Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
af82c8e
Add eth_capabilities RPC method and related data structures
divi2806 Apr 30, 2026
ed261ee
Enhance eth_capabilities method to handle pruning modes and improve s…
divi2806 Apr 30, 2026
186b453
Merge branch 'master' into feature/11260-eth-capabilities-support
divi2806 Apr 30, 2026
8823583
Add EthCapabilitiesProvider class and refactor eth_capabilities method
divi2806 May 1, 2026
0fb6d79
Refactor EthCapabilitiesResult and EthCapabilitiesProvider to use lon…
divi2806 May 1, 2026
d0c59ac
Merge branch 'master' into feature/11260-eth-capabilities-support
divi2806 May 1, 2026
6fdf14e
refactor: constructor-based capability records and dedup capability t…
LukaszRozmej May 1, 2026
aef7382
refactor: introduce IEthCapabilitiesProvider, register via DI, rename…
LukaszRozmej May 2, 2026
3eaa9ea
Merge branch 'master' into feature/11260-eth-capabilities-support
divi2806 May 2, 2026
8939c6a
feat(eth_capabilities): account for history pruning; alias Tx/Logs to…
LukaszRozmej May 2, 2026
5e598c3
fix(eth_capabilities): align with spec — integer retentionBlocks; sha…
LukaszRozmej May 2, 2026
4adbf57
fix: regenerate packages.lock.json after JsonRpc->History reference
LukaszRozmej May 2, 2026
50bc388
refactor(eth_capabilities): wire state availability through IWorldSta…
LukaszRozmej May 4, 2026
6d3dd2e
fix(eth_capabilities): support state proofs within trie pruning window
LukaszRozmej May 4, 2026
a9fea0a
refactor(eth_capabilities): drop StateProofsSupported; flat supports …
LukaszRozmej May 4, 2026
96bf7c3
feat(eth_capabilities): persist OldestStateBlock metadata
LukaszRozmej May 4, 2026
2e85b8d
refactor(eth_capabilities): inline StateAvailability as GetOldestStat…
LukaszRozmej May 4, 2026
801b3e7
Merge remote-tracking branch 'ghhttps/master' into pr-11438
LukaszRozmej May 6, 2026
aea412d
fix: regenerate packages.lock.json with Nethermind.History reference
LukaszRozmej May 6, 2026
0dd5edb
Merge remote-tracking branch 'ghhttps/master' into pr-11438
LukaszRozmej May 9, 2026
0e54767
fix(eth_capabilities): use raw barriers; honor body availability; han…
LukaszRozmej May 9, 2026
2fa4434
fix(eth_capabilities): use a valid 64-char hash in ExampleResponse
LukaszRozmej May 9, 2026
916037a
fix(eth_capabilities): gate body/receipt download flags on fast-sync …
LukaszRozmej May 9, 2026
dd4dc74
docs(eth_capabilities): note window-vs-floor selection rationale
LukaszRozmej May 10, 2026
8a05579
fix(eth_capabilities): track actual sync progress mid-sync
LukaszRozmej May 10, 2026
6c38e79
refactor(eth_capabilities): apply review fixes
LukaszRozmej May 10, 2026
2f5a99d
Merge remote-tracking branch 'origin/master' into feature/11260-eth-c…
LukaszRozmej May 12, 2026
ac03884
refactor(eth_capabilities): address review feedback from asdacap & st…
LukaszRozmej May 12, 2026
1bb0bcb
refactor(eth_capabilities): own OldestStateBlock persistence in World…
LukaszRozmej May 12, 2026
4106a1e
fix(eth_capabilities): alias stateproofs to state again
LukaszRozmej May 12, 2026
b499b2d
feat(eth_capabilities): discard stale state-availability markers at s…
LukaszRozmej May 12, 2026
cfd6015
test(state-metadata): cover stale-floor discard at startup
LukaszRozmej May 12, 2026
b9f1947
fix(eth_capabilities): delete metadata key when OldestStateBlock is c…
LukaszRozmej May 12, 2026
8e57996
Merge branch 'master' into feature/11260-eth-capabilities-support
LukaszRozmej May 12, 2026
675346c
fix(eth_capabilities): guard descending-pointer pre-insert state and …
LukaszRozmej May 12, 2026
68c0b45
Merge remote-tracking branch 'origin/master' into fix/pr-11438-review
LukaszRozmej May 13, 2026
fabd507
refactor(eth_capabilities): narrow OldestStateBlockStore deps, dedup …
LukaszRozmej May 13, 2026
c59137f
refactor(eth_capabilities): IStateBoundary on IWorldStateManager; per…
LukaszRozmej May 15, 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 @@ -244,6 +244,7 @@ public TestContext(
FullPruningCompletionBehavior = completionBehavior
},
BlockTree,
Substitute.For<IStateBoundary>(),
StateReader,
ProcessExitSource,
_chainEstimations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ protected override async Task<TestBlockchain> Build(Action<ContainerBuilder>? co
PruningTrigger,
PruningConfig,
BlockTree,
Container.Resolve<IWorldStateManager>(),
StateReader,
ProcessExitSource,
DriveInfo,
Expand Down Expand Up @@ -115,14 +116,15 @@ public class FullTestPruner(
IPruningTrigger pruningTrigger,
IPruningConfig pruningConfig,
IBlockTree blockTree,
IStateBoundary stateBoundary,
IStateReader stateReader,
IProcessExitSource processExitSource,
IDriveInfo driveInfo,
IPruningTrieStore trieStore,
IChainEstimations chainEstimations,
ILogManager logManager)
: FullPruner(pruningDb, nodeStorageFactory, mainNodeStorage, pruningTrigger, pruningConfig, blockTree,
stateReader, processExitSource, chainEstimations, driveInfo, trieStore, logManager)
stateBoundary, stateReader, processExitSource, chainEstimations, driveInfo, trieStore, logManager)
{
public EventWaitHandle WaitHandle { get; } = new ManualResetEvent(false);

Expand Down
14 changes: 11 additions & 3 deletions src/Nethermind/Nethermind.Blockchain/FullPruning/FullPruner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class FullPruner : IDisposable
private readonly IPruningTrigger _pruningTrigger;
private readonly IPruningConfig _pruningConfig;
private readonly IBlockTree _blockTree;
private readonly IStateBoundary _stateBoundary;
private readonly IStateReader _stateReader;
private readonly IProcessExitSource _processExitSource;
private readonly ILogManager _logManager;
Expand All @@ -46,6 +47,7 @@ public FullPruner(
IPruningTrigger pruningTrigger,
IPruningConfig pruningConfig,
IBlockTree blockTree,
IStateBoundary stateBoundary,
IStateReader stateReader,
IProcessExitSource processExitSource,
IChainEstimations chainEstimations,
Expand All @@ -59,6 +61,7 @@ public FullPruner(
_pruningTrigger = pruningTrigger;
_pruningConfig = pruningConfig;
_blockTree = blockTree;
_stateBoundary = stateBoundary;
_stateReader = stateReader;
_processExitSource = processExitSource;
_logManager = logManager;
Expand Down Expand Up @@ -178,7 +181,10 @@ await WaitForMainChainChange((e) =>
}

if (_logger.IsInfo) _logger.Info($"Full Pruning Ready to start: pruning garbage before state {stateToCopy} with root {header.StateRoot}");
await CopyTrie(pruningContext, header, cancellationToken);
if (CopyTrie(pruningContext, header, cancellationToken))
{
_stateBoundary.OldestStateBlock = stateToCopy;
}
}

private bool CanStartNewPruning() => _fullPruningDb.CanStartPruning;
Expand Down Expand Up @@ -218,10 +224,11 @@ private void HandlePruningFinished(object? sender, PruningEventArgs e)
}
}

