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

Add ICA controller #7839

Merged
merged 5 commits into from
Mar 25, 2024
Merged

Add ICA controller #7839

merged 5 commits into from
Mar 25, 2024

Conversation

nicolaslara
Copy link
Contributor

@nicolaslara nicolaslara commented Mar 25, 2024

What is the purpose of the change

Add the ICA controller to osmosis

Testing and Verifying

All existing tests should pass.

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Changelog entry added to Unreleased section of CHANGELOG.md?

Where is the change documented?

  • Specification (x/{module}/README.md)
  • Osmosis documentation site
  • Code comments?
  • N/A

Summary by CodeRabbit

  • New Features
    • Integrated Interchain Accounts (ICA) controller functionality, enhancing cross-chain interactions.
    • Added parameter handling for the icacontrollertypes module.
    • Enabled ICA controllers by setting parameters in the ICAControllerKeeper during upgrades.
    • Scoped ScopedICAControllerKeeper within the CapabilityKeeper.
    • Updated ica.NewAppModule function to include app.ICAControllerKeeper.
  • Improvements
    • Modified scoped keepers to accommodate the new ScopedICAControllerKeeper.
    • Adjusted initialization of ICAControllerKeeper and integrated it into the IBC router.
    • Updated references in scoped keepers to reflect changes.
    • Included icacontrollertypes.StoreKey in the StoreUpgrades struct.

Copy link
Contributor

coderabbitai bot commented Mar 25, 2024

Walkthrough

The update integrates Interchain Accounts (ICA) controller functionality into the application, enhancing cross-chain account management. It involves adjusting keeper configurations, updating modules for ICA control, and enabling ICA controllers in upgrades.

Changes

File Path Change Summary
app/keepers/keepers.go Introduced new imports for icacontroller, added ScopedICAControllerKeeper, updated keepers, integrated ICAControllerKeeper into IBC router.
app/modules.go Modified ica.NewAppModule to include ICAControllerKeeper.
app/upgrades/v24/upgrades.go Added functionality to enable ICA controllers in the upgrade handler.
app/upgrades/v24/constants.go Added import for icacontrollertypes, included icacontrollertypes.StoreKey in StoreUpgrades struct.

🐰 A Whimsical Poem by the CodeRabbit 🥕

In the world of bits and bytes so grand,
The ICA controller takes a stand.
Keepers and modules hand in hand,
Across chains, they expand.
🌟 Unity in code, a magical land, 🌟
Where upgrades dance, oh so unplanned.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added the C:app-wiring Changes to the app folder label Mar 25, 2024
@nicolaslara nicolaslara added the V:state/breaking State machine breaking PR label Mar 25, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 900c0a0 and 03f586a.
Files selected for processing (3)
  • app/keepers/keepers.go (9 hunks)
  • app/modules.go (1 hunks)
  • app/upgrades/v24/upgrades.go (2 hunks)
Additional comments: 12
app/upgrades/v24/upgrades.go (2)
  • 7-7: The addition of the icacontrollertypes import is necessary for the ICA controller functionality. Looks good.
  • 50-52: Enabling ICA controllers by setting default parameters is a standard approach. Ensure that this operation is idempotent and does not negatively impact the upgrade process.
app/modules.go (1)
  • 168-168: Modification to include app.ICAControllerKeeper as an argument in the ica.NewAppModule function call is necessary for ICA integration. Ensure that both ICAControllerKeeper and ICAHostKeeper are correctly initialized and passed.
Verification successful

To accurately verify the initialization and correct passing of ICAControllerKeeper and ICAHostKeeper to the ica.NewAppModule function, we need to inspect the relevant code sections. Let's proceed with searching for the initialization of these keepers and their usage in the ica.NewAppModule function call.


The script output provides evidence of the initialization and correct passing of ICAControllerKeeper and ICAHostKeeper to the ica.NewAppModule function call within app/modules.go. Specifically, it shows:

  1. The initialization of ICAControllerKeeper in app/keepers/keepers.go, where it is assigned a new keeper instance.
  2. The initialization of ICAHostKeeper in the same file, following a similar pattern.
  3. The usage of both ICAControllerKeeper and ICAHostKeeper in the ica.NewAppModule function call within app/modules.go, confirming that they are passed correctly to this function.

Given this information, it can be concluded that the initialization and correct passing of ICAControllerKeeper and ICAHostKeeper to the ica.NewAppModule function are verified as per the review comment.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the initialization and correct passing of ICAControllerKeeper and ICAHostKeeper
# This script is a placeholder for the actual verification steps which would depend on the specific implementation details of the ICAControllerKeeper and ICAHostKeeper.
echo "Ensure that ICAControllerKeeper and ICAHostKeeper are correctly initialized and passed to the ica.NewAppModule function."

