Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* berlin update post AllCoreDevs

* update tests to latest develop

* fixed the access exception

* added the new goerli validator

* additional comparison rules for Goerli to support new ideas for impasse resolution

* fixed known addresses

* regression test added

* add clique module method for checking signer

* add clique method to interface

* cleaning some code while looking for a solution to Goerli impasse

* return pending tx count in ethstats properly

* berlin mainnet blocks set

* fixed tests for Belrin on mainnet

* added missing test categories

* modexp fixes

* update tests

* bit length -1 but only on positive

* added tests, failing 2930

* minor cleaning around MODEXP

* 2930 access list tests

* 2930 tests rename and C# 9

* add various missing test categories

* added more missing tests

* added more missing block tests

* bringing back tests that used to be broken and now are fine

* fixed access lists ordering

* NuGet fix

* do not seek VMTests subdir

* disabled subroutine tests

* added flaky test to ignore]

* NDM fix

* some nullability fixes
  • Loading branch information
tkstanczak authored Mar 7, 2021
1 parent 4b66d03 commit 3158aa4
Show file tree
Hide file tree
Showing 538 changed files with 2,872 additions and 1,789 deletions.
6 changes: 5 additions & 1 deletion src/Nethermind/Chains/foundation.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@
"eip1344Transition": "0x8a61c8",
"eip1884Transition": "0x8a61c8",
"eip2028Transition": "0x8a61c8",
"eip2200Transition": "0x8a61c8"
"eip2200Transition": "0x8a61c8",
"eip2565Transition": "0xBAD420",
"eip2718Transition": "0xBAD420",
"eip2929Transition": "0xBAD420",
"eip2930Transition": "0xBAD420"
},
"genesis": {
"seal": {
Expand Down
2 changes: 0 additions & 2 deletions src/Nethermind/Chains/goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
"eip1884Transition": "0x17D433",
"eip2028Transition": "0x17D433",
"eip2200Transition": "0x17D433",
"eip2315Transition": "0x441064",
"eip2537Transition": "0x441064",
"eip2565Transition": "0x441064",
"eip2718Transition": "0x441064",
"eip2929Transition": "0x441064",
Expand Down
2 changes: 0 additions & 2 deletions src/Nethermind/Chains/rinkeby.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
"eip1884Transition": "0x52efd1",
"eip2028Transition": "0x52efd1",
"eip2200Transition": "0x52efd1",
"eip2315Transition": "0x7E8270",
"eip2537Transition": "0x7E8270",
"eip2565Transition": "0x7E8270",
"eip2718Transition": "0x7E8270",
"eip2929Transition": "0x7E8270",
Expand Down
2 changes: 0 additions & 2 deletions src/Nethermind/Chains/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
"eip1884Transition": "0x62F756",
"eip2028Transition": "0x62F756",
"eip2200Transition": "0x62F756",
"eip2315Transition": "0x95B8DD",
"eip2537Transition": "0x95B8DD",
"eip2565Transition": "0x95B8DD",
"eip2718Transition": "0x95B8DD",
"eip2929Transition": "0x95B8DD",
Expand Down
6 changes: 3 additions & 3 deletions src/Nethermind/Ethereum.Abi.Test/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void Setup()
{
}

private static Dictionary<string, AbiType> _abiTypes = new Dictionary<string, AbiType>
private static Dictionary<string, AbiType> _abiTypes = new()
{
{"uint256", AbiType.UInt256},
{"uint32[]", new AbiArray(AbiType.UInt32)},
Expand Down Expand Up @@ -74,11 +74,11 @@ public void Test_abi_encoding()
Dictionary<string, AbiTest> tests = JsonConvert.DeserializeObject<Dictionary<string, AbiTest>>(text);
foreach ((string testName, AbiTest abiTest) in tests)
{
AbiSignature signature = new AbiSignature(
AbiSignature signature = new(
testName,
abiTest.Types.Select(t => _abiTypes[t]).ToArray());

AbiEncoder encoder = new AbiEncoder();
AbiEncoder encoder = new();
byte[] abi = encoder.Encode(AbiEncodingStyle.None, signature, abiTest.Args.Select(JsonToObject).ToArray());
abi.Should().BeEquivalentTo(Bytes.FromHexString(abiTest.Result));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Nethermind/Ethereum.Basic.Test/TransactionTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Ethereum.Test.Base;
using NUnit.Framework;

namespace Ethereum.Blockchain.Block.Legacy.Test
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class RandomBlockhashTests : BlockchainTestBase
{
[TestCaseSource(nameof(LoadTests))]
public async Task Test(BlockchainTest test)
{
await RunTest(test);
}
public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcRandomBlockhashTest");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
23 changes: 23 additions & 0 deletions src/Nethermind/Ethereum.Blockchain.Block.Legacy.Test/StateTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Ethereum.Test.Base;
using NUnit.Framework;

namespace Ethereum.Blockchain.Block.Legacy.Test
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class StateTests : BlockchainTestBase
{
[TestCaseSource(nameof(LoadTests))]
public async Task Test(BlockchainTest test)
{
await RunTest(test);
}
public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcStateTests");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Ethereum.Test.Base;
using NUnit.Framework;

namespace Ethereum.Blockchain.Block.Legacy.Test
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
public class TotalDifficultyTests : BlockchainTestBase
{
[TestCaseSource(nameof(LoadTests))]
public async Task Test(BlockchainTest test)
{
await RunTest(test);
}
public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcTotalDifficultyTest");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public async Task Test(BlockchainTest test)

public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcForkStressTest");
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcUncleHeaderValidity");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public async Task Test(BlockchainTest test)

public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcForkStressTest");
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcUncleSpecialTests");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public async Task Test(BlockchainTest test)

public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcForkStressTest");
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcUncleTest");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public async Task Test(BlockchainTest test)

public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcForkStressTest");
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcValidBlockTest");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public async Task Test(BlockchainTest test)

public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcForkStressTest");
var loader = new TestsSourceLoader(new LoadLegacyBlockchainTestsStrategy(), "bcWalletTest");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -39,4 +39,4 @@ public static IEnumerable<BlockchainTest> LoadTests()
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\tests\BlockchainTests\ValidBlocks\VMTests\vm*\*.*">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<!-- <Content Include="..\..\tests\BlockchainTests\InvalidBlocks\bc*\*.*">-->
<!-- <Link>InvalidBlocks\%(RecursiveDir)%(FileName)%(Extension)</Link>-->
<!-- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>-->
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Ethereum.Blockchain.Block.Test/ExploitTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -41,4 +41,4 @@ public static IEnumerable<BlockchainTest> LoadTests()
}


}
}
4 changes: 2 additions & 2 deletions src/Nethermind/Ethereum.Blockchain.Block.Test/ForgedTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -45,4 +45,4 @@ public static IEnumerable<BlockchainTest> LoadTests()
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -39,4 +39,4 @@ public static IEnumerable<BlockchainTest> LoadTests()
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -39,4 +39,4 @@ public static IEnumerable<BlockchainTest> LoadTests()
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -39,4 +39,4 @@ public static IEnumerable<BlockchainTest> LoadTests()
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
15 changes: 9 additions & 6 deletions src/Nethermind/Ethereum.Blockchain.Block.Test/MetaTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -30,10 +30,12 @@ public class MetaTests
[Test]
public void All_categories_are_tested()
{
string[] directories = Directory.GetDirectories(AppDomain.CurrentDomain.BaseDirectory)
string[] directories =
Directory.GetDirectories(AppDomain.CurrentDomain.BaseDirectory)
.Select(Path.GetFileName)
.Where(d =>d.StartsWith("bc"))
.Where(d =>d.StartsWith("bc") || d.StartsWith("vm"))
.ToArray();

Type[] types = GetType().Assembly.GetTypes();
List<string> missingCategories = new List<string>();
foreach (string directory in directories)
Expand All @@ -46,7 +48,7 @@ public void All_categories_are_tested()
continue;
}

missingCategories.Add(directory);
missingCategories.Add(directory + " expected " + expectedTypeName);
}
}

Expand All @@ -60,6 +62,7 @@ public void All_categories_are_tested()

private static string ExpectedTypeName(string directory)
{
string prefix = directory.StartsWith("vm") ? "Vm" : "";
string expectedTypeName = directory.Remove(0, 2);
if (!expectedTypeName.EndsWith("Tests"))
{
Expand All @@ -73,7 +76,7 @@ private static string ExpectedTypeName(string directory)
}
}

return expectedTypeName;
return prefix + expectedTypeName;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -39,4 +39,4 @@ public static IEnumerable<BlockchainTest> LoadTests()
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -34,8 +34,8 @@ public async Task Test(BlockchainTest test)
}
public static IEnumerable<BlockchainTest> LoadTests()
{
var loader = new TestsSourceLoader(new LoadBlockchainTestsStrategy(), "bcRandomBlockhashTests");
var loader = new TestsSourceLoader(new LoadBlockchainTestsStrategy(), "bcRandomBlockhashTest");
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
4 changes: 2 additions & 2 deletions src/Nethermind/Ethereum.Blockchain.Block.Test/StateTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Demerzel Solutions Limited
* Copyright (c) 2021 Demerzel Solutions Limited
* This file is part of the Nethermind library.
*
* The Nethermind library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -41,4 +41,4 @@ public static IEnumerable<BlockchainTest> LoadTests()
return (IEnumerable<BlockchainTest>)loader.LoadTests();
}
}
}
}
Loading

0 comments on commit 3158aa4

Please sign in to comment.