-
Notifications
You must be signed in to change notification settings - Fork 619
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
Add cli to submit gov proposal to upgrade multiple channels #5548
Add cli to submit gov proposal to upgrade multiple channels #5548
Conversation
msgUpgradeInit := types.NewMsgChannelUpgradeInit(ch.PortId, ch.ChannelId, types.NewUpgradeFields(ch.Ordering, ch.ConnectionHops, versionStr), clientCtx.GetFromAddress().String()) | ||
msgs = append(msgs, msgUpgradeInit) |
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 left ordering and connection hops unchanged, and only the version string changes. Technically we can allow these fields to be updated, but I think the version string will be all that we need 99% of the time. As far as bulk creating MsgChanUpgradeInit
s is concerned
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.
Thank you @chatton! Looks great to me!
Use: "upgrade-channels", | ||
Short: "Upgrade IBC channels", | ||
Long: `Submit a governance proposal to upgrade all open channels whose port matches a specified pattern | ||
(the default is transfer), optionally, specific an exact list of channel IDs with a comma separated list.`, |
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 default is transfer), optionally, specific an exact list of channel IDs with a comma separated list.`, | |
(the default is transfer), optionally, an exact list of comma separated channel IDs may be specified.`, |
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.
should we specify in this docstring that if channel IDs are specified then it must match the specified port? or leave that for the longer documentation?
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.
just one doc related comment, thanks @chatton!
Use: "upgrade-channels", | ||
Short: "Upgrade IBC channels", | ||
Long: `Submit a governance proposal to upgrade all open channels whose port matches a specified pattern | ||
(the default is transfer), optionally, specific an exact list of channel IDs with a comma separated list.`, |
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.
should we specify in this docstring that if channel IDs are specified then it must match the specified port? or leave that for the longer documentation?
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.
Thank you for the quick turnaround, @chatton! I just left a suggestion to maybe simplify some code.
depositStr := args[0] | ||
versionStr := args[1] | ||
|
||
metadata, err := cmd.Flags().GetString(flagMetadata) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
summary, err := cmd.Flags().GetString(flagSummary) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
title, err := cmd.Flags().GetString(flagTitle) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
portPattern, err := cmd.Flags().GetString(flagPortPattern) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
commaSeparatedChannelIDs, err := cmd.Flags().GetString(flagChannelIDs) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
displayJSON, err := cmd.Flags().GetBool(flagJSON) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
expidited, err := cmd.Flags().GetBool(flagExpedited) | ||
if err != nil { | ||
return err | ||
} |
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 think we can maybe simplify all this code about the gov flags with a call ReadGovPropFlags
like here, including the deposit parameter. And that function will return us a govv1.MsgSubmitProposal
where we can add the messages.
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.
yea, could also add AddGovPropFlagsToCmd
though we do set a sensible default here so fine either way (maybe add and override default value?)
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.
great suggestions, will implement these.
return cmd | ||
} | ||
|
||
// channelShouldBeUpgraded returns a boolean indicated whether or not the given channel should be upgraded based |
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.
// channelShouldBeUpgraded returns a boolean indicated whether or not the given channel should be upgraded based | |
// channelShouldBeUpgraded returns a boolean indicating whether or not the given channel should be upgraded based |
I think we can leave this for the longer docs |
@@ -50,7 +50,8 @@ func NewTxCmd() *cobra.Command { | |||
} | |||
|
|||
txCmd.AddCommand( | |||
NewPruneAcknowledgementsTxCmd(), | |||
newUpgradeChannelsTxCmd(), |
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.
unexported this to stay consistent, I don't think this needs to be exported.
(cherry picked from commit 11b301b)
Description
closes: #5540
This PR adds a CLI to which queries all channels, and allows for specifying a pattern for the portID, and an optional comma separated list for channelIDs which will either generate a
proposal.json
file which containsMsgChanUpgradeInit
s, or actually broadcast aMsgSubmitProposal
directly.--dry-run
will behave the same way as--json
.I can add documentation in a follow up if this approach gets merged.
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
).godoc
comments.Files changed
in the Github PR explorer.Codecov Report
in the comment section below once CI passes.