rpc: seed callTracer log index with the block's preceding logs - #27356
Open
MysticRyuujin wants to merge 2 commits into
Open
MysticRyuujin wants to merge 2 commits into
MysticRyuujin wants to merge 2 commits into
Conversation
debug_traceTransaction seeds the tracer with the log count of the preceding receipts, and debug_traceBlock* and traceChain accumulate it across the block. Follows ethereum/execution-apis#855; needs revm-inspectors set_next_log_index.
MysticRyuujin
marked this pull request as ready for review
September 27, 2026 13:45
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change makes the callTracer
logs[].indexfollow ethereum/execution-apis#855: "The log's index within the block: the number of logs that took effect in the block before this one, counting the logs of all preceding transactions. It MUST equal the logIndex of the same log in the transaction receipt. Logs of reverted frames never take effect and do not consume an index, and onlyTopCall does not change the numbering. For debug_traceCall, where no receipt exists, numbering starts at zero for the traced call."The counter lives in revm-inspectors and restarts at 0 for every traced transaction. The companion change paradigmxyz/revm-inspectors#512 adds
DebugInspector::set_next_log_index, restores the counter when a frame reverts, and setspositionto 0 underonlyTopCall. This PR depends on that unreleased change and does not build until a release with it is picked up.debug_traceTransactionreads the block's receipts from the RPC cache and seeds the tracer with the log count of the preceding transactions, through the same helpereth_getTransactionReceiptuses forlogIndex. It reads the receipts becauseinspect_transaction_in_blockmay attach a BAL instead of replaying the preceding transactions.debug_traceBlock*andtraceChainaccumulate the log count across the block and seed the tracer again after eachfuse.debug_traceCallanddebug_traceCallManykeep starting at 0.When the block's receipts are pruned, the seed falls back to 0 and the numbering is transaction-local, as before. Reviewers may want to decide if that fallback is acceptable; a receipt to match does not exist in that case, and deriving the count through replay does not work on the BAL path.
Hive rpc-compat with the fixtures of the spec PR, built from this branch with the patched revm-inspectors:
debug_traceTransaction/calltracer-with-log-indexpasses (root logindex0x3, was 0x0) anddebug_traceTransaction/calltracer-only-top-call-with-logpasses (position0x0, was 0x8). The five other callTracerdebug_traceTransactionfixtures stay green.debug_traceCall/calltracer-only-top-callfails before and after because the response carries the EIP-8037 gas fields; that is unrelated to this change.