Skip to content

fix: deduplicate block fetch in getTransactionReceipt#3244

Merged
bdchatham merged 1 commit intomainfrom
refactor/opt-03-deduplicate-block-fetch-in-receipt
Apr 15, 2026
Merged

fix: deduplicate block fetch in getTransactionReceipt#3244
bdchatham merged 1 commit intomainfrom
refactor/opt-03-deduplicate-block-fetch-in-receipt

Conversation

@bdchatham
Copy link
Copy Markdown
Contributor

@bdchatham bdchatham commented Apr 14, 2026

Summary

  • getTransactionReceipt was fetching the same block twice via blockByNumberRespectingWatermarks: once inside the ante-failure branch (Status==0 && GasUsed==0) at line 141, and again unconditionally at line 172 for encodeReceipt
  • Hoisted the block fetch above the conditional so both the ante-failure sender recovery path and the receipt encoding path share a single fetch

Motivation

Every eth_getTransactionReceipt call that hits the ante-failure path (tx failed before reaching the VM) paid for two redundant block store lookups. This is a hot RPC method — wallets, explorers, and indexers poll it continuously.

Test plan

  • All 6 TestGetTransactionReceipt* tests pass
  • All 25 TestGetTransaction* tests pass (zero regressions)
  • gofmt -s -l evmrpc/tx.go produces no output
  • go build ./evmrpc/ compiles cleanly

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedApr 14, 2026, 6:06 PM

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.26%. Comparing base (9795d18) to head (6e3e648).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3244   +/-   ##
=======================================
  Coverage   59.26%   59.26%           
=======================================
  Files        2070     2070           
  Lines      169788   169784    -4     
=======================================
- Hits       100631   100629    -2     
+ Misses      60358    60357    -1     
+ Partials     8799     8798    -1     
Flag Coverage Δ
sei-chain-pr 63.86% <100.00%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
evmrpc/tx.go 85.01% <100.00%> (+0.48%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

getTransactionReceipt fetched the same block twice: once inside the
ante-failure branch (Status==0 && GasUsed==0) to recover sender info,
and again unconditionally for receipt encoding. Hoist the single fetch
above the branch so both paths share it, eliminating the redundant
block store lookup on every receipt query that hits the ante-failure
path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bdchatham bdchatham force-pushed the refactor/opt-03-deduplicate-block-fetch-in-receipt branch 2 times, most recently from efbe3b0 to 6e3e648 Compare April 14, 2026 18:05
@bdchatham bdchatham marked this pull request as ready for review April 14, 2026 18:07
@bdchatham bdchatham requested a review from yzang2019 April 14, 2026 19:47
@bdchatham bdchatham added this pull request to the merge queue Apr 15, 2026
Merged via the queue into main with commit 8aeb6ca Apr 15, 2026
41 checks passed
@bdchatham bdchatham deleted the refactor/opt-03-deduplicate-block-fetch-in-receipt branch April 15, 2026 14:56
yzang2019 added a commit that referenced this pull request Apr 16, 2026
* main:
  Fix buffer offset in ProposerPriorityHash (CON-200) (#3255)
  Handle error case in light client divergence detector (#3254)
  perf(evmrpc): eliminate redundant block fetches in simulate backend (#3208)
  fix(evmrpc): omit notifications from legacy JSON-RPC batch responses per spec (#3246)
  fix: deduplicate block fetch in getTransactionReceipt (#3244)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants