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

feat(app)!: add ICA Host module with enabled false #1441

Merged
merged 10 commits into from
Sep 1, 2022

Conversation

technicallyty
Copy link
Contributor

@technicallyty technicallyty commented Aug 30, 2022

Description

  • adds interchain accounts

TODO: do we want to setup the parameters manually in the upgrade, allowing us to enable ICA right off the bat with some predefined allowed messages, or should we it be initialized as an empty module and let governance enable/add messages?

governance can enable and set the messages to be available for host chain execution.

Additionally, some tests/refactoring can be added to ensure this works in #1440

Closes: #1328


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)

@technicallyty technicallyty marked this pull request as ready for review August 30, 2022 19:10
@technicallyty technicallyty requested a review from a team August 30, 2022 19:10
@technicallyty technicallyty changed the title feat: add interchain accounts module and upgrade feat(app)!: add interchain accounts module and upgrade Aug 30, 2022
@codecov
Copy link

codecov bot commented Aug 30, 2022

Codecov Report

Merging #1441 (615943e) into main (d2bc473) will decrease coverage by 0.07%.
The diff coverage is 53.57%.

@@            Coverage Diff             @@
##             main    #1441      +/-   ##
==========================================
- Coverage   78.45%   78.37%   -0.08%     
==========================================
  Files         238      238              
  Lines       18448    18494      +46     
==========================================
+ Hits        14473    14495      +22     
- Misses       3130     3154      +24     
  Partials      845      845              
Impacted Files Coverage Δ
app/appconfig.go 23.33% <0.00%> (ø)
app/app.go 93.04% <100.00%> (+0.36%) ⬆️

@technicallyty technicallyty changed the title feat(app)!: add interchain accounts module and upgrade feat(app)!: add interchain accounts module Aug 30, 2022
Comment on lines +55 to +71
// removeICAFromSimulation is a utility function that removes from genesis exporting due to a panic bug.
//
// TODO: remove after https://github.com/cosmos/ibc-go/issues/2151 is resolved
func removeICAFromSimulation(app *regen.RegenApp) {
remove := func(target string, mods []string) []string {
for i, mod := range mods {
if mod == target {
return append(mods[:i], mods[i+1:]...)
}
}
return mods
}

icaModName := ica.AppModule{}.Name()

app.ModuleManager.OrderExportGenesis = remove(icaModName, app.ModuleManager.OrderExportGenesis)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unfortunately ICA module does not implement AppModuleSimulation so the module does initialize with any state during simulations. This in turn causes ExportGenesis calls on the regen.App to panic due to a bug described here cosmos/ibc-go#2151.

This is a temporary workaround until the above issue is resolved on the IBC-go repo, or a more preferable solution is found.

Copy link
Member

Choose a reason for hiding this comment

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

Work around for now works for me.

@technicallyty technicallyty changed the title feat(app)!: add interchain accounts module feat(app)!: enable ICA Host module Aug 31, 2022
Copy link
Member

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Nice! Excited to get this added. Tested adding a message via governance and querying params. We should have host disabled on upgrade and require a governance proposal to enable it. Would be nice to wire up the controller here as well and make sure it is also disabled upon upgrade.

app/app.go Outdated
Comment on lines 435 to 438
// TODO: decide if we want to be a controller chain. For now, we only setup the host.
// this means actions can be executed on Regen Ledger from another chain.
// however, until we add the controller, Regen Ledger accounts will not be able to execute messages
// on other chains.
Copy link
Member

Choose a reason for hiding this comment

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

We should wire up the controlled and make sure it is disabled. This way it could be enabled via governance:

https://github.com/cosmos/ibc-go/blob/main/modules/apps/27-interchain-accounts/controller/types/params.go#L9-L12

Copy link
Member

Choose a reason for hiding this comment

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

Currently the command to query the controller is available but it produces the following error:

Error: rpc error: code = Unknown desc = value method github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/keeper.Keeper.Params called using nil *Keeper pointer: panic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah the controller is a lot more tricky than the host. it needs middleware, and in the demo i linked in discord, it appears the thing chain devs should be doing is creating their own x/intertx module (the one in the demo says its experimental and not to use it in prod) ? but it also looks like it can be wired up using a new IBCFee module.

the docs are also a bit confusing for chain devs, as the integration guide mentions an ICAAuth module that can be used for the controller's middleware, but that module doesn't appear to exist ??

we may just want to start w/ host for now and wait for them to update the docs to see what chaindevs should do for integrating controllers 🤷🏻

Copy link
Member

Choose a reason for hiding this comment

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

Can we make this an issue rather than a todo? No need for the todo here but an issue to track would be great.

Copy link
Member

Choose a reason for hiding this comment

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

We can throw it in the backlog. Probably not something we need for v5.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

issue: #1453

commented in code: bf6f818

Comment on lines +55 to +71
// removeICAFromSimulation is a utility function that removes from genesis exporting due to a panic bug.
//
// TODO: remove after https://github.com/cosmos/ibc-go/issues/2151 is resolved
func removeICAFromSimulation(app *regen.RegenApp) {
remove := func(target string, mods []string) []string {
for i, mod := range mods {
if mod == target {
return append(mods[:i], mods[i+1:]...)
}
}
return mods
}

icaModName := ica.AppModule{}.Name()

app.ModuleManager.OrderExportGenesis = remove(icaModName, app.ModuleManager.OrderExportGenesis)
}
Copy link
Member

Choose a reason for hiding this comment

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

Work around for now works for me.

@@ -36,6 +37,7 @@ func (app *RegenApp) registerUpgradeHandlers() {
storeUpgrades := storetypes.StoreUpgrades{
Added: []string{
group.ModuleName,
icahosttypes.StoreKey,
Copy link
Member

Choose a reason for hiding this comment

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

We should probably have the host disabled upon upgrade and require a governance proposal to enable it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you mean to edit the upgrade handler to directly set the host params to false? I don't think we can remove the key in the commented line there

in any case, the host submod will be disabled either way, however disabling it manually in the upgrade handler will at least make it's params queryable post-upgrade. wdyt, edit the handler or leave as is?

Copy link
Member

Choose a reason for hiding this comment

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

I just left the comment here because it was the only line changed. I do mean setting the host param to false.

Copy link
Member

Choose a reason for hiding this comment

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

Edit the handler. It will be queryable either way as long as the module is wired up. Currently the upgrade will set the host to enabled by default. We should require a governance proposal to enable it before adding messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah i missed the default genesis setting it to true, i'll set the params in the upgrade handler 👍🏻

@technicallyty technicallyty mentioned this pull request Aug 31, 2022
4 tasks
@ryanchristo
Copy link
Member

ryanchristo commented Aug 31, 2022

tACK. Unfortunately the error still exists when querying controller params because the keeper is not implemented. Is there a way around this?

@technicallyty
Copy link
Contributor Author


tACK. Unfortunately the error still exists since when querying controller params because the keeper is not implemented. Is there a way around this?

I don't think so. all the cmd's are managed by the module itself. might just have to live with it until the ICA module matures 🤷🏻

Copy link
Member

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Meant to approve with the tACK above. Would be nice to get the controller set up but start with it disabled if we find time to dig in further or when the documentation is more up-to-date.

@ryanchristo ryanchristo merged commit cb9db1e into main Sep 1, 2022
@ryanchristo ryanchristo deleted the ty/1328-ica_module branch September 1, 2022 17:28
@ryanchristo ryanchristo changed the title feat(app)!: enable ICA Host module feat(app)!: add ICA Host module with enabled false Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add interchain accounts module and migrations
2 participants