Repository navigation
Conversation
Add eth/73, which extends the eth/72 NewPooledTransactionHashes message with each transaction's source address and nonce. A delivered transaction that contradicts its announced source or nonce disconnects the peer. eth/73 is advertised only alongside eth/72 and behind TxPool.AnnounceTxSourceAndNonce, which defaults to false while the EIP is a draft.
|
Claude finished @Marchhill's task in 2m 32s —— View job Review: EIP-8077 eth/73 (announce tx source and nonce)
Overall: The design is sound. eth/73 is opt-in ( Findings
No problems found with the comments; the added XML docs explain intent and spec context. Not verified
Mergeable: not yet. The Medium finding needs a fix or a stated rationale. |
| return false; | ||
| } | ||
|
|
||
| if (tx.SenderAddress is null && ecdsa.TryRecoverAddress(tx, out Address? sender)) |
There was a problem hiding this comment.
Medium – ECDSA recovery now runs before the pool's cheap filters.
In the pool, sender recovery happens in MalformedTxFilter. That filter runs after SizeTxFilter, GasLimitTxFilter, PriorityFeeTooLowFilter, FeeTooLowFilter and AlreadyKnownTxFilter (TxPool.cs:310-328). This override recovers the sender for every announced tx up front, for the whole batch, before any of those filters run.
An eth/73 peer can announce underpriced or over-gas-limit txs with a matching nonce, and we pay for a secp256k1 recovery on each one. On eth/72 the pool rejects these without recovering the sender. The PR description says fetch scheduling doesn't use the source yet, so this is extra CPU per fetched tx with no benefit so far.
Options:
- Check the nonce eagerly (it's free) and check the source only when
tx.SenderAddressis already set (frame txs). Leave signer verification until the metadata is actually used for scheduling. - Or check the source after
SubmitTxreturns, once the pool has resolvedSenderAddress. This needs the tx to still be readable, so it fits poorly with theSubmitOwnedTxrecycle contract.
If you keep eager recovery on purpose, please document the trade-off.
There was a problem hiding this comment.
Fixed in f29e36c: no recovery in the handler. Nonce (and frame-tx explicit sender) checked pre-submit; recovered senders compared in a post-submit hook after the pool resolves them, so cheaply rejected txs never pay for recovery. Sparse eth/72 blob txs bypass this path (noted in remarks).
| { | ||
| if (!_txPool.IsKnown(in hashes[i])) | ||
| { | ||
| _announcedSourcesAndNonces.Set(hashes[i], (sources[i], nonces[i])); |
There was a problem hiding this comment.
Low – the cache stores hashes we never request.
An entry is stored for every unknown announced hash, including ones Handle then drops: disallowed type, oversized, NotifyAboutTx not RequestRequired, or blob support off. Each entry also holds a separately allocated Address. With ~13k entries per peer, this is roughly 1 MB+ of retained memory per peer under adversarial announcements.
It also repeats the _txPool.IsKnown lookup that Handle does again straight afterwards on the network thread.
Consider recording the source and nonce at the point where TxShapeAnnouncements.Set runs, i.e. only for hashes we actually request. That needs a small hook in Eth72ProtocolHandler.Handle, or a combined value in the shape cache.
There was a problem hiding this comment.
Fixed in f29e36c: source/nonce recorded only for requested hashes via a hook next to TxShapeAnnouncements.Set; duplicate IsKnown removed.
| { | ||
| Transaction tx = txs[i]; | ||
| int announcementSize = GetAnnouncementSize(tx); | ||
| if (announcementSize <= 0 || tx.SenderAddress is not { } source) |
There was a problem hiding this comment.
Low – txs dropped here are never announced to this peer.
ShouldNotifyTransactionCore has already put the hash into NotifiedTransactions / _announcedBlobTransactionMasks before SendAnnouncement runs. A tx skipped here because SenderAddress is null will therefore never be announced to this peer later, even after its sender is resolved.
Pool txs should always have a sender, so in practice this probably never triggers. It is worth a short note, or a Debug.Assert, so it doesn't silently become a propagation gap.
Separately, this method is an almost line-for-line copy of Eth72ProtocolHandler.SendAnnouncement, and NewPooledTransactionHashesMessageSerializer73 largely duplicates the eth/72 serializer. Sharing the common parts would reduce drift between the two versions.
There was a problem hiding this comment.
Fixed in f29e36c: Debug.Assert + note on the null-sender skip; announcement loop shared via Eth72.AddAnnouncedTransactions, serializer reuses the eth/72 length/write helpers (decode stays separate for the field-count checks).
Stateless guest cost
Variable cost by bucket, summed over shared blocks (excludes BASE)
Compared against |
- Check the announced nonce, and the source of frame transactions, before submission; check a recovered sender only after the pool has resolved it, so cheaply rejected transactions cost no signature recovery - Remember announced source/nonce only for requested transactions - Share announcement building and serialization with eth/72
|
@claude review |
|
Claude finished @Marchhill's task in 1m 12s —— View job Re-review: EIP-8077 eth/73 (after f29e36c)
Overall: All three earlier findings are fixed. I found nothing new at Medium severity or above. Earlier findings
Checks on the new post-submit hook
Remaining notes (no action needed)
CommentsThe added XML docs and inline comments explain why choices were made or what the contract is (EIP-8077/8070 references, the recycle contract, the reason for the Not verified
Mergeable: yes. There are no unresolved findings at Critical, High or Medium severity. |
| } | ||
|
|
||
| private void SendAnnouncement(IReadOnlyList<Transaction> txs, byte[] cellMask) | ||
| private protected virtual void SendAnnouncement(IReadOnlyList<Transaction> txs, byte[] cellMask) |
There was a problem hiding this comment.
private protected appropriate here?
There was a problem hiding this comment.
Now protected virtual, matching the other overridable hooks (Eth62 HandleSlow, Eth65 CreateAnnouncementMessage, Eth68 MatchesAnnouncedTransactionSize) (db9315c).
| } | ||
| else | ||
| { | ||
| types.Dispose(); |
There was a problem hiding this comment.
do we dispose correctly on the other path?
There was a problem hiding this comment.
Send path was fine (Session.DeliverMessage disposes in a finally). The gap was an exception in AddAnnouncedTransactions; the message is now built up front and disposed unless handed to Send (db9315c).
| /// <summary> | ||
| /// Implements eth/73 (EIP-8077): eth/72 with transaction announcements that also carry each transaction's source address and nonce. | ||
| /// </summary> | ||
| /// <remarks> |
There was a problem hiding this comment.
Trimmed across the eth/73 files (db9315c).
| _announcedSourcesAndNonces.Set(announcement.Hashes[index], (announcement.Sources[index], announcement.Nonces[index])); | ||
| } | ||
|
|
||
| private protected override void SendAnnouncement(IReadOnlyList<Transaction> txs, byte[] cellMask) |
| } | ||
| else | ||
| { | ||
| types.Dispose(); |
There was a problem hiding this comment.
Same pattern: one message.Dispose() covers the empty and exception paths (db9315c).
|
@claude review |
|
Claude finished @Marchhill's task in 46s —— View job Re-review: EIP-8077 eth/73 (after db9315c)
Overall: db9315c fixes what @Marchhill asked about in the review, and I found no new issues. The earlier findings were already resolved in f29e36c. Checks on db9315c
Rechecked from earlier passes (unchanged)
Notes (no action needed)
Not verified
Mergeable: yes. There are no Critical, High or Medium findings. |
|
Claude finished @Marchhill's task in 28s —— View job Re-review: EIP-8077 eth/73 (ready for review, HEAD db9315c)
Overall: Nothing has changed since my last pass on db9315c, and a fresh read of the full diff turned up no new issues. All earlier findings were resolved in f29e36c and db9315c, as covered in the previous re-reviews. What I checked again
Notes (no action needed)
Not verified
Mergeable: yes. There are no Critical, High or Medium findings. |
LukaszRozmej
left a comment
There was a problem hiding this comment.
Reviewed db9315c69f8dcdd58b1161c397eefba4d80859f2 against its merge base with master. Static review of the diff, relevant callers, tests, and current EIP drafts; I did not run builds or tests.
Inline findings:
- [P2] Verify sparse blob senders after recovery too
Total findings: 1.
Review scope, grouped by project
- Nethermind.Init (production):
Modules/NetworkModule.cs - Nethermind.Merge.Plugin (production):
MergeP2PCapabilityResolver.cs - Nethermind.Merge.Plugin.Test (tests):
MergeP2PCapabilityResolverTests.cs - Nethermind.Network (production):
P2P/Subprotocols/Eth/V62/Eth62ProtocolHandler.cs,P2P/Subprotocols/Eth/V72/Eth72ProtocolHandler.cs,P2P/Subprotocols/Eth/V72/Messages/NewPooledTransactionHashesMessageSerializer72.cs,P2P/Subprotocols/Eth/V73/Eth73ProtocolHandler.cs,P2P/Subprotocols/Eth/V73/Messages/NewPooledTransactionHashesMessage73.cs,P2P/Subprotocols/Eth/V73/Messages/NewPooledTransactionHashesMessageSerializer73.cs - Nethermind.Network.Contract (production):
P2P/EthVersions.cs - Nethermind.Network.Test (tests):
Builders/SerializationBuilder.cs,P2P/Subprotocols/Eth/V73/Eth73MessageSerializerTests.cs,P2P/Subprotocols/Eth/V73/Eth73ProtocolHandlerTests.cs - Nethermind.TxPool (production):
ITxPoolConfig.cs,TxPoolConfig.cs
Categories: consensus/protocol correctness, API compatibility, robustness/resource ownership, performance, and test/project rules.
No files skipped.
🤖 AI agent (Codex / GPT-6) on behalf of @LukaszRozmej. Review workflow: review skill and resource-leak-audit skill.
| } | ||
|
|
||
| if (tx.SenderAddress is null) | ||
| { |
There was a problem hiding this comment.
[P2] Verify sparse blob senders after recovery too
A requested sparse blob transaction arrives without SenderAddress, so this branch provisionally accepts it. Eth72 routes it through PrepareAndMaybeSubmitSparseBlobTransaction/the sparse registry rather than SubmitTransaction, so OnTransactionSubmitted never performs the deferred comparison. A peer announcing the correct hash/nonce but a false source is never disconnected, contrary to the PR's stated mismatch handling and EIP-8077 security guidance. The remarks acknowledge this gap; carry the peer announcement through sender recovery and test a sparse blob source mismatch.
There was a problem hiding this comment.
Fixed in 9f5664d: the sparse path now calls OnTransactionSubmitted after the registry's sampling validation recovers the sender, so a false source disconnects; eth/72 unchanged (hook is a no-op there). Test covers both cases.
|
IMO this will evolve, not sure if we should merge current spec |
Sparse blob txs bypass SubmitTransaction, so the deferred source check never ran and a peer announcing a false source was not disconnected. Run the hook once the sparse blob registry has recorded the tx, by which point sampling validation has recovered its sender.
|
@claude review |
|
Claude finished @Marchhill's task in 43s —— View job Re-review: EIP-8077 eth/73 (after 9f5664d)
Overall: 9f5664d fixes the P2 finding, and I found nothing new at Medium severity or above. The fix in 9f5664d
Notes (no action needed)
Not a code finding
Not verified
Mergeable: yes. There are no Critical, High or Medium findings. |
makes sense, we can hold off merging for now |
| } | ||
|
|
||
| sources.Add(source); | ||
| nonces!.Add(tx.Nonce); |
There was a problem hiding this comment.
Do keyed frame txs need their nonce key announced too? Two of them from one sender can share this nonce
| protected override ValueTask HandleSlow(TransactionsRequest request, CancellationToken cancellationToken) | ||
| { | ||
| IOwnedReadOnlyList<Transaction> transactions = request.Transactions; | ||
| ReadOnlySpan<Transaction> transactionsSpan = transactions.AsSpan(); | ||
| int startIdx = request.StartIndex; | ||
| for (int i = startIdx; i < transactionsSpan.Length; i++) | ||
| { | ||
| if (!MatchesAnnouncedNonceAndKnownSource(transactionsSpan[i])) | ||
| { | ||
| // [0, startIdx) were already handled in a prior scheduler slot. | ||
| ReturnUnsubmittedTransactions(transactionsSpan[startIdx..]); | ||
| transactions.Dispose(); | ||
| Session.InitiateDisconnect(DisconnectReason.BreachOfProtocol, AnnouncementMismatch); | ||
| return ValueTask.CompletedTask; | ||
| } | ||
| } | ||
|
|
||
| return base.HandleSlow(request, cancellationToken); | ||
| } |
There was a problem hiding this comment.
On a mismatch the whole remaining batch is returned unsubmitted. Those bodies are valid on their own, and ReturnUnsubmittedTransactions never marks them received in RetryCache, so each one waits for the 3.5 s timeout and is then re-requested from another peer. Submitting first and disconnecting after keeps the penalty and drops the delay:
| protected override ValueTask HandleSlow(TransactionsRequest request, CancellationToken cancellationToken) | |
| { | |
| IOwnedReadOnlyList<Transaction> transactions = request.Transactions; | |
| ReadOnlySpan<Transaction> transactionsSpan = transactions.AsSpan(); | |
| int startIdx = request.StartIndex; | |
| for (int i = startIdx; i < transactionsSpan.Length; i++) | |
| { | |
| if (!MatchesAnnouncedNonceAndKnownSource(transactionsSpan[i])) | |
| { | |
| // [0, startIdx) were already handled in a prior scheduler slot. | |
| ReturnUnsubmittedTransactions(transactionsSpan[startIdx..]); | |
| transactions.Dispose(); | |
| Session.InitiateDisconnect(DisconnectReason.BreachOfProtocol, AnnouncementMismatch); | |
| return ValueTask.CompletedTask; | |
| } | |
| } | |
| return base.HandleSlow(request, cancellationToken); | |
| } | |
| protected override async ValueTask HandleSlow(TransactionsRequest request, CancellationToken cancellationToken) | |
| { | |
| bool matchesAnnouncement = MatchesAnnouncement(request); | |
| await base.HandleSlow(request, cancellationToken); | |
| if (!matchesAnnouncement) | |
| { | |
| Session.InitiateDisconnect(DisconnectReason.BreachOfProtocol, AnnouncementMismatch); | |
| } | |
| } | |
| private bool MatchesAnnouncement(TransactionsRequest request) | |
| { | |
| ReadOnlySpan<Transaction> transactionsSpan = request.Transactions.AsSpan(); | |
| for (int i = request.StartIndex; i < transactionsSpan.Length; i++) | |
| { | |
| if (!MatchesAnnouncedNonceAndKnownSource(transactionsSpan[i])) | |
| { | |
| return false; | |
| } | |
| } | |
| return true; | |
| } |
| public const byte Eth70 = 70; | ||
| public const byte Eth71 = 71; | ||
| public const byte Eth72 = 72; | ||
| public const byte Eth73 = 73; |
There was a problem hiding this comment.
EIP-8408 in master already defines eth/73 as "Indexed Cell Requests", and ethereum/EIPs#12423 / #12551 both claim eth/74. With the flag on, this node and an 8408 node would both advertise eth/73 with different messages. Fine behind AnnounceTxSourceAndNonce=false; worth keeping it off by default until the EIP gets a number. Also +1 to Lukasz: the spec text still diffs against eth/69, so the field order here (after cells, same as reth-oss#126) is ahead of the spec.
| { | ||
| private const string AnnouncementMismatch = "pooled tx does not match its announced source or nonce"; | ||
|
|
||
| private readonly ClockCache<ValueHash256, (Address Source, ulong Nonce)> _announcedSourcesAndNonces = new(MemoryAllowance.TxHashCacheSize / 10, lockPartition: 1); |
There was a problem hiding this comment.
TxHashCacheSize / 10 is 13,107 entries per peer at defaults, so up to ~655k with 50 peers. Since it is filled only for requested hashes, would a bound from the per-peer in-flight request limit be enough?
Changes
NewPooledTransactionHashescarries each tx's source and nonce after the eth/72 cell mask:[types, [sizes], [hashes], cells, [sources], [nonces]]SenderAddress/Nonce(explicit sender /nonce_seqfor frame txs, per EIPs#12139); txs without a resolved sender are not announcedTxPool.AnnounceTxSourceAndNonce(defaultfalse) while the EIP is draft and the version number unassignedTypes of changes
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Serializer vectors/round-trip/malformed cases, handler announce and mismatch-disconnect, capability resolver matrix. Network.Test, resolver and Runner NetworkModule/config tests pass.
Documentation
Requires documentation update
Requires explanation in Release Notes
Experimental
TxPool.AnnounceTxSourceAndNonce(defaultfalse) advertises the draft eth/73 protocol (EIP-8077).