-
Notifications
You must be signed in to change notification settings - Fork 3
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: add cosmwasm #118
base: main
Are you sure you want to change the base?
feat: add cosmwasm #118
Conversation
Warning Rate limit exceeded@fmorency has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 44 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
WalkthroughThis pull request integrates enhanced CosmWasm support into the project. It updates CI/CD workflows and Makefile targets to run new CosmWasm end-to-end tests, enriches linting configurations, and revises documentation to include a new CosmWasm module and upload contract script. Application initialization, ante handling, and module management have been extended to incorporate WASM functionalities, while simulation tests and temporary resource management have been refined. Additionally, genesis configuration and CLI commands now accommodate public WASM access. Changes
Sequence Diagram(s)sequenceDiagram
participant T as Tester
participant CI as GitHub CI
participant M as Makefile
participant B as Blockchain Node
participant W as WASM Module
T->>CI: Trigger e2e tests (ictest-cosmwasm)
CI->>M: Run Makefile target "ictest-cosmwasm"
M->>B: Execute TestCosmWasm (upload, instantiate, execute)
B->>W: Process contract via WASM Module
W-->>B: Return execution result
B-->>M: Report test results
M-->>CI: Send outcome
CI-->>T: Notify test result
sequenceDiagram
participant C as CLI Command
participant A as Application
participant W as WasmKeeper
participant H as Ante Handler
C->>A: Initialize app (NewApp)
A->>W: Create WasmKeeper instance
A->>A: Read WASM config via appOpts
A->>H: Configure ante handler with WASM decorators
C->>A: Execute commands with WASM support
Possibly related PRs
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 4
🧹 Nitpick comments (10)
cmd/manifestd/cmd/root.go (1)
103-103
: Check for potential error handling
Though initWasmConfig() doesn’t return an error, verifying that the returned config is valid before proceeding could improve resilience in case future changes introduce error conditions.app/app.go (2)
652-672
: Construct the WasmKeeper
The keeper is set up with relevant modules and a path for storing contracts (wasm/). Ensure that directory is secure and restricted in production environments. Also verify that the modules used for IBC and distribution queries are correct for your chain’s needs.
969-996
: WASM configuration in ante handler
Reading the WASM config and inserting specialized decorators is a neat design. Consider graceful handling for misconfigured or missing WASM parameters to prevent unexpected panics in production.interchaintest/cosmwasm_test.go (2)
67-67
: Follow Go naming conventions for acronyms.The variable name
codeId
should becodeID
as per Go naming conventions where acronyms should be uppercase.-codeId, err := chain.StoreContract(ctx, user.KeyName(), string(wasmBytes)) +codeID, err := chain.StoreContract(ctx, user.KeyName(), string(wasmBytes))🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 67-67: var-naming: var codeId should be codeID
(revive)
17-17
: Add test documentation.Add a comment explaining the purpose and scope of this test function to improve maintainability.
+// TestCosmWasm verifies the functionality of CosmWasm smart contract operations +// by uploading a contract, instantiating it, and performing basic interactions. func TestCosmWasm(t *testing.T) {app/test_helpers.go (1)
361-369
: Document the helper function.Add documentation to explain the purpose and behavior of the
makeTestDir
function.+// makeTestDir creates a unique temporary directory for testing purposes and ensures +// its cleanup after the test completes. It returns the path to the created directory. func makeTestDir(t *testing.T) string {app/sim_test.go (1)
245-245
: Address blank identifier warnings.Multiple blank identifiers in function calls make the code less maintainable and hide potentially useful values.
Consider naming the ignored values or documenting why they're ignored:
-newDB, _, _, _, err := simtestutil.SetupSimulation(...) +newDB, dir, logger, skip, err := simtestutil.SetupSimulation(...) +// dir, logger, and skip are unused in this contextAlso applies to: 382-382
🧰 Tools
🪛 GitHub Check: build amd64 for linux
[failure] 245-245:
declaration has 3 blank identifiers (dogsled)🪛 GitHub Actions: Build Manifest
[error] 245-245: declaration has 3 blank identifiers (dogsled)
scripts/upload_contract.sh (2)
7-7
: Refactor HOME_DIR assignment to avoid masking return values (SC2155).
Using command substitution directly in the export statement may mask important return values. Consider declaring a temporary variable first. For example:- export HOME_DIR=$(eval echo "${HOME_DIR:-"~/.manifest"}") + HOME_DIR_DEFAULT="${HOME_DIR:-"~/.manifest"}" + export HOME_DIR=$(eval echo "$HOME_DIR_DEFAULT")🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 7-7: Declare and assign separately to avoid masking return values.
(SC2155)
11-11
: Avoid alias pitfalls in non-interactive scripts (SC2139).
Aliases in scripts are expanded at definition time and may lead to unexpected behavior. A more robust pattern is to define a wrapper function that appends the required flag. For example:- alias BINARY="$BINARY --home=$HOME_DIR" + function runBinary() { + $BINARY --home="$HOME_DIR" "$@" + }Then replace calls to “$BINARY” with “runBinary”.
🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 11-11: This expands when defined, not when used. Consider escaping.
(SC2139)
MODULE.md (1)
255-316
: New COSM WASM Module Documentation
The new COSM WASM Module section (lines 255–316) is detailed and covers contract deployment, administration, and execution commands. To comply with markdown style guidelines (MD026), consider removing trailing punctuation (e.g., the colons at the end of headings like "#### Contract Deployment:", "#### Contract Administration:", and "#### Contract Execution:").🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
263-263: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
269-269: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
276-276: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
284-284: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
294-294: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
306-306: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
scripts/cw_template.wasm
is excluded by!**/*.wasm
📒 Files selected for processing (15)
.github/workflows/e2e.yml
(2 hunks).golangci.yml
(1 hunks)MODULE.md
(3 hunks)Makefile
(1 hunks)README.md
(4 hunks)app/ante.go
(3 hunks)app/app.go
(14 hunks)app/sim_test.go
(13 hunks)app/test_helpers.go
(2 hunks)cmd/manifestd/cmd/root.go
(3 hunks)go.mod
(5 hunks)interchaintest/cosmwasm_test.go
(1 hunks)network/manifest-1/set-genesis-params.sh
(1 hunks)scripts/test_node.sh
(1 hunks)scripts/upload_contract.sh
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Codecov
Makefile
[error] 140-140: The command 'make local-image' failed with exit code 2.
🪛 GitHub Actions: Simulation Tests
Makefile
[error] 301-301: Makefile:301: sim-after-import failed with exit code 2.
🪛 Shellcheck (0.10.0)
scripts/upload_contract.sh
[warning] 7-7: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 11-11: This expands when defined, not when used. Consider escaping.
(SC2139)
🪛 LanguageTool
MODULE.md
[duplication] ~7-~7: Possible typo: you repeated a word.
Context: ... of Contents - Manifest Module - Module Functionality ...
(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~12-~12: Possible typo: you repeated a word.
Context: ...okens-burn-coins) - Proof of Authority Module - Module Functionality...
(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~21-~21: Possible typo: you repeated a word.
Context: ...move-validator-remove) - Token Factory Module - Module Functionality...
(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~35-~35: Possible typo: you repeated a word.
Context: ...-metadata-modify-metadata) - COSM WASM Module - Module Functionality...
(ENGLISH_WORD_REPEAT_RULE)
🪛 markdownlint-cli2 (0.17.2)
MODULE.md
263-263: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
269-269: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
276-276: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
284-284: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
294-294: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
306-306: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
🪛 golangci-lint (1.62.2)
app/ante.go
20-20: could not import github.com/CosmWasm/wasmd/x/wasm/keeper (-: # github.com/CosmWasm/wasmd/x/wasm/keeper
/tmp/go/.go-mod-cache/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/test_common.go:386:3: cannot use runtime.NewKVStoreService(keys[types.StoreKey]) (value of type "cosmossdk.io/core/store".KVStoreService) as "cosmossdk.io/store/types".StoreKey value in argument to NewKeeper: "cosmossdk.io/core/store".KVStoreService does not implement "cosmossdk.io/store/types".StoreKey (missing method Name)
/tmp/go/.go-mod-cache/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/test_common.go:400:3: cannot use availableCapabilities (variable of type []string) as string value in argument to NewKeeper)
(typecheck)
interchaintest/cosmwasm_test.go
118-118: File is not gofumpt
-ed
(gofumpt)
[warning] 67-67: var-naming: var codeId should be codeID
(revive)
🪛 GitHub Check: build amd64 for linux
app/sim_test.go
[failure] 245-245:
declaration has 3 blank identifiers (dogsled)
[failure] 382-382:
declaration has 3 blank identifiers (dogsled)
🪛 GitHub Actions: Unit Tests
app/sim_test.go
[warning] 143-143: TestFullAppSimulation is skipped.
[warning] 190-190: TestAppImportExport is skipped.
[warning] 331-331: TestAppSimulationAfterImport is skipped.
[warning] 419-419: TestAppStateDeterminism is skipped.
🪛 GitHub Actions: Build Manifest
app/sim_test.go
[error] 245-245: declaration has 3 blank identifiers (dogsled)
🔇 Additional comments (29)
cmd/manifestd/cmd/root.go (3)
16-16
: Add new imports for serverconfig, crisis, wasm, and wasmtypes
No issues found. This import set appears appropriate for WASM integration and crisis handling.Also applies to: 23-23, 27-28
125-142
: Validate zero gas price in production
Here, the MinGasPrices is set to "0stake," which may be acceptable for testing but can introduce spam or DOS risks in production. Ensure this configuration is intentional. Returning an interface{} for the config can reduce type safety. If possible, consider returning a concrete struct to prevent runtime casting errors.
144-146
: Initialize WASM and crisis flags together
Adding both WASM and crisis module init flags is straightforward and consistent. Ensure no overlap with existing flags.app/app.go (8)
141-143
: New imports for CosmWasm
Importing wasm, wasmkeeper, and wasmtypes is consistent with the new WASM integration.
221-221
: Grant burner permission to WASM module account
Granting WASM the burner permission allows contract code to burn tokens. Confirm this is intended, as it can be powerful.
277-277
: Added WasmKeeper field
Introducing WasmKeeper in ManifestApp is a clean approach to integrate WASM functionality.
338-338
: Add WASM store key
Adding wasmtypes.StoreKey ensures proper state isolation for storing WASM data.
386-400
: Scoped keeper and skip-upgrades
Defining scopedWasmKeeper and reading skipUpgradeHeights align with standard patterns. The code for loading the wasm configuration is clear. No issues noted.
743-743
: Added crisis, manifest, and wasm modules to ModuleManager
Integrating these modules is standard. Confirm that the order of insertion meets each module’s dependency requirements.Also applies to: 745-746
748-775
: Register WASM for lifecycle management
Appending wasm to the begin/end blocker and init-genesis sequences properly integrates it into the chain lifecycle. This is a key step in ensuring modules can interact with WASM code during every block phase.
925-925
: Ante handler invocation
Calling setAnteHandler with additional WASM parameters is a proper approach for hooking in WASM capabilities at transaction level.app/ante.go (3)
12-12
: New imports for store, runtime, and WASM
These added imports accurately reflect the extended WASM-dependent features and store interactions.Also applies to: 16-16, 20-21
37-38
: Expanded HandlerOptions
Adding WasmConfig and StoreKey aligns with the new CosmWasm functionality. Ensure both fields remain non-nil to avoid runtime panics.
71-72
: New WASM ante decorators
The LimitSimulationGasDecorator uses SimulationGasLimit, and CountTXDecorator relies on a KV store service. Confirm that WasmConfig is always defined, as referencing a nil config could cause errors..golangci.yml (1)
45-46
: LGTM! Good addition of CosmWasm prefixes.The addition of CosmWasm-related prefixes to the GCI sections is appropriate for the integration of the CosmWasm module.
scripts/upload_contract.sh (1)
1-32
: Overall, the upload contract script is structured well.
The script reliably sets environment variables, adds the required key if missing, and follows the workflow for storing, instantiating, and querying the contract. Make sure that the sleep durations (lines 21, 25, 29) are aligned with the blockchain’s expected response times.🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 7-7: Declare and assign separately to avoid masking return values.
(SC2155)
[warning] 11-11: This expands when defined, not when used. Consider escaping.
(SC2139)
.github/workflows/e2e.yml (1)
69-69
: Integrating the CosmWasm test into the E2E workflow.
The addition of the "ictest-cosmwasm" command in the test matrix ensures that the new CosmWasm module is validated along with other tests. Confirm that a corresponding Makefile target exists and that all necessary dependencies are met.network/manifest-1/set-genesis-params.sh (1)
75-78
: CosmWasm Genesis Parameter Configuration.
The new lines configuring the WASM module—setting “code_upload_access” and “instantiate_default_permission” to "Everybody"—are clear and in line with the objective of enhancing contract accessibility. Please verify that these permission values conform with the blockchain’s expected configuration and security requirements.README.md (2)
59-62
: Clarify system requirements for CosmWasm compatibility.
The update specifying “Linux (x86_64 with SSSE3 support) or Linux (arm64 with NEON support)” adds important detail regarding processor instruction support. This helps users ensure their hardware is compatible with CosmWasm.
181-190
: Addition of the Upload Contract Script section.
The new “Upload Contract script” section clearly explains the purpose and usage of thescripts/upload_contract.sh
file. The provided usage example and linkage with existing environment variables (shared with test_node.sh) improve clarity. Consider including a brief troubleshooting note if the contract upload fails.scripts/test_node.sh (1)
88-91
: Consistent WASM configuration in test genesis updates.
The appended updates to the genesis parameters for the WASM module, setting both “code_upload_access” and “instantiate_default_permission” to "Everybody", are consistent with the other configuration files. This unified approach should facilitate smoother integration of CosmWasm functionalities.go.mod (4)
36-36
: CosmWasm Dependency Addition
The addition of "github.com/CosmWasm/wasmd v0.51.0" on line 36 is well aligned with the PR’s objective to integrate CosmWasm functionality. Please verify that version v0.51.0 is compatible with the rest of your modules and does not introduce unintended breaking changes.
68-68
: WasmVM Dependency Inclusion
The inclusion of "github.com/CosmWasm/wasmvm/v2 v2.0.0" as an indirect dependency supports CosmWasm-related operations. Ensure that using an indirect dependency here is intentional and that this version is tested in your WASM contract execution scenarios.
103-103
: Distribution Reference Dependency
The new indirect dependency "github.com/distribution/reference v0.5.0" added on line 103 appears to support container or image-related operations. Please double-check that it is truly required and that its version does not conflict with other dependencies.
175-175
: OpenContainers Digest Dependency
"Github.com/opencontainers/go-digest v1.0.0" has been added as an indirect dependency (line 175). Verify that this addition meets the requirements for handling container digests and does not lead to compatibility issues.Makefile (3)
123-125
: New CosmWasm Test Target
The addition of the "ictest-cosmwasm" target (lines 123–125) is consistent with integrating CosmWasm tests into the CI workflow. Ensure that the "TestCosmWasm" test function is fully implemented and passes all necessary validations in your local and CI environments.
299-304
: Review Simulation Target: sim-after-import
The "sim-after-import" target (lines 299–304) runs "TestAppSimulationAfterImport." Given that the CI pipeline reported an exit code 2 on line 301, please review the test parameters (SIM_COMMON_ARGS) and the test implementation to ensure that the simulation is configured correctly.🧰 Tools
🪛 GitHub Actions: Simulation Tests
[error] 301-301: Makefile:301: sim-after-import failed with exit code 2.
132-141
: Local Image Build Target Issue
The "local-image" target (lines 132–141) is used to clone and build the heighliner image, but the CI pipeline reported a failure (exit code 2). Please investigate whether the heighliner repository is accessible, the clone/build steps complete successfully, and the binary is installed correctly.🧰 Tools
🪛 GitHub Actions: Codecov
[error] 140-140: The command 'make local-image' failed with exit code 2.
MODULE.md (1)
5-43
: Updated Table of Contents
The revised TOC thoroughly reorganizes the modules and introduces the new COSM WASM Module. Please double-check that all links resolve correctly and review any potential duplicate wordings flagged by static analysis.🧰 Tools
🪛 LanguageTool
[duplication] ~7-~7: Possible typo: you repeated a word.
Context: ... of Contents - Manifest Module - Module Functionality ...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~12-~12: Possible typo: you repeated a word.
Context: ...okens-burn-coins) - Proof of Authority Module - Module Functionality...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~21-~21: Possible typo: you repeated a word.
Context: ...move-validator-remove) - Token Factory Module - Module Functionality...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~35-~35: Possible typo: you repeated a word.
Context: ...-metadata-modify-metadata) - COSM WASM Module - Module Functionality...(ENGLISH_WORD_REPEAT_RULE)
interchaintest/cosmwasm_test.go
Outdated
wasmFile := "../contracts/cw_template.wasm" | ||
wasmBytes, err := os.ReadFile(wasmFile) | ||
require.NoError(t, 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.
🛠️ Refactor suggestion
Improve contract file handling.
The contract file path is hardcoded and lacks existence validation, which could lead to unclear errors if the file is missing.
-wasmFile := "../contracts/cw_template.wasm"
+wasmFile := os.Getenv("TEST_CONTRACT_PATH")
+if wasmFile == "" {
+ wasmFile = "../contracts/cw_template.wasm"
+}
+
+// Verify contract file exists
+if _, err := os.Stat(wasmFile); os.IsNotExist(err) {
+ t.Fatalf("Contract file not found at %s", wasmFile)
+}
wasmBytes, err := os.ReadFile(wasmFile)
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.
wasmFile := "../contracts/cw_template.wasm" | |
wasmBytes, err := os.ReadFile(wasmFile) | |
require.NoError(t, err) | |
wasmFile := os.Getenv("TEST_CONTRACT_PATH") | |
if wasmFile == "" { | |
wasmFile = "../contracts/cw_template.wasm" | |
} | |
// Verify contract file exists | |
if _, err := os.Stat(wasmFile); os.IsNotExist(err) { | |
t.Fatalf("Contract file not found at %s", wasmFile) | |
} | |
wasmBytes, err := os.ReadFile(wasmFile) | |
require.NoError(t, err) |
app/sim_test.go
Outdated
@@ -415,110 +419,54 @@ | |||
t.Skip("skipping application simulation") |
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.
💡 Verification agent
🧩 Analysis chain
Document test skip conditions.
Multiple simulation tests are being skipped. Add documentation explaining the conditions under which these tests should run.
🏁 Script executed:
#!/bin/bash
# Find all skipped tests and their conditions
rg -A 1 "t\.Skip\(" app/sim_test.go
Length of output: 261
Action Required: Document Simulation Test Skip Conditions
The simulation tests in app/sim_test.go (e.g., lines showing "t.Skip("skipping application simulation")", "t.Skip("skipping application import/export simulation")", and "t.Skip("skipping application simulation after import")") are being skipped without any accompanying documentation detailing when or why these tests should be run. Please add clear documentation (e.g., conditions, environment settings, or dependency requirements) that explains the circumstances under which each skipped test should execute. This will enhance code maintainability and clarity for future maintainers.
🧰 Tools
🪛 GitHub Actions: Unit Tests
[warning] 419-419: TestAppStateDeterminism is skipped.
@fmorency most of these tests are passing locally, but the CI is bugging out about the libwasmvm download link |
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!
-
make test
is failing. TheTestExportGenesis
test fails withpanic: Could not lock exclusive.lock. Is a different VM running in the same directory already?
-
make sim-import-export
should pass -
make sim-after-import
should pass -
make ictest-cosmwasm
fails
sleep 2 | ||
|
||
echo "Querying contract info..." | ||
$BINARY q wasm contract $addr |
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.
EOF EOL
# Add CosmWasm configuration | ||
update_genesis '.app_state["wasm"]["params"]["code_upload_access"]["permission"]="Everybody"' | ||
update_genesis '.app_state["wasm"]["params"]["instantiate_default_permission"]="Everybody"' | ||
|
||
# # add genesis accounts | ||
# # TODO: | ||
# manifestd genesis add-genesis-account manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct 1umfx --append |
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.
EOF EOL
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/app.go (2)
388-394
: Consider using constants for upgrade heights.The upgrade heights are currently hardcoded in the code. Consider moving them to a configuration file or constants for better maintainability.
-skipUpgradeHeights := map[int64]bool{} -for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true -} +const ( + UpgradeHeight1 int64 = 1000000 + UpgradeHeight2 int64 = 2000000 +) + +var defaultSkipUpgradeHeights = map[int64]bool{ + UpgradeHeight1: true, + UpgradeHeight2: true, +} + +skipUpgradeHeights := defaultSkipUpgradeHeights +if heights := cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)); len(heights) > 0 { + skipUpgradeHeights = make(map[int64]bool) + for _, h := range heights { + skipUpgradeHeights[int64(h)] = true + } +}
395-399
: Add error details to panic message.When reading the wasm config fails, include the error details in the panic message for better debugging.
-panic(fmt.Errorf("error while reading wasm config: %w", err)) +panic(fmt.Errorf("failed to read wasm config from %s: %v", appOpts.Get(flags.FlagHome), err))
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/app.go
(16 hunks)app/test_helpers.go
(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/test_helpers.go
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: e2e-tests (ictest-group-poa)
- GitHub Check: e2e-tests (ictest-manifest)
- GitHub Check: e2e-tests (ictest-ibc)
🔇 Additional comments (8)
app/app.go (8)
138-140
: LGTM! CosmWasm imports added correctly.The required imports for the CosmWasm module are properly added.
221-221
: LGTM! Module account permissions configured correctly.The wasm module account is correctly configured with the
Burner
permission, which is the standard permission set for CosmWasm modules.
276-276
: LGTM! WasmKeeper field added to ManifestApp.The WasmKeeper field is correctly added to the ManifestApp struct.
337-337
: LGTM! Store key added for wasm module.The wasm module's store key is correctly added to the KVStoreKeys.
969-990
: LGTM! Ante handler updated with wasm configuration.The ante handler is correctly updated to include wasm configuration and store key.
385-386
: LGTM! Capability scoping for wasm module.The wasm module's capabilities are correctly scoped using the capability keeper.
745-775
: Verify module ordering in genesis and block processing.The wasm module is correctly added to the module manager and block processing order. However, verify that:
- The module is added at the end of InitGenesis as required for contract instantiation
- The module is added to both BeginBlockers and EndBlockers
✅ Verification successful
🏁 Script executed:
#!/bin/bash # Check module ordering in genesis rg -A 10 'genesisModuleOrder.*:=.*\[' app/app.go # Check module ordering in begin/end blockers rg -A 10 'OrderBeginBlockers.*=.*append' app/app.go rg -A 10 'OrderEndBlockers.*=.*append' app/app.goLength of output: 1292
The wasm module ordering is correctly implemented.
- The wasm module is properly appended to OrderBeginBlockers, OrderEndBlockers, and OrderInitGenesis, ensuring it is processed at the intended order and at the end of genesis for proper contract instantiation.
652-670
: Verify WasmKeeper initialization parameters.The WasmKeeper initialization looks correct but has some points to verify:
- The supported features list includes versions up to "cosmwasm_2_0"
- The wasm directory path is set to
filepath.Join(homePath, "wasm")
✅ Verification successful
🏁 Script executed:
#!/bin/bash # Check if the wasm directory exists and is writable test -d "wasm" || mkdir wasm if [ ! -w "wasm" ]; then echo "Warning: wasm directory is not writable" exit 1 fi # Check for any existing wasm contracts find wasm -type f -name "*.wasm" | while read -r contract; do echo "Found contract: $contract" doneLength of output: 103
I'm going to run an additional shell script that checks for "cosmwasm_2_0" in "app/app.go" to verify that the WasmKeeper is indeed configured with the expected supported features.
🏁 Script executed:
#!/bin/bash # Check that the WasmKeeper initialization in app/app.go includes the "cosmwasm_2_0" feature. rg "cosmwasm_2_0" -n app/app.goLength of output: 162
WasmKeeper configuration verified
- The supported features list correctly includes "cosmwasm_2_0".
- The wasm directory path is indeed set using filepath.Join(homePath, "wasm").
Don't run wasm proposal in the simulator as it clashes with the POA governance.
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.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
app/sim_test.go (1)
529-540
: Consider using test-scoped POA admin configuration.Setting environment variables in tests can lead to test interference if tests run in parallel. Consider:
- Using a test-scoped configuration mechanism
- Cleaning up the environment variable in test cleanup
func setPOAAdmin(config simulationtypes.Config) error { r := rand.New(rand.NewSource(config.Seed)) params := simulation.RandomParams(r) accs := simulationtypes.RandomAccounts(r, params.NumKeys()) poaAdminAddr := accs[0] - err := os.Setenv("POA_ADMIN_ADDRESS", poaAdminAddr.Address.String()) - if err != nil { - return err - } - return nil + return setTestPOAAdmin(poaAdminAddr.Address.String()) } +// setTestPOAAdmin sets the POA admin address in a test-scoped configuration +func setTestPOAAdmin(address string) error { + // TODO: Implement test-scoped configuration + return nil +}
🧹 Nitpick comments (2)
simulation/sim_params.json (1)
9-16
: New Simulation Parameters for Contract ProposalsThe addition of the following keys:
• "weight_instantiate_contract_proposal"
• "weight_update_admin_proposal"
• "weight_execute_contract_proposal"
• "weight_clear_admin_proposal"
• "weight_migrate_contract_proposal"
• "weight_pin_codes_proposal"
• "weight_unpin_codes_proposal"
• "weight_update_instantiate_config_proposal"enhances the simulation configuration for contract-related proposals in the CosmWasm module. They are all set to 0 by default, which appears to represent placeholder values. Please verify that these defaults are the intended initial weights and consider whether a consistent naming convention is desired. Notably, the earlier keys follow the "op_weight_" prefix, whereas these new parameters omit it—if this naming difference is intentional, a brief comment or documentation update might be useful for clarity.
app/sim_test.go (1)
435-435
: Document the temporary reduction in simulation runs.The comment indicates that the number of simulation runs was reduced from 5 to 3 for faster CI. Consider:
- Adding a configuration flag to control this value
- Documenting when to use the full number of runs
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
app/sim_test.go
(9 hunks)simulation/sim_params.json
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: e2e-tests (ictest-cosmwasm)
- GitHub Check: e2e-tests (ictest-group-poa)
- GitHub Check: e2e-tests (ictest-manifest)
- GitHub Check: e2e-tests (ictest-tokenfactory)
- GitHub Check: e2e-tests (ictest-poa)
- GitHub Check: e2e-tests (ictest-ibc)
- GitHub Check: tests
- GitHub Check: build
🔇 Additional comments (2)
app/sim_test.go (2)
83-83
: LGTM! Good use of temporary directories.The change to use temporary directories for each test is a good practice as it ensures proper test isolation and automatic cleanup.
Also applies to: 100-100, 154-154, 217-217, 260-260, 344-344, 392-392, 453-453, 476-477
89-91
: Document test skip conditions.Multiple simulation tests are being skipped without clear documentation explaining:
- When these tests should run
- What conditions need to be met
- How to enable these tests
Also applies to: 143-145, 197-199, 333-335, 417-419
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/ante.go
(3 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
app/ante.go
20-20: could not import github.com/CosmWasm/wasmd/x/wasm/keeper (-: # github.com/CosmWasm/wasmd/x/wasm/keeper
/tmp/go/.go-mod-cache/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/test_common.go:386:3: cannot use runtime.NewKVStoreService(keys[types.StoreKey]) (value of type "cosmossdk.io/core/store".KVStoreService) as "cosmossdk.io/store/types".StoreKey value in argument to NewKeeper: "cosmossdk.io/core/store".KVStoreService does not implement "cosmossdk.io/store/types".StoreKey (missing method Name)
/tmp/go/.go-mod-cache/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/test_common.go:400:3: cannot use availableCapabilities (variable of type []string) as string value in argument to NewKeeper)
(typecheck)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: e2e-tests (ictest-cosmwasm)
- GitHub Check: e2e-tests (ictest-group-poa)
- GitHub Check: e2e-tests (ictest-manifest)
- GitHub Check: e2e-tests (ictest-tokenfactory)
- GitHub Check: e2e-tests (ictest-poa)
- GitHub Check: e2e-tests (ictest-ibc)
- GitHub Check: tests
- GitHub Check: build
🔇 Additional comments (2)
app/ante.go (2)
20-21
: Verify CosmWasm dependency versions.The static analysis indicates potential compatibility issues with the CosmWasm dependencies. Let's verify the versions and compatibility.
✅ Verification successful
🏁 Script executed:
#!/bin/bash # Description: Check CosmWasm dependency versions and compatibility # Check go.mod for CosmWasm version echo "CosmWasm version in go.mod:" go list -m github.com/CosmWasm/wasmd # Check for any dependency conflicts go mod graph | grep CosmWasmLength of output: 16002
CosmWasm Dependency Versions Verified Successfully
The go.mod file specifies CosmWasm/wasmd at v0.51.0, which aligns with the imports in app/ante.go. Although the dependency graph shows that one test module (interchaintest) references an earlier wasmd version (v0.42.1), this does not affect the runtime configuration of our ante handler. No compatibility issues impacting the core functionality were found.
🧰 Tools
🪛 golangci-lint (1.62.2)
20-20: could not import github.com/CosmWasm/wasmd/x/wasm/keeper (-: # github.com/CosmWasm/wasmd/x/wasm/keeper
/tmp/go/.go-mod-cache/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/test_common.go:386:3: cannot use runtime.NewKVStoreService(keys[types.StoreKey]) (value of type "cosmossdk.io/core/store".KVStoreService) as "cosmossdk.io/store/types".StoreKey value in argument to NewKeeper: "cosmossdk.io/core/store".KVStoreService does not implement "cosmossdk.io/store/types".StoreKey (missing method Name)
/tmp/go/.go-mod-cache/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/test_common.go:400:3: cannot use availableCapabilities (variable of type []string) as string value in argument to NewKeeper)(typecheck)
71-72
: Verify decorator order and KVStoreService compatibility.Two concerns need to be addressed:
The placement of WASM decorators at the beginning of the chain needs verification. Typically, setup and basic validation decorators should run first.
There's a potential compatibility issue with
runtime.NewKVStoreService
. The static analysis indicates that the returnedKVStoreService
might not implement the required interface.Let's verify the CosmWasm decorator order in other projects:
Consider moving the WASM decorators after the basic setup and validation decorators to ensure proper transaction processing order.
✅ Verification successful
🏁 Script executed:
#!/bin/bash # Description: Check CosmWasm decorator order in other projects # Search for NewLimitSimulationGasDecorator usage echo "Searching for NewLimitSimulationGasDecorator usage patterns:" rg --type go "NewLimitSimulationGasDecorator.*anteDecorators" -A 10 -B 10 # Search for NewCountTXDecorator usage echo "Searching for NewCountTXDecorator usage patterns:" rg --type go "NewCountTXDecorator.*anteDecorators" -A 10 -B 10Length of output: 380
🏁 Script executed:
#!/bin/bash # New Script: Gather additional context on CosmWasm decorator usage and KVStoreService # Search for any usage of NewLimitSimulationGasDecorator across the repository. echo "Searching for any usage of wasmkeeper.NewLimitSimulationGasDecorator:" rg --type go "wasmkeeper\.NewLimitSimulationGasDecorator" -A 5 -B 5 # Search for any usage of NewCountTXDecorator across the repository. echo "Searching for any usage of wasmkeeper.NewCountTXDecorator:" rg --type go "wasmkeeper\.NewCountTXDecorator" -A 5 -B 5 # Search for any usage of runtime.NewKVStoreService across the repository. echo "Searching for any usage of runtime.NewKVStoreService:" rg --type go "runtime\.NewKVStoreService" -A 5 -B 5Length of output: 9257
Decorator order and KVStoreService integration verified.
• The new WASM decorators in app/ante.go are positioned after the context setup decorator and before subsequent validation and circuit breaker decorators, which follows the established pattern for proper transaction processing.
• The usage of runtime.NewKVStoreService in NewCountTXDecorator is consistent with its use elsewhere in the codebase (e.g., in app/app.go for various keepers), indicating that the returned service properly implements the required interfaces.
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.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
app/app.go (1)
1224-1237
: Add wasm module parameter store subspace.The wasm module's parameter store subspace is not registered in the
initParamsKeeper
function. This could cause issues with wasm module configuration.Add the wasm subspace registration:
paramsKeeper.Subspace(authtypes.ModuleName) paramsKeeper.Subspace(banktypes.ModuleName) paramsKeeper.Subspace(stakingtypes.ModuleName) paramsKeeper.Subspace(minttypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(govtypes.ModuleName) paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibcexported.ModuleName) paramsKeeper.Subspace(icahosttypes.SubModuleName) paramsKeeper.Subspace(tokenfactorytypes.ModuleName) paramsKeeper.Subspace(manifesttypes.ModuleName) paramsKeeper.Subspace(icacontrollertypes.SubModuleName) +paramsKeeper.Subspace(wasmtypes.ModuleName)
🧹 Nitpick comments (1)
app/app.go (1)
277-277
: LGTM! WasmKeeper is properly initialized with all required dependencies.The keeper is correctly configured with all necessary dependencies and the supported features list is comprehensive. However, consider extracting the supported features list to a constant for better maintainability.
+const SupportedWasmFeatures = []string{ + "iterator", + "staking", + "stargate", + "cosmwasm_1_1", + "cosmwasm_1_2", + "cosmwasm_1_3", + "cosmwasm_1_4", + "cosmwasm_2_0", +} app.WasmKeeper = wasmkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, distrkeeper.NewQuerier(app.DistrKeeper), app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, scopedWasmKeeper, app.TransferKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), filepath.Join(homePath, "wasm"), wasmConfig, - []string{"iterator", "staking", "stargate", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0"}, + SupportedWasmFeatures, GetPoAAdmin(), )Also applies to: 653-671
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/app.go
(16 hunks)app/test_helpers.go
(3 hunks)cmd/manifestd/cmd/root.go
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- app/test_helpers.go
⏰ Context from checks skipped due to timeout of 90000ms (11)
- GitHub Check: e2e-tests (ictest-cosmwasm)
- GitHub Check: e2e-tests (ictest-group-poa)
- GitHub Check: e2e-tests (ictest-manifest)
- GitHub Check: e2e-tests (ictest-tokenfactory)
- GitHub Check: e2e-tests (ictest-poa)
- GitHub Check: e2e-tests (ictest-ibc)
- GitHub Check: build amd64 for linux
- GitHub Check: build amd64 for darwin
- GitHub Check: tests
- GitHub Check: Analyze
- GitHub Check: build
🔇 Additional comments (9)
cmd/manifestd/cmd/root.go (5)
16-17
: LGTM! Import changes look good.The new imports are correctly organized and necessary for the WASM integration.
Also applies to: 23-26
104-108
: LGTM! Configuration initialization looks good.The change correctly integrates WASM configuration with the existing CometBFT configuration.
133-133
: Verify minimum gas price configuration.The minimum gas price is set to "0stake", but based on past review comments, this value might need to match the validator minimum gas price (e.g., "0.0011umfx").
126-143
: LGTM! WASM configuration structure looks good.The function correctly:
- Embeds the server config
- Adds WASM configuration
- Combines templates
145-148
: LGTM! Flag initialization looks good.The function correctly adds initialization flags for both crisis and WASM modules.
app/app.go (4)
138-140
: LGTM! CosmWasm imports and module permissions are correctly configured.The CosmWasm module is properly imported and the module account is correctly configured with burner capability for contract management.
Also applies to: 222-222
338-338
: LGTM! Store key and capability scoping are correctly configured.The wasm module's store key is properly added and the capability keeper is correctly scoped for the wasm module.
Also applies to: 387-387
970-991
: LGTM! Ante handler is properly configured with wasm support.The ante handler is correctly updated to include wasm configuration, with proper error handling in place.
761-776
: LGTM! Module ordering is correctly configured.The wasm module is properly added to begin blockers, end blockers, and init genesis orderings. The placement after other modules is appropriate as wasm contracts might depend on other module functionalities.
Also applies to: 823-823, 842-842, 869-869
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.
Actionable comments posted: 0
♻️ Duplicate comments (3)
interchaintest/cosmwasm_test.go (3)
64-64
: 🛠️ Refactor suggestionImprove contract file handling.
The contract file path is hardcoded and lacks existence validation, which could lead to unclear errors if the file is missing.
132-132
:⚠️ Potential issueFix incorrect assertion after increment operation.
The test expects the count to be 0 after incrementing it, which is logically incorrect. After incrementing, the count should be 1.
137-137
: 🛠️ Refactor suggestionHandle cleanup errors properly.
The error from
ic.Close()
is silently ignored, which could hide cleanup issues.
🧹 Nitpick comments (1)
interchaintest/cosmwasm_test.go (1)
59-59
: Follow Go naming conventions for variables.Variables should follow Go naming conventions for abbreviations:
codeId
should becodeID
codeIdStr
should becodeIDStr
Also applies to: 66-66
🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 59-59: var-naming: var codeId should be codeID
(revive)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
interchaintest/cosmwasm_test.go
(1 hunks)interchaintest/setup.go
(2 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
interchaintest/setup.go
9-9: File is not gofumpt
-ed
(gofumpt)
interchaintest/cosmwasm_test.go
139-139: File is not gofumpt
-ed
(gofumpt)
[warning] 59-59: var-naming: var codeId should be codeID
(revive)
[warning] 66-66: var-naming: var codeIdStr should be codeIDStr
(revive)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: e2e-tests (ictest-cosmwasm)
- GitHub Check: e2e-tests (ictest-group-poa)
- GitHub Check: e2e-tests (ictest-manifest)
- GitHub Check: e2e-tests (ictest-tokenfactory)
- GitHub Check: e2e-tests (ictest-poa)
- GitHub Check: e2e-tests (ictest-ibc)
- GitHub Check: tests
🔇 Additional comments (4)
interchaintest/setup.go (1)
9-9
: LGTM!The CosmWasm integration changes are correctly implemented:
- Import statement follows Go conventions
- Interface registration is properly placed with other module registrations
Also applies to: 97-97
🧰 Tools
🪛 golangci-lint (1.62.2)
9-9: File is not
gofumpt
-ed(gofumpt)
interchaintest/cosmwasm_test.go (3)
16-57
: LGTM!The test setup follows best practices with proper chain configuration and user setup.
74-92
: LGTM!The contract instantiation is well-implemented with proper error handling and assertions.
94-107
: LGTM!The query implementation is correct with proper JSON handling and response parsing.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
- Coverage 77.85% 75.06% -2.79%
==========================================
Files 33 33
Lines 2190 2282 +92
==========================================
+ Hits 1705 1713 +8
- Misses 397 478 +81
- Partials 88 91 +3 ☔ View full report in Codecov by Sentry. |
@@ -72,6 +72,10 @@ update_genesis '.app_state["staking"]["params"]["bond_denom"]="upoa"' | |||
update_genesis '.app_state["tokenfactory"]["params"]["denom_creation_fee"]=[]' | |||
update_genesis '.app_state["tokenfactory"]["params"]["denom_creation_gas_consume"]="250000"' | |||
|
|||
# Add CosmWasm configuration | |||
update_genesis '.app_state["wasm"]["params"]["code_upload_access"]["permission"]="Everybody"' |
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.
for local test nodes, yes this makes sense. mainnet, no. This is how I set it up for the hub as well. reduces pain for local devex
@@ -85,6 +85,11 @@ from_scratch () { | |||
update_test_genesis '.app_state["tokenfactory"]["params"]["denom_creation_fee"]=[]' | |||
update_test_genesis '.app_state["tokenfactory"]["params"]["denom_creation_gas_consume"]=2000000' | |||
|
|||
# WASM Configuration | |||
update_test_genesis '.app_state["wasm"]["params"]["code_upload_access"]["permission"]="Everybody"' |
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.
other comment, yes this is good for test_node for local devex
scripts/cw_template.wasm
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 add a readme for where this file is, which commit it was used to build, and the machine that built it (i.e. x86/64 or m1 mac)
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.
making a note for the future: when upgrade test are added, this sort of logic should be run before and after the upgrade as well
https://github.com/CosmosContracts/juno/blob/main/interchaintest/chain_upgrade_test.go#L110
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
interchaintest/cosmwasm_test.go (3)
17-59
: Consider making chain configuration more flexible and documented.The test setup uses hardcoded values for validators and full nodes. Consider making these configurable and adding documentation to explain the configuration choices.
+// Default chain configuration values +const ( + defaultValidators = 1 + defaultFullNodes = 1 +) func TestCosmWasm(t *testing.T) { ctx := context.Background() cfg := LocalChainConfig cfg.Name = "manifest-2" cfg.WithCodeCoverage() + // Chain configuration with customizable validator and full node counts + validators := defaultValidators + fullNodes := defaultFullNodes chains, err := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{ { Name: "manifest", Version: "local", ChainName: cfg.ChainID, - NumValidators: &vals, - NumFullNodes: &fullNodes, + NumValidators: &validators, + NumFullNodes: &fullNodes, ChainConfig: cfg, }, }).Chains(t.Name())
60-74
: Follow Go naming conventions for variables.Variables should follow Go naming conventions. Rename variables to use proper capitalization for abbreviations.
-var codeId uint64 -var codeIdStr string +var codeID uint64 +var codeIDStr string🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 61-61: var-naming: var codeId should be codeID
(revive)
[warning] 68-68: var-naming: var codeIdStr should be codeIDStr
(revive)
17-141
: Consider structuring tests to support future upgrade scenarios.As noted in the PR comments, this test should be structured to support future upgrade tests. Consider extracting common contract operations into helper functions that can be reused before and after upgrades.
Here's a script to find similar upgrade test patterns in the codebase:
❌ Verification inconclusive
🏁 Script executed:
#!/bin/bash # Search for upgrade test patterns in the codebase rg -l "upgrade.*test" --type goLength of output: 33
Action Required: Enhance Test Structure for Future Upgrades
Our initial search did not reveal any existing upgrade test patterns in the codebase. Based on the provided snippet, contract operations (upload, instantiation, querying, execution) are implemented inline without being factored into reusable helpers. In order to smoothly integrate future upgrade tests, consider refactoring these operations into common helper functions that can be invoked both before and after upgrade procedures.
- File: interchaintest/cosmwasm_test.go
- Recommendation: Extract repetitive contract operations (upload, instantiate, query, execute) into helper functions to facilitate testing upgrade scenarios when needed.
🧰 Tools
🪛 golangci-lint (1.62.2)
[warning] 61-61: var-naming: var codeId should be codeID
(revive)
[warning] 68-68: var-naming: var codeIdStr should be codeIDStr
(revive)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
interchaintest/cosmwasm_test.go
(1 hunks)
🧰 Additional context used
🪛 golangci-lint (1.62.2)
interchaintest/cosmwasm_test.go
[warning] 61-61: var-naming: var codeId should be codeID
(revive)
[warning] 68-68: var-naming: var codeIdStr should be codeIDStr
(revive)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: e2e-tests (ictest-cosmwasm)
- GitHub Check: e2e-tests (ictest-group-poa)
- GitHub Check: e2e-tests (ictest-manifest)
- GitHub Check: e2e-tests (ictest-tokenfactory)
- GitHub Check: e2e-tests (ictest-poa)
- GitHub Check: e2e-tests (ictest-ibc)
- GitHub Check: tests
- GitHub Check: build
🔇 Additional comments (6)
interchaintest/cosmwasm_test.go (6)
1-15
: LGTM!The package structure and imports are well-organized and appropriate for the test.
66-67
: Improve contract file handling.The contract file path is hardcoded and lacks existence validation, which could lead to unclear errors if the file is missing.
76-94
: LGTM!The contract instantiation test is well-implemented with proper error handling and verification.
96-109
: LGTM!The query test implementation is correct with proper response handling and verification.
111-135
: Fix incorrect assertion after increment operation.The test expects the count to be 0 after incrementing it, which is logically incorrect. After incrementing, the count should be 1.
137-141
: Handle cleanup errors properly.The error from
ic.Close()
is silently ignored, which could hide cleanup issues.
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.
Actionable comments posted: 0
♻️ Duplicate comments (3)
app/ante.go (1)
36-37
: Add validation for new CosmWasm fields.The new fields
WasmConfig
andTxCounterStoreKey
should be validated in theNewAnteHandler
function to ensure they are properly initialized.Add these validations after line 52:
if options.CircuitKeeper == nil { return nil, errors.New("circuit keeper is required for ante builder") } + if options.WasmConfig == nil { + return nil, errors.New("wasm config is required for ante builder") + } + if options.TxCounterStoreKey == nil { + return nil, errors.New("store key is required for ante builder") + }Committable suggestion skipped: line range outside the PR's diff.
app/app.go (2)
746-758
: Remove duplicate wasm module registration.The wasm module is registered twice:
- In the module manager list at line 746
- Explicitly after the module manager initialization at lines 750-758
This is redundant and could potentially cause issues.
Remove the duplicate registration:
-// Add wasm module to the app module manager -app.ModuleManager.Modules[wasmtypes.ModuleName] = wasm.NewAppModule( - appCodec, - &app.WasmKeeper, - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.MsgServiceRouter(), - app.GetSubspace(wasmtypes.ModuleName), -)📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)), )
653-671
: Review the WasmKeeper initialization path.The WasmKeeper initialization uses a joined path for the WASM directory, which could be risky when using a custom WasmVM generation. Consider using only the homePath.
Apply this diff:
- filepath.Join(homePath, "wasm"), + homePath,Also, consider using the standard capabilities list from wasmd:
- []string{"iterator", "staking", "stargate", "cosmwasm_1_1", "cosmwasm_1_2", "cosmwasm_1_3", "cosmwasm_1_4", "cosmwasm_2_0"}, + strings.Join(wasmapp.AllCapabilities(), ","),Add the import:
+ wasmapp "github.com/CosmWasm/wasmd/app"
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.// Make sure to add the following import at the top of the file: import ( // ... other imports "strings" wasmapp "github.com/CosmWasm/wasmd/app" ) ... app.WasmKeeper = wasmkeeper.NewKeeper( appCodec, runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, distrkeeper.NewQuerier(app.DistrKeeper), app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, scopedWasmKeeper, app.TransferKeeper, app.MsgServiceRouter(), app.GRPCQueryRouter(), homePath, wasmConfig, strings.Join(wasmapp.AllCapabilities(), ","), GetPoAAdmin(), )
🧹 Nitpick comments (4)
MODULE.md (4)
6-41
: Revise Table of Contents Structure
The updated TOC now comprehensively covers all modules—including the new COSM WASM Module—and details their respective subsections and commands. Please verify that all anchor links (e.g.,#cosm-wasm-module
,#module-functionality-3
) correctly link to the corresponding sections further down in the document. Additionally, note that static analysis flagged potential duplication issues (e.g., at lines ~7, ~12, ~21, and ~35) and markdownlint warnings regarding trailing punctuation in some headings (e.g., the colon at the end of "Mint and disburse native tokens (payout):"). Confirm whether these are intentional (perhaps to mimic command syntax) or if they should be revised for consistency.🧰 Tools
🪛 LanguageTool
[duplication] ~7-~7: Possible typo: you repeated a word.
Context: ... of Contents - Manifest Module - Module Functionality ...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~12-~12: Possible typo: you repeated a word.
Context: ...okens-burn-coins) - Proof of Authority Module - Module Functionality...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~21-~21: Possible typo: you repeated a word.
Context: ...move-validator-remove) - Token Factory Module - Module Functionality...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~35-~35: Possible typo: you repeated a word.
Context: ...-metadata-modify-metadata) - COSM WASM Module - Module Functionality...(ENGLISH_WORD_REPEAT_RULE)
157-157
: Confirm Token Factory Note
The note added under the Token Factory Module—"The module is designed for handling tokens created by the module itself"—provides helpful context. Ensure that its placement and phrasing align with the intended documentation flow.
225-225
: Fix Typo in Note
There is a typographical error in the note: "createor" should be corrected to "creator". This improvement will enhance the professionalism and clarity of the documentation.
255-316
: Add CosmWasm Module Documentation
The new COSM WASM Module section is well structured and aligns with the PR objectives for integrating CosmWasm features. It clearly delineates the functionalities into Contract Deployment, Administration, and Execution, and provides practical command examples for each. Please review the heading texts—such as "Contract Deployment:", "Contract Administration:", "Contract Execution:", "Upload Contract (upload-contract):", "Instantiate Contract (instantiate-contract):", and "Execute Contract (execute-contract):"—since markdownlint advises against trailing punctuation in headings. Adjust these if the trailing colons are not intentional for clarity.🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
263-263: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
269-269: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
276-276: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
284-284: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
294-294: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
306-306: Trailing punctuation in heading
Punctuation: ':'(MD026, no-trailing-punctuation)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
MODULE.md
(3 hunks)app/ante.go
(4 hunks)app/app.go
(17 hunks)
🧰 Additional context used
🪛 LanguageTool
MODULE.md
[duplication] ~7-~7: Possible typo: you repeated a word.
Context: ... of Contents - Manifest Module - Module Functionality ...
(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~12-~12: Possible typo: you repeated a word.
Context: ...okens-burn-coins) - Proof of Authority Module - Module Functionality...
(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~21-~21: Possible typo: you repeated a word.
Context: ...move-validator-remove) - Token Factory Module - Module Functionality...
(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~35-~35: Possible typo: you repeated a word.
Context: ...-metadata-modify-metadata) - COSM WASM Module - Module Functionality...
(ENGLISH_WORD_REPEAT_RULE)
🪛 markdownlint-cli2 (0.17.2)
MODULE.md
263-263: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
269-269: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
276-276: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
284-284: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
294-294: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
306-306: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
🪛 golangci-lint (1.62.2)
app/ante.go
19-19: could not import github.com/CosmWasm/wasmd/x/wasm/keeper (-: # github.com/CosmWasm/wasmd/x/wasm/keeper
/tmp/go/.go-mod-cache/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/test_common.go:386:3: cannot use runtime.NewKVStoreService(keys[types.StoreKey]) (value of type "cosmossdk.io/core/store".KVStoreService) as "cosmossdk.io/store/types".StoreKey value in argument to NewKeeper: "cosmossdk.io/core/store".KVStoreService does not implement "cosmossdk.io/store/types".StoreKey (missing method Name)
/tmp/go/.go-mod-cache/github.com/!cosm!wasm/[email protected]/x/wasm/keeper/test_common.go:400:3: cannot use availableCapabilities (variable of type []string) as string value in argument to NewKeeper)
(typecheck)
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: e2e-tests (ictest-cosmwasm)
- GitHub Check: e2e-tests (ictest-group-poa)
- GitHub Check: e2e-tests (ictest-manifest)
- GitHub Check: e2e-tests (ictest-tokenfactory)
- GitHub Check: e2e-tests (ictest-poa)
- GitHub Check: e2e-tests (ictest-ibc)
- GitHub Check: build
🔇 Additional comments (3)
app/ante.go (1)
70-71
: LGTM! The new decorators are properly integrated.The addition of
LimitSimulationGasDecorator
andCountTXDecorator
enhances the ante handler with CosmWasm-specific functionality:
- Gas limiting during simulations
- Transaction counting
app/app.go (2)
338-338
: LGTM! Store key and capability setup is correct.The CosmWasm store key is properly registered and the capability keeper is correctly scoped for the wasm module.
Also applies to: 387-387
761-776
: LGTM! Module ordering is correct.The wasm module is properly added to:
- Begin blockers
- End blockers
- Init genesis
- cosmos-sdk v0.50.11-lifted.1 - wasmd v0.54.0 - wasmvm v2.2.1 - ibc-go v8.4.0
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Makefile (1)
123-125
: Ensure New CosmWasm Test Target is Properly IntegratedThe new target
ictest-cosmwasm
is correctly defined to run the CosmWasm end-to-end test with race detection and verbose output. One suggestion is to add this target to the.PHONY
declaration to guarantee that Make interprets it as a command, not as a file. This would bring it in line with the other test targets and avoid potential issues.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
go.sum
is excluded by!**/*.sum
go.work
is excluded by!**/*.work
interchaintest/go.sum
is excluded by!**/*.sum
📒 Files selected for processing (18)
.github/workflows/build.yml
(1 hunks).github/workflows/codeql.yml
(1 hunks).github/workflows/e2e.yml
(3 hunks).github/workflows/release-bin.yaml
(1 hunks).github/workflows/simulation.yml
(1 hunks).github/workflows/test.yml
(1 hunks)Dockerfile
(2 hunks)Makefile
(2 hunks)app/ante.go
(4 hunks)app/app.go
(17 hunks)app/upgrades/next/upgrades.go
(3 hunks)app/upgrades/types.go
(1 hunks)cmd/manifestd/cmd/root.go
(3 hunks)go.mod
(10 hunks)interchaintest/go.mod
(8 hunks)interchaintest/setup.go
(2 hunks)network/manifest-1/GENESIS.md
(1 hunks)network/manifest-1/POST_GENESIS.md
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
- app/upgrades/types.go
- interchaintest/setup.go
- Dockerfile
- .github/workflows/e2e.yml
- interchaintest/go.mod
- go.mod
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: e2e-tests (ictest-cosmwasm)
- GitHub Check: e2e-tests (ictest-group-poa)
- GitHub Check: e2e-tests (ictest-manifest)
- GitHub Check: e2e-tests (ictest-tokenfactory)
- GitHub Check: e2e-tests (ictest-poa)
- GitHub Check: e2e-tests (ictest-ibc)
- GitHub Check: build
🔇 Additional comments (19)
.github/workflows/test.yml (1)
12-13
: Update GO_VERSION for Unit Tests Workflow
TheGO_VERSION
variable has been updated to1.23.6
, which aligns with the other workflows. This consistency helps ensure that unit tests are run in the same environment as the rest of the CI/CD pipeline..github/workflows/release-bin.yaml (1)
21-24
: Update Go Setup Version in Release Workflow
Thego-version
parameter for the Go setup action is updated to1.23.6
(line 23). This change is consistent with the other workflow files and should ensure that release binaries are built with the expected Go version.🧰 Tools
🪛 actionlint (1.7.4)
21-21: the runner of "actions/setup-go@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
.github/workflows/simulation.yml (1)
12-13
: Consistent Update of GO_VERSION in Simulation Tests
The environment variableGO_VERSION
is now set to1.23.6
, ensuring that simulation tests run using the updated Go version. This update maintains consistency with the rest of the workflows..github/workflows/build.yml (1)
16-18
: Update of GO_VERSION in Build Workflow
TheGO_VERSION
environment variable has been updated to1.23.6
(line 17) and is correctly referenced in the Go setup step. This ensures that both build and tidy jobs use the updated Go version..github/workflows/codeql.yml (1)
16-18
: Updated GO_VERSION for CodeQL Analysis
The environment variable update to1.23.6
in the CodeQL workflow ensures that the analysis is performed with the same Go version as the rest of the CI/CD pipelines. This change is straightforward and consistent.network/manifest-1/GENESIS.md (1)
32-33
: Updated Go Version PrerequisiteThe prerequisite line has been updated from
go1.22+
togo1.23+
, which is consistent with the changes in other parts of the project. This ensures that users have the correct Go version required for the new CosmWasm functionality and overall compatibility.network/manifest-1/POST_GENESIS.md (1)
25-25
: Aligned Prerequisite SpecificationThe update in the dependencies section from
go1.22+
togo1.23+
aligns with the changes in GENESIS.md and the overall project requirements. This consistency across documentation clearly informs users of the minimum Go version needed.app/upgrades/next/upgrades.go (2)
22-24
: LGTM! CosmWasm module store added correctly.The CosmWasm module store is properly added to the upgrade handler.
41-48
: Verify the restrictive CosmWasm permissions.The CosmWasm parameters are set with restrictive permissions:
AllowNobody
for code upload: Only governance can upload codeAccessTypeAnyOfAddresses
for contract instantiation: Only specified addresses can instantiate contractsPlease confirm if these restrictive permissions align with the project's security requirements.
app/ante.go (2)
36-38
: LGTM! CosmWasm fields added to HandlerOptions.The required CosmWasm fields are properly added to HandlerOptions.
71-74
: LGTM! CosmWasm decorators added in correct order.The CosmWasm decorators are added in the correct order:
- LimitSimulationGasDecorator: Limits gas during simulation
- CountTXDecorator: Counts transactions
- GasRegisterDecorator: Registers gas consumption
- TxContractsDecorator: Validates contract-related transactions
cmd/manifestd/cmd/root.go (3)
127-130
: LGTM! CustomAppConfig properly includes WASM config.The CustomAppConfig correctly embeds the server config and includes the WASM node config.
132-133
: Review min gas prices configuration.The min gas prices are set to "0stake". This might need to be adjusted based on your tokenomics and to prevent spam transactions.
145-148
: LGTM! Module init flags added correctly.Both crisis and wasm module init flags are properly added to the start command.
app/app.go (4)
222-222
: LGTM! Wasm module permissions set correctly.The wasm module is granted the burner permission, which is appropriate for contract-related operations.
655-674
: LGTM! WasmKeeper initialized with all required dependencies.The WasmKeeper is properly initialized with all necessary dependencies:
- Account, Bank, and Staking keepers for basic operations
- IBC-related keepers for cross-chain functionality
- Message and query routers for contract execution
- Proper configuration and capabilities
797-797
: LGTM! Wasm module added to all required execution stages.The wasm module is correctly added to:
- BeginBlockers
- EndBlockers
- InitGenesis order
Also applies to: 816-816, 843-843
944-950
: LGTM! Ante handler properly configured with WASM config.The ante handler is correctly configured to read and use the WASM configuration.
Makefile (1)
222-224
: GolangCI-Lint Version Update VerificationThe update of
golangci_version
tov1.63.4
aligns with linter improvements and bug fixes. Please verify that this newer version does not introduce any conflicts with your custom lint rules or workflow, and that it continues to run smoothly within your CI/CD pipeline.
Add cosmwasm to Manifest-ledger
Description
This PR adds the cosmwasm module to the manfiest ledger, adds cosmwasm scripts, updates simulations, add cosm wasm interchain test.
Testing
For testing locally:
test_node.sh
scriptupload_contract.sh
scriptOtherwise view the CI/Docker tests.
Breaking Changes (if applicable)
@fmorency
Checklist:
Summary by CodeRabbit
New Features
Documentation