Skip to content
Open
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
96 changes: 96 additions & 0 deletions .github/workflows/nethermind-tests-flat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Nethermind tests (Flat DB)

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
push:
branches: [master]
workflow_dispatch:

env:
TEST_USE_FLAT: "1"
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1
TERM: xterm

jobs:
tests:
name: Run ${{ matrix.project }}${{ matrix.chunk && format(' ({0})', matrix.chunk) || '' }}
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
project:
- Ethereum.Abi.Test
- Ethereum.Basic.Test
- Ethereum.Blockchain.Block.Test
- Ethereum.Blockchain.Pyspec.Test
- Ethereum.Difficulty.Test
- Ethereum.HexPrefix.Test
- Ethereum.KeyAddress.Test
- Ethereum.KeyStore.Test
- Ethereum.Legacy.Blockchain.Block.Test
- Ethereum.Legacy.Transition.Test
- Ethereum.Legacy.VM.Test
- Ethereum.PoW.Test
- Ethereum.Rlp.Test
- Ethereum.Transaction.Test
- Ethereum.Trie.Test
- Nethermind.Consensus.Test
- Nethermind.Core.Test
- Nethermind.Db.Test
- Nethermind.Runner.Test
chunk: ['']
include:
- project: Ethereum.Legacy.Blockchain.Test
chunk: 1of4
- project: Ethereum.Legacy.Blockchain.Test
chunk: 2of4
- project: Ethereum.Legacy.Blockchain.Test
chunk: 3of4
- project: Ethereum.Legacy.Blockchain.Test
chunk: 4of4
steps:
- name: Check out repository
uses: actions/checkout@v6
with:
submodules: ${{ startsWith(matrix.project, 'Ethereum.') && 'recursive' || 'false' }}

- name: Set up .NET
uses: actions/setup-dotnet@v5

- name: ${{ matrix.project }}
id: test
working-directory: src/Nethermind/${{ matrix.project }}
env:
TEST_CHUNK: ${{ matrix.chunk }}
run: |
dotnet test --project ${{ matrix.project }}.csproj -c release

- name: Save test outcome
if: success() || failure()
run: echo "${{ steps.test.outcome == 'success' }}," >> test.outcome

- name: Upload test outcome
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.project }}${{ matrix.chunk && format('-{0}', matrix.chunk) || '' }}-flat-outcome
path: test.outcome
retention-days: 1

tests-summary:
name: Tests summary
needs: tests
runs-on: ubuntu-latest
steps:
- name: Download test outcomes
uses: actions/download-artifact@v4

- name: Ensure all tests passed
run: |
data=$(cat **/test.outcome) && data=${data%?}
passed=$(echo "[$data]" | jq -r 'all')
[[ "$passed" == "true" ]] && exit 0 || exit 1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,6 @@ FodyWeavers.xsd
## Nethermind
keystore/
/.githooks

# Worktrees
.worktrees/
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<PackageVersion Include="Spectre.Console" Version="0.54.0" />
<PackageVersion Include="System.CommandLine" Version="2.0.1" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.0.1" />
<PackageVersion Include="System.IO.Hashing" Version="10.0.2" />
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="10.0.1" />
<PackageVersion Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="22.1.0" />
<PackageVersion Include="TestableIO.System.IO.Abstractions.Wrappers" Version="22.1.0" />
Expand Down
28 changes: 28 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@
"bootnodes",
"bottlenecked",
"browsable",
"bsearch",
"btcs",
"buildtransitive",
"bulkset",
"bursty",
"buterin",
"bylica",
"cacheline",
"bytecodes",
"callcode",
"calldatacopy",
Expand Down Expand Up @@ -170,6 +172,7 @@
"deserialised",
"dests",
"devirtualize",
"devirtualized",
"devnet",
"devnets",
"devp2p",
Expand Down Expand Up @@ -237,7 +240,9 @@
"extopcodes",
"extradata",
"extstaticcall",
"Exitor",
"fastbin",
"Fastpath",
"fastlz",
"fastmod",
"fastsync",
Expand Down Expand Up @@ -292,6 +297,7 @@
"hostnames",
"hotstuff",
"hyperthreading",
"HUGEPAGE",
"idxs",
"iface",
"ikvp",
Expand Down Expand Up @@ -345,6 +351,7 @@
"ldarg",
"ldfld",
"lemire's",
"levelname",
"libc",
"libdl",
"libp",
Expand All @@ -361,6 +368,8 @@
"machdep",
"machinename",
"madv",
"Madvise",
"madvise",
"maiboroda",
"mainchain",
"mallopt",
Expand All @@ -379,10 +388,12 @@
"maxlevel",
"maxpriorityfee",
"mclbn",
"mbpk",
"mcmc",
"mcopy",
"mellor",
"memberwise",
"memcolumndb",
"memin",
"meminstart",
"meminsz",
Expand Down Expand Up @@ -411,6 +422,7 @@
"morden",
"movbe",
"movzx",
"Mpmc",
"mres",
"mscorlib",
"msgrecv",
Expand Down Expand Up @@ -457,6 +469,7 @@
"nodestore",
"nodetype",
"nofile",
"noninteractive",
"nonposdao",
"nonstring",
"nops",
Expand All @@ -483,13 +496,15 @@
"owlf",
"pacaya",
"parallelizable",
"patriciatree",
"paweł",
"pctg",
"pearce",
"pectra",
"pendingtxs",
"perfnet",
"perfolizer",
"Persistences",
"permissioned",
"pgrep",
"physicalcpu",
Expand All @@ -499,6 +514,7 @@
"pkcs",
"pmsg",
"poacore",
"Populator",
"poaps",
"podc",
"popcnt",
Expand All @@ -509,6 +525,7 @@
"powm",
"preconf",
"preconfirmation",
"pregenesis",
"predeploy",
"prefixedf",
"prefund",
Expand Down Expand Up @@ -560,6 +577,7 @@
"resettables",
"retesteth",
"retf",
"ribbonfilter",
"returncode",
"returndata",
"returndatacopy",
Expand All @@ -578,6 +596,7 @@
"rocksdb",
"ronin",
"roothash",
"rootref",
"rormask",
"rpcurl",
"runtimeconfig",
Expand Down Expand Up @@ -611,11 +630,13 @@
"sload",
"smod",
"somelabel",
"Spmc",
"spaceneth",
"spammy",
"sparkline",
"spinlocks",
"squarify",
"srcset",
"ssse",
"sstfiles",
"sstore",
Expand Down Expand Up @@ -680,6 +701,7 @@
"trienode",
"triestore",
"trietest",
"Triewarmer",
"trietestnextprev",
"triggerable",
"tstore",
Expand Down Expand Up @@ -723,6 +745,8 @@
"upto",
"upvoting",
"vbmi",
"verifytrie",
"verkle",
"vitalik",
"vmovups",
"vmtrace",
Expand All @@ -734,6 +758,8 @@
"vpor",
"vptest",
"vzeroupper",
"Wakeup",
"wakeup",
"wamp",
"warmcoinbase",
"wblob",
Expand All @@ -744,6 +770,7 @@
"worklet",
"worklist",
"worldchain",
"worldscope",
"worldstate",
"writebatch",
"writeoptions",
Expand All @@ -758,6 +785,7 @@
"yparity",
"zcompressor",
"zdecompressor",
"zerobytes",
"zhizhu",
"zstandard",
"zstd",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Nethermind.Core.Extensions;
using Nethermind.Core.Test.Blockchain;
using Nethermind.Core.Test.IO;
using Nethermind.Core.Test.Modules;
using Nethermind.Db;
using Nethermind.Db.FullPruning;
using Nethermind.Db.Rocks;
Expand Down Expand Up @@ -136,6 +137,12 @@ protected override async Task RunFullPruning(CancellationToken cancellationToken
}
}

[SetUp]
public void Setup()
{
if (PseudoNethermindModule.TestUseFlat) Assert.Ignore("Disabled in flat");
}

[Test, MaxTime(Timeout.LongTestTime)]
public async Task prune_on_disk_multiple_times()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Nethermind.Core;
using Nethermind.Core.Test.Builders;
using Nethermind.Core.Test.Modules;
using Nethermind.Evm.State;
using Nethermind.Evm.TransactionProcessing;
using NUnit.Framework;

namespace Nethermind.Consensus.Test;
Expand All @@ -19,8 +21,8 @@ public void OnSubsequentBuild_GiveDifferentWorldState()
using IContainer container = new ContainerBuilder().AddModule(new TestNethermindModule()).Build();
IShareableTxProcessorSource shareableSource = container.Resolve<IShareableTxProcessorSource>();

var scope1 = shareableSource.Build(Build.A.BlockHeader.TestObject);
var scope2 = shareableSource.Build(Build.A.BlockHeader.TestObject);
var scope1 = shareableSource.Build(IWorldState.PreGenesis);
var scope2 = shareableSource.Build(IWorldState.PreGenesis);

scope1.WorldState.Should().NotBeSameAs(scope2.WorldState);
}
Expand All @@ -31,9 +33,9 @@ public void OnSubsequentBuild_AfterFirstScopeDispose_GiveSameWorldState()
using IContainer container = new ContainerBuilder().AddModule(new TestNethermindModule()).Build();
IShareableTxProcessorSource shareableSource = container.Resolve<IShareableTxProcessorSource>();

var scope1 = shareableSource.Build(Build.A.BlockHeader.TestObject);
var scope1 = shareableSource.Build(IWorldState.PreGenesis);
scope1.Dispose();
var scope2 = shareableSource.Build(Build.A.BlockHeader.TestObject);
var scope2 = shareableSource.Build(IWorldState.PreGenesis);

scope1.WorldState.Should().BeSameAs(scope2.WorldState);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ public Block[] Process(BlockHeader? baseBlock, IReadOnlyList<Block> suggestedBlo
}
else
{
BlockHeader? scopeBaseBlock = baseBlock ?? (suggestedBlock.IsGenesis ? suggestedBlock.Header : null);
worldStateCloser = stateProvider.BeginScope(scopeBaseBlock);
worldStateCloser = stateProvider.BeginScope(baseBlock);
}

CancellationTokenSource? backgroundCancellation = new();
Expand Down
Loading