Skip to content

feat: EIP-8077 announce tx source and nonce (eth/73) - #14462

Draft
Marchhill wants to merge 5 commits into
masterfrom
feature/eip-8077
Draft

Marchhill wants to merge 5 commits into
masterfrom
feature/eip-8077

Conversation

@Marchhill

Copy link
Copy Markdown
Contributor

Changes

  • Add eth/73 (EIP-8077): NewPooledTransactionHashes carries each tx's source and nonce after the eth/72 cell mask: [types, [sizes], [hashes], cells, [sources], [nonces]]
  • Announce SenderAddress/Nonce (explicit sender / nonce_seq for frame txs, per EIPs#12139); txs without a resolved sender are not announced
  • Disconnect a peer whose delivered tx contradicts its announced source/nonce
  • Fetch scheduling unchanged from eth/72
  • eth/73 is offered only alongside eth/72 and behind TxPool.AnnounceTxSourceAndNonce (default false) while the EIP is draft and the version number unassigned

Types of changes

  • New feature (a non-breaking change that adds functionality)

Testing

Requires testing

  • Yes

If yes, did you write tests?

  • Yes

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

  • No

Requires explanation in Release Notes

  • Yes

Experimental TxPool.AnnounceTxSourceAndNonce (default false) advertises the draft eth/73 protocol (EIP-8077).

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

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @Marchhill's task in 2m 32s —— View job


Review: EIP-8077 eth/73 (announce tx source and nonce)

  • Gather context / diff
  • Review handler, serializer, wiring, tests
  • Post findings

Overall: The design is sound. eth/73 is opt-in (TxPool.AnnounceTxSourceAndNonce, default false) and only offered alongside eth/72. The handler follows the existing Eth68ProtocolHandler.HandleSlow validate-then-delegate pattern, including correct disposal and return of txs on the mismatch path. On a reschedule, HandleSlow re-runs this override, and the cache entries it already consumed make the second check a no-op. The serializer is strict: DecodeAddress rejects empty or short addresses, the nonces must fit in a ulong, the field counts must match and the cell mask must have a fixed length. Because the tx hash commits to the nonce and signature, a mismatch can only come from a peer lying, so disconnecting it is safe and can't misfire on honest peers.

Findings

Severity Location Issue
Medium Eth73ProtocolHandler.cs:155 The sender is recovered for every announced tx before the pool's cheap filters run (size, gas limit, fees, already-known). Today MalformedTxFilter recovers only after those filters. An eth/73 peer can therefore make us do a secp256k1 recovery for each underpriced tx it delivers, and the source isn't used for fetch scheduling yet. Fix: check the nonce eagerly but leave signer verification until later, or document the trade-off.
Low Eth73ProtocolHandler.cs:73 The source/nonce cache stores every unknown announced hash, including ones we never request. Each entry also allocates its own Address, which adds up to roughly 1 MB+ per peer under adversarial announcements. IsKnown is also looked up twice on the network thread. Recording the entry only where TxShapeAnnouncements.Set runs would fix both.
Low Eth73ProtocolHandler.cs:93 A tx skipped because it has no sender has already been marked as notified, so it is never announced to this peer later. SendAnnouncement and the eth/73 serializer are also near-copies of their eth/72 versions, so sharing the common parts would reduce drift.

No problems found with the comments; the added XML docs explain intent and spec context.

Not verified

  • Whether putting [sources], [nonces] after the eth/72 cell mask matches what other clients implement. The EIP text is written against the pre-eth/72 format, so the layout needs cross-client agreement before the version number is assigned.
  • I did not build the code or run the tests in this job.

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))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.SenderAddress is already set (frame txs). Leave signer verification until the metadata is actually used for scheduling.
  • Or check the source after SubmitTx returns, once the pool has resolved SenderAddress. This needs the tx to still be readable, so it fits poorly with the SubmitOwnedTx recycle contract.

If you keep eager recovery on purpose, please document the trade-off.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Stateless guest cost

block steps Δ steps prover cost Δ cost
25526356 114,858,085 -0.154% 18,023,648,980 -0.083%
25532382 122,275,128 -0.157% 20,188,011,843 -0.078%
25532442 160,502,072 -0.087% 23,073,693,539 -0.052%
25532454 144,718,541 -0.139% 22,678,548,777 -0.074%
25532471 142,171,247 -0.123% 22,153,244,117 -0.067%
25532480 94,229,541 -0.178% 15,642,157,908 -0.089%
25532553 134,967,440 -0.137% 20,613,852,950 -0.076%
25532642 133,261,595 -0.127% 20,831,061,800 -0.069%
25532711 130,987,438 -0.137% 19,614,506,812 -0.078%
all 9 blocks 1,177,971,087 -0.135% 182,818,726,726 -0.073%
Variable cost by bucket, summed over shared blocks (excludes BASE)
bucket before after Δ
MAIN 80,210,102,236 80,102,033,916 -0.135%
OPCODES 16,516,148,785 16,498,121,403 -0.109%
PRECOMPILES 63,841,124,225 63,844,059,139 +0.005%
MEMORY 19,799,501,558 19,788,723,852 -0.054%

214b2d18d119 (merge commit) · 9 pinned blocks · ziskemu is deterministic, so these figures are exact and any non-zero delta is real.

Compared against dafc36978368.

- 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
@Marchhill

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @Marchhill's task in 1m 12s —— View job


Re-review: EIP-8077 eth/73 (after f29e36c)

  • Gather context and diff
  • Re-check the earlier findings against f29e36c
  • Review the handler, serializer, eth/62 and eth/72 hooks, and tests
  • Post findings

Overall: All three earlier findings are fixed. I found nothing new at Medium severity or above.

Earlier findings

Earlier finding Status
Medium: the sender was recovered for every announced tx before the pool's cheap filters ran ✅ Fixed. Eth73ProtocolHandler no longer uses IEthereumEcdsa. Before submission it checks only the nonce and an explicit frame-tx sender. A recovered sender is checked in OnTransactionSubmitted after MalformedTxFilter has set tx.SenderAddress, so txs that AlreadyKnown, Size, GasLimit or the fee filters reject never pay for a recovery. The WrongSourceRejectedCheaply test case covers this.
Low: the cache stored hashes we never request, and IsKnown was looked up twice ✅ Fixed. Entries are recorded through OnPooledTransactionRequested, right after TxShapeAnnouncements.Set (Eth72ProtocolHandler.cs:483). should_not_remember_announcements_that_are_not_requested covers this.
Low: a tx with no sender was silently skipped, and the announcement and serializer code was duplicated ✅ Fixed. A Debug.Assert with a comment now covers the null-sender skip. eth/73 reuses AddAnnouncedTransactions and the eth/72 GetContentLength/WriteContent helpers.

Checks on the new post-submit hook

  • Reading the tx after it goes to the pool: this is safe. OnTransactionSubmitted (Eth62ProtocolHandler.cs:407) runs before a rejected tx is recycled. The pool never returns an accepted tx to TxObjectPool; the only Return call in a non-test path is ReturnUnsubmittedTransactions. So reading Hash/SenderAddress after SubmitOwnedTx is fine, and the hook's <remarks> describe the contract correctly.
  • Disconnects: replacing the throw SubprotocolException with InitiateDisconnect(BreachOfProtocol) is fine.
    • If the check fails before submission, the code returns [startIdx..] to the object pool and disposes the list. Nothing in that range has been submitted yet, because the whole range is checked before base.HandleSlow runs.
    • If the check fails after submission, the disconnect stops the rest of the batch through the existing Session.IsClosing check in Eth72ProtocolHandler.HandleSlow.
  • Rescheduled batches: when a batch is rescheduled, the second pass looks up txs that were already submitted. Their entries were deleted on the first pass, so the second check does nothing. That is correct.
  • Cost for other eth versions: every eth/62–72 tx now goes through one empty virtual call. That cost is negligible.
  • Accepting a mismatched tx: the tx is still accepted into the pool before we disconnect the peer. That is fine: the tx hash commits to the signature, so the tx itself is valid and only the announcement was wrong.

Remaining notes (no action needed)

  • Blob txs leave cache entries behind. The nonce of a sparse blob tx (PrepareAndMaybeSubmitSparseBlobTransaction) or a partial-blob V0 tx is checked, but its cache entry is never deleted, because OnTransactionSubmitted never runs for it. The entry stays until ClockCache evicts it. The cache is bounded and the class <remarks> already say the sender of a sparse blob tx is not checked, so this is acceptable.
  • MatchesAnnouncedNonceAndKnownSource does TryGet and then Delete, which is two lookups. This runs in the background, so the cost is negligible.

Comments

The 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 Debug.Assert). None of them just restate the code.

