Skip to content

EIP-8288: mempool aggregation and eth/76 proof wrappers (EIP-8518) - #16469

Draft
Marchhill wants to merge 40 commits into
feature/eip8288-claims-builderfrom
feature/eip8288-claims-mempool
Draft

Marchhill wants to merge 40 commits into
feature/eip8288-claims-builderfrom
feature/eip8288-claims-mempool

Conversation

@Marchhill

@Marchhill Marchhill commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Layer 3 of 3, on #16463 (builder-only EIP-8288 and eth/74), which is on #16461. It adds mempool aggregation and eth/76 as specified in Marchhill/EIPs#29 (EIP-8518).

Changes

  • Blocks.DependencyProofAggregation = Mempool, now a documented setting. BuilderOnly is kept, described as a development option.

  • Proof wrappers (ProofWrapperCodec): [transactions, deps, recursive-stark], at most 2 MiB. Each transaction is EIP-8141's pooled encoding with its aggregatable witnesses emptied. The claim mapping is Eip8288Dependencies.IsAggregatable/Map, and deps must be the exact canonical union. Wrapper problems are sorted into a transport fault (penalized), a cache miss (retried in full), or a dependency-rule failure (discarded, not penalized). A blob-carrying transaction is in EIP-8070's elided form: its commitments and cell proofs stay, they are checked against its versioned hashes, and they bind its encoding hash.

  • eth/76 on eth/74 (0x18–0x1c): Eth76ProtocolHandler subclasses Eth74ProtocolHandler. ProofWrapperRelay handles:

    • announcements, with suppression;
    • fetching modelled on geth's tx fetcher. Each wanted wrapper either waits or is fetched from one announcer, and a busy announcer fails over at once;
    • per-node budgets keyed by node ID, so they outlive reconnections:
      • a share of open fetches and bounded concurrent requests;
      • a rate limit on aggregate-proof verification, which skips proofs already verified;
      • no more fetches from a node after 8 invalid proofs or timeouts;
      • hard global caps, whose last quarter is reserved for nodes that served a proof this node verified;
    • manifests for large wrappers;
    • compact responses, and a full retry on a cache miss;
    • hint and manifest checks before proof verification;
    • relay only when a wrapper newly admitted at least one transaction and no fewer than it rejected.

    The session checks the 6,723-byte announcement bound and the response cap before decompression. The capability resolver advertises eth/76 only when EIP-8288 is scheduled and the mode is Mempool. Wrapper messages are ignored unless EIP-8288 is active at the current time.

  • Mempool aggregation: on an interval, pending transactions that no held wrapper covers are aggregated into one wrapper and announced.

  • Blobs: once a wrapper verifies, its blob-carrying transactions go to the eth/72 sparse blobpool. That samples their cells by consensus hash, from cell announcements only (a wrapper announcement adds no provider), and submits them to the pool once the cells are available. eth/72 tracks cell announcements for a type-6 hash only while such an elided copy awaits them; other frame transactions still travel whole.

  • Pool: in Mempool mode, a transaction whose leanSPHINCS witnesses are AggregatedWitness (set only after a wrapper or block proof verifies) is admitted. It is never announced or served as a pooled transaction.

  • Builder: proofs from received wrappers are kept in DependencyProofCache. A covered transaction is picked only when held proofs cover it (AggregatedTxPicker). The block proof extends those proofs (Combine now takes several parents). If that proof is not ready under a deadline, the build fails with AggregatedProofNotReadyException, and BlockProducerBase rebuilds once without such transactions.

  • Reorgs: the relay keeps each imported block's aggregated proof. A transaction a reorg returns with placeholder witnesses therefore stays buildable, and the next aggregation round re-aggregates it into a wrapper from that proof (with discards). If no proof covers it, it waits for a peer's wrapper to cover it again.

Removed vs #14202

  • Mode 0 (direct witnesses), eth/75 and the EIP-8437/8504 dependencies: EIP-8518 relays aggregates only, and individual transactions keep EIP-8141 pooled propagation.
  • Randomised/probabilistic aggregation, bucketing, batch leaves, raw-witness mode 2 and the visualiser: experimental.
  • The per-fork VK override: AGGREGATED_VK is fixed and the mempool fork changes no verification rule, so wrapper relay does not need it.
  • Wrapper RPCs (eth_sendProofWrapper), IL proofs and TxPool.AggregateProofs: not part of EIP-8518, and Mempool mode replaces the flag.
  • SparseBlobPoolPeerRegistry.Wrapped's separate store for wrapped blob transactions: the existing sparse-blobpool path takes them instead, gated on the aggregated witness, so no second store is needed.
  • Proven-subset rebuild limits (DependencyLimit, up to 8 fallbacks): replaced by one rebuild without the covered transactions. A later improvement build uses the proof once it is ready.

Remarks

Tests: wrapper codec/validation (blob sidecars included), production with covered transactions (inline, deadline and rebuild, uncovered), the picker, the pool claim filter, prefix simulation, pooled-transaction serving and gossip, the relay (fetch, hints, invalid proof, retained-witness failure, cache miss, fallback announcer, equivalent coverage, serving, aggregation, reorg re-aggregation), the eth/76 handler and serializers (with the EIP-8518 announcement vector), and the capability resolver.

eth/76 conformance: Marchhill/go-ethereum#2 adds devp2p rlpx eth76-test. Hive (local, arm64) passes eth76 12/12 (including a blob-carrying wrapper) on the EIP-8288 chain, plus 11 skips on the standard chain. In eth74, GetDependencyProofs* now fail with engine_getPayloadV6: -38005 Unsupported fork. That comes from layer 2's latest engine API commits (ae392cb0fa/bc29e25d4c): the image of the earlier layer 2 head still passes them. Could the eth74 suite move to the newer engine methods?