Length of output: 250



Script:

#!/bin/bash
# Search for the initialization of ICAControllerKeeper
echo "Searching for ICAControllerKeeper initialization..."
rg "ICAControllerKeeper" --context 5

# Search for the initialization of ICAHostKeeper
echo "Searching for ICAHostKeeper initialization..."
rg "ICAHostKeeper" --context 5

# Search for the usage of ICAControllerKeeper and ICAHostKeeper in ica.NewAppModule function call
echo "Searching for usage in ica.NewAppModule function call..."
rg "ica.NewAppModule" --context 5

Length of output: 15474

app/keepers/keepers.go (9)
  • 41-43: The addition of new imports for the ICA controller from the ibc-go/v7 module is correctly done. These imports are essential for the integration of the ICA controller functionality into the Osmosis architecture.
  • 131-136: The addition of ScopedICAControllerKeeper to the scoped keepers is correctly implemented. This change is necessary for managing the capabilities and interactions of interchain accounts within the CapabilityKeeper.
  • 149-149: The initialization of the ICAControllerKeeper and its integration into the IBC router is correctly adjusted. This step is crucial for enabling the ICA controller's functionality within the Osmosis application modules.
  • 308-317: The detailed setup for the ICAControllerKeeper including its codec, store key, subspace, and scoped keeper is correctly implemented. This setup is essential for the operational functionality of the ICA controller within the app.
  • 319-326: The initialization of the ICA module with the mock module as the authentication module on the controller side is correctly done. This setup is part of the foundational work required for enabling ICA functionalities.
  • 344-351: The addition of the ICA controller and host modules to the IBC router is correctly implemented. This change ensures that the ICA functionalities are properly routed within the IBC framework, enabling seamless interchain account management.
  • 700-700: The scoping of the ICAControllerKeeper within the CapabilityKeeper is correctly done. This step is necessary for ensuring that the ICA controller's capabilities are properly managed and isolated within the app's architecture.
  • 739-739: The subspace for the ICAControllerKeeper is correctly initialized with its parameter key table. This initialization is crucial for managing the parameters related to the ICA controller's functionality.
  • 853-853: The addition of the ICAControllerKeeper store key to the list of KV store keys is correctly done. This inclusion is necessary for ensuring that the ICA controller's data is properly stored and managed within the app's state.


// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
// channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
var icaHostStack porttypes.IBCModule
Copy link
Contributor

Choose a reason for hiding this comment

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

There's an opportunity to merge the variable declaration with the assignment on the next line to improve code conciseness.

-	var icaControllerStack porttypes.IBCModule
-	icaControllerStack = icacontroller.NewIBCMiddleware(icaControllerStack, *appKeepers.ICAControllerKeeper)
+	icaControllerStack := icacontroller.NewIBCMiddleware(nil, *appKeepers.ICAControllerKeeper)

Note: The original code initializes icaControllerStack with a zero value and then assigns it. The suggested change initializes it directly with the return value of NewIBCMiddleware, making the code more concise. Additionally, the original code incorrectly passes icaControllerStack as an argument to itself before it's fully initialized. The corrected code passes nil to indicate that there's no prior middleware in the stack.


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
var icaHostStack porttypes.IBCModule
icaControllerStack := icacontroller.NewIBCMiddleware(nil, *appKeepers.ICAControllerKeeper)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 03f586a and 6011f43.
Files selected for processing (1)
  • app/keepers/keepers.go (9 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/keepers/keepers.go

@PaddyMc PaddyMc added the A:backport/v24.x backport patches to v24.x branch label Mar 25, 2024
Copy link
Contributor

@PaddyMc PaddyMc left a comment

Choose a reason for hiding this comment

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

💪

@nicolaslara nicolaslara merged commit 2f409fd into main Mar 25, 2024
1 check passed
@nicolaslara nicolaslara deleted the nicolas/add-ica-controller branch March 25, 2024 14:27
mergify bot pushed a commit that referenced this pull request Mar 25, 2024
* added ica controller

* lint

* added store upgrade

* changelog

(cherry picked from commit 2f409fd)
@mergify mergify bot mentioned this pull request Mar 25, 2024
6 tasks
PaddyMc pushed a commit that referenced this pull request Mar 26, 2024
* added ica controller

* lint

* added store upgrade

* changelog

(cherry picked from commit 2f409fd)

Co-authored-by: Nicolas Lara <nicolaslara@gmail.com>
@github-actions github-actions bot mentioned this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v24.x backport patches to v24.x branch C:app-wiring Changes to the app folder V:state/breaking State machine breaking PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants