Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flat encoding and requests as a side car #7557

Merged
merged 598 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
598 commits
Select commit Hold shift + click to select a range
0dcfb3d
Merge branch 'master' into feature/eip-7702
ak88 Jun 24, 2024
0a8346b
removed test
ak88 Jun 24, 2024
e25a17c
Merge branch 'feature/eip-7702' of https://github.com/NethermindEth/n…
ak88 Jun 24, 2024
a869907
update rlp decoding
Jun 25, 2024
e2fb74d
authorizationtuple being nullable
Jun 25, 2024
c062402
unittest fix
ak88 Jun 25, 2024
d40c3c0
Merge branch 'master' into feature/eip-7702
ak88 Jun 25, 2024
949f5a8
Rlp decoder changes
ak88 Jun 25, 2024
12297d4
refactor
ak88 Jun 26, 2024
21c06a7
txpool test fix
ak88 Jun 26, 2024
1926da9
missing
ak88 Jun 26, 2024
18a8951
Rlp unitest
ak88 Jun 26, 2024
7702fa4
some basic refactorings
LukaszRozmej Jun 27, 2024
ef3370d
simplified refactor and RLP fix
ak88 Jun 27, 2024
05ea012
format whitespace
ak88 Jun 27, 2024
06e48c9
cleanup
ak88 Jun 27, 2024
bbd956a
cleanup and review comments
ak88 Jun 27, 2024
0b182c8
fix for old tx tests
ak88 Jun 27, 2024
ca22d59
removed unused field
ak88 Jun 28, 2024
6218545
CodeInfoRepository passing refactor
LukaszRozmej Jun 28, 2024
35276b6
simplify code
LukaszRozmej Jun 28, 2024
ff5a88d
refactor and recover authority in tx pool
ak88 Jun 28, 2024
7efa123
unit test fix
ak88 Jun 29, 2024
3daf9fb
bad sig will skip and not throw
ak88 Jul 3, 2024
eb84a1d
eip 7702 timestamp
ak88 Jul 24, 2024
182b67b
set the actual value of IsEip7702Enabled
smartprogrammer93 Jul 24, 2024
3ff6605
add test tp chainspec tests to make sure it is loaded
smartprogrammer93 Jul 24, 2024
050fe47
Validate nonce then increment after 7702
ak88 Jul 27, 2024
78a82b5
decode rlp auth list fix
ak88 Jul 31, 2024
9b189d4
Resolved all conflicts
MarekM25 Sep 12, 2024
ff9e4cd
fix whitespaces
MarekM25 Sep 12, 2024
8557a10
fix benchmarks.sln build
MarekM25 Sep 12, 2024
03e4997
fix tests
MarekM25 Sep 12, 2024
be5acf1
fix tests
MarekM25 Sep 12, 2024
b7546f3
fix tests
MarekM25 Sep 13, 2024
45e44cf
Prague: Add support for getPayloadBodiesBy Hash + Range (#7133)
rjnrohit Jun 25, 2024
f4db109
Resolved payload bodies
MarekM25 Sep 13, 2024
5f2434c
Removed log message
MarekM25 Sep 13, 2024
d7d0c04
Cleanup the branch
MarekM25 Sep 13, 2024
51c1701
Cleanup
MarekM25 Sep 13, 2024
eebac4f
minor refactor
smartprogrammer93 Sep 14, 2024
c8434ab
Reduce allocation + minors + optimize `ToULongFromBigEndianByteArrayW…
smartprogrammer93 Sep 14, 2024
b653664
fix
smartprogrammer93 Sep 14, 2024
0abb556
Update src/Nethermind/Nethermind.State/Proofs/RequestsTrie.cs
smartprogrammer93 Sep 14, 2024
01deb2a
Update src/Nethermind/Nethermind.Specs/ReleaseSpec.cs
smartprogrammer93 Sep 14, 2024
7d106ea
Merge branch 'master' into pectra_eips
smartprogrammer93 Sep 14, 2024
3d5bde2
fix whitespace and build issue
smartprogrammer93 Sep 14, 2024
2a60176
fix test
smartprogrammer93 Sep 14, 2024
aa0196b
Resolved conflicts
MarekM25 Sep 16, 2024
3e156c9
spec changes start
ak88 Aug 16, 2024
ceeee20
revert nonce increments
ak88 Aug 16, 2024
d4e3298
intrinsic gas
ak88 Aug 16, 2024
58da91d
cherry-picking
MarekM25 Sep 16, 2024
129f134
build fix
ak88 Aug 19, 2024
0237c49
fx unittest
ak88 Aug 20, 2024
2e8eddb
spec changes
ak88 Aug 22, 2024
da3e3bd
unit tests
ak88 Aug 22, 2024
7f7e2ee
Merge branch 'pectra' into feature/eip-7702
ak88 Aug 22, 2024
8badf7d
Build fix
ak88 Aug 22, 2024
3be0b1c
change nonce to ulong
ak88 Aug 22, 2024
ac4fd87
refactor ChargeAccountAccessGas
ak88 Aug 24, 2024
bdf56f9
gas fixes and bug
ak88 Aug 26, 2024
61d59f7
merge fix
ak88 Aug 27, 2024
b5cea7a
build fix
ak88 Aug 28, 2024
403207a
refactor txprocessor to using accessed addresses
ak88 Aug 29, 2024
bdc4dc0
fix
ak88 Sep 1, 2024
93159d2
encoder fix
ak88 Sep 2, 2024
bbc81a4
test strg
ak88 Sep 2, 2024
cb6ac2d
fix extcodehash
ak88 Sep 2, 2024
5301b89
7702 refunds
ak88 Sep 3, 2024
29257b2
Use uint256 for sig values
ak88 Sep 4, 2024
aef10ce
state test fix for auth list
ak88 Sep 4, 2024
9b9eb2e
validate auth sig in txvalidator
ak88 Sep 4, 2024
1053f7a
Revert "Use uint256 for sig values"
ak88 Sep 4, 2024
51856ad
unittest fixes
ak88 Sep 4, 2024
8335b61
unique check auth sig validity
ak88 Sep 4, 2024
d5b8037
test cleanup
ak88 Sep 4, 2024
e996c17
unittest fix
ak88 Sep 4, 2024
2ce9f73
do not allow empty auth list
ak88 Sep 5, 2024
2da8111
tx pool check if sender is delegation
ak88 Sep 5, 2024
22152a8
unittest for TxPool
ak88 Sep 6, 2024
904bdb6
modified hive.json for debugging
MarekM25 Sep 9, 2024
b6f2563
hive test cfg
ak88 Sep 9, 2024
6a77929
cleanup
ak88 Sep 9, 2024
2f1e85c
Auth list in RPC
ak88 Sep 9, 2024
d59d3fa
fix, disallow create tx in SetCode tx type
smartprogrammer93 Sep 10, 2024
189e566
fix chainid
ak88 Sep 12, 2024
0f388d1
revert temp path too long fix
ak88 Sep 12, 2024
c938923
small refactors
LukaszRozmej Sep 16, 2024
291ba9b
more basic refactors and cleanups
LukaszRozmej Sep 16, 2024
046fb36
Resolved conflicts
MarekM25 Sep 17, 2024
a0dbd21
Solving errors
MarekM25 Sep 17, 2024
7ec64d2
Builds error solved
MarekM25 Sep 17, 2024
7baea0b
Resolved conflicts
MarekM25 Sep 17, 2024
3e8726e
fix build errors
MarekM25 Sep 17, 2024
0db830c
cherry pick missing from 7702
ak88 Sep 17, 2024
b90b883
fix whitespaces
MarekM25 Sep 17, 2024
4532047
fix merge tests
MarekM25 Sep 17, 2024
93a7c75
cosmetic
MarekM25 Sep 17, 2024
a739b22
Null handling for requests
MarekM25 Sep 17, 2024
fa10981
tx decoder for setcode
ak88 Sep 17, 2024
7aa7aa8
RPC module tests for 7702
ak88 Sep 11, 2024
c9c1afc
cleanup after missing commit
ak88 Sep 17, 2024
5ac555e
tx validator for setcode refactor
ak88 Sep 18, 2024
7b5f627
fix tests
MarekM25 Sep 18, 2024
2953bca
cosmetic
MarekM25 Sep 18, 2024
f3c2c52
fix whitespace?
MarekM25 Sep 18, 2024
76b8b6f
whitespace?
MarekM25 Sep 18, 2024
540b86c
fix test
MarekM25 Sep 18, 2024
ce64d97
cosmetic
MarekM25 Sep 18, 2024
66bd24e
fix test
MarekM25 Sep 18, 2024
6465805
fix tx pool tests
ak88 Sep 18, 2024
958df8a
use BlockchainId instead
ak88 Sep 18, 2024
3f5e57b
unnecessary using
ak88 Sep 18, 2024
4c564b3
use BlockchainId instead
ak88 Sep 18, 2024
98d5277
Resolved conflicts with payload bodies
MarekM25 Sep 18, 2024
e39c754
Merge branch 'pectra_fix_7702_after_merge' of https://github.com/neth…
MarekM25 Sep 18, 2024
ff823b0
revert proof module
MarekM25 Sep 18, 2024
2653613
fix one more test
MarekM25 Sep 18, 2024
1857a61
fix whitespace
MarekM25 Sep 18, 2024
95fb7fa
whitespaces?
MarekM25 Sep 18, 2024
5c41d0a
fix whitespace
MarekM25 Sep 18, 2024
e8c1782
?fix
MarekM25 Sep 18, 2024
e8011ff
fix
MarekM25 Sep 18, 2024
28839a9
fix Evm.Test
MarekM25 Sep 18, 2024
63e262c
fix
MarekM25 Sep 18, 2024
2fac622
use SpecProvider.ChainId in test
ak88 Sep 18, 2024
6018e7d
Merge branch 'pectra_fix_7702_after_merge' of https://github.com/Neth…
ak88 Sep 18, 2024
d4b36c5
small refactor TransactionProcessorEip7702Tests
ak88 Sep 18, 2024
f3301ad
ignore authorization list if null TransactionForRpc
ak88 Sep 18, 2024
e7a91a2
fix SimulateReadOnlyBlocksProcessingEnv
ak88 Sep 18, 2024
51a63dd
fix EthModuleBenchmarks
ak88 Sep 18, 2024
ed6b5bf
remove unnecessary ?
LukaszRozmej Sep 19, 2024
a249a58
Move engine_getPayloadBodiesByHash to IHandler, no Async needed
LukaszRozmej Sep 19, 2024
b298026
syntatic suggar
LukaszRozmej Sep 19, 2024
638fd41
Merge branch 'master' into pectra_eips
MarekM25 Sep 19, 2024
a911023
Merge branch 'pectra_eips' into pectra_payload_bodies
MarekM25 Sep 19, 2024
bc5130b
Consensus requests change class structure
MarekM25 Sep 19, 2024
d29ca4d
one more field
MarekM25 Sep 19, 2024
1518f27
class to abstract
MarekM25 Sep 19, 2024
3acb335
Review fixes
MarekM25 Sep 19, 2024
650630e
Resolved conflicts
MarekM25 Sep 19, 2024
53043ad
extra test for refunds
ak88 Sep 19, 2024
d3197ec
some cosmetic changes
MarekM25 Sep 19, 2024
15040c9
Merge branch 'pectra_fix_7702_after_merge' of https://github.com/neth…
MarekM25 Sep 19, 2024
4e71d9a
Test null address
ak88 Sep 19, 2024
3361a63
remove unused
ak88 Sep 20, 2024
45bf7bd
enginemoduletest
ak88 Sep 20, 2024
28a0f7c
improve recoversignatures
ak88 Sep 20, 2024
026de88
Merge branch 'new_test' into pectra_fix_7702_after_merge
ak88 Sep 20, 2024
aec7e85
fix test
ak88 Sep 20, 2024
5e59935
if sender recovered from pool also set authority
ak88 Sep 20, 2024
54a59ba
Apply suggestions from code review
ak88 Sep 20, 2024
9c3ec4d
cosmetic
ak88 Sep 20, 2024
6d90306
Merge branch 'pectra_fix_7702_after_merge' of https://github.com/Neth…
ak88 Sep 20, 2024
7f48fd6
a few optimizations
MarekM25 Sep 20, 2024
552b704
Merge branch 'pectra_fix_7702_after_merge' of https://github.com/neth…
MarekM25 Sep 20, 2024
7da0be0
fix
MarekM25 Sep 20, 2024
18a3e0e
cosmetic
MarekM25 Sep 20, 2024
58ae212
cosmetic
MarekM25 Sep 23, 2024
c35e4ea
Resolved conflicts
MarekM25 Sep 23, 2024
581321d
cosmetic cleanup
ak88 Sep 23, 2024
43a99b2
cosmetic
ak88 Sep 24, 2024
757d06f
removed metric
ak88 Sep 24, 2024
1aa8096
cosmetic
MarekM25 Sep 25, 2024
65f06e2
Merge branch 'pectra_fix_7702_after_merge' of https://github.com/neth…
MarekM25 Sep 25, 2024
d124cf7
small optimization
ak88 Sep 25, 2024
f3bce87
small changes from review
ak88 Sep 25, 2024
0e23a9e
changes around CodeInfoRepository
LukaszRozmej Sep 26, 2024
e66c64c
Update src/Nethermind/Nethermind.Evm/CodeInfoRepository.cs
LukaszRozmej Sep 26, 2024
667e168
Update src/Nethermind/Nethermind.Evm/CodeInfoRepository.cs
LukaszRozmej Sep 26, 2024
42ab153
Update src/Nethermind/Nethermind.Consensus/Validators/TxValidator.cs
LukaszRozmej Sep 26, 2024
085fa42
Update src/Nethermind/Nethermind.Consensus/Validators/TxValidator.cs
LukaszRozmej Sep 26, 2024
a7dd3d9
Update src/Nethermind/Nethermind.Evm/VirtualMachine.cs
LukaszRozmej Sep 26, 2024
0b8062f
Update src/Nethermind/Nethermind.Facade/Eth/TransactionForRpc.cs
LukaszRozmej Sep 26, 2024
49105d2
Update src/Nethermind/Nethermind.State/IReadOnlyStateProviderExtensio…
LukaszRozmej Sep 26, 2024
110a5b8
fixes
LukaszRozmej Sep 26, 2024
c4b083d
avoid newing HashSet
ak88 Sep 26, 2024
1c69596
add NoContractCreationTxValidator, change SetCodeTxValidator to Autho…
LukaszRozmej Sep 26, 2024
8729021
Move code to value hashes
LukaszRozmej Sep 26, 2024
407effa
ReadConsolidationRequests reorder params to have consistency
LukaszRozmej Sep 26, 2024
a7035ce
simplify IntrinsicGasCalculator
LukaszRozmej Sep 26, 2024
d0dd643
simplify AccessListCost
LukaszRozmej Sep 26, 2024
295854f
grab TxExecutionContext by reference
LukaszRozmej Sep 26, 2024
c323bae
Invert VM condition for readability
LukaszRozmej Sep 26, 2024
900ac8b
Simplify RecoverAuthorityFilter
LukaszRozmej Sep 26, 2024
141c565
fix AuthorizationTupleDecoder
LukaszRozmej Sep 26, 2024
8607c8e
remove IRlpObjectDecoder<ConsolidationRequest>
LukaszRozmej Sep 26, 2024
b998979
bring back exceptions in IntrinsicGasCalculator
LukaszRozmej Sep 26, 2024
6a6db8b
fix
LukaszRozmej Sep 26, 2024
794f6da
fix
LukaszRozmej Sep 26, 2024
5f714d1
More CodeInfoRepository changes
LukaszRozmej Sep 26, 2024
fbc6822
More renames
LukaszRozmej Sep 26, 2024
cbde5c8
More refactors
LukaszRozmej Sep 26, 2024
2a9da1c
fixes
LukaszRozmej Sep 26, 2024
254ff42
changes from review
ak88 Sep 27, 2024
76129ad
decoder netty fix
ak88 Sep 27, 2024
70a3390
also check auth sig in recovery
ak88 Sep 27, 2024
ab855fb
move sign func to extension
ak88 Sep 28, 2024
e28f666
changes from review
ak88 Sep 30, 2024
2963ac2
fix tests
ak88 Oct 1, 2024
1be004e
refactor codeinforepo test
ak88 Oct 2, 2024
eeb4ff9
base class for processors
ak88 Sep 30, 2024
096fb43
Merge branch 'master' into pectra_fix_7702_after_merge
ak88 Oct 2, 2024
facba02
merge fix
ak88 Oct 2, 2024
60348e2
comment correction
ak88 Oct 2, 2024
e4c49d3
Merge branch 'master' into pectra_fix_7702_after_merge
ak88 Oct 2, 2024
86c9df2
format whitespace
ak88 Oct 2, 2024
cd151cc
benchmark fix
ak88 Oct 2, 2024
347a63a
small test change
ak88 Oct 2, 2024
0087008
Merge branch 'master' into pectra_fix_7702_after_merge
MarekM25 Oct 3, 2024
464deeb
Update src/Nethermind/Nethermind.Consensus/Processing/RecoverSignatur…
ak88 Oct 4, 2024
59a1ae2
Update src/Nethermind/Nethermind.Consensus/Processing/RecoverSignatur…
ak88 Oct 4, 2024
4b51139
Update src/Nethermind/Nethermind.Consensus/Processing/RecoverSignatur…
ak88 Oct 4, 2024
9f01cf2
review changes
ak88 Oct 4, 2024
0800ee3
use existing nulltxpool
ak88 Oct 4, 2024
7b51ea1
format
ak88 Oct 4, 2024
03db79c
cosmetic
ak88 Oct 4, 2024
86d8135
add flat encoding and requests as a side car
rjnrohit Oct 5, 2024
0d3aabe
Merge branch 'prague/devnet4' into flat_requests
rjnrohit Oct 5, 2024
28577ad
fix build error
rjnrohit Oct 5, 2024
f417572
fix more build error
rjnrohit Oct 5, 2024
ab9ca8e
more build errors
rjnrohit Oct 5, 2024
e085509
more build errors
rjnrohit Oct 5, 2024
aeba2a9
add requests to executionPayloadParams
rjnrohit Oct 5, 2024
db27172
ensure requests are in sorted order
rjnrohit Oct 5, 2024
8120251
add executionRequests processor tests
rjnrohit Oct 6, 2024
f97aa5a
make executionRequests optional
rjnrohit Oct 6, 2024
fafb812
fix test errors
rjnrohit Oct 7, 2024
26cb98e
format files
rjnrohit Oct 7, 2024
e2bfb69
remove Build.Deposit.cs
rjnrohit Oct 7, 2024
5bd226a
remove Build.WithdrawalRequest.cs
rjnrohit Oct 7, 2024
9ab33a1
requestsRoot -> requestsHash
rjnrohit Oct 7, 2024
23cba3c
remove test from block validator
rjnrohit Oct 7, 2024
47d94d4
remove undef ref
rjnrohit Oct 7, 2024
c92705d
fix cast error
rjnrohit Oct 7, 2024
5636cda
fix test build error
rjnrohit Oct 8, 2024
d2c0473
fix requests in Aura Test
rjnrohit Oct 8, 2024
f97a524
fix hash scheme
rjnrohit Oct 8, 2024
548ad77
Update root calculation
rjnrohit Oct 9, 2024
1c72a4e
move requestHash calc
rjnrohit Oct 9, 2024
b04c9f9
fix consensus test
rjnrohit Oct 9, 2024
465cbdf
fix ci tests
rjnrohit Oct 9, 2024
4e01f92
format files
rjnrohit Oct 9, 2024
c9cd867
remove signature changes
rjnrohit Oct 9, 2024
a87a144
optimise executionRequestProcessor
rjnrohit Oct 9, 2024
5bd0edf
address few comments
rjnrohit Oct 15, 2024
dc6dfec
Merge branch 'pectra_devnet_4' into prague/devnet4
rjnrohit Oct 15, 2024
0f29bbf
Merge branch 'prague/devnet4' into flat_requests
rjnrohit Oct 15, 2024
bb41884
fix address error
rjnrohit Oct 15, 2024
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
2 changes: 1 addition & 1 deletion src/Nethermind/Ethereum.Test.Base/GeneralStateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class GeneralStateTest : IEthereumTest
public UInt256? ParentBlobGasUsed { get; set; }
public UInt256? ParentExcessBlobGas { get; set; }

public Hash256? RequestsRoot { get; set; }
public Hash256? RequestsHash { get; set; }

public override string ToString()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Ethereum.Test.Base/GeneralTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected EthereumTestResult RunTest(GeneralStateTest test, ITxTracer txTracer)
header.ParentBeaconBlockRoot = test.CurrentBeaconRoot;
header.ExcessBlobGas = test.CurrentExcessBlobGas ?? (test.Fork is Cancun ? 0ul : null);
header.BlobGasUsed = BlobGasCalculator.CalculateBlobGas(test.Transaction);
header.RequestsRoot = test.RequestsRoot;
header.RequestsHash = test.RequestsHash;

Stopwatch stopwatch = Stopwatch.StartNew();
IReleaseSpec? spec = specProvider.GetSpec((ForkActivation)test.CurrentNumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: LGPL-3.0-only

using Nethermind.Consensus.Validators;
using Nethermind.Core.ConsensusRequests;
using Nethermind.Core;
using Nethermind.Core.Crypto;
using Nethermind.Core.Specs;
Expand Down Expand Up @@ -199,51 +198,4 @@ public void ValidateSuggestedBlock_SuggestedBlockIsInvalid_CorrectErrorIsSet(Blo

Assert.That(error, Does.StartWith(expectedError));
}

[Test]
public void ValidateBodyAgainstHeader_BlockHasInvalidRequestRoot_ReturnsFalse()
{
Block block = Build.A.Block
.WithConsensusRequests(new ConsensusRequest[] {
Build.A.Deposit.WithIndex(0).TestObject,
Build.A.WithdrawalRequest.TestObject
})
.TestObject;
block.Header.RequestsRoot = Keccak.OfAnEmptyString;

Assert.That(
BlockValidator.ValidateBodyAgainstHeader(block.Header, block.Body),
Is.False);
}

[Test]
public void ValidateBodyRequests_BlockHasReuests_InOrder_ReturnsTrue()
{
Block block = Build.A.Block
.WithConsensusRequests(new ConsensusRequest[] {
Build.A.Deposit.WithIndex(0).TestObject,
Build.A.WithdrawalRequest.TestObject
})
.TestObject;

Assert.That(
BlockValidator.ValidateRequestsOrder(block, out string? _),
Is.True);
}

[Test]
public void ValidateBodyRequests_BlockHasReuests_OutOfOrder_ReturnsFalse()
{
Block block = Build.A.Block
.WithConsensusRequests(new ConsensusRequest[] {
Build.A.WithdrawalRequest.TestObject,
Build.A.Deposit.WithIndex(0).TestObject
})
.TestObject;

Assert.That(
BlockValidator.ValidateRequestsOrder(block, out string? _),
Is.False);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
using Nethermind.Blockchain.Find;
using Nethermind.Blockchain.Receipts;
using Nethermind.Consensus.AuRa.Validators;
using Nethermind.Consensus.ExecutionRequests;
using Nethermind.Consensus.Processing;
using Nethermind.Consensus.Requests;
using Nethermind.Consensus.Rewards;
using Nethermind.Consensus.Transactions;
using Nethermind.Consensus.Validators;
Expand Down Expand Up @@ -53,7 +53,7 @@ public AuRaBlockProcessor(
AuRaContractGasLimitOverride? gasLimitOverride = null,
ContractRewriter? contractRewriter = null,
IBlockCachePreWarmer? preWarmer = null,
IConsensusRequestsProcessor? consensusRequestsProcessor = null)
IExecutionRequestsProcessor? executionRequestsProcessor = null)
: base(
specProvider,
blockValidator,
Expand All @@ -67,7 +67,7 @@ public AuRaBlockProcessor(
logManager,
withdrawalProcessor,
preWarmer: preWarmer,
consensusRequestsProcessor: consensusRequestsProcessor)
executionRequestsProcessor: executionRequestsProcessor)
{
_specProvider = specProvider;
_blockTree = blockTree ?? throw new ArgumentNullException(nameof(blockTree));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Nethermind.Consensus.Producers;
using Nethermind.Consensus.Transactions;
using Nethermind.Core;
using Nethermind.Core.ConsensusRequests;
using Nethermind.Core.Crypto;
using Nethermind.Core.Specs;
using Nethermind.Crypto;
Expand Down Expand Up @@ -500,8 +499,7 @@ ILogManager logManager
header,
selectedTxs,
Array.Empty<BlockHeader>(),
spec.WithdrawalsEnabled ? Enumerable.Empty<Withdrawal>() : null,
spec.RequestsEnabled ? Enumerable.Empty<ConsensusRequest>() : null
spec.WithdrawalsEnabled ? Enumerable.Empty<Withdrawal>() : null
);
header.TxRoot = TxTrie.CalculateRoot(block.Transactions);
block.Header.Author = _sealer.Address;
Expand Down
70 changes: 0 additions & 70 deletions src/Nethermind/Nethermind.Consensus.Test/DepositProcessorTests.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Linq;
using Nethermind.Abi;
using Nethermind.Consensus.ExecutionRequests;
using Nethermind.Core;
using Nethermind.Core.ExecutionRequest;
using Nethermind.Core.Extensions;
using Nethermind.Core.Specs;
using Nethermind.Core.Test.Builders;
using Nethermind.Db;
using Nethermind.Evm;
using Nethermind.Evm.Tracing;
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Int256;
using Nethermind.Logging;
using Nethermind.Specs;
using Nethermind.State;
using Nethermind.Trie.Pruning;
using NSubstitute;
using NUnit.Framework;

namespace Nethermind.Consensus.Test;

public class ExecutionProcessorTests
{
private ISpecProvider _specProvider;
private ITransactionProcessor _transactionProcessor;
private WorldState _stateProvider;
private static readonly UInt256 AccountBalance = 1.Ether();
private readonly Address DepositContractAddress = Eip6110Constants.MainnetDepositContractAddress;
private readonly Address eip7002Account = Eip7002Constants.WithdrawalRequestPredeployAddress;
private readonly Address eip7251Account = Eip7251Constants.ConsolidationRequestPredeployAddress;
private IReleaseSpec spec;
private readonly AbiSignature _depositEventABI = new("DepositEvent", AbiType.DynamicBytes, AbiType.DynamicBytes, AbiType.DynamicBytes, AbiType.DynamicBytes, AbiType.DynamicBytes);
private readonly AbiEncoder _abiEncoder = AbiEncoder.Instance;

ExecutionRequest[] executionDepositRequests = [TestItem.ExecutionRequestA, TestItem.ExecutionRequestB, TestItem.ExecutionRequestC];
ExecutionRequest[] executionWithdrawalRequests = [TestItem.ExecutionRequestD, TestItem.ExecutionRequestE, TestItem.ExecutionRequestF];
ExecutionRequest[] executionConsolidationRequests = [TestItem.ExecutionRequestG, TestItem.ExecutionRequestH, TestItem.ExecutionRequestI];

[SetUp]
public void Setup()
{


_specProvider = MainnetSpecProvider.Instance;
MemDb stateDb = new();
TrieStore trieStore = new(stateDb, LimboLogs.Instance);

_stateProvider = new WorldState(trieStore, new MemDb(), LimboLogs.Instance);
_stateProvider.CreateAccount(eip7002Account, AccountBalance);
_stateProvider.CreateAccount(eip7251Account, AccountBalance);
_stateProvider.Commit(_specProvider.GenesisSpec);
_stateProvider.CommitTree(0);

spec = Substitute.For<IReleaseSpec>();

spec.RequestsEnabled.Returns(true);
spec.DepositsEnabled.Returns(true);
spec.WithdrawalRequestsEnabled.Returns(true);
spec.ConsolidationRequestsEnabled.Returns(true);

spec.DepositContractAddress.Returns(DepositContractAddress);
spec.Eip7002ContractAddress.Returns(eip7002Account);
spec.Eip7251ContractAddress.Returns(eip7251Account);

_transactionProcessor = Substitute.For<ITransactionProcessor>();

_transactionProcessor.Execute(Arg.Any<Transaction>(), Arg.Any<BlockExecutionContext>(), Arg.Any<CallOutputTracer>())
.Returns(ci =>
{
Transaction transaction = ci.Arg<Transaction>();
CallOutputTracer tracer = ci.Arg<CallOutputTracer>();
if (transaction.To == eip7002Account)
{
tracer.ReturnValue = executionWithdrawalRequests.FlatEncodeWithoutType();
}
else if (transaction.To == eip7251Account)
{
tracer.ReturnValue = executionConsolidationRequests.FlatEncodeWithoutType();
}
else
{
tracer.ReturnValue = Array.Empty<byte>();
}
return new TransactionResult();
});
}

[Test]
public void ShouldProcessExecutionRequests()
{
Block block = Build.A.Block.TestObject;
ExecutionRequestsProcessor executionRequestsProcessor = new(_transactionProcessor);

TxReceipt[] txReceipts = [
Build.A.Receipt.WithLogs(
Build.A.LogEntry.WithData(
_abiEncoder.Encode(AbiEncodingStyle.None, _depositEventABI, [TestItem.PublicKeyA.Bytes.Slice(0, 48), TestItem.KeccakA.Bytes.ToArray(), BitConverter.GetBytes((ulong)1_000_000_000), TestItem.SignatureBytes, BitConverter.GetBytes((ulong)1)])
).WithAddress(DepositContractAddress).TestObject,
Build.A.LogEntry.WithData(
_abiEncoder.Encode(AbiEncodingStyle.None, _depositEventABI, [TestItem.PublicKeyB.Bytes.Slice(0, 48), TestItem.KeccakB.Bytes.ToArray(), BitConverter.GetBytes((ulong)2_000_000_000), TestItem.SignatureBytes, BitConverter.GetBytes((ulong)2)])
).WithAddress(DepositContractAddress).TestObject,
Build.A.LogEntry.WithData(
_abiEncoder.Encode(AbiEncodingStyle.None, _depositEventABI, [TestItem.PublicKeyC.Bytes.Slice(0, 48), TestItem.KeccakC.Bytes.ToArray(), BitConverter.GetBytes((ulong)3_000_000_000), TestItem.SignatureBytes, BitConverter.GetBytes((ulong)3)])
).WithAddress(DepositContractAddress).TestObject
).TestObject
];


executionRequestsProcessor.ProcessExecutionRequests(block, _stateProvider, txReceipts, spec);

foreach (var (processedRequest, expectedRequest) in block.ExecutionRequests.Zip([
.. executionDepositRequests,
.. executionWithdrawalRequests,
.. executionConsolidationRequests
]))
{
Assert.That(processedRequest.RequestType, Is.EqualTo(expectedRequest.RequestType));
Assert.That(processedRequest.RequestData, Is.EqualTo(expectedRequest.RequestData));
}

Assert.That(block.Header.RequestsHash, Is.EqualTo(block.ExecutionRequests.ToArray().CalculateHash()));
}
}
Loading
Loading