Skip to content

Integrate Frontier's fix for eth_getTransactionReceipt race condition#3651

Merged
librelois merged 4 commits intomasterfrom
manuel/fix-race-condition-in-frontier-rpc
Feb 3, 2026
Merged

Integrate Frontier's fix for eth_getTransactionReceipt race condition#3651
librelois merged 4 commits intomasterfrom
manuel/fix-race-condition-in-frontier-rpc

Conversation

@manuelmauro
Copy link
Copy Markdown
Contributor

@manuelmauro manuelmauro commented Feb 3, 2026

What does it do?

Integrate Frontier's fix for eth_getTransactionReceipt race condition: polkadot-evm/frontier#1802

@manuelmauro manuelmauro self-assigned this Feb 3, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 3, 2026

Walkthrough

This PR adds block retrieval by number to the lazy-loading backend and RPC client layers, and introduces a retry-enabled test helper function for more resilient block fetching. The helper is then integrated across multiple test suites to replace direct block fetch calls.

Changes

Cohort / File(s) Summary
Backend & RPC Implementation
node/service/src/lazy_loading/frontier_backend.rs, node/service/src/lazy_loading/rpc_client.rs
Added block_hash_by_number method to LazyLoadingFrontierBackend and block_by_number method to RPC client for fetching blocks by number, mirroring existing block-by-hash patterns and error handling.
Test Helper
test/helpers/eth-transactions.ts
Added getBlockWithRetry helper function with configurable retry logic (maxAttempts, delayMs) supporting retrieval by blockHash, blockNumber, or latest block, with error handling for BlockNotFoundError scenarios.
Test Suite Updates
test/suites/dev/moonbase/test-chain/test-fork-chain.ts, test/suites/dev/moonbase/test-txpool/test-txpool-limits*.ts
Replaced direct context.viem().getBlock() calls with getBlockWithRetry(context) for improved resilience against transient block retrieval failures across multiple test files.

Sequence Diagram

sequenceDiagram
    participant Test
    participant Helper as getBlockWithRetry
    participant RPC Client
    participant Backend
    
    Test->>Helper: getBlockWithRetry(context, options)
    Helper->>RPC Client: block_by_number(blockNumber)
    RPC Client->>Backend: block_by_number(blockNumber)
    Backend->>RPC Client: Result<Option<H256>, String>
    RPC Client->>Helper: Result<Option<Block>>
    alt BlockNotFoundError or timeout
        Helper->>Helper: Wait delayMs
        Helper->>RPC Client: Retry (until maxAttempts)
    else Success
        Helper->>Test: Return Block
    end
    Test->>Test: Assert block properties
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 By number now the blocks do flow,
Through RPC's retry magic, swift and slow,
With gentle pauses 'tween each try,
The tests dance on, they'll never die! 🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title references 'eth_getTransactionReceipt' and 'race condition', but the changes focus on implementing 'block_hash_by_number' and 'getBlockWithRetry' for block retrieval. While these may be part of fixing the race condition, the title doesn't clearly describe the actual code changes. Update the title to better reflect the main changes, such as 'Implement block_hash_by_number and add getBlockWithRetry helper' or a more specific description of the Frontier integration work being done.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch manuel/fix-race-condition-in-frontier-rpc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@manuelmauro manuelmauro added B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes not-breaking Does not need to be mentioned in breaking changes D2-notlive PR doesn't change runtime code (so can't be audited) labels Feb 3, 2026
@manuelmauro manuelmauro requested a review from librelois February 3, 2026 16:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 3, 2026

WASM runtime size check:

Compared to target branch

Moonbase runtime: 2120 KB (no changes) ✅

Moonbeam runtime: 2236 KB (no changes) ✅

Moonriver runtime: 2236 KB (no changes) ✅

Compared to latest release (runtime-4102)

Moonbase runtime: 2120 KB (+184 KB compared to latest release) ⚠️

Moonbeam runtime: 2236 KB (+200 KB compared to latest release) ⚠️

Moonriver runtime: 2236 KB (+204 KB compared to latest release) ⚠️

@librelois librelois added the agent-review Trigger CodeRabbit Agent review label Feb 3, 2026
@librelois librelois merged commit 0cbbef0 into master Feb 3, 2026
50 of 53 checks passed
@librelois librelois deleted the manuel/fix-race-condition-in-frontier-rpc branch February 3, 2026 20:27
@arturgontijo arturgontijo mentioned this pull request Feb 10, 2026
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-review Trigger CodeRabbit Agent review B5-clientnoteworthy Changes should be mentioned in any downstream projects' release notes D2-notlive PR doesn't change runtime code (so can't be audited) not-breaking Does not need to be mentioned in breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants