Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
394 commits
Select commit Hold shift + click to select a range
5a56c5f
disable warning temporarily
Marchhill Oct 13, 2025
54a00d5
fix block building
Marchhill Oct 13, 2025
32b91d9
add encoding and decoding logs tmp
Marchhill Oct 14, 2025
0c23e49
improve logs for degbugging
Marchhill Oct 14, 2025
b9fba1f
fix bal index for building & decoding index 0
Marchhill Oct 14, 2025
8087b86
reset block access index
Marchhill Oct 14, 2025
cfad062
try to fix invalid hash, add logs
Marchhill Oct 14, 2025
601db9e
remove log
Marchhill Oct 14, 2025
c774422
log encoding balance changes
Marchhill Oct 14, 2025
2668013
try fix ushort decoding, save encoded bal
Marchhill Oct 14, 2025
30b6f29
try fix account changes in wrong order error
Marchhill Oct 14, 2025
96bdd95
coinbase zero transfer edge case
Marchhill Oct 16, 2025
e461a6c
code change max increase
Marchhill Oct 16, 2025
7352691
Merge remote-tracking branch 'upstream/master' into bal-devnet-0
Marchhill Oct 16, 2025
cc7e07c
enforce rlp buffer size limits
Marchhill Oct 16, 2025
36937cd
fix test runners
Marchhill Oct 16, 2025
78d054e
fix restore
Marchhill Oct 17, 2025
074a9e7
fix reverting storage change
Marchhill Oct 17, 2025
81f3d0f
add account read for extcodecopy
Marchhill Oct 17, 2025
bc43434
don't add for extcodecopy when oog
Marchhill Oct 17, 2025
872ff02
fix engine test runner
Marchhill Oct 20, 2025
c3b9447
refactor test runner
Marchhill Oct 20, 2025
f9ff97a
don't record storage change if resets to same value
Marchhill Oct 20, 2025
88ae970
remove storage changes if empty
Marchhill Oct 20, 2025
4023bc2
fix storage changes
Marchhill Oct 21, 2025
77c7130
only add read if write not present
Marchhill Oct 21, 2025
a6081ae
fix error message
Marchhill Oct 21, 2025
41e689d
add changes when resetting to og value
Marchhill Oct 21, 2025
bd76f9d
change comparison, add logging
Marchhill Oct 21, 2025
eb23d61
more logging
Marchhill Oct 21, 2025
e314c75
even more logging
Marchhill Oct 21, 2025
8f5604e
use sequenceequal
Marchhill Oct 21, 2025
689f10c
check for previous code deployed being the same
Marchhill Oct 21, 2025
5536c3d
record more account accesses
Marchhill Oct 22, 2025
8d63f4d
extcodesize
Marchhill Oct 22, 2025
e7b662d
fix tracing
Marchhill Oct 22, 2025
80cadec
remove console logs
Marchhill Oct 23, 2025
23171a3
remove coinbase edge case
Marchhill Oct 31, 2025
d8ac0ea
Merge remote-tracking branch 'upstream/master' into bal-devnet-0-test
Marchhill Nov 6, 2025
fe46806
bpo forks
Marchhill Nov 7, 2025
246ff27
base fee update fractions
Marchhill Nov 7, 2025
359df9c
add bpos to spec name parser
Marchhill Nov 7, 2025
4cb4f45
Merge remote-tracking branch 'upstream' into bal-devnet-0-test
Marchhill Nov 7, 2025
e09553b
change blockchain tests
Marchhill Nov 10, 2025
8f7c3b1
fix setnonce tracing
Marchhill Nov 10, 2025
e4718eb
add storage slot to changes in edge case
Marchhill Nov 10, 2025
e3d4308
generatedblockaccesslist for debugging
Marchhill Nov 11, 2025
b0dd675
add testing log for decoding
Marchhill Nov 11, 2025
1f064b7
try adding sequence length in block encoding
Marchhill Nov 11, 2025
9da9946
try block decoding fix
Marchhill Nov 11, 2025
0730d44
try fix bal json serialisation
Marchhill Nov 11, 2025
d4555b6
refactor
Marchhill Nov 12, 2025
5a4fd75
debug assert fail for unreachable codde
Marchhill Nov 12, 2025
3441a90
remove code change diff check
Marchhill Nov 12, 2025
df5a82d
string encoding use json
Marchhill Nov 12, 2025
692e22b
fix: check count empty when checking if storage changed
Marchhill Nov 12, 2025
afbfee9
Merge remote-tracking branch 'upstream/master' into bal-devnet-0-test-2
Marchhill Nov 24, 2025
47cb345
fix merge
Marchhill Nov 24, 2025
8cf31e6
fix json serialisation
Marchhill Nov 24, 2025
391c817
fix suggested & generated
Marchhill Nov 24, 2025
d38c6ba
fix check code change
Marchhill Nov 24, 2025
6fffe33
blockchain test blob schedule load
Marchhill Nov 24, 2025
d74a4b8
nonce change on account creation
Marchhill Nov 24, 2025
84c1157
debugging logs for blob schedule
Marchhill Nov 25, 2025
befc83a
fix compile
Marchhill Nov 25, 2025
5d98db8
more logs
Marchhill Nov 25, 2025
ebb5b77
try basing amsterdam on osaka
Marchhill Nov 25, 2025
1c76673
undo change
Marchhill Nov 25, 2025
ee35d5f
print HIVE vars
Marchhill Nov 25, 2025
0a066b4
new blobschedule log
Marchhill Nov 25, 2025
7f6ab10
override to 6/9
Marchhill Nov 25, 2025
3fb5f65
check of code has changed during tx
Marchhill Nov 25, 2025
c8ed3d2
include system address balance change
Marchhill Nov 25, 2025
c2b7c0a
fix adding back storage read, handling of system account
Marchhill Nov 25, 2025
e90fce7
undo bpo override
Marchhill Nov 26, 2025
b357c93
move delegation check later call
Marchhill Nov 26, 2025
2063877
remove extra logs
Marchhill Nov 26, 2025
911c4a6
Merge branch 'master' of github.com:NethermindEth/nethermind into bal…
Marchhill Nov 26, 2025
70d2afb
set balance to 0 on selfdestruct
Marchhill Nov 26, 2025
43d2e73
copy generatedbal to suggested block
Marchhill Dec 1, 2025
4c78c3b
Fix cross-block state leak of `_parityTouchBugAccount.ShouldDelete` f…
qu0b Dec 1, 2025
aeb8a73
codecopy fix
Marchhill Dec 4, 2025
01c5761
Merge branch 'bal-devnet-0' of github.com:NethermindEth/nethermind in…
Marchhill Dec 4, 2025
030a214
move generatedBAL to top level
Marchhill Dec 8, 2025
b963b7a
getter for generatedBAL
Marchhill Dec 8, 2025
cb15cef
change storage keys and values to UInt256
Marchhill Dec 16, 2025
5c57c15
fix conversion to uint256
Marchhill Dec 16, 2025
cae8a54
delay charge create gas call
Marchhill Dec 17, 2025
b4ff262
add slot changes if not present on restore
Marchhill Dec 17, 2025
5c0cf14
tidy
Marchhill Dec 17, 2025
86b869c
OOG if not enough gas for self-destruct (#10064)
fselmo Jan 5, 2026
6d4715c
Merge branch 'bal-devnet-1' of github.com:NethermindEth/nethermind in…
Marchhill Jan 5, 2026
58f9442
remove bal from block body
Marchhill Jan 5, 2026
f084da7
bal store
Marchhill Jan 5, 2026
e8bf5fd
add engine api endpoints
Marchhill Jan 5, 2026
c3ec66d
add new handlers
Marchhill Jan 5, 2026
c154bf3
fix DI
Marchhill Jan 6, 2026
46bfcfe
add debug endpoitn
Marchhill Jan 6, 2026
c12c252
make shareable
Marchhill Jan 6, 2026
1f826bc
change attributes
Marchhill Jan 6, 2026
cb83d90
getbal test
Marchhill Jan 6, 2026
6963fed
fix encoding
Marchhill Jan 6, 2026
94519bb
insert in bal store on suggest
Marchhill Jan 6, 2026
342a3f5
move to executionpayloadv4
Marchhill Jan 14, 2026
8447cb3
getpayloadv6
Marchhill Jan 14, 2026
4acd687
osaka engine api version
Marchhill Jan 14, 2026
3c64f20
getpayloadv6 DI
Marchhill Jan 15, 2026
9874c30
use executionpayloadv4 in blockchain tests
Marchhill Jan 20, 2026
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
3db161c
bal builder refactor
Marchhill Jan 30, 2026
20473ca
remove block size validation check
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
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
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
3ac9c84
Merge remote-tracking branch 'upstream/master' into bal-devnet-2-bals…
Marchhill Mar 9, 2026
0fe07a6
fix some commetns
Marchhill Mar 9, 2026
b859b07
inherit invalidblockexception
Marchhill Mar 9, 2026
8357110
move addaccountread to extension, tidy delegation handling
Marchhill Mar 9, 2026
3a7b32b
encapsulate setting bal
Marchhill Mar 9, 2026
57c7244
Merge remote-tracking branch 'upstream/master' into bal-devnet-2-bals…
Marchhill Mar 9, 2026
a21b883
get tests passing
Marchhill Mar 9, 2026
dd11695
Merge remote-tracking branch 'upstream/master' into bal-devnet-2-bals…
Marchhill Mar 9, 2026
aa45ba0
refactor BlockProcessor
LukaszRozmej Mar 9, 2026
bad9013
Merge branch 'bal-devnet-2-bals-only' into bal-devnet-2
Marchhill Mar 9, 2026
4c161ab
Merge branch 'bal-devnet-2-bals-only' into bal-devnet-2
LukaszRozmej Mar 9, 2026
2916abd
fix
LukaszRozmej Mar 9, 2026
7781e41
minor optimization
LukaszRozmej Mar 9, 2026
8bab217
Merge remote-tracking branch 'origin/master' into bal-devnet-2
LukaszRozmej Mar 9, 2026
2fe1341
fix
LukaszRozmej Mar 9, 2026
88799ac
Update src/Nethermind/Nethermind.Core/Extensions/SpanExtensions.cs
LukaszRozmej Mar 9, 2026
5384b70
fix comments
Marchhill Mar 9, 2026
2230bd1
comments
Marchhill Mar 9, 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: 3 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@
"segmentations",
"selfbalance",
"selfdestruct",
"selfdestructs",
"seqlock",
"serialised",
"serialises",
Expand Down Expand Up @@ -728,6 +729,7 @@
"skylake",
"slnx",
"sload",
"slotnum",
"smod",
"somelabel",
"Spmc",
Expand Down Expand Up @@ -856,6 +858,7 @@
"upto",
"upvoting",
"vbmi",
"vectorised",
"verifytrie",
"verkle",
"vitalik",
Expand Down
7 changes: 3 additions & 4 deletions src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ protected async Task<EthereumTestResult> RunTest(BlockchainTest test, Stopwatch?
bool isEngineTest = test.Blocks is null && test.EngineNewPayloads is not null;

List<(ForkActivation Activation, IReleaseSpec Spec)> transitions =
isEngineTest ?
[((ForkActivation)0, test.Network)] :
[((ForkActivation)0, test.GenesisSpec), ((ForkActivation)1, test.Network)]; // genesis block is always initialized with Frontier
isEngineTest ?
[((ForkActivation)0, test.Network)] :
[((ForkActivation)0, test.GenesisSpec), ((ForkActivation)1, test.Network)]; // genesis block is always initialized with Frontier

if (test.NetworkAfterTransition is not null)
{
Expand Down Expand Up @@ -127,7 +127,6 @@ protected async Task<EthereumTestResult> RunTest(BlockchainTest test, Stopwatch?
}

IConfigProvider configProvider = new ConfigProvider();
// configProvider.GetConfig<IBlocksConfig>().PreWarmStateOnBlockProcessing = false;
ContainerBuilder containerBuilder = new ContainerBuilder()
.AddModule(new TestNethermindModule(configProvider))
.AddSingleton(specProvider)
Expand Down
4 changes: 3 additions & 1 deletion src/Nethermind/Ethereum.Test.Base/JsonToEthereumTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public static BlockHeader Convert(TestBlockHeaderJson? headerJson)
headerJson.BlobGasUsed is null ? null : (ulong)Bytes.FromHexString(headerJson.BlobGasUsed).ToUnsignedBigInteger(),
headerJson.ExcessBlobGas is null ? null : (ulong)Bytes.FromHexString(headerJson.ExcessBlobGas).ToUnsignedBigInteger(),
headerJson.ParentBeaconBlockRoot is null ? null : new Hash256(headerJson.ParentBeaconBlockRoot),
headerJson.RequestsHash is null ? null : new Hash256(headerJson.RequestsHash)
headerJson.RequestsHash is null ? null : new Hash256(headerJson.RequestsHash),
headerJson.SlotNumber is null ? null : (ulong)Bytes.FromHexString(headerJson.SlotNumber).ToUnsignedBigInteger()
)
{
Bloom = new Bloom(Bytes.FromHexString(headerJson.Bloom)),
Expand Down Expand Up @@ -119,6 +120,7 @@ public static BlockHeader Convert(TestBlockHeaderJson? headerJson)
ExcessBlobGas = executionPayload.ExcessBlobGas is null ? null : (ulong)Bytes.FromHexString(executionPayload.ExcessBlobGas).ToUnsignedBigInteger(),
ParentBeaconBlockRoot = parentBeaconBlockRoot is null ? null : new(parentBeaconBlockRoot),
Withdrawals = executionPayload.Withdrawals is null ? null : [.. executionPayload.Withdrawals.Select(x => Rlp.Decode<Withdrawal>(Bytes.FromHexString(x)))],
SlotNumber = executionPayload.SlotNumber is null ? null : (ulong)Bytes.FromHexString(executionPayload.SlotNumber).ToUnsignedBigInteger(),
Transactions = [.. executionPayload.Transactions.Select(x => Bytes.FromHexString(x))],
ExecutionRequests = []
}, blobVersionedHashes, validationError, int.Parse(engineNewPayload.NewPayloadVersion ?? "4"), int.Parse(engineNewPayload.ForkChoiceUpdatedVersion ?? "3"));
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Ethereum.Test.Base/TestBlockHeaderJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ public class TestBlockHeaderJson
public string? BlockAccessListHash { get; set; }
public string? BlobGasUsed { get; set; }
public string? ExcessBlobGas { get; set; }
public string? SlotNumber { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class ParamsExecutionPayload
public string[] Transactions { get; set; }
public string[]? Withdrawals { get; set; }
public string? BlockAccessList { get; set; }
public string? SlotNumber { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,41 @@ void AddTxs(int txCount, int blobsPerTx, int account, List<Transaction> txs, ref
[TestCaseSource(nameof(EnoughShardBlobTransactionsSelectedTestCases))]
[TestCaseSource(nameof(BlobTransactionOrderingTestCases))]
public void Proper_transactions_selected(ProperTransactionsSelectedTestCase testCase)
{
IReadOnlyList<Transaction> selectedTransactions = SelectTransactions(testCase);
selectedTransactions.Should()
.BeEquivalentTo(testCase.ExpectedSelectedTransactions, o => o.WithStrictOrdering());
}

[Test]
public void Block_gas_budget_uses_pre_refund_value_for_sender_chain()
{
Transaction first = Build.A.Transaction.WithSenderAddress(TestItem.AddressA).WithNonce(1)
.WithGasPrice(10).WithGasLimit(30_000).SignedAndResolved(TestItem.PrivateKeyA).TestObject;
Transaction second = Build.A.Transaction.WithSenderAddress(TestItem.AddressA).WithNonce(2)
.WithGasPrice(10).WithGasLimit(30_000).SignedAndResolved(TestItem.PrivateKeyA).TestObject;

first.SpentGas = 10_000;
first.BlockGasUsed = 20_000;
second.SpentGas = 10_000;
second.BlockGasUsed = 20_000;

ProperTransactionsSelectedTestCase testCase = new()
{
ReleaseSpec = Berlin.Instance,
BaseFee = 0,
AccountStates = { { TestItem.AddressA, (1_000_000, 1) } },
Transactions = { first, second },
GasLimit = 30_000
};
testCase.ExpectedSelectedTransactions.Add(first);

IReadOnlyList<Transaction> selectedTransactions = SelectTransactions(testCase);
selectedTransactions.Should()
.BeEquivalentTo(testCase.ExpectedSelectedTransactions, o => o.WithStrictOrdering());
}

private static IReadOnlyList<Transaction> SelectTransactions(ProperTransactionsSelectedTestCase testCase)
{
IWorldState stateProvider = TestWorldStateFactory.CreateForTest();
ISpecProvider specProvider = Substitute.For<ISpecProvider>();
Expand Down Expand Up @@ -549,11 +584,7 @@ Dictionary<AddressAsKey, Transaction[]> GroupTransactions(bool supportBlobs) =>
parentHeader = parentHeader.WithExcessBlobGas(0);
}

IEnumerable<Transaction> selectedTransactions =
poolTxSource.GetTransactions(parentHeader.TestObject,
testCase.GasLimit);
selectedTransactions.Should()
.BeEquivalentTo(testCase.ExpectedSelectedTransactions, o => o.WithStrictOrdering());
return poolTxSource.GetTransactions(parentHeader.TestObject, testCase.GasLimit).ToArray();
}

public class ProperTransactionsSelectedTestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
using Nethermind.Consensus.Ethash;
using Nethermind.Consensus.Validators;
using Nethermind.Core;
using Nethermind.Core.BlockAccessLists;
using Nethermind.Core.Crypto;
using Nethermind.Core.Specs;
using Nethermind.Core.Test;
using Nethermind.Core.Test.Builders;
using Nethermind.Crypto;
using Nethermind.Int256;
using Nethermind.Logging;
using Nethermind.Serialization.Rlp;
using Nethermind.Specs;
using Nethermind.Specs.Forks;
using Nethermind.Specs.Test;
Expand Down Expand Up @@ -143,6 +145,52 @@ public void When_timestamp_same_as_parent()
Assert.That(result, Is.False);
}

[Test, MaxTime(Timeout.MaxTestTime)]
public void When_slot_number_same_as_parent()
{
// Arrange: Same setup as above
TestSpecProvider specProvider = new(Amsterdam.Instance);
_validator = new HeaderValidator(_blockTree, Always.Valid, specProvider,
new OneLoggerLogManager(new(_testLogger)));

BlockAccessList emptyBal = new();
byte[] emptyEncodedBal = Rlp.Encode(emptyBal).Bytes;
_parentBlock = Build.A.Block
.WithNumber(5)
.WithSlotNumber(10)
.WithBlobGasUsed(0)
.WithExcessBlobGas(0)
.WithEmptyRequestsHash()
.WithBlockAccessList(emptyBal)
.WithEncodedBlockAccessList(emptyEncodedBal)
.WithBlockAccessListHash(Keccak.OfAnEmptySequenceRlp)
.TestObject;

_block = Build.A.Block
.WithParent(_parentBlock)
.WithNumber(_parentBlock.Number + 1)
.WithSlotNumber(10)
.WithBlobGasUsed(0)
.WithExcessBlobGas(0)
.WithEmptyRequestsHash()
.WithBlockAccessList(emptyBal)
.WithBlockAccessListHash(Keccak.OfAnEmptySequenceRlp)
.WithEncodedBlockAccessList(emptyEncodedBal)
.TestObject;

_block.Header.Hash = _block.CalculateHash();

// Act
bool result = _validator.Validate(_block.Header, _parentBlock.Header, false, out string? error);

using (Assert.EnterMultipleScope())
{
// Assert
Assert.That(result, Is.False);
Assert.That(error, Is.EqualTo("InvalidSlotNumber: Slot number in header must exceed parent."));
}
}

[Test, MaxTime(Timeout.MaxTestTime)]
public void When_extra_data_too_long()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class AccessTxTracer(params Address[] addressesToOptimize) : TxTracer
public override bool IsTracingReceipt => true;
public override bool IsTracingAccess => true;

public override void MarkAsSuccess(Address recipient, GasConsumed gasSpent, byte[] output, LogEntry[] logs,
public override void MarkAsSuccess(Address recipient, in GasConsumed gasSpent, byte[] output, LogEntry[] logs,
Hash256? stateRoot = null)
{
GasSpent += gasSpent.SpentGas;
}

public override void MarkAsFailed(Address recipient, GasConsumed gasSpent, byte[] output, string? error,
public override void MarkAsFailed(Address recipient, in GasConsumed gasSpent, byte[] output, string? error,
Hash256? stateRoot = null)
{
GasSpent += gasSpent.SpentGas;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public static AlwaysCancelTxTracer Instance
public bool IsTracingFees => true;
public bool IsTracingLogs => true;

public void MarkAsSuccess(Address recipient, GasConsumed gasSpent, byte[] output, LogEntry[] logs, Hash256? stateRoot = null) => throw new OperationCanceledException(ErrorMessage);
public void MarkAsSuccess(Address recipient, in GasConsumed gasSpent, byte[] output, LogEntry[] logs, Hash256? stateRoot = null) => throw new OperationCanceledException(ErrorMessage);

public void MarkAsFailed(Address recipient, GasConsumed gasSpent, byte[] output, string? error, Hash256? stateRoot = null) => throw new OperationCanceledException(ErrorMessage);
public void MarkAsFailed(Address recipient, in GasConsumed gasSpent, byte[] output, string? error, Hash256? stateRoot = null) => throw new OperationCanceledException(ErrorMessage);

public void StartOperation(int pc, Instruction opcode, long gas, in ExecutionEnvironment env, int codeSection = 0, int functionDepth = 0) => throw new OperationCanceledException(ErrorMessage);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Nethermind.Core;
using Nethermind.Core.Crypto;
Expand Down Expand Up @@ -33,9 +34,9 @@ public class BlockReceiptsTracer : IBlockTracer, ITxTracer, IJournal<int>, ITxTr
public bool IsTracingFees => _currentTxTracer.IsTracingFees;
public bool IsTracingLogs => _currentTxTracer.IsTracingLogs;

public void MarkAsSuccess(Address recipient, GasConsumed gasSpent, byte[] output, LogEntry[] logs, Hash256? stateRoot = null)
public void MarkAsSuccess(Address recipient, in GasConsumed gasSpent, byte[] output, LogEntry[] logs, Hash256? stateRoot = null)
{
_txReceipts.Add(BuildReceipt(recipient, gasSpent.SpentGas, StatusCode.Success, logs, stateRoot));
_txReceipts.Add(BuildReceipt(recipient, gasSpent, StatusCode.Success, logs, stateRoot));

// hacky way to support nested receipt tracers
if (_otherTracer is ITxTracer otherTxTracer)
Expand All @@ -49,9 +50,9 @@ public void MarkAsSuccess(Address recipient, GasConsumed gasSpent, byte[] output
}
}

public void MarkAsFailed(Address recipient, GasConsumed gasSpent, byte[] output, string? error, Hash256? stateRoot = null)
public void MarkAsFailed(Address recipient, in GasConsumed gasSpent, byte[] output, string? error, Hash256? stateRoot = null)
{
_txReceipts.Add(BuildFailedReceipt(recipient, gasSpent.SpentGas, error, stateRoot));
_txReceipts.Add(BuildFailedReceipt(recipient, gasSpent, error, stateRoot));

// hacky way to support nested receipt tracers
if (_otherTracer is ITxTracer otherTxTracer)
Expand All @@ -65,28 +66,51 @@ public void MarkAsFailed(Address recipient, GasConsumed gasSpent, byte[] output,
}
}

protected TxReceipt BuildFailedReceipt(Address recipient, long gasSpent, string error, Hash256? stateRoot)
protected TxReceipt BuildFailedReceipt(Address recipient, in GasConsumed gasSpent, string error, Hash256? stateRoot)
{
TxReceipt receipt = BuildReceipt(recipient, gasSpent, StatusCode.Failure, [], stateRoot);
receipt.Error = error;
return receipt;
}

protected virtual TxReceipt BuildReceipt(Address recipient, long spentGas, byte statusCode, LogEntry[] logEntries, Hash256? stateRoot)
/// <summary>
/// Updates cumulative gas tracking for both block and receipt accounting.
/// EIP-7778: Block gas uses pre-refund values for gas limit accounting,
/// while receipt gas uses post-refund values (what users actually pay).
/// </summary>
/// <returns>The cumulative post-refund gas for receipts</returns>
protected long UpdateCumulativeGasTracking(in GasConsumed gasConsumed)
{
// Track cumulative block gas for restore (pre-refund)
long cumulativeBlockGas = (_cumulativeBlockGasPerTx.Count > 0 ? _cumulativeBlockGasPerTx[^1] : 0) + gasConsumed.EffectiveBlockGas;
_cumulativeBlockGasPerTx.Add(cumulativeBlockGas);

// Track cumulative receipt gas (post-refund)
_cumulativeReceiptGas += gasConsumed.SpentGas;

Debug.Assert(_txReceipts.Count + 1 == _cumulativeBlockGasPerTx.Count,
"Receipt and gas tracking lists must remain synchronized");

return _cumulativeReceiptGas;
}

protected virtual TxReceipt BuildReceipt(Address recipient, in GasConsumed gasConsumed, byte statusCode, LogEntry[] logEntries, Hash256? stateRoot)
{
long cumulativeReceiptGas = UpdateCumulativeGasTracking(gasConsumed);

Transaction transaction = CurrentTx!;
TxReceipt txReceipt = new()
{
Logs = logEntries,
TxType = transaction.Type,
// Bloom calculated in parallel with other receipts
GasUsedTotal = Block.GasUsed,
GasUsedTotal = cumulativeReceiptGas, // Post-refund cumulative
StatusCode = statusCode,
Recipient = transaction.IsContractCreation ? null : recipient,
BlockHash = Block.Hash,
BlockNumber = Block.Number,
Index = _currentIndex,
GasUsed = spentGas,
GasUsed = gasConsumed.SpentGas, // Post-refund for this tx
Sender = transaction.SenderAddress,
ContractAddress = transaction.IsContractCreation ? recipient : null,
TxHash = transaction.Hash,
Expand Down Expand Up @@ -198,6 +222,8 @@ public void ReportFees(UInt256 fees, UInt256 burntFees)
private ITxTracer _currentTxTracer = NullTxTracer.Instance;
protected int _currentIndex { get; private set; }
private readonly List<TxReceipt> _txReceipts = new();
private readonly List<long> _cumulativeBlockGasPerTx = new(); // Track pre-refund block gas for restore
private long _cumulativeReceiptGas; // Track cumulative post-refund gas for receipts
protected Transaction? CurrentTx;
public ReadOnlySpan<TxReceipt> TxReceipts => CollectionsMarshal.AsSpan(_txReceipts);
public TxReceipt LastReceipt => _txReceipts[^1];
Expand All @@ -210,13 +236,20 @@ public void ReportFees(UInt256 fees, UInt256 burntFees)
public void Restore(int snapshot)
{
int numToRemove = _txReceipts.Count - snapshot;

for (int i = 0; i < numToRemove; i++)
if (numToRemove > 0)
{
_txReceipts.RemoveAt(_txReceipts.Count - 1);
_txReceipts.RemoveRange(snapshot, numToRemove);
_cumulativeBlockGasPerTx.RemoveRange(snapshot, numToRemove);
}

Block.Header.GasUsed = _txReceipts.Count > 0 ? _txReceipts[^1].GasUsedTotal : 0;
Debug.Assert(_txReceipts.Count == _cumulativeBlockGasPerTx.Count,
"Receipt and gas tracking lists must remain synchronized after restore");

// Restore block gas from tracking (pre-refund)
Block.Header.GasUsed = _cumulativeBlockGasPerTx.Count > 0 ? _cumulativeBlockGasPerTx[^1] : 0;

// Restore receipt gas from remaining receipts (post-refund)
_cumulativeReceiptGas = _txReceipts.Count > 0 ? _txReceipts[^1].GasUsedTotal : 0;
}

public void ReportReward(Address author, string rewardType, UInt256 rewardValue) =>
Expand All @@ -227,6 +260,8 @@ public void StartNewBlockTrace(Block block)
Block = block;
_currentIndex = 0;
_txReceipts.Clear();
_cumulativeBlockGasPerTx.Clear();
_cumulativeReceiptGas = 0;

_otherTracer.StartNewBlockTrace(block);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CallOutputTracer : TxTracer

public byte StatusCode { get; set; }

public override void MarkAsSuccess(Address recipient, GasConsumed gasSpent, byte[] output, LogEntry[] logs,
public override void MarkAsSuccess(Address recipient, in GasConsumed gasSpent, byte[] output, LogEntry[] logs,
Hash256? stateRoot = null)
{
GasSpent = gasSpent.SpentGas;
Expand All @@ -29,7 +29,7 @@ public override void MarkAsSuccess(Address recipient, GasConsumed gasSpent, byte
StatusCode = Evm.StatusCode.Success;
}

public override void MarkAsFailed(Address recipient, GasConsumed gasSpent, byte[] output, string? error,
public override void MarkAsFailed(Address recipient, in GasConsumed gasSpent, byte[] output, string? error,
Hash256? stateRoot = null)
{
GasSpent = gasSpent.SpentGas;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public EstimateGasTracer()

public bool TopLevelRevert { get; private set; }

public override void MarkAsSuccess(Address recipient, GasConsumed gasSpent, byte[] output, LogEntry[] logs,
public override void MarkAsSuccess(Address recipient, in GasConsumed gasSpent, byte[] output, LogEntry[] logs,
Hash256? stateRoot = null)
{
GasSpent = gasSpent.SpentGas;
ReturnValue = output;
StatusCode = Evm.StatusCode.Success;
}

public override void MarkAsFailed(Address recipient, GasConsumed gasSpent, byte[] output, string? error,
public override void MarkAsFailed(Address recipient, in GasConsumed gasSpent, byte[] output, string? error,
Hash256? stateRoot = null)
{
GasSpent = gasSpent.SpentGas;
Expand Down
Loading
Loading