-
Notifications
You must be signed in to change notification settings - Fork 202
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 validation for multi message execution wasm #2092
Conversation
WalkthroughThe pull request includes updates to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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 (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2092 +/- ##
==========================================
+ Coverage 64.52% 64.58% +0.06%
==========================================
Files 271 271
Lines 21235 21237 +2
==========================================
+ Hits 13701 13716 +15
+ Misses 6584 6574 -10
+ Partials 950 947 -3
|
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: 3
🧹 Outside diff range and nitpick comments (2)
CHANGELOG.md (1)
139-139
: Consider expanding the changelog entry to be more descriptive.The current entry "feat(evm): add validation for wasm multi message execution" could be more informative about:
- The specific validations added
- The connection to Code423n4 issue Coaching session on Cosmos SDK unit testing w/ Uncle AgentSmith #34
- The impact on contract interactions
Consider expanding it to something like:
- - [#2092](https://github.com/NibiruChain/nibiru/pull/2092) - feat(evm): add validation for wasm multi message execution + - [#2092](https://github.com/NibiruChain/nibiru/pull/2092) - feat(evm): add validation for wasm multi message execution. Implements enhanced validation checks for multiple contract calls in response to Code423n4 issue #34, improving the security and reliability of contract interactions.x/evm/precompile/wasm.go (1)
334-342
: Consider executing all messages even if some executions failIn the execution loop, the function returns immediately when an execution error occurs. Executing all messages and collecting errors can provide a complete set of execution results to the caller.
Here's a potential modification:
var responses [][]byte +var executionErrors []error // Execute all messages after validation for _, msg := range validatedMsgs { respBz, e := p.Wasm.Execute(ctx, msg.contract, callerBech32, msg.msgArgs, msg.funds) if e != nil { - err = fmt.Errorf("execute failed for contract %s: %w", msg.contract.String(), e) - return + executionErrors = append(executionErrors, fmt.Errorf("execute failed for contract %s: %w", msg.contract.String(), e)) + continue } responses = append(responses, respBz) } +if len(executionErrors) > 0 { + err = fmt.Errorf("execution errors occurred: %v", executionErrors) + return +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- CHANGELOG.md (1 hunks)
- x/evm/precompile/wasm.go (2 hunks)
- x/evm/precompile/wasm_test.go (2 hunks)
🔇 Additional comments (2)
CHANGELOG.md (1)
Line range hint
1-1207
: LGTM! Well-structured changelog.The changelog follows proper semantic versioning, has clear categorization of changes, and maintains consistent formatting throughout.
x/evm/precompile/wasm_test.go (1)
731-773
: LGTM: TheTestExecuteMultiPartialExecution
function correctly verifies no state change on validation failureThe test effectively ensures that no state changes occur if any message in the batch fails validation, maintaining the integrity of the system as expected.
x/evm/precompile/wasm.go
Outdated
// Validate each message using parseExecuteArgs | ||
for _, msg := range wasmExecMsgs { | ||
// Create args array in the format expected by parseExecuteArgs | ||
singleMsgArgs := []any{ | ||
msg.ContractAddr, | ||
msg.MsgArgs, | ||
msg.Funds, | ||
} | ||
|
||
contract, msgArgs, funds, e := p.parseExecuteArgs(singleMsgArgs) | ||
if e != nil { | ||
err = fmt.Errorf("Execute failed: %w", e) | ||
err = fmt.Errorf("validation failed for contract %s: %w", msg.ContractAddr, e) | ||
return | ||
} | ||
var funds sdk.Coins | ||
for _, fund := range m.Funds { | ||
funds = append(funds, sdk.Coin{ | ||
Denom: fund.Denom, | ||
Amount: sdk.NewIntFromBigInt(fund.Amount), | ||
}) | ||
} | ||
respBz, e := p.Wasm.Execute(ctx, wasmContract, callerBech32, m.MsgArgs, funds) | ||
|
||
validatedMsgs = append(validatedMsgs, validatedMsg{ | ||
contract: contract, | ||
msgArgs: msgArgs, | ||
funds: funds, | ||
}) | ||
} |
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
Enhance validation by collecting all errors before returning
Currently, the validation loop returns upon encountering the first error. Collecting all validation errors before returning could provide more comprehensive feedback to the caller.
You might modify the code as follows:
var validationErrors []error
for _, msg := range wasmExecMsgs {
// Create args array in the format expected by parseExecuteArgs
singleMsgArgs := []any{
msg.ContractAddr,
msg.MsgArgs,
msg.Funds,
}
contract, msgArgs, funds, e := p.parseExecuteArgs(singleMsgArgs)
if e != nil {
- err = fmt.Errorf("validation failed for contract %s: %w", msg.ContractAddr, e)
- return
+ validationErrors = append(validationErrors, fmt.Errorf("validation failed for contract %s: %w", msg.ContractAddr, e))
continue
}
validatedMsgs = append(validatedMsgs, validatedMsg{
contract: contract,
msgArgs: msgArgs,
funds: funds,
})
}
+if len(validationErrors) > 0 {
+ err = fmt.Errorf("validation errors occurred: %v", validationErrors)
+ return
+}
📝 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.
// Validate each message using parseExecuteArgs | |
for _, msg := range wasmExecMsgs { | |
// Create args array in the format expected by parseExecuteArgs | |
singleMsgArgs := []any{ | |
msg.ContractAddr, | |
msg.MsgArgs, | |
msg.Funds, | |
} | |
contract, msgArgs, funds, e := p.parseExecuteArgs(singleMsgArgs) | |
if e != nil { | |
err = fmt.Errorf("Execute failed: %w", e) | |
err = fmt.Errorf("validation failed for contract %s: %w", msg.ContractAddr, e) | |
return | |
} | |
var funds sdk.Coins | |
for _, fund := range m.Funds { | |
funds = append(funds, sdk.Coin{ | |
Denom: fund.Denom, | |
Amount: sdk.NewIntFromBigInt(fund.Amount), | |
}) | |
} | |
respBz, e := p.Wasm.Execute(ctx, wasmContract, callerBech32, m.MsgArgs, funds) | |
validatedMsgs = append(validatedMsgs, validatedMsg{ | |
contract: contract, | |
msgArgs: msgArgs, | |
funds: funds, | |
}) | |
} | |
// Validate each message using parseExecuteArgs | |
var validationErrors []error | |
for _, msg := range wasmExecMsgs { | |
// Create args array in the format expected by parseExecuteArgs | |
singleMsgArgs := []any{ | |
msg.ContractAddr, | |
msg.MsgArgs, | |
msg.Funds, | |
} | |
contract, msgArgs, funds, e := p.parseExecuteArgs(singleMsgArgs) | |
if e != nil { | |
validationErrors = append(validationErrors, fmt.Errorf("validation failed for contract %s: %w", msg.ContractAddr, e)) | |
continue | |
} | |
validatedMsgs = append(validatedMsgs, validatedMsg{ | |
contract: contract, | |
msgArgs: msgArgs, | |
funds: funds, | |
}) | |
} | |
if len(validationErrors) > 0 { | |
err = fmt.Errorf("validation errors occurred: %v", validationErrors) | |
return | |
} |
x/evm/precompile/wasm_test.go
Outdated
s.Require().Error(err) | ||
s.Require().Contains(err.Error(), tc.wantError) | ||
s.Require().Nil(ethTxResp) |
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 error assertions by checking error types instead of error messages
Comparing error messages using substrings can be brittle and may lead to fragile tests. Consider checking for specific error types or using error wrapping to make your tests more robust and maintainable.
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.
The issue describes validation specifically for the m.MsgArgs
field, which should only be a few line change, not 200+. The validate basic call is for the JSON arguments
You can remove most of this code and type the msgArgs from raw bytes to the type from Wasm validate that
msgArgsCopy := wasm.RawContractMessage(msgArgs)
if e := msgArgsCopy.ValidateBasic(); e != nil {
err = ErrArgTypeValidation(e.Error(), args[argIdx])
return
}
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.
Test cases look good
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: 6
🧹 Outside diff range and nitpick comments (1)
CHANGELOG.md (1)
159-159
: Add more details about the validation changes.
While the entry correctly references PR #2092, it would be helpful to expand on what specific validation was added for wasm multi message execution to help users understand the security implications.
Consider expanding the entry to something like:
-- [#2092](https://github.com/NibiruChain/nibiru/pull/2092) - feat(evm): add validation for wasm multi message execution
++ [#2092](https://github.com/NibiruChain/nibiru/pull/2092) - feat(evm): add validation for wasm multi message execution to ensure message integrity and prevent potential security vulnerabilities
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- CHANGELOG.md (1 hunks)
- x/evm/precompile/wasm.go (2 hunks)
- x/evm/precompile/wasm_test.go (2 hunks)
🧰 Additional context used
🪛 GitHub Check: unit-tests
x/evm/precompile/wasm_test.go
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
🪛 GitHub Check: integration-tests
x/evm/precompile/wasm_test.go
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
🪛 GitHub Check: lint
x/evm/precompile/wasm_test.go
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState) (typecheck)
🔇 Additional comments (5)
x/evm/precompile/wasm_test.go (3)
318-322
: Existing comment about reusing WasmExecuteMsg type is still valid
324-457
: Well-structured test cases for multi-message validation
The test cases comprehensively cover various validation scenarios including:
- Valid single and multiple messages
- Invalid contract addresses
- Malformed message arguments
- Invalid funds
- Partial validation failures
This ensures robust validation of the multi-message execution feature.
🧰 Tools
🪛 GitHub Check: unit-tests
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
🪛 GitHub Check: integration-tests
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
🪛 GitHub Check: lint
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
459-501
: Well-designed test for partial execution validation
The test effectively verifies that the system maintains atomicity during multi-message execution by ensuring no state changes occur when any message in the batch fails validation.
🧰 Tools
🪛 GitHub Check: unit-tests
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
🪛 GitHub Check: integration-tests
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
🪛 GitHub Check: lint
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState) (typecheck)
CHANGELOG.md (1)
151-158
: LGTM!
The changelog entries for PRs #2073-#2089 are properly formatted and provide clear descriptions of the changes made.
x/evm/precompile/wasm.go (1)
289-308
: The previous suggestion to collect all validation errors is still applicable
As per the previous review comment, the current implementation returns upon encountering the first validation error. Collecting all validation errors before returning could provide more comprehensive feedback to the caller.
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: 2
🧹 Outside diff range and nitpick comments (1)
x/evm/precompile/wasm_test.go (1)
324-501
: Consider adding edge cases to the test suite
While the current test coverage is good, consider adding these edge cases:
- Maximum message batch size validation
- Empty message batch validation
- Duplicate contract calls within the same batch
- Gas limit exhaustion scenarios
🧰 Tools
🪛 GitHub Check: unit-tests
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
🪛 GitHub Check: lint
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState) (typecheck)
🪛 GitHub Check: integration-tests
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- CHANGELOG.md (1 hunks)
- x/evm/precompile/wasm.go (2 hunks)
- x/evm/precompile/wasm_test.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- CHANGELOG.md
🧰 Additional context used
🪛 GitHub Check: unit-tests
x/evm/precompile/wasm_test.go
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
🪛 GitHub Check: lint
x/evm/precompile/wasm_test.go
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState) (typecheck)
🪛 GitHub Check: integration-tests
x/evm/precompile/wasm_test.go
[failure] 334-334:
undefined: SetupWasmContracts
[failure] 442-442:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 463-463:
undefined: SetupWasmContracts
[failure] 467-467:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
[failure] 490-490:
assignment mismatch: 2 variables but deps.EvmKeeper.CallContractWithInput returns 3 values
[failure] 500-500:
s.assertWasmCounterState undefined (type *WasmSuite has no field or method assertWasmCounterState)
🔇 Additional comments (4)
x/evm/precompile/wasm.go (3)
277-285
: LGTM! Well-structured validation setup.
The validatedMsg
struct design and slice pre-allocation demonstrate good practices for performance and maintainability.
286-306
: Consider collecting all validation errors.
The current implementation returns on the first validation error. As suggested in the past review, collecting all validation errors before returning could provide more comprehensive feedback to the caller.
311-320
: LGTM! Correct handling of execution errors.
The current implementation, which returns on the first execution error, is the right approach. This ensures atomic execution of the batch - either all messages succeed, or none of them are executed, maintaining state consistency.
Note: While collecting all validation errors (as suggested earlier) would be helpful, collecting execution errors would be inappropriate as it could lead to partial state changes.
x/evm/precompile/wasm_test.go (1)
318-322
: Consider reusing the existing WasmExecuteMsg
type
This type definition appears to be duplicated. A similar type already exists in the precompile package.
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 and nitpick comments (3)
x/evm/precompile/wasm.go (1)
Line range hint 279-301
: Consider collecting all validation errors before execution
Currently, the function returns on the first validation error. For better UX, consider collecting all validation errors before execution, especially since this is a batch operation. This would help users fix all issues at once rather than discovering them one by one.
Here's a suggested implementation:
var responses [][]byte
+var validationErrors []error
for i, m := range wasmExecMsgs {
wasmContract, e := sdk.AccAddressFromBech32(m.ContractAddr)
if e != nil {
- err = fmt.Errorf("Execute failed at index %d: %w", i, e)
- return
+ validationErrors = append(validationErrors, fmt.Errorf("validation failed at index %d: invalid contract address: %w", i, e))
+ continue
}
msgArgsCopy := wasm.RawContractMessage(m.MsgArgs)
if e := msgArgsCopy.ValidateBasic(); e != nil {
- err = fmt.Errorf("Execute failed at index %d: error parsing msg args: %w", i, e)
- return
+ validationErrors = append(validationErrors, fmt.Errorf("validation failed at index %d: invalid message args: %w", i, e))
+ continue
}
+
+ // Store validated messages for execution
+ validatedMsgs = append(validatedMsgs, struct {
+ contract sdk.AccAddress
+ msgArgs []byte
+ funds sdk.Coins
+ }{
+ contract: wasmContract,
+ msgArgs: m.MsgArgs,
+ funds: funds,
+ })
}
+if len(validationErrors) > 0 {
+ return nil, fmt.Errorf("validation errors: %v", validationErrors)
+}
+// Execute all validated messages
+for i, msg := range validatedMsgs {
var funds sdk.Coins
for _, fund := range m.Funds {
funds = append(funds, sdk.Coin{
Denom: fund.Denom,
Amount: sdk.NewIntFromBigInt(fund.Amount),
})
}
respBz, e := p.Wasm.Execute(ctx, msg.contract, callerBech32, msg.msgArgs, msg.funds)
if e != nil {
err = fmt.Errorf("Execute failed at index %d: %w", i, e)
return
}
responses = append(responses, respBz)
}
This approach:
- Collects all validation errors before execution
- Separates validation from execution
- Provides comprehensive feedback about all validation issues
- Maintains the current execution behavior (fail-fast on execution errors)
x/evm/precompile/wasm_test.go (2)
350-432
: Consider adding test case for empty message array
The test cases are comprehensive but missing validation for an empty array of messages. This edge case should be handled explicitly.
Add this test case to the array:
testCases := []struct {
name string
executeMsgs []WasmExecuteMsg
wantError string
}{
+ {
+ name: "invalid - empty message array",
+ executeMsgs: []WasmExecuteMsg{},
+ wantError: "empty message array",
+ },
// ... existing test cases ...
}
457-498
: Enhance partial execution test coverage
The test effectively verifies that state remains unchanged when the second message fails, but consider adding more scenarios:
- First message fails
- Last message fails in a larger batch
- Middle message fails in a larger batch
This would provide more confidence in the rollback behavior across different positions in the message array.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
- CHANGELOG.md (1 hunks)
- x/evm/precompile/wasm.go (3 hunks)
- x/evm/precompile/wasm_test.go (2 hunks)
- x/evm/statedb/statedb.go (0 hunks)
💤 Files with no reviewable changes (1)
- x/evm/statedb/statedb.go
🚧 Files skipped from review as they are similar to previous changes (1)
- CHANGELOG.md
🔇 Additional comments (3)
x/evm/precompile/wasm.go (2)
13-13
: LGTM: Required import for WASM message validation
The addition of the WASM types import is necessary to support the new validation feature using RawContractMessage
.
279-288
: LGTM: Enhanced validation for multi-message execution
The added validation improves the robustness of the system by:
- Validating contract addresses before execution
- Ensuring message arguments are properly formatted using
ValidateBasic()
- Providing clear error messages with index information for debugging
This aligns well with the PR objectives of adding validation for multi-message execution.
x/evm/precompile/wasm_test.go (1)
324-498
: Implementation looks solid! 👍
The test implementation is well-structured and provides good coverage of the multi-message execution validation:
- Comprehensive validation scenarios
- Clear test case organization
- Proper error handling verification
- State change validation
Purpose / Abstract
Summary by CodeRabbit
New Features
Bug Fixes
Documentation