Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -17,6 +17,8 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.All)]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class BeaconBlockRootHandlerTests
{
private BeaconBlockRootHandler _beaconBlockRootHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.All)]
public class BlockFinderExtensionsTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.All)]
public class BlockProcessorTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.All)]
public class BlockTreeSuggestPacerTests
{
[Test]
Expand Down
2 changes: 2 additions & 0 deletions src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.All)]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class BlockTreeTests
{
private TestMemDb _blocksInfosDb = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.Self)]
[Parallelizable(ParallelScope.All)]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class BlockchainProcessorTests
{
private class ProcessingTestContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace Nethermind.Blockchain.Test.Blocks;

[Parallelizable(ParallelScope.All)]
public class BadBlockStoreTests
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace Nethermind.Blockchain.Test.Blocks;

[Parallelizable(ParallelScope.All)]
public class BlockStoreTests
{
private readonly Func<EquivalencyAssertionOptions<Block>, EquivalencyAssertionOptions<Block>> _ignoreEncodedSize = options => options.Excluding(b => b.EncodedSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

namespace Nethermind.Blockchain.Test.Blocks;

[Parallelizable(ParallelScope.All)]
public class HeaderStoreTests
{

[Test]
public void TestCanStoreAndGetHeader()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
namespace Nethermind.Blockchain.Test;

[TestFixture]
[Parallelizable(ParallelScope.All)]
public class CachedCodeInfoRepositoryTests
{
private static IReleaseSpec CreateSpecWithPrecompile(Address precompileAddress)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.All)]
public class ChainHeadReadOnlyStateProviderTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
namespace Nethermind.Blockchain.Test.Consensus
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class ClefSignerTests
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace Nethermind.Blockchain.Test.Consensus;

[Parallelizable(ParallelScope.All)]
public class CompositeTxSourceTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Nethermind.Blockchain.Test.Consensus
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class NethDevSealEngineTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Nethermind.Blockchain.Test.Consensus
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class NullSealEngineTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Nethermind.Blockchain.Test.Consensus
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class NullSignerTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Nethermind.Blockchain.Test.Consensus
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class OneByOneTxSourceTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Nethermind.Blockchain.Test.Consensus
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class SealEngineExceptionTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
namespace Nethermind.Blockchain.Test.Consensus
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class SignerTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Nethermind.Blockchain.Test.Consensus
{
[Parallelizable(ParallelScope.All)]
public class SinglePendingTxSelectorTests
{
private readonly BlockHeader _anyParent = Build.A.BlockHeader.TestObject;
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.Blockchain.Test/DaoDataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.All)]
public class DaoDataTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace Nethermind.Blockchain.Test.Data
{
[Parallelizable(ParallelScope.All)]
public class FileLocalDataSourceTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Nethermind.Blockchain.Test;

[Parallelizable(ParallelScope.All)]
public class ExitOnBlocknumberHandlerTests
{
[TestCase(10, false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Nethermind.Blockchain.Test.Filters;

[TestFixture]
[Parallelizable(ParallelScope.All)]
public class AddressFilterTests
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

namespace Nethermind.Blockchain.Test.Filters;

[Parallelizable(ParallelScope.All)]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class FilterStoreTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down Expand Up @@ -152,6 +154,7 @@ public void Correctly_creates_topics_filter(Hash256[]?[]? topics, TopicsFilter e
}

[Test, MaxTime(Timeout.MaxTestTime)]
[Parallelizable(ParallelScope.None)]
public async Task CleanUps_filters()
{
List<int> removedFilterIds = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Nethermind.Blockchain.Test.Filters;

[Parallelizable(ParallelScope.All)]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class LogFilterTests
{
private int _filterCounter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

namespace Nethermind.Blockchain.Test.Find;

[Parallelizable(ParallelScope.All)]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class LogFinderTests
{
private IBlockTree _blockTree = null!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,11 @@

namespace Nethermind.Blockchain.Test.FullPruning;

[Parallelizable(ParallelScope.Self)]
[Parallelizable(ParallelScope.All)]
[TestFixture(INodeStorage.KeyScheme.HalfPath)]
[TestFixture(INodeStorage.KeyScheme.Hash)]
public class CopyTreeVisitorTests
public class CopyTreeVisitorTests(INodeStorage.KeyScheme scheme)
{
private readonly INodeStorage.KeyScheme _keyScheme;

public CopyTreeVisitorTests(INodeStorage.KeyScheme scheme)
{
_keyScheme = scheme;
}

[TestCase(0, 1)]
[TestCase(0, 8)]
[TestCase(1, 1)]
Expand Down Expand Up @@ -83,7 +76,7 @@ public void cancel_coping_state_between_dbs()
private IPruningContext CopyDb(IPruningContext pruningContext, CancellationToken cancellationToken, MemDb trieDb, VisitingOptions? visitingOptions = null, WriteFlags writeFlags = WriteFlags.None)
{
LimboLogs logManager = LimboLogs.Instance;
PatriciaTree trie = Build.A.Trie(new NodeStorage(trieDb, _keyScheme)).WithAccountsByIndex(0, 100).TestObject;
PatriciaTree trie = Build.A.Trie(new NodeStorage(trieDb, scheme)).WithAccountsByIndex(0, 100).TestObject;

// Create a custom DbProvider that uses the trieDb from the test
IDbProvider dbProvider = Substitute.For<IDbProvider>();
Expand All @@ -94,16 +87,16 @@ private IPruningContext CopyDb(IPruningContext pruningContext, CancellationToken
(IWorldState worldState, IStateReader stateReader) = TestWorldStateFactory.CreateForTestWithStateReader(dbProvider, logManager);

BlockHeader? baseBlock = Build.A.BlockHeader.WithStateRoot(trie.RootHash).TestObject;
if (_keyScheme == INodeStorage.KeyScheme.Hash)
if (scheme == INodeStorage.KeyScheme.Hash)
{
NodeStorage nodeStorage = new NodeStorage(pruningContext, _keyScheme);
NodeStorage nodeStorage = new NodeStorage(pruningContext, scheme);
using CopyTreeVisitor<NoopTreePathContextWithStorage> copyTreeVisitor = new(nodeStorage, writeFlags, logManager, cancellationToken);
stateReader.RunTreeVisitor(copyTreeVisitor, baseBlock, visitingOptions);
copyTreeVisitor.Finish();
}
else
{
NodeStorage nodeStorage = new NodeStorage(pruningContext, _keyScheme);
NodeStorage nodeStorage = new NodeStorage(pruningContext, scheme);
using CopyTreeVisitor<TreePathContextWithStorage> copyTreeVisitor = new(nodeStorage, writeFlags, logManager, cancellationToken);
stateReader.RunTreeVisitor(copyTreeVisitor, baseBlock, visitingOptions);
copyTreeVisitor.Finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,10 @@ namespace Nethermind.Blockchain.Test.FullPruning;
[TestFixture(0, 4)]
[TestFixture(1, 1)]
[TestFixture(1, 4)]
[Parallelizable(ParallelScope.Children)]
public class FullPrunerTests
[Parallelizable(ParallelScope.All)]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class FullPrunerTests(int fullPrunerMemoryBudgetMb, int degreeOfParallelism)
{
private readonly int _fullPrunerMemoryBudgetMb;
private readonly int _degreeOfParallelism;

public FullPrunerTests(int fullPrunerMemoryBudgetMb, int degreeOfParallelism)
{
_fullPrunerMemoryBudgetMb = fullPrunerMemoryBudgetMb;
_degreeOfParallelism = degreeOfParallelism;
}

[Test, MaxTime(Timeout.MaxTestTime)]
public async Task can_prune()
{
Expand All @@ -61,8 +53,8 @@ public async Task can_prune_and_switch_key_scheme(INodeStorage.KeyScheme current
true,
false,
FullPruningCompletionBehavior.None,
_fullPrunerMemoryBudgetMb,
_degreeOfParallelism,
fullPrunerMemoryBudgetMb,
degreeOfParallelism,
currentKeyScheme: currentKeyScheme,
preferredKeyScheme: newKeyScheme);

Expand Down Expand Up @@ -192,8 +184,8 @@ private TestContext CreateTest(
successfulPruning,
clearPrunedDb,
completionBehavior,
_fullPrunerMemoryBudgetMb,
_degreeOfParallelism);
fullPrunerMemoryBudgetMb,
degreeOfParallelism);

private class TestContext
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

namespace Nethermind.Blockchain.Test.FullPruning;

[Parallelizable(ParallelScope.All)]
public class FullPruningDiskTest
{
public class PruningTestBlockchain : TestBlockchain
Expand Down Expand Up @@ -109,27 +110,24 @@ public static async Task<PruningTestBlockchain> Create(IPruningConfig? pruningCo
return chain;
}

public class FullTestPruner : FullPruner
public class FullTestPruner(
IFullPruningDb pruningDb,
INodeStorageFactory nodeStorageFactory,
INodeStorage mainNodeStorage,
IPruningTrigger pruningTrigger,
IPruningConfig pruningConfig,
IBlockTree blockTree,
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)
{
public EventWaitHandle WaitHandle { get; } = new ManualResetEvent(false);

public FullTestPruner(
IFullPruningDb pruningDb,
INodeStorageFactory nodeStorageFactory,
INodeStorage mainNodeStorage,
IPruningTrigger pruningTrigger,
IPruningConfig pruningConfig,
IBlockTree blockTree,
IStateReader stateReader,
IProcessExitSource processExitSource,
IDriveInfo driveInfo,
IPruningTrieStore trieStore,
IChainEstimations chainEstimations,
ILogManager logManager)
: base(pruningDb, nodeStorageFactory, mainNodeStorage, pruningTrigger, pruningConfig, blockTree, stateReader, processExitSource, chainEstimations, driveInfo, trieStore, logManager)
{
}

protected override async Task RunFullPruning(CancellationToken cancellationToken)
{
await base.RunFullPruning(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
namespace Nethermind.Blockchain.Test.FullPruning
{
[TestFixture]
[Parallelizable(ParallelScope.Self)]
[Parallelizable(ParallelScope.All)]
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
public class PruningTriggerPruningStrategyTests
{
private IFullPruningDb _fullPruningDb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Nethermind.Blockchain.Test.Producers;

[Parallelizable(ParallelScope.All)]
public class BuildBlockOnEachPendingTxTests
{
[Test, MaxTime(Timeout.MaxTestTime)]
Expand Down
Loading