Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
554 commits
Select commit Hold shift + click to select a range
dca3296
fix removing storage read on revert, copy across BAL from suggested f…
Marchhill Jan 21, 2026
e479770
Bal devnet 2 fixes (#10293)
benaadams Jan 21, 2026
37e891c
Bal devnet 2 merge (#10297)
benaadams Jan 21, 2026
5326cc5
goto outofgas selfdestruct
Marchhill Jan 22, 2026
f639b70
fix call delegation access
Marchhill Jan 22, 2026
2766fb8
fix call gas charging
Marchhill Jan 22, 2026
eaf3efb
move new account charge in call
Marchhill Jan 23, 2026
7a78b71
add bal hash to rpc
Marchhill Jan 23, 2026
abf1b07
rename to parallelworldstate
Marchhill Jan 26, 2026
38c28af
Merge remote-tracking branch 'upstream/master' into bal-devnet-2
Marchhill Jan 26, 2026
3f9f1f6
fix merge conflict testsourceloader
Marchhill Jan 26, 2026
810e247
fix packages lock
Marchhill Jan 26, 2026
165aa66
add trie back to packages lock
Marchhill Jan 26, 2026
175959f
fix gnosis config
Marchhill Jan 26, 2026
17aef0b
fix testsouceloader
Marchhill Jan 26, 2026
87a5757
Implement EIP-7843 (SLOTNUM opcode) (#10231)
Marchhill Jan 26, 2026
f5eace2
EIP-7778: Block Gas Accounting without Refunds (#10292)
benaadams Jan 26, 2026
a64ee30
EIP-8024 DupN/SwapN/Exchange stack operations (#10285)
benaadams Jan 26, 2026
addae85
EIP-7708 ETH transfer log (#10291)
LukaszRozmej Jan 26, 2026
03fc7d8
fix slotnumber
Marchhill Jan 27, 2026
a8d30ba
add slotnum to executionpayload crearte
Marchhill Jan 27, 2026
b9f9f21
test runner & validation fixes
Marchhill Jan 27, 2026
92e60ba
try undo blockchain test change
Marchhill Jan 27, 2026
52563c0
try always setting bal hash genesis
Marchhill Jan 27, 2026
c97acee
Revert "try always setting bal hash genesis"
Marchhill Jan 27, 2026
cf229e6
test override chainspec genesis
Marchhill Jan 27, 2026
47375f9
Revert "test override chainspec genesis"
Marchhill Jan 27, 2026
f071131
add logs
Marchhill Jan 27, 2026
dc5cec5
always set genesis slotnum to 0, fix log
Marchhill Jan 27, 2026
2e8462c
Merge branch 'bal-devnet-2' into feature/parallel-txs
Marchhill Jan 30, 2026
3db161c
bal builder refactor
Marchhill Jan 30, 2026
20473ca
remove block size validation check
Marchhill Jan 30, 2026
a98e9df
Merge branch 'bal-devnet-2-bals-only' into feature/parallel-txs
Marchhill Jan 30, 2026
1f4aa82
use sortedlist for storage changes
Marchhill Jan 30, 2026
4c28ad6
formatting
Marchhill Jan 30, 2026
ef7df4a
move tests
Marchhill Jan 30, 2026
8ec3a96
fix slot changes encoder
Marchhill Jan 30, 2026
e2e0526
fix encoding test
Marchhill Jan 30, 2026
5062607
code tests
Marchhill Jan 30, 2026
ec57526
improve tests
Marchhill Jan 31, 2026
ea951b3
stefan fixes
Marchhill Feb 1, 2026
d8d0a74
fix: ExecutionPayloadV4.Create() calls V1 base instead of V3 (#10376)
qu0b Feb 2, 2026
22ee2d9
change bal to class, fix epv4, test fixes
Marchhill Feb 2, 2026
689db35
tidy tests
Marchhill Feb 2, 2026
b11746a
block building test, build.a.bal
Marchhill Feb 2, 2026
d4ed88a
use fcu in block building test, update year
Marchhill Feb 2, 2026
54a6aab
Update for change in eip 7778 (#10387)
benaadams Feb 2, 2026
fea15d5
Update for change in eip 7778 (#10388)
benaadams Feb 2, 2026
6a2fada
rpc changes
Marchhill Feb 2, 2026
26407f2
rpc changes
Marchhill Feb 2, 2026
b2dc766
fix engine rpc method, eth error codes
Marchhill Feb 3, 2026
24ebfd6
enginerpc and eth tests
Marchhill Feb 3, 2026
60ee104
fix engine rpc method, eth error codes
Marchhill Feb 3, 2026
bbfd4b9
add tx to block building test
Marchhill Feb 3, 2026
ebb0d75
Merge remote-tracking branch 'upstream/master' into bal-devnet-2
Marchhill Feb 3, 2026
c87e028
fix benchmarks build
Marchhill Feb 3, 2026
c916a20
fix docgen build, format
Marchhill Feb 3, 2026
c0f03f3
fix CachedCodeInfoRepositoryTests
Marchhill Feb 3, 2026
01d6a04
should_process test and e2e new payload test
Marchhill Feb 3, 2026
1865a99
finish newpayload test
Marchhill Feb 3, 2026
500fb0f
blockchain test runner fix
Marchhill Feb 4, 2026
850f38f
Skip transfer logs for DELEGATECALL, CALLCODE, self (#10402)
benaadams Feb 4, 2026
4fc70d7
Optimize value transfer (#10403)
benaadams Feb 4, 2026
8e45a85
Fix tests to include new EIPS &
Marchhill Feb 4, 2026
e404819
Merge branch 'bal-devnet-2' of github.com:NethermindEth/nethermind in…
Marchhill Feb 4, 2026
86bb87f
Merge remote-tracking branch 'upstream/master' into bal-devnet-2
Marchhill Feb 4, 2026
b1ff1db
verify slotnum in payloadattributes
Marchhill Feb 4, 2026
897bc07
formatting
Marchhill Feb 4, 2026
247a884
improve block & header validation
Marchhill Feb 4, 2026
c5e3d2f
fix(eip8024): SWAPN off-by-one in stack swap depth (#10408)
qu0b Feb 5, 2026
83d4576
Fix selfdestruct+revert (#10302)
benaadams Feb 5, 2026
5f27150
undo slot number header validation change
Marchhill Feb 5, 2026
0c20713
Merge branch 'bal-devnet-2' of github.com:NethermindEth/nethermind in…
Marchhill Feb 5, 2026
890c65c
copy over validation & test changes
Marchhill Feb 5, 2026
7b5311f
fix block null bal validation
Marchhill Feb 5, 2026
aab6cee
fix block bal validation
Marchhill Feb 5, 2026
1874fc9
early bal invalidation
Marchhill Feb 6, 2026
d14d056
early read validation
Marchhill Feb 6, 2026
8e76723
ext opcode tests
Marchhill Feb 7, 2026
289e834
add evm tests
Marchhill Feb 9, 2026
251b435
precompile test
Marchhill Feb 9, 2026
5269549
call test
Marchhill Feb 9, 2026
6eea214
other call tests
Marchhill Feb 9, 2026
42ac77e
delegated account test
Marchhill Feb 9, 2026
a914b0c
initial oog tests
Marchhill Feb 9, 2026
7640f92
complete pre-state access oog tests
Marchhill Feb 9, 2026
92ae805
complete post-state access oog tests
Marchhill Feb 9, 2026
d8550f3
stack underflow tests
Marchhill Feb 9, 2026
9502f9b
revert_with_return_to_original
Marchhill Feb 9, 2026
e319c26
more evm tests
Marchhill Feb 9, 2026
43303bd
incorrect order decoding tests
Marchhill Feb 9, 2026
882de9b
optimise remove allocations
Marchhill Feb 9, 2026
ec86fdf
unreachable exceptions
Marchhill Feb 9, 2026
aefffe9
clear BAL, code change reduce allocation
Marchhill Feb 9, 2026
f67b74b
filter post execution reads in storage read gas check
Marchhill Feb 9, 2026
96ad72d
Merge remote-tracking branch 'upstream/master' into bal-devnet-2-bals…
Marchhill Feb 9, 2026
f72fd5d
tidy
Marchhill Feb 10, 2026
79e193e
fix: EIP-8024 EXCHANGE off-by-one in TryDecodePair (#10475)
qu0b Feb 10, 2026
8d7a0c8
fix aura tests
Marchhill Feb 10, 2026
0471b85
Merge remote-tracking branch 'upstream/master' into bal-devnet-2-bals…
Marchhill Feb 10, 2026
bfa5cd0
fix tests
Marchhill Feb 10, 2026
ecdbd1c
tidy
Marchhill Feb 10, 2026
e42e6d5
check balbuilder not null when tx processing
Marchhill Feb 10, 2026
8f28c9e
Merge branch 'bal-devnet-2-bals-only' into bal-devnet-2
Marchhill Feb 10, 2026
16e533b
fix aura tests
Marchhill Feb 10, 2026
cb0b0e5
undo test runner change
Marchhill Feb 10, 2026
6d495da
Update src/Nethermind/Ethereum.Test.Base/JsonToEthereumTest.cs
Marchhill Feb 10, 2026
3fabee2
Update src/Nethermind/Ethereum.Test.Base/JsonToEthereumTest.cs
Marchhill Feb 10, 2026
de48b8c
Update src/Nethermind/Ethereum.Test.Base/FileTestsSource.cs
Marchhill Feb 10, 2026
ee2e166
merge bal-devnet-2, plus fixes
Marchhill Feb 11, 2026
a6f1fff
fixes
Marchhill Feb 11, 2026
3c1d5e3
fix withdrawal bal index
Marchhill Feb 11, 2026
402d6c7
parallel receipts tracing
Marchhill Feb 11, 2026
1f4290f
warmup bal index, fix tests build
Marchhill Feb 11, 2026
0569bfa
overridablecodeinforepo bal index
Marchhill Feb 11, 2026
f95354e
missing bal index
Marchhill Feb 11, 2026
395f23e
disable warming
Marchhill Feb 11, 2026
745eea8
fix trim leading zeros on storage get, reenable prewarmer
Marchhill Feb 12, 2026
404f6a5
disable evm warming
Marchhill Feb 12, 2026
18d67e1
block production fixes
Marchhill Feb 12, 2026
39a55b7
parallelise gas checks
Marchhill Feb 12, 2026
4db4460
use underlying state directly in test
Marchhill Feb 13, 2026
0016459
merge SlotChanges
Marchhill Feb 13, 2026
57afd75
try applying state in main thread
Marchhill Feb 13, 2026
d166798
calculate state root in parallel with tx execution
Marchhill Feb 13, 2026
7b66394
fix tx exec in different thread
Marchhill Feb 13, 2026
79e131b
fix
Marchhill Feb 13, 2026
f3a5305
syntax
Marchhill Feb 13, 2026
84d327d
✨ feat(EIP-7708): Rename log topic from Selfedestruct to Burn (#10540)
raxhvl Feb 16, 2026
76a8434
Revert "✨ feat(EIP-7708): Rename log topic from Selfedestruct to Burn…
flcl42 Feb 17, 2026
ed1cb26
add parallel logging
Marchhill Feb 18, 2026
03824ba
fix
Marchhill Feb 18, 2026
dab4e26
fix logs
Marchhill Feb 18, 2026
fea4fd1
state application in tx thread
Marchhill Feb 19, 2026
bbe3ab6
separate task for state application
Marchhill Feb 19, 2026
4041be4
add early validation
Marchhill Feb 19, 2026
df2e1dd
Fix tests - remove console output and move converters back
flcl42 Feb 24, 2026
60d6f2a
Merge remote-tracking branch 'origin/master' into bal-devnet-2-bals-only
flcl42 Feb 24, 2026
af3fa92
Merge branch 'bal-devnet-2-bals-only' into bal-devnet-2
flcl42 Feb 24, 2026
0155862
Consider another override; scan more
flcl42 Feb 25, 2026
95e4181
Deduplicate reads counting
flcl42 Feb 26, 2026
ff97728
Consider another override; scan more; account for Skipped in block bu…
flcl42 Feb 26, 2026
cbf9912
Use records; clean up
flcl42 Feb 26, 2026
58ab5a7
Less heap alloc; check rlp
flcl42 Mar 1, 2026
274638f
Merge remote-tracking branch 'origin/master' into bal-devnet-2-bals-only
flcl42 Mar 1, 2026
d46e218
review comments
Marchhill Mar 2, 2026
9c3e5d0
Merge remote-tracking branch 'upstream/master' into bal-devnet-2-bals…
Marchhill Mar 2, 2026
c2c7ce5
fix rlp
Marchhill Mar 2, 2026
fa539a7
fix aura test, blockchain test blob schedule loader
Marchhill Mar 2, 2026
767f78a
tidy
Marchhill Mar 2, 2026
510e65b
Merge branch 'bal-devnet-2-bals-only' into bal-devnet-2
Marchhill Mar 2, 2026
83caaa0
Merge branch 'bal-devnet-2' into feature/parallel-txs
Marchhill Mar 3, 2026
88d3cac
tmp disable early validation
Marchhill Mar 3, 2026
b7bf61c
Revert "tmp disable early validation"
Marchhill Mar 3, 2026
dc39a00
missing bal index
Marchhill Mar 3, 2026
a12b8b7
tmp disable early validation
Marchhill Mar 3, 2026
b4bc421
only load suggested when parallel enabled
Marchhill Mar 3, 2026
efa5971
use address for getting code
Marchhill Mar 3, 2026
f590f73
comments
Marchhill Mar 3, 2026
33e04df
improve logging
Marchhill Mar 3, 2026
7362615
Revert "only load suggested when parallel enabled"
Marchhill Mar 3, 2026
f7230f6
reenable early validation
Marchhill Mar 3, 2026
f32a186
add logging
Marchhill Mar 3, 2026
ecb80c7
size limit check
Marchhill Mar 4, 2026
c12c434
small check refactor
Marchhill Mar 4, 2026
babd30b
config
Marchhill Mar 4, 2026
324c94f
merge intermediate bals incrementally
Marchhill Mar 4, 2026
8cb29d3
formatting
Marchhill Mar 4, 2026
0282421
move merge up to 0
Marchhill Mar 4, 2026
e5791f0
don't use getbalance internal
Marchhill Mar 4, 2026
32f54fc
fix some tests, todos
Marchhill Mar 4, 2026
ad4cd8c
more test fixes
Marchhill Mar 4, 2026
c200e7e
fix more tests, missing bal index
Marchhill Mar 4, 2026
d620f3a
more fixes
Marchhill Mar 4, 2026
29c3505
more fixes
Marchhill Mar 4, 2026
156e1b0
make parallel false by default
Marchhill Mar 4, 2026
bf198f4
enable parallel for vm test base
Marchhill Mar 4, 2026
044ab32
remove unneeded parallel, don't use parallel in vm test base
Marchhill Mar 4, 2026
5547936
more test fixes
Marchhill Mar 4, 2026
6b12a1d
only throw for null bal if parallel exec enabled
Marchhill Mar 4, 2026
963b057
complete change null bal index check
Marchhill Mar 4, 2026
dae18cf
more missing
Marchhill Mar 4, 2026
24e903d
change to check if tracing enabled
Marchhill Mar 4, 2026
305f4b1
missing change to int?
Marchhill Mar 4, 2026
1a84868
pass trace in worldstate commit
Marchhill Mar 4, 2026
c86bb64
fix beaconblockroot, gasestimate, tracetoblock
Marchhill Mar 5, 2026
2862fa4
fix error returning from processing
Marchhill Mar 5, 2026
d0256b8
fix storage read validation
Marchhill Mar 5, 2026
c4d4cfe
nullable bal builder
Marchhill Mar 5, 2026
cc55447
check bal builder is not null tx exec
Marchhill Mar 5, 2026
f3cb59b
aura issue comment, fix aura bal
Marchhill Mar 5, 2026
9c8ac80
fix isstorageempty, hascode overrides
Marchhill Mar 5, 2026
3af3ab6
debugrpctests
Marchhill Mar 6, 2026
18a582e
facade exception handling
Marchhill Mar 6, 2026
473dc31
parallel error handling
Marchhill Mar 6, 2026
1ca5f91
aura test
Marchhill Mar 6, 2026
b017a16
format
Marchhill Mar 6, 2026
662b665
fix benchmarks build
Marchhill Mar 6, 2026
89ca640
comment aura payload bodies
Marchhill Mar 6, 2026
92af537
change early read validation
Marchhill Mar 6, 2026
2d1dc77
format
Marchhill Mar 6, 2026
39be600
tidy
Marchhill Mar 6, 2026
61c13e6
fix build
Marchhill Mar 6, 2026
a94c609
use bal index tx picker
Marchhill Mar 6, 2026
0e8186c
Merge remote-tracking branch 'upstream/master' into feature/parallel-txs
Marchhill Mar 10, 2026
91d7e16
fix build
Marchhill Mar 10, 2026
d56175c
fix missing bal index
Marchhill Mar 10, 2026
dd5253a
whitespace
Marchhill Mar 10, 2026
1852bcd
statelessexec build
Marchhill Mar 10, 2026
3d36cfa
stateless building task
Marchhill Mar 10, 2026
18b7fd2
add logging, filter all system contracts
Marchhill Mar 10, 2026
e174ed3
improve logging
Marchhill Mar 11, 2026
12e6d4f
use spentgas
Marchhill Mar 11, 2026
c587f5c
separate gasSpent and blockGas
Marchhill Mar 11, 2026
c67d547
add logging
Marchhill Mar 11, 2026
763c944
try setting tx block gas earlier
Marchhill Mar 11, 2026
f18609b
try checking if equal to limit
Marchhill Mar 11, 2026
41a2160
try using lock for header gas
Marchhill Mar 12, 2026
4445954
try other approach
Marchhill Mar 12, 2026
62a3ace
try adding spent gas
Marchhill Mar 12, 2026
68a1d11
revert experiment
Marchhill Mar 12, 2026
6c3580f
blockgasusedtest
Marchhill Mar 12, 2026
ff29e58
more logging
Marchhill Mar 12, 2026
ed43f37
try checking header gas
Marchhill Mar 12, 2026
6a60098
simplify, check warmup flag
Marchhill Mar 12, 2026
e573b99
use block gas for storage read check
Marchhill Mar 12, 2026
457b8a9
fix getcodeinfo
Marchhill Mar 13, 2026
d1e5977
add parallelworldstatetests
Marchhill Mar 16, 2026
d650ddf
codeinforepo tests
Marchhill Mar 16, 2026
2a4f4d0
Merge branch 'claude/intelligent-rosalind' into feature/parallel-txs
Marchhill Mar 16, 2026
4aa148b
improve tests
Marchhill Mar 16, 2026
3f69a40
simplify codeinforepo tests
Marchhill Mar 16, 2026
fe763e4
Merge branch 'master' of github.com:NethermindEth/nethermind into fea…
Marchhill Mar 16, 2026
fd830ac
Merge remote-tracking branch 'upstream/master' into feature/parallel-txs
Marchhill Mar 17, 2026
1feb01a
format
Marchhill Mar 17, 2026
00a52bd
fixes
Marchhill Mar 17, 2026
14cda96
fix subtract system user, add regression test
Marchhill Mar 17, 2026
d635fbd
fix some tests
Marchhill Mar 18, 2026
89e1d34
remove unneeded check
Marchhill Mar 18, 2026
909c38b
missing bal index readonlystateproviderextensions
Marchhill Mar 18, 2026
0078791
check no overlapping reads and changes rlp
Marchhill Mar 18, 2026
242dd92
fix auramergeenginemoduletests
Marchhill Mar 19, 2026
c796277
aura preprocessing and test fix
Marchhill Mar 19, 2026
2d33e1f
fix tests by adding aurastep / sig
Marchhill Mar 20, 2026
2d80b98
only add aurastep for aura tests
Marchhill Mar 20, 2026
c0dfe92
Merge remote-tracking branch 'upstream/master' into fix/aura-merge-en…
Marchhill Mar 20, 2026
2a6cc2c
refactor test
Marchhill Mar 20, 2026
a4c9cc7
Merge remote-tracking branch 'upstream/master' into feature/parallel-txs
Marchhill Mar 20, 2026
c4b4986
Merge branch 'fix/aura-merge-engine' into feature/parallel-txs
Marchhill Mar 20, 2026
58404f6
uncomment tests
Marchhill Mar 20, 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
3 changes: 2 additions & 1 deletion src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
using Nethermind.Merge.Plugin;
using Nethermind.JsonRpc;
using System.Reflection;
using Nethermind.State;

namespace Ethereum.Test.Base;

Expand Down Expand Up @@ -144,7 +145,7 @@ protected async Task<EthereumTestResult> RunTest(BlockchainTest test, Stopwatch?
await using IContainer container = containerBuilder.Build();

IMainProcessingContext mainBlockProcessingContext = container.Resolve<IMainProcessingContext>();
IWorldState stateProvider = mainBlockProcessingContext.WorldState;
IWorldState stateProvider = (mainBlockProcessingContext.WorldState as ParallelWorldState).Inner; // directly access underlying state
BlockchainProcessor blockchainProcessor = (BlockchainProcessor)mainBlockProcessingContext.BlockchainProcessor;
IBlockTree blockTree = container.Resolve<IBlockTree>();
IBlockValidator blockValidator = container.Resolve<IBlockValidator>();
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.AuRa.Test/AuRaBlockProducerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Context()
{
Block block = c.Arg<Block>();
block.TrySetTransactions(TransactionSource.GetTransactions(BlockTree.Head!.Header, block.GasLimit).ToArray());
return block;
return (block, null);
});
StateProvider.HasStateForBlock(Arg.Any<BlockHeader>()).Returns(x => true);
InitProducer();
Expand Down Expand Up @@ -208,7 +208,7 @@ public async Task Does_not_produce_block_when_head_is_null()
public async Task Does_not_produce_block_when_processing_fails()
{
Context context = new();
context.BlockchainProcessor.Process(Arg.Any<Block>(), ProcessingOptions.ProducingBlock, Arg.Any<IBlockTracer>(), Arg.Any<CancellationToken>()).Returns((Block)null);
context.BlockchainProcessor.Process(Arg.Any<Block>(), ProcessingOptions.ProducingBlock, Arg.Any<IBlockTracer>(), Arg.Any<CancellationToken>()).Returns((null, null));
(await StartStop(context)).ShouldProduceBlocks(Quantity.None());
}

Expand Down
34 changes: 22 additions & 12 deletions src/Nethermind/Nethermind.AuRa.Test/AuraBlockProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using FluentAssertions;
using Nethermind.Blockchain;
using Nethermind.Blockchain.BeaconBlockRoot;
using Nethermind.Blockchain.Receipts;
using Nethermind.Blockchain.Test.Validators;
using Nethermind.Blockchain.Tracing;
using Nethermind.Consensus.AuRa;
using Nethermind.Consensus.AuRa.Config;
using Nethermind.Consensus.ExecutionRequests;
using Nethermind.Consensus.Processing;
using Nethermind.Consensus.Rewards;
Expand Down Expand Up @@ -37,13 +39,13 @@ namespace Nethermind.AuRa.Test
public class AuraBlockProcessorTests
{
[Test]
public void Prepared_block_contains_author_field()
public async Task Prepared_block_contains_author_field()
{
BranchProcessor processor = CreateProcessor().Processor;

BlockHeader header = Build.A.BlockHeader.WithAuthor(TestItem.AddressD).TestObject;
Block block = Build.A.Block.WithHeader(header).TestObject;
Block[] processedBlocks = processor.Process(
Block[] processedBlocks = await processor.Process(
null,
new List<Block> { block },
ProcessingOptions.None,
Expand Down Expand Up @@ -83,17 +85,17 @@ public void For_normal_processing_it_should_not_fail_with_gas_remaining_rules()
.SignedAndResolved().WithChainId(105).WithGasPrice(0).WithValue(0).WithGasLimit(gasLimit + 1).TestObject;
Block block = Build.A.Block.WithHeader(header).WithTransactions(new Transaction[] { tx })
.WithGasLimit(gasLimit).TestObject;
Assert.DoesNotThrow(() => processor.Process(
Assert.DoesNotThrowAsync(() => processor.Process(
null,
new List<Block> { block },
ProcessingOptions.None,
NullBlockTracer.Instance));
}

[Test]
public void Should_rewrite_contracts([Values] bool isPostMerge)
public async Task Should_rewrite_contracts([Values] bool isPostMerge)
{
static BlockHeader Process(BranchProcessor auRaBlockProcessor, BlockHeader parent, IBlockTree blockTree, bool isPostMerge)
static async Task<BlockHeader> Process(BranchProcessor auRaBlockProcessor, BlockHeader parent, IBlockTree blockTree, bool isPostMerge)
{
BlockHeader header = Build.A.BlockHeader
.WithAuthor(TestItem.AddressD)
Expand All @@ -102,11 +104,11 @@ static BlockHeader Process(BranchProcessor auRaBlockProcessor, BlockHeader paren
.WithTotalDifficulty(0).TestObject;
header.IsPostMerge = isPostMerge;
Block block = Build.A.Block.WithHeader(header).TestObject;
BlockHeader res = auRaBlockProcessor.Process(
BlockHeader res = (await auRaBlockProcessor.Process(
parent,
new List<Block> { block },
ProcessingOptions.None,
NullBlockTracer.Instance)[0].Header;
NullBlockTracer.Instance))[0].Header;
blockTree.Insert(res);
return res;
}
Expand Down Expand Up @@ -156,7 +158,7 @@ static BlockHeader Process(BranchProcessor auRaBlockProcessor, BlockHeader paren
}

BlockHeader currentBlock = Build.A.BlockHeader.WithNumber(0).WithStateRoot(stateRoot).TestObject;
currentBlock = Process(processor, currentBlock, blockTree, isPostMerge);
currentBlock = await Process(processor, currentBlock, blockTree, isPostMerge);

using (stateProvider.BeginScope(currentBlock))
{
Expand All @@ -166,7 +168,7 @@ static BlockHeader Process(BranchProcessor auRaBlockProcessor, BlockHeader paren
stateProvider.GetCode(TestItem.AddressD).Should().BeEquivalentTo(Array.Empty<byte>());
}

currentBlock = Process(processor, currentBlock, blockTree, isPostMerge);
currentBlock = await Process(processor, currentBlock, blockTree, isPostMerge);

using (stateProvider.BeginScope(currentBlock))
{
Expand All @@ -176,7 +178,7 @@ static BlockHeader Process(BranchProcessor auRaBlockProcessor, BlockHeader paren
stateProvider.GetCode(TestItem.AddressD).Should().BeEquivalentTo(Bytes.FromHexString("0x321"));
}

currentBlock = Process(processor, currentBlock, blockTree, isPostMerge);
currentBlock = await Process(processor, currentBlock, blockTree, isPostMerge);

using (stateProvider.BeginScope(currentBlock))
{
Expand All @@ -189,14 +191,22 @@ static BlockHeader Process(BranchProcessor auRaBlockProcessor, BlockHeader paren

private (BranchProcessor Processor, IWorldState StateProvider, IBlockTree blockTree) CreateProcessor(ITxFilter? txFilter = null, ContractRewriter? contractRewriter = null)
{
IWorldState stateProvider = TestWorldStateFactory.CreateForTest();
IWorldState stateProvider = TestWorldStateFactory.CreateForTest(parallel: true);
IBlockTree blockTree = Build.A.BlockTree(GnosisSpecProvider.Instance).TestObject;
ITransactionProcessor transactionProcessor = Substitute.For<ITransactionProcessor>();
AuRaBlockProcessor processor = new(
GnosisSpecProvider.Instance,
new AuRaChainSpecEngineParameters(),
TestBlockValidator.AlwaysValid,
NoBlockRewards.Instance,
new BlockProcessor.BlockValidationTransactionsExecutor(new ExecuteTransactionProcessorAdapter(transactionProcessor), stateProvider),
new BlockProcessor.BlockValidationTransactionsExecutor(
stateProvider,
new ExecuteTransactionProcessorAdapter(transactionProcessor),
new BlobBaseFeeCalculator(),
HoodiSpecProvider.Instance,
Substitute.For<IBlockhashProvider>(),
Substitute.For<ICodeInfoRepository>(),
LimboLogs.Instance),
stateProvider,
NullReceiptStorage.Instance,
new BeaconBlockRootHandler(transactionProcessor, stateProvider),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ private sealed class StubBranchProcessor : IBranchProcessor
public event EventHandler<BlockEventArgs>? BlockProcessing;
#pragma warning restore CS0067

public Block[] Process(BlockHeader? baseBlock, IReadOnlyList<Block> suggestedBlocks,
public Task<Block[]> Process(BlockHeader? baseBlock, IReadOnlyList<Block> suggestedBlocks,
ProcessingOptions processingOptions, IBlockTracer blockTracer, CancellationToken token = default)
=> [];
=> Task.FromResult(Array.Empty<Block>());

public void RaiseBlocksProcessing() =>
BlocksProcessing?.Invoke(this, new BlocksProcessingEventArgs([]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void Test_BeaconRootsAccessList_canInsertBeaconRootIsTrue_AccountExists()
{
BlockHeader header = Build.A.BlockHeader.WithNumber(1).WithParentBeaconBlockRoot(Hash256.Zero).TestObject;
Block block = Build.A.Block.WithHeader(header).TestObject;
_worldState.AccountExists(Arg.Any<Address>()).Returns(true);
_worldState.AccountExists(Arg.Any<Address>(), Arg.Any<int?>()).Returns(true);
(_, AccessList? accessList) = _beaconBlockRootHandler
.BeaconRootsAccessList(block, Cancun.Instance, includeStorageCells: true);

Expand All @@ -108,7 +108,7 @@ public void Test_BeaconRootsAccessList_canInsertBeaconRootIsTrue_AccountExists_I
{
BlockHeader header = Build.A.BlockHeader.WithNumber(1).WithParentBeaconBlockRoot(Hash256.Zero).TestObject;
Block block = Build.A.Block.WithHeader(header).TestObject;
_worldState.AccountExists(Arg.Any<Address>()).Returns(true);
_worldState.AccountExists(Arg.Any<Address>(), Arg.Any<int?>()).Returns(true);
(_, AccessList? accessList) = _beaconBlockRootHandler
.BeaconRootsAccessList(block, Cancun.Instance, false);

Expand All @@ -134,7 +134,7 @@ public void Test_StoreBeaconRoot_AccessListNotNull()
BlockHeader header = Build.A.BlockHeader.WithNumber(1).WithParentBeaconBlockRoot(Hash256.Zero).TestObject;
Block block = Build.A.Block.WithHeader(header).TestObject;

_worldState.AccountExists(Arg.Any<Address>()).Returns(true);
_worldState.AccountExists(Arg.Any<Address>(), Arg.Any<int?>()).Returns(true);

_beaconBlockRootHandler.StoreBeaconRoot(block, Cancun.Instance, NullTxTracer.Instance);

Expand Down
39 changes: 23 additions & 16 deletions src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,19 @@ private static (BlockProcessor processor, BranchProcessor branchProcessor, IWorl
IRewardCalculator? rewardCalculator = null,
IBlockCachePreWarmer? preWarmer = null)
{
IWorldState stateProvider = TestWorldStateFactory.CreateForTest();
IWorldState stateProvider = TestWorldStateFactory.CreateForTest(parallel: true);
ITransactionProcessor transactionProcessor = Substitute.For<ITransactionProcessor>();
BlockProcessor processor = new(HoodiSpecProvider.Instance,
TestBlockValidator.AlwaysValid,
rewardCalculator ?? NoBlockRewards.Instance,
new BlockProcessor.BlockValidationTransactionsExecutor(new ExecuteTransactionProcessorAdapter(transactionProcessor), stateProvider),
new BlockProcessor.BlockValidationTransactionsExecutor(
stateProvider,
new ExecuteTransactionProcessorAdapter(transactionProcessor),
new BlobBaseFeeCalculator(),
HoodiSpecProvider.Instance,
Substitute.For<IBlockhashProvider>(),
Substitute.For<ICodeInfoRepository>(),
LimboLogs.Instance),
stateProvider,
NullReceiptStorage.Instance,
new BeaconBlockRootHandler(transactionProcessor, stateProvider),
Expand All @@ -71,13 +78,13 @@ private static (BlockProcessor processor, BranchProcessor branchProcessor, IWorl
}

[Test, MaxTime(Timeout.MaxTestTime)]
public void Prepared_block_contains_author_field()
public async Task Prepared_block_contains_author_field()
{
(_, BranchProcessor branchProcessor, _) = CreateProcessorAndBranch();

BlockHeader header = Build.A.BlockHeader.WithAuthor(TestItem.AddressD).TestObject;
Block block = Build.A.Block.WithHeader(header).TestObject;
Block[] processedBlocks = branchProcessor.Process(
Block[] processedBlocks = await branchProcessor.Process(
null,
new List<Block> { block },
ProcessingOptions.None,
Expand All @@ -87,20 +94,20 @@ public void Prepared_block_contains_author_field()
}

[Test, MaxTime(Timeout.MaxTestTime)]
public void Recovers_state_on_cancel()
public async Task Recovers_state_on_cancel()
{
(_, BranchProcessor branchProcessor, _) = CreateProcessorAndBranch(
rewardCalculator: new RewardCalculator(MainnetSpecProvider.Instance));

BlockHeader header = Build.A.BlockHeader.WithNumber(1).WithAuthor(TestItem.AddressD).TestObject;
Block block = Build.A.Block.WithTransactions(1, MuirGlacier.Instance).WithHeader(header).TestObject;
Assert.Throws<OperationCanceledException>(() => branchProcessor.Process(
Assert.ThrowsAsync<OperationCanceledException>(() => branchProcessor.Process(
null,
new List<Block> { block },
ProcessingOptions.None,
AlwaysCancelBlockTracer.Instance));

Assert.Throws<OperationCanceledException>(() => branchProcessor.Process(
Assert.ThrowsAsync<OperationCanceledException>(() => branchProcessor.Process(
null,
new List<Block> { block },
ProcessingOptions.None,
Expand Down Expand Up @@ -141,7 +148,7 @@ public async Task Process_long_running_branch(int blocksAmount)


[Test, MaxTime(Timeout.MaxTestTime)]
public void TransactionsExecuted_event_fires_during_ProcessOne()
public async Task TransactionsExecuted_event_fires_during_ProcessOne()
{
(BlockProcessor processor, _, IWorldState stateProvider) = CreateProcessorAndBranch();

Expand All @@ -153,21 +160,21 @@ public void TransactionsExecuted_event_fires_during_ProcessOne()
Block block = Build.A.Block.WithHeader(header).TestObject;
IReleaseSpec spec = HoodiSpecProvider.Instance.GetSpec(block.Header);

processor.ProcessOne(block, ProcessingOptions.NoValidation, NullBlockTracer.Instance, spec, CancellationToken.None);
await processor.ProcessOne(block, ProcessingOptions.NoValidation, NullBlockTracer.Instance, spec, CancellationToken.None);

eventFired.Should().BeTrue("TransactionsExecuted should fire after ProcessTransactions completes");
}

[Test, MaxTime(Timeout.MaxTestTime)]
public void BranchProcessor_cancels_prewarmer_via_TransactionsExecuted_event()
public async Task BranchProcessor_cancels_prewarmer_via_TransactionsExecuted_event()
{
TokenCapturingPreWarmer preWarmer = new();
(_, BranchProcessor branchProcessor, _) = CreateProcessorAndBranch(preWarmer: preWarmer);

BlockHeader header = Build.A.BlockHeader.WithAuthor(TestItem.AddressD).TestObject;
Block block = Build.A.Block.WithHeader(header).WithTransactions(3, MuirGlacier.Instance).TestObject;

branchProcessor.Process(
await branchProcessor.Process(
null,
new List<Block> { block },
ProcessingOptions.NoValidation,
Expand All @@ -178,14 +185,14 @@ public void BranchProcessor_cancels_prewarmer_via_TransactionsExecuted_event()
}

[Test, MaxTime(Timeout.MaxTestTime)]
public void BranchProcessor_unsubscribes_from_TransactionsExecuted_after_processing()
public async Task BranchProcessor_unsubscribes_from_TransactionsExecuted_after_processing()
{
(BlockProcessor processor, BranchProcessor branchProcessor, IWorldState stateProvider) = CreateProcessorAndBranch();

BlockHeader header = Build.A.BlockHeader.WithAuthor(TestItem.AddressD).TestObject;
Block block = Build.A.Block.WithHeader(header).TestObject;

branchProcessor.Process(
await branchProcessor.Process(
null,
new List<Block> { block },
ProcessingOptions.NoValidation,
Expand All @@ -201,20 +208,20 @@ public void BranchProcessor_unsubscribes_from_TransactionsExecuted_after_process
using IDisposable scope = stateProvider.BeginScope(null);
Block block2 = Build.A.Block.WithHeader(Build.A.BlockHeader.WithAuthor(TestItem.AddressD).TestObject).TestObject;
IReleaseSpec spec = HoodiSpecProvider.Instance.GetSpec(block2.Header);
processor.ProcessOne(block2, ProcessingOptions.NoValidation, NullBlockTracer.Instance, spec, CancellationToken.None);
await processor.ProcessOne(block2, ProcessingOptions.NoValidation, NullBlockTracer.Instance, spec, CancellationToken.None);

externalHandlerCallCount.Should().Be(1, "only the externally subscribed handler should fire, BranchProcessor should have unsubscribed");
}

[Test, MaxTime(Timeout.MaxTestTime)]
public void BranchProcessor_no_prewarmer_still_processes_successfully()
public async Task BranchProcessor_no_prewarmer_still_processes_successfully()
{
(_, BranchProcessor branchProcessor, _) = CreateProcessorAndBranch(preWarmer: null);

BlockHeader header = Build.A.BlockHeader.WithAuthor(TestItem.AddressD).TestObject;
Block block = Build.A.Block.WithHeader(header).WithTransactions(3, MuirGlacier.Instance).TestObject;

Block[] processedBlocks = branchProcessor.Process(
Block[] processedBlocks = await branchProcessor.Process(
null,
new List<Block> { block },
ProcessingOptions.NoValidation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void AllowToFail(Hash256 hash)
}
}

public Block[] Process(BlockHeader? baseBlock, IReadOnlyList<Block> suggestedBlocks, ProcessingOptions processingOptions, IBlockTracer blockTracer, CancellationToken token)
public Task<Block[]> Process(BlockHeader? baseBlock, IReadOnlyList<Block> suggestedBlocks, ProcessingOptions processingOptions, IBlockTracer blockTracer, CancellationToken token)
{
if (blockTracer != NullBlockTracer.Instance)
{
Expand Down Expand Up @@ -123,7 +123,7 @@ public Block[] Process(BlockHeader? baseBlock, IReadOnlyList<Block> suggestedBlo
else
{
_rootProcessed.Add(suggestedBlocks.Last().StateRoot!);
return suggestedBlocks.ToArray();
return Task.FromResult(suggestedBlocks.ToArray());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Nethermind.Consensus.Processing;
using Nethermind.Core;
using Nethermind.Evm.State;
Expand All @@ -23,9 +24,9 @@ internal class TestBranchProcessor : IBranchProcessor
public event EventHandler<BlocksProcessingEventArgs>? BlocksProcessing { add { } remove { } }
public event EventHandler<BlockEventArgs>? BlockProcessing { add { } remove { } }

public Block[] Process(BlockHeader? baseBlock, IReadOnlyList<Block> suggestedBlocks,
public Task<Block[]> Process(BlockHeader? baseBlock, IReadOnlyList<Block> suggestedBlocks,
ProcessingOptions processingOptions, IBlockTracer blockTracer, CancellationToken token = default)
=> [];
=> Task.FromResult<Block[]>([]);

public void RaiseBlockProcessed(BlockProcessedEventArgs args)
=> BlockProcessed?.Invoke(this, args);
Expand Down
Loading
Loading