private Task CopyTrie(IPruningContext pruning, BlockHeader? baseBlock, CancellationToken cancellationToken)
private bool CopyTrie(IPruningContext pruning, BlockHeader? baseBlock, CancellationToken cancellationToken)
{
INodeStorage.KeyScheme originalKeyScheme = _nodeStorage.Scheme;
ICopyTreeVisitor visitor = null;
bool committed = false;

try
{
Expand Down Expand Up @@ -277,6 +284,7 @@ private Task CopyTrie(IPruningContext pruning, BlockHeader? baseBlock, Cancellat

_nodeStorage.Scheme = targetNodeStorage.Scheme;
_lastPruning = DateTime.UtcNow;
committed = true;
}
}
catch (Exception e)
Expand All @@ -290,7 +298,7 @@ private Task CopyTrie(IPruningContext pruning, BlockHeader? baseBlock, Cancellat
visitor?.Dispose();
}

return Task.CompletedTask;
return committed;
}

private ICopyTreeVisitor CopyTree<TContext>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace Nethermind.Blockchain.FullPruning;

public interface IFullPrunerFactory
{
FullPruner? Create(IStateReader stateReader, IPruningTrieStore trieStore);
FullPruner? Create(IWorldStateManager worldStateManager, IPruningTrieStore trieStore);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public long? BestPersistedState
set => _wrapped.BestPersistedState = value;
}


