Skip to content

fix(tracing): return empty arrays for blocks without EVM transactions - #8

Closed
Ri-go wants to merge 1 commit into
masterfrom
codex/fix-empty-trace-array
Closed

fix(tracing): return empty arrays for blocks without EVM transactions#8
Ri-go wants to merge 1 commit into
masterfrom
codex/fix-empty-trace-array

Conversation

@Ri-go

@Ri-go Ri-go commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • initialize block trace results as a non-nil empty slice when a block has no Ethereum transactions
  • preserve virtual transaction alignment while ensuring empty results serialize as [] instead of null
  • cover both completely empty blocks and Cosmos-only blocks with no Ethereum messages

Rationale

Injective chain initializes empty block trace results as a non-nil slice, so its JSON response is []. The v1.4.3 gateway alignment path started from a nil slice and returned null when there were no visible transaction hashes. This restores chain-compatible output without changing the v1.4.3 transaction hash and alignment behavior.

Testing

  • go test ./internal/evm/rpc/backend -run "TestTraceBlockWithoutEthereumTransactionsReturnsEmptyArray|TestAlignTraceBlockResultsWithVisibleTransactions|TestTraceBlockLatestSendsResolvedBlockContextHeight" -count=1
  • go test ./...

Summary by CodeRabbit

  • Bug Fixes
    • Fixed block tracing responses for blocks without Ethereum transactions.
    • Such blocks now return a valid empty array ([]) instead of a null result.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: efc4844c-d4ce-4333-bf4f-48003f190f43

📥 Commits

Reviewing files that changed from the base of the PR and between bd53603 and 8dc0737.

📒 Files selected for processing (2)
  • internal/evm/rpc/backend/trace_helpers_test.go
  • internal/evm/rpc/backend/tracing.go

📝 Walkthrough

Walkthrough

TraceBlock now returns an empty non-nil trace slice when blocks contain no Ethereum transactions. Tests cover both empty blocks and blocks containing non-Ethereum transactions, asserting the serialized result is [].

Changes

TraceBlock empty results

Layer / File(s) Summary
Empty-result handling and validation
internal/evm/rpc/backend/tracing.go, internal/evm/rpc/backend/trace_helpers_test.go
TraceBlock uses an empty slice for zero Ethereum transactions, with tests confirming the result is non-nil and serializes to [] for both covered block cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: maxim-inj

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: tracing now returns empty arrays for blocks without EVM transactions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-empty-trace-array

Comment @coderabbitai help to get the list of available commands.

@Ri-go

Ri-go commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

Closing in favor of a smaller replacement PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant