graphprotocol / graphprotocol/graph-node
Stop generating Protobuf Rust bindings on `build.rs`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 1.1k
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the existing build.rs and Cargo build pipeline that generate the Protobuf Rust bindings. Compare the proposed manual, script-based, or dedicated-task approaches, then define how bindings are regenerated when definitions change and verify that normal graph-node builds no longer require the Protobuf toolchain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100