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

fix(group)!: Register types with Amino #13592

Merged
merged 4 commits into from
Oct 19, 2022
Merged

fix(group)!: Register types with Amino #13592

merged 4 commits into from
Oct 19, 2022

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Oct 19, 2022

Description

In v0.46, we forgot to register amino types on the group's AppModule interface.

This results in group Msgs not rendering correctly for amino-json: #13592 (comment)

This is a state-machine breaking change if the chain uses group with amino. We should decide if we backport it with clear instructions, of just wait for 0.47. I prefer the latter.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

out, err := cdc.Amino.MarshalJSON(group.MsgSubmitProposal{Proposers: []string{member1.String()}})
require.NoError(t, err)
require.Equal(t,
`{"type":"cosmos-sdk/group/MsgSubmitProposal","value":{"proposers":["cosmos1d4jk6cn9wgcsj540xq"]}}`,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whereas on v0.46, we have:

{"proposers":["cosmos1d4jk6cn9wgcsj540xq"]}

@amaury1093 amaury1093 changed the title fix!(group): Register types with Amino fix(group)!: Register types with Amino Oct 19, 2022
@amaury1093 amaury1093 added the T: State Machine Breaking State machine breaking changes (impacts consensus). label Oct 19, 2022
@amaury1093 amaury1093 marked this pull request as ready for review October 19, 2022 11:19
@amaury1093 amaury1093 requested a review from a team as a code owner October 19, 2022 11:19
@codecov
Copy link

codecov bot commented Oct 19, 2022

Codecov Report

Merging #13592 (1eda1c7) into main (10ac33e) will decrease coverage by 1.07%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #13592      +/-   ##
==========================================
- Coverage   55.78%   54.70%   -1.08%     
==========================================
  Files         692      645      -47     
  Lines       59931    55692    -4239     
==========================================
- Hits        33431    30465    -2966     
+ Misses      23666    22739     -927     
+ Partials     2834     2488     -346     
Impacted Files Coverage Δ
x/group/module/module.go 52.50% <100.00%> (+0.60%) ⬆️
x/group/keeper/keeper.go 56.25% <0.00%> (-0.40%) ⬇️
tx/textual/valuerenderer/bytes.go
orm/model/ormtable/auto_increment.go
orm/model/ormtable/util.go
orm/internal/stablejson/encode.go
orm/encoding/ormkv/key_codec.go
orm/encoding/ormfield/codec.go
orm/encoding/ormfield/enum.go
math/int.go
... and 39 more

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its unclear to me if we miss these or choose not to include them? does it make sense to do some ast tool in order to verify things are right?

@amaury1093
Copy link
Contributor Author

I think we simply missed them. It's better to have the type information.

Re AST tool: We now add amino annoations on proto Msgs. We could add validations based on those. One simple validation I'm thinking is that 1/ all proto Msg has an amino annotation and 2/ the annotation value is equal to the one we registered inside go-amino (and in a later phase 3/ the output of go-amino is the same as our new proto-based amino encoder)

@amaury1093 amaury1093 enabled auto-merge (squash) October 19, 2022 12:26
@amaury1093 amaury1093 merged commit 9a9e5b5 into main Oct 19, 2022
@amaury1093 amaury1093 deleted the am/group-amino-2 branch October 19, 2022 13:16
@julienrbrt
Copy link
Member

@Mergifyio backport release/v0.46.x

mergify bot pushed a commit that referenced this pull request Nov 30, 2022
* fix!(group): Register types with Amino

* Chagenlog

(cherry picked from commit 9a9e5b5)

# Conflicts:
#	CHANGELOG.md
#	x/group/msgs_test.go
@mergify
Copy link
Contributor

mergify bot commented Nov 30, 2022

backport release/v0.46.x

✅ Backports have been created

ryanchristo pushed a commit to regen-network/cosmos-sdk that referenced this pull request Dec 14, 2022
* fix!(group): Register types with Amino

* Chagenlog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/group T: State Machine Breaking State machine breaking changes (impacts consensus).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants