Skip to content
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e8337bc
feat(eip8288): mempool aggregation and eth/76 proof wrappers (EIP-8518)
Marchhill Nov 28, 2026
bc3a621
Merge branch 'feature/eip8288-claims-builder' of github.com:Nethermin…
Marchhill Nov 28, 2026
6440edd
fix(eip8288): register the eth/76 handler under its own version
Marchhill Nov 28, 2026
9f01f66
fix(eip8288): harden proof wrapper retrieval
Marchhill Nov 28, 2026
c7217cd
fix(eip8288): apply the per-peer fetch limits on failover too
Marchhill Nov 28, 2026
622fddf
fix(eip8288): defer a busy peer's fetches instead of dropping it
Marchhill Nov 28, 2026
1f540d0
refactor(eip8288): schedule wrapper fetches from one announced/fetchi…
Marchhill Nov 28, 2026
1246b62
test(eip8288): sample the eth/76 messages in the decoding compatibili…
Marchhill Nov 28, 2026
c4874b8
fix(eip8288): bound each peer's share of wrapper fetches
Marchhill Nov 28, 2026
7105030
fix(eip8288): address review of mempool aggregation
Marchhill Nov 28, 2026
f3fa5d4
Merge branch 'feature/eip8288-claims-builder' of github.com:Nethermin…
Marchhill Nov 28, 2026
d3a2ac7
fix(eip8288): bound held wrappers by half the statement count, and sk…
Marchhill Nov 28, 2026
81b4d25
feat(eip8288): per-node fetch and verification budgets for proof wrap…
Marchhill Nov 28, 2026
719e1cd
fix(eip8288): keep a fair share of the global wrapper caps for nodes …
Marchhill Nov 28, 2026
ca7dcfe
fix(eip8288): reserve the last quarter of the global wrapper caps for…
Marchhill Nov 28, 2026
cf2aacd
feat(eip8288): blob-carrying transactions in proof wrappers
Marchhill Nov 28, 2026
a5758bb
fix(eip8288): keep blob transactions awaiting cells out of admission
Marchhill Nov 28, 2026
af760ce
Merge branch 'feature/eip8288-claims-builder' of github.com:Nethermin…
Marchhill Nov 28, 2026
2b69ee4
fix(eip8288): let a differing blob copy take over only after the reco…
Marchhill Nov 28, 2026
22cf2c5
fix(eip8288): keep one alternate per blob transaction awaiting cells
Marchhill Nov 28, 2026
aa56ada
fix(eip8288): keep the first blob alternate rather than the latest
Marchhill Nov 28, 2026
00a9b1f
feat(eip8288): mempool aggregation benchmark
Marchhill Nov 28, 2026
3be2d36
fix(eip8288): relay wrappers whose blob transactions await cells, and…
Marchhill Nov 28, 2026
1e12349
fix(eip8288): count only newly sampled blob transactions as pending, …
Marchhill Nov 28, 2026
c6c523f
fix(eip8288): defer wrappers on a spent global verification budget, a…
Marchhill Nov 28, 2026
607985d
fix(eip8288): charge only exempted fetches, skip declined blob copies…
Marchhill Nov 28, 2026
42cdfbd
eth/76: keep deferred fetches and count unsamplable blob copies as re…
Marchhill Nov 28, 2026
dff1667
test: an unsamplable blob copy counts as rejected
Marchhill Nov 28, 2026
eeab515
bench: sample memory when the kernel has no memory.peak
Marchhill Nov 28, 2026
beda49b
Merge remote-tracking branch 'upstream/feature/eip8288-claims-builder…
Marchhill Nov 28, 2026
fcba95f
test(eip8288): keep the mempool benchmark runner in tools/
Marchhill Nov 28, 2026
9597ccc
Merge remote-tracking branch 'upstream/feature/eip8288-claims-builder…
Marchhill Nov 28, 2026
73f058a
fix(eip8288): rebuild a Mempool payload once the proof covering its w…
Marchhill Nov 28, 2026
8c302b5
fix(eip8288): rebuild a Mempool payload only for the statement coveri…
Marchhill Nov 28, 2026
2e6b164
fix(eip8288): take the left-out rebuild only while the payload lacks …
Marchhill Nov 28, 2026
8552373
eth/76: aggregate pending blob frame transactions and log wrapper adm…
Marchhill Nov 29, 2026
5536eb8
fix(eip8288): reuse the proof of a statement proven just before
Marchhill Nov 29, 2026
0358bd6
eth/76: log built wrappers, and keep the fold test's summary on it
Marchhill Nov 29, 2026
7671c01
eth/76: rank aggregation candidates by fee, and hold deferred fetches…
Marchhill Nov 29, 2026
020f2a6
eth/76: rank aggregation candidates by effective tip, and clamp the d…
Marchhill Nov 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Nethermind.Config;

