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

Require cosmos.msg.v1 annotations #13405

Closed
Tracked by #13310
aaronc opened this issue Sep 27, 2022 · 5 comments · Fixed by #13793
Closed
Tracked by #13310

Require cosmos.msg.v1 annotations #13405

aaronc opened this issue Sep 27, 2022 · 5 comments · Fixed by #13793
Assignees
Labels
C: Proto Proto definition and proto release

Comments

@aaronc
Copy link
Member

aaronc commented Sep 27, 2022

Summary

Require valid cosmos.msg.v1.signer and cosmos.msg.v1.service annotations so that dynamic clients can rely on them.

Problem Definition

In #10977, @fdymylja added the cosmos.msg.v1.signer proto option but had to remove the logic which makes the field required (#10977 (comment)) because of some complexities with the gogo proto global registry and the work was never finished.

In #13178, the cosmos.msg.v1.service option was added which allows clients to dynamically distinguish Msg and Query services.

If we can ensure that these options are consistently applied, then clients will know:

  • which fields of a Msg need to be signed
  • which services are used to make transactions and which are used for queries

These .proto options can be leveraged in the future by the Cosmos SDK framework itself in order to simplify service registration and ADR 033 clients as described in #12972. Also the sdk.Msg type itself can be simplified with cosmos.msg.v1.signer which will allow Msg.GetSigners to be removed and take us much closer to removing bech32 globals (#9690).

Proposal

Implement validation logic that runs when Msg services are registered that:

  • checks that all sdk.Msg types have a valid cosmos.msg.v1.signer annotation
  • checks that all Msg services are annotated with cosmos.msg.v1.service

We can access the full gogo proto registry with the functionality add to our fork in cosmos/gogoproto#13. The original validation work that had been started in #10977 can be found at https://github.com/cosmos/cosmos-sdk/blob/7e0c199b61349f226cdbabf4b1cfcabc911390ff/types/module/assert_signers.go.

@alexanderbez alexanderbez added the C: Proto Proto definition and proto release label Sep 27, 2022
@amaury1093
Copy link
Contributor

amaury1093 commented Oct 19, 2022

We can make this issue as the whole "cosmos.msg.v1" validation issue, which means also adding validation for the newyl added Amino annotations too #13407, ref #13501 (review)

I can work on a PR that does all validations at once.

@aaronc
Copy link
Member Author

aaronc commented Oct 19, 2022

We can make this issue as the whole "cosmos.msg.v1" validation issue, which means also adding validation for the newyl added Amino annotations too #13407, ref #13501 (review)

I can work on a PR that does all validations at once.

Great thank you 🙏

@aaronc
Copy link
Member Author

aaronc commented Oct 19, 2022

Can we validate that amino annotations match what's registered in the amino codec and struct field tags? That would be great because it will allow easy, clean deprecation of amino registration soon

@amaury1093
Copy link
Contributor

That's what I'd like to explore too. The validation will start from the pulsar types, to be able to read annotations easily. The challenge is to get the associated gogo generated reflect.Type, which is used by go-amino's registry. Probably there's a way to do this by going throuhg our interfaceRegistry.

@ethanfrey ethanfrey mentioned this issue Nov 4, 2022
54 tasks
@amaury1093 amaury1093 self-assigned this Nov 8, 2022
@amaury1093 amaury1093 moved this from 📝 Todo to 💪 In Progress in Cosmos-SDK Nov 8, 2022
@amaury1093 amaury1093 moved this to 📝 Todo in Cosmos-SDK Nov 8, 2022
@amaury1093
Copy link
Contributor

amaury1093 commented Jan 18, 2023

I'll actually down-scope this issue to only tackle cosmos.msg.v1.signer and cosmos.msg.v1.service, as initially written in the first post, because they are easier.

I created another issue for the amino.name annotations #14682.

@amaury1093 amaury1093 moved this from 💪 In Progress to 👀 Needs Review in Cosmos-SDK Mar 8, 2023
@github-project-automation github-project-automation bot moved this from 👀 Needs Review to 👏 Done in Cosmos-SDK Mar 20, 2023
@tac0turtle tac0turtle removed this from Cosmos-SDK May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Proto Proto definition and proto release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@aaronc @amaury1093 @alexanderbez @tac0turtle and others