graphprotocol / graphprotocol/graph-node
Stop generating Protobuf Rust bindings on `build.rs`
Personne n'a encore pris cette issue.
- Langage dominant
- Rust
- Étoiles
- 3.2k
- Forks
- 1.1k
- Merge moyen
- 4 j 1 h
- PR mergées (30 j)
- 1
Description
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Right now, Protobuf Rust bindings are generated via build.rs in the Cargo build pipeline. However, the Protobuf definitions are updated quite infrequently. The current build process imposes some constraints on people that want to build graph-node as they require the full toolchain to compile Protobuf to Rust so valid protoc, seems that rustfmt was required also. Lot's of issue recently (like #4240) were having problem building due to incorrect protoc version.
What is the expected behavior?
Protobuf Rust bindings generation should be an ad-hoc task that is done manually by the developer when the Protobuf definition changes. This way, only then the toolchain is required and everyone else don't need to care about this.
Some ideas (could be "mixed" together):
- Using https://buf.build (could even think about using remote worker)
- Create a bash script that invokes the required commands, this is how we work in firehose-XXXX chain like (see https://github.com/streamingfast/firehose-ethereum/blob/develop/types/pb/generate.sh#L22)
- Having a dedicated crate in Rust that invokes tonic build, this is how we do it today in
near-firehose-indexer(see https://github.com/streamingfast/near-firehose-indexer) - Do some of the following but use https://github.com/matklad/cargo-xtask to integrate into a specific cargo task to run
cargo protogensomething like that.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par examiner le build.rs existant et le pipeline de build de Cargo qui génèrent les bindings Rust de Protobuf. Comparez les approches proposées, qu’elles soient manuelles, basées sur un script ou fondées sur une tâche dédiée, puis définissez comment les bindings sont régénérés lorsque les définitions changent et vérifiez que les builds normaux de graph-node ne nécessitent plus la toolchain Protobuf.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- rust
- Domaine
- build-system, developer-experience
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100