Skip to content

fix(eth): use 0-indexed transactionPosition in trace_block - #13610

Merged
rvagg merged 1 commit into
masterfrom
rvagg/fix-trace-tx-position
May 11, 2026
Merged

fix(eth): use 0-indexed transactionPosition in trace_block#13610
rvagg merged 1 commit into
masterfrom
rvagg/fix-trace-tx-position

Conversation

@rvagg

@rvagg rvagg commented May 5, 2026

Copy link
Copy Markdown
Member

Thanks to Yan from Blockscout for picking this one up. It's been present since the beginning for these APIs. Confirmed incorrect by querying public Ethereum APIs to make sure they are all zero-based.

curl "https://filecoin.chain.love/rpc/v1" -s -X POST -H "Content-Type: application/json" \
  --data '{"id":1,"jsonrpc":"2.0","method":"trace_block","params":["latest"]}' \
  | jq '.result | map(.transactionPosition) | unique' | head -5
[
  1,
  2,
  3,
  4,
$ curl "https://docs-demo.quiknode.pro/" -s -X POST -H "Content-Type: application/json" \
  --data '{"id":1,"jsonrpc":"2.0","method":"trace_block","params":["latest"]}' \
  | jq '.result | map(.transactionPosition) | unique' | head -5
[
  0,
  1,
  2,
  3,

cc @LesnyRumcajs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the Ethereum trace API’s transactionPosition indexing so trace responses align with Ethereum’s zero-based transaction ordering and match Lotus’s block transaction indices.

Changes:

  • Move EthTraceBlock’s message index increment so the first non-system transaction is reported as position 0 instead of 1.
  • Update integration-test expectations in TestTraceFilter to reflect zero-based transactionPosition.
  • Document the API behavior change in the unreleased changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
node/impl/eth/trace.go Adjusts transactionPosition assignment for block-derived trace results.
itests/eth_transactions_test.go Updates trace filter assertions for the new zero-based positions.
CHANGELOG.md Records the trace API off-by-one fix for the next release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread itests/eth_transactions_test.go
@github-project-automation github-project-automation Bot moved this from 📌 Triage to ✔️ Approved by reviewer in FilOz May 5, 2026
@rvagg
rvagg merged commit ac09d12 into master May 11, 2026
261 of 264 checks passed
@rvagg
rvagg deleted the rvagg/fix-trace-tx-position branch May 11, 2026 08:43
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FilOz May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

3 participants