Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Reformat whitespaces * add withdrawalApplier to blockchainProcessor * add withdrawals to ExecutionPayload * test fixes * fix EVM.test * fix EthereumTests * fix Benchmarks.sln * Revise withdrawals representation according to the spec and refactor * Rename `IWithdrawalApplier` to `IWithdrawalProcessor` * Add tests for withdrawal encoding/decoding * Rename `Recipient` to `Address` * Reformat whitespaces * Revise withdrawals length calculation in block encoding * HasBody? * Remove redundant withdrawals hash check * fix withdrawals_test chainspec && added IReleaseSpec.WithdrawalsEnabled * Fixes * fix GenesisLoader * fix extra-data * Refactor withdrawal validation by implementing `IWithdrawalValidator` * Fix failing tests * Reformat whitespaces * fix withdrawalsTimestamp * temporary change validation * null handling? * Applying Marek's suggestion. Not sure about this one * Fix Ethereum tests * Fix test cases * Fix benchmark build * Fix payload attributes validation * Remove "V1" from `IForkchoiceUpdatedHandler` name * Update tests * hack AuRa tests for now * fix more tests * fix more tests * fix build * + fix one more tests * fix Synchronization tests * Update tests to 0aa59689101f64cab8fa1526d9cf6e647ddba946 * fixed withdrawal chainspec * withdrawals block validator tests * Implement Engine API tests * Reformat code * fix chainspec? * Fix withdrawals decoding * fix chainspec timestamp * Add and fix Engine API tests * Revise block decoder tests * Revise file headers * Revise file headers * Add missing file headers * fix AuRa test * adjusting comments * load genesis tests * Lukasz suggestions * formating * Fix build * withdrawals_hivetests.json + cosmetic * Add more unit tests * spacing * Try on fixing timestamp activation with same value as genesis timestamp * Fix gnosis and chiado ForkId Calculations * fix tests * Cleanup and more tests * Janky but working solution to very rare edge case? * Fix flakiness of caused by Parallelizable * Correct usage of chain ID and network ID * adding engine tests * working on more tests * add loop in test * Can_apply_withdrawals_correctly test * more test cases * Update withdrawals hive tests configuration * Refactor and fix some null reference warnings * Expose withdrawals to JSON-RPC modules * Fix broken tests * Revise `ForkchoiceUpdatedHandler` string output * fix Can_apply_withdrawals_correctly * fix whitespaces * fix whitespaces * more whitespaces fixes * add more tests * Fix chainId loading from spec * Rename for clarity * work on Withdrawals_transition test cases * adjust CustomSpecProvider * Introduce IEip1995Spec * Make test NetworkId vs ChainId different Changing ChainId to another number breaks a lot of test, that are based to hashes and RLP. Let at least test if the values differ * small changes in tests * Fix license * add comments * Apply Marek Suggestion * Adjust Lic to Rubo * Marek Suggestions * Fix * fix withdrawals in ChainLevelHelper * Fix chainid for account abstraction; add and improve tests; fix a tutorial link * Fix naming in other projects, whitespaces * Fix more renaming * fix hive sync tests * fix? * Revise withdrawals root hash encoding/decoding and its tests * fix PayloadAttributes ToString * add more temp logs to investigate hive tests * more logs * revert not needed logs * fix test * ignore incorrect tests * Fix tests broken by withdrawals decoding revision * Revise file headers * Final appraoch, removed GetSpec complexity * Forgotten changes * SecondsPerSlot to BlocksConfig * Minor + config changes * Typo fix * remove empty line * Move BlocksConfig to Nethermind.Config project * Benchmark build fix * Rename `ExecutionPayloadV1` to `ExecutionPayloadV2` * Revise withdrawals check * Refactor tests * Optimize withdrawals root hash decoding in block header * Add fields, spec, header encoding * Implements ForkId tests that are ub EIP-6122 * Spacing * Fix build * Fix ForkId Test case * Removing 3675 and using MergeForkId Transition * Final test fix * Fix tests * Rename `ExecutionPayloadV2` to `ExecutionPayload` * add one more line in Nlog (temp) * Revert NLog for jsonRpc * fix missing body? * adjust TxPool logs * Add more test cases for `BlockBodiesMessageSerializer` * Add tests for `BlockHeader.HasBody` * Revise `null` handling for `BlockHeader.HasBody` * fix BlockBody empty * cosmetic * fix CI * Revise tests * Update null checks with pattern matching * Refactor block body initialization and add tests * Revise whitespaces * cosmetic * ForkId calculation polish (#5068) * Refactor - mainly ChainSpecBasedSpecProvider * fixes * Better warning message * Simplify sanity check * one more simplification * Revise Clique block production according to withdrawals rules * Add withdrawals to `eth_getBlockByNumber` tests * SecondsPerSlot move to BlocksConfig (#4944) Co-authored-by: MarekM25 <marekm2504@gmail.com> Co-authored-by: lukasz.rozmej <lukasz.rozmej@gmail.com> Resolves #4871 * fix build * removed duplicated NSubstitute * Fix network id in node info * Rollback spec change * Rename NetworkId class to BlockchainIds; more renaming and usage of TestBlockChainIds * Improve a test * Fix chainid/networkid usage * Refactors * Improve CustomSpecProvider ctor * Use test provider * ethstats fix * whitespace * Fix * Fix header encoding: loading from genesis * Remove fork, simplify codfe, fix merge conflicts * Improve tests, fix spaces * Fix whitespaces * Fix tests * Fix space * Fix Rlp for headers * Add DATAHASH opcode * LogFinder should be initialized befre UserOperationPools * Fix postmerge * Add no blobs for benchmarks, let's add it with DATAHASH benchmarks Co-authored-by: Ruben Buniatyan <rubo@users.noreply.github.com> Co-authored-by: MarekM25 <marekm2504@gmail.com> Co-authored-by: smartprogrammer <smartprogrammer@windowslive.com> Co-authored-by: Lukasz Rozmej <lukasz.rozmej@gmail.com> Co-authored-by: Ahmad Bitar <33181301+smartprogrammer93@users.noreply.github.com>
- Loading branch information
1 parent
bf29cbf
commit 6fe2983
Showing
15 changed files
with
109 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters