Skip to content

Commit

Permalink
Merge master into taiko
Browse files Browse the repository at this point in the history
  • Loading branch information
flcl42 committed Oct 11, 2024
2 parents 27fe295 + 54a795c commit efb52ca
Show file tree
Hide file tree
Showing 247 changed files with 5,472 additions and 2,260 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build tools

on:
merge_group:
types: [checks_requested]
pull_request:
branches: [master]
push:
branches: [master]

jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config: [release]
project:
- DocGen/DocGen.sln
- HiveCompare/HiveCompare.sln
- HiveConsensusWorkflowGenerator/HiveConsensusWorkflowGenerator.csproj
- Nethermind.Tools.Kute/Nethermind.Tools.Kute.csproj
- SendBlobs/SendBlobs.sln
- TxParser/TxParser.csproj
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
- name: Build ${{ matrix.project }}
working-directory: tools
run: dotnet build ./${{ matrix.project }} -c ${{ matrix.config }}
2 changes: 1 addition & 1 deletion .github/workflows/sync-supported-chains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: '1.21.0'
go-version: 'stable'
check-latest: true
cache: true

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ jobs:
global-json-file: n/global.json
- name: Build DocGen
working-directory: n
run: dotnet build tools/docgen/DocGen.csproj -c release -o docgen
run: dotnet build tools/DocGen/DocGen.csproj -c release -o DocGen
- name: Generate docs
run: n/docgen/DocGen $GITHUB_WORKSPACE/d --config --jsonrpc --metrics
run: n/DocGen/DocGen $GITHUB_WORKSPACE/d --config --jsonrpc --metrics
- name: Tag a new version
if: github.event_name == 'release' && !github.event.release.prerelease
working-directory: d
run: |
npm i
npm run docusaurus docs:version v${{ github.event.release.tag_name }}
npm run docusaurus docs:version ${{ github.event.release.tag_name }}
- name: Create a pull request
working-directory: d
env:
Expand Down
76 changes: 32 additions & 44 deletions src/Nethermind/Chains/hive.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"eip155Transition": "0x0",
"maxCodeSizeTransition": "0x0",
"maxCodeSize": 24576,
"maximumExtraDataSize": 102400,
"maximumExtraDataSize": "0x400",
"eip140Transition": "0x0",
"eip211Transition": "0x0",
"eip214Transition": "0x0",
Expand All @@ -51,57 +51,45 @@
"eip3529Transition": "0x0",
"eip3541Transition": "0x0",
"eip3198Transition": "0x0",
"MergeForkIdTransition": "0x64",
"networkID": "0x7",
"chainID": "0x7"
"eip3651TransitionTimestamp": "0x0",
"eip3855TransitionTimestamp": "0x0",
"eip3860TransitionTimestamp": "0x0",
"eip4895TransitionTimestamp": "0x0",
"eip4844TransitionTimestamp": "0x0",
"eip4788TransitionTimestamp": "0x0",
"eip1153TransitionTimestamp": "0x0",
"eip5656TransitionTimestamp": "0x0",
"eip6780TransitionTimestamp": "0x0",
"eip7702TransitionTimestamp": "0x0",
"chainID": "0x1"
},
"genesis": {
"seal": {
"ethereum": {
"nonce": "0x0000000000000000"
"nonce": "0x0000000000000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x30000",
"difficulty": "0x00",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x1234",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000658bdf435d810c91414ec09147daa6db624063790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x2fefd8"
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x00",
"gasLimit": "0x016345785d8a0000",
"baseFeePerGas": "0x07"
},
"accounts": {
"0xcf49fda3be353c69b41ed96333cd24302da4556f": {
"balance": "0x123450000000000000000"
},
"0x0161e041aad467a890839d5b08b138c1e6373072": {
"balance": "0x123450000000000000000"
},
"0x87da6a8c6e9eff15d703fc2773e32f6af8dbe301": {
"balance": "0x123450000000000000000"
},
"0xb97de4b8c857e4f6bc354f226dc3249aaee49209": {
"balance": "0x123450000000000000000"
},
"0xc5065c9eeebe6df2c2284d046bfc906501846c51": {
"balance": "0x123450000000000000000"
},
"0x0000000000000000000000000000000000000314": {
"balance": "0x0",
"code": "0x60606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063a223e05d1461006a578063abd1a0cf1461008d578063abfced1d146100d4578063e05c914a14610110578063e6768b451461014c575b610000565b346100005761007761019d565b6040518082815260200191505060405180910390f35b34610000576100be600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506101a3565b6040518082815260200191505060405180910390f35b346100005761010e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506101ed565b005b346100005761014a600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610236565b005b346100005761017960048080359060200190919080359060200190919080359060200190919050506103c4565b60405180848152602001838152602001828152602001935050505060405180910390f35b60005481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050565b7f6031a8d62d7c95988fa262657cd92107d90ed96e08d8f867d32f26edfe85502260405180905060405180910390a17f47e2689743f14e97f7dcfa5eec10ba1dff02f83b3d1d4b9c07b206cbbda66450826040518082815260200191505060405180910390a1817fa48a6b249a5084126c3da369fbc9b16827ead8cb5cdc094b717d3f1dcd995e2960405180905060405180910390a27f7890603b316f3509577afd111710f9ebeefa15e12f72347d9dffd0d65ae3bade81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a18073ffffffffffffffffffffffffffffffffffffffff167f7efef9ea3f60ddc038e50cccec621f86a0195894dc0520482abf8b5c6b659e4160405180905060405180910390a28181604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a05b5050565b6000600060008585859250925092505b935093509390505600a165627a7a72305820aaf842d0d0c35c45622c5263cbb54813d2974d3999c8c38551d7c613ea2bc1170029",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x1234",
"0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9": "0x01"
}
},
"0x0000000000000000000000000000000000000315": {
"balance": "0x9999999999999999999999999999999",
"code": "0x60606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063ef2769ca1461003e575b610000565b3461000057610078600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061007a565b005b8173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051809050600060405180830381858888f1935050505015610106578173ffffffffffffffffffffffffffffffffffffffff167f30a3c50752f2552dcc2b93f5b96866280816a986c0c0408cb6778b9fa198288f826040518082815260200191505060405180910390a25b5b50505600a165627a7a72305820637991fabcc8abad4294bf2bb615db78fbec4edff1635a2647d3894e2daf6a610029"
},
"0x0000000000000000000000000000000000000316": {
"balance": "0x0",
"code": "0x444355"
},
"0x0000000000000000000000000000000000000317": {
"balance": "0x0",
"code": "0x600160003555"
"0x000f3df6d732807ef1319fb7b8bb8522d0beac02": {
"nonce": "0x01",
"balance": "0x00",
"code": "0x3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500",
"storage": {}
},
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"nonce": "0x00",
"balance": "0x1d6329f1c35ca4bfabb9f5610000000000",
"code": "0x",
"storage": {}
},
"0x0000000000000000000000000000000000000001": {
"builtin": {
Expand Down Expand Up @@ -206,4 +194,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Ethereum.Test.Base;
using NUnit.Framework;

namespace Ethereum.Blockchain.Pyspec.Test;

[TestFixture]
[Parallelizable(ParallelScope.All)]
[Explicit("These tests are not ready yet")]
public class PragueBlockChainTests : BlockchainTestBase
{
[TestCaseSource(nameof(LoadTests))]
public async Task Test(BlockchainTest test) => await RunTest(test);

private static IEnumerable<BlockchainTest> LoadTests()
{
TestsSourceLoader loader = new(new LoadPyspecTestsStrategy(), $"fixtures/blockchain_tests/prague");
return loader.LoadTests().OfType<BlockchainTest>();
}
}
22 changes: 22 additions & 0 deletions src/Nethermind/Ethereum.Blockchain.Pyspec.Test/PragueStateTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Linq;
using Ethereum.Test.Base;
using FluentAssertions;
using NUnit.Framework;

namespace Ethereum.Blockchain.Pyspec.Test;

[TestFixture]
[Parallelizable(ParallelScope.All)]
[Explicit("These tests are not ready yet")]
public class PragueStateTests : GeneralStateTestBase
{
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test) => RunTest(test).Pass.Should().BeTrue();

private static IEnumerable<GeneralStateTest> LoadTests()
{
TestsSourceLoader loader = new(new LoadPyspecTestsStrategy(), $"fixtures/state_tests/prague");
return loader.LoadTests().Cast<GeneralStateTest>();
}
}
16 changes: 16 additions & 0 deletions src/Nethermind/Ethereum.Test.Base/AuthorizationListJson.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using Nethermind.Core;

namespace Ethereum.Test.Base;
public class AuthorizationListJson
{
public ulong ChainId { get; set; }
public Address Address { get; set; }
public ulong Nonce { get; set; }
public ulong V { get; set; }
public byte[] R { get; set; }
public byte[] S { get; set; }
public Address Signer { get; set; }
}
8 changes: 6 additions & 2 deletions src/Nethermind/Ethereum.Test.Base/GeneralTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,16 @@ protected EthereumTestResult RunTest(GeneralStateTest test, ITxTracer txTracer)

Block block = Build.A.Block.WithTransactions(test.Transaction).WithHeader(header).TestObject;

bool isValid = _txValidator.IsWellFormed(test.Transaction, spec) && IsValidBlock(block, specProvider);
ValidationResult txIsValid = _txValidator.IsWellFormed(test.Transaction, spec);

if (isValid)
if (txIsValid)
{
transactionProcessor.Execute(test.Transaction, new BlockExecutionContext(header), txTracer);
}
else
{
_logger.Info($"Skipping invalid tx with error: {txIsValid.Error}");
}

stopwatch.Stop();

Expand Down
19 changes: 19 additions & 0 deletions src/Nethermind/Ethereum.Test.Base/JsonToEthereumTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public static Transaction Convert(PostStateJson postStateJson, TransactionJson t
{
Transaction transaction = new();

transaction.Type = transactionJson.Type;
transaction.Value = transactionJson.Value[postStateJson.Indexes.Value];
transaction.GasLimit = transactionJson.GasLimit[postStateJson.Indexes.Gas];
transaction.GasPrice = transactionJson.GasPrice ?? transactionJson.MaxPriorityFeePerGas ?? 0;
Expand Down Expand Up @@ -157,6 +158,23 @@ public static Transaction Convert(PostStateJson postStateJson, TransactionJson t
if (transaction.BlobVersionedHashes?.Length > 0)
transaction.Type = TxType.Blob;

if (transactionJson.AuthorizationList is not null)
{
transaction.AuthorizationList =
transactionJson.AuthorizationList
.Select(i => new AuthorizationTuple(
i.ChainId,
i.Address,
i.Nonce,
i.V,
i.R,
i.S)).ToArray();
if (transaction.AuthorizationList.Any())
{
transaction.Type = TxType.SetCode;
}
}

return transaction;
}

Expand Down Expand Up @@ -291,6 +309,7 @@ public static IEnumerable<GeneralStateTest> Convert(string json)
List<GeneralStateTest> tests = new();
foreach (KeyValuePair<string, GeneralStateTestJson> namedTest in testsInFile)
{
Console.WriteLine($"Loading {namedTest.Key}\n {namedTest.Value.Post}");
tests.AddRange(Convert(namedTest.Key, namedTest.Value));
}

Expand Down
1 change: 1 addition & 0 deletions src/Nethermind/Ethereum.Test.Base/LegacyTransactionJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class LegacyTransactionJson
public UInt256 Nonce { get; set; }
public Address To { get; set; }
public UInt256 Value { get; set; }
public string Sender { get; set; }
public byte[] R { get; set; }
public byte[] S { get; set; }
public ulong V { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions src/Nethermind/Ethereum.Test.Base/TransactionJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace Ethereum.Test.Base
{
public class TransactionJson
{
public TxType Type { get; set; }
public Address Sender { get; set; }
public byte[][]? Data { get; set; }
public long[]? GasLimit { get; set; }
public UInt256? GasPrice { get; set; }
Expand All @@ -19,6 +21,7 @@ public class TransactionJson
public byte[]? SecretKey { get; set; }
public AccessListItemJson[]?[]? AccessLists { get; set; }
public AccessListItemJson[]? AccessList { get; set; }
public AuthorizationListJson[]? AuthorizationList { get; set; }
public byte[]?[]? BlobVersionedHashes { get; set; }
public UInt256? MaxFeePerBlobGas { get; set; }
}
Expand Down
Loading

0 comments on commit efb52ca

Please sign in to comment.