feat(ica/host)!: migrate ICA host params to be self managed#3520
feat(ica/host)!: migrate ICA host params to be self managed#3520srdtrk merged 75 commits intocosmos:mainfrom
Conversation
Codecov Report❌ Patch coverage is 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
🚀 New features to boost your workflow:
|
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.
| 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.
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.
You should register the new message in types/codec.go (which you need to create)
There was a problem hiding this comment.
You should also initialise the key table for migration in line 915. See example here
…d' and 'GetAllowMessages' functions
colin-axner
left a comment
There was a problem hiding this comment.
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
crodriguezvega
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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
damiannolan
left a comment
There was a problem hiding this comment.
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.
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.
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.
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/hostsubmodule now self-manages its parameters.ica/hostsubmodule's parameters.x/params' subspace to theica/hostsubmodule'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/).godoccomments.Files changedin the Github PR explorer.Codecov Reportin the comment section below once CI passes.