RPC: add eth_getRawTransactionByBlockHashAndIndex & eth_getRawTransactionByBlockNumberAndIndex & eth_sendRawTransactionSync#11521
Conversation
…ckNumberAndIndex & eth_sendRawTransactionSync implementation
|
Claude finished @svlachakis's task in 4m 40s —— View job PR Review
SummaryThe two Critical
|
eth_getRawTransactionByBlockHashAndIndex & eth_getRawTransactionByBlockNumberAndIndex & eth_sendRawTransactionSync implementationeth_getRawTransactionByBlockHashAndIndex & eth_getRawTransactionByBlockNumberAndIndex & eth_sendRawTransactionSync
|
@claude review again |
|
Claude finished @svlachakis's task in 4m 18s —— View job PR Review
SummaryAll Critical, High, and Medium findings from the previous review are now fixed. One new Medium issue was found, plus one low-severity note. Fixed from previous review ✅
New findingsMedium —
|
|
@claude review again |
|
Claude finished @svlachakis's task in 4m 29s —— View job PR Review
SummaryAll Critical, High, and Medium findings from both prior reviews are fixed. No new Critical, High, or Medium issues found. One pre-existing Low is noted. Fixed from previous reviews ✅
Pre-existing (not introduced by this PR)Low —
|
|
Claude finished @svlachakis's task in 4m 52s —— View job PR Review
SummaryAll findings from the three prior review rounds are confirmed fixed. No new Critical, High, or Medium issues. The implementation is correct and ready to merge. All prior findings — fixed ✅
Verification notes
No other Verdict: mergeable — no unresolved Critical, High, or Medium findings. |
|
@claude re-review |
|
Claude finished @LukaszRozmej's task in 4m 59s —— View job PR Review
SummaryAll findings from the previous four review rounds remain fixed. One new Medium issue found. All prior findings — confirmed fixed ✅
New findingMedium —
|
| public int FiltersTimeout { get; set; } = 900000; | ||
| public bool PreloadRpcModules { get; set; } | ||
| public bool StrictHexFormat { get; set; } = true; | ||
| public int RpcTxSyncDefaultTimeoutMs { get; set; } = 20_000; |
There was a problem hiding this comment.
Why do we need separate timeouts?
There was a problem hiding this comment.
They seem to serve different purposes. Default is the no-arg UX (~1–2 block times so tx-not-included callers get fast feedback), Max is a server-side cap against clients passing huge timeouts and pinning workers, same split Geth uses for the same reason I believe (RPCTxSyncDefaultTimeout/RPCTxSyncMaxTimeout).
| using SemaphoreSlim signal = new(0, 1); | ||
| void OnNewHead(object? sender, BlockEventArgs _) | ||
| { | ||
| try { signal.Release(); } | ||
| catch (SemaphoreFullException) { } | ||
| catch (ObjectDisposedException) { } | ||
| } | ||
|
|
||
| // Subscribe before submit to avoid losing a fast inclusion to a race. | ||
| _blockTree.NewHeadBlock += OnNewHead; |
There was a problem hiding this comment.
N semaphores and N event subscriptions per call. Maybe they should be consolidated to 1?
There was a problem hiding this comment.
I think a single SemaphoreSlim won't work (Release wakes only one waiter), so the real alternative is a shared TCS that gets swapped on each block. Looks like it saves a few microseconds per block, but adds a race: if a block lands between the receipt check and the await, the shared TCS has already swapped to the next block, and the call sits idle for ~12s before checking again. N per-call semaphores avoid that because each release queues, even with bad timing the next await returns right away.
In the case where one semaphore receives two releases, if these two Release() calls happen before any WaitAsync():
- 1st: count 0 → 1
- 2nd: count is already at max → throws
SemaphoreFullException(we catch it) - That second release is lost / coalesced, not queued
Microseconds vs occasionally missing a block I think it's better to keep N.
There was a problem hiding this comment.
TCS is fine, IMO race is avoidable
|
@claude review again, I switched to use eth_sendRawTransaction to catch the override cases also without too much hustle |
|
Claude finished @svlachakis's task in 2m 31s —— View job PR Review
SummaryAll prior Medium+ findings remain fixed. The refactor from Prior findings — confirmed fixed ✅
New findingLow — Optimism
|
|
@claude review again, switched to pass through eth_getTransactionReceipt, again for overrides |
|
Claude finished @svlachakis's task in 2m 57s —— View job Claude finished @svlachakis's task — PR Review
SummaryAll findings from all prior review rounds remain fixed. The latest change ( All prior findings — confirmed fixed ✅
Verification of the latest changeThe switch from the deleted
Verdict: mergeable — no unresolved Critical, High, or Medium findings. |
|
@claude review again my refactoring based on @LukaszRozmej point here #11521 (comment) |
|
Claude finished @svlachakis's task in 2m 43s —— View job PR Review
SummaryAll prior Medium+ findings remain fixed. The Correctness of the
|
| Severity | Finding |
|---|---|
| Critical | NewHeadBlock no-op on ReadOnlyBlockTree → always timed out in production |
| High | Constructor IBlockFinder cast-and-throw violated LSP |
| Medium | positionIndex < 0 dead code for UInt256 |
| Medium | ResolveSyncTimeoutMs unsafe (ulong) cast on negative config |
| Medium | ObjectDisposedException race on SemaphoreSlim from in-flight block event |
| Medium | eth_sendRawTransactionSync non-virtual, Optimism validator nodes always timed out |
| Low | Missing ExampleValue on new methods |
| Low | Missing trace log on new raw-tx methods |
| Low | Optimism eth_sendRawTransactionSync returned plain ReceiptForRpc, omitting L1 fee fields |
Verdict: mergeable — no unresolved Critical, High, or Medium findings. The TCS refactoring is a clean improvement: one subscription, no per-call allocation of SemaphoreSlim, no lock needed, and the race-avoidance argument is cleaner to reason about.
|
@claude review again |
|
Claude finished @svlachakis's task in 3m 21s —— View job PR Review
SummaryBoth Low findings from the previous review are now resolved. No new Critical, High, or Medium issues found. The PR is in good shape. Fixed from previous review ✅
All prior findings — confirmed fixed ✅
Pre-existing (not introduced by this PR)
Verdict: mergeable — no unresolved Critical, High, or Medium findings. |
Fixes Closes Resolves #11518 & #11519 & #11520
Changes
eth_getRawTransactionByBlockHashAndIndeximplementationeth_getRawTransactionByBlockNumberAndIndeximplementationeth_sendRawTransactionSyncimplementationTypes of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Documentation
Requires documentation update
If yes, link the PR to the docs update or the issue with the details labeled
docs. Remove if not applicable.