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: enable wasm light clients on IBC (08-wasm) #2068

Merged
merged 4 commits into from
Oct 31, 2024
Merged

Conversation

helder-moreira
Copy link
Contributor

@helder-moreira helder-moreira commented Oct 9, 2024

Purpose / Abstract

Summary by CodeRabbit

  • New Features

    • Introduced support for WASM client types within the IBC framework.
    • Added validation for FunToken creation fees and improved state synchronization during complex transactions.
    • Expanded upgrade capabilities with new upgrade version v2.1.0.
  • Bug Fixes

    • Enhanced ERC20 metadata handling and fixed gas consumption issues in contract execution.
    • Improved state consistency and clarified gas price handling.
  • Refactor

    • Simplified EVM precompile setup and improved error message clarity.
  • Tests

    • Added tests for race conditions in FunToken precompile and expanded coverage for EVM functionalities.
  • Documentation

    • Updated CHANGELOG.md to reflect recent changes and audit outcomes.

@helder-moreira helder-moreira self-assigned this Oct 9, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 61.11111% with 14 lines in your changes missing coverage. Please review.

Project coverage is 64.56%. Comparing base (7b7beb7) to head (dccee9c).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
app/app.go 30.00% 6 Missing and 1 partial ⚠️
cmd/nibid/cmd/init.go 0.00% 5 Missing ⚠️
app/keepers.go 90.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2068      +/-   ##
==========================================
- Coverage   64.58%   64.56%   -0.03%     
==========================================
  Files         271      271              
  Lines       21237    21279      +42     
==========================================
+ Hits        13716    13738      +22     
- Misses       6574     6587      +13     
- Partials      947      954       +7     
Files with missing lines Coverage Δ
app/upgrades.go 55.55% <100.00%> (ø)
app/keepers.go 98.96% <90.00%> (-0.28%) ⬇️
cmd/nibid/cmd/init.go 12.17% <0.00%> (-0.56%) ⬇️
app/app.go 57.14% <30.00%> (-1.46%) ⬇️

... and 3 files with indirect coverage changes

Copy link
Contributor

coderabbitai bot commented Oct 28, 2024

Walkthrough

The pull request introduces significant updates to the Nibiru EVM codebase, focusing on the integration of the IBC Wasm light client module. Key changes include bug fixes, new features, refactoring, and enhanced testing. The CHANGELOG.md has been updated to reflect these changes. Additionally, several files have been modified to support new methods, constants, and structures related to the IBC Wasm functionality, improving the handling of state and client interactions.

Changes

File Path Change Summary
CHANGELOG.md Updated with new entry for "Nibiru EVM" detailing bug fixes, features, refactoring, testing, and API changes.
app/app.go Added new imports and updated NewNibiruApp to integrate IBC Wasm functionalities and error handling.
app/keepers.go Integrated IBC WASM module, added memory limit constant, and updated keeper initialization.
app/keepers/all_keepers.go Added WasmClientKeeper field to PublicKeepers struct.
app/upgrades.go Introduced upgrade version v2_1_0 and updated setUpgradeHandlers method signature.
app/upgrades/types.go Updated CreateUpgradeHandler function signature to include clientkeeper.Keeper.
app/upgrades/v1_1_0/constants.go Updated CreateUpgradeHandler function signature to include clientKeeper.
app/upgrades/v1_2_0/constants.go Updated CreateUpgradeHandler function signature to include clientKeeper.
app/upgrades/v1_3_0/constants.go Updated CreateUpgradeHandler function signature to include clientKeeper.
app/upgrades/v1_4_0/constants.go Updated CreateUpgradeHandler function signature to include clientKeeper.
app/upgrades/v2_1_0/constants.go Introduced new constants and upgrade logic for version v2.1.0.
cmd/nibid/cmd/init.go Added imports for IBC WASM types and modified IBC state initialization for genesis.
go.mod Updated dependencies and versions, including new ibc-go/modules/light-clients/08-wasm.

Assessment against linked issues

Objective Addressed Explanation
The chain needs to support wasm clients. (Issue #2061)
Open a union connection to some instance of Nibiru. (Issue #2061) This objective is not addressed in the PR.
Add the authority changes for the IBC Wasm light client. (Issue #2061) This objective is not addressed in the PR.
Get the upgrade completed on mainnet. (Issue #2061) Unclear if this objective is fully addressed.

Possibly related PRs

Suggested reviewers

  • Unique-Divine

Poem

In the land where code does play,
The Nibiru EVM finds its way.
With Wasm light clients shining bright,
We hop along, in pure delight!
Bugs are fixed, and features bloom,
In this code garden, there's always room! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 68db735 and dccee9c.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

🪧 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>, please review it.
    • Generate unit testing code 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@helder-moreira helder-moreira marked this pull request as ready for review October 31, 2024 10:43
@helder-moreira helder-moreira requested a review from a team as a code owner October 31, 2024 10:43
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.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (6)
app/upgrades/v1_2_0/constants.go (1)

Based on the search results, I can now generate the final response since I have clear evidence of how IBC-related migrations are handled in the codebase.

The upgrade handler needs to be updated to enable Wasm client type in IBC params

Looking at the v2_1_0 upgrade handler, which is specifically focused on Wasm light clients, it performs necessary IBC-specific migrations by updating the allowed client types. Your handler should follow the same pattern:

params := clientKeeper.GetParams(ctx)
params.AllowedClients = append(params.AllowedClients, ibcwasmtypes.Wasm)
clientKeeper.SetParams(ctx, params)

This ensures that the Wasm client type is properly registered with IBC after the upgrade.

🔗 Analysis chain

Line range hint 17-21: Verify the upgrade handler's minimal implementation.

While the upgrade handler has been modified to accept the clientKeeper parameter, it's not utilizing it for any IBC-specific migrations. Given that this PR is specifically about enabling Wasm light clients on IBC:

  1. The handler might need to perform IBC-specific migrations or validations
  2. Consider if any Wasm-related state migrations are required

Let's check if other upgrade handlers in the codebase perform IBC-specific migrations:

Consider whether you need to:

  1. Initialize any Wasm-specific state
  2. Migrate existing light client data
  3. Set up default parameters for the Wasm light client module

Would you like assistance in implementing these potential requirements?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for IBC-related migrations in other upgrade handlers
rg -A 10 "CreateUpgradeHandler.*clientKeeper" app/upgrades/

Length of output: 3880

app/upgrades/v1_4_0/constants.go (1)

Based on the search results, I can now generate the final response as we have clear evidence of how Wasm-related migrations are handled in the codebase, particularly from the v2_1_0 upgrade handler.

Wasm client type needs to be added to allowed clients list during upgrade

The upgrade handler should update the IBC client parameters to include the Wasm client type, similar to how it's done in v2_1_0:

params := clientKeeper.GetParams(ctx)
params.AllowedClients = append(params.AllowedClients, ibcwasmtypes.Wasm)
clientKeeper.SetParams(ctx, params)

This ensures that Wasm light clients can be created after the upgrade.

🔗 Analysis chain

Line range hint 17-21: Verify if Wasm-related migrations are needed.

While the clientKeeper parameter has been added to the upgrade handler, it's not being utilized in the implementation. Given that this PR aims to enable Wasm light clients, consider if any Wasm-specific migrations should be performed during this upgrade.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any Wasm-related migrations in other upgrade handlers
# or migration files that might serve as examples

# Look for Wasm-related migrations in other upgrade handlers
echo "Checking for Wasm-related migrations in other upgrade handlers..."
rg -l "wasm" app/upgrades/

# Look for migration-related files
echo "Checking for migration files..."
fd -t f "migrations?" app/upgrades/

# Look for IBC client migrations
echo "Checking for IBC client migrations..."
rg -A 5 "clientKeeper" app/upgrades/

Length of output: 3649

app/upgrades.go (1)

31-31: Enhancement: IBC Client Keeper integration looks good

The addition of app.ibcKeeper.ClientKeeper to the upgrade handler is well-aligned with the objective of enabling Wasm light clients on IBC. This change provides the necessary access to IBC client functionality during upgrades.

Consider documenting the following in your upgrade guide:

  1. The impact of this change on existing IBC connections
  2. Any necessary steps for validators during the upgrade
  3. The process for verifying Wasm client functionality post-upgrade
app/keepers/all_keepers.go (1)

72-72: LGTM! Consider documenting keeper responsibilities.

The WasmClientKeeper field is correctly positioned with other WASM-related keepers and follows the established pattern.

Consider adding a documentation comment above the field to clarify:

  • Its role in IBC light client verification
  • Its relationship with the existing WasmKeeper
  • Any specific initialization requirements

Example:

+  // WasmClientKeeper handles IBC light client verification using WebAssembly modules.
+  // It works alongside WasmKeeper but focuses specifically on IBC client operations.
   WasmClientKeeper ibcwasmkeeper.Keeper
CHANGELOG.md (2)

177-177: Enhance the changelog entry for IBC Wasm light clients.

The current entry feat: enable wasm light clients on IBC (08-wasm) could be expanded to provide more context about this significant change. Consider adding details about:

  1. The purpose and benefits of enabling Wasm light clients
  2. Any configuration or setup requirements
  3. Impact on existing IBC functionality
  4. Any migration steps needed

Example:

-feat: enable wasm light clients on IBC (08-wasm)
+feat: enable wasm light clients on IBC (08-wasm)
+  - Adds support for WebAssembly-based light clients in IBC to enable trust-minimized cross-chain communication
+  - Implements IBC client interface for Wasm light clients following 08-wasm specifications
+  - Allows deployment and modification of light clients across chains
+  - Required for the upcoming Euclid Protocol launch on 40-50 testnets

Line range hint 1-24: Maintain consistent changelog formatting and detail level.

The changelog structure is good but could benefit from more consistency:

  1. Each breaking change should include:

    • What changed
    • Why it changed
    • Migration impact
    • Required actions
  2. Use consistent formatting:

    • Start entries with change type (feat/fix/refactor)
    • Include PR number in consistent format
    • Add descriptive summaries beyond PR titles

Example format:

- feat(module): description of new feature (#PR)
  - Details about what changed
  - Impact on existing functionality
  - Required actions for users
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0afb08f and 8fb0340.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (13)
  • CHANGELOG.md (1 hunks)
  • app/app.go (3 hunks)
  • app/keepers.go (11 hunks)
  • app/keepers/all_keepers.go (2 hunks)
  • app/upgrades.go (2 hunks)
  • app/upgrades/types.go (1 hunks)
  • app/upgrades/v1_1_0/constants.go (2 hunks)
  • app/upgrades/v1_2_0/constants.go (2 hunks)
  • app/upgrades/v1_3_0/constants.go (2 hunks)
  • app/upgrades/v1_4_0/constants.go (2 hunks)
  • app/upgrades/v2_1_0/constants.go (1 hunks)
  • cmd/nibid/cmd/init.go (3 hunks)
  • go.mod (2 hunks)
🔇 Additional comments (32)
app/upgrades/types.go (2)

7-8: LGTM: Clean import addition for IBC client keeper.

The import of clientkeeper from IBC-Go v7 is properly structured and aligns with the requirements for Wasm light client support.


14-14: Verify all upgrade handlers are updated for the breaking change.

The addition of clientkeeper.Keeper parameter to CreateUpgradeHandler is a breaking change that requires updates to all existing upgrade handlers.

Let's verify all upgrade handlers have been properly updated:

✅ Verification successful

All upgrade handlers have been properly updated with the clientkeeper.Keeper parameter

Based on the search results, all upgrade handlers in the codebase have been updated to include the clientkeeper.Keeper parameter:

  • app/upgrades/v1_1_0/constants.go
  • app/upgrades/v1_2_0/constants.go
  • app/upgrades/v1_3_0/constants.go
  • app/upgrades/v1_4_0/constants.go
  • app/upgrades/v2_1_0/constants.go

Each handler follows the new signature pattern and accepts all three parameters: *module.Manager, module.Configurator, and clientkeeper.Keeper.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check all upgrade handlers for the new parameter pattern
# Expected: All CreateUpgradeHandler implementations should use clientkeeper.Keeper

# Search for CreateUpgradeHandler implementations
ast-grep --pattern 'CreateUpgradeHandler := func($_, $_, $_) types.UpgradeHandler'

# Also check for any potentially missed handlers
rg -A 5 "CreateUpgradeHandler.*func.*UpgradeHandler"

Length of output: 3335

app/upgrades/v1_2_0/constants.go (1)

8-8: LGTM: Import addition aligns with the new clientKeeper parameter.

The addition of the clientkeeper import from ibc-go/v7 is necessary for the new parameter type in the upgrade handler.

app/upgrades/v1_4_0/constants.go (1)

8-8: LGTM: Import addition is appropriate.

The addition of the clientkeeper import from ibc-go v7 aligns with the PR's objective of enabling Wasm light clients.

app/upgrades/v1_1_0/constants.go (2)

8-8: LGTM: Import added correctly

The import for clientkeeper from ibc-go v7 is properly added to support the new parameter.


Line range hint 18-22: Verify: Handler might be missing Wasm client initialization

The clientKeeper parameter is added but not utilized in the upgrade handler. Given that this PR aims to enable Wasm light clients on IBC, the handler should potentially include initialization or migration logic for Wasm clients.

Let's check other upgrade handlers for similar patterns:

Consider whether this upgrade handler should:

  1. Initialize any Wasm client-specific parameters
  2. Migrate existing client states
  3. Set up any required Wasm client configurations

Would you like assistance in implementing the Wasm client initialization logic?

app/upgrades/v2_1_0/constants.go (4)

1-12: LGTM: Imports are well-organized and necessary.

All required dependencies are properly imported for the upgrade functionality.


14-14: LGTM: Version constant follows semantic versioning.

The upgrade name follows the standard format and matches the intended version.


28-30: LGTM: Store upgrades correctly configured.

The store upgrades configuration properly adds the Wasm module to support the new functionality.


23-23: Verify error handling for SetParams.

The SetParams call could potentially return an error that should be handled before proceeding with migrations.

app/upgrades.go (2)

13-13: LGTM: Import follows consistent pattern

The import for the new v2.1.0 upgrade package follows the established pattern and semantic versioning convention.


21-21: Verify upgrade version compatibility

The addition of v2.1.0 upgrade follows the correct sequence and pattern. Given this upgrade's importance for the Euclid Protocol launch across multiple testnets, let's verify the upgrade configuration.

✅ Verification successful

Let me gather more information about the upgrade configuration and its dependencies.


Upgrade version v2.1.0 is properly configured and compatible

The verification confirms:

  • Correct version sequence: v1.1.0 → v1.2.0 → v1.3.0 → v1.4.0 → v2.1.0
  • Proper upgrade handler implementation that adds wasm client type to IBC params
  • No version conflicts or inconsistencies in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify upgrade configuration and dependencies

# Check upgrade name consistency
echo "Verifying upgrade name consistency..."
rg -l "v2\.1\.0" --type go

# Check for any potential version conflicts or dependencies
echo "Checking for version references..."
rg "UpgradeName.*2\.1\.0" --type go -A 5

Length of output: 802


Script:

#!/bin/bash
# Check the upgrade sequence and dependencies

# Check previous upgrade version
echo "Checking previous upgrade version..."
rg "UpgradeName.*1\.4\.0" --type go -A 5

# List all upgrade versions in chronological order
echo "Listing all upgrade versions..."
fd -e go -e md . app/upgrades/ -x rg -l "UpgradeName.*=.*v[0-9]+\.[0-9]+\.[0-9]+"

# Check upgrade handler implementation
echo "Checking upgrade handler implementation..."
ast-grep --pattern 'func($_, $_, $_) upgradetypes.UpgradeHandler {
  $$$
}'

Length of output: 6432

app/upgrades/v1_3_0/constants.go (2)

Line range hint 26-63: Missing Wasm light client initialization in upgrade handler.

The upgrade handler initializes the ICA module but doesn't include any initialization for Wasm light clients. According to the PR objectives, this upgrade should enable Wasm light clients on IBC.

Let's check if Wasm light client initialization exists elsewhere:

#!/bin/bash
# Search for Wasm-related initializations or configurations
rg -l "wasm" --type go

# Search specifically for IBC Wasm client setup
ast-grep --pattern 'func($_) {
  $$$
  wasm$_
  $$$
}'

Consider adding the following to the upgrade handler:

  1. Initialize Wasm light client parameters
  2. Register any required Wasm client types
  3. Set up necessary state migrations for Wasm client support

Would you like assistance in implementing these changes?


26-26: ⚠️ Potential issue

Unused parameter clientKeeper in CreateUpgradeHandler.

The clientKeeper parameter is added to the function signature but is not utilized within the upgrade handler. This suggests incomplete implementation of the Wasm light client functionality.

Let's verify if other upgrade handlers use this parameter:

app/keepers/all_keepers.go (1)

13-13: LGTM! Verify keeper initialization.

The import statement is correctly added and follows the standard Go conventions.

Let's verify the keeper initialization and usage:

✅ Verification successful

Keeper initialization and dependencies verified successfully

The verification shows that:

  • WasmKeeper is properly initialized before WasmClientKeeper
  • WasmClientKeeper is correctly initialized with the shared WasmVM instance
  • Both keepers are properly integrated into the app's dependency chain
  • No initialization conflicts or dependency issues found
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the initialization of WasmClientKeeper and its dependencies

# Test 1: Check keeper initialization
rg -A 10 "WasmClientKeeper.*=.*ibcwasmkeeper\.NewKeeper"

# Test 2: Check for any potential conflicts with existing Wasm keeper
rg "WasmKeeper.*=.*wasmkeeper\.NewKeeper"

Length of output: 620


Script:

#!/bin/bash
# Let's verify the initialization order and dependencies

# Check if WasmKeeper is initialized before WasmClientKeeper
rg -B 10 -A 10 "WasmKeeper.*=.*wasmkeeper\.NewKeeper" app/keepers.go

# Check if there are any other references to these keepers
rg "WasmClientKeeper|WasmKeeper" --type go

Length of output: 3129

cmd/nibid/cmd/init.go (2)

11-11: LGTM: Required imports for IBC Wasm integration.

The new imports are correctly versioned and necessary for enabling the Wasm light client functionality.

Also applies to: 30-31


136-140: Verify security implications of enabling Wasm clients.

While the implementation correctly adds Wasm to the allowed clients list, this is a significant security change that requires careful consideration:

  1. Enabling Wasm clients allows arbitrary light client implementations to be deployed.
  2. This change only affects newly initialized chains.

Let's verify the upgrade handling for existing chains:

Consider adding:

  1. Documentation comments explaining the security implications
  2. Validation of Wasm client configurations during runtime
  3. Explicit error handling for IBC state modifications
go.mod (2)

17-17: LGTM: IBC-Go version update

The update to github.com/cosmos/ibc-go/v7 v7.4.0 aligns with the PR objective of enabling Wasm light clients.


60-60: Verify compatibility with development version of Wasm light client module

The Wasm light client module is pinned to a development version (v0.3.2-0.20240730185603-13c071f0b34d). While this might be necessary for early integration, it could pose stability risks.

Let's verify the compatibility between the IBC-Go and Wasm light client versions:

✅ Verification successful

Let me gather more information about the specific version compatibility and usage.


Let me check one more aspect to understand the integration better.


Development version of Wasm light client module appears stable and properly integrated

Based on the evidence gathered:

  • The Wasm light client module is properly initialized using ibcwasmkeeper.NewKeeperWithVM with appropriate parameters
  • The feature was intentionally added as shown in CHANGELOG.md: "feat: enable wasm light clients on IBC (08-wasm)"
  • The module is used alongside IBC-Go v7.4.0, which is a stable release
  • The development version (v0.3.2-0.20240730185603-13c071f0b34d) appears to be a pre-release that's been specifically integrated and tested with the codebase

While it's a development version, the integration appears intentional and properly configured. The stability risk is mitigated by the proper initialization and its use alongside a stable IBC-Go version.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the Wasm light client module is compatible with IBC-Go v7.4.0

# Test 1: Check if the module version is referenced in IBC-Go's go.mod
rg -A 5 "github.com/cosmos/ibc-go/modules/light-clients/08-wasm" 

# Test 2: Look for any compatibility notes or requirements
fd -t f "README.md" | xargs rg -i "compatibility|requirement|version"

Length of output: 4239


Script:

#!/bin/bash
# Check for version constraints and usage in the codebase

# Look for version constraints in go.mod
rg "github.com/cosmos/ibc-go/v7" go.mod -A 2

# Check for Wasm light client initialization and configuration
ast-grep --pattern 'ibcwasmkeeper.NewKeeper($_)'

# Look for any upgrade handlers or migration code related to Wasm light client
fd -t f "upgrades" | xargs rg -i "wasm.*light.*client"

# Check for any specific version requirements or constraints in docs
fd -t f ".md" | xargs rg -i "wasm.*light.*client|ibc.*version"

Length of output: 416


Script:

#!/bin/bash
# Check for specific configuration and initialization of the Wasm light client

# Look for Wasm light client configuration in app setup
rg -A 10 "ibcwasmkeeper.NewKeeper" 

# Check for any specific commit references or version constraints
rg -A 3 "13c071f0b34d" 

# Look for any specific configuration or parameters in the app initialization
rg "RegisterWasmLightClient" 

Length of output: 1380

CHANGELOG.md (1)

Line range hint 25-35: LGTM on versioning structure!

The changelog follows semantic versioning best practices with:

  • Clear version numbers (MAJOR.MINOR.PATCH)
  • Release dates included
  • Proper separation of unreleased changes
  • Well-organized sections for different types of changes
app/app.go (2)

13-15: Imports added are appropriate

The new import statements for cmtos, cmtproto, and ibcwasmkeeper are necessary for the added IBC WASM functionalities.


246-249: 🛠️ Refactor suggestion

Improve error handling in snapshot extension registration

When registering snapshot extensions, it's beneficial to provide specific error messages for easier debugging. Currently, if an error occurs, the message is generic and doesn't specify which snapshotter failed to register.

Consider modifying the error handling to include the actual error and specify which extension failed:

if err := snapshotManager.RegisterExtensions(
    wasmkeeper.NewWasmSnapshotter(
        app.CommitMultiStore(),
        &app.WasmKeeper,
    ),
    ibcwasmkeeper.NewWasmSnapshotter(
        app.CommitMultiStore(),
        &app.WasmClientKeeper,
    ),
); err != nil {
-    panic("failed to add wasm snapshot extension.")
+    panic(fmt.Sprintf("failed to register snapshot extensions: %v", err))
}

This change will output the specific error encountered during registration.

Likely invalid or redundant comment.

app/keepers.go (10)

7-8: Correctly imported ibcwasm packages

The import statements for ibcwasm and ibcwasmkeeper are correctly added to support the IBC Wasm light client functionality.


21-21: Added necessary import for wasmvm package

The import of the wasmvm package is correctly added, which is essential for interacting with the WASM virtual machine.


90-90: Imported ibcwasmtypes package

The ibcwasmtypes package is correctly imported, providing necessary type definitions for the IBC Wasm light client.


202-202: Added ibcwasm StoreKey to store keys

The ibcwasmtypes.StoreKey is correctly added to the list of store keys in initStoreKeys(), which is necessary for proper state management of the IBC Wasm module.


460-466: Initialized WASM VM instance for reuse

The WASM VM is initialized outside the keeper using wasmvm.NewVM, allowing it to be reused in both the WasmKeeper and WasmClientKeeper. The parameters passed are appropriate, and handling the error with a panic is acceptable in this initialization context.


485-486: Configured WasmKeeper with the shared WASM VM

The WasmKeeper is correctly configured to use the shared wasmVM instance by appending wasmkeeper.WithWasmEngine(wasmVM) to the options. This ensures consistency and efficient resource utilization.


488-494: Initialized WasmClientKeeper with the shared WASM VM

The WasmClientKeeper is properly initialized using ibcwasmkeeper.NewKeeperWithVM, reusing the shared wasmVM instance. The parameters provided, including appCodec, keys, ClientKeeper, and GRPCQueryRouter, are appropriate.


658-658: Included ibcwasm module in application modules

The ibcwasm module is correctly included in the list of application modules through ibcwasm.NewAppModule(app.WasmClientKeeper), enabling its functionalities within the application.


730-730: Added ibcwasm module to ordered module names

The ibcwasmtypes.ModuleName is appropriately added to the orderedModuleNames list, ensuring the correct initialization order and integration with begin and end block hooks.


837-837: Included ibcwasm AppModuleBasic in ModuleBasicManager

The ibcwasm.AppModuleBasic{} is correctly added to the ModuleBasicManager, registering the basic functionality of the IBC Wasm module and ensuring proper module setup.

app/upgrades/v2_1_0/constants.go Outdated Show resolved Hide resolved
app/app.go Outdated Show resolved Hide resolved
app/keepers.go Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Completed
Development

Successfully merging this pull request may close these issues.

[ecosystem] Enable Wasm light clients on IBC (08-wasm)
3 participants