graphprotocol / graphprotocol/graph-node
Stop generating Protobuf Rust bindings on `build.rs`
Nessuno ha ancora preso questa issue.
- Lingua principale
- Rust
- Stelle
- 3.2k
- Fork
- 1.1k
- Merge medio
- 4g 1h
- PR unite (30g)
- 1
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia ispezionando il build.rs esistente e la pipeline di build di Cargo che generano i binding Rust di Protobuf. Confronta gli approcci proposti, manuali, basati su script o su un task dedicato, quindi definisci come rigenerare i binding quando cambiano le definizioni e verifica che le build normali di graph-node non richiedano più la toolchain Protobuf.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- build-system, developer-experience
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100