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 DATAHASH opcode #4894

Merged
merged 316 commits into from Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
316 commits
Select commit Hold shift + click to select a range
a43ca6d
Reformat whitespaces
rubo Nov 2, 2022
6fd2c3d
add withdrawalApplier to blockchainProcessor
MarekM25 Nov 3, 2022
c0adc96
Merge branch 'feature/shanghai-eip-4895-withdrawals' of https://githu…
MarekM25 Nov 3, 2022
cd18844
add withdrawals to ExecutionPayload
MarekM25 Nov 3, 2022
d9e2a08
test fixes
MarekM25 Nov 3, 2022
ea9ff25
fix EVM.test
MarekM25 Nov 3, 2022
78a06d4
fix EthereumTests
MarekM25 Nov 3, 2022
117225f
fix Benchmarks.sln
MarekM25 Nov 3, 2022
37f703c
Revise withdrawals representation according to the spec and refactor
rubo Nov 3, 2022
176fb16
Rename `IWithdrawalApplier` to `IWithdrawalProcessor`
rubo Nov 3, 2022
0279db6
Add tests for withdrawal encoding/decoding
rubo Nov 3, 2022
8751876
Rename `Recipient` to `Address`
rubo Nov 3, 2022
b49a1df
Reformat whitespaces
rubo Nov 3, 2022
d05c009
Revise withdrawals length calculation in block encoding
rubo Nov 3, 2022
f05fd1e
HasBody?
MarekM25 Nov 4, 2022
7ecaef2
Remove redundant withdrawals hash check
rubo Nov 2, 2022
a45ded2
fix withdrawals_test chainspec && added IReleaseSpec.WithdrawalsEnabled
MarekM25 Nov 7, 2022
e16253e
Fixes
smartprogrammer93 Nov 7, 2022
3d49cfe
Merge master
smartprogrammer93 Nov 7, 2022
feb997e
fix GenesisLoader
MarekM25 Nov 8, 2022
a29598f
Merge branch 'fix/forkId_calculation_is_wrong_after_timestamp_activat…
MarekM25 Nov 8, 2022
3794a14
fix extra-data
MarekM25 Nov 8, 2022
e2c0e98
Refactor withdrawal validation by implementing `IWithdrawalValidator`
rubo Nov 8, 2022
e35ca06
Fix failing tests
rubo Nov 8, 2022
f989fce
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 8, 2022
1e64cc8
Reformat whitespaces
rubo Nov 8, 2022
1009366
Merge Master
smartprogrammer93 Nov 8, 2022
7314dd5
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 9, 2022
d89d2ba
fix withdrawalsTimestamp
MarekM25 Nov 10, 2022
73ad787
Merge branch 'feature/shanghai-eip-4895-withdrawals' of https://githu…
MarekM25 Nov 10, 2022
a3824f7
temporary change validation
MarekM25 Nov 10, 2022
951fe85
null handling?
MarekM25 Nov 10, 2022
88108cf
Merging latest fix from forkId Calculation
smartprogrammer93 Nov 10, 2022
ddc75a5
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 11, 2022
54b28d2
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
smartprogrammer93 Nov 15, 2022
c57cc7d
Applying Marek's suggestion. Not sure about this one
smartprogrammer93 Nov 15, 2022
e90256e
Fix Ethereum tests
smartprogrammer93 Nov 15, 2022
500185a
Fix test cases
smartprogrammer93 Nov 15, 2022
d821522
Fix benchmark build
smartprogrammer93 Nov 15, 2022
f3cb918
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 15, 2022
0807e34
Fix payload attributes validation
rubo Nov 15, 2022
87b2721
Remove "V1" from `IForkchoiceUpdatedHandler` name
rubo Nov 15, 2022
b4b9eac
Update tests
rubo Nov 15, 2022
781a11f
hack AuRa tests for now
MarekM25 Nov 16, 2022
a11b424
fix more tests
MarekM25 Nov 16, 2022
01fbe57
Merge branch 'fix/forkId_calculation_is_wrong_after_timestamp_activat…
MarekM25 Nov 16, 2022
33c92d7
fix more tests
MarekM25 Nov 16, 2022
6fbc10d
fix build
MarekM25 Nov 16, 2022
8689463
+ fix one more tests
MarekM25 Nov 16, 2022
cf5a4a2
fix Synchronization tests
MarekM25 Nov 16, 2022
2e5d09c
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
MarekM25 Nov 16, 2022
9b8766c
Update tests to 0aa59689101f64cab8fa1526d9cf6e647ddba946
rubo Nov 16, 2022
276225d
fixed withdrawal chainspec
MarekM25 Nov 17, 2022
48cb901
withdrawals block validator tests
MarekM25 Nov 17, 2022
7fa3505
Implement Engine API tests
rubo Nov 17, 2022
46e62c8
Reformat code
rubo Nov 17, 2022
0919807
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 17, 2022
30acb11
fix chainspec?
MarekM25 Nov 18, 2022
d280ddb
Merge branch 'feature/shanghai-eip-4895-withdrawals' of https://githu…
MarekM25 Nov 18, 2022
786b42c
Fix withdrawals decoding
rubo Nov 18, 2022
497581a
fix chainspec timestamp
MarekM25 Nov 18, 2022
a535927
Merge branch 'feature/shanghai-eip-4895-withdrawals' of https://githu…
MarekM25 Nov 18, 2022
e25eaf6
Add and fix Engine API tests
rubo Nov 18, 2022
4936691
Revise block decoder tests
rubo Nov 21, 2022
c1d98c5
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 21, 2022
efc5e78
Revise file headers
rubo Nov 21, 2022
6736c0c
Revise file headers
rubo Nov 21, 2022
ab7c76e
Add missing file headers
rubo Nov 21, 2022
c4e398a
Merge branch 'feature/shanghai-eip-4895-withdrawals' of https://githu…
MarekM25 Nov 22, 2022
ec25ab6
fix AuRa test
MarekM25 Nov 22, 2022
5116555
adjusting comments
MarekM25 Nov 22, 2022
102535b
load genesis tests
MarekM25 Nov 22, 2022
d67ad62
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 22, 2022
6ea17ce
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
smartprogrammer93 Nov 22, 2022
9465532
Lukasz suggestions
smartprogrammer93 Nov 22, 2022
aad391a
formating
smartprogrammer93 Nov 22, 2022
a6f34d2
Fix build
smartprogrammer93 Nov 22, 2022
c7d3087
withdrawals_hivetests.json + cosmetic
MarekM25 Nov 23, 2022
620981a
Add more unit tests
smartprogrammer93 Nov 23, 2022
1a35206
spacing
smartprogrammer93 Nov 23, 2022
a16cd0b
Try on fixing timestamp activation with same value as genesis timestamp
smartprogrammer93 Nov 23, 2022
f99bdec
Merge Master
smartprogrammer93 Nov 23, 2022
a891746
Fix gnosis and chiado ForkId Calculations
smartprogrammer93 Nov 23, 2022
22e3f37
Merge branch 'fix/forkId_calculation_is_wrong_after_timestamp_activat…
MarekM25 Nov 23, 2022
efa1329
fix tests
MarekM25 Nov 23, 2022
5d31d9e
Cleanup and more tests
smartprogrammer93 Nov 23, 2022
d75143d
Janky but working solution to very rare edge case?
smartprogrammer93 Nov 23, 2022
115d4d2
Fix flakiness of caused by Parallelizable
smartprogrammer93 Nov 23, 2022
c8c6868
Correct usage of chain ID and network ID
flcl42 Oct 31, 2022
b8dfefb
adding engine tests
MarekM25 Nov 24, 2022
bffad26
working on more tests
MarekM25 Nov 24, 2022
edf75cd
add loop in test
MarekM25 Nov 24, 2022
fe77f93
Can_apply_withdrawals_correctly test
MarekM25 Nov 24, 2022
c0c6e7c
more test cases
MarekM25 Nov 24, 2022
f13347e
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 24, 2022
dc730aa
Update withdrawals hive tests configuration
rubo Nov 24, 2022
f1a9b18
Refactor and fix some null reference warnings
rubo Nov 24, 2022
13d3115
Expose withdrawals to JSON-RPC modules
rubo Nov 24, 2022
dbf6994
Fix broken tests
rubo Nov 24, 2022
803a9f5
Revise `ForkchoiceUpdatedHandler` string output
rubo Nov 24, 2022
189a02f
fix Can_apply_withdrawals_correctly
MarekM25 Nov 25, 2022
b805fde
Merge branch 'feature/shanghai-eip-4895-withdrawals' of https://githu…
MarekM25 Nov 25, 2022
a258284
fix whitespaces
MarekM25 Nov 25, 2022
9fe7a0b
fix whitespaces
MarekM25 Nov 25, 2022
47f49a3
more whitespaces fixes
MarekM25 Nov 25, 2022
d8f7165
add more tests
MarekM25 Nov 28, 2022
80c5b92
Fix chainId loading from spec
flcl42 Nov 28, 2022
fa96fdf
Rename for clarity
flcl42 Nov 28, 2022
5c63f4a
work on Withdrawals_transition test cases
MarekM25 Nov 28, 2022
abcab04
adjust CustomSpecProvider
MarekM25 Nov 28, 2022
4775775
Introduce IEip1995Spec
smartprogrammer93 Nov 28, 2022
0dbdec0
Merge branch 'fix/forkId_calculation_is_wrong_after_timestamp_activat…
smartprogrammer93 Nov 28, 2022
9a252d7
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Nov 28, 2022
255e9b2
Make test NetworkId vs ChainId different
flcl42 Nov 28, 2022
a67f7d9
Merge branch 'fix/forkId_calculation_is_wrong_after_timestamp_activat…
MarekM25 Nov 28, 2022
94262c6
small changes in tests
MarekM25 Nov 29, 2022
0326564
Fix license
smartprogrammer93 Nov 29, 2022
26190a4
add comments
smartprogrammer93 Nov 29, 2022
d9c39e1
Apply Marek Suggestion
smartprogrammer93 Nov 29, 2022
1dd876a
Adjust Lic to Rubo
smartprogrammer93 Nov 29, 2022
a7bc607
Marek Suggestions
smartprogrammer93 Nov 29, 2022
b5aaff9
Fix
smartprogrammer93 Nov 29, 2022
c91da93
fix withdrawals in ChainLevelHelper
MarekM25 Nov 29, 2022
e15fea4
Fix chainid for account abstraction; add and improve tests; fix a tut…
flcl42 Nov 29, 2022
56bd997
Fix naming in other projects, whitespaces
flcl42 Nov 29, 2022
4bbccaf
Fix more renaming
flcl42 Nov 29, 2022
a40bfa7
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
smartprogrammer93 Nov 29, 2022
da1262e
fix hive sync tests
MarekM25 Nov 30, 2022
e1ae154
fix?
MarekM25 Nov 30, 2022
a5631de
Revise withdrawals root hash encoding/decoding and its tests
rubo Dec 1, 2022
494aaa1
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 1, 2022
a33abb8
fix PayloadAttributes ToString
MarekM25 Dec 2, 2022
4caf2bc
add more temp logs to investigate hive tests
MarekM25 Dec 2, 2022
60a10bc
more logs
MarekM25 Dec 2, 2022
50a38a0
revert not needed logs
MarekM25 Dec 2, 2022
c1a8f78
fix test
MarekM25 Dec 2, 2022
661c50d
ignore incorrect tests
MarekM25 Dec 2, 2022
1322a22
Merge remote-tracking branch 'origin/master' into bugfix/4848-Correct…
flcl42 Dec 5, 2022
8f73c7e
Fix tests broken by withdrawals decoding revision
rubo Dec 5, 2022
c33b706
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 7, 2022
5f97f90
Revise file headers
rubo Dec 7, 2022
c91193b
Final appraoch, removed GetSpec complexity
smartprogrammer93 Dec 7, 2022
85676fe
Forgotten changes
smartprogrammer93 Dec 7, 2022
9bfb991
Merge Master
smartprogrammer93 Dec 7, 2022
3bac96d
SecondsPerSlot to BlocksConfig
smartprogrammer93 Nov 29, 2022
78a9912
Minor + config changes
smartprogrammer93 Nov 29, 2022
1a454ba
Typo fix
smartprogrammer93 Dec 6, 2022
ebc1808
remove empty line
smartprogrammer93 Dec 7, 2022
1c41c4b
Move BlocksConfig to Nethermind.Config project
smartprogrammer93 Dec 7, 2022
4c86a4f
Benchmark build fix
smartprogrammer93 Dec 7, 2022
a15fd52
Merge remote-tracking branch 'origin/master' into bugfix/4848-Correct…
flcl42 Dec 8, 2022
4847b22
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 8, 2022
4fab706
Rename `ExecutionPayloadV1` to `ExecutionPayloadV2`
rubo Dec 8, 2022
e55177a
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 11, 2022
34379b7
Merge remote-tracking branch 'origin/feature/shanghai-eip-4895-withdr…
flcl42 Dec 12, 2022
9183250
Revise withdrawals check
rubo Dec 12, 2022
452b004
Refactor tests
rubo Dec 12, 2022
59743f1
Optimize withdrawals root hash decoding in block header
rubo Dec 12, 2022
5bccabe
Add fields, spec, header encoding
flcl42 Nov 3, 2022
82f9afa
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 13, 2022
32e48f0
Implements ForkId tests that are ub EIP-6122
smartprogrammer93 Dec 13, 2022
6561ac3
Spacing
smartprogrammer93 Dec 13, 2022
e0e0960
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
smartprogrammer93 Dec 14, 2022
6fc2e92
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
smartprogrammer93 Dec 14, 2022
c5159b2
Fix build
smartprogrammer93 Dec 14, 2022
fe4b020
Fix ForkId Test case
smartprogrammer93 Dec 14, 2022
93ceb9c
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
smartprogrammer93 Dec 14, 2022
7869fd0
Removing 3675 and using MergeForkId Transition
smartprogrammer93 Dec 14, 2022
c931c3f
Final test fix
smartprogrammer93 Dec 14, 2022
35d7f10
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 14, 2022
7f7f837
Fix tests
rubo Dec 14, 2022
4a7de80
Rename `ExecutionPayloadV2` to `ExecutionPayload`
rubo Dec 15, 2022
5a8abd0
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 15, 2022
6084fe9
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 16, 2022
d695f4e
add one more line in Nlog (temp)
MarekM25 Dec 19, 2022
75b9186
Revert NLog for jsonRpc
MarekM25 Dec 20, 2022
ec63830
fix missing body?
MarekM25 Dec 22, 2022
095b5de
adjust TxPool logs
MarekM25 Dec 22, 2022
b24a24d
Merge branch 'fix/slotTime_to_be_in_init_config_instead_of_merge' int…
MarekM25 Dec 22, 2022
751eded
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 22, 2022
77e0ad0
Add more test cases for `BlockBodiesMessageSerializer`
rubo Dec 22, 2022
00db474
Add tests for `BlockHeader.HasBody`
rubo Dec 22, 2022
ea6aa43
Revise `null` handling for `BlockHeader.HasBody`
rubo Dec 22, 2022
3823f88
fix BlockBody empty
MarekM25 Dec 23, 2022
f5cf45a
Merge branch 'feature/shanghai-eip-4895-withdrawals' of https://githu…
MarekM25 Dec 23, 2022
0363da5
Merge Tracking Branch
smartprogrammer93 Dec 28, 2022
cb2469d
Merge Tracking Branch
smartprogrammer93 Dec 28, 2022
1bc58d6
Merge branch 'fix/forkId_calculation_is_wrong_after_timestamp_activat…
smartprogrammer93 Dec 28, 2022
5a0577e
Merge branch 'master' into fix/slotTime_to_be_in_init_config_instead_…
MarekM25 Dec 28, 2022
50fe945
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
MarekM25 Dec 28, 2022
71fa0a5
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
MarekM25 Dec 28, 2022
9d2037c
Merge branch 'fix/slotTime_to_be_in_init_config_instead_of_merge' int…
MarekM25 Dec 28, 2022
6351165
cosmetic
MarekM25 Dec 28, 2022
dd21379
fix CI
MarekM25 Dec 28, 2022
a856172
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 28, 2022
aa3153e
Revise tests
rubo Dec 28, 2022
a74aaab
Update null checks with pattern matching
rubo Dec 28, 2022
ff5443f
Refactor block body initialization and add tests
rubo Dec 28, 2022
d4aba09
Revise whitespaces
rubo Dec 28, 2022
8878117
cosmetic
MarekM25 Dec 29, 2022
6d711da
Merge branch 'feature/shanghai-eip-4895-withdrawals' of https://githu…
MarekM25 Dec 29, 2022
31ffc99
Merge branch 'master' into fix/slotTime_to_be_in_init_config_instead_…
MarekM25 Dec 29, 2022
8632163
Merge branch 'fix/slotTime_to_be_in_init_config_instead_of_merge' int…
MarekM25 Dec 29, 2022
9ff4bf9
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
MarekM25 Dec 29, 2022
25f696a
ForkId calculation polish (#5068)
LukaszRozmej Dec 30, 2022
a5a54f3
Revise Clique block production according to withdrawals rules
rubo Dec 30, 2022
f6a9a52
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Dec 30, 2022
21c16e7
Add withdrawals to `eth_getBlockByNumber` tests
rubo Dec 30, 2022
f0d2f6a
SecondsPerSlot move to BlocksConfig (#4944)
smartprogrammer93 Jan 1, 2023
3ee9679
Merge branch 'fix/forkId_calculation_is_wrong_after_timestamp_activat…
MarekM25 Jan 2, 2023
12b81e9
fix build
MarekM25 Jan 2, 2023
4bc8426
Merge branch 'master' into fix/forkId_calculation_is_wrong_after_time…
MarekM25 Jan 2, 2023
59408a7
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
rubo Jan 2, 2023
44f80bc
Merge branch 'fix/forkId_calculation_is_wrong_after_timestamp_activat…
LukaszRozmej Jan 2, 2023
933f294
Merge branch 'master' into feature/shanghai-eip-4895-withdrawals
MarekM25 Jan 2, 2023
24552f1
removed duplicated NSubstitute
MarekM25 Jan 2, 2023
49c3110
Merge branch 'feature/shanghai-eip-4895-withdrawals' into bugfix/4848…
flcl42 Jan 3, 2023
a6cf8ac
Fix network id in node info
flcl42 Jan 3, 2023
0c34da5
Rollback spec change
flcl42 Jan 3, 2023
ad149b5
Rename NetworkId class to BlockchainIds; more renaming and usage of T…
flcl42 Jan 4, 2023
6968572
Merge remote-tracking branch 'origin/master' into bugfix/4848-Correct…
flcl42 Jan 11, 2023
6d183d2
Improve a test
flcl42 Jan 16, 2023
c3aac9e
Fix chainid/networkid usage
flcl42 Jan 18, 2023
2d300c5
Merge remote-tracking branch 'origin/master' into bugfix/4848-Correct…
flcl42 Jan 18, 2023
fb22da9
Refactors
LukaszRozmej Jan 18, 2023
65d4b6c
Improve CustomSpecProvider ctor
flcl42 Jan 18, 2023
52a90ec
Merge branch 'bugfix/4848-Correct-usage-of-chain-and-network-ids' of …
flcl42 Jan 19, 2023
0c4ca1e
Merge remote-tracking branch 'origin/master' into bugfix/4848-Correct…
flcl42 Jan 19, 2023
02336ae
Use test provider
flcl42 Jan 19, 2023
1f1ed06
ethstats fix
LukaszRozmej Jan 19, 2023
fe25564
whitespace
LukaszRozmej Jan 19, 2023
222affe
Merge remote-tracking branch 'origin/master' into bugfix/4848-Correct…
flcl42 Jan 19, 2023
87dc35b
Fix
LukaszRozmej Jan 19, 2023
00459a4
Merge branch 'bugfix/4848-Correct-usage-of-chain-and-network-ids' of …
flcl42 Jan 19, 2023
6799333
Fix header encoding: loading from genesis
flcl42 Jan 3, 2023
3b5362f
Merge remote-tracking branch 'origin/bugfix/4848-Correct-usage-of-cha…
flcl42 Jan 19, 2023
20dcc0f
Merge remote-tracking branch 'origin/bugfix/4848-Correct-usage-of-cha…
flcl42 Jan 19, 2023
5075ee0
Remove fork, simplify codfe, fix merge conflicts
flcl42 Jan 20, 2023
b82737b
Merge branch 'feature/add-blob-spec-fork-and-fields' of github.com:Ne…
flcl42 Jan 20, 2023
4a22fda
Merge remote-tracking branch 'origin/master' into feature/add-blob-sp…
flcl42 Jan 20, 2023
f6299c8
Improve tests, fix spaces
flcl42 Jan 20, 2023
d974c28
Fix whitespaces
flcl42 Jan 20, 2023
0cf7330
Fix tests
flcl42 Jan 20, 2023
b4b421c
Fix space
flcl42 Jan 20, 2023
0950b67
Fix Rlp for headers
flcl42 Jan 20, 2023
be53825
Add DATAHASH opcode
flcl42 Nov 11, 2022
4c84274
LogFinder should be initialized befre UserOperationPools
flcl42 Nov 26, 2022
109078f
Fix postmerge
flcl42 Jan 20, 2023
d853320
Merge remote-tracking branch 'origin/master' into feature/add-datahas…
flcl42 Jan 21, 2023
37e6751
Add no blobs for benchmarks, let's add it with DATAHASH benchmarks
flcl42 Jan 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -66,6 +66,7 @@ public IBlockFinder BlockFinder
set => _blockFinder = value;
}

public ILogFinder LogFinder { get; private set; } = null!;
public IJsonSerializer JsonSerializer { get; set; } = null!;
public IStateProvider State { get; set; } = null!;
public IReadOnlyStateProvider ReadOnlyState { get; private set; } = null!;
Expand Down Expand Up @@ -165,6 +166,10 @@ protected virtual async Task<TestBlockchain> Build(ISpecProvider? specProvider =
PoSSwitcher = NoPoS.Instance;
ISealer sealer = new NethDevSealEngine(TestItem.AddressD);
SealEngine = new SealEngine(sealer, Always.Valid);

BloomStorage bloomStorage = new(new BloomConfig(), new MemDb(), new InMemoryDictionaryFileStoreFactory());
ReceiptsRecovery receiptsRecovery = new(new EthereumEcdsa(SpecProvider.ChainId, LimboLogs.Instance), SpecProvider);
LogFinder = new LogFinder(BlockTree, ReceiptStorage, ReceiptStorage, bloomStorage, LimboLogs.Instance, receiptsRecovery);
BlockProcessor = CreateBlockProcessor();

BlockchainProcessor chainProcessor = new(BlockTree, BlockProcessor, BlockPreprocessorStep, StateReader, LogManager, Consensus.Processing.BlockchainProcessor.Options.Default);
Expand Down
Expand Up @@ -20,6 +20,7 @@
<ItemGroup>
<ProjectReference Include="..\Nethermind.Blockchain\Nethermind.Blockchain.csproj" />
<ProjectReference Include="..\Nethermind.Core\Nethermind.Core.csproj" />
<ProjectReference Include="..\Nethermind.Facade\Nethermind.Facade.csproj" />
<ProjectReference Include="..\Nethermind.Network\Nethermind.Network.csproj" />
<ProjectReference Include="..\Nethermind.Specs.Test\Nethermind.Specs.Test.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Evm.Benchmark/EvmBenchmarks.cs
Expand Up @@ -61,7 +61,7 @@ public void GlobalSetup()
CodeInfo = new CodeInfo(ByteCode),
Value = 0,
TransferValue = 0,
TxExecutionContext = new TxExecutionContext(_header, Address.Zero, 0)
TxExecutionContext = new TxExecutionContext(_header, Address.Zero, 0, null)
};

_evmState = new EvmState(long.MaxValue, _environment, ExecutionType.Transaction, true, _worldState.TakeSnapshot(), false);
Expand Down
Expand Up @@ -91,7 +91,7 @@ public void GlobalSetup()
CodeInfo = new CodeInfo(_bytecode.Concat(_bytecode).Concat(_bytecode).Concat(_bytecode).ToArray()),
Value = 0,
TransferValue = 0,
TxExecutionContext = new TxExecutionContext(_header, Address.Zero, 0)
TxExecutionContext = new TxExecutionContext(_header, Address.Zero, 0, null)
};

_evmState = new EvmState(100_000_000L, _environment, ExecutionType.Transaction, true, _worldState.TakeSnapshot(), false);
Expand Down
Expand Up @@ -102,7 +102,7 @@ public void GlobalSetup()
CodeInfo = new CodeInfo(Bytecode),
Value = 0,
TransferValue = 0,
TxExecutionContext = new TxExecutionContext(_header, Address.Zero, 0)
TxExecutionContext = new TxExecutionContext(_header, Address.Zero, 0, null)
};

_evmState = new EvmState(100_000_000L, _environment, ExecutionType.Transaction, true, _worldState.TakeSnapshot(), false);
Expand Down
60 changes: 60 additions & 0 deletions src/Nethermind/Nethermind.Evm.Test/Eip4844Tests.cs
@@ -0,0 +1,60 @@
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using FluentAssertions;
using Nethermind.Specs;
using NUnit.Framework;
using System;
using Nethermind.Int256;
using System.Linq;

namespace Nethermind.Evm.Test;

[TestFixture]
public class Eip4844Tests : VirtualMachineTestsBase
{
protected override long BlockNumber => MainnetSpecProvider.GrayGlacierBlockNumber;
protected override ulong Timestamp => MainnetSpecProvider.CancunBlockTimestamp;

[TestCase(0, 0, Description = "Should return 0 when no hashes")]
[TestCase(1, 1, Description = "Should return 0 when out of range")]
[TestCase(2, 1, Description = "Should return 0 when way out of range")]
[TestCase(0, 1, Description = "Should return hash, when exists")]
[TestCase(1, 3, Description = "Should return hash, when exists")]
public void Test_datahash_index_in_range(int index, int datahashesCount)
{
byte[][] hashes = new byte[datahashesCount][];
for (int i = 0; i < datahashesCount; i++)
{
hashes[i] = new byte[32];
for (int n = 0; n < datahashesCount; n++)
{
hashes[i][n] = (byte)((i * 3 + 10 * 7) % 256);
}
}
byte[] expectedOutput = datahashesCount > index ? hashes[index] : new byte[32];

// Cost of transaction call + PUSH1 x4 + MSTORE (entry cost + 1 memory cell used)
const long GasCostOfCallingWrapper = GasCostOf.Transaction + GasCostOf.VeryLow * 5 + GasCostOf.Memory;

byte[] code = Prepare.EvmCode
.PushData(new UInt256((ulong)index))
.DATAHASH()
.MSTORE(0)
.Return(32, 0)
.Done;

TestAllTracerWithOutput result = Execute(BlockNumber, 50000, code, blobVersionedHashes: hashes, timestamp: Timestamp);

result.StatusCode.Should().Be(StatusCode.Success);
result.ReturnValue.SequenceEqual(expectedOutput);
AssertGas(result, GasCostOfCallingWrapper + GasCostOf.DataHash);
}

protected override TestAllTracerWithOutput CreateTracer()
{
TestAllTracerWithOutput tracer = base.CreateTracer();
tracer.IsTracingAccess = false;
return tracer;
}
}
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs
Expand Up @@ -106,7 +106,7 @@ public class InvalidOpcodeTests : VirtualMachineTestsBase
{
Instruction.TSTORE,
Instruction.TLOAD,
// TODO: Add DATAHASH
Instruction.DATAHASH,
}
).ToArray();

