-
Notifications
You must be signed in to change notification settings - Fork 586
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(ica/host)!: migrate ICA host params to be self managed #3520
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3520 +/- ##
==========================================
- Coverage 78.80% 78.75% -0.05%
==========================================
Files 182 186 +4
Lines 12689 12744 +55
==========================================
+ Hits 9999 10036 +37
- Misses 2258 2276 +18
Partials 432 432
|
modules/apps/27-interchain-accounts/host/migrations/v8/migrations.go
Outdated
Show resolved
Hide resolved
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { | ||
return paramtypes.ParamSetPairs{ | ||
paramtypes.NewParamSetPair(KeyHostEnabled, p.HostEnabled, validateEnabledType), | ||
paramtypes.NewParamSetPair(KeyAllowMessages, p.AllowMessages, validateAllowlistLegacy), |
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.
paramtypes.NewParamSetPair(KeyAllowMessages, p.AllowMessages, validateAllowlistLegacy), | |
paramtypes.NewParamSetPair(KeyAllowMessages, &p.AllowMessages, validateAllowlistLegacy), |
This code should fail during migration unless you use referencing &
here. I know because I did the same mistake before. The reason why we both made this mistake was because the original was missing the references.
You would've ran into this error if you wrote migration tests (they would've failed). You should write migration tests. You can use this as an example.
I'm surprised that the e2e tests are passing though as you should be needing to use the new governance proposal to have them update. Did these tests not exist before?
modules/apps/27-interchain-accounts/host/types/params_legacy.go
Outdated
Show resolved
Hide resolved
modules/apps/27-interchain-accounts/host/types/params_legacy.go
Outdated
Show resolved
Hide resolved
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.
Imo, it makes more sense for these functions to be in keeper.go
instead.
Remove the IsHostEnabled
function all together, imo, it is wrong to return false if there is a problem unmarshalling. This case should be handled in GetParams
, it seems like you're re-implementing GetParams
, unnecessary code duplication
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.
You should register the new message in types/codec.go
(which you need to create)
testing/simapp/app.go
Outdated
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.
You should also initialise the key table for migration in line 915. See example here
…d' and 'GetAllowMessages' functions
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 @aleem1314! Really cool that you picked up this work for us 🙏 I left various comments and only had time to review half the pr, I will hopefully pick up my review soon
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 work, @aleem1314! I just left a few nits.
|
||
hostm := hostkeeper.NewMigrator(am.hostKeeper) | ||
if err := cfg.RegisterMigration(types.ModuleName, 2, hostm.MigrateParams); err != nil { | ||
panic(fmt.Sprintf("failed to migrate interchainaccounts host params from version 2 to 3: %v", 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.
Since we will probably migrate together both controller and host params, maybe we can do something here to bump the version only once. But maybe we can deal with that in a later PR after merging also the migration of the controller params.
panic(fmt.Sprintf("failed to migrate interchainaccounts host params from version 2 to 3: %v", err)) | |
panic(fmt.Sprintf("failed to migrate interchainaccounts app from version 2 to 3: %v", 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.
done, decided to increase the version now, I assumed the two would be done together but this is safer
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.
Yep, the migration handler can be configured like this with an anonymous function
if err := cfg.RegisterMigration(types.ModuleName, 2, func(ctx sdk.Context) error {
if err := hostMigrator.MigrateParams(ctx); err != nil {
return err
}
if err := controllerMigrator.MigrateParams(ctx); err != nil {
return err
}
}); err != nil {
panic(fmt.Sprintf("failed to migrate interchainaccounts app from version 2 to 3: %v", 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.
this can be done later, lgtm
modules/apps/27-interchain-accounts/host/keeper/msg_server_test.go
Outdated
Show resolved
Hide resolved
modules/apps/27-interchain-accounts/host/keeper/genesis_test.go
Outdated
Show resolved
Hide resolved
modules/apps/27-interchain-accounts/host/keeper/genesis_test.go
Outdated
Show resolved
Hide resolved
modules/apps/27-interchain-accounts/host/keeper/genesis_test.go
Outdated
Show resolved
Hide resolved
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 @aleem1314 for your work on this, and @srdtrk for seeing it to completion
I almost forgot, we need a note in the migration doc for the breaking change in app.go. It should be pretty short with a small diff noting that the authority needs to be added |
} | ||
|
||
// MsgUpdateParams defines the payload for Msg/UpdateParams | ||
message MsgUpdateParams { |
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.
ah, also, since this is a new file, adding the message signer option or else we'll totally miss it after #3627
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.
Shouldn't their PRs take care of these when their PR is merging. If I implement it now, it can be confusing. Even if they have to manually resolve the merge conflict. I think it should be fine?
Edit: I misunderstood. I think I will make these additions as commits to that PR, not here. I will be mindful of this in future PRs after their PRs are merged.
import "ibc/applications/interchain_accounts/host/v1/host.proto"; | ||
|
||
// Msg defines the 27-interchain-accounts/host Msg service. | ||
service Msg { |
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.
and the equivalent one for services
#3630
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.
Shouldn't their PRs take care of these when their PR is merging. If I implement it now, it can be confusing. Even if they have to manually resolve the merge conflict. I think it should be fine?
Edit: I misunderstood. I think I will make these additions as commits to that PR, not here
Description
With this PR:
ica/host
submodule now self-manages its parameters.ica/host
submodule's parameters.x/params
' subspace to theica/host
submodule's keeper.closes: #3504
addresses: #2010
Commit Message / Changelog Entry
see the guidelines for commit messages. (view raw markdown for examples)
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.