fix(evmrpc): pass raw tx bytes to DeliverTx in BlockByNumber TraceRunnable (CON-326)#3598
Conversation
…nable
Non-traced Cosmos transactions replayed via BlockByNumber were passing an
empty RequestDeliverTxV2{} to DeliverTx, leaving ctx.TxBytes() nil.
The ante handler reads ctx.TxBytes() to charge TxSizeCostPerByte gas,
so a nil value causes divergence from the original on-chain execution.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR SummaryMedium Risk Overview The change also hoists Reviewed by Cursor Bugbot for commit 66f9018. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3598 +/- ##
==========================================
- Coverage 58.96% 58.25% -0.72%
==========================================
Files 2208 2140 -68
Lines 181757 173969 -7788
==========================================
- Hits 107164 101337 -5827
+ Misses 64976 63612 -1364
+ Partials 9617 9020 -597
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Summary
BlockByNumberreplays non-traced (Cosmos) transactions via aTraceRunnableclosure but was passingabci.RequestDeliverTxV2{}(empty) toDeliverTxBaseApp.DeliverTxsetsctx.TxBytes = req.Txbefore calling the ante handler; with an emptyreq.Tx,ctx.TxBytes()is nilTxSizeCostPerByte * len(ctx.TxBytes())gas — nil bytes means 0 gas charged, diverging from actual on-chain executiontxBytes := tmBlock.Block.Txs[i]before the closure (also making the loop variable capture explicit and version-independent) and passRequestDeliverTxV2{Tx: txBytes}replayTransactionTillIndexalready did this correctly;BlockByNumberwas the only callsite missing itTest plan
TestBlockByNumberNonTracedTxPassesTxBytes— new test using a minimalBaseAppwith a spy ante handler that capturesctx.TxBytes(); asserts it equals the raw tx bytes from the block. Verified it fails without the fix and passes with it.🤖 Generated with Claude Code