Expand Down
8 changes: 5 additions & 3 deletions src/Nethermind/Nethermind.Evm.Test/VirtualMachineTestsBase.cs
Expand Up @@ -110,9 +110,9 @@ protected TestAllTracerWithOutput Execute(params byte[] code)
return tracer;
}

protected TestAllTracerWithOutput Execute(long blockNumber, long gasLimit, byte[] code, long blockGasLimit = DefaultBlockGasLimit, ulong timestamp = 0)
protected TestAllTracerWithOutput Execute(long blockNumber, long gasLimit, byte[] code, long blockGasLimit = DefaultBlockGasLimit, ulong timestamp = 0, byte[][] blobVersionedHashes = null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only tests, but I would consider creating some container (class) for those parameters, to easier evolve them in the future.

Copy link
Contributor Author

@flcl42 flcl42 Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean just blobVersionedHashes? Or all the stuff like blobVersionedHashes, blobs, kzgs, proof?
blobVersionedHashes byte[][] type looks OK for me, may be UIn256t[] could look better, but would bring redundant type conversions
blobVersionedHashes is always a block part, but blobs, kzgs and proof may be considered as a separate thing, that exists until passed to CL. Still I'd give a try to flat transaction structure, we can easily change in the future without problems with serialization anyway

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All parameters, when your method starts to take more than 4-5 it is time to make them into a class/struct of their own. It is nothing crucial and can stay as is, just providing a tip.

{
(Block block, Transaction transaction) = PrepareTx(blockNumber, gasLimit, code, blockGasLimit: blockGasLimit, timestamp: timestamp);
(Block block, Transaction transaction) = PrepareTx(blockNumber, gasLimit, code, blockGasLimit: blockGasLimit, timestamp: timestamp, blobVersionedHashes: blobVersionedHashes);
TestAllTracerWithOutput tracer = CreateTracer();
_processor.Execute(transaction, block.Header, tracer);
return tracer;
Expand All @@ -125,7 +125,8 @@ protected TestAllTracerWithOutput Execute(long blockNumber, long gasLimit, byte[
SenderRecipientAndMiner senderRecipientAndMiner = null,
int value = 1,
long blockGasLimit = DefaultBlockGasLimit,
ulong timestamp = 0)
ulong timestamp = 0,
byte[][] blobVersionedHashes = null)
{
senderRecipientAndMiner ??= SenderRecipientAndMiner.Default;
TestState.CreateAccount(senderRecipientAndMiner.Sender, 100.Ether());
Expand All @@ -144,6 +145,7 @@ protected TestAllTracerWithOutput Execute(long blockNumber, long gasLimit, byte[
.WithGasLimit(gasLimit)
.WithGasPrice(1)
.WithValue(value)
.WithBlobVersionedHashes(blobVersionedHashes)
.To(senderRecipientAndMiner.Recipient)
.SignedAndResolved(_ethereumEcdsa, senderRecipientAndMiner.SenderKey)
.TestObject;
Expand Down
9 changes: 2 additions & 7 deletions src/Nethermind/Nethermind.Evm/ByteCodeBuilderExtensions.cs
@@ -1,15 +1,8 @@
// SPDX-FileCopyrightText: 2022 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Collections;
using System.Collections.Generic;
using Nethermind.Core;
using Nethermind.Core.Collections;
using Nethermind.Core.Extensions;
using Nethermind.Int256;
using Nethermind.Serialization.Json;
using Org.BouncyCastle.Asn1.Mozilla;

namespace Nethermind.Evm
{
Expand Down Expand Up @@ -92,6 +85,8 @@ public static Prepare SELFBALANCE(this Prepare @this)
=> @this.Op(Instruction.SELFBALANCE);
public static Prepare BASEFEE(this Prepare @this)
=> @this.Op(Instruction.BASEFEE);
public static Prepare DATAHASH(this Prepare @this)
=> @this.Op(Instruction.DATAHASH);
public static Prepare POP(this Prepare @this)
=> @this.Op(Instruction.POP);
public static Prepare PC(this Prepare @this)
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.Evm/GasCostOf.cs
Expand Up @@ -39,6 +39,7 @@ public static class GasCostOf
public const long TxDataNonZero = 68;
public const long TxDataNonZeroEip2028 = 16;
public const long Transaction = 21000;
public const long DataHash = 3;
public const long Log = 375;
public const long LogTopic = 375;
public const long LogData = 8;
Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Nethermind.Evm/Instruction.cs
Expand Up @@ -67,6 +67,7 @@ public enum Instruction : byte
CHAINID = 0x46,
SELFBALANCE = 0x47,
BASEFEE = 0x48,
DATAHASH = 0x49,

POP = 0x50,
MLOAD = 0x51,
Expand Down
Expand Up @@ -321,7 +321,7 @@ senderBalance < (UInt256)transaction.GasLimit * transaction.MaxFeePerGas + value
recipientOrNull = recipient;

ExecutionEnvironment env = new();
env.TxExecutionContext = new TxExecutionContext(block, caller, effectiveGasPrice);
env.TxExecutionContext = new TxExecutionContext(block, caller, effectiveGasPrice, transaction.BlobVersionedHashes);
env.Value = value;
env.TransferValue = value;
env.Caller = caller;
Expand Down
4 changes: 3 additions & 1 deletion src/Nethermind/Nethermind.Evm/TxExecutionContext.cs
Expand Up @@ -11,12 +11,14 @@ namespace Nethermind.Evm
public BlockHeader Header { get; }
public Address Origin { get; }
public UInt256 GasPrice { get; }
public byte[][]? BlobVersionedHashes { get; }

public TxExecutionContext(BlockHeader blockHeader, Address origin, in UInt256 gasPrice)
public TxExecutionContext(BlockHeader blockHeader, Address origin, in UInt256 gasPrice, byte[][] blobVersionedHashes)
{
Header = blockHeader;
Origin = origin;
GasPrice = gasPrice;
BlobVersionedHashes = blobVersionedHashes;
}
}
}
26 changes: 26 additions & 0 deletions src/Nethermind/Nethermind.Evm/VirtualMachine.cs
Expand Up @@ -1720,6 +1720,32 @@ void UpdateMemoryCost(in UInt256 position, in UInt256 length)
stack.PushUInt256(in baseFee);
break;
}
case Instruction.DATAHASH:
{
if (!spec.IsEip4844Enabled)
{
EndInstructionTraceError(EvmExceptionType.BadInstruction);
return CallResult.InvalidInstructionException;
}

if (!UpdateGas(GasCostOf.DataHash, ref gasAvailable))
{
EndInstructionTraceError(EvmExceptionType.OutOfGas);
return CallResult.OutOfGasException;
}

stack.PopUInt256(out UInt256 blobIndex);

if (txCtx.BlobVersionedHashes is not null && blobIndex < txCtx.BlobVersionedHashes.Length)
{
stack.PushBytes(txCtx.BlobVersionedHashes[blobIndex.u0]);
}
else
{
stack.PushZero();
}
break;
}
case Instruction.POP:
{
if (!UpdateGas(GasCostOf.Base, ref gasAvailable))
Expand Down
Expand Up @@ -40,8 +40,6 @@ public class TestRpcBlockchain : TestBlockchain
public IBlockchainBridge Bridge { get; private set; } = null!;
public ITxSealer TxSealer { get; private set; } = null!;
public ITxSender TxSender { get; private set; } = null!;
public ILogFinder LogFinder { get; private set; } = null!;

public IReceiptFinder ReceiptFinder { get; private set; } = null!;
public IGasPriceOracle GasPriceOracle { get; private set; } = null!;

Expand Down Expand Up @@ -108,14 +106,11 @@ public async Task<T> Build(ISpecProvider? specProvider = null, UInt256? initialV

protected override async Task<TestBlockchain> Build(ISpecProvider? specProvider = null, UInt256? initialValues = null)
{
BloomStorage bloomStorage = new(new BloomConfig(), new MemDb(), new InMemoryDictionaryFileStoreFactory());
specProvider ??= new TestSpecProvider(Berlin.Instance);
await base.Build(specProvider, initialValues);
IFilterStore filterStore = new FilterStore();
IFilterManager filterManager = new FilterManager(filterStore, BlockProcessor, TxPool, LimboLogs.Instance);

ReceiptsRecovery receiptsRecovery = new(new EthereumEcdsa(specProvider.ChainId, LimboLogs.Instance), specProvider);
LogFinder = new LogFinder(BlockTree, ReceiptStorage, ReceiptStorage, bloomStorage, LimboLogs.Instance, receiptsRecovery);

ReadOnlyTxProcessingEnv processingEnv = new(
new ReadOnlyDbProvider(DbProvider, false),
Expand Down