Skip to content
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

Support codegen for penumbra.client.v1alpha1 RPC methods #658

Closed
conorsch opened this issue Jul 7, 2023 · 2 comments
Closed

Support codegen for penumbra.client.v1alpha1 RPC methods #658

conorsch opened this issue Jul 7, 2023 · 2 comments

Comments

@conorsch
Copy link
Contributor

conorsch commented Jul 7, 2023

In pursuit of #644, we've been using the generated go code from Penumbra's Buf Build repo, same as done in the relayer. Recently, however, we have a need to use the penumbra.client.v1alpha1.* RPC methods, and have been unable to do so.

Steps to reproduce

  1. Clone the interchaintest repo
  2. Check out branch andrew/penumbra_pclientd (last tested on commit df5bf4c).
  3. Run go test -v examples/penumbra/penumbra_chain_test.go
  4. Observe error:
# github.com/strangelove-ventures/interchaintest/v7/chain/penumbra/client/v1alpha1
chain/penumbra/client/v1alpha1/client.pb.go:8561:35: m.LatestBlockTime.MarshalToSizedBuffer undefined (type *timestamppb.Timestamp has no field or method MarshalToSizedBuffer)
chain/penumbra/client/v1alpha1/client.pb.go:9955:25: m.LatestBlockTime.Size undefined (type *timestamppb.Timestamp has no field or method Size)
chain/penumbra/client/v1alpha1/client.pb.go:17554:32: m.LatestBlockTime.Unmarshal undefined (type *timestamppb.Timestamp has no field or method Unmarshal)
FAIL    command-line-arguments [build failed]
FAIL

Notably we don't have this problem in the relayer codegen because we selectively remove the client subdir post-generation:

https://github.com/cosmos/relayer/blob/91f910512e770a58ce2cf152aaa1445e97125377/scripts/protocgen.sh#L24

That was OK in the relayer, because we weren't using the client methods, but we need them in interchaintest today, and likely will in the relayer at a subsequent date. So we need to dig into the root cause and find a fix. The relevant buf build specs for Penumbra can be found here: https://github.com/penumbra-zone/penumbra/tree/v0.55.0/proto

@conorsch
Copy link
Contributor Author

My intuition is that this field needs a type change: https://github.com/penumbra-zone/penumbra/blob/v0.55.0/proto/penumbra/penumbra/client/v1alpha1/client.proto#L521 Note that the google.protobuf.Timestamp type is already transformed by pbjson in Penumbra's proto build process https://github.com/penumbra-zone/penumbra/blob/v0.55.0/tools/proto-compiler/src/main.rs#L48-L49

@conorsch
Copy link
Contributor Author

We have a solution, thanks to @jtieri:

--- a/proto/buf.gen.penumbra.yaml
+++ b/proto/buf.gen.penumbra.yaml
@@ -10,4 +10,4 @@ managed:
 plugins:
   - name: gocosmos
     out: .
-    opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
\ No newline at end of file
+    opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mgoogle/protobuf/timestamp.proto=github.com/cosmos/gogoproto/types
\ No newline at end of file

Note that the google.protobuf.Timestamp type is already transformed by pbjson in Penumbra's proto build process https://github.com/penumbra-zone/penumbra/blob/v0.55.0/tools/proto-compiler/src/main.rs#L48-L49

My understanding is that's a red herring for the present context, given that the pbjson/proto-compiler tooling should only affect generated Rust code, not generated Go code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant