-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: ditch proto-compiler, use buf #2619
Conversation
3e346a4
to
b90f613
Compare
b90f613
to
9ed2138
Compare
9ed2138
to
011e5b3
Compare
@conorsch Question in re: #2184 (comment) : is there any other regression other than the reflection data not being updated? If not, I think it could be good to merge this now, so that we don't generate conflicts with other changes to |
So far, so good. I'll get this cleaned up and RFR today, then circle back on the reflection! |
011e5b3
to
374cb1f
Compare
Overhauls the protobuf codegen by standardizing on `buf`, along with associated tooling like `protoc-gen-prost` and `proto-gen-tonic`. The output dirs for the supported langs are now: * Rust: ./crates/proto/src/gen/ * Go: ./proto/go/gen/ We've removed the proto-compiler tool from the repo. Also, we no longer vendor upstream protos by committing directly to our repo; instead, we declare dependencies in the buf yaml files and offload the resolution to `buf generate`. One major regression is that gRPC server reflection no longer works. These changes remove the `proto_descriptor.bin` build.rs logic, with no replacement in the new buf logic. As of right now, preview supports reflection: ❯ grpcurl grpc.testnet-preview.penumbra.zone:443 list cosmos.base.tendermint.v1beta1.Service grpc.reflection.v1alpha.ServerReflection penumbra.client.v1alpha1.ObliviousQueryService penumbra.client.v1alpha1.SpecificQueryService penumbra.client.v1alpha1.TendermintProxyService penumbra.custody.v1alpha1.CustodyProtocolService penumbra.narsil.ledger.v1alpha1.LedgerService penumbra.view.v1alpha1.ViewAuthService penumbra.view.v1alpha1.ViewProtocolService but this code does not: ❯ grpcurl -plaintext localhost:8080 list Failed to list services: server does not support the reflection API We'll circle back on reflection support. Notably the tonic rpc defs are now in their own files, a side-effect of using the `prost-gen-tonic` plugin for buf. The original proto files, without the `.tonic.proto` suffix, now automatically `include!` their tonic neighbors, so the interface hasn't changed. Refs #2184.
374cb1f
to
b35aef5
Compare
The CI check for breaking changes in buf is failing, reporting a single change to the TM types, due to the switch from vendoring to dynamic dependency resolution. Running locally, I see:
Indeed, on
Whereas on this branch, there's only the one casing:
Our code compiles fine, so I think we can disregard this as a blocker. |
Regarding testing to ensure we don't have regressions (other than disabling gRPC server reflection support), I compared the output from |
@@ -33,7 +33,7 @@ jobs: | |||
- name: Check for breaking changes | |||
uses: bufbuild/buf-breaking-action@v1 | |||
with: | |||
input: 'crates/proto' | |||
input: 'proto' | |||
# The 'main' branch of the GitHub repository that defines the module. | |||
against: 'https://github.com/${GITHUB_REPOSITORY}.git#branch=main,subdir=crates/proto' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B. the against
line should be updated post-merge, but is accurate as of right now, showing us potentially breaking changes in the CI output of this PR.
.add_service(tonic_web::enable( | ||
tonic_reflection::server::Builder::configure() | ||
.register_encoded_file_descriptor_set( | ||
penumbra_proto::FILE_DESCRIPTOR_SET, | ||
) | ||
.build() | ||
.with_context(|| "could not configure grpc reflection service")?, | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make a follow-up issue to restore grpc reflection, and copy this code snippet into the issue description, so that we don't lose track of it once it's deleted.
/// Encoded file descriptor set for the `penumbra.core.transparent_proofs.v1alpha1` package | ||
pub const FILE_DESCRIPTOR_SET: &[u8] = &[ | ||
0x0a, 0xe1, 0x0b, 0x0a, 0x42, 0x70, 0x65, 0x6e, 0x75, 0x6d, 0x62, 0x72, 0x61, 0x2f, 0x63, 0x6f, | ||
0x72, 0x65, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70, | ||
0x72, 0x6f, 0x6f, 0x66, 0x73, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x74, | ||
0x72, 0x61, 0x6e, 0x73, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀 Looks like the new setup is putting the file descriptor set in the output directly?
Follow-up post-merge to changes in #2619.
Follow-up post-merge to changes in #2619.
Follow-up post-merge to changes in #2619.
The overhaul of the protobuf codegen logic from #2619 was incomplete: we encountered problems with serde implementations. Wasn't able to sort them quickly, and we're about to release Testnet 53, so I'm backing out the recent changes to unblock in-flight PRs. Will return to disentangling the protobuf story on subsequent sprint. Revert "fix: re-enable grpc server reflection" This reverts commit f8d09f6. Revert "ci: update buf target dir" This reverts commit 3e7b4c7. Revert "dev: add buf breaking change detection" This reverts commit 724ccf6. Revert "ci: eliminate the chore of buf mod update" This reverts commit 1f28bb2. Revert "build: ditch proto-compiler, use buf" This reverts commit 53b56cb.
The overhaul of the protobuf codegen logic from #2619 was incomplete: we encountered problems with serde implementations. Wasn't able to sort them quickly, and we're about to release Testnet 53, so I'm backing out the recent changes to unblock in-flight PRs. Will return to disentangling the protobuf story on subsequent sprint. Revert "fix: re-enable grpc server reflection" This reverts commit f8d09f6. Revert "ci: update buf target dir" This reverts commit 3e7b4c7. Revert "dev: add buf breaking change detection" This reverts commit 724ccf6. Revert "ci: eliminate the chore of buf mod update" This reverts commit 1f28bb2. Revert "build: ditch proto-compiler, use buf" This reverts commit 53b56cb.
Overhauls the protobuf codegen by standardizing on
buf
, along with associated tooling likeprotoc-gen-prost
andproto-gen-tonic
. The output dirs for the supported langs are now:./crates/proto/src/gen/
./proto/go/gen/
We've removed the proto-compiler tool from the repo. Also, we no longer vendor upstream protos by committing directly to our repo; instead, we declare dependencies in the buf yaml files and offload the resolution to
buf generate
.One major regression is that gRPC server reflection no longer works. These changes remove the
proto_descriptor.bin
build.rs logic, with no replacement in the new buf logic. As of right now, preview supports reflection:but this code does not:
We'll circle back on reflection support.
Notably the tonic rpc defs are now in their own files, a side-effect of using the
prost-gen-tonic
plugin for buf. The original proto files, without the.tonic.proto
suffix, now automaticallyinclude!
their tonic neighbors, so the interface hasn't changed.Refs #2184.