evmrpc: return null from eth_getTransactionReceipt for blocks above safe latest#3501
Conversation
…afe latest When the receipt's block sits above the watermark MIN (e.g. tendermint Status lags the receipt store by a block), return JSON null instead of propagating ErrBlockHeightNotYetAvailable. This matches the Ethereum spec's "not yet mined" semantics so clients keep polling, and mirrors the same handling already in eth_getBlockByNumber. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR SummaryMedium Risk Overview Adds Reviewed by Cursor Bugbot for commit 74a422e. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
…ll_above_watermark
Merged in #3438 from main which added EvmProxy to LocalClient. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3501 +/- ##
==========================================
+ Coverage 59.11% 59.30% +0.19%
==========================================
Files 2187 2128 -59
Lines 182236 175509 -6727
==========================================
- Hits 107724 104083 -3641
+ Misses 64864 62383 -2481
+ Partials 9648 9043 -605
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…tests Per review: - getBlockByNumber (was #3119) and getTransactionReceipt (was #3501) had inline `if errors.Is(err, ErrBlockHeightNotYetAvailable) { return nil, nil }` predating this PR's helpers. Route both through blockByNumberOrNullForJSONRPC so all spec-compliant conversion lives in one place. Behavior verified equivalent by the existing endpoint tests (TestGetBlockByNumber*, TestGetTransactionReceiptReturnsNullAboveWatermark). - Add direct unit tests covering each helper's branches (above-watermark, in-range, sentinel-not-found-by-hash, non-watermark error propagation). The Block:nil → ErrBlockNotFoundByHash path was previously not exercised by any test (MockClient returns a plain string error instead of the sentinel), so this closes that gap. `errors` import removed from block.go (no remaining callers after this consolidation; getBlockByHash still uses errors elsewhere... actually no it doesn't either after the prior commit, hence the removal). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
eth_getTransactionReceiptfinds a receipt whose block sits above the watermark MIN — which happens for a brief window after a fresh block commits while one of the watermark sources (tendermintStatus.LatestBlockHeight, ctx provider, state store, receipt store) lags the others — return JSONnullinstead of propagatingErrBlockHeightNotYetAvailable.tx.wait()in hardhat/ethers, indexers, wallets) keep polling instead of surfacing the error.eth_getBlockByNumber.Observed on main as an
Autobahn EVM Interoperabilityjob failure in run 26180853885 —ERC20toNativePointerTest.js→ "should transfer to unlinked address" hitrequested height 1589 is not yet available; safe latest is 1588from atx.wait()poll. The receipt was already in the receipt store; the RPC node'sStatusview simply hadn't advanced yet. The race is not Autobahn-specific — it lives entirely inevmrpc.Test plan
TestGetTransactionReceiptReturnsNullAboveWatermark: plants a receipt 100 blocks above the watermark and asserts(nil, nil). Verified via temporary revert that the test fails with the production error string when the fix is removed.go test ./evmrpc/ -count=1passes (22s).gofmt -s -lclean.golangci-lint run ./evmrpc/: 0 issues.🤖 Generated with Claude Code