Benchmark (tools/eip8288-bench/run.sh, Mempool vs None; 4 nodes, about 2 peers each, 40 ± 10 ms one-way, 2 claims transactions/s for 90 s; mean of 3 runs at 607985d). It ran on a 6 vCPU / 16 GB Linode, because the GCP workflow (#15884) rejects this branch at sign-in. The EIP-7870 "Attester" and "Full Node" profiles were scaled down to fit that box (CPU x 0.078, memory x 0.043). The absolute figures are therefore not EIP-7870 numbers; only the deltas between arms mean anything. Every run reached all 184 transactions on every node, with no exceptions.

profile, arm propagation p50 / p95 / p99 ms node CPU cores node rx / tx KiB/s memory at end, MiB ms per aggregate proof
Attester, Mempool 334 / 1178 / 1485 0.88 53 / 43 1629 2435
Attester, None 322 / 1171 / 1410 0.06 31 / 21 848 –
Full Node, Mempool 388 / 1196 / 1520 0.60 (of 0.62) 41 / 31 1378 4272
Full Node, None 326 / 1061 / 1288 0.06 31 / 21 611 –

The box's kernel has no memory.peak, so these runs report memory at the end; the script now samples a peak instead. On #15884's runners, run.sh can run unscaled with CPU_SCALE=1 MEMORY_SCALE=1 on a host with at least 16 threads and 64 GB per node, plus one CPU for the load generator.

Adds Blocks.DependencyProofAggregation=Mempool, EIP-8518 proof wrappers and eth/76
(0x18-0x1c) on eth/74. Received wrapper proofs cover their transactions in the pool
and in built blocks; reorged transactions are re-aggregated from their block's proof.
…dEth/nethermind into feature/eip8288-claims-mempool
It inherited eth/74's static protocol info, so its factory took eth/74 sessions.
Discard a wrapper only under the hash it really has, hold one only while one of its
transactions is pending, bound the encoding cache by bytes, and cap a peer's
concurrent fetches and the proof failures fetched from it.
…ng table

Each wanted wrapper waits or is fetched from one announcer; a single scheduler assigns
waiting ones to the first announcer with a free request, so a busy peer fails over at
once and a removed or failing peer's fetches move on. Unanswered requests count as
failures, and a wrapper left without announcers is forgotten.
A peer opens at most 512 fetches, a full announcer list takes a new announcer in
place of a failed or busy one, and an announcement looks its peer up under the lock
RemovePeer cleans up under.
@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @Marchhill's task in 3m 9s —— View job


PR #16469 review: EIP-8518 mempool aggregation and eth/76

  • Gather context (diff against feature/eip8288-claims-builder; there were no earlier review comments)
  • Review network layer (Eth76ProtocolHandler, ProofWrapperRelay, Session, serializers)
  • Review consensus/pool changes (codec, picker, AggregatingBlockProcessor, DependencyProofCache, pool filter, rebuild)
  • Post findings

Result: 1 Medium and 4 Low findings, no Critical or High. The Medium needs a fix or an explicit rationale before merge. Each finding has an inline comment.

Findings

Severity Location Issue
Medium DependencyProofCache.cs:23 The cache allows 32 MiB of statements, but the relay holds up to 64 MiB of wrappers with proofs of up to 1 MiB each. Every 6 s Prune() re-adds all their proofs, so statements keep evicting each other. A transaction first admitted from a wrapper keeps AggregatedWitness: when its raw pooled form arrives it gets AlreadyKnown, so it cannot fall back to raw witnesses. While its statement is evicted it is skipped as NotCovered and is not re-aggregated, so it can stay unbuildable.
Low ProofWrapperRelay.cs:496 The result of Announced.TryGet is ignored. If the 4096-entry LRU evicted the announcement, Length is 0, decoding returns Malformed, and an honest peer is disconnected.
Low Session.cs:295 The fast path now ends at 6,723 bytes instead of about 3 MiB. Every larger message, on any protocol, now does a route lookup.
Low AggregatingBlockProcessor.cs:69 ExcludeAggregated is only cleared when the rebuild reaches ProcessOne. If the rebuild stops earlier, the next production build quietly leaves out covered transactions.
Low AcceptTxResult.cs:252 Message is made public so the relay can classify rejections by their text (IsWitnessError(result.Message)). That is new public surface and depends on the message wording.

Checked and found sound

  • AggregatedWitness is matched by reference, so no decoded witness can be it. The pool accepts it only in Mempool mode with EIP-8288 active. The picker allows such a transaction only when a held proof covers it, and AggregatingBlockProcessor refuses to fall back to raw witnesses (mustAggregate). This makes acceptAggregated: true in TransactionProcessorBase.FrameTx.cs:768 safe.
  • Wrapper validation:
    • A wrapper is discarded only under its canonical hash, so a peer cannot get someone else's wrapper refused.
    • deps must be the exact canonical union.
    • The reconstructed size is checked against the bound while decoding.
    • Hints and the manifest are checked before the STARK is verified.
    • Responses are matched in order with Match.
  • Fetch scheduling: each peer's opened fetches, concurrent requests and failure count are bounded. A removed peer's fetches are handed to other announcers. Serving is rate-limited and answers empty once its backlog is spent.
  • Capability: eth/76 is advertised only with Mempool mode and EIP-8288 scheduled.

Smaller notes (no inline comment)

  • STARK verification (VerifyProof) runs inline in the fetch continuation on the thread pool. With several peers each having up to 4 requests in flight, a burst of large wrappers could tie up many pool threads. A small dedicated verification queue may be worth it later.
  • In Aggregate(), if Covering(unwitnessed) returns null (eviction after Covers passed), the prover still runs with uncovered dependencies and fails. That costs a prover call and is logged only at Debug. You could recheck and skip in that case.
  • On the eth74 Hive question: I can't move the eth74 suite to the newer engine methods from here; that change belongs in Marchhill/go-ethereum.

Tests look thorough for the scope. I didn't run them in this job.

private const int MaxStatements = 16;
// Proof wrappers and received blocks share the statements with this builder's own, so they are bounded by bytes first.
private const int MaxStatements = 256;
private const long MaxStatementBytes = 32 * 1024 * 1024;

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: the statement byte budget is smaller than the relay's held set, so covered transactions can become unbuildable.

MaxStatements went from 16 to 256, but MaxStatementBytes is still 32 MiB. ProofWrapperRelay holds up to 256 wrappers or 64 MiB, and each proof can be up to MaxAggregateProofBytes (1 MiB). Every 6 s, Prune() (ProofWrapperRelay.cs:779) calls Remember for each held wrapper that still covers a pending transaction. When those proofs total more than 32 MiB, each round evicts the oldest statements, including this builder's own and block proofs.

Why this matters: a transaction admitted from a wrapper keeps AggregatedWitness. When the plain pooled form arrives later it gets AlreadyKnown, so it never goes back to raw witnesses. AggregatedTxPicker then skips it with NotCovered for as long as its statement is evicted. Aggregate() also skips it, because IsCovered sees the held wrapper. So a valid, paying transaction can stay unbuildable while its wrapper is still held.

Possible fixes: size MaxStatementBytes to at least the relay's proof budget, or count statements that back held wrappers separately, or have the picker/Plan fall back to the held wrapper's proof.

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.

Thanks, fixed in 7105030. The statement cache now holds 96 MiB, and the relay keeps its held wrappers' proofs within half of it. Prune refreshes them each round, so they no longer evict each other. Is falling back to a raw copy arriving later worth a pool change here, or better as a follow-up?

private void Receive(IProofWrapperPeer peer, PeerState state, ServedWrapper served, bool compact,
Dictionary<ValueHash256, ValueHash256[]>? manifests, List<ValueHash256>? retryFull)
{
state.Announced.TryGet(served.Hash, out WrapperAnnouncement announcement);

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: an honest peer can be disconnected if its announcement was evicted. The TryGet result is ignored. PeerState.Announced is an LRU with 4096 entries, so it can drop the entry between the announcement and the response, for example when a peer announces quickly while requests are queued. In that case announcement is default, Length is 0, and TryDecode gets bound = 0. It returns Malformed, and the relay sends a ProtocolViolation disconnect to a peer that did nothing wrong. Consider treating a missing announcement as "no longer wanted" (Complete/skip) instead of decoding with a zero bound. FetchManifests (line ~414) has the same pattern.

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.

Thanks, fixed in 7105030. A wrapper whose announcement was forgotten is now left to another announcer, without blame. A test covers it.

bool IMessageLimitSession.ExceedsMessageLimit(int adaptivePacketType, int uncompressedLength)
{
if (uncompressedLength <= Subprotocols.Eth.V74.Eth74Protocol.LocalMaxResponseBytes || _routes is not { } routes) return false;
if (uncompressedLength <= Subprotocols.Eth.V76.Eth76Protocol.MaxAnnouncementBytes || _routes is not { } routes) return false;

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 (hot path): the fast-path threshold drops from about 3 MiB to 6,723 bytes for every session. Previously, any message up to Eth74Protocol.LocalMaxResponseBytes returned straight away. Now every message over 6.7 KB, on any protocol and any eth version (eth/68 tx batches, bodies, receipts, snap ranges), pays for ResolveProtocol and a _protocols lookup. Each lookup is cheap, but this runs on every frame. You could keep the old early return for sessions that didn't negotiate eth/76, for example by caching the negotiated eth version, or check MaxAnnouncementBytes only after resolving to Eth76MessageCode.NewProofWrapperHashes.

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.

Thanks, fixed in 7105030. The fast path stays at eth/74's cap unless eth/76 was negotiated, and the version is read from the protocol table, not the route resolver. Does that look right?

finally
{
inner.TransactionsExecuted -= Aggregate;
if (rebuild) _production.ExcludeAggregated = false;

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: ExcludeAggregated is only cleared when the rebuild reaches this ProcessOne. NotReady() sets the flag, and the producer's rebuild is expected to clear it here. If the rebuild never gets here, the flag carries over to the next production build in this scope, which then quietly leaves out covered transactions. That happens if PrepareBlock throws, the token is cancelled, or the spec check at the top returns early. Resetting it in BlockProducerBase (a try/finally around the retry), or tying the exclusion to the specific block/attempt, would make this safer.

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.

Thanks, fixed in 7105030. The exclusion is now keyed to the block's parent and timestamp, so a rebuild that never runs can't affect another block. A picker case covers it.

private int Id { get; }
private string Code { get; }
private string? Message { get; }
public string? Message { get; }

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: new public surface, and the relay classifies rejections by message string. Message is made public only so that ProofWrapperRelay.Accept can call FrameTxClaimVerifier.IsWitnessError(result.Message). That ties the relay's discard decision to the free-text detail FrameTxClaimFilter passes to Reject, so any change to how that detail is formatted would silently change relay behaviour. AGENTS.md asks to avoid new public members. A dedicated AcceptTxResult code for witness failures, compared by identity, would avoid both problems.

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.

Would keeping this be acceptable? IsWitnessError compares against the FrameTxClaimVerifier constants that the pool's claim filter itself rejects with, which is also how the pool decides SidecarRejected. The alternative is to re-verify retained witnesses in the relay before submitting, which would duplicate the filter. Happy to switch if you'd prefer.

Keep the held wrappers' proofs within half the statement cache, key the rebuild's
exclusion to its block, leave a wrapper with a forgotten announcement to another
announcer, skip a re-aggregation whose covering proofs were evicted, and keep the
session's fast path at eth/74's cap unless eth/76 is negotiated.
…dEth/nethermind into feature/eip8288-claims-mempool
@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks for the review. All the inline points are addressed in 7105030 or answered in their threads. On the smaller notes: Aggregate() now skips a round whose covering proofs were evicted. A dedicated verification queue seems worth doing as a follow-up, once there are measurements; does that sound reasonable? @claude review

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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


Re-review of PR #16469 after 7105030

  • Read the follow-up commit and the thread replies
  • Check each earlier finding
  • Look for regressions the fixes introduce
  • Post the result

Result: 1 Medium and 1 Low remain, no Critical or High. Each has an inline comment.

Earlier findings

Earlier finding Status
Medium: statement cache vs held wrappers Partly fixed. The byte budget is now split: 96 MiB in total, with held proofs kept to 48 MiB or less. But MaxStatements (256) still equals MaxHeldWrappers (256). When proofs average under ~192 KiB, the count bound is hit first. Then block proofs and builder statements evict held wrappers' statements between Prune() rounds, which leaves the same NotCovered gap. Bounding the count the same way as the bytes closes it (see the inline comment).
Low: Receive ignores TryGet Fixed in Receive, with a test. FetchManifests (line 445) still has the same pattern: after the await, an evicted entry leads to IsValidManifest(…, default) and a ProtocolViolation disconnect. There's a suggested fix inline.
Low: Session fast path Fixed. Peers below eth/74 return before the route lookup, eth/74 peers keep the 3 MiB fast path, and only eth/76 sessions check above 6,723 bytes. _protocols is a ConcurrentDictionary, so the extra lookup is safe. The new SessionTests cases cover 74 vs 76.
Low: ExcludeAggregated could leak to the next build Fixed. The exclusion is now keyed to (ParentHash, Timestamp). The rebuild in BlockProducerBase calls PrepareBlock with the same parent and payload attributes, so the key matches. Hash256 == compares values, so the nullable-tuple comparison works. A stale key can only match a later build of the same payload, and that build clears it.
Low: AcceptTxResult.Message made public Accepted with your rationale. IsWitnessError compares against the FrameTxClaimVerifier constants that the filter itself rejects with, so the coupling stays inside the claims code. A dedicated result code would still be cleaner later, but I don't consider this blocking.

Your questions

  • Aggregate() skip: looks right. Returning null when Covering(unwitnessed) comes back empty avoids a prover call that would fail, and the next round retries.
  • Dedicated verification queue as a follow-up: sounds reasonable. Per-peer request bounds (4 per peer) already limit how many verifications can run at once, so this is a throughput and latency question that measurements should drive. It doesn't need to block this PR.
  • Falling back to a later raw copy (pool change): better as a follow-up. Once the count bound is fixed, the held wrapper's statement stays in the cache, so the transaction stays buildable without a pool change.

No regressions found in the fix commit

  • In Receive, an early return leaves the hash in assigned, so Finish moves it to the next announcer and doesn't count a failure. That matches the new test.
  • _heldProofBytes is updated on both Hold and Release, under _lock.

I didn't build the code or run tests in this job.

private const int MaxStatements = 16;
private const long MaxStatementBytes = 32 * 1024 * 1024;
// Proof wrappers and received blocks share the statements with this builder's own, so they are bounded by bytes first.
private const int MaxStatements = 256;

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: the count bound can still evict held wrappers' statements, so the earlier Medium is only partly fixed. 7105030 keeps the held proofs within half of the 96 MiB byte budget. But MaxStatements is still 256, and ProofWrapperRelay.MaxHeldWrappers is also 256. When held wrappers average less than 192 KiB of proof (48 MiB ÷ 256), the count bound is hit before the byte bound. At that point each block proof (RememberBlockProof) and each builder statement goes through Remember, which evicts the oldest statement by count (line ~204). That statement is often a held wrapper's.

Prune() puts them back only every 6 s. Between two rounds, AggregatedTxPicker returns NotCovered for that wrapper's transactions, and Aggregate() skips them because IsCovered sees the held wrapper. That is the same window of unbuildable transactions as before, with a smaller budget. Each Remember also does a linear dedupe scan over the full list.

Simplest fix: bound the count the same way you bounded the bytes. For example, set MaxStatements = 2 * MaxHeldWrappers, or make MaxHeldWrappers depend on DependencyProofCache.MaxStatements / 2, the way MaxHeldProofBytes already depends on the byte budget.

Dictionary<ValueHash256, ValueHash256[]> manifests = [];
foreach (ServedManifest manifest in Match(served, large, static m => m.Hash))
{
state.Announced.TryGet(manifest.Hash, out WrapperAnnouncement announcement);

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 same forgotten-announcement case remains in FetchManifests. Receive now returns when TryGet fails, but this line still ignores the result. The entry was present when large was built (line 435). After the await GetProofWrapperManifests, the peer's further announcements can evict it from the 4096-entry LRU. Then announcement is default, IsValidManifest sees Length == 0 and returns false, and an honest peer gets a ProtocolViolation disconnect.

Suggested change
state.Announced.TryGet(manifest.Hash, out WrapperAnnouncement announcement);
if (!state.Announced.TryGet(manifest.Hash, out WrapperAnnouncement announcement))
{
// Unverifiable against a forgotten announcement; left to another announcer, as in Receive.
hashes.Remove(manifest.Hash);
continue;
}

Finish gets the original assigned list, so a hash removed here still moves to its next announcer.

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.

Thanks, fixed in d3a2ac7. The forgotten announcement is skipped there too, and a test covers it.

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Stateless guest cost

⚠️ Baseline does not match this pull request's base; deltas are suppressed.

Restored from 14d42a1fef58, not this pull request's base (1a03e1165716).

Only absolute measurements are shown.

block steps prover cost
11957686 251,695,478 26,848,095,000
11962410 149,165,003 15,829,717,433
11962415 180,216,675 19,290,890,203
11962427 153,160,566 16,140,035,726
11962485 157,268,963 16,790,889,130
25526356 85,502,116 14,363,778,960
25532382 91,372,053 16,318,297,882
25532442 102,148,006 16,611,756,493
25532454 109,149,789 18,243,593,940
25532553 96,016,053 15,889,797,984
25532642 99,764,544 16,615,387,510

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

…pers

Budgets are keyed by node ID, so they outlive reconnections, under a global cap on
requests. Aggregate proofs not verified before are rate limited per node and overall,
and a served wrapper longer than announced is refused before decoding.
… proven nodes

Replaces the fair-share exception, which left the caps unbounded under many fresh nodes.
…' into feature/eip8288-claims-mempool

# Conflicts:
#	src/Nethermind/Nethermind.Consensus/Processing/BranchProcessor.cs
#	src/Nethermind/Nethermind.Consensus/ProofAggregation/Eip8288Module.cs
@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks for the earlier reviews. Could you take another look? 9597ccc merges the layer 2 fixes, and 73f058a also rebuilds a Mempool payload once the proof covering its wrapper transactions is ready, and passes IBlocksConfig to the AuRa pool. @claude review

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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


Re-review of PR #16469 after 9597ccc and 73f058a

  • Find the new commits
  • Review the merge conflict resolutions (BranchProcessor.cs, Eip8288Module.cs)
  • Review 73f058a: rebuild once the proof is ready, and the AuRa pool config
  • Post findings

Result: 1 new Medium, no Critical or High. It has an inline comment. I didn't build the code or run the tests in this job.

New finding

Severity Location Issue
Medium AggregatingBlockImprovementContextFactory.cs:150 In Mempool mode, any ScheduledProofCompleted triggers the single rebuild while the payload lacks the aggregated proof. That includes a statement from an earlier payload that is still running, or from a sibling improvement context. Such a rebuild runs before the statement covering the left-out wrapper transaction is proven, so it leaves the transaction out again and sets _second. The relevant completion then can't start another rebuild, so on a quiet pool getPayload still lacks the wrapper transaction, which is the case this commit is meant to fix. There's also a smaller cost: Mempool-mode payloads with no claims (DependencyProof null) do one extra full build on the first unrelated completion. Suggested fix: rebuild only when the first build actually left transactions out, and only once those are covered (for example by checking the depsHash it scheduled with TryGetProof). Alternatively, let a rebuild that still lacks the proof re-arm. A test with an unrelated proof completing before the gate opens would cover this.

Checked and found sound

  • BranchProcessor merge: both UnavailableException and AggregatedProofNotReadyException are still excluded from the warning, so neither layer's exclusion was lost.
  • Eip8288Module merge: layer 2's AggregatingBlockImprovementContextFactory decorator and this layer's picker, production and gossip registrations are all kept. The added Nethermind.Consensus.Producers using is needed for IBlockImprovementContextFactory.
  • AuRa: passing IBlocksConfig to the AuRa TxPool makes its claim filter and gossip honour Mempool mode, as the default pool does.
  • Rest of RebuildingContext (mode shared with BuilderOnly): the raw-witness _awaited path is unchanged. _firstBuilt, _provenEarly and _lacksAggregatedProof are read and written only under _lock. The rebuild still runs off the prover's thread.
  • New test Production_Mempool_QuietPool_GetPayloadCarriesTheWrapperTransactionOnceProven covers the intended path: build without the transaction, gate the proof, rebuild with it. Making Covered and Produce internal is test-only.

Earlier items

All earlier Medium findings are fixed. The Lows you deferred while the relay is frozen are accepted as follow-ups: the mixed wrapper whose blob copy is declined, and gating Schedule on global verification room.

Mergeability

The one new Medium blocks the merge until it is fixed or you explain why it's acceptable.

lock (_lock)
{
if (_awaitsAnyStatement && !_firstBuilt) _provenEarly = true;
awaited = _awaited == depsHash || (_awaitsAnyStatement && _lacksAggregatedProof);

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: in Mempool mode the one rebuild can be used up by an unrelated proof, and the payload then never gets the wrapper transaction.

With _awaitsAnyStatement, any ScheduledProofCompleted event triggers the rebuild while the payload lacks the aggregated proof. The same is true of _provenEarly, which is set by any event that arrives before the first build finishes. DependencyProofCache runs one statement at a time, so the event can easily belong to another statement:

  • a statement scheduled by an earlier payload or slot that is still running (the PR's benchmark shows 2.4–4.3 s per aggregate proof), or
  • a statement scheduled by a sibling improvement context of the same payload. The payload service starts a new RebuildingContext whenever transactions arrive.

Scenario: statement S0 is still running when payload P starts. P's first build leaves wrapper transaction W out (AggregatedProofNotReadyException), and its statement S1 waits as _pending. S0 completes, so OnProven sees _lacksAggregatedProof and starts the rebuild. W still isn't covered, so the rebuild leaves it out again and sets _second. When S1 completes, StartRebuild returns early because _second is not null. On the quiet pool this commit targets, getPayload returns a block without W.

There's a smaller cost as well. Every Mempool-mode payload whose block has no aggregated proof does one full extra build per payload on the first proof completion anywhere. That includes blocks with no claims at all, where DependencyProof is null and therefore also matches is not [Aggregated, ..]. The rebuild is adopted only if it's better, so this is CPU only.

Possible fixes:

  • Before rebuilding, check that what the first build left out is now covered: record its excluded transactions, or the depsHash it scheduled, and test it with _proofCache.TryGetProof or Covers. Rebuild only then.
  • Or let a rebuild re-arm when its result still lacks the aggregated proof.

Either way, rebuild only when the first build actually left transactions out, not whenever DependencyProof isn't aggregated. A test with an unrelated ScheduledProofCompleted that fires before the gate opens would catch this; the current test has no competing statement.

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.

Thanks, fixed in 8c302b5. A build that leaves wrapper transactions out now records the statement it scheduled for them (AggregatedTxProduction.LeftOut, keyed to the block). The decorator rebuilds only once that statement, or the raw-witness one, is proven. The excluded rebuild no longer schedules its own statement, so it cannot displace the pending one. The test now has an unrelated statement completing first, and that case fails with the earlier rule.

@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks, the Medium is fixed in 8c302b5. Could you take another look? @claude review

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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


Re-review of PR #16469 after 8c302b5

  • Read the fix commit (8c302b5) and its updated test
  • Check the earlier Medium: an unrelated proof uses up the single Mempool rebuild
  • Look for regressions the fix introduces
  • Post the result

Result: no Critical, High or Medium findings remain open. There is 1 new Low, posted as an inline comment. I didn't build the code or run the tests in this job.

Earlier finding

Earlier finding Status
Medium: any ScheduledProofCompleted triggers the Mempool rebuild Fixed. NotReady now records the scheduled depsHash in AggregatedTxProduction.LeftOut, keyed to (parent, timestamp). RebuildingContext waits only for that statement or for the raw-witness one. _awaitsAnyStatement, _provenEarly and _lacksAggregatedProof are gone, so payloads without claims no longer do an extra build on an unrelated completion. The excluded retry in BlockProducerBase no longer schedules its own statement (rebuild → !rebuild guard). That means it can't replace the pending left-out statement in the cache's single _pending slot. The test now has an unrelated statement finish first (anotherStatementProving) and asserts Builds == 1 before the gate opens.

New finding

Severity Location Issue
Low AggregatingBlockImprovementContextFactory.cs:119 Nothing clears LeftOut. Once A's statement is proven and A has rebuilt, every later sibling context for the same payload still matches it. That includes the common case where only plain transactions arrived and the first build already carries the aggregated proof. Each such sibling then rebuilds straight away, which doubles block-building CPU for the rest of the slot. Adopt keeps the result correct. Suggested fix: take the left-out path only when the first block lacks the aggregated proof, or clear LeftOut once it has been used.

Checked and found sound

  • AddScoped → AddSingleton for AggregatedTxProduction. The decorator factory is resolved at root, so a singleton is needed for it to share state with the processor and the picker. The state stays keyed to (parent, timestamp). LeftOut is a single reference write, so the improvement thread can read it without tearing.
  • Rebuild contents. LeftOut is the canonical union of the aggregated and raw dependencies. When it is proven, the rebuild's Plan finds it cached and aggregates inline, even under the deadline. ExcludeAggregatedFor was already cleared by the excluded retry, so the picker includes the wrapper transaction again.
  • NotReady(block, null) (when Plan returns null or the prover throws) records no LeftOut. No rebuild is armed in that case, which is right: there is nothing to wait for.
  • The raw _awaited path is unchanged for BuilderOnly. rebuild can only be true after NotReady, which requires mustAggregate, so only Mempool mode reaches it.

Accepted earlier, still open as follow-ups

  • A mixed wrapper loses its declined blob copy.
  • Schedule isn't gated on room in the global verification window.
  • Edge case, efficiency only: if the left-out statement never runs, the payload is never rebuilt with the wrapper transaction. That happens when a later payload replaces it as the cache's single pending statement, or when the prover is busy (LeanProverBusyException). The block stays valid with raw witnesses.

Mergeability

No Critical, High or Medium findings remain open. The new Low doesn't block the merge.

/// witnesses, rebuilding at once if one is proven already.</summary>
private void OnFirstBuilt()
{
if (_leftOut() is { } leftOut)

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 (CPU only): a stale LeftOut makes every later improvement context of the same payload do an extra full build.

LeftOut is written in NotReady but never cleared, and it is keyed only to (parent, timestamp). After context A's statement S1 is proven and A rebuilds, LeftOut still points at S1. When transactions arrive, the payload service starts a sibling context B. Often B's new transactions are plain, so its deps union equals S1 and B's first build already carries the aggregated proof. B's OnFirstBuilt still matches the stale LeftOut, sees TryGetProof(S1) is true, and calls Rebuild() straight away. The same happens for every later sibling in the slot. Adopt keeps the result correct, but block-building work doubles for the rest of the slot on any payload that once left a wrapper transaction out.

A minimal fix is to take the left-out path only when the first block actually lacks the aggregated proof:

if (_leftOut() is { } leftOut
    && _first.Best.CurrentBestBlock?.DependencyProof is not [Eip8288Constants.DependencyProofVersionAggregated, ..])

(Clearing LeftOut once a build of that block succeeds with the aggregated proof also works.) A test case with a second context started after the rebuild, asserting Builds doesn't grow, would cover it.

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.

Thanks, fixed in 2e6b164: the left-out path is taken only while the first build lacks the aggregated proof, so a later context whose build already carries it does not rebuild. Production_Mempool_LeftOutStatementAlreadyUsed_DoesNotRebuildAnAggregatedPayload covers it, and it fails without the check.

@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks, the Low is fixed in 2e6b164. Could you take another look? @claude review

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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


Re-review of PR #16469 after 2e6b164

  • Read the fix commit (2e6b164) and its test
  • Check the earlier Low: a stale LeftOut makes sibling contexts rebuild
  • Look for regressions the fix introduces
  • Post the result

Result: no Critical, High or Medium findings, and no new Low. I didn't build the code or run the tests in this job.

Earlier finding

Earlier finding Status
Low: a stale LeftOut makes every later sibling context rebuild Fixed. OnFirstBuilt now takes the left-out path only while the first build's DependencyProof is not [Aggregated, ..]. A sibling whose build already carries the aggregated proof neither sets _awaitedLeftOut nor rebuilds. It also skips the raw-witness path, because that path needs [Raw, ..], so the sibling does no extra build at all. Production_Mempool_LeftOutStatementAlreadyUsed_DoesNotRebuildAnAggregatedPayload pre-seeds a proven LeftOut, checks that the precondition holds (the first block is aggregated), and asserts Builds == 1.

Checked and found sound

  • A sibling whose block still lacks the aggregated proof keeps the earlier behaviour. It rebuilds once if the recorded statement is proven, and otherwise waits for it. That is the case the rebuild exists for.
  • A sibling with no claims (DependencyProof null) and a stale, proven LeftOut. In theory it could still rebuild. In practice it can't happen: the excluded retry has already cleared ExcludeAggregatedFor, and the picker includes the covered wrapper transaction, so a later build for the same (parent, timestamp) would carry claims and be aggregated. Even if it did happen, it would cost one build of CPU and nothing else.
  • The new comment explains why the check is needed (sibling contexts share the record), so it isn't noise.

Accepted earlier, still open as follow-ups

  • A mixed wrapper loses its declined blob copy.
  • Schedule isn't gated on room in the global verification window.
  • If the left-out statement never runs (it is replaced in the cache's single _pending slot, or LeanProverBusyException is thrown), the payload keeps raw witnesses. The block is still valid; only efficiency is lost.
  • A dedicated STARK verification queue, once there are measurements.

Mergeability

No Critical, High or Medium findings remain open. As far as this review covers, the PR is mergeable.

@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks for this. I ran 2e6b164fdb on a 2-node devnet with EIP-8141 and EIP-8288 at genesis, both nodes in Mempool mode (they negotiate eth/76). A scripted CL drives it over newPayloadV7, and one node builds. It worked well:

  • Raw leanSPHINCS txs sent to the non-building node were aggregated into a wrapper, relayed over eth/76, verified by the builder, and included as 0x01 (e.g. 44 placeholder txs in one block, 250 KB, VALID on both nodes).
  • After the builder restarted, the held wrapper was offered on reconnect, and its tx landed in a 0x01 block.
  • On a quiet pool, txs arriving mid-build shipped as 0x01 in the same slot once the proof completed (45 claims: 348 KB raw → 252 KB). The devnet-2 rebuild question is resolved.
  • Blob-carrying claim txs worked inside a builder aggregate: 43 txs, 3 of them with blobs, in one 0x01 block.
  • A wiped node beacon-synced over P2P through every 0x01 block with no missing-proof errors, and both nodes agree on all blocks.
  • Mixed secp256k1/P256/custom claims alongside leanSPHINCS, plus restarts of either node, raised no invalid blocks. The only exception was one Invalid Snappy block at peer connect, which I also saw on the EIP-8141: declarative claims, segregated witnesses and HASCLAIM #16461 build.

A few questions and suggestions:

  1. Blob-carrying txs in mempool wrappers. ProofWrapperRelay.Aggregate reads _txPool.GetPendingTransactions(), which doesn't include the blob pool. As a result, a wrapper never covers a blob-carrying claim tx, even though ProofWrapperCodec.Normalize and the receive path (cell sampling) handle them. With 40 plain and 3 blob leanSPHINCS txs pending, both nodes' mempool rounds proved 40 direct, while the builder's block proof covered all 43. Should Aggregate also draw from the pending blob transactions?

  2. Duplicate proving (minor). When txs arrive mid-build, the builder's scheduled proof and the next mempool round prove the same set back to back, e.g. 45 direct at 00:12:56 and again at 00:12:57, ~800 ms each. With 44 claims under load the two runs took 4.1 s and 1.5 s. Could the mempool round reuse a statement the cache already holds for the same deps hash?

  3. Observability (minor). On success the relay logs nothing, even at Debug: no line when a wrapper is built, received, verified or relayed. I could only infer relay from pool counts and the EIP-8288 proof in ... lines. A Debug line per wrapper (hash, tx count, admitted/rejected) would make this much easier to follow on a devnet.

Measurements (6 vCPU x86 box): mempool proofs took 0.15 s for 1 claim, 0.8–1.5 s for 40–45 claims, and up to 6.4 s when both nodes proved at once. A lone wrapper-covered tx that the builder holds only as a placeholder ships as 0x01 with a ~258 KB recursive proof, as expected, since its raw witness isn't available.

@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks for the devnet findings. Could you take another look? 8552373 adds pending blob-pool frame transactions to mempool aggregation, in the elided form, and logs wrapper admission and relay at Debug. 5536eb8 reuses the proof of a statement proven just before, so the builder and the mempool tick no longer prove the same set twice. @claude review

@claude

claude Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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


Re-review of PR #16469 after 8552373 and 5536eb8

  • Read 8552373: blob-pool frame transactions in aggregation, plus Debug logging
  • Read 5536eb8: reuse of a statement proven just before
  • Look for regressions
  • Post findings

Result: no Critical, High or Medium findings. There are 2 new Low findings, each with an inline comment. I didn't build the code or run the tests in this job.

Your devnet questions

Question Status
1. Blob-carrying claim transactions in mempool wrappers Fixed. AggregationCandidates() now reads the blob pool's light records too. It keeps only uncovered frame transactions and loads each through TryGetPendingTransactionWithoutBlobs. That method returns BlobTransactionPayload.Elide(...), which removes Blobs, CellMask and Cells but keeps Commitments and the V1 cell Proofs, so the result passes Normalize → HasElidedSidecar. The claim witnesses survive too: the persistent pool's metadata cache stores the full transaction in elided form. The type and IsCovered checks run before the load, so a DB read only happens for frame transactions still waiting for coverage. The loop is lazy, so it stops at MaxProducedTransactions. The new test runs a blob-only wrapper from the producer to a receiver that holds it and records it for sampling.
2. Proving the same set twice Fixed. ProveDependencyProof returns the last proof when (depsHash, vk) repeat. This is safe: the proof attests to the statement (depsHash, AggregatedVk), not to how the input was split into direct, recursive and discarded parts, and verification is keyed on (depsHash, vk, proof). The check and the store both happen under _provingLock, and only a proof that verified is stored. It catches only back-to-back repeats, which is exactly the builder-then-tick case you saw. A set that differs (for example, the builder includes transactions that a held wrapper already covers) is still proven again, as it should be.
3. Debug logging Mostly fixed. Accept now logs each received wrapper with its counts and whether it was relayed, and Discard already logged discards. A wrapper this node builds still has no line of its own; see the Low below.

New findings

Severity Location Issue
Low AggregatedDependencyProofTests.cs:408 The new test was inserted between the Signatures fold… XML doc and the test it describes. The new test now has two <summary> elements, and the folding test has none.
Low ProofWrapperRelay.cs:305 (AddLocal) A locally built wrapper gets no Debug line with its hash, transaction count, or whether it was announced. That makes it hard to match against the receiver's Proof wrapper … from … line on a devnet. There's a suggestion inline.

Smaller notes (no inline comment)

  • Blob candidates come after every non-blob pending transaction. With more than 256 uncovered plain frame transactions, blob transactions wait one or more 6 s rounds. They are aggregated once the plain ones are covered, so this only delays them.

Accepted earlier, still open as follow-ups

  • A mixed wrapper loses its declined blob copy.
  • Schedule isn't gated on room in the global verification window.
  • If the left-out statement never runs, the payload keeps raw witnesses.
  • A dedicated STARK verification queue.

Mergeability

No Critical, High or Medium findings remain open. The two new Lows don't block the merge.

Comment on lines +408 to +410
/// <summary>Signatures fold in the fewest equal leaves within the native bound, and recursive inputs merge
/// <see cref="DependencyProofAggregator.FanIn"/> at a time in calls of their own.</summary>
/// <summary>The builder and the mempool aggregation proving the same pending set back to back run the prover once.</summary>

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 (doc): the new test landed between an existing test's XML doc and that test. The Signatures fold in the fewest equal leaves… summary was written for the [TestCase(1, 0, new[] { 1 }, 1)] test below. It now sits on ProveDependencyProof_SameStatementBackToBack_ReusesTheProof, so that test has two <summary> elements and the folding test has none. Moving the new test (with its own summary) above line 408 fixes it:

Suggested change
/// <summary>Signatures fold in the fewest equal leaves within the native bound, and recursive inputs merge
/// <see cref="DependencyProofAggregator.FanIn"/> at a time in calls of their own.</summary>
/// <summary>The builder and the mempool aggregation proving the same pending set back to back run the prover once.</summary>
/// <summary>The builder and the mempool aggregation proving the same pending set back to back run the prover once.</summary>

After applying this, put the Signatures fold… summary back directly above [TestCase(1, 0, new[] { 1 }, 1)].

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.

Thanks, fixed in 0358bd6.

Comment on lines +305 to +309
internal void AddLocal(ProofWrapper wrapper)
{
_proofCache.Remember(wrapper.Deps, wrapper.DepsHash, wrapper.Proof);
if (Hold(wrapper)) AnnounceToAll(wrapper);
}

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 (observability): a wrapper this node builds still produces no Debug line. 8552373 logs received wrappers in Accept, and Discard already logs discards. The local path (StartAggregation → Aggregate → AddLocal) logs only the prover's EIP-8288 proof in … line. That line doesn't give the wrapper hash, how many transactions it holds, or whether it was announced. Your devnet note asked for a line when a wrapper is built, so a matching line here would let you trace a wrapper from its builder to the nodes that receive it:

Suggested change
internal void AddLocal(ProofWrapper wrapper)
{
_proofCache.Remember(wrapper.Deps, wrapper.DepsHash, wrapper.Proof);
if (Hold(wrapper)) AnnounceToAll(wrapper);
}
internal void AddLocal(ProofWrapper wrapper)
{
_proofCache.Remember(wrapper.Deps, wrapper.DepsHash, wrapper.Proof);
bool held = Hold(wrapper);
if (held) AnnounceToAll(wrapper);
if (_logger.IsDebug) _logger.Debug($"Built proof wrapper {wrapper.Hash}: {wrapper.Transactions.Length} transactions, {wrapper.Length} bytes{(held ? ", announced" : ", not held")}");
}

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.

Thanks, fixed in 0358bd6.

@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks, both Lows are fixed. Could you take another look? @claude review

@claude

claude Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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


Re-review of PR #16469 after 0358bd6

  • Read the fix commit (0358bd6)
  • Check the two earlier Lows (misplaced XML doc, no Debug line for a built wrapper)
  • Look for regressions
  • Post the result

Result: no Critical, High or Medium findings, and no new Low. I didn't build the code or run the tests in this job.

Earlier findings

Earlier finding Status
Low (doc): the new test sat between the Signatures fold… summary and its test Fixed. ProveDependencyProof_SameStatementBackToBack_ReusesTheProof now has one <summary>. The fold summary is back directly above [TestCase(1, 0, new[] { 1 }, 1)].
Low (observability): no Debug line when this node builds a wrapper Fixed. AddLocal now logs the wrapper hash, how many transactions it holds, its length, and whether it was announced or not held (ProofWrapperRelay.cs:308-310). The log is behind IsDebug, so the hot path doesn't pay for the string. The behaviour is the same as before: it remembers the proof, holds the wrapper, and announces it only once held.

Accepted earlier, still open as follow-ups

  • A mixed wrapper loses its declined blob copy.
  • Schedule isn't gated on room in the global verification window.
  • If the left-out statement never runs, the payload keeps raw witnesses.
  • A dedicated STARK verification queue, once there are measurements.
  • Blob candidates are aggregated only after the non-blob pending transactions, which only delays them.

Mergeability

No Critical, High or Medium findings remain open. As far as this review covers, the PR is mergeable.

@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks. 7671c01 does the two approved follow-ups: blob-pool frame transactions now compete with the others by fee, and a deferred fetch waits for room in the global verification window instead of being downloaded again. Could you take another look? @claude review

@claude

claude Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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


Re-review of PR #16469 after 7671c01

  • Read the follow-up commit (7671c01) and its two tests
  • Check the two follow-ups you'd agreed to do (ranking blob-pool frame transactions by fee, and gating deferred fetches on global room)
  • Look for regressions
  • Post findings

Result: no Critical, High or Medium findings. There are 2 new Low findings, each with an inline comment. I didn't build the code or run the tests in this job.

Follow-ups in this commit

Follow-up Status
Blob candidates were aggregated only after every non-blob pending transaction Done. AggregationCandidates() now gathers the uncovered frame transactions from both pools into one list and sorts it by tip, then by max fee. A blob-pool light record is still loaded from the DB only when the loop reaches it, so the lazy load is kept; only the light records are kept in memory, not the full transactions. The light records carry both fee fields (LightTransaction copies GasPrice and DecodedMaxFeePerGas), so the comparison is valid. Aggregate_BlobTransactionOutrankingTheOthers_IsCoveredInTheSameRound covers it.
A deferred fetch was downloaded again every window while the global window stayed spent Done. Schedule now skips a fetch with DeferredAt != 0 while HasGlobalRoom is false, unless IsProven exempts it. Because HasGlobalRoom uses WithinGlobalCap with the announcer's own budget, an announcer that has proven itself can still use the reserved quarter, and the fetch keeps all its announcers. Tick reschedules it every 6 s, so it resumes once the window rolls.

New findings

Severity Location Issue
Low ProofWrapperRelayTests.cs:663-666 Task.Delay(target - clock.Elapsed) throws ArgumentOutOfRangeException when the delay goes negative, for example when SpendGlobalBudget runs slowly on CI. The < 4 s precondition is also sensitive to timing. Clamp the delays to zero, or inject a time source.
Low ProofWrapperRelay.cs:1084 The ranking ignores the base fee. A transaction with a large tip and MaxFeePerGas below the base fee can take a slot even though no block can include it yet. Ranking by effective tip, or reusing the pool's comparer, fixes this. It affects efficiency only.

Smaller notes (no inline comment)

  • IsCovered and IsProven are now called twice per candidate or announcer: in AggregationCandidates and again in Aggregate, and in both Schedule checks. Both calls are cheap and bounded, so this isn't worth churning code for.
  • List.Sort isn't stable, so transactions with equal fees are aggregated in no fixed order. This doesn't matter for correctness: chosen is re-sorted by hash before it is encoded.

Accepted earlier, still open as follow-ups

  • A mixed wrapper loses its declined blob copy.
  • If the left-out statement never runs, the payload keeps raw witnesses.
  • A dedicated STARK verification queue, once there are measurements.

Mergeability

No Critical, High or Medium findings remain open. Both new findings are Low and don't block the merge.

Comment on lines +663 to +666
await Task.Delay(TimeSpan.FromSeconds(2.1) - clock.Elapsed);
await SpendGlobalBudget(context, 1);
await Task.Delay(TimeSpan.FromSeconds(3.5) - clock.Elapsed);
Assert.That(clock.Elapsed, Is.LessThan(TimeSpan.FromSeconds(4)), "precondition: still within the second global window");

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 (test flakiness): this test depends on wall-clock timing and can throw on a slow CI runner.

Task.Delay(TimeSpan.FromSeconds(2.1) - clock.Elapsed) throws ArgumentOutOfRangeException when the delay is negative and isn't exactly -1 ms. The delay goes negative whenever SpendGlobalBudget (240 announcements) takes longer than about 0.9 s. The 3.5 s delay has the same problem, and the < 4 s precondition is also sensitive to timing. At minimum, clamp both delays:

static TimeSpan Until(TimeSpan target, Stopwatch clock) => target > clock.Elapsed ? target - clock.Elapsed : TimeSpan.Zero;

A cleaner fix is to drive both windows through an injectable time source instead of Stopwatch.GetTimestamp().

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.

Thanks, fixed in 020f2a6.

}
}

candidates.Sort(static (left, right) => right.Tx.MaxPriorityFeePerGas.CompareTo(left.Tx.MaxPriorityFeePerGas) is var byTip and not 0

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: candidates are ranked by nominal tip, ignoring the base fee.

The ranking uses MaxPriorityFeePerGas, so a transaction with a large tip but MaxFeePerGas below the current base fee ranks first. It takes one of the 256 slots even though no block can include it right now. A payable transaction that would actually be built then waits for a later round. Ranking by effective tip, min(MaxPriorityFeePerGas, MaxFeePerGas - baseFee) against _blockTree.Head?.Header.BaseFeePerGas, would match how blocks pick transactions. Another option is to reuse the pool's comparer, as TxPoolTxSource does. This affects efficiency only, not correctness.

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.

Thanks, fixed in 020f2a6.

@Marchhill

Copy link
Copy Markdown
Contributor Author

Thanks, both Lows are fixed. Could you take another look? @claude review

@claude

claude Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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


Re-review of PR #16469 after 020f2a6

  • Read the fix commit (020f2a6)
  • Check the two earlier Lows (test timing, effective-tip ranking)
  • Look for regressions
  • Post the result

Result: no Critical, High or Medium findings, and no new Low. I didn't build the code or run the tests in this job.

Earlier findings

Earlier finding Status
Low (test flakiness): negative Task.Delay and a timing-sensitive precondition in Verification_GlobalBudgetSpentAgain_KeepsTheDeferredFetchWaiting Fixed. Until(...) clamps both delays at zero, so Task.Delay can't throw. The < 4 s check is now Assume.That, so a slow runner reports the test as inconclusive rather than failing it. That's reasonable for a test that depends on wall-clock time. An injectable time source would still be cleaner, but it isn't needed.
Low: ranking ignored the base fee Fixed. AggregationCandidates() now calls TryCalculatePremiumPerGas(baseFee, ...), the same helper TxPoolTxSource uses. Candidates are sorted by payable first, then effective tip, then max fee. A transaction whose fee cap is below the base fee gets Payable = false and a tip of 0, so it ranks after every payable one. The light blob records carry DecodedMaxFeePerGas/GasPrice, and frame transactions use Supports1559, so the calculation is valid for both pools. The DB load is still lazy: it only happens when the loop reaches the record. Aggregate_TransactionBelowTheBaseFee_RanksAfterThePayableOnes fills all 256 slots with payable transactions and checks that the unpayable one with a higher tip is left out.

Checked and found sound

  • Base fee source. The ranking uses the head's BaseFeePerGas, not the next block's. The two differ by at most 12.5%, which only affects transactions right at the margin. That's fine for a ranking heuristic.
  • Add as a local function inside the iterator. This is legal in an iterator, and all candidates are collected before the first yield, so nothing changes in when the pool is read.
  • Test Context.BlockTree. Exposing the substitute doesn't change other tests: Head still returns null unless a test sets it. IsActive falls back to block 0, as before.

Accepted earlier, still open as follow-ups

  • A mixed wrapper loses its declined blob copy.
  • If the left-out statement never runs, the payload keeps raw witnesses.
  • A dedicated STARK verification queue, once there are measurements.

Mergeability

No Critical, High or Medium findings remain open. As far as this review covers, the PR is mergeable.

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.

1 participant