public BlockHeader? LowestInsertedBeaconHeader
{
get => _wrapped.LowestInsertedBeaconHeader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ public static WorldStateManager CreateWorldStateManagerForTest(IDbProvider dbPro
finalizedStateProvider.TrieStore = trieStore;
TrieStoreScopeProvider worldState = new(trieStore, dbProvider.CodeDb, logManager);

return new WorldStateManager(worldState, trieStore, dbProvider, logManager);
return new WorldStateManager(worldState, trieStore, dbProvider, logManager, pruningConfig);
}
}
2 changes: 2 additions & 0 deletions src/Nethermind/Nethermind.History/HistoryPruner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class HistoryPruner : IHistoryPruner
private const int LockWaitTimeoutMs = 100;
private const int SlotsPerEpoch = 32;

public long GetRetentionBlocks(long retentionEpochs) => retentionEpochs * SlotsPerEpoch;

// only one pruning and one searching thread at a time
private readonly object _pruneLock = new();
private readonly object _searchLock = new();
Expand Down
6 changes: 6 additions & 0 deletions src/Nethermind/Nethermind.History/IHistoryPruner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ public interface IHistoryPruner
event EventHandler<OnNewOldestBlockArgs> NewOldestBlock;

void SchedulePruneHistory();

/// <summary>
/// Converts a retention window expressed in epochs to a block count using this pruner's
/// slots-per-epoch constant. Keeps the epoch→blocks conversion co-located with the pruner.
/// </summary>
long GetRetentionBlocks(long retentionEpochs);
}
5 changes: 3 additions & 2 deletions src/Nethermind/Nethermind.Init/FullPrunerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ILogManager logManager
{
private readonly ILogger _logger = logManager.GetClassLogger<FullPrunerFactory>();

public FullPruner? Create(IStateReader stateReader, IPruningTrieStore trieStore)
public FullPruner? Create(IWorldStateManager worldStateManager, IPruningTrieStore trieStore)
{
IDb stateDb = dbProvider.StateDb;

Expand All @@ -60,7 +60,8 @@ ILogManager logManager
compositePruningTrigger,
pruningConfig,
blockTree,
stateReader,
worldStateManager,
worldStateManager.GlobalStateReader,
processExit,
ChainSizes.CreateChainSizeInfo(chainSpec.ChainId),
drive,
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.Init/Modules/RpcModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ protected override void Load(ContainerBuilder builder)
.AddSingleton<IBlockchainBridgeFactory, BlockchainBridgeFactory>()
.AddScoped<IBlockchainBridge>((ctx) => ctx.Resolve<IBlockchainBridgeFactory>().CreateBlockchainBridge())
.AddSingleton<IFeeHistoryOracle, FeeHistoryOracle>()
.AddSingleton<IEthCapabilitiesProvider, EthCapabilitiesProvider>()
.AddSingleton<FilterStore, ITimerFactory, IJsonRpcConfig>((timerFactory, rpcConfig) => new FilterStore(timerFactory, rpcConfig.FiltersTimeout))
.AddSingleton<FilterManager>()
.AddSingleton<IWitnessGeneratingBlockProcessingEnvFactory, WitnessGeneratingBlockProcessingEnvFactory>()
Expand Down
4 changes: 3 additions & 1 deletion src/Nethermind/Nethermind.Init/PruningTrieStateFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace Nethermind.Init;

public class PruningTrieStateFactory(
ISyncConfig syncConfig,
IPruningConfig pruningConfig,
IDbProvider dbProvider,
IBlockTree blockTree,
MainPruningTrieStoreFactory mainPruningTrieStoreFactory,
Expand Down Expand Up @@ -71,6 +72,7 @@ public class PruningTrieStateFactory(
trieStore,
dbProvider,
logManager,
pruningConfig,
new LastNStateRootTracker(blockTree, syncConfig.SnapServingMaxDepth));

// NOTE: Don't forget this! Very important!
Expand All @@ -80,7 +82,7 @@ public class PruningTrieStateFactory(

disposeStack.Push(mainWorldTrieStore);

FullPruner? fullPruner = fullPrunerFactory.Create(stateManager.GlobalStateReader, trieStore);
FullPruner? fullPruner = fullPrunerFactory.Create(stateManager, trieStore);
if (fullPruner is not null)
{
disposeStack.Push(fullPruner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
using Nethermind.Blockchain;
using Nethermind.Blockchain.Find;
using Nethermind.Blockchain.Receipts;
using Nethermind.Blockchain.Synchronization;
using Nethermind.Blockchain.Tracing;
using Nethermind.History;
using Nethermind.Synchronization;
using NSubstitute;
using Nethermind.Consensus.Processing;
using Nethermind.Core;
using Nethermind.Core.Extensions;
Expand Down Expand Up @@ -86,7 +90,14 @@ public void GlobalSetup()
_container.Resolve<IForkInfo>(),
new LogIndexConfig(),
new BlocksConfig().SecondsPerSlot,
_headBlockSignal);
_headBlockSignal,
new EthCapabilitiesProvider(
blockTree.AsReadOnly(),
_container.Resolve<IWorldStateManager>(),
_container.Resolve<ISyncConfig>(),
Substitute.For<ISyncPointers>(),
Substitute.For<IHistoryConfig>(),
Substitute.For<IHistoryPruner>()));
}

[GlobalCleanup]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
// SPDX-License-Identifier: LGPL-3.0-only

using System.Threading.Tasks;
using Nethermind.Blockchain;
using Nethermind.Blockchain.Receipts;
using Nethermind.Blockchain.Synchronization;
using Nethermind.Config;
using Nethermind.Core.Specs;
using Nethermind.Core.Test.Builders;
using Nethermind.Db.LogIndex;
using Nethermind.History;
using Nethermind.JsonRpc.Modules;
using Nethermind.JsonRpc.Modules.Eth;
using Nethermind.Logging;
Expand All @@ -17,6 +20,7 @@
using Nethermind.JsonRpc.Modules.Eth.GasPrice;
using Nethermind.Network;
using Nethermind.State;
using Nethermind.Synchronization;
using Nethermind.TxPool;
using Nethermind.Wallet;
using NSubstitute;
Expand Down Expand Up @@ -58,7 +62,14 @@ public Task Initialize()
Substitute.For<IProtocolsManager>(),
new BlocksConfig(),
Substitute.For<IForkInfo>(),
Substitute.For<ILogIndexConfig>()),
Substitute.For<ILogIndexConfig>(),
new EthCapabilitiesProvider(
blockTree.AsReadOnly(),
Substitute.For<IStateBoundary>(),
new SyncConfig(),
Substitute.For<ISyncPointers>(),
Substitute.For<IHistoryConfig>(),
Substitute.For<IHistoryPruner>())),
1, 1000);

return Task.CompletedTask;
Expand Down
Loading