fix: evm tx index and log indexes are not patched (alternative design)#1132
Conversation
* align patch * cleanup
fix: patch expected failure txs
Greptile SummaryThis PR fixes EVM tx and log indexing under BlockSTM by narrowing the post-execution patch to only the two fields that parallel execution actually breaks ( Confidence Score: 5/5Safe to merge; all remaining findings are P2 test-quality observations that do not affect production correctness. The core logic is well-reasoned and the two previously raised P1 concerns (unmarshal hard-failure and ethTxIndex divergence in mixed blocks) are both addressed and tested. The only open findings are P2: a misleading test-case name in response_test.go and a minor coverage gap in the STM contract test's outer assertions. Neither affects runtime behavior. x/vm/types/response_test.go — test case names for failed-tx scenarios should be clarified to avoid implying the counter never advances for failed EVM txs Important Files Changed
|
…uteKeyTxIndex in mixed blocks
|
@greptile review |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1132 +/- ##
==========================================
+ Coverage 62.24% 65.55% +3.30%
==========================================
Files 332 335 +3
Lines 23725 23643 -82
==========================================
+ Hits 14767 15498 +731
+ Misses 7072 6930 -142
+ Partials 1886 1215 -671
🚀 New features to boost your workflow:
|
Alternative to #812.
Fixes EVM tx and log indexing under BlockSTM, and keeps RPC receipt indices consistent in mixed-tx blocks.
ctx.TxIndex() is actually correct under both sequential and STM runners. The SDK passes the original block-order index into deliverTx.
However, the SDK's STMRunner passes the original block-order index into deliverTx, which BaseApp forwards into ctx.TxIndex(). The only invariant parallel execution actually breaks is the cumulative log.Index, since it depends on the log count of every prior successful eth tx in the block.
These are patched once per block, post-execution, by evmtypes.PatchTxResponses, installed as a TxRunner wrapper via the new x/vm/runner package (runner.SetRunner is now required for sequential and STM runners alike).
Changes from #812: