You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replaces buf generate by tonic_build to generate rust code from protobuf.
Background
buf generate relies on the third party plugins protoc-gen-prost and protoc-gen-tonic, which are not yet updated to prost-build 0.12 and tonic-build 0.10 (and hence prost 0.12, tonic 0.10).
This patch moves code generation away from the buf generate executable to the Rust tonic-build crate, because we need to update prost/tonic and because these projects do not guarantee that code generated with older versions work with newer versions.
Changes
Replace invoking the buf generate executable by using tonic_build directly
Use buf build to create a file descriptor set that can be fed into tonic_build (the latter skips its own invocation of protoc)
Clean the generated code by removing all files that are not prefixed with astria. (tonic also creates client and server code for tendermint abci; I am not sure why, probably due to the descriptor set)
Testing
Not tested directly; this should not affect the actual code generated. Everything should still compile, all tests should pass.
Related Issues
PR requiring a newer version of penumbra and hence prost: #579
looks good! so are we still using buf for handling dependencies, but tonic for the actual build?
Yeah, so buf fetches the the tendermint protos as defined in astria-proto/proto/buf.yaml. and then compiles our protos + the tendermint protos it just pulled, emitting a file descriptor set. We then feed this set into tonic-build.
My understanding is that tonic-build would usually invoke protoc, which would also result in that file descriptor set. But we .skip_protoc() because we want buf to deal with proto-dependecy resolution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
buf generatebytonic_buildto generate rust code from protobuf.Background
buf generaterelies on the third party pluginsprotoc-gen-prostandprotoc-gen-tonic, which are not yet updated to prost-build 0.12 and tonic-build 0.10 (and hence prost 0.12, tonic 0.10).This patch moves code generation away from the
buf generateexecutable to the Rusttonic-buildcrate, because we need to update prost/tonic and because these projects do not guarantee that code generated with older versions work with newer versions.Changes
buf generateexecutable by usingtonic_builddirectlybuf buildto create a file descriptor set that can be fed intotonic_build(the latter skips its own invocation ofprotoc)astria.(tonic also creates client and server code for tendermint abci; I am not sure why, probably due to the descriptor set)Testing
Not tested directly; this should not affect the actual code generated. Everything should still compile, all tests should pass.
Related Issues
PR requiring a newer version of penumbra and hence prost: #579
PR againast protoc-gen-prost: neoeinstein/protoc-gen-prost#78