-
Notifications
You must be signed in to change notification settings - Fork 193
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
chore: add checktx for AnteDecVerifyEthAcc #2171
Conversation
📝 WalkthroughWalkthroughThis pull request introduces a modification to the Changes
Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (5)
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 #2171 +/- ##
==========================================
- Coverage 64.89% 64.86% -0.03%
==========================================
Files 277 277
Lines 22302 22305 +3
==========================================
- Hits 14472 14468 -4
- Misses 6839 6847 +8
+ Partials 991 990 -1
|
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 (2)
CHANGELOG.md
(1 hunks)app/evmante/evmante_verify_eth_acc.go
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: integration-tests
- GitHub Check: e2e-evm
🔇 Additional comments (1)
app/evmante/evmante_verify_eth_acc.go (1)
43-45
: Verify test coverage and consistency with other AnteHandlersPlease ensure that:
- Test cases cover both CheckTx and DeliverTx scenarios
- This optimization pattern aligns with other AnteHandlers in the codebase
Let's verify the test coverage and similar patterns:
✅ Verification successful
Test coverage and AnteHandler consistency verified
The implementation has comprehensive test coverage and follows consistent patterns with other AnteHandlers in the codebase. The test suite includes both success and failure scenarios, with explicit CheckTx verification.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for test files covering this AnteHandler fd -e go test.*evmante.*verify_eth_acc # Look for similar CheckTx patterns in other AnteHandlers rg -B 2 -A 2 "IsCheckTx\(\)" app/Length of output: 1317
Script:
#!/bin/bash # Search for test files in app directory containing verify_eth_acc rg -l "verify_eth_acc" app/**/*_test.go # Look for actual test implementations rg -B 2 -A 5 "TestVerifyEthAcc|verify_eth_acc" app/Length of output: 753
Script:
#!/bin/bash # View the content of the test file cat app/evmante/evmante_verify_eth_acc_test.goLength of output: 2799
if !ctx.IsCheckTx() { | ||
return next(ctx, tx, simulate) | ||
} |
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.
Critical: The CheckTx optimization logic is reversed
The current implementation skips validation during DeliverTx (actual block execution) and performs validation during CheckTx (mempool pre-screening). This is the opposite of the intended optimization and could allow invalid transactions to be processed during block execution.
Apply this diff to correct the logic:
-if !ctx.IsCheckTx() {
+if ctx.IsCheckTx() {
return next(ctx, tx, simulate)
}
This correction will:
- Skip expensive validation during CheckTx (mempool) as intended
- Ensure full validation during DeliverTx (block execution) for security
📝 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.
if !ctx.IsCheckTx() { | |
return next(ctx, tx, simulate) | |
} | |
if ctx.IsCheckTx() { | |
return next(ctx, tx, simulate) | |
} |
What is the URL for the original issue? |
|
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.
I actually don't think this is a good idea to add in (the QA report and Ethermint did not think through this critically enough).
CheckTx
is only called when a tx arrives at the local mempool, but not at block execution time. Only DeliverTx
is called at block execution time.
That means a malicious validator could include a tx in the proposed block that doesn't pass this AnteHandler check, and we'd bypass through that check if we merge this PR. Essentially, we still want this check to run on DeliverTx
.
Agreed on this point from @k-yang (#2171 (review)). I think we should not include this change |
Pull request was closed
Purpose / Abstract
Based on QA-11 Missing CheckTx optimization in account verification leads to redundant processing