diff --git a/src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs b/src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs index e58670532ba..b836470a97d 100644 --- a/src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs +++ b/src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs @@ -136,7 +136,7 @@ protected async Task RunTest(BlockchainTest test, Stopwatch? TrieStore trieStore = new(stateDb, _logManager); IWorldState stateProvider = new WorldState(trieStore, codeDb, _logManager); - var worldStateManager = new WorldStateManager(stateProvider, trieStore, dbProvider, null, _logManager); + var worldStateManager = new WorldStateManager(stateProvider, trieStore, dbProvider, _logManager); IBlockTree blockTree = Build.A.BlockTree() .WithSpecProvider(specProvider) .WithoutSettingHead diff --git a/src/Nethermind/Nethermind.AuRa.Test/AuraBlockProcessorTests.cs b/src/Nethermind/Nethermind.AuRa.Test/AuraBlockProcessorTests.cs index f0920243787..3a5a9d9e638 100644 --- a/src/Nethermind/Nethermind.AuRa.Test/AuraBlockProcessorTests.cs +++ b/src/Nethermind/Nethermind.AuRa.Test/AuraBlockProcessorTests.cs @@ -149,7 +149,7 @@ void Process(AuRaBlockProcessor auRaBlockProcessor, int blockNumber, Hash256 sta TrieStore trieStore = new(dbProvider.StateDb, LimboLogs.Instance); IWorldState stateProvider = new WorldState(trieStore, dbProvider.CodeDb, LimboLogs.Instance); var worldStateManager = - new WorldStateManager(stateProvider, trieStore, dbProvider, null, LimboLogs.Instance); + new WorldStateManager(stateProvider, trieStore, dbProvider, LimboLogs.Instance); ITransactionProcessor transactionProcessor = Substitute.For(); AuRaBlockProcessor processor = new AuRaBlockProcessor( HoleskySpecProvider.Instance, diff --git a/src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs index d7405104c82..1a328a28ca4 100644 --- a/src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs +++ b/src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs @@ -41,7 +41,7 @@ public void Prepared_block_contains_author_field() TrieStore trieStore = new(dbProvider.StateDb, LimboLogs.Instance); IWorldState stateProvider = new WorldState(trieStore, dbProvider.CodeDb, LimboLogs.Instance); var worldStateManger = - new WorldStateManager(stateProvider, trieStore, dbProvider, null, LimboLogs.Instance); + new WorldStateManager(stateProvider, trieStore, dbProvider, LimboLogs.Instance); ITransactionProcessor transactionProcessor = Substitute.For(); BlockProcessor processor = new( @@ -72,7 +72,7 @@ public void Recovers_state_on_cancel() TrieStore trieStore = new(dbProvider.StateDb, LimboLogs.Instance); IWorldState stateProvider = new WorldState(trieStore, dbProvider.CodeDb, LimboLogs.Instance); var worldStateManger = - new WorldStateManager(stateProvider, trieStore, dbProvider, null, LimboLogs.Instance); + new WorldStateManager(stateProvider, trieStore, dbProvider, LimboLogs.Instance); ITransactionProcessor transactionProcessor = Substitute.For(); BlockProcessor processor = new( HoleskySpecProvider.Instance, diff --git a/src/Nethermind/Nethermind.Blockchain.Test/BlockhashProviderTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/BlockhashProviderTests.cs index a7136f9d042..772b0d6e09e 100644 --- a/src/Nethermind/Nethermind.Blockchain.Test/BlockhashProviderTests.cs +++ b/src/Nethermind/Nethermind.Blockchain.Test/BlockhashProviderTests.cs @@ -28,7 +28,7 @@ private static IWorldStateManager CreateWorldStateManager() var worldState = new WorldState(trieStore, dbProvider.CodeDb, LimboLogs.Instance); worldState.CreateAccount(Eip2935Constants.BlockHashHistoryAddress, 0, 1); worldState.Commit(Frontier.Instance); - return new WorldStateManager(worldState, trieStore, dbProvider, null, LimboLogs.Instance); + return new WorldStateManager(worldState, trieStore, dbProvider, LimboLogs.Instance); } private static BlockhashProvider CreateBlockHashProvider(IBlockFinder tree, IReleaseSpec spec) diff --git a/src/Nethermind/Nethermind.Blockchain.Test/Producers/DevBlockproducerTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/Producers/DevBlockproducerTests.cs index 6b7f208df46..3e72ec6fd31 100644 --- a/src/Nethermind/Nethermind.Blockchain.Test/Producers/DevBlockproducerTests.cs +++ b/src/Nethermind/Nethermind.Blockchain.Test/Producers/DevBlockproducerTests.cs @@ -57,7 +57,7 @@ public void Test() dbProvider.RegisteredDbs[DbNames.Code], LimboLogs.Instance); var worldStateManager = - new WorldStateManager(stateProvider, trieStore, dbProvider, null, LimboLogs.Instance); + new WorldStateManager(stateProvider, trieStore, dbProvider, LimboLogs.Instance); StateReader stateReader = new(trieStore, dbProvider.GetDb(DbNames.State), LimboLogs.Instance); BlockhashProvider blockhashProvider = new(blockTree, specProvider, worldStateManager, LimboLogs.Instance); CodeInfoRepository codeInfoRepository = new(); diff --git a/src/Nethermind/Nethermind.Blockchain.Test/ReorgTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/ReorgTests.cs index cf52d0ee0ee..7be79d116dc 100644 --- a/src/Nethermind/Nethermind.Blockchain.Test/ReorgTests.cs +++ b/src/Nethermind/Nethermind.Blockchain.Test/ReorgTests.cs @@ -39,7 +39,7 @@ public void Setup() WorldState stateProvider = new(trieStore, memDbProvider.CodeDb, LimboLogs.Instance); StateReader stateReader = new(trieStore, memDbProvider.CodeDb, LimboLogs.Instance); var worldStateManager = - new WorldStateManager(stateProvider, trieStore, memDbProvider, null, LimboLogs.Instance); + new WorldStateManager(stateProvider, trieStore, memDbProvider, LimboLogs.Instance); ISpecProvider specProvider = MainnetSpecProvider.Instance; EthereumEcdsa ecdsa = new(1); ITransactionComparerProvider transactionComparerProvider = diff --git a/src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs b/src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs index 07cd0a61715..252bbdb1752 100644 --- a/src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs +++ b/src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs @@ -96,7 +96,7 @@ public On CreateNode(PrivateKey privateKey, bool withGenesisAlreadyProcessed = f stateProvider.Commit(goerliSpecProvider.GenesisSpec); stateProvider.CommitTree(0); var worldStateManager = - new WorldStateManager(stateProvider, trieStore, dbProvider, null, LimboLogs.Instance); + new WorldStateManager(stateProvider, trieStore, dbProvider, LimboLogs.Instance); BlockTree blockTree = Build.A.BlockTree() .WithSpecProvider(goerliSpecProvider) @@ -149,7 +149,7 @@ public On CreateNode(PrivateKey privateKey, bool withGenesisAlreadyProcessed = f IReadOnlyTrieStore minerTrieStore = trieStore.AsReadOnly(); WorldState minerStateProvider = new(minerTrieStore, dbProvider.CodeDb, nodeLogManager); - var minerWorldStateManager = new WorldStateManager(minerStateProvider, minerTrieStore, dbProvider, null, + var minerWorldStateManager = new WorldStateManager(minerStateProvider, minerTrieStore, dbProvider, LimboLogs.Instance); VirtualMachine minerVirtualMachine = new(blockhashProvider, specProvider, codeInfoRepository, nodeLogManager); TransactionProcessor minerTransactionProcessor = new(goerliSpecProvider, minerVirtualMachine, codeInfoRepository, nodeLogManager); diff --git a/src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs b/src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs index 5ac3b17cecd..92e2bf93c20 100644 --- a/src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs +++ b/src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs @@ -159,7 +159,7 @@ protected virtual async Task Build(ISpecProvider? specProvider = State.CommitTree(0); ReadOnlyTrieStore = TrieStore.AsReadOnly(new NodeStorage(StateDb)); - WorldStateManager = new WorldStateManager(State, TrieStore, DbProvider, null, LimboLogs.Instance); + WorldStateManager = new WorldStateManager(State, TrieStore, DbProvider, LimboLogs.Instance); StateReader = new StateReader(ReadOnlyTrieStore, CodeDb, LogManager); ChainLevelInfoRepository = new ChainLevelInfoRepository(this.DbProvider.BlockInfosDb); diff --git a/src/Nethermind/Nethermind.Facade.Test/BlockchainBridgeTests.cs b/src/Nethermind/Nethermind.Facade.Test/BlockchainBridgeTests.cs index 3300af91808..e96596b5e3c 100644 --- a/src/Nethermind/Nethermind.Facade.Test/BlockchainBridgeTests.cs +++ b/src/Nethermind/Nethermind.Facade.Test/BlockchainBridgeTests.cs @@ -80,7 +80,7 @@ public async Task SetUp() IReadOnlyTrieStore trieStore = new TrieStore(_dbProvider.StateDb, LimboLogs.Instance).AsReadOnly(); IWorldStateManager readOnlyWorldStateManager = - new ReadOnlyWorldStateManager(dbProvider, trieStore, null, LimboLogs.Instance); + new ReadOnlyWorldStateManager(dbProvider, trieStore, LimboLogs.Instance); IReadOnlyBlockTree readOnlyBlockTree = _blockTree.AsReadOnly(); ReadOnlyTxProcessingEnv processingEnv = new TestReadOnlyTxProcessingEnv( @@ -221,7 +221,7 @@ public void Bridge_head_is_correct(long headNumber) IReadOnlyTrieStore trieStore = new TrieStore(_dbProvider.StateDb, LimboLogs.Instance).AsReadOnly(); IWorldStateManager readOnlyWorldStateManager = - new ReadOnlyWorldStateManager(dbProvider, trieStore, null, LimboLogs.Instance); + new ReadOnlyWorldStateManager(dbProvider, trieStore, LimboLogs.Instance); IReadOnlyBlockTree roBlockTree = _blockTree.AsReadOnly(); ReadOnlyTxProcessingEnv processingEnv = new( readOnlyWorldStateManager, diff --git a/src/Nethermind/Nethermind.Init/InitializeStateDb.cs b/src/Nethermind/Nethermind.Init/InitializeStateDb.cs index 5ce04e9ae87..cb2caa60cfc 100644 --- a/src/Nethermind/Nethermind.Init/InitializeStateDb.cs +++ b/src/Nethermind/Nethermind.Init/InitializeStateDb.cs @@ -165,8 +165,7 @@ public Task Execute(CancellationToken cancellationToken) worldState, trieStore, getApi.DbProvider, - preBlockCaches, - getApi.LogManager); + getApi.LogManager, preBlockCaches); // TODO: Don't forget this TrieStoreBoundaryWatcher trieStoreBoundaryWatcher = new(stateManager, _api.BlockTree!, _api.LogManager); diff --git a/src/Nethermind/Nethermind.JsonRpc.Test/Modules/Proof/ProofRpcModuleTests.cs b/src/Nethermind/Nethermind.JsonRpc.Test/Modules/Proof/ProofRpcModuleTests.cs index 7e0122527aa..7f74b75145a 100644 --- a/src/Nethermind/Nethermind.JsonRpc.Test/Modules/Proof/ProofRpcModuleTests.cs +++ b/src/Nethermind/Nethermind.JsonRpc.Test/Modules/Proof/ProofRpcModuleTests.cs @@ -72,7 +72,7 @@ public async Task Setup() .OfChainLength(10) .TestObject; - _worldStateManager = new WorldStateManager(worldState, trieStore, _dbProvider, null, LimboLogs.Instance); + _worldStateManager = new WorldStateManager(worldState, trieStore, _dbProvider, LimboLogs.Instance); ProofModuleFactory moduleFactory = new( _worldStateManager, _blockTree, diff --git a/src/Nethermind/Nethermind.JsonRpc.Test/Modules/Trace/ParityStyleTracerTests.cs b/src/Nethermind/Nethermind.JsonRpc.Test/Modules/Trace/ParityStyleTracerTests.cs index 9521e514ff4..64cfc8da9c9 100644 --- a/src/Nethermind/Nethermind.JsonRpc.Test/Modules/Trace/ParityStyleTracerTests.cs +++ b/src/Nethermind/Nethermind.JsonRpc.Test/Modules/Trace/ParityStyleTracerTests.cs @@ -64,7 +64,7 @@ public async Task Setup() _stateReader = new StateReader(trieStore, _dbProvider.CodeDb, LimboLogs.Instance); var worldStateManager = - new WorldStateManager(stateProvider, trieStore, _dbProvider, null, LimboLogs.Instance); + new WorldStateManager(stateProvider, trieStore, _dbProvider, LimboLogs.Instance); BlockhashProvider blockhashProvider = new(_blockTree, specProvider, worldStateManager, LimboLogs.Instance); CodeInfoRepository codeInfoRepository = new(); diff --git a/src/Nethermind/Nethermind.Runner.Test/Ethereum/ContextWithMocks.cs b/src/Nethermind/Nethermind.Runner.Test/Ethereum/ContextWithMocks.cs index f2f9f46556a..b1b7fa87b58 100644 --- a/src/Nethermind/Nethermind.Runner.Test/Ethereum/ContextWithMocks.cs +++ b/src/Nethermind/Nethermind.Runner.Test/Ethereum/ContextWithMocks.cs @@ -121,7 +121,7 @@ public static NethermindApi ContextWithMocks() BadBlocksStore = Substitute.For() }; - api.WorldStateManager = new ReadOnlyWorldStateManager(api.DbProvider, Substitute.For(), null, LimboLogs.Instance); + api.WorldStateManager = new ReadOnlyWorldStateManager(api.DbProvider, Substitute.For(), LimboLogs.Instance); api.NodeStorageFactory = new NodeStorageFactory(INodeStorage.KeyScheme.HalfPath, LimboLogs.Instance); return api; } diff --git a/src/Nethermind/Nethermind.State.Test/WorldStateManagerTests.cs b/src/Nethermind/Nethermind.State.Test/WorldStateManagerTests.cs index aa223696c15..ca16567e1e7 100644 --- a/src/Nethermind/Nethermind.State.Test/WorldStateManagerTests.cs +++ b/src/Nethermind/Nethermind.State.Test/WorldStateManagerTests.cs @@ -23,7 +23,7 @@ public void ShouldProxyGlobalWorldState() IWorldState worldState = Substitute.For(); ITrieStore trieStore = Substitute.For(); IDbProvider dbProvider = TestMemDbProvider.Init(); - WorldStateManager worldStateManager = new WorldStateManager(worldState, trieStore, dbProvider, null, LimboLogs.Instance); + WorldStateManager worldStateManager = new WorldStateManager(worldState, trieStore, dbProvider, LimboLogs.Instance); worldStateManager.GlobalWorldState.Should().Be(worldState); } @@ -34,7 +34,7 @@ public void ShouldProxyReorgBoundaryEvent() IWorldState worldState = Substitute.For(); ITrieStore trieStore = Substitute.For(); IDbProvider dbProvider = TestMemDbProvider.Init(); - WorldStateManager worldStateManager = new WorldStateManager(worldState, trieStore, dbProvider, null, LimboLogs.Instance); + WorldStateManager worldStateManager = new WorldStateManager(worldState, trieStore, dbProvider, LimboLogs.Instance); bool gotEvent = false; worldStateManager.ReorgBoundaryReached += (sender, reached) => gotEvent = true; diff --git a/src/Nethermind/Nethermind.State/OverlayWorldStateManager.cs b/src/Nethermind/Nethermind.State/OverlayWorldStateManager.cs index 50b5266c0c2..9be01584257 100644 --- a/src/Nethermind/Nethermind.State/OverlayWorldStateManager.cs +++ b/src/Nethermind/Nethermind.State/OverlayWorldStateManager.cs @@ -14,10 +14,11 @@ namespace Nethermind.State; public class OverlayWorldStateManager( IReadOnlyDbProvider dbProvider, OverlayTrieStore overlayTrieStore, - ILogManager? logManager) + ILogManager? logManager, + PreBlockCaches? caches = null) : IWorldStateManager { - public PreBlockCaches Caches { get; } + public PreBlockCaches? Caches { get; } = caches; private readonly IDb _codeDb = dbProvider.GetDb(DbNames.Code); diff --git a/src/Nethermind/Nethermind.State/ReadOnlyWorldStateManager.cs b/src/Nethermind/Nethermind.State/ReadOnlyWorldStateManager.cs index 0a02ad55634..763b739406e 100644 --- a/src/Nethermind/Nethermind.State/ReadOnlyWorldStateManager.cs +++ b/src/Nethermind/Nethermind.State/ReadOnlyWorldStateManager.cs @@ -22,12 +22,10 @@ public class ReadOnlyWorldStateManager : IWorldStateManager public PreBlockCaches? Caches { get; } - public ReadOnlyWorldStateManager( - IDbProvider dbProvider, + public ReadOnlyWorldStateManager(IDbProvider dbProvider, IReadOnlyTrieStore readOnlyTrieStore, - PreBlockCaches? preBlockCaches, - ILogManager logManager - ) + ILogManager logManager, + PreBlockCaches? preBlockCaches = null) { _readOnlyTrieStore = readOnlyTrieStore; _logManager = logManager; diff --git a/src/Nethermind/Nethermind.State/WorldStateManager.cs b/src/Nethermind/Nethermind.State/WorldStateManager.cs index 701f5e85f55..fcd81e3921a 100644 --- a/src/Nethermind/Nethermind.State/WorldStateManager.cs +++ b/src/Nethermind/Nethermind.State/WorldStateManager.cs @@ -13,9 +13,9 @@ public class WorldStateManager( IWorldState worldState, ITrieStore trieStore, IDbProvider dbProvider, - PreBlockCaches? preBlockCaches, - ILogManager logManager) - : ReadOnlyWorldStateManager(dbProvider, trieStore.AsReadOnly(), preBlockCaches, logManager) + ILogManager logManager, + PreBlockCaches? preBlockCaches = null) + : ReadOnlyWorldStateManager(dbProvider, trieStore.AsReadOnly(), logManager, preBlockCaches) { public override IWorldState GlobalWorldState => worldState; diff --git a/src/Nethermind/Nethermind.Synchronization.Test/SyncThreadTests.cs b/src/Nethermind/Nethermind.Synchronization.Test/SyncThreadTests.cs index d141f574c57..a728c6e1d7b 100644 --- a/src/Nethermind/Nethermind.Synchronization.Test/SyncThreadTests.cs +++ b/src/Nethermind/Nethermind.Synchronization.Test/SyncThreadTests.cs @@ -261,7 +261,7 @@ private SyncTestContext CreateSyncManager(int index) stateProvider.CommitTree(0); stateProvider.RecalculateStateRoot(); var worldStateManager = - new WorldStateManager(stateProvider, trieStore, dbProvider, null, LimboLogs.Instance); + new WorldStateManager(stateProvider, trieStore, dbProvider, LimboLogs.Instance); InMemoryReceiptStorage receiptStorage = new(); @@ -315,7 +315,7 @@ private SyncTestContext CreateSyncManager(int index) SyncPeerPool syncPeerPool = new(tree, nodeStatsManager, new TotalDifficultyBetterPeerStrategy(LimboLogs.Instance), logManager, 25); WorldState devState = new(trieStore, codeDb, logManager); - var devWorldStateManager = new WorldStateManager(devState, trieStore, dbProvider, null, LimboLogs.Instance); + var devWorldStateManager = new WorldStateManager(devState, trieStore, dbProvider, LimboLogs.Instance); VirtualMachine devEvm = new(blockhashProvider, specProvider, codeInfoRepository, logManager); TransactionProcessor devTxProcessor = new(specProvider, devEvm, codeInfoRepository, logManager);