Not verified

  • Whether other clients also put [sources], [nonces] after the eth/72 cell mask. The layout needs cross-client agreement before the version number is assigned. The feature is off by default (AnnounceTxSourceAndNonce = false), so this doesn't block merging.
  • I did not build the code or run the tests in this job.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private protected appropriate here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now protected virtual, matching the other overridable hooks (Eth62 HandleSlow, Eth65 CreateAnnouncementMessage, Eth68 MatchesAnnouncedTransactionSize) (db9315c).

}
else
{
types.Dispose();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we dispose correctly on the other path?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

long comments

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, now protected override (db9315c).

}
else
{
types.Dispose();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same pattern: one message.Dispose() covers the empty and exception paths (db9315c).

@Marchhill

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @Marchhill's task in 46s —— View job


Re-review: EIP-8077 eth/73 (after db9315c)

  • Gather the context and the diff
  • Review the latest changes (protected hooks, disposing the announcement on throw, trimmed comments)
  • Post findings

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

Area Result
private protected → protected virtual (DeserializeNewPooledTransactionHashes, OnPooledTransactionRequested, SendAnnouncement, AddAnnouncedTransactions, OnTransactionSubmitted) ✅ This now matches the existing hooks (HandleSlow, CreateAnnouncementMessage, MatchesAnnouncedTransactionSize). Every parameter and return type is public: NewPooledTransactionHashesMessage72, IByteBuffer, Transaction, ArrayPoolList<T> and Address. So there's no inconsistent-accessibility error (CS0051). The only callers are inside the eth/72 and eth/73 handlers.
Disposing on throw in SendAnnouncement (Eth72ProtocolHandler.cs:1884, Eth73ProtocolHandler.cs:69) ✅ This is correct. The message is built before anything is filled in, so if AddAnnouncedTransactions throws or the announcement is empty, message.Dispose() releases every pooled list. NewPooledTransactionHashesMessage73.Dispose also disposes Sources and Nonces. isTransferred is set before Send, so if DeliverMessage throws, the session's finally is the only thing that disposes the message. Nothing is disposed twice.
Trimmed comments ✅ What's left is useful. The class <remarks> keep the two non-obvious points: a mismatch is a protocol breach, and the sender of a sparse blob tx isn't checked. The HandleSlow remark explains why the recovered-sender check is deferred. The Debug.Assert note explains the notified-but-skipped case. The serializer summary gives the wire layout. None of them just restate the code.

Rechecked from earlier passes (unchanged)

  • HandleSlow (Eth73ProtocolHandler.cs:97): if the check fails before submission, the code returns [startIdx..] to the pool, disposes the batch, and calls InitiateDisconnect(BreachOfProtocol). If the check fails after submission, OnTransactionSubmitted triggers the same disconnect, and the existing Session.IsClosing check stops the rest of the batch.
  • For an explicit-sender tx, MatchesAnnouncedNonceAndKnownSource deletes the cache entry before submission. Otherwise the entry is deleted in OnTransactionSubmitted, so a rescheduled batch doesn't check the same tx twice.
  • Cache entries are recorded only for requested hashes, at Eth72ProtocolHandler.cs:483, right after TxShapeAnnouncements.Set.

Notes (no action needed)

  • The cache entry for a sparse blob tx or partial V0 blob tx is only cleared when ClockCache evicts it. The cache is bounded and the class remarks document this.
  • The eth/73 copy of SendAnnouncement doesn't have the eth/72 comment // The session disposes the message on every path. That's fine, since the pattern is identical.

Not verified

  • Whether other clients agree on where [sources], [nonces] go relative to the eth/72 cell mask. This doesn't block the PR, because the feature is off by default (AnnounceTxSourceAndNonce = false).
  • I did not build the code or run the tests in this job.

Mergeable: yes. There are no Critical, High or Medium findings.

@Marchhill
Marchhill marked this pull request as ready for review October 9, 2026 16:36
@claude

claude Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @Marchhill's task in 28s —— View job


Re-review: EIP-8077 eth/73 (ready for review, HEAD db9315c)

  • Gather context and diff (dafc369..db9315c)
  • Re-check the handler, serializer, eth/62 and eth/72 hooks, and wiring
  • Post findings

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

  • Pre-submit check (Eth73ProtocolHandler.HandleSlow): this checks the nonce, and the source only for a frame tx whose sender is explicit. It doesn't recover the sender. On a mismatch it returns [startIdx..] to the pool, disposes the batch and disconnects with BreachOfProtocol. Nothing in that range has been submitted yet, so this is safe.
  • Post-submit check (OnTransactionSubmitted): this runs before a rejected tx is recycled. It compares the source only when the pool has resolved SenderAddress, so a tx that the cheap filters reject never pays for a recovery. The check deletes the cache entry, so a rescheduled batch doesn't check the same tx twice.
  • Cache size: entries are recorded only for hashes we request, through OnPooledTransactionRequested next to TxShapeAnnouncements.Set, and the ClockCache is bounded.
  • Serializer:
    • Field counts must match, and the cell mask must be exactly 3 trailing fields long with a fixed length.
    • DecodeAddress rejects short or empty sources, and every list has an RlpLimit.
    • Pooled lists are disposed if decoding throws.
    • Encoding reuses the eth/72 GetContentLength and WriteContent helpers.
  • Disposal in SendAnnouncement (eth/72 and eth/73): the message is built up front and disposed unless it was handed to Send. Nothing is disposed twice.
  • Gating: eth/73 is offered only alongside eth/72 and only when TxPool.AnnounceTxSourceAndNonce is on (default false).
  • Comments: the added XML docs give the contract, the reason behind a choice, or a spec reference. None of them just restate the code.

Notes (no action needed)

  • Blob txs leave cache entries behind. The cache entry for a sparse blob tx or a partial V0 blob tx is never deleted, because OnTransactionSubmitted never runs for it. It stays until ClockCache evicts it. The cache is bounded and the class remarks document this.
  • Wire layout: other clients haven't yet agreed on where [sources], [nonces] go relative to the eth/72 cell mask. That has to be settled before the version number is assigned. It doesn't block merging, because the feature is off by default.

Not verified

  • I did not build the code or run the tests in this job.

Mergeable: yes. There are no Critical, High or Medium findings.

@LukaszRozmej LukaszRozmej left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@LukaszRozmej

Copy link
Copy Markdown
Member

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.
@Marchhill

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @Marchhill's task in 43s —— View job


Re-review: EIP-8077 eth/73 (after 9f5664d)

  • Gather context and diff (db9315c..9f5664d, plus the surrounding sparse-blob path)
  • Check the fix for @LukaszRozmej's P2 finding (source of a sparse blob tx not checked)
  • Check that the hook is safe to call on the sparse path (ownership, recycling, calling it twice)
  • Post findings

Overall: 9f5664d fixes the P2 finding, and I found nothing new at Medium severity or above.

The fix in 9f5664d

Area Result
Sparse blob txs now get the source check (Eth72ProtocolHandler.cs:1707-1708) ✅ When RecordTransaction reaches ValidateTxForBlobSampling, it runs FilterTransactions, so MalformedTxFilter fills in SenderAddress. OnTransactionSubmitted then compares that sender with the announced source. If a cheap filter rejects the tx first, or the peer isn't active (RecordTransaction returns null), SenderAddress stays null and the entry is just removed. The non-sparse path does the same: no recovery is spent on a tx the pool rejects early.
Reading the tx after the call is safe ✅ Before the call, PooledBlobBuffers.Disown(tx) runs, and the registry calls _txPool.SubmitTx (SparseBlobPoolPeerRegistry.cs:1844), not SubmitOwnedTx, so the tx is never sent back to TxObjectPool. If the registry keeps the tx in state.Transaction and another peer's RecordCells submits it at the same time, reading Hash and SenderAddress is still harmless.
The hook can't run twice for one tx ✅ HandleSlow sends only V1 sparse txs (Eth72ProtocolHandler.cs:943) to this method. A full-blob tx goes through PrepareAndSubmitTransaction. A full-blob tx that still reaches RecordTransaction would trigger SubmitTransaction inside the registry, which doesn't call the handler hook. Even if the hook did run twice, Delete would make the second call do nothing.
Cost for eth/72 ✅ It adds one empty virtual call per sparse blob tx, which is negligible.
Test (should_check_sparse_blob_tx_against_announced_source) ✅ It covers both the matching and the wrong source. It checks that the sampling validation ran, that SubmitTx was never called (so the sparse path was really taken), and that a disconnect happens only for the wrong source. The two cases share one parameterised method.
Comments ✅ The new <summary> on the hook and the inline comment at :1706 both explain a contract or the reason for a choice: the sender is recovered by the sampling validation. The class <remarks> now describe the behaviour correctly.

Notes (no action needed)

  • V0 txs with partial blobs leave cache entries behind. For these txs (Eth72ProtocolHandler.cs:921-939) only the nonce is checked, and the cache entry is never deleted because the tx is never submitted. The entry stays until ClockCache evicts it. The cache is bounded and the tx is dropped anyway, so this is harmless.
  • Sender-free checks on a sparse tx are skipped in one case. If a sparse tx is rejected before MalformedTxFilter runs, a false source goes undetected. The same is true on the normal pool path, and it's the trade-off chosen in f29e36c to avoid recovering the sender for txs the pool rejects early.

Not a code finding

  • @LukaszRozmej noted that the spec is likely to change. Other clients also haven't yet agreed where [sources], [nonces] go relative to the eth/72 cell mask. Because eth/73 is off by default (TxPool.AnnounceTxSourceAndNonce = false) and is offered only alongside eth/72, merging now is low-risk. Whether to merge before the EIP settles is a maintainer decision rather than a correctness issue.

Not verified

  • I did not build the code or run the tests in this job.

Mergeable: yes. There are no Critical, High or Medium findings.

@Marchhill

Copy link
Copy Markdown
Contributor Author

IMO this will evolve, not sure if we should merge current spec

makes sense, we can hold off merging for now

}

sources.Add(source);
nonces!.Add(tx.Nonce);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do keyed frame txs need their nonce key announced too? Two of them from one sender can share this nonce

@LukaszRozmej
LukaszRozmej marked this pull request as draft October 12, 2026 14:11
Comment on lines +97 to +115
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);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

This branch has not been deployed

No deployments
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.

5 participants