-
Notifications
You must be signed in to change notification settings - Fork 71
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
Use cosmos plugin to generate proof proto files for compatibility with SDK #33
Conversation
@aaronc could you please review these changes to ensure they are correct 🙏 |
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.
No changes to the .proto file?
Please check if this works for you or if you need more changes. The go codec is tuned for the cosmos sdk. I just want to ensure the other languages still work with the proto file, which this did not modify
protoc --gogofaster_out=. $(PROTOC_FLAGS) ../proofs.proto | ||
protoc --gocosmos_out=plugins=interfacetype+grpc,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types:. $(PROTOC_FLAGS) ../proofs.proto | ||
|
||
install-proto-dep: |
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.
Thanks to add that
yea so this issue #32 can't be addressed without some package name changes. Protocol Buffers specifies that: The go_package option defines the import path of the package which will contain all the generated code for this file. The Go package name will be the last path component of the import path. In the SDK we need to use ProofSpecs as a field in a proto generated type. We pull the proto files from here and put them in our If I add that same option to the proofs file here directly and generate the files, the build won't work because the package name will be Basically to solve this either
Either solution is fine with me, but I figured I'd start by addressing the issue that would be blocking our development (the proofs.pb.go file needs to be generated using the same plugin as the SDK). |
The current changes work and are all we really need at the moment. What I mentioned above could be trivially addressed later |
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.
LGTM from what I can see although the gogo proto usage is only necessary if you are using gRPC or certain extensions (just castrepeated I believe). It doesn't hurt to use it though.
@colin-axner I'm trying to figure out the import comment, and do understand this is a major pain for you.
It is a bit confusing trying to keep 3 languages in one repo, but I see it as the only way to make sure they all stay in sync and maintained. I do not want to have one folder with 3 different languages mixed. If needed for the go imports, I guess we could generate the |
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 good, hope this helps your integration
I don't think so. I think the For now on the SDK I've just added a |
Ah, I just released |
While working on client-migration I found out the the proofs.pb.go is not compatible with the plugin used on the SDK, this can be replicated by checking out the lastest commit of this pr and trying to build. The error will be:
this occurs because the plugin used by the SDK to generate the
ClientState
which contains theics23.ProofSpecs
uses functions not defined by the generated proto files that create these proof specs. There are two possible fixes for this:This pr goes with the second approach since the golang ProofSpecs were implemented for SDK usage
I have updated the Makefile to generate the proofs file in the same way the SDK does. I tested that this works locally and this can be seen looking at the build of my branch with this fix, The above error is no longer occurs (the build is broken for many other unrelated reasons).
I based the Makefile changes off how the SDK does this, here is the reason for the install section and here is for the protoc changes
cc/ @ethanfrey @fedekunze