/// <summary>Where this node aggregates the leanSPHINCS witnesses of EIP-8141 claims into EIP-8288 recursive proofs.</summary>
/// <remarks>Affects only what the node produces: every node accepts and verifies both raw and aggregated dependency proofs.</remarks>
/// <remarks>Every node accepts and verifies both raw and aggregated dependency proofs in blocks.</remarks>
public enum DependencyProofAggregation
{
/// <summary>No aggregation: produced blocks carry raw witnesses (dependency proof version <c>0x00</c>).</summary>
Expand All @@ -13,4 +13,8 @@ public enum DependencyProofAggregation
/// <summary>The block producer aggregates its block's leanSPHINCS witnesses into one recursive proof (version <c>0x01</c>)
/// when the proof is ready and smaller than the raw witnesses it replaces, and keeps them raw otherwise.</summary>
BuilderOnly,

/// <summary>As <see cref="BuilderOnly"/>, and also aggregates pending transactions into EIP-8518 proof wrappers, relays
/// them over <c>eth/76</c>, and builds blocks from the transactions they cover.</summary>
Mempool,
}
7 changes: 3 additions & 4 deletions src/Nethermind/Nethermind.Config/IBlocksConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ public interface IBlocksConfig : IConfig
double SingleBlockImprovementOfSlot { get; set; }

/// <summary>Where this node aggregates EIP-8288 dependency proofs. Defaults to <see cref="DependencyProofAggregation.None"/>.</summary>
/// <remarks>Applies only on chains with EIP-8288 scheduled, and only to what the node produces: every node accepts and
/// verifies both raw and aggregated dependency proofs. Aggregation runs the native Lean prover, which takes seconds per
/// proof, off the payload deadline.</remarks>
[ConfigItem(Description = "EIP-8288: where this node aggregates the leanSPHINCS witnesses of its blocks' claims into one recursive proof. `None` produces raw witnesses; `BuilderOnly` aggregates when building a block, once a proof is ready and smaller than the raw witnesses. Received blocks are verified either way.", DefaultValue = "None", HiddenFromDocs = true)]
/// <remarks>Applies only on chains with EIP-8288 scheduled: every node accepts and verifies both raw and aggregated
/// dependency proofs. Aggregation runs the native Lean prover, which takes seconds per proof, off the payload deadline.</remarks>
[ConfigItem(Description = "EIP-8288: where this node aggregates the leanSPHINCS witnesses of EIP-8141 claims into recursive proofs. `None` produces raw witnesses. `Mempool` aggregates pending transactions into proof wrappers exchanged over `eth/76` (EIP-8518) and builds blocks from them. `BuilderOnly`, a development option, aggregates only when building a block. Received blocks are verified either way.", DefaultValue = "None")]
DependencyProofAggregation DependencyProofAggregation { get; set; }

[ConfigItem(Description = "State pre-warming level while processing blocks: `None`, `Block` (warm the block's own transactions), or `BlockAndMempool` (also speculatively warm from the mempool between blocks).", DefaultValue = "BlockAndMempool")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// SPDX-FileCopyrightText: 2026 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

#nullable enable

using System;
using System.Collections.Generic;
using System.Threading;
using Nethermind.Blockchain.Tracing;
using Nethermind.Config;
using Nethermind.Consensus.Processing;
using Nethermind.Consensus.ProofAggregation;
using Nethermind.Core;
using Nethermind.Core.Crypto;
using Nethermind.Core.Specs;
using Nethermind.Core.Test.Builders;
using Nethermind.Evm.State;
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Logging;
using Nethermind.Specs;
using Nethermind.Specs.Forks;
using NSubstitute;
using NUnit.Framework;

namespace Nethermind.Consensus.Test.ProofAggregation;

/// <summary>Building blocks from transactions known only from EIP-8518 proof wrappers.</summary>
public class AggregatedTxProductionTests
{
private static readonly IReleaseSpec Spec = Eip8288Prototype.Instance;

[Test]
public void Production_AggregatedTx_ExtendsTheProofCoveringIt()
{
FakeLeanProofVerifier verifier = new();
DependencyProofCache cache = new(verifier, LimboLogs.Instance);
Transaction aggregated = Covered(cache, verifier, FrameTxTestFrames.LeanSphincsTx(0, true, (TestItem.KeccakA, TestItem.KeccakB)));
Transaction raw = FrameTxTestFrames.LeanSphincsTx(1, false, (TestItem.KeccakC, TestItem.KeccakD));

Block produced = Produce(cache, new AggregatedTxProduction(), deadline: false, aggregated, raw);

using (Assert.EnterMultipleScope())
{
Assert.That(produced.DependencyProof![0], Is.EqualTo(Eip8288Constants.DependencyProofVersionAggregated));
Assert.That(() => FrameTxDependencyProof.AssignWitnesses(Received(produced), Spec, verifier), Throws.Nothing);
}
}

[Test]
public void Production_AggregatedTx_UnderADeadline_FailsTheBuildUntilItsProofIsReady()
{
FakeLeanProofVerifier verifier = new();
DependencyProofCache cache = new(verifier, LimboLogs.Instance);
AggregatedTxProduction production = new();
Transaction aggregated = Covered(cache, verifier, FrameTxTestFrames.LeanSphincsTx(0, true, (TestItem.KeccakA, TestItem.KeccakB)));
Transaction raw = FrameTxTestFrames.LeanSphincsTx(1, false, (TestItem.KeccakC, TestItem.KeccakD));

Assert.That(() => Produce(cache, production, deadline: true, aggregated, raw), Throws.InstanceOf<AggregatedProofNotReadyException>());
Assert.That(production.ExcludeAggregated, Is.True, "the rebuild leaves the aggregated transaction out");
Assert.That(() => !cache.IsScheduled && verifier.ProofCalls > 1, Is.True.After(5000, 10));

Block produced = Produce(cache, production, deadline: true, aggregated, raw);

using (Assert.EnterMultipleScope())
{
Assert.That(production.ExcludeAggregated, Is.False);
Assert.That(produced.DependencyProof![0], Is.EqualTo(Eip8288Constants.DependencyProofVersionAggregated));
}
}

[Test]
public void Production_AggregatedTxNoProofCovers_FailsTheBuild()
{
FakeLeanProofVerifier verifier = new();
DependencyProofCache cache = new(verifier, LimboLogs.Instance);
Transaction aggregated = FrameTxTestFrames.LeanSphincsTx(0, true, (TestItem.KeccakA, TestItem.KeccakB));
aggregated.ClaimWitnesses![0] = FrameTxClaimVerifier.AggregatedWitness;

Assert.That(() => Produce(cache, new AggregatedTxProduction(), deadline: false, aggregated), Throws.InstanceOf<AggregatedProofNotReadyException>());
}

public enum Case { Covered, NotCovered, Excluded, NotMempoolMode, Raw }

[TestCase(Case.Covered, BlockProcessor.TxAction.Add)]
[TestCase(Case.NotCovered, BlockProcessor.TxAction.Skip)]
[TestCase(Case.Excluded, BlockProcessor.TxAction.Skip)]
[TestCase(Case.NotMempoolMode, BlockProcessor.TxAction.Skip)]
[TestCase(Case.Raw, BlockProcessor.TxAction.Add)]
public void Picker_PicksAnAggregatedTxOnlyWhenAProofCoversIt(Case @case, BlockProcessor.TxAction expected)
{
FakeLeanProofVerifier verifier = new();
DependencyProofCache cache = new(verifier, LimboLogs.Instance);
Transaction tx = FrameTxTestFrames.LeanSphincsTx(0, true, (TestItem.KeccakA, TestItem.KeccakB));
if (@case != Case.Raw) tx.ClaimWitnesses![0] = FrameTxClaimVerifier.AggregatedWitness;
if (@case != Case.NotCovered) Covered(cache, verifier, tx);
Block block = Build.A.Block.TestObject;
BlockProcessor.IBlockProductionTransactionPicker inner = Substitute.For<BlockProcessor.IBlockProductionTransactionPicker>();
inner.CanAddTransaction(default!, default!, default!, default!, default, default)
.ReturnsForAnyArgs(new BlockProcessor.AddingTxEventArgs(0, tx, block, []));
AggregatedTxPicker picker = new(inner, new TestSingleReleaseSpecProvider(Spec),
new BlocksConfig { DependencyProofAggregation = @case == Case.NotMempoolMode ? DependencyProofAggregation.BuilderOnly : DependencyProofAggregation.Mempool },
cache, new AggregatedTxProduction { ExcludeAggregated = @case == Case.Excluded });

BlockProcessor.AddingTxEventArgs args = picker.CanAddTransaction(block, tx, new HashSet<Transaction>(), Substitute.For<IReadOnlyStateProvider>(), 0, 0);

Assert.That(args.Action, Is.EqualTo(expected));
}

[Test]
public void GossipPolicy_KeepsAggregatedTransactionsOutOfAnnouncements()
{
Transaction tx = FrameTxTestFrames.LeanSphincsTx(0, true, (TestItem.KeccakA, TestItem.KeccakB));
AggregatedTxGossipPolicy policy = new();
bool raw = policy.ShouldGossipTransaction(tx);
tx.ClaimWitnesses![0] = FrameTxClaimVerifier.AggregatedWitness;

using (Assert.EnterMultipleScope())
{
Assert.That(raw, Is.True);
Assert.That(policy.ShouldGossipTransaction(tx), Is.False);
}
}

/// <summary>Marks <paramref name="tx"/>'s leanSPHINCS witnesses as aggregated and remembers a proof covering them.</summary>
private static Transaction Covered(DependencyProofCache cache, FakeLeanProofVerifier verifier, Transaction tx)
{
List<AggregatedDependency> deps = Eip8288Dependencies.Canonicalize(ProofWrapperCodec.AggregatedDependencies(tx));
ValueHash256 depsHash = Eip8288Dependencies.ComputeDepsHash(deps);
cache.Remember(deps, depsHash, verifier.ProveDependencyProof(depsHash, Eip8288Constants.AggregatedVk, new AggregationInput()));
for (int i = 0; i < tx.FrameClaims!.Length; i++)
{
if (Eip8288Dependencies.IsAggregatable(tx.FrameClaims[i].Verifier)) tx.ClaimWitnesses![i] = FrameTxClaimVerifier.AggregatedWitness;
}

return tx;
}

private static Block Produce(DependencyProofCache cache, AggregatedTxProduction production, bool deadline, params Transaction[] transactions)
{
Block block = Build.A.Block.WithTransactions(transactions).TestObject;
IBlockProcessor inner = Substitute.For<IBlockProcessor>();
inner.ProcessOne(default!, default, default!, default!, default).ReturnsForAnyArgs(call =>
{
Block processed = call.Arg<Block>();
FrameTxDependencyProof.Build(processed);
inner.TransactionsExecuted += Raise.Event<Action<Block>>(processed);
return (processed, Array.Empty<TxReceipt>());
});

AggregatingBlockProcessor processor = new(inner, cache, new BlocksConfig { DependencyProofAggregation = DependencyProofAggregation.Mempool },
LimboLogs.Instance, Substitute.For<BlockProcessor.IBlockProductionTransactionsExecutor>(), production);
using CancellationTokenSource cts = new();
return processor.ProcessOne(block, ProcessingOptions.ProducingBlock, NullBlockTracer.Instance, Spec, deadline ? cts.Token : CancellationToken.None).Block;
}

/// <summary>The block as a validating node receives it, without the producer's witnesses.</summary>
private static Block Received(Block produced)
{
Transaction[] transactions = new Transaction[produced.Transactions.Length];
for (int i = 0; i < transactions.Length; i++)
{
transactions[i] = new Transaction();
produced.Transactions[i].CopyTo(transactions[i]);
transactions[i].ClaimWitnesses = null;
}

Block received = Build.A.Block.WithTransactions(transactions).TestObject;
received.DependencyProof = produced.DependencyProof;
received.Header.DependencyProofHash = produced.Header.DependencyProofHash;
return received;
}
}
Loading
Loading