-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat(gov): support v1.Proposal in v1beta1.Proposal.Content #14347
Conversation
Adding backports to 0.46 and 0.47, but maybe we will need to make it manually , because the directory names changed. |
return legacyProposal, nil | ||
// hack to fill up the content with the first message | ||
legacyProposal.Content, err = codectypes.NewAnyWithValue(msgs[0]) | ||
|
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.
The first idea I had, was to create a simple message:
message BasicContent {
string title = 1;
string description = 2 ;
}
and fill it using the Content
interface. But, then we will remove additional attributes, which are in fact used by explorers to display the full content (I verified that with ping pub).
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.
I agree, the current way you have is best imo.
Can we add a NotEmpty / Equal check in tests? |
@julienrbrt what do you mean? |
I just mean adding a test in here: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/migrations/v3/convert_test.go, to check content is properly set. |
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, can we add a changelog too?
Co-authored-by: Julien Robert <julien@rbrt.fr>
[Cosmos SDK] Kudos, SonarCloud Quality Gate passed! |
Added an error when amount of messages in v1.Proposal is different than one. The conversion (and the endpoint) will fail in that case. |
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
(cherry picked from commit 330ff5f) # Conflicts: # CHANGELOG.md
(cherry picked from commit 330ff5f) # Conflicts: # CHANGELOG.md # x/gov/migrations/v3/convert.go # x/gov/migrations/v3/convert_test.go
@Mergifyio backport release/v0.47.x |
✅ Backports have been created
|
@@ -46,6 +48,9 @@ func ConvertToLegacyProposal(proposal v1.Proposal) (v1beta1.Proposal, error) { | |||
if err != nil { | |||
return v1beta1.Proposal{}, err | |||
} | |||
if len(msgs) != 1 { | |||
return v1beta1.Proposal{}, sdkerrors.ErrInvalidType.Wrap("can't convert a gov/v1 Proposal to gov/v1beta1 Proposal when amount of proposal messages is more than one") | |||
} | |||
for _, msg := range msgs { |
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.
The for loop isn't needed anymore
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.
yes... too late :/ Is it worth to create another PR?
Description
Closes: #14334
Strawman solution to handle
gov/v1
proposals ingov/v1beta1.Proposal.Content
required for existing explorers (mintscan, ping pub, kepler) and wallets.I tested it locally in Umee and local, with various proposals (including sofware upgrade, custom proposals, params...)
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change