diff --git a/src/Nethermind/Directory.Packages.props b/src/Nethermind/Directory.Packages.props
index 7bf34ecfeb5..a82c8f71f14 100644
--- a/src/Nethermind/Directory.Packages.props
+++ b/src/Nethermind/Directory.Packages.props
@@ -57,9 +57,9 @@
-
-
-
+
+
+
diff --git a/src/Nethermind/Ethereum.Abi.Test/Tests.cs b/src/Nethermind/Ethereum.Abi.Test/Tests.cs
index 3edf18e0567..3b6c1d24c89 100644
--- a/src/Nethermind/Ethereum.Abi.Test/Tests.cs
+++ b/src/Nethermind/Ethereum.Abi.Test/Tests.cs
@@ -53,7 +53,7 @@ public void Test_abi_encoding()
}
catch (IOException)
{
- TestContext.WriteLine($"Could not find test in {potentialLocation}");
+ TestContext.Out.WriteLine($"Could not find test in {potentialLocation}");
}
}
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ArgsZeroOneBalanceTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ArgsZeroOneBalanceTests.cs
index 81db55dd96d..c8ee2ce85e1 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ArgsZeroOneBalanceTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ArgsZeroOneBalanceTests.cs
@@ -5,22 +5,20 @@
using Ethereum.Test.Base;
using NUnit.Framework;
-namespace Ethereum.Blockchain.Legacy.Test
+namespace Ethereum.Blockchain.Legacy.Test;
+
+[Parallelizable(ParallelScope.All)]
+public class ArgsZeroOneBalanaceTests : GeneralStateTestBase
{
- [TestFixture]
- [Parallelizable(ParallelScope.All)]
- public class ArgsZeroOneBalanaceTests : GeneralStateTestBase
+ [TestCaseSource(nameof(LoadTests))]
+ public void Test(GeneralStateTest test)
{
- [TestCaseSource(nameof(LoadTests))]
- public void Test(GeneralStateTest test)
- {
- Assert.True(RunTest(test).Pass);
- }
+ Assert.That(RunTest(test).Pass, Is.True);
+ }
- public static IEnumerable LoadTests()
- {
- var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stArgsZeroOneBalance");
- return (IEnumerable)loader.LoadTests();
- }
+ public static IEnumerable LoadTests()
+ {
+ var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stArgsZeroOneBalance");
+ return (IEnumerable)loader.LoadTests();
}
}
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/AttackTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/AttackTests.cs
index 60057dc2bcd..4083eaca5ce 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/AttackTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/AttackTests.cs
@@ -5,22 +5,20 @@
using Ethereum.Test.Base;
using NUnit.Framework;
-namespace Ethereum.Blockchain.Legacy.Test
+namespace Ethereum.Blockchain.Legacy.Test;
+
+[Parallelizable(ParallelScope.All)]
+public class AttackTests : GeneralStateTestBase
{
- [TestFixture]
- [Parallelizable(ParallelScope.All)]
- public class AttackTests : GeneralStateTestBase
+ [TestCaseSource(nameof(LoadTests))]
+ public void Test(GeneralStateTest test)
{
- [TestCaseSource(nameof(LoadTests))]
- public void Test(GeneralStateTest test)
- {
- Assert.True(RunTest(test).Pass);
- }
+ Assert.That(RunTest(test).Pass, Is.True);
+ }
- public static IEnumerable LoadTests()
- {
- var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stAttackTest");
- return (IEnumerable)loader.LoadTests();
- }
+ public static IEnumerable LoadTests()
+ {
+ var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stAttackTest");
+ return (IEnumerable)loader.LoadTests();
}
}
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/BadOpCodeTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/BadOpCodeTests.cs
index 9161df19653..881c72bc5e8 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/BadOpCodeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/BadOpCodeTests.cs
@@ -5,22 +5,20 @@
using Ethereum.Test.Base;
using NUnit.Framework;
-namespace Ethereum.Blockchain.Legacy.Test
+namespace Ethereum.Blockchain.Legacy.Test;
+
+[Parallelizable(ParallelScope.All)]
+public class BadOpCodeTests : GeneralStateTestBase
{
- [TestFixture]
- [Parallelizable(ParallelScope.All)]
- public class BadOpCodeTests : GeneralStateTestBase
+ [TestCaseSource(nameof(LoadTests))]
+ public void Test(GeneralStateTest test)
{
- [TestCaseSource(nameof(LoadTests))]
- public void Test(GeneralStateTest test)
- {
- Assert.True(RunTest(test).Pass);
- }
+ Assert.That(RunTest(test).Pass, Is.True);
+ }
- public static IEnumerable LoadTests()
- {
- var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stBadOpcode");
- return (IEnumerable)loader.LoadTests();
- }
+ public static IEnumerable LoadTests()
+ {
+ var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stBadOpcode");
+ return (IEnumerable)loader.LoadTests();
}
}
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/BugsTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/BugsTests.cs
index f8d97d9f2c5..9c4f2e6beec 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/BugsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/BugsTests.cs
@@ -5,22 +5,20 @@
using Ethereum.Test.Base;
using NUnit.Framework;
-namespace Ethereum.Blockchain.Legacy.Test
+namespace Ethereum.Blockchain.Legacy.Test;
+
+[Parallelizable(ParallelScope.All)]
+public class BugsTets : GeneralStateTestBase
{
- [TestFixture]
- [Parallelizable(ParallelScope.All)]
- public class BugsTets : GeneralStateTestBase
+ [TestCaseSource(nameof(LoadTests))]
+ public void Test(GeneralStateTest test)
{
- [TestCaseSource(nameof(LoadTests))]
- public void Test(GeneralStateTest test)
- {
- Assert.True(RunTest(test).Pass);
- }
+ Assert.That(RunTest(test).Pass, Is.True);
+ }
- public static IEnumerable LoadTests()
- {
- var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stBugs");
- return (IEnumerable)loader.LoadTests();
- }
+ public static IEnumerable LoadTests()
+ {
+ var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stBugs");
+ return (IEnumerable)loader.LoadTests();
}
}
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallCodesTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallCodesTests.cs
index 7cf48ca1ad1..e9906133cf2 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallCodesTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallCodesTests.cs
@@ -5,21 +5,19 @@
using Ethereum.Test.Base;
using NUnit.Framework;
-namespace Ethereum.Blockchain.Legacy.Test
+namespace Ethereum.Blockchain.Legacy.Test;
+
+[Parallelizable(ParallelScope.All)]
+public class CallCodesTests : GeneralStateTestBase
{
- [TestFixture]
- [Parallelizable(ParallelScope.All)]
- public class CallCodesTests : GeneralStateTestBase
+ [TestCaseSource(nameof(LoadTests))]
+ public void Test(GeneralStateTest test)
+ {
+ Assert.That(RunTest(test).Pass, Is.True);
+ }
+ public static IEnumerable LoadTests()
{
- [TestCaseSource(nameof(LoadTests))]
- public void Test(GeneralStateTest test)
- {
- Assert.True(RunTest(test).Pass);
- }
- public static IEnumerable LoadTests()
- {
- var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stCallCodes");
- return (IEnumerable)loader.LoadTests();
- }
+ var loader = new TestsSourceLoader(new LoadLegacyGeneralStateTestsStrategy(), "stCallCodes");
+ return (IEnumerable)loader.LoadTests();
}
}
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallCreateCallCodeTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallCreateCallCodeTests.cs
index 6005eb16d10..30651ec8df2 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallCreateCallCodeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallCreateCallCodeTests.cs
@@ -14,7 +14,7 @@ public class CallCreateCallCodeTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallDelegateCodesCallCodeHomesteadTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallDelegateCodesCallCodeHomesteadTests.cs
index d32977b101b..e739212b9f3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallDelegateCodesCallCodeHomesteadTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallDelegateCodesCallCodeHomesteadTests.cs
@@ -14,7 +14,7 @@ public class CallDelegateCodesCallCodeHomesteadTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallDelegateCodesHomesteadTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallDelegateCodesHomesteadTests.cs
index dcd1b8b11cd..4fcba7c54c4 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallDelegateCodesHomesteadTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CallDelegateCodesHomesteadTests.cs
@@ -14,7 +14,7 @@ public class CallDelegateCodesHomesteadTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
{
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ChangedEIP150Tests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ChangedEIP150Tests.cs
index 5e59862afd8..8a4d19007d3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ChangedEIP150Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ChangedEIP150Tests.cs
@@ -14,7 +14,7 @@ public class ChangedEIP150Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CodeCopyTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CodeCopyTests.cs
index e8762eaca82..9dabdeb8db8 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CodeCopyTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CodeCopyTests.cs
@@ -14,7 +14,7 @@ public class CodeCopyTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CodeSizeLimitTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CodeSizeLimitTests.cs
index 985472b5910..0e6a0a1a3be 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CodeSizeLimitTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CodeSizeLimitTests.cs
@@ -14,7 +14,7 @@ public class CodeSizeLimitTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Create2Tests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Create2Tests.cs
index 242ba20a2e7..35d2bca5afa 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Create2Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Create2Tests.cs
@@ -14,7 +14,7 @@ public class Create2Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CreateTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CreateTests.cs
index 83453c975c0..17882e6bfc7 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CreateTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/CreateTests.cs
@@ -14,7 +14,7 @@ public class CreateTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/DelegateCallTestHomesteadTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/DelegateCallTestHomesteadTests.cs
index f392fd2be7f..885b20650d0 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/DelegateCallTestHomesteadTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/DelegateCallTestHomesteadTests.cs
@@ -14,7 +14,7 @@ public class DelegateCallTestHomesteadTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/EIP150SingleCodeGasPricesTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/EIP150SingleCodeGasPricesTests.cs
index ce4998a73c8..d1618b3ad18 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/EIP150SingleCodeGasPricesTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/EIP150SingleCodeGasPricesTests.cs
@@ -14,7 +14,7 @@ public class EIP150SingleCodeGasPricesTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Eip150SpecificTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Eip150SpecificTests.cs
index 4dd920396a7..a47b3306aee 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Eip150SpecificTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Eip150SpecificTests.cs
@@ -14,7 +14,7 @@ public class Eip150SpecificTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Eip158SpecificTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Eip158SpecificTests.cs
index b4af049d9f6..abdfd91772e 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Eip158SpecificTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Eip158SpecificTests.cs
@@ -14,7 +14,7 @@ public class Eip158SpecificTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ExampleTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ExampleTests.cs
index a05eef7b8f1..9cc75a46334 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ExampleTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ExampleTests.cs
@@ -14,7 +14,7 @@ public class ExampleTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ExtCodeHashTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ExtCodeHashTests.cs
index 0f45d9cc570..4baf5578084 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ExtCodeHashTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ExtCodeHashTests.cs
@@ -14,7 +14,7 @@ public class ExtCodeHashTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/HomesteadSpecificTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/HomesteadSpecificTests.cs
index 6d5ae56843e..316e690a128 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/HomesteadSpecificTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/HomesteadSpecificTests.cs
@@ -14,7 +14,7 @@ public class HomesteadSpecificTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/InitCodeTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/InitCodeTests.cs
index 3dac60373ad..440c7cd2905 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/InitCodeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/InitCodeTests.cs
@@ -14,7 +14,7 @@ public class InitCodeTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/LogTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/LogTests.cs
index 80058cbad05..22719043928 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/LogTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/LogTests.cs
@@ -14,7 +14,7 @@ public class LogTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemExpandingEip150CallsTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemExpandingEip150CallsTests.cs
index 1df386c0bd1..260f4b4045b 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemExpandingEip150CallsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemExpandingEip150CallsTests.cs
@@ -14,7 +14,7 @@ public class MemExpandingEip150CallsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemoryStressTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemoryStressTests.cs
index 9636d95c535..5f5d46fcceb 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemoryStressTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemoryStressTests.cs
@@ -14,7 +14,7 @@ public class MemoryStressTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemoryTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemoryTests.cs
index cac3fd8557f..8da88320042 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemoryTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/MemoryTests.cs
@@ -14,7 +14,7 @@ public class MemoryTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
{
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/NonZeroCallTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/NonZeroCallTests.cs
index 59d47c52402..a18fc5dbcd5 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/NonZeroCallTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/NonZeroCallTests.cs
@@ -14,7 +14,7 @@ public class NonZeroCallTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/PreCompiledContracts2Tests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/PreCompiledContracts2Tests.cs
index 25be4699f8c..0157e2d52d5 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/PreCompiledContracts2Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/PreCompiledContracts2Tests.cs
@@ -14,7 +14,7 @@ public class PreCompiledContracts2Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/PreCompiledContractsTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/PreCompiledContractsTests.cs
index e8f3666137b..683397c7341 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/PreCompiledContractsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/PreCompiledContractsTests.cs
@@ -14,7 +14,7 @@ public class PreCompiledContractsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/QuadraticComplexityTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/QuadraticComplexityTests.cs
index dfa26f83600..b69e62e832b 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/QuadraticComplexityTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/QuadraticComplexityTests.cs
@@ -14,7 +14,7 @@ public class QuadraticComplexityTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Random2Tests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Random2Tests.cs
index 7783bcb03d2..085c9057bb9 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Random2Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/Random2Tests.cs
@@ -14,7 +14,7 @@ public class Random2Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RandomTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RandomTests.cs
index 45103b0b33a..f4e873bc876 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RandomTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RandomTests.cs
@@ -14,7 +14,7 @@ public class RandomTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RecursiveCreateTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RecursiveCreateTests.cs
index 532d3eac6aa..fba11d1ea19 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RecursiveCreateTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RecursiveCreateTests.cs
@@ -14,7 +14,7 @@ public class RecursiveCreateTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RefundTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RefundTests.cs
index c718c700800..c3e2edf5ec2 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RefundTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RefundTests.cs
@@ -14,7 +14,7 @@ public class RefundTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ReturnDataTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ReturnDataTests.cs
index b17848977a5..2e213865216 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ReturnDataTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ReturnDataTests.cs
@@ -14,7 +14,7 @@ public class ReturnDataTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RevertTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RevertTests.cs
index 1811a5dea22..713c649a2c5 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RevertTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/RevertTests.cs
@@ -15,7 +15,7 @@ public class RevertTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SStoreTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SStoreTests.cs
index d98891e599d..3b451e3f25a 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SStoreTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SStoreTests.cs
@@ -14,7 +14,7 @@ public class SStoreTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ShiftTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ShiftTests.cs
index 181e07df104..fb5e7fa6f69 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ShiftTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ShiftTests.cs
@@ -14,7 +14,7 @@ public class ShiftTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SolidityTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SolidityTests.cs
index 4f4286de4fa..dde781ad0c8 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SolidityTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SolidityTests.cs
@@ -14,7 +14,7 @@ public class SolidityTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SpecialTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SpecialTests.cs
index 15269bdfd83..826fe9ab636 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SpecialTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SpecialTests.cs
@@ -15,7 +15,7 @@ public class SpecialTests : GeneralStateTestBase
[Retry(3)]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/StackTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/StackTests.cs
index 9537453d16c..6c8600ceabd 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/StackTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/StackTests.cs
@@ -14,7 +14,7 @@ public class StackTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/StaticCallTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/StaticCallTests.cs
index cc03dbdd226..7ff4fa7a9d2 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/StaticCallTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/StaticCallTests.cs
@@ -14,7 +14,7 @@ public class StaticCallTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SystemOperationsTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SystemOperationsTests.cs
index 6fb261a0187..f64a2c715f9 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SystemOperationsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/SystemOperationsTests.cs
@@ -14,7 +14,7 @@ public class SystemOperationsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TimeConsumingTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TimeConsumingTests.cs
index 7e4cb1ef3b6..2c297fdaac0 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TimeConsumingTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TimeConsumingTests.cs
@@ -14,7 +14,7 @@ public class TimeConsumingTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TransactionTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TransactionTests.cs
index 1396faaa933..2736ccdcb1d 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TransactionTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TransactionTests.cs
@@ -14,7 +14,7 @@ public class TransactionTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TransitionTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TransitionTests.cs
index 150e263ff62..24327c15260 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TransitionTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/TransitionTests.cs
@@ -14,7 +14,7 @@ public class TransitionTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/WalletTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/WalletTests.cs
index b0156f84e66..f13698011c3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/WalletTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/WalletTests.cs
@@ -14,7 +14,7 @@ public class WalletTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroCallsRevertTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroCallsRevertTests.cs
index ea3cb94386e..bdf69dd1b69 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroCallsRevertTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroCallsRevertTests.cs
@@ -14,7 +14,7 @@ public class ZeroCallsRevertTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroCallsTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroCallsTests.cs
index 0cb161edd47..89f957ecf83 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroCallsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroCallsTests.cs
@@ -14,7 +14,7 @@ public class ZeroCallsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroKnowledge2Tests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroKnowledge2Tests.cs
index d7387613dd4..559441d537d 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroKnowledge2Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroKnowledge2Tests.cs
@@ -14,7 +14,7 @@ public class ZeroKnowledge2Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroKnowledgeTests.cs b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroKnowledgeTests.cs
index 8f5daf72c75..026fcd0fcf3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroKnowledgeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Legacy.Test/ZeroKnowledgeTests.cs
@@ -14,7 +14,7 @@ public class ZeroKnowledgeTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ArgsZeroOneBalanceTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ArgsZeroOneBalanceTests.cs
index 5db1726704f..98f88a5df87 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ArgsZeroOneBalanceTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ArgsZeroOneBalanceTests.cs
@@ -14,7 +14,7 @@ public class ArgsZeroOneBalanceTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/AttackTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/AttackTests.cs
index 37a37b89a7a..7807c5e51a0 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/AttackTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/AttackTests.cs
@@ -14,7 +14,7 @@ public class AttackTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/BadOpcodeTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/BadOpcodeTests.cs
index e90821b0a4a..54ee33d93b9 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/BadOpcodeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/BadOpcodeTests.cs
@@ -16,7 +16,7 @@ public class BadOpcodeTests : GeneralStateTestBase
[Retry(3)]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/BlockhashTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/BlockhashTests.cs
index 29963fbcaf2..7e621f779f3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/BlockhashTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/BlockhashTests.cs
@@ -16,7 +16,7 @@ public class BlockhashTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/BugsTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/BugsTests.cs
index cf531d83418..c1bf2149470 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/BugsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/BugsTests.cs
@@ -14,7 +14,7 @@ public class BugsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/CallCodeTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/CallCodeTests.cs
index b7a15e7a94b..bda00b0f1f4 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/CallCodeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/CallCodeTests.cs
@@ -14,7 +14,7 @@ public class CallCodesTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/CallCreateCallCodeTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/CallCreateCallCodeTests.cs
index be1a7831e17..1d3ea3c7e94 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/CallCreateCallCodeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/CallCreateCallCodeTests.cs
@@ -14,7 +14,7 @@ public class CallCreateCallCodeTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/CallDelegateCodesCallCodeHomesteadTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/CallDelegateCodesCallCodeHomesteadTests.cs
index 397609494fc..20cd25070b3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/CallDelegateCodesCallCodeHomesteadTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/CallDelegateCodesCallCodeHomesteadTests.cs
@@ -14,7 +14,7 @@ public class CallDelegateCodesCallCodeHomesteadTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/CallDelegateCodesHomesteadTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/CallDelegateCodesHomesteadTests.cs
index 3f98125a892..e88999d517d 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/CallDelegateCodesHomesteadTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/CallDelegateCodesHomesteadTests.cs
@@ -14,7 +14,7 @@ public class CallDelegateCodesHomesteadTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ChainIdTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ChainIdTests.cs
index 9711e655a5d..fb32ef488fb 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ChainIdTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ChainIdTests.cs
@@ -14,7 +14,7 @@ public class ChainIdTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/CodeCopyTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/CodeCopyTests.cs
index 0e86ed2cca5..1cca26a70e7 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/CodeCopyTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/CodeCopyTests.cs
@@ -14,7 +14,7 @@ public class CodeCopyTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/CodeSizeLimitTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/CodeSizeLimitTests.cs
index 2a34e531437..8355900e130 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/CodeSizeLimitTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/CodeSizeLimitTests.cs
@@ -14,7 +14,7 @@ public class CodeSizeLimitTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Create2Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Create2Tests.cs
index d70554854c6..a518ec7f3c8 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Create2Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Create2Tests.cs
@@ -14,7 +14,7 @@ public class Create2Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/CreateTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/CreateTests.cs
index b84a7b55eb3..9dbd4c59b38 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/CreateTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/CreateTests.cs
@@ -15,7 +15,7 @@ public class CreateTests : GeneralStateTestBase
[Retry(3)]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/DelegateCallTestHomesteadTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/DelegateCallTestHomesteadTests.cs
index 71b2e32acb1..07b38e904c5 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/DelegateCallTestHomesteadTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/DelegateCallTestHomesteadTests.cs
@@ -14,7 +14,7 @@ public class DelegateCallTestHomesteadTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/EIP150SingleCodeGasPricesTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/EIP150SingleCodeGasPricesTests.cs
index 64cb2ca29d9..9ec5c5f902c 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/EIP150SingleCodeGasPricesTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/EIP150SingleCodeGasPricesTests.cs
@@ -14,7 +14,7 @@ public class Eip150SingleCodeGasPricesTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/EIP6110Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/EIP6110Tests.cs
index d55bf6b3af1..64b6e80209d 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/EIP6110Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/EIP6110Tests.cs
@@ -14,7 +14,7 @@ public class Eip6110Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip1153Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip1153Tests.cs
index 056d80d94f0..fbb7baa2c1f 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip1153Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip1153Tests.cs
@@ -14,7 +14,7 @@ public class EIP1153transientStorageTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip150SpecificTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip150SpecificTests.cs
index 6ff98009dc9..1e2cca8beac 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip150SpecificTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip150SpecificTests.cs
@@ -14,7 +14,7 @@ public class Eip150SpecificTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip1559Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip1559Tests.cs
index 27f847e1541..0f8f14effc1 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip1559Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip1559Tests.cs
@@ -14,7 +14,7 @@ public class Eip1559Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip158SpecificTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip158SpecificTests.cs
index 59d8e46b707..2cba21a51c9 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip158SpecificTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip158SpecificTests.cs
@@ -14,7 +14,7 @@ public class Eip158SpecificTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip2537Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip2537Tests.cs
index 23fe74ca1a3..ec0b408d0db 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip2537Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip2537Tests.cs
@@ -14,7 +14,7 @@ public class Eip2537Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip2930Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip2930Tests.cs
index bbdfee1df2d..28d80c6bfbe 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip2930Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip2930Tests.cs
@@ -14,7 +14,7 @@ public class Eip2930Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip3540Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip3540Tests.cs
index 7d39ed7ef51..9e9d5dc1924 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip3540Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip3540Tests.cs
@@ -16,7 +16,7 @@ public class Eip3540Tests : GeneralStateTestBase
// [TestCaseSource(nameof(LoadTests))]
// public void Test(GeneralStateTest test)
// {
- // Assert.True(RunTest(test).Pass);
+ // Assert.That(RunTest(test).Pass, Is.True);
// }
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip3607Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip3607Tests.cs
index afcca56a34c..c8f7121207d 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip3607Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip3607Tests.cs
@@ -14,7 +14,7 @@ public class Eip3607Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip3651WarmCoinbaseTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip3651WarmCoinbaseTests.cs
index 7628583e30e..567c97f0cd4 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip3651WarmCoinbaseTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip3651WarmCoinbaseTests.cs
@@ -14,7 +14,7 @@ public class Eip3651WarmCoinbaseTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip3855Push0Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip3855Push0Tests.cs
index c54418db7f3..4915e9ec236 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip3855Push0Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip3855Push0Tests.cs
@@ -14,7 +14,7 @@ public class Eip3855Push0Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip3860LimitmeterInitCodeTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip3860LimitmeterInitCodeTests.cs
index baebeaab864..70c0295872b 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip3860LimitmeterInitCodeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip3860LimitmeterInitCodeTests.cs
@@ -14,7 +14,7 @@ public class Eip3860LimitmeterInitCodeTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip4844Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip4844Tests.cs
index 76fedb8c2e5..f8ede23b307 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip4844Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip4844Tests.cs
@@ -14,7 +14,7 @@ public class EIP4844blobtransactionsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Eip5656Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Eip5656Tests.cs
index 1a48e321290..979d03a3d88 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Eip5656Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Eip5656Tests.cs
@@ -14,7 +14,7 @@ public class EIP5656MCOPYTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/EofTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/EofTests.cs
index f4fad766299..251ec083de0 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/EofTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/EofTests.cs
@@ -16,7 +16,7 @@ public class EOFTests : GeneralStateTestBase
// [TestCaseSource(nameof(LoadTests))]
// public void Test(GeneralStateTest test)
// {
- // Assert.True(RunTest(test).Pass);
+ // Assert.That(RunTest(test).Pass, Is.True);
// }
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ExampleTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ExampleTests.cs
index c241f7697fa..eacd39a47d9 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ExampleTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ExampleTests.cs
@@ -14,7 +14,7 @@ public class ExampleTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ExtCodeHashTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ExtCodeHashTests.cs
index 72eb4715fbf..4e37b44b359 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ExtCodeHashTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ExtCodeHashTests.cs
@@ -14,7 +14,7 @@ public class ExtCodeHashTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/HomesteadSpecificTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/HomesteadSpecificTests.cs
index 02c154318a0..04669079f47 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/HomesteadSpecificTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/HomesteadSpecificTests.cs
@@ -14,7 +14,7 @@ public class HomesteadSpecificTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/InitCodeTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/InitCodeTests.cs
index f258d7e1ad4..47e2827a89d 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/InitCodeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/InitCodeTests.cs
@@ -14,7 +14,7 @@ public class InitCodeTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/LogTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/LogTests.cs
index 2b0aab864ea..a78da46e41f 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/LogTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/LogTests.cs
@@ -14,7 +14,7 @@ public class LogTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/MemExpandingEip150CallsTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/MemExpandingEip150CallsTests.cs
index 0449aece457..ec5f3da4479 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/MemExpandingEip150CallsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/MemExpandingEip150CallsTests.cs
@@ -14,7 +14,7 @@ public class MemExpandingEip150CallsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/MemoryStressTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/MemoryStressTests.cs
index 480fa423113..f3c9b1431bd 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/MemoryStressTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/MemoryStressTests.cs
@@ -14,7 +14,7 @@ public class MemoryStressTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/MemoryTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/MemoryTests.cs
index 3997ca78cff..33089138878 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/MemoryTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/MemoryTests.cs
@@ -15,7 +15,7 @@ public class MemoryTests : GeneralStateTestBase
[Retry(3)]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/NonZeroCallTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/NonZeroCallTests.cs
index 4019346834d..9df35201ced 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/NonZeroCallTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/NonZeroCallTests.cs
@@ -14,7 +14,7 @@ public class NonZeroCallsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/PreCompiledContracts2Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/PreCompiledContracts2Tests.cs
index 99ccd78a2aa..2108d914093 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/PreCompiledContracts2Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/PreCompiledContracts2Tests.cs
@@ -14,7 +14,7 @@ public class PreCompiledContracts2Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/PreCompiledContractsTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/PreCompiledContractsTests.cs
index 00c97d29fab..fbce44d6ac6 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/PreCompiledContractsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/PreCompiledContractsTests.cs
@@ -14,7 +14,7 @@ public class PreCompiledContractsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/QuadraticComplexityTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/QuadraticComplexityTests.cs
index 9180dd2a78c..d8cb9d42dcc 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/QuadraticComplexityTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/QuadraticComplexityTests.cs
@@ -14,7 +14,7 @@ public class QuadraticComplexityTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/Random2Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/Random2Tests.cs
index 44b9d8b75b2..09124501f9d 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/Random2Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/Random2Tests.cs
@@ -14,7 +14,7 @@ public class Random2Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/RandomTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/RandomTests.cs
index 503b3684e68..066c6c83954 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/RandomTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/RandomTests.cs
@@ -14,7 +14,7 @@ public class RandomTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/RecursiveCreateTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/RecursiveCreateTests.cs
index fa97c5ea69f..30f64caca8f 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/RecursiveCreateTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/RecursiveCreateTests.cs
@@ -14,7 +14,7 @@ public class RecursiveCreateTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/RefundTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/RefundTests.cs
index 38570e8fa1f..df0937aacf6 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/RefundTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/RefundTests.cs
@@ -14,7 +14,7 @@ public class RefundTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ReturnDataTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ReturnDataTests.cs
index 00e4c57b2c6..86ce0cc3971 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ReturnDataTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ReturnDataTests.cs
@@ -14,7 +14,7 @@ public class ReturnDataTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/RevertTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/RevertTests.cs
index 33588d24396..c40d233e72e 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/RevertTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/RevertTests.cs
@@ -14,7 +14,7 @@ public class RevertTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/SLoadTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/SLoadTests.cs
index 4fa452180d4..9bd635b50a3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/SLoadTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/SLoadTests.cs
@@ -14,7 +14,7 @@ public class SLoadTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/SStoreTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/SStoreTests.cs
index f2e98a5c73d..7b35c7950c1 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/SStoreTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/SStoreTests.cs
@@ -14,7 +14,7 @@ public class SStoreTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/SelfBalanceTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/SelfBalanceTests.cs
index a18b603bb47..aaebbbac289 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/SelfBalanceTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/SelfBalanceTests.cs
@@ -14,7 +14,7 @@ public class SelfBalanceTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ShiftTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ShiftTests.cs
index e8ccd020c15..cccf0e78808 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ShiftTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ShiftTests.cs
@@ -14,7 +14,7 @@ public class ShiftTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/SolidityTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/SolidityTests.cs
index 98e97de0806..ce0941fb082 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/SolidityTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/SolidityTests.cs
@@ -15,7 +15,7 @@ public class SolidityTests : GeneralStateTestBase
[Retry(3)]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/SpecialTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/SpecialTests.cs
index d931e0b88c4..b3a30484320 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/SpecialTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/SpecialTests.cs
@@ -14,7 +14,7 @@ public class SpecialTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests)), Retry(3)]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/StackTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/StackTests.cs
index 14293bb58ae..b966cf1f84a 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/StackTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/StackTests.cs
@@ -14,7 +14,7 @@ public class StackTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/StaticCallTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/StaticCallTests.cs
index f2eff44c1bf..09fd0875f07 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/StaticCallTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/StaticCallTests.cs
@@ -14,7 +14,7 @@ public class StaticCallTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/StaticFlagEnabledTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/StaticFlagEnabledTests.cs
index 45af9c583ad..d66cf77d0f3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/StaticFlagEnabledTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/StaticFlagEnabledTests.cs
@@ -14,7 +14,7 @@ public class StaticFlagEnabledTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/SystemOperationsTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/SystemOperationsTests.cs
index 5ecf1b56f68..242d460cdd7 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/SystemOperationsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/SystemOperationsTests.cs
@@ -14,7 +14,7 @@ public class SystemOperationsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/TimeConsumingTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/TimeConsumingTests.cs
index 0967afdcf8d..f49ecc8a56c 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/TimeConsumingTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/TimeConsumingTests.cs
@@ -14,7 +14,7 @@ public class TimeConsumingTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/TransactionTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/TransactionTests.cs
index bc7b054e356..a546bf2eebb 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/TransactionTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/TransactionTests.cs
@@ -27,7 +27,7 @@ public void Test(GeneralStateTest test)
return;
}
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/TransitionTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/TransitionTests.cs
index d426ce9d76b..aa1a185e5d5 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/TransitionTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/TransitionTests.cs
@@ -14,7 +14,7 @@ public class TransitionTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/WalletTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/WalletTests.cs
index d5b980c3c2f..ee26a53f650 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/WalletTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/WalletTests.cs
@@ -14,7 +14,7 @@ public class WalletTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ZeroCallsRevertTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ZeroCallsRevertTests.cs
index 02c345a93e3..5a2896ad9f3 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ZeroCallsRevertTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ZeroCallsRevertTests.cs
@@ -14,7 +14,7 @@ public class ZeroCallsRevertTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ZeroCallsTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ZeroCallsTests.cs
index 9ce090e67a8..a46ab6da3d4 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ZeroCallsTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ZeroCallsTests.cs
@@ -14,7 +14,7 @@ public class ZeroCallsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ZeroKnowledge2Tests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ZeroKnowledge2Tests.cs
index eb6cd15ed94..5f79784913d 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ZeroKnowledge2Tests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ZeroKnowledge2Tests.cs
@@ -14,7 +14,7 @@ public class ZeroKnowledge2Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Blockchain.Test/ZeroKnowledgeTests.cs b/src/Nethermind/Ethereum.Blockchain.Test/ZeroKnowledgeTests.cs
index a66827e60e7..99e70ed5aae 100644
--- a/src/Nethermind/Ethereum.Blockchain.Test/ZeroKnowledgeTests.cs
+++ b/src/Nethermind/Ethereum.Blockchain.Test/ZeroKnowledgeTests.cs
@@ -14,7 +14,7 @@ public class ZeroKnowledgeTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs b/src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs
index ba62c18508e..6f8afe58043 100644
--- a/src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs
+++ b/src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs
@@ -39,436 +39,435 @@
using Nethermind.TxPool;
using NUnit.Framework;
-namespace Ethereum.Test.Base
+namespace Ethereum.Test.Base;
+
+public abstract class BlockchainTestBase
{
- public abstract class BlockchainTestBase
+ private static InterfaceLogger _logger = new NUnitLogger(LogLevel.Trace);
+ // private static ILogManager _logManager = new OneLoggerLogManager(_logger);
+ private static ILogManager _logManager = LimboLogs.Instance;
+ private static ISealValidator Sealer { get; }
+ private static DifficultyCalculatorWrapper DifficultyCalculator { get; }
+
+ static BlockchainTestBase()
{
- private static InterfaceLogger _logger = new NUnitLogger(LogLevel.Trace);
- // private static ILogManager _logManager = new OneLoggerLogManager(_logger);
- private static ILogManager _logManager = LimboLogs.Instance;
- private static ISealValidator Sealer { get; }
- private static DifficultyCalculatorWrapper DifficultyCalculator { get; }
+ DifficultyCalculator = new DifficultyCalculatorWrapper();
+ Sealer = new EthashSealValidator(_logManager, DifficultyCalculator, new CryptoRandom(), new Ethash(_logManager), Timestamper.Default); // temporarily keep reusing the same one as otherwise it would recreate cache for each test
+ }
- static BlockchainTestBase()
- {
- DifficultyCalculator = new DifficultyCalculatorWrapper();
- Sealer = new EthashSealValidator(_logManager, DifficultyCalculator, new CryptoRandom(), new Ethash(_logManager), Timestamper.Default); // temporarily keep reusing the same one as otherwise it would recreate cache for each test
- }
+ [SetUp]
+ public void Setup()
+ {
+ }
- [SetUp]
- public void Setup()
+ private class DifficultyCalculatorWrapper : IDifficultyCalculator
+ {
+ public IDifficultyCalculator? Wrapped { get; set; }
+
+ public UInt256 Calculate(BlockHeader header, BlockHeader parent)
{
+ if (Wrapped is null)
+ {
+ throw new InvalidOperationException(
+ $"Cannot calculate difficulty before the {nameof(Wrapped)} calculator is set.");
+ }
+
+ return Wrapped.Calculate(header, parent);
}
+ }
- private class DifficultyCalculatorWrapper : IDifficultyCalculator
- {
- public IDifficultyCalculator? Wrapped { get; set; }
+ protected async Task RunTest(BlockchainTest test, Stopwatch? stopwatch = null, bool failOnInvalidRlp = true)
+ {
+ TestContext.Out.WriteLine($"Running {test.Name}, Network: [{test.Network.Name}] at {DateTime.UtcNow:HH:mm:ss.ffffff}");
+ if (test.NetworkAfterTransition is not null)
+ TestContext.Out.WriteLine($"Network after transition: [{test.NetworkAfterTransition.Name}] at {test.TransitionForkActivation}");
+ Assert.That(test.LoadFailure, Is.Null, "test data loading failure");
- public UInt256 Calculate(BlockHeader header, BlockHeader parent)
- {
- if (Wrapped is null)
- {
- throw new InvalidOperationException(
- $"Cannot calculate difficulty before the {nameof(Wrapped)} calculator is set.");
- }
+ IDb stateDb = new MemDb();
+ IDb codeDb = new MemDb();
- return Wrapped.Calculate(header, parent);
- }
+ ISpecProvider specProvider;
+ if (test.NetworkAfterTransition is not null)
+ {
+ specProvider = new CustomSpecProvider(
+ ((ForkActivation)0, Frontier.Instance),
+ ((ForkActivation)1, test.Network),
+ (test.TransitionForkActivation!.Value, test.NetworkAfterTransition));
+ }
+ else
+ {
+ specProvider = new CustomSpecProvider(
+ ((ForkActivation)0, Frontier.Instance), // TODO: this thing took a lot of time to find after it was removed!, genesis block is always initialized with Frontier
+ ((ForkActivation)1, test.Network));
}
- protected async Task RunTest(BlockchainTest test, Stopwatch? stopwatch = null, bool failOnInvalidRlp = true)
+ if (specProvider.GenesisSpec != Frontier.Instance)
{
- TestContext.WriteLine($"Running {test.Name}, Network: [{test.Network.Name}] at {DateTime.UtcNow:HH:mm:ss.ffffff}");
- if (test.NetworkAfterTransition is not null)
- TestContext.WriteLine($"Network after transition: [{test.NetworkAfterTransition.Name}] at {test.TransitionForkActivation}");
- Assert.IsNull(test.LoadFailure, "test data loading failure");
+ Assert.Fail("Expected genesis spec to be Frontier for blockchain tests");
+ }
- IDb stateDb = new MemDb();
- IDb codeDb = new MemDb();
+ if (test.Network is Cancun || test.NetworkAfterTransition is Cancun)
+ {
+ await KzgPolynomialCommitments.InitializeAsync();
+ }
- ISpecProvider specProvider;
- if (test.NetworkAfterTransition is not null)
- {
- specProvider = new CustomSpecProvider(
- ((ForkActivation)0, Frontier.Instance),
- ((ForkActivation)1, test.Network),
- (test.TransitionForkActivation!.Value, test.NetworkAfterTransition));
- }
- else
- {
- specProvider = new CustomSpecProvider(
- ((ForkActivation)0, Frontier.Instance), // TODO: this thing took a lot of time to find after it was removed!, genesis block is always initialized with Frontier
- ((ForkActivation)1, test.Network));
- }
+ DifficultyCalculator.Wrapped = new EthashDifficultyCalculator(specProvider);
+ IRewardCalculator rewardCalculator = new RewardCalculator(specProvider);
+ bool isPostMerge = test.Network != London.Instance &&
+ test.Network != Berlin.Instance &&
+ test.Network != MuirGlacier.Instance &&
+ test.Network != Istanbul.Instance &&
+ test.Network != ConstantinopleFix.Instance &&
+ test.Network != Constantinople.Instance &&
+ test.Network != Byzantium.Instance &&
+ test.Network != SpuriousDragon.Instance &&
+ test.Network != TangerineWhistle.Instance &&
+ test.Network != Dao.Instance &&
+ test.Network != Homestead.Instance &&
+ test.Network != Frontier.Instance &&
+ test.Network != Olympic.Instance;
+ if (isPostMerge)
+ {
+ rewardCalculator = NoBlockRewards.Instance;
+ specProvider.UpdateMergeTransitionInfo(0, 0);
+ }
- if (specProvider.GenesisSpec != Frontier.Instance)
+ IEthereumEcdsa ecdsa = new EthereumEcdsa(specProvider.ChainId);
+
+ TrieStore trieStore = new(stateDb, _logManager);
+ IWorldState stateProvider = new WorldState(trieStore, codeDb, _logManager);
+ IBlockTree blockTree = Build.A.BlockTree()
+ .WithSpecProvider(specProvider)
+ .WithoutSettingHead
+ .TestObject;
+ ITransactionComparerProvider transactionComparerProvider = new TransactionComparerProvider(specProvider, blockTree);
+ IStateReader stateReader = new StateReader(trieStore, codeDb, _logManager);
+
+ IReceiptStorage receiptStorage = NullReceiptStorage.Instance;
+ IBlockhashProvider blockhashProvider = new BlockhashProvider(blockTree, specProvider, stateProvider, _logManager);
+ ITxValidator txValidator = new TxValidator(TestBlockchainIds.ChainId);
+ IHeaderValidator headerValidator = new HeaderValidator(blockTree, Sealer, specProvider, _logManager);
+ IUnclesValidator unclesValidator = new UnclesValidator(blockTree, headerValidator, _logManager);
+ IBlockValidator blockValidator = new BlockValidator(txValidator, headerValidator, unclesValidator, specProvider, _logManager);
+ CodeInfoRepository codeInfoRepository = new();
+ IVirtualMachine virtualMachine = new VirtualMachine(
+ blockhashProvider,
+ specProvider,
+ codeInfoRepository,
+ _logManager);
+
+ TransactionProcessor transactionProcessor = new(
+ specProvider,
+ stateProvider,
+ virtualMachine,
+ codeInfoRepository,
+ _logManager);
+
+ IBlockProcessor blockProcessor = new BlockProcessor(
+ specProvider,
+ blockValidator,
+ rewardCalculator,
+ new BlockProcessor.BlockValidationTransactionsExecutor(transactionProcessor, stateProvider),
+ stateProvider,
+ receiptStorage,
+ transactionProcessor,
+ new BeaconBlockRootHandler(transactionProcessor),
+ new BlockhashStore(specProvider, stateProvider),
+ _logManager);
+
+ IBlockchainProcessor blockchainProcessor = new BlockchainProcessor(
+ blockTree,
+ blockProcessor,
+ new RecoverSignatures(ecdsa, NullTxPool.Instance, specProvider, _logManager),
+ stateReader,
+ _logManager,
+ BlockchainProcessor.Options.NoReceipts);
+
+ InitializeTestState(test, stateProvider, specProvider);
+
+ stopwatch?.Start();
+ List<(Block Block, string ExpectedException)> correctRlp = DecodeRlps(test, failOnInvalidRlp);
+
+ test.GenesisRlp ??= Rlp.Encode(new Block(JsonToEthereumTest.Convert(test.GenesisBlockHeader)));
+
+ Block genesisBlock = Rlp.Decode(test.GenesisRlp.Bytes);
+ Assert.That(genesisBlock.Header.Hash, Is.EqualTo(new Hash256(test.GenesisBlockHeader.Hash)));
+
+ ManualResetEvent genesisProcessed = new(false);
+
+ blockTree.NewHeadBlock += (_, args) =>
+ {
+ if (args.Block.Number == 0)
{
- Assert.Fail("Expected genesis spec to be Frontier for blockchain tests");
+ Assert.That(stateProvider.StateRoot, Is.EqualTo(genesisBlock.Header.StateRoot));
+ genesisProcessed.Set();
}
+ };
- if (test.Network is Cancun || test.NetworkAfterTransition is Cancun)
- {
- await KzgPolynomialCommitments.InitializeAsync();
- }
+ blockchainProcessor.Start();
+ blockTree.SuggestBlock(genesisBlock);
- DifficultyCalculator.Wrapped = new EthashDifficultyCalculator(specProvider);
- IRewardCalculator rewardCalculator = new RewardCalculator(specProvider);
- bool isPostMerge = test.Network != London.Instance &&
- test.Network != Berlin.Instance &&
- test.Network != MuirGlacier.Instance &&
- test.Network != Istanbul.Instance &&
- test.Network != ConstantinopleFix.Instance &&
- test.Network != Constantinople.Instance &&
- test.Network != Byzantium.Instance &&
- test.Network != SpuriousDragon.Instance &&
- test.Network != TangerineWhistle.Instance &&
- test.Network != Dao.Instance &&
- test.Network != Homestead.Instance &&
- test.Network != Frontier.Instance &&
- test.Network != Olympic.Instance;
- if (isPostMerge)
+ genesisProcessed.WaitOne();
+ for (int i = 0; i < correctRlp.Count; i++)
+ {
+ if (correctRlp[i].Block.Hash is null)
{
- rewardCalculator = NoBlockRewards.Instance;
- specProvider.UpdateMergeTransitionInfo(0, 0);
+ Assert.Fail($"null hash in {test.Name} block {i}");
}
- IEthereumEcdsa ecdsa = new EthereumEcdsa(specProvider.ChainId);
-
- TrieStore trieStore = new(stateDb, _logManager);
- IWorldState stateProvider = new WorldState(trieStore, codeDb, _logManager);
- IBlockTree blockTree = Build.A.BlockTree()
- .WithSpecProvider(specProvider)
- .WithoutSettingHead
- .TestObject;
- ITransactionComparerProvider transactionComparerProvider = new TransactionComparerProvider(specProvider, blockTree);
- IStateReader stateReader = new StateReader(trieStore, codeDb, _logManager);
-
- IReceiptStorage receiptStorage = NullReceiptStorage.Instance;
- IBlockhashProvider blockhashProvider = new BlockhashProvider(blockTree, specProvider, stateProvider, _logManager);
- ITxValidator txValidator = new TxValidator(TestBlockchainIds.ChainId);
- IHeaderValidator headerValidator = new HeaderValidator(blockTree, Sealer, specProvider, _logManager);
- IUnclesValidator unclesValidator = new UnclesValidator(blockTree, headerValidator, _logManager);
- IBlockValidator blockValidator = new BlockValidator(txValidator, headerValidator, unclesValidator, specProvider, _logManager);
- CodeInfoRepository codeInfoRepository = new();
- IVirtualMachine virtualMachine = new VirtualMachine(
- blockhashProvider,
- specProvider,
- codeInfoRepository,
- _logManager);
-
- TransactionProcessor transactionProcessor = new(
- specProvider,
- stateProvider,
- virtualMachine,
- codeInfoRepository,
- _logManager);
-
- IBlockProcessor blockProcessor = new BlockProcessor(
- specProvider,
- blockValidator,
- rewardCalculator,
- new BlockProcessor.BlockValidationTransactionsExecutor(transactionProcessor, stateProvider),
- stateProvider,
- receiptStorage,
- transactionProcessor,
- new BeaconBlockRootHandler(transactionProcessor),
- new BlockhashStore(specProvider, stateProvider),
- _logManager);
-
- IBlockchainProcessor blockchainProcessor = new BlockchainProcessor(
- blockTree,
- blockProcessor,
- new RecoverSignatures(ecdsa, NullTxPool.Instance, specProvider, _logManager),
- stateReader,
- _logManager,
- BlockchainProcessor.Options.NoReceipts);
-
- InitializeTestState(test, stateProvider, specProvider);
-
- stopwatch?.Start();
- List<(Block Block, string ExpectedException)> correctRlp = DecodeRlps(test, failOnInvalidRlp);
-
- test.GenesisRlp ??= Rlp.Encode(new Block(JsonToEthereumTest.Convert(test.GenesisBlockHeader)));
-
- Block genesisBlock = Rlp.Decode(test.GenesisRlp.Bytes);
- Assert.That(genesisBlock.Header.Hash, Is.EqualTo(new Hash256(test.GenesisBlockHeader.Hash)));
-
- ManualResetEvent genesisProcessed = new(false);
-
- blockTree.NewHeadBlock += (_, args) =>
- {
- if (args.Block.Number == 0)
- {
- Assert.That(stateProvider.StateRoot, Is.EqualTo(genesisBlock.Header.StateRoot));
- genesisProcessed.Set();
- }
- };
-
- blockchainProcessor.Start();
- blockTree.SuggestBlock(genesisBlock);
-
- genesisProcessed.WaitOne();
- for (int i = 0; i < correctRlp.Count; i++)
+ try
{
- if (correctRlp[i].Block.Hash is null)
+ // TODO: mimic the actual behaviour where block goes through validating sync manager?
+ correctRlp[i].Block.Header.IsPostMerge = correctRlp[i].Block.Difficulty == 0;
+ if (!test.SealEngineUsed || blockValidator.ValidateSuggestedBlock(correctRlp[i].Block, out _))
{
- Assert.Fail($"null hash in {test.Name} block {i}");
+ blockTree.SuggestBlock(correctRlp[i].Block);
}
-
- try
- {
- // TODO: mimic the actual behaviour where block goes through validating sync manager?
- correctRlp[i].Block.Header.IsPostMerge = correctRlp[i].Block.Difficulty == 0;
- if (!test.SealEngineUsed || blockValidator.ValidateSuggestedBlock(correctRlp[i].Block, out _))
- {
- blockTree.SuggestBlock(correctRlp[i].Block);
- }
- else
- {
- if (correctRlp[i].ExpectedException is not null)
- {
- Assert.Fail($"Unexpected invalid block {correctRlp[i].Block.Hash}");
- }
- }
- }
- catch (InvalidBlockException e)
+ else
{
if (correctRlp[i].ExpectedException is not null)
{
- Assert.Fail($"Unexpected invalid block {correctRlp[i].Block.Hash}: {e}");
+ Assert.Fail($"Unexpected invalid block {correctRlp[i].Block.Hash}");
}
}
- catch (Exception e)
+ }
+ catch (InvalidBlockException e)
+ {
+ if (correctRlp[i].ExpectedException is not null)
{
- Assert.Fail($"Unexpected exception during processing: {e}");
+ Assert.Fail($"Unexpected invalid block {correctRlp[i].Block.Hash}: {e}");
}
}
+ catch (Exception e)
+ {
+ Assert.Fail($"Unexpected exception during processing: {e}");
+ }
+ }
- await blockchainProcessor.StopAsync(true);
- stopwatch?.Stop();
+ await blockchainProcessor.StopAsync(true);
+ stopwatch?.Stop();
- List differences = RunAssertions(test, blockTree.RetrieveHeadBlock(), stateProvider);
+ List differences = RunAssertions(test, blockTree.RetrieveHeadBlock(), stateProvider);
- Assert.Zero(differences.Count, "differences");
+ Assert.That(differences.Count, Is.Zero, "differences");
- return new EthereumTestResult
- (
- test.Name,
- null,
- differences.Count == 0
- );
- }
+ return new EthereumTestResult
+ (
+ test.Name,
+ null,
+ differences.Count == 0
+ );
+ }
- private List<(Block Block, string ExpectedException)> DecodeRlps(BlockchainTest test, bool failOnInvalidRlp)
+ private List<(Block Block, string ExpectedException)> DecodeRlps(BlockchainTest test, bool failOnInvalidRlp)
+ {
+ List<(Block Block, string ExpectedException)> correctRlp = new();
+ for (int i = 0; i < test.Blocks.Length; i++)
{
- List<(Block Block, string ExpectedException)> correctRlp = new();
- for (int i = 0; i < test.Blocks.Length; i++)
+ TestBlockJson testBlockJson = test.Blocks[i];
+ try
{
- TestBlockJson testBlockJson = test.Blocks[i];
- try
+ var rlpContext = Bytes.FromHexString(testBlockJson.Rlp).AsRlpStream();
+ Block suggestedBlock = Rlp.Decode(rlpContext);
+ suggestedBlock.Header.SealEngineType =
+ test.SealEngineUsed ? SealEngineType.Ethash : SealEngineType.None;
+
+ if (testBlockJson.BlockHeader is not null)
{
- var rlpContext = Bytes.FromHexString(testBlockJson.Rlp).AsRlpStream();
- Block suggestedBlock = Rlp.Decode(rlpContext);
- suggestedBlock.Header.SealEngineType =
- test.SealEngineUsed ? SealEngineType.Ethash : SealEngineType.None;
+ Assert.That(suggestedBlock.Header.Hash, Is.EqualTo(new Hash256(testBlockJson.BlockHeader.Hash)));
- if (testBlockJson.BlockHeader is not null)
+ for (int uncleIndex = 0; uncleIndex < suggestedBlock.Uncles.Length; uncleIndex++)
{
- Assert.That(suggestedBlock.Header.Hash, Is.EqualTo(new Hash256(testBlockJson.BlockHeader.Hash)));
-
- for (int uncleIndex = 0; uncleIndex < suggestedBlock.Uncles.Length; uncleIndex++)
- {
- Assert.That(suggestedBlock.Uncles[uncleIndex].Hash, Is.EqualTo(new Hash256(testBlockJson.UncleHeaders[uncleIndex].Hash)));
- }
-
- correctRlp.Add((suggestedBlock, testBlockJson.ExpectedException));
+ Assert.That(suggestedBlock.Uncles[uncleIndex].Hash, Is.EqualTo(new Hash256(testBlockJson.UncleHeaders[uncleIndex].Hash)));
}
+
+ correctRlp.Add((suggestedBlock, testBlockJson.ExpectedException));
}
- catch (Exception e)
+ }
+ catch (Exception e)
+ {
+ if (testBlockJson.ExpectedException is null)
{
- if (testBlockJson.ExpectedException is null)
+ string invalidRlpMessage = $"Invalid RLP ({i}) {e}";
+ if (failOnInvalidRlp)
{
- string invalidRlpMessage = $"Invalid RLP ({i}) {e}";
- if (failOnInvalidRlp)
- {
- Assert.Fail(invalidRlpMessage);
- }
- else
- {
- // ForgedTests don't have ExpectedException and at the same time have invalid rlps
- // Don't fail here. If test executed incorrectly will fail at last check
- _logger.Warn(invalidRlpMessage);
- }
+ Assert.Fail(invalidRlpMessage);
}
else
{
- _logger.Info($"Expected invalid RLP ({i})");
+ // ForgedTests don't have ExpectedException and at the same time have invalid rlps
+ // Don't fail here. If test executed incorrectly will fail at last check
+ _logger.Warn(invalidRlpMessage);
}
}
- }
-
- if (correctRlp.Count == 0)
- {
- Assert.NotNull(test.GenesisBlockHeader);
- Assert.That(test.LastBlockHash, Is.EqualTo(new Hash256(test.GenesisBlockHeader.Hash)));
- }
-
- return correctRlp;
- }
-
- private void InitializeTestState(BlockchainTest test, IWorldState stateProvider, ISpecProvider specProvider)
- {
- foreach (KeyValuePair accountState in
- ((IEnumerable>)test.Pre ?? Array.Empty>()))
- {
- foreach (KeyValuePair storageItem in accountState.Value.Storage)
- {
- stateProvider.Set(new StorageCell(accountState.Key, storageItem.Key), storageItem.Value);
- }
-
- stateProvider.CreateAccount(accountState.Key, accountState.Value.Balance);
- stateProvider.InsertCode(accountState.Key, accountState.Value.Code, specProvider.GenesisSpec);
- for (int i = 0; i < accountState.Value.Nonce; i++)
+ else
{
- stateProvider.IncrementNonce(accountState.Key);
+ _logger.Info($"Expected invalid RLP ({i})");
}
}
-
- stateProvider.Commit(specProvider.GenesisSpec);
-
- stateProvider.CommitTree(0);
-
- stateProvider.Reset();
}
- private List RunAssertions(BlockchainTest test, Block headBlock, IWorldState stateProvider)
+ if (correctRlp.Count == 0)
{
- if (test.PostStateRoot is not null)
- {
- return test.PostStateRoot != stateProvider.StateRoot ? new List { "state root mismatch" } : Enumerable.Empty().ToList();
- }
-
- TestBlockHeaderJson testHeaderJson = (test.Blocks?
- .Where(b => b.BlockHeader is not null)
- .SingleOrDefault(b => new Hash256(b.BlockHeader.Hash) == headBlock.Hash)?.BlockHeader) ?? test.GenesisBlockHeader;
- BlockHeader testHeader = JsonToEthereumTest.Convert(testHeaderJson);
- List differences = new();
+ Assert.That(test.GenesisBlockHeader, Is.Not.Null);
+ Assert.That(test.LastBlockHash, Is.EqualTo(new Hash256(test.GenesisBlockHeader.Hash)));
+ }
- IEnumerable> deletedAccounts = test.Pre?
- .Where(pre => !(test.PostState?.ContainsKey(pre.Key) ?? false)) ?? Array.Empty>();
+ return correctRlp;
+ }
- foreach (KeyValuePair deletedAccount in deletedAccounts)
+ private void InitializeTestState(BlockchainTest test, IWorldState stateProvider, ISpecProvider specProvider)
+ {
+ foreach (KeyValuePair accountState in
+ ((IEnumerable>)test.Pre ?? Array.Empty>()))
+ {
+ foreach (KeyValuePair storageItem in accountState.Value.Storage)
{
- if (stateProvider.AccountExists(deletedAccount.Key))
- {
- differences.Add($"Pre state account {deletedAccount.Key} was not deleted as expected.");
- }
+ stateProvider.Set(new StorageCell(accountState.Key, storageItem.Key), storageItem.Value);
}
- foreach ((Address acountAddress, AccountState accountState) in test.PostState)
+ stateProvider.CreateAccount(accountState.Key, accountState.Value.Balance);
+ stateProvider.InsertCode(accountState.Key, accountState.Value.Code, specProvider.GenesisSpec);
+ for (int i = 0; i < accountState.Value.Nonce; i++)
{
- int differencesBefore = differences.Count;
+ stateProvider.IncrementNonce(accountState.Key);
+ }
+ }
- if (differences.Count > 8)
- {
- Console.WriteLine("More than 8 differences...");
- break;
- }
+ stateProvider.Commit(specProvider.GenesisSpec);
- bool accountExists = stateProvider.AccountExists(acountAddress);
- UInt256? balance = accountExists ? stateProvider.GetBalance(acountAddress) : (UInt256?)null;
- UInt256? nonce = accountExists ? stateProvider.GetNonce(acountAddress) : (UInt256?)null;
+ stateProvider.CommitTree(0);
- if (accountState.Balance != balance)
- {
- differences.Add($"{acountAddress} balance exp: {accountState.Balance}, actual: {balance}, diff: {(balance > accountState.Balance ? balance - accountState.Balance : accountState.Balance - balance)}");
- }
+ stateProvider.Reset();
+ }
- if (accountState.Nonce != nonce)
- {
- differences.Add($"{acountAddress} nonce exp: {accountState.Nonce}, actual: {nonce}");
- }
+ private List RunAssertions(BlockchainTest test, Block headBlock, IWorldState stateProvider)
+ {
+ if (test.PostStateRoot is not null)
+ {
+ return test.PostStateRoot != stateProvider.StateRoot ? new List { "state root mismatch" } : Enumerable.Empty().ToList();
+ }
- byte[] code = accountExists ? stateProvider.GetCode(acountAddress) : new byte[0];
- if (!Bytes.AreEqual(accountState.Code, code))
- {
- differences.Add($"{acountAddress} code exp: {accountState.Code?.Length}, actual: {code?.Length}");
- }
+ TestBlockHeaderJson testHeaderJson = (test.Blocks?
+ .Where(b => b.BlockHeader is not null)
+ .SingleOrDefault(b => new Hash256(b.BlockHeader.Hash) == headBlock.Hash)?.BlockHeader) ?? test.GenesisBlockHeader;
+ BlockHeader testHeader = JsonToEthereumTest.Convert(testHeaderJson);
+ List differences = new();
- if (differences.Count != differencesBefore)
- {
- _logger.Info($"ACCOUNT STATE ({acountAddress}) HAS DIFFERENCES");
- }
+ IEnumerable> deletedAccounts = test.Pre?
+ .Where(pre => !(test.PostState?.ContainsKey(pre.Key) ?? false)) ?? Array.Empty>();
- differencesBefore = differences.Count;
+ foreach (KeyValuePair deletedAccount in deletedAccounts)
+ {
+ if (stateProvider.AccountExists(deletedAccount.Key))
+ {
+ differences.Add($"Pre state account {deletedAccount.Key} was not deleted as expected.");
+ }
+ }
- KeyValuePair[] clearedStorages = new KeyValuePair[0];
- if (test.Pre.ContainsKey(acountAddress))
- {
- clearedStorages = test.Pre[acountAddress].Storage.Where(s => !accountState.Storage.ContainsKey(s.Key)).ToArray();
- }
+ foreach ((Address acountAddress, AccountState accountState) in test.PostState)
+ {
+ int differencesBefore = differences.Count;
- foreach (KeyValuePair clearedStorage in clearedStorages)
- {
- ReadOnlySpan value = !stateProvider.AccountExists(acountAddress) ? Bytes.Empty : stateProvider.Get(new StorageCell(acountAddress, clearedStorage.Key));
- if (!value.IsZero())
- {
- differences.Add($"{acountAddress} storage[{clearedStorage.Key}] exp: 0x00, actual: {value.ToHexString(true)}");
- }
- }
+ if (differences.Count > 8)
+ {
+ Console.WriteLine("More than 8 differences...");
+ break;
+ }
- foreach (KeyValuePair storageItem in accountState.Storage)
- {
- ReadOnlySpan value = !stateProvider.AccountExists(acountAddress) ? Bytes.Empty : stateProvider.Get(new StorageCell(acountAddress, storageItem.Key));
- if (!Bytes.AreEqual(storageItem.Value, value))
- {
- differences.Add($"{acountAddress} storage[{storageItem.Key}] exp: {storageItem.Value.ToHexString(true)}, actual: {value.ToHexString(true)}");
- }
- }
+ bool accountExists = stateProvider.AccountExists(acountAddress);
+ UInt256? balance = accountExists ? stateProvider.GetBalance(acountAddress) : (UInt256?)null;
+ UInt256? nonce = accountExists ? stateProvider.GetNonce(acountAddress) : (UInt256?)null;
- if (differences.Count != differencesBefore)
- {
- _logger.Info($"ACCOUNT STORAGE ({acountAddress}) HAS DIFFERENCES");
- }
+ if (accountState.Balance != balance)
+ {
+ differences.Add($"{acountAddress} balance exp: {accountState.Balance}, actual: {balance}, diff: {(balance > accountState.Balance ? balance - accountState.Balance : accountState.Balance - balance)}");
}
- BigInteger gasUsed = headBlock.Header.GasUsed;
- if ((testHeader?.GasUsed ?? 0) != gasUsed)
+ if (accountState.Nonce != nonce)
{
- differences.Add($"GAS USED exp: {testHeader?.GasUsed ?? 0}, actual: {gasUsed}");
+ differences.Add($"{acountAddress} nonce exp: {accountState.Nonce}, actual: {nonce}");
}
- if (headBlock.Transactions.Any() && testHeader.Bloom.ToString() != headBlock.Header.Bloom.ToString())
+ byte[] code = accountExists ? stateProvider.GetCode(acountAddress) : new byte[0];
+ if (!Bytes.AreEqual(accountState.Code, code))
{
- differences.Add($"BLOOM exp: {testHeader.Bloom}, actual: {headBlock.Header.Bloom}");
+ differences.Add($"{acountAddress} code exp: {accountState.Code?.Length}, actual: {code?.Length}");
}
- if (testHeader.StateRoot != stateProvider.StateRoot)
+ if (differences.Count != differencesBefore)
{
- differences.Add($"STATE ROOT exp: {testHeader.StateRoot}, actual: {stateProvider.StateRoot}");
+ _logger.Info($"ACCOUNT STATE ({acountAddress}) HAS DIFFERENCES");
}
- if (testHeader.TxRoot != headBlock.Header.TxRoot)
+ differencesBefore = differences.Count;
+
+ KeyValuePair[] clearedStorages = new KeyValuePair[0];
+ if (test.Pre.ContainsKey(acountAddress))
{
- differences.Add($"TRANSACTIONS ROOT exp: {testHeader.TxRoot}, actual: {headBlock.Header.TxRoot}");
+ clearedStorages = test.Pre[acountAddress].Storage.Where(s => !accountState.Storage.ContainsKey(s.Key)).ToArray();
}
- if (testHeader.ReceiptsRoot != headBlock.Header.ReceiptsRoot)
+ foreach (KeyValuePair clearedStorage in clearedStorages)
{
- differences.Add($"RECEIPT ROOT exp: {testHeader.ReceiptsRoot}, actual: {headBlock.Header.ReceiptsRoot}");
+ ReadOnlySpan value = !stateProvider.AccountExists(acountAddress) ? Bytes.Empty : stateProvider.Get(new StorageCell(acountAddress, clearedStorage.Key));
+ if (!value.IsZero())
+ {
+ differences.Add($"{acountAddress} storage[{clearedStorage.Key}] exp: 0x00, actual: {value.ToHexString(true)}");
+ }
}
- if (test.LastBlockHash != headBlock.Hash)
+ foreach (KeyValuePair storageItem in accountState.Storage)
{
- differences.Add($"LAST BLOCK HASH exp: {test.LastBlockHash}, actual: {headBlock.Hash}");
+ ReadOnlySpan value = !stateProvider.AccountExists(acountAddress) ? Bytes.Empty : stateProvider.Get(new StorageCell(acountAddress, storageItem.Key));
+ if (!Bytes.AreEqual(storageItem.Value, value))
+ {
+ differences.Add($"{acountAddress} storage[{storageItem.Key}] exp: {storageItem.Value.ToHexString(true)}, actual: {value.ToHexString(true)}");
+ }
}
- foreach (string difference in differences)
+ if (differences.Count != differencesBefore)
{
- _logger.Info(difference);
+ _logger.Info($"ACCOUNT STORAGE ({acountAddress}) HAS DIFFERENCES");
}
+ }
- return differences;
+ BigInteger gasUsed = headBlock.Header.GasUsed;
+ if ((testHeader?.GasUsed ?? 0) != gasUsed)
+ {
+ differences.Add($"GAS USED exp: {testHeader?.GasUsed ?? 0}, actual: {gasUsed}");
}
+
+ if (headBlock.Transactions.Any() && testHeader.Bloom.ToString() != headBlock.Header.Bloom.ToString())
+ {
+ differences.Add($"BLOOM exp: {testHeader.Bloom}, actual: {headBlock.Header.Bloom}");
+ }
+
+ if (testHeader.StateRoot != stateProvider.StateRoot)
+ {
+ differences.Add($"STATE ROOT exp: {testHeader.StateRoot}, actual: {stateProvider.StateRoot}");
+ }
+
+ if (testHeader.TxRoot != headBlock.Header.TxRoot)
+ {
+ differences.Add($"TRANSACTIONS ROOT exp: {testHeader.TxRoot}, actual: {headBlock.Header.TxRoot}");
+ }
+
+ if (testHeader.ReceiptsRoot != headBlock.Header.ReceiptsRoot)
+ {
+ differences.Add($"RECEIPT ROOT exp: {testHeader.ReceiptsRoot}, actual: {headBlock.Header.ReceiptsRoot}");
+ }
+
+ if (test.LastBlockHash != headBlock.Hash)
+ {
+ differences.Add($"LAST BLOCK HASH exp: {test.LastBlockHash}, actual: {headBlock.Hash}");
+ }
+
+ foreach (string difference in differences)
+ {
+ _logger.Info(difference);
+ }
+
+ return differences;
}
}
diff --git a/src/Nethermind/Ethereum.Test.Base/GeneralTestBase.cs b/src/Nethermind/Ethereum.Test.Base/GeneralTestBase.cs
index 99faa058359..120c146c6d3 100644
--- a/src/Nethermind/Ethereum.Test.Base/GeneralTestBase.cs
+++ b/src/Nethermind/Ethereum.Test.Base/GeneralTestBase.cs
@@ -57,8 +57,8 @@ protected EthereumTestResult RunTest(GeneralStateTest test)
protected EthereumTestResult RunTest(GeneralStateTest test, ITxTracer txTracer)
{
- TestContext.Write($"Running {test.Name} at {DateTime.UtcNow:HH:mm:ss.ffffff}");
- Assert.IsNull(test.LoadFailure, "test data loading failure");
+ TestContext.Out.Write($"Running {test.Name} at {DateTime.UtcNow:HH:mm:ss.ffffff}");
+ Assert.That(test.LoadFailure, Is.Null, "test data loading failure");
IDb stateDb = new MemDb();
IDb codeDb = new MemDb();
diff --git a/src/Nethermind/Ethereum.Test.Base/TestLoader.cs b/src/Nethermind/Ethereum.Test.Base/TestLoader.cs
index 4a910f73123..ecc5202c148 100644
--- a/src/Nethermind/Ethereum.Test.Base/TestLoader.cs
+++ b/src/Nethermind/Ethereum.Test.Base/TestLoader.cs
@@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
@@ -13,73 +12,72 @@
using NUnit.Framework;
-namespace Ethereum.Test.Base
+namespace Ethereum.Test.Base;
+
+public static class TestLoader
{
- public static class TestLoader
+ public static object PrepareInput(object input)
{
- public static object PrepareInput(object input)
+ if (input is string s && s.StartsWith("#"))
{
- if (input is string s && s.StartsWith("#"))
- {
- BigInteger bigInteger = BigInteger.Parse(s.Substring(1));
- input = bigInteger;
- }
+ BigInteger bigInteger = BigInteger.Parse(s.Substring(1));
+ input = bigInteger;
+ }
- JsonElement token = (JsonElement)input;
+ JsonElement token = (JsonElement)input;
- if (token.ValueKind == JsonValueKind.Array)
+ if (token.ValueKind == JsonValueKind.Array)
+ {
+ object[] array = new object[token.GetArrayLength()];
+ for (int i = 0; i < array.Length; i++)
{
- object[] array = new object[token.GetArrayLength()];
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = PrepareInput(token[i]);
- }
-
- input = array;
+ array[i] = PrepareInput(token[i]);
}
- if (token.ValueKind == JsonValueKind.String)
- {
- return token.GetString()!;
- }
+ input = array;
+ }
- if (token.ValueKind == JsonValueKind.Number)
- {
- return token.GetInt64();
- }
+ if (token.ValueKind == JsonValueKind.String)
+ {
+ return token.GetString()!;
+ }
- return input;
+ if (token.ValueKind == JsonValueKind.Number)
+ {
+ return token.GetInt64();
}
- public static IEnumerable LoadFromFile(
- string testFileName,
- Func> testExtractor)
+ return input;
+ }
+
+ public static IEnumerable LoadFromFile(
+ string testFileName,
+ Func> testExtractor)
+ {
+ Assembly assembly = typeof(TTest).Assembly;
+ string[] resourceNames = assembly.GetManifestResourceNames();
+ string resourceName = resourceNames.SingleOrDefault(r => r.Contains(testFileName));
+ if (resourceName is null)
{
- Assembly assembly = typeof(TTest).Assembly;
- string[] resourceNames = assembly.GetManifestResourceNames();
- string resourceName = resourceNames.SingleOrDefault(r => r.Contains(testFileName));
- if (resourceName is null)
- {
- throw new ArgumentException($"Cannot find test resource: {testFileName}");
- }
+ throw new ArgumentException($"Cannot find test resource: {testFileName}");
+ }
- var jsonOptions = new JsonSerializerOptions()
- {
- PropertyNameCaseInsensitive = true,
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
- DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
- NumberHandling = JsonNumberHandling.AllowReadingFromString
- };
- using (Stream stream = assembly.GetManifestResourceStream(resourceName))
+ var jsonOptions = new JsonSerializerOptions()
+ {
+ PropertyNameCaseInsensitive = true,
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
+ DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
+ NumberHandling = JsonNumberHandling.AllowReadingFromString
+ };
+ using (Stream stream = assembly.GetManifestResourceStream(resourceName))
+ {
+ Assert.That(stream, Is.Not.Null);
+ using (StreamReader reader = new(stream))
{
- Assert.NotNull(stream);
- using (StreamReader reader = new(stream))
- {
- string testJson = reader.ReadToEnd();
- TContainer testSpecs =
- JsonSerializer.Deserialize(testJson, jsonOptions);
- return testExtractor(testSpecs);
- }
+ string testJson = reader.ReadToEnd();
+ TContainer testSpecs =
+ JsonSerializer.Deserialize(testJson, jsonOptions);
+ return testExtractor(testSpecs);
}
}
}
diff --git a/src/Nethermind/Ethereum.Transaction.Test/TransactionTests.cs b/src/Nethermind/Ethereum.Transaction.Test/TransactionTests.cs
index ec1f5c3b4ce..b292e38393a 100644
--- a/src/Nethermind/Ethereum.Transaction.Test/TransactionTests.cs
+++ b/src/Nethermind/Ethereum.Transaction.Test/TransactionTests.cs
@@ -6,7 +6,6 @@
using System.IO;
using System.Linq;
using System.Text.Json;
-
using Nethermind.Consensus.Validators;
using Nethermind.Core;
using Nethermind.Core.Crypto;
@@ -14,252 +13,250 @@
using Nethermind.Core.Specs;
using Nethermind.Crypto;
using Nethermind.Int256;
-using Nethermind.Logging;
using Nethermind.Serialization.Rlp;
using Nethermind.Specs.Forks;
using NUnit.Framework;
-namespace Ethereum.Transaction.Test
+namespace Ethereum.Transaction.Test;
+
+public class TransactionTests
{
- public class TransactionTests
+ [OneTimeSetUp]
+ public void SetUp()
{
- [OneTimeSetUp]
- public void SetUp()
- {
- Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
- }
+ Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
+ }
- private static IEnumerable LoadTests(string testSet)
+ private static IEnumerable LoadTests(string testSet)
+ {
+ Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
+ IEnumerable testDirs = Directory.EnumerateDirectories(".", "tt" + testSet);
+ Dictionary> testJsons =
+ new();
+ foreach (string testDir in testDirs)
{
- Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
- IEnumerable testDirs = Directory.EnumerateDirectories(".", "tt" + testSet);
- Dictionary> testJsons =
- new();
- foreach (string testDir in testDirs)
+ testJsons[testDir] = new Dictionary();
+ IEnumerable testFiles = Directory.EnumerateFiles(testDir).ToList();
+ foreach (string testFile in testFiles)
{
- testJsons[testDir] = new Dictionary();
- IEnumerable testFiles = Directory.EnumerateFiles(testDir).ToList();
- foreach (string testFile in testFiles)
+ string json = File.ReadAllText(testFile);
+ Dictionary testsInFile = JsonSerializer.Deserialize>(json);
+ foreach (KeyValuePair namedTest in testsInFile)
{
- string json = File.ReadAllText(testFile);
- Dictionary testsInFile = JsonSerializer.Deserialize>(json);
- foreach (KeyValuePair namedTest in testsInFile)
- {
- testJsons[testDir].Add(namedTest.Key, namedTest.Value);
- }
+ testJsons[testDir].Add(namedTest.Key, namedTest.Value);
}
}
+ }
- List tests = new();
- foreach (KeyValuePair> byDir in testJsons)
+ List tests = new();
+ foreach (KeyValuePair> byDir in testJsons)
+ {
+ foreach (KeyValuePair byName in byDir.Value)
{
- foreach (KeyValuePair byName in byDir.Value)
+ TransactionJson transactionJson = byName.Value.Transaction;
+ TransactionTest test;
+ if (transactionJson is not null)
{
- TransactionJson transactionJson = byName.Value.Transaction;
- TransactionTest test;
- if (transactionJson is not null)
- {
- test = new ValidTransactionTest(byDir.Key, byName.Key, byName.Value.Rlp);
- ValidTransactionTest validTest = (ValidTransactionTest)test;
- validTest.BlockNumber = Bytes.FromHexString(byName.Value.BlockNumber).ToUInt256();
- validTest.Data = Bytes.FromHexString(transactionJson.Data);
- validTest.GasLimit = Bytes.FromHexString(transactionJson.GasLimit).ToUInt256();
- validTest.GasPrice = Bytes.FromHexString(transactionJson.GasPrice).ToUInt256();
- validTest.Nonce = Bytes.FromHexString(transactionJson.Nonce).ToUInt256();
- validTest.R = Bytes.FromHexString(transactionJson.R).ToUInt256();
- validTest.S = Bytes.FromHexString(transactionJson.S).ToUInt256();
- validTest.V = Bytes.FromHexString(transactionJson.V)[0];
- validTest.Sender = new Address(byName.Value.Sender);
- validTest.Value = Bytes.FromHexString(transactionJson.Value).ToUInt256();
- validTest.To = string.IsNullOrEmpty(transactionJson.To) ? null : new Address(transactionJson.To);
- }
- else
- {
- test = new TransactionTest(byDir.Key, byName.Key, byName.Value.Rlp);
- }
-
- tests.Add(test);
+ test = new ValidTransactionTest(byDir.Key, byName.Key, byName.Value.Rlp);
+ ValidTransactionTest validTest = (ValidTransactionTest)test;
+ validTest.BlockNumber = Bytes.FromHexString(byName.Value.BlockNumber).ToUInt256();
+ validTest.Data = Bytes.FromHexString(transactionJson.Data);
+ validTest.GasLimit = Bytes.FromHexString(transactionJson.GasLimit).ToUInt256();
+ validTest.GasPrice = Bytes.FromHexString(transactionJson.GasPrice).ToUInt256();
+ validTest.Nonce = Bytes.FromHexString(transactionJson.Nonce).ToUInt256();
+ validTest.R = Bytes.FromHexString(transactionJson.R).ToUInt256();
+ validTest.S = Bytes.FromHexString(transactionJson.S).ToUInt256();
+ validTest.V = Bytes.FromHexString(transactionJson.V)[0];
+ validTest.Sender = new Address(byName.Value.Sender);
+ validTest.Value = Bytes.FromHexString(transactionJson.Value).ToUInt256();
+ validTest.To = string.IsNullOrEmpty(transactionJson.To) ? null : new Address(transactionJson.To);
+ }
+ else
+ {
+ test = new TransactionTest(byDir.Key, byName.Key, byName.Value.Rlp);
}
- }
- return tests;
+ tests.Add(test);
+ }
}
- [TestCaseSource(nameof(LoadTests), new object[] { "Address" })]
- public void Test_Address(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ return tests;
+ }
- [TestCaseSource(nameof(LoadTests), new object[] { "Data" })]
- public void Test_Data(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ [TestCaseSource(nameof(LoadTests), new object[] { "Address" })]
+ public void Test_Address(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
- [TestCaseSource(nameof(LoadTests), new object[] { "EIP2028" })]
- public void Test_EIP2028(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ [TestCaseSource(nameof(LoadTests), new object[] { "Data" })]
+ public void Test_Data(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
- [TestCaseSource(nameof(LoadTests), new object[] { "GasLimit" })]
- public void Test_GasLimit(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ [TestCaseSource(nameof(LoadTests), new object[] { "EIP2028" })]
+ public void Test_EIP2028(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
- [TestCaseSource(nameof(LoadTests), new object[] { "GasPrice" })]
- public void Test_GasPrice(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ [TestCaseSource(nameof(LoadTests), new object[] { "GasLimit" })]
+ public void Test_GasLimit(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
- [TestCaseSource(nameof(LoadTests), new object[] { "Nonce" })]
- public void Test_Nonce(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ [TestCaseSource(nameof(LoadTests), new object[] { "GasPrice" })]
+ public void Test_GasPrice(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
- [TestCaseSource(nameof(LoadTests), new object[] { "RSValue" })]
- public void Test_RSValue(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ [TestCaseSource(nameof(LoadTests), new object[] { "Nonce" })]
+ public void Test_Nonce(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
- [TestCaseSource(nameof(LoadTests), new object[] { "Signature" })]
- public void Test_Signature(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ [TestCaseSource(nameof(LoadTests), new object[] { "RSValue" })]
+ public void Test_RSValue(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
- [TestCaseSource(nameof(LoadTests), new object[] { "Value" })]
- public void Test_Value(TransactionTest test)
- {
- RunTest(test, Frontier.Instance);
- }
+ [TestCaseSource(nameof(LoadTests), new object[] { "Signature" })]
+ public void Test_Signature(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
+
+ [TestCaseSource(nameof(LoadTests), new object[] { "Value" })]
+ public void Test_Value(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
- // ToDo: this tests are not starting because of TargetInvocationException
- // [TestCaseSource(nameof(LoadTests), new object[] { "VValue" })]
- // public void Test_VValue(TransactionTest test)
- // {
- // RunTest(test, Frontier.Instance);
- // }
+ // ToDo: this tests are not starting because of TargetInvocationException
+ // [TestCaseSource(nameof(LoadTests), new object[] { "VValue" })]
+ // public void Test_VValue(TransactionTest test)
+ // {
+ // RunTest(test, Frontier.Instance);
+ // }
- [TestCaseSource(nameof(LoadTests), new object[] { "WrongRLP" })]
- public void Test_WrongRLP(TransactionTest test)
+ [TestCaseSource(nameof(LoadTests), new object[] { "WrongRLP" })]
+ public void Test_WrongRLP(TransactionTest test)
+ {
+ RunTest(test, Frontier.Instance);
+ }
+
+ private void RunTest(TransactionTest test, IReleaseSpec spec)
+ {
+ //TestContext.CurrentContext.Test.Properties.Set("Category", test.Network); // no longer public
+
+ ValidTransactionTest validTest = test as ValidTransactionTest;
+ Nethermind.Core.Transaction transaction;
+ try
{
- RunTest(test, Frontier.Instance);
+ Rlp rlp = new(Bytes.FromHexString(test.Rlp));
+ transaction = Rlp.Decode(rlp);
}
-
- private void RunTest(TransactionTest test, IReleaseSpec spec)
+ catch (Exception)
{
- //TestContext.CurrentContext.Test.Properties.Set("Category", test.Network); // no longer public
-
- ValidTransactionTest validTest = test as ValidTransactionTest;
- Nethermind.Core.Transaction transaction;
- try
+ if (validTest is null)
{
- Rlp rlp = new(Bytes.FromHexString(test.Rlp));
- transaction = Rlp.Decode(rlp);
+ return;
}
- catch (Exception)
- {
- if (validTest is null)
- {
- return;
- }
- throw;
- }
+ throw;
+ }
- bool useChainId = transaction.Signature.V > 28UL;
+ bool useChainId = transaction.Signature.V > 28UL;
- TxValidator validator = new(useChainId ? BlockchainIds.Mainnet : 0UL);
+ TxValidator validator = new(useChainId ? BlockchainIds.Mainnet : 0UL);
- if (validTest is not null)
- {
- Assert.That(transaction.Value, Is.EqualTo(validTest.Value), "value");
- Assert.That(transaction.Data.AsArray(), Is.EqualTo(validTest.Data), "data");
- Assert.That(transaction.GasLimit, Is.EqualTo(validTest.GasLimit.ToInt64(null)), "gasLimit");
- Assert.That(transaction.GasPrice, Is.EqualTo(validTest.GasPrice), "gasPrice");
- Assert.That(transaction.Nonce, Is.EqualTo(validTest.Nonce), "nonce");
- Assert.That(transaction.To, Is.EqualTo(validTest.To), "to");
- Assert.True(validator.IsWellFormed(transaction, spec));
-
- Signature expectedSignature = new(validTest.R, validTest.S, validTest.V);
- Assert.That(transaction.Signature, Is.EqualTo(expectedSignature), "signature");
-
- IEthereumEcdsa ecdsa = new EthereumEcdsa(useChainId ? BlockchainIds.Mainnet : 0UL);
- bool verified = ecdsa.Verify(
- validTest.Sender,
- transaction);
- Assert.True(verified);
- }
- else
- {
- Assert.False(validator.IsWellFormed(transaction, spec));
- }
+ if (validTest is not null)
+ {
+ Assert.That(transaction.Value, Is.EqualTo(validTest.Value), "value");
+ Assert.That(transaction.Data.AsArray(), Is.EqualTo(validTest.Data), "data");
+ Assert.That(transaction.GasLimit, Is.EqualTo(validTest.GasLimit.ToInt64(null)), "gasLimit");
+ Assert.That(transaction.GasPrice, Is.EqualTo(validTest.GasPrice), "gasPrice");
+ Assert.That(transaction.Nonce, Is.EqualTo(validTest.Nonce), "nonce");
+ Assert.That(transaction.To, Is.EqualTo(validTest.To), "to");
+ Assert.That(validator.IsWellFormed(transaction, spec), Is.True);
+
+ Signature expectedSignature = new(validTest.R, validTest.S, validTest.V);
+ Assert.That(transaction.Signature, Is.EqualTo(expectedSignature), "signature");
+
+ IEthereumEcdsa ecdsa = new EthereumEcdsa(useChainId ? BlockchainIds.Mainnet : 0UL);
+ bool verified = ecdsa.Verify(
+ validTest.Sender,
+ transaction);
+ Assert.That(verified, Is.True);
}
-
- public class TransactionTest
+ else
{
- public TransactionTest(string network, string name, string rlp)
- {
- Network = network;
- Name = name;
- Rlp = rlp;
- }
-
- public string Network { get; set; }
- public string Name { get; set; }
- public string Rlp { get; set; }
-
- public override string ToString()
- {
- return string.Concat(Network, "->", Name);
- }
+ Assert.That(validator.IsWellFormed(transaction, spec), Is.False);
}
+ }
- public class TransactionJson
+ public class TransactionTest
+ {
+ public TransactionTest(string network, string name, string rlp)
{
- public string Nonce { get; set; }
- public string GasPrice { get; set; }
- public string GasLimit { get; set; }
- public string To { get; set; }
- public string Value { get; set; }
- public string V { get; set; }
- public string R { get; set; }
- public string S { get; set; }
- public string Data { get; set; }
+ Network = network;
+ Name = name;
+ Rlp = rlp;
}
- public class TransactionTestJson
+ public string Network { get; set; }
+ public string Name { get; set; }
+ public string Rlp { get; set; }
+
+ public override string ToString()
{
- public string Rlp { get; set; }
- public string Sender { get; set; }
- public string BlockNumber { get; set; }
- public TransactionJson Transaction { get; set; }
+ return string.Concat(Network, "->", Name);
}
+ }
- public class ValidTransactionTest : TransactionTest
- {
- public ValidTransactionTest(string network, string name, string rlp)
- : base(network, name, rlp)
- {
- }
+ public class TransactionJson
+ {
+ public string Nonce { get; set; }
+ public string GasPrice { get; set; }
+ public string GasLimit { get; set; }
+ public string To { get; set; }
+ public string Value { get; set; }
+ public string V { get; set; }
+ public string R { get; set; }
+ public string S { get; set; }
+ public string Data { get; set; }
+ }
- public Address Sender { get; set; }
- public UInt256 BlockNumber { get; set; }
- public UInt256 Nonce { get; set; }
- public UInt256 GasPrice { get; set; }
- public UInt256 GasLimit { get; set; }
- public Address To { get; set; }
- public UInt256 Value { get; set; }
- public byte V { get; set; }
- public UInt256 R { get; set; }
- public UInt256 S { get; set; }
- public byte[] Data { get; set; }
+ public class TransactionTestJson
+ {
+ public string Rlp { get; set; }
+ public string Sender { get; set; }
+ public string BlockNumber { get; set; }
+ public TransactionJson Transaction { get; set; }
+ }
+
+ public class ValidTransactionTest : TransactionTest
+ {
+ public ValidTransactionTest(string network, string name, string rlp)
+ : base(network, name, rlp)
+ {
}
+
+ public Address Sender { get; set; }
+ public UInt256 BlockNumber { get; set; }
+ public UInt256 Nonce { get; set; }
+ public UInt256 GasPrice { get; set; }
+ public UInt256 GasLimit { get; set; }
+ public Address To { get; set; }
+ public UInt256 Value { get; set; }
+ public byte V { get; set; }
+ public UInt256 R { get; set; }
+ public UInt256 S { get; set; }
+ public byte[] Data { get; set; }
}
}
diff --git a/src/Nethermind/Ethereum.Trie.Test/TrieTests.cs b/src/Nethermind/Ethereum.Trie.Test/TrieTests.cs
index 113a3c6f88e..ab7f94d6220 100644
--- a/src/Nethermind/Ethereum.Trie.Test/TrieTests.cs
+++ b/src/Nethermind/Ethereum.Trie.Test/TrieTests.cs
@@ -134,7 +134,7 @@ private void RunTest(TrieTest test, bool secure)
string permutationDescription =
string.Join(Environment.NewLine, test.Input.Select(p => $"{p.Key} -> {p.Value}"));
- TestContext.WriteLine(Surrounded(permutationDescription));
+ TestContext.Out.WriteLine(Surrounded(permutationDescription));
PatriciaTree patriciaTree = new PatriciaTree(_db, Keccak.EmptyTreeHash, false, true, NullLogManager.Instance);
foreach (KeyValuePair keyValuePair in test.Input)
@@ -150,8 +150,8 @@ private void RunTest(TrieTest test, bool secure)
? Bytes.FromHexString(valueString)
: Encoding.ASCII.GetBytes(valueString);
- TestContext.WriteLine();
- TestContext.WriteLine($"Setting {keyString} -> {valueString}");
+ TestContext.Out.WriteLine();
+ TestContext.Out.WriteLine($"Setting {keyString} -> {valueString}");
patriciaTree.Set(key.ToPackedByteArray(), value);
}
diff --git a/src/Nethermind/Ethereum.VM.Test/AbiTests.cs b/src/Nethermind/Ethereum.VM.Test/AbiTests.cs
index c9294d276a2..284e159fe91 100644
--- a/src/Nethermind/Ethereum.VM.Test/AbiTests.cs
+++ b/src/Nethermind/Ethereum.VM.Test/AbiTests.cs
@@ -3,75 +3,73 @@
using System.Collections.Generic;
using System.Linq;
-
using Ethereum.Test.Base;
using Nethermind.Abi;
using Nethermind.Core.Extensions;
using NUnit.Framework;
-namespace Ethereum.VM.Test
+namespace Ethereum.VM.Test;
+
+internal class AbiTests
{
- internal class AbiTests
+ private static readonly Dictionary TypesByName = new Dictionary
{
- private static readonly Dictionary TypesByName = new Dictionary
- {
- {"uint256", AbiType.UInt256},
- {"uint32[]", new AbiArray(new AbiUInt(32))},
- {"bytes10", new AbiBytes(10)},
- {"bytes", AbiType.DynamicBytes},
- {"address", AbiType.Address}
- };
+ {"uint256", AbiType.UInt256},
+ {"uint32[]", new AbiArray(new AbiUInt(32))},
+ {"bytes10", new AbiBytes(10)},
+ {"bytes", AbiType.DynamicBytes},
+ {"address", AbiType.Address}
+ };
- private static AbiType ToAbiType(string typeName)
- {
- return TypesByName[typeName];
- }
+ private static AbiType ToAbiType(string typeName)
+ {
+ return TypesByName[typeName];
+ }
- private static AbiTest Convert(string name, AbiTestJson testJson)
- {
- AbiTest test = new AbiTest();
- test.Name = name;
- test.Result = Bytes.FromHexString(testJson.Result);
- test.Types = testJson.Types.Select(ToAbiType).ToArray();
- test.Args = testJson.Args.Select(TestLoader.PrepareInput).ToArray();
- return test;
- }
+ private static AbiTest Convert(string name, AbiTestJson testJson)
+ {
+ AbiTest test = new AbiTest();
+ test.Name = name;
+ test.Result = Bytes.FromHexString(testJson.Result);
+ test.Types = testJson.Types.Select(ToAbiType).ToArray();
+ test.Args = testJson.Args.Select(TestLoader.PrepareInput).ToArray();
+ return test;
+ }
- private static IEnumerable LoadBasicAbiTests()
- {
- IEnumerable tests = TestLoader.LoadFromFile, AbiTest>(
- "basic_abi_tests.json",
- allTests => allTests.Select(namedTest => Convert(namedTest.Key, namedTest.Value)));
- return tests;
- }
+ private static IEnumerable LoadBasicAbiTests()
+ {
+ IEnumerable tests = TestLoader.LoadFromFile, AbiTest>(
+ "basic_abi_tests.json",
+ allTests => allTests.Select(namedTest => Convert(namedTest.Key, namedTest.Value)));
+ return tests;
+ }
- [TestCaseSource(nameof(LoadBasicAbiTests))]
- public void Test(AbiTest abiTest)
- {
- AbiEncoder encoder = new AbiEncoder();
- AbiSignature signature = new AbiSignature(abiTest.Name, abiTest.Types);
- byte[] encoded = encoder.Encode(AbiEncodingStyle.IncludeSignature, signature, abiTest.Args).Slice(4);
- Assert.True(Bytes.AreEqual(abiTest.Result, encoded));
- }
+ [TestCaseSource(nameof(LoadBasicAbiTests))]
+ public void Test(AbiTest abiTest)
+ {
+ AbiEncoder encoder = new AbiEncoder();
+ AbiSignature signature = new AbiSignature(abiTest.Name, abiTest.Types);
+ byte[] encoded = encoder.Encode(AbiEncodingStyle.IncludeSignature, signature, abiTest.Args).Slice(4);
+ Assert.That(Bytes.AreEqual(abiTest.Result, encoded), Is.True);
+ }
- public class AbiTestJson
- {
- public object[] Args { get; set; }
- public string Result { get; set; }
- public string[] Types { get; set; }
- }
+ public class AbiTestJson
+ {
+ public object[] Args { get; set; }
+ public string Result { get; set; }
+ public string[] Types { get; set; }
+ }
- public class AbiTest
- {
- public string Name { get; set; }
- public object[] Args { get; set; }
- public byte[] Result { get; set; }
- public AbiType[] Types { get; set; }
+ public class AbiTest
+ {
+ public string Name { get; set; }
+ public object[] Args { get; set; }
+ public byte[] Result { get; set; }
+ public AbiType[] Types { get; set; }
- public override string ToString()
- {
- return Name;
- }
+ public override string ToString()
+ {
+ return Name;
}
}
}
diff --git a/src/Nethermind/Ethereum.VM.Test/ArithmeticTests.cs b/src/Nethermind/Ethereum.VM.Test/ArithmeticTests.cs
index 222efbcfa08..b6aeef88107 100644
--- a/src/Nethermind/Ethereum.VM.Test/ArithmeticTests.cs
+++ b/src/Nethermind/Ethereum.VM.Test/ArithmeticTests.cs
@@ -14,7 +14,7 @@ public class ArithmeticTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.VM.Test/BitwiseLogicOperationTests.cs b/src/Nethermind/Ethereum.VM.Test/BitwiseLogicOperationTests.cs
index 438de123e02..32ac5b5532f 100644
--- a/src/Nethermind/Ethereum.VM.Test/BitwiseLogicOperationTests.cs
+++ b/src/Nethermind/Ethereum.VM.Test/BitwiseLogicOperationTests.cs
@@ -14,7 +14,7 @@ public class BitwiseLogicOperationTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.VM.Test/IOAndFlowOperationsTests.cs b/src/Nethermind/Ethereum.VM.Test/IOAndFlowOperationsTests.cs
index 5cf7f3234fc..4049e40b9f2 100644
--- a/src/Nethermind/Ethereum.VM.Test/IOAndFlowOperationsTests.cs
+++ b/src/Nethermind/Ethereum.VM.Test/IOAndFlowOperationsTests.cs
@@ -15,7 +15,7 @@ public class IOAndFlowOperationsTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.VM.Test/LogTests.cs b/src/Nethermind/Ethereum.VM.Test/LogTests.cs
index 79dc0cd218d..abfc7ea9eee 100644
--- a/src/Nethermind/Ethereum.VM.Test/LogTests.cs
+++ b/src/Nethermind/Ethereum.VM.Test/LogTests.cs
@@ -14,7 +14,7 @@ public class LogTests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.VM.Test/PerformanceTests.cs b/src/Nethermind/Ethereum.VM.Test/PerformanceTests.cs
index 9c94dc066ab..f3d9ae83d5f 100644
--- a/src/Nethermind/Ethereum.VM.Test/PerformanceTests.cs
+++ b/src/Nethermind/Ethereum.VM.Test/PerformanceTests.cs
@@ -16,7 +16,7 @@ public class PerformanceTests : GeneralStateTestBase
[Retry(3)]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Ethereum.VM.Test/Tests.cs b/src/Nethermind/Ethereum.VM.Test/Tests.cs
index 32901a87e43..077dc9c3401 100644
--- a/src/Nethermind/Ethereum.VM.Test/Tests.cs
+++ b/src/Nethermind/Ethereum.VM.Test/Tests.cs
@@ -15,7 +15,7 @@ public class Tests : GeneralStateTestBase
[TestCaseSource(nameof(LoadTests))]
public void Test(GeneralStateTest test)
{
- Assert.True(RunTest(test).Pass);
+ Assert.That(RunTest(test).Pass, Is.True);
}
public static IEnumerable LoadTests()
diff --git a/src/Nethermind/Nethermind.Abi.Test/AbiTests.cs b/src/Nethermind/Nethermind.Abi.Test/AbiTests.cs
index ffe63f77382..45999c2344c 100644
--- a/src/Nethermind/Nethermind.Abi.Test/AbiTests.cs
+++ b/src/Nethermind/Nethermind.Abi.Test/AbiTests.cs
@@ -16,7 +16,6 @@
namespace Nethermind.Abi.Test;
-[TestFixture]
public class AbiTests
{
private readonly AbiEncoder _abiEncoder = AbiEncoder.Instance;
@@ -132,7 +131,7 @@ public void Test_bytes(AbiEncodingStyle encodingStyle)
AbiSignature signature = new AbiSignature("abc", type);
byte[] encoded = _abiEncoder.Encode(encodingStyle, signature, data);
object[] arguments = _abiEncoder.Decode(encodingStyle, signature, encoded);
- Assert.True(Bytes.AreEqual((byte[])arguments[0], data));
+ Assert.That(Bytes.AreEqual((byte[])arguments[0], data), Is.True);
}
[TestCase(AbiEncodingStyle.IncludeSignature)]
@@ -158,7 +157,7 @@ public void Test_dynamic_bytes(AbiEncodingStyle encodingStyle)
AbiSignature signature = new AbiSignature("abc", type);
byte[] encoded = _abiEncoder.Encode(encodingStyle, signature, data);
object[] arguments = _abiEncoder.Decode(encodingStyle, signature, encoded);
- Assert.True(Bytes.AreEqual((byte[])arguments[0], data));
+ Assert.That(Bytes.AreEqual((byte[])arguments[0], data), Is.True);
}
[TestCase(AbiEncodingStyle.IncludeSignature)]
@@ -213,7 +212,7 @@ public void Test_single_function(AbiEncodingStyle encodingStyle)
AbiSignature signature = new AbiSignature("abc", type);
byte[] encoded = _abiEncoder.Encode(encodingStyle, signature, data);
object[] arguments = _abiEncoder.Decode(encodingStyle, signature, encoded);
- Assert.True(Bytes.AreEqual((byte[])arguments[0], data));
+ Assert.That(Bytes.AreEqual((byte[])arguments[0], data), Is.True);
}
[TestCase(AbiEncodingStyle.IncludeSignature)]
diff --git a/src/Nethermind/Nethermind.Api.Test/PluginLoaderTests.cs b/src/Nethermind/Nethermind.Api.Test/PluginLoaderTests.cs
index d95cc1988b4..9671c959d0f 100644
--- a/src/Nethermind/Nethermind.Api.Test/PluginLoaderTests.cs
+++ b/src/Nethermind/Nethermind.Api.Test/PluginLoaderTests.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.IO.Abstractions;
-using System.Linq;
using Nethermind.Api.Extensions;
using Nethermind.Consensus.AuRa;
using Nethermind.Consensus.Clique;
@@ -37,7 +36,7 @@ public void full_lexicographical_order()
typeof(HivePlugin),
typeof(TestPlugin)
};
- CollectionAssert.AreEqual(expected, loader.PluginTypes.ToList());
+ Assert.That(expected, Is.EqualTo(loader.PluginTypes).AsCollection);
}
[Test]
@@ -60,7 +59,7 @@ public void full_order()
typeof(HivePlugin),
typeof(TestPlugin)
};
- CollectionAssert.AreEqual(expected, loader.PluginTypes.ToList());
+ Assert.That(expected, Is.EqualTo(loader.PluginTypes).AsCollection);
}
[Test]
@@ -83,7 +82,7 @@ public void partial_lexicographical_order()
typeof(HivePlugin),
typeof(TestPlugin)
};
- CollectionAssert.AreEqual(expected, loader.PluginTypes.ToList());
+ Assert.That(expected, Is.EqualTo(loader.PluginTypes).AsCollection);
}
[Test]
@@ -106,6 +105,6 @@ public void default_config()
typeof(HealthChecksPlugin),
typeof(HivePlugin)
};
- CollectionAssert.AreEqual(expected, loader.PluginTypes.ToList());
+ Assert.That(expected, Is.EqualTo(loader.PluginTypes).AsCollection);
}
}
diff --git a/src/Nethermind/Nethermind.Blockchain.Test/BlockFinderExtensionsTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/BlockFinderExtensionsTests.cs
index 409e4d9f4dc..7665e94c284 100644
--- a/src/Nethermind/Nethermind.Blockchain.Test/BlockFinderExtensionsTests.cs
+++ b/src/Nethermind/Nethermind.Blockchain.Test/BlockFinderExtensionsTests.cs
@@ -9,25 +9,23 @@
using NSubstitute;
using NUnit.Framework;
-namespace Nethermind.Blockchain.Test
+namespace Nethermind.Blockchain.Test;
+
+public class BlockFinderExtensionsTests
{
- [TestFixture]
- public class BlockFinderExtensionsTests
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Can_upgrade_maybe_parent()
{
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Can_upgrade_maybe_parent()
- {
- BlockHeader parent = Build.A.BlockHeader.TestObject;
- BlockHeader parentWithTotalDiff = Build.A.BlockHeader.WithTotalDifficulty(1).TestObject;
- BlockHeader child = Build.A.BlockHeader.WithParent(parent).TestObject;
- parent.TotalDifficulty.Should().BeNull(); // just to avoid the testing rig change without this test being updated
+ BlockHeader parent = Build.A.BlockHeader.TestObject;
+ BlockHeader parentWithTotalDiff = Build.A.BlockHeader.WithTotalDifficulty(1).TestObject;
+ BlockHeader child = Build.A.BlockHeader.WithParent(parent).TestObject;
+ parent.TotalDifficulty.Should().BeNull(); // just to avoid the testing rig change without this test being updated
- IBlockFinder blockFinder = Substitute.For();
- blockFinder.FindHeader(child.ParentHash!, BlockTreeLookupOptions.TotalDifficultyNotNeeded, blockNumber: child.Number - 1).Returns(parent);
- blockFinder.FindHeader(child.ParentHash!, BlockTreeLookupOptions.None, blockNumber: child.Number - 1).Returns(parentWithTotalDiff);
+ IBlockFinder blockFinder = Substitute.For();
+ blockFinder.FindHeader(child.ParentHash!, BlockTreeLookupOptions.TotalDifficultyNotNeeded, blockNumber: child.Number - 1).Returns(parent);
+ blockFinder.FindHeader(child.ParentHash!, BlockTreeLookupOptions.None, blockNumber: child.Number - 1).Returns(parentWithTotalDiff);
- blockFinder.FindParentHeader(child, BlockTreeLookupOptions.TotalDifficultyNotNeeded).Should().Be(parent);
- blockFinder.FindParentHeader(child, BlockTreeLookupOptions.None)!.TotalDifficulty.Should().Be((UInt256?)UInt256.One);
- }
+ blockFinder.FindParentHeader(child, BlockTreeLookupOptions.TotalDifficultyNotNeeded).Should().Be(parent);
+ blockFinder.FindParentHeader(child, BlockTreeLookupOptions.None)!.TotalDifficulty.Should().Be((UInt256?)UInt256.One);
}
}
diff --git a/src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs
index 935b102d61f..60c7c37b66e 100644
--- a/src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs
+++ b/src/Nethermind/Nethermind.Blockchain.Test/BlockProcessorTests.cs
@@ -30,107 +30,105 @@
using Nethermind.Core.Test.Blockchain;
using Nethermind.Evm.TransactionProcessing;
-namespace Nethermind.Blockchain.Test
+namespace Nethermind.Blockchain.Test;
+
+public class BlockProcessorTests
{
- [TestFixture]
- public class BlockProcessorTests
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Prepared_block_contains_author_field()
{
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Prepared_block_contains_author_field()
- {
- IDb stateDb = new MemDb();
- IDb codeDb = new MemDb();
- TrieStore trieStore = new(stateDb, LimboLogs.Instance);
- IWorldState stateProvider = new WorldState(trieStore, codeDb, LimboLogs.Instance);
- ITransactionProcessor transactionProcessor = Substitute.For();
- BlockProcessor processor = new(
- HoleskySpecProvider.Instance,
- TestBlockValidator.AlwaysValid,
- NoBlockRewards.Instance,
- new BlockProcessor.BlockValidationTransactionsExecutor(transactionProcessor, stateProvider),
- stateProvider,
- NullReceiptStorage.Instance,
- transactionProcessor,
- new BeaconBlockRootHandler(transactionProcessor),
- Substitute.For(),
- LimboLogs.Instance);
+ IDb stateDb = new MemDb();
+ IDb codeDb = new MemDb();
+ TrieStore trieStore = new(stateDb, LimboLogs.Instance);
+ IWorldState stateProvider = new WorldState(trieStore, codeDb, LimboLogs.Instance);
+ ITransactionProcessor transactionProcessor = Substitute.For();
+ BlockProcessor processor = new(
+ HoleskySpecProvider.Instance,
+ TestBlockValidator.AlwaysValid,
+ NoBlockRewards.Instance,
+ new BlockProcessor.BlockValidationTransactionsExecutor(transactionProcessor, stateProvider),
+ stateProvider,
+ NullReceiptStorage.Instance,
+ transactionProcessor,
+ new BeaconBlockRootHandler(transactionProcessor),
+ Substitute.For(),
+ LimboLogs.Instance);
- BlockHeader header = Build.A.BlockHeader.WithAuthor(TestItem.AddressD).TestObject;
- Block block = Build.A.Block.WithHeader(header).TestObject;
- Block[] processedBlocks = processor.Process(
- Keccak.EmptyTreeHash,
- new List { block },
- ProcessingOptions.None,
- NullBlockTracer.Instance);
- Assert.That(processedBlocks.Length, Is.EqualTo(1), "length");
- Assert.That(processedBlocks[0].Author, Is.EqualTo(block.Author), "author");
- }
+ BlockHeader header = Build.A.BlockHeader.WithAuthor(TestItem.AddressD).TestObject;
+ Block block = Build.A.Block.WithHeader(header).TestObject;
+ Block[] processedBlocks = processor.Process(
+ Keccak.EmptyTreeHash,
+ new List { block },
+ ProcessingOptions.None,
+ NullBlockTracer.Instance);
+ Assert.That(processedBlocks.Length, Is.EqualTo(1), "length");
+ Assert.That(processedBlocks[0].Author, Is.EqualTo(block.Author), "author");
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Recovers_state_on_cancel()
- {
- IDb stateDb = new MemDb();
- IDb codeDb = new MemDb();
- TrieStore trieStore = new(stateDb, LimboLogs.Instance);
- IWorldState stateProvider = new WorldState(trieStore, codeDb, LimboLogs.Instance);
- ITransactionProcessor transactionProcessor = Substitute.For();
- BlockProcessor processor = new(
- HoleskySpecProvider.Instance,
- TestBlockValidator.AlwaysValid,
- new RewardCalculator(MainnetSpecProvider.Instance),
- new BlockProcessor.BlockValidationTransactionsExecutor(transactionProcessor, stateProvider),
- stateProvider,
- NullReceiptStorage.Instance,
- transactionProcessor,
- new BeaconBlockRootHandler(transactionProcessor),
- Substitute.For(),
- LimboLogs.Instance);
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Recovers_state_on_cancel()
+ {
+ IDb stateDb = new MemDb();
+ IDb codeDb = new MemDb();
+ TrieStore trieStore = new(stateDb, LimboLogs.Instance);
+ IWorldState stateProvider = new WorldState(trieStore, codeDb, LimboLogs.Instance);
+ ITransactionProcessor transactionProcessor = Substitute.For();
+ BlockProcessor processor = new(
+ HoleskySpecProvider.Instance,
+ TestBlockValidator.AlwaysValid,
+ new RewardCalculator(MainnetSpecProvider.Instance),
+ new BlockProcessor.BlockValidationTransactionsExecutor(transactionProcessor, stateProvider),
+ stateProvider,
+ NullReceiptStorage.Instance,
+ transactionProcessor,
+ new BeaconBlockRootHandler(transactionProcessor),
+ Substitute.For(),
+ LimboLogs.Instance);
- BlockHeader header = Build.A.BlockHeader.WithNumber(1).WithAuthor(TestItem.AddressD).TestObject;
- Block block = Build.A.Block.WithTransactions(1, MuirGlacier.Instance).WithHeader(header).TestObject;
- Assert.Throws(() => processor.Process(
- Keccak.EmptyTreeHash,
- new List { block },
- ProcessingOptions.None,
- AlwaysCancelBlockTracer.Instance));
+ BlockHeader header = Build.A.BlockHeader.WithNumber(1).WithAuthor(TestItem.AddressD).TestObject;
+ Block block = Build.A.Block.WithTransactions(1, MuirGlacier.Instance).WithHeader(header).TestObject;
+ Assert.Throws(() => processor.Process(
+ Keccak.EmptyTreeHash,
+ new List { block },
+ ProcessingOptions.None,
+ AlwaysCancelBlockTracer.Instance));
- Assert.Throws(() => processor.Process(
- Keccak.EmptyTreeHash,
- new List { block },
- ProcessingOptions.None,
- AlwaysCancelBlockTracer.Instance));
- }
+ Assert.Throws(() => processor.Process(
+ Keccak.EmptyTreeHash,
+ new List { block },
+ ProcessingOptions.None,
+ AlwaysCancelBlockTracer.Instance));
+ }
- [Timeout(Timeout.MaxTestTime)]
- [TestCase(20)]
- [TestCase(63)]
- [TestCase(64)]
- [TestCase(65)]
- [TestCase(127)]
- [TestCase(128)]
- [TestCase(129)]
- [TestCase(130)]
- [TestCase(1000)]
- [TestCase(2000)]
- public async Task Process_long_running_branch(int blocksAmount)
+ [MaxTime(Timeout.MaxTestTime)]
+ [TestCase(20)]
+ [TestCase(63)]
+ [TestCase(64)]
+ [TestCase(65)]
+ [TestCase(127)]
+ [TestCase(128)]
+ [TestCase(129)]
+ [TestCase(130)]
+ [TestCase(1000)]
+ [TestCase(2000)]
+ public async Task Process_long_running_branch(int blocksAmount)
+ {
+ Address address = TestItem.Addresses[0];
+ TestSingleReleaseSpecProvider spec = new TestSingleReleaseSpecProvider(ConstantinopleFix.Instance);
+ TestRpcBlockchain testRpc = await TestRpcBlockchain.ForTest(SealEngineType.NethDev)
+ .Build(spec);
+ testRpc.TestWallet.UnlockAccount(address, new SecureString());
+ await testRpc.AddFunds(address, 1.Ether());
+ await testRpc.AddBlock();
+ SemaphoreSlim suggestedBlockResetEvent = new SemaphoreSlim(0);
+ testRpc.BlockTree.NewHeadBlock += (_, _) =>
{
- Address address = TestItem.Addresses[0];
- TestSingleReleaseSpecProvider spec = new TestSingleReleaseSpecProvider(ConstantinopleFix.Instance);
- TestRpcBlockchain testRpc = await TestRpcBlockchain.ForTest(SealEngineType.NethDev)
- .Build(spec);
- testRpc.TestWallet.UnlockAccount(address, new SecureString());
- await testRpc.AddFunds(address, 1.Ether());
- await testRpc.AddBlock();
- SemaphoreSlim suggestedBlockResetEvent = new SemaphoreSlim(0);
- testRpc.BlockTree.NewHeadBlock += (_, _) =>
- {
- suggestedBlockResetEvent.Release(1);
- };
+ suggestedBlockResetEvent.Release(1);
+ };
- int branchLength = blocksAmount + (int)testRpc.BlockTree.BestKnownNumber + 1;
- ((BlockTree)testRpc.BlockTree).AddBranch(branchLength, (int)testRpc.BlockTree.BestKnownNumber);
- (await suggestedBlockResetEvent.WaitAsync(TestBlockchain.DefaultTimeout * 10)).Should().BeTrue();
- Assert.That((int)testRpc.BlockTree.BestKnownNumber, Is.EqualTo(branchLength - 1));
- }
+ int branchLength = blocksAmount + (int)testRpc.BlockTree.BestKnownNumber + 1;
+ ((BlockTree)testRpc.BlockTree).AddBranch(branchLength, (int)testRpc.BlockTree.BestKnownNumber);
+ (await suggestedBlockResetEvent.WaitAsync(TestBlockchain.DefaultTimeout * 10)).Should().BeTrue();
+ Assert.That((int)testRpc.BlockTree.BestKnownNumber, Is.EqualTo(branchLength - 1));
}
}
diff --git a/src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs
index db457642581..bdf990467bd 100644
--- a/src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs
+++ b/src/Nethermind/Nethermind.Blockchain.Test/BlockTreeTests.cs
@@ -30,1952 +30,1948 @@
using NSubstitute;
using NUnit.Framework;
-namespace Nethermind.Blockchain.Test
-{
- [TestFixture]
- public class BlockTreeTests
- {
- private TestMemDb _blocksInfosDb = null!;
- private TestMemDb _headersDb = null!;
- private TestMemDb _blocksDb = null!;
+namespace Nethermind.Blockchain.Test;
- [TearDown]
- public void TearDown()
- {
- _blocksDb?.Dispose();
- _headersDb?.Dispose();
- }
+public class BlockTreeTests
+{
+ private TestMemDb _blocksInfosDb = null!;
+ private TestMemDb _headersDb = null!;
+ private TestMemDb _blocksDb = null!;
- private BlockTree BuildBlockTree()
- {
- _blocksDb = new TestMemDb();
- _headersDb = new TestMemDb();
- _blocksInfosDb = new TestMemDb();
- BlockTreeBuilder builder = Build.A.BlockTree()
- .WithBlocksDb(_blocksDb)
- .WithHeadersDb(_headersDb)
- .WithBlockInfoDb(_blocksInfosDb)
- .WithoutSettingHead;
- return builder.TestObject;
- }
+ [TearDown]
+ public void TearDown()
+ {
+ _blocksDb?.Dispose();
+ _headersDb?.Dispose();
+ }
- private static void AddToMain(BlockTree blockTree, Block block0)
- {
- blockTree.SuggestBlock(block0);
- blockTree.UpdateMainChain(new[] { block0 }, true);
- }
+ private BlockTree BuildBlockTree()
+ {
+ _blocksDb = new TestMemDb();
+ _headersDb = new TestMemDb();
+ _blocksInfosDb = new TestMemDb();
+ BlockTreeBuilder builder = Build.A.BlockTree()
+ .WithBlocksDb(_blocksDb)
+ .WithHeadersDb(_headersDb)
+ .WithBlockInfoDb(_blocksInfosDb)
+ .WithoutSettingHead;
+ return builder.TestObject;
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Add_genesis_shall_notify()
- {
- bool hasNotified = false;
- BlockTree blockTree = BuildBlockTree();
- blockTree.NewHeadBlock += (_, _) => { hasNotified = true; };
+ private static void AddToMain(BlockTree blockTree, Block block0)
+ {
+ blockTree.SuggestBlock(block0);
+ blockTree.UpdateMainChain(new[] { block0 }, true);
+ }
- bool hasNotifiedNewSuggested = false;
- blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Add_genesis_shall_notify()
+ {
+ bool hasNotified = false;
+ BlockTree blockTree = BuildBlockTree();
+ blockTree.NewHeadBlock += (_, _) => { hasNotified = true; };
- Block block = Build.A.Block.WithNumber(0).TestObject;
- AddBlockResult result = blockTree.SuggestBlock(block);
- blockTree.UpdateMainChain(block);
+ bool hasNotifiedNewSuggested = false;
+ blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
- Assert.True(hasNotified, "notification");
- Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
- Assert.True(hasNotifiedNewSuggested, "NewSuggestedBlock");
- }
+ Block block = Build.A.Block.WithNumber(0).TestObject;
+ AddBlockResult result = blockTree.SuggestBlock(block);
+ blockTree.UpdateMainChain(block);
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Add_genesis_shall_work_even_with_0_difficulty()
- {
- bool hasNotified = false;
- BlockTree blockTree = BuildBlockTree();
- blockTree.NewBestSuggestedBlock += (_, _) => { hasNotified = true; };
+ Assert.That(hasNotified, Is.True, "notification");
+ Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
+ Assert.That(hasNotifiedNewSuggested, Is.True, "NewSuggestedBlock");
+ }
- bool hasNotifiedNewSuggested = false;
- blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Add_genesis_shall_work_even_with_0_difficulty()
+ {
+ bool hasNotified = false;
+ BlockTree blockTree = BuildBlockTree();
+ blockTree.NewBestSuggestedBlock += (_, _) => { hasNotified = true; };
- Block block = Build.A.Block.WithNumber(0).WithDifficulty(0).TestObject;
- AddBlockResult result = blockTree.SuggestBlock(block);
+ bool hasNotifiedNewSuggested = false;
+ blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
- Assert.True(hasNotified, "notification");
- Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
- Assert.True(hasNotifiedNewSuggested, "NewSuggestedBlock");
- }
+ Block block = Build.A.Block.WithNumber(0).WithDifficulty(0).TestObject;
+ AddBlockResult result = blockTree.SuggestBlock(block);
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Suggesting_genesis_many_times_does_not_cause_any_trouble()
- {
- BlockTree blockTree = BuildBlockTree();
- Block blockA = Build.A.Block.WithNumber(0).TestObject;
- Block blockB = Build.A.Block.WithNumber(0).TestObject;
- blockTree.SuggestBlock(blockA).Should().Be(AddBlockResult.Added);
- blockTree.SuggestBlock(blockB).Should().Be(AddBlockResult.AlreadyKnown);
- }
+ Assert.That(hasNotified, Is.True, "notification");
+ Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
+ Assert.That(hasNotifiedNewSuggested, Is.True, "NewSuggestedBlock");
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Shall_notify_on_new_head_block_after_genesis()
- {
- bool hasNotified = false;
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
- blockTree.SuggestBlock(block0);
- blockTree.NewHeadBlock += (_, _) => { hasNotified = true; };
-
- bool hasNotifiedNewSuggested = false;
- blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
-
- AddBlockResult result = blockTree.SuggestBlock(block1);
- blockTree.UpdateMainChain(block1);
-
- Assert.True(hasNotified, "notification");
- Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
- Assert.True(hasNotifiedNewSuggested, "NewSuggestedBlock");
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Suggesting_genesis_many_times_does_not_cause_any_trouble()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block blockA = Build.A.Block.WithNumber(0).TestObject;
+ Block blockB = Build.A.Block.WithNumber(0).TestObject;
+ blockTree.SuggestBlock(blockA).Should().Be(AddBlockResult.Added);
+ blockTree.SuggestBlock(blockB).Should().Be(AddBlockResult.AlreadyKnown);
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Shall_notify_new_head_block_once_and_block_added_to_main_multiple_times_when_adding_multiple_blocks_at_once()
- {
- int newHeadBlockNotifications = 0;
- int blockAddedToMainNotifications = 0;
-
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithDifficulty(0).WithParent(block1).TestObject;
- Block block3 = Build.A.Block.WithNumber(3).WithDifficulty(0).WithParent(block2).TestObject;
-
- blockTree.SuggestBlock(block0);
- blockTree.NewHeadBlock += (_, _) => { newHeadBlockNotifications++; };
- blockTree.BlockAddedToMain += (_, _) => { blockAddedToMainNotifications++; };
-
- blockTree.SuggestBlock(block1);
- blockTree.SuggestBlock(block2);
- blockTree.SuggestBlock(block3);
- blockTree.UpdateMainChain(new[] { block1, block2, block3 }, true);
-
- newHeadBlockNotifications.Should().Be(1, "new head block");
- blockAddedToMainNotifications.Should().Be(3, "block added to main");
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Shall_notify_on_new_head_block_after_genesis()
+ {
+ bool hasNotified = false;
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
+ blockTree.SuggestBlock(block0);
+ blockTree.NewHeadBlock += (_, _) => { hasNotified = true; };
+
+ bool hasNotifiedNewSuggested = false;
+ blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
+
+ AddBlockResult result = blockTree.SuggestBlock(block1);
+ blockTree.UpdateMainChain(block1);
+
+ Assert.That(hasNotified, Is.True, "notification");
+ Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
+ Assert.That(hasNotifiedNewSuggested, Is.True, "NewSuggestedBlock");
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Shall_notify_on_new_suggested_block_after_genesis()
- {
- bool hasNotified = false;
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
- blockTree.SuggestBlock(block0);
- blockTree.NewBestSuggestedBlock += (_, _) => { hasNotified = true; };
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Shall_notify_new_head_block_once_and_block_added_to_main_multiple_times_when_adding_multiple_blocks_at_once()
+ {
+ int newHeadBlockNotifications = 0;
+ int blockAddedToMainNotifications = 0;
+
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithDifficulty(0).WithParent(block1).TestObject;
+ Block block3 = Build.A.Block.WithNumber(3).WithDifficulty(0).WithParent(block2).TestObject;
+
+ blockTree.SuggestBlock(block0);
+ blockTree.NewHeadBlock += (_, _) => { newHeadBlockNotifications++; };
+ blockTree.BlockAddedToMain += (_, _) => { blockAddedToMainNotifications++; };
+
+ blockTree.SuggestBlock(block1);
+ blockTree.SuggestBlock(block2);
+ blockTree.SuggestBlock(block3);
+ blockTree.UpdateMainChain(new[] { block1, block2, block3 }, true);
+
+ newHeadBlockNotifications.Should().Be(1, "new head block");
+ blockAddedToMainNotifications.Should().Be(3, "block added to main");
+ }
- bool hasNotifiedNewSuggested = false;
- blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Shall_notify_on_new_suggested_block_after_genesis()
+ {
+ bool hasNotified = false;
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
+ blockTree.SuggestBlock(block0);
+ blockTree.NewBestSuggestedBlock += (_, _) => { hasNotified = true; };
- AddBlockResult result = blockTree.SuggestBlock(block1);
+ bool hasNotifiedNewSuggested = false;
+ blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
- Assert.True(hasNotified, "notification");
- Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
- Assert.True(hasNotifiedNewSuggested, "NewSuggestedBlock");
- }
+ AddBlockResult result = blockTree.SuggestBlock(block1);
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Shall_not_notify_but_add_on_lower_difficulty()
- {
- bool hasNotifiedBest = false;
- bool hasNotifiedHead = false;
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(3).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
- blockTree.SuggestBlock(block0);
- blockTree.SuggestBlock(block1);
- blockTree.NewHeadBlock += (_, _) => { hasNotifiedHead = true; };
- blockTree.NewBestSuggestedBlock += (_, _) => { hasNotifiedBest = true; };
-
- bool hasNotifiedNewSuggested = false;
- blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
-
- AddBlockResult result = blockTree.SuggestBlock(block2);
-
- Assert.False(hasNotifiedBest, "notification best");
- Assert.False(hasNotifiedHead, "notification head");
- Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
- Assert.True(hasNotifiedNewSuggested, "NewSuggestedBlock");
- }
+ Assert.That(hasNotified, Is.True, "notification");
+ Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
+ Assert.That(hasNotifiedNewSuggested, Is.True, "NewSuggestedBlock");
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Shall_ignore_orphans()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithDifficulty(3).TestObject;
- blockTree.SuggestBlock(block0);
- AddBlockResult result = blockTree.SuggestBlock(block2);
- Assert.That(result, Is.EqualTo(AddBlockResult.UnknownParent));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Shall_not_notify_but_add_on_lower_difficulty()
+ {
+ bool hasNotifiedBest = false;
+ bool hasNotifiedHead = false;
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(3).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
+ blockTree.SuggestBlock(block0);
+ blockTree.SuggestBlock(block1);
+ blockTree.NewHeadBlock += (_, _) => { hasNotifiedHead = true; };
+ blockTree.NewBestSuggestedBlock += (_, _) => { hasNotifiedBest = true; };
+
+ bool hasNotifiedNewSuggested = false;
+ blockTree.NewSuggestedBlock += (_, _) => { hasNotifiedNewSuggested = true; };
+
+ AddBlockResult result = blockTree.SuggestBlock(block2);
+
+ Assert.That(hasNotifiedBest, Is.False, "notification best");
+ Assert.That(hasNotifiedHead, Is.False, "notification head");
+ Assert.That(result, Is.EqualTo(AddBlockResult.Added), "result");
+ Assert.That(hasNotifiedNewSuggested, Is.True, "NewSuggestedBlock");
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Shall_ignore_known()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
- blockTree.SuggestBlock(block0);
- blockTree.SuggestBlock(block1);
- AddBlockResult result = blockTree.SuggestBlock(block1);
- Assert.That(result, Is.EqualTo(AddBlockResult.AlreadyKnown));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Shall_ignore_orphans()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithDifficulty(3).TestObject;
+ blockTree.SuggestBlock(block0);
+ AddBlockResult result = blockTree.SuggestBlock(block2);
+ Assert.That(result, Is.EqualTo(AddBlockResult.UnknownParent));
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Cleans_invalid_blocks_before_starting()
- {
- MemDb blockInfosDb = new MemDb();
- BlockTreeBuilder builder = Build.A.BlockTree()
- .WithBlockInfoDb(blockInfosDb)
- .WithoutSettingHead;
- IBlockStore blockStore = builder.BlockStore;
- BlockTree tree = builder.TestObject;
-
- Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithDifficulty(3).WithParent(block1).TestObject;
- Block block3 = Build.A.Block.WithNumber(3).WithDifficulty(4).WithParent(block2).TestObject;
-
- tree.SuggestBlock(block0);
- tree.SuggestBlock(block1);
- tree.SuggestBlock(block2);
- tree.SuggestBlock(block3);
-
- blockInfosDb.Set(BlockTree.DeletePointerAddressInDb, block1.Hash!.Bytes);
- BlockTree tree2 = Build.A.BlockTree()
- .WithoutSettingHead
- .WithDatabaseFrom(builder)
- .TestObject;
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Shall_ignore_known()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
+ blockTree.SuggestBlock(block0);
+ blockTree.SuggestBlock(block1);
+ AddBlockResult result = blockTree.SuggestBlock(block1);
+ Assert.That(result, Is.EqualTo(AddBlockResult.AlreadyKnown));
+ }
- Assert.That(tree2.BestKnownNumber, Is.EqualTo(0L), "best known");
- Assert.That(tree2.Head, Is.EqualTo(null), "head");
- Assert.That(tree2.BestSuggestedHeader!.Number, Is.EqualTo(0L), "suggested");
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Cleans_invalid_blocks_before_starting()
+ {
+ MemDb blockInfosDb = new MemDb();
+ BlockTreeBuilder builder = Build.A.BlockTree()
+ .WithBlockInfoDb(blockInfosDb)
+ .WithoutSettingHead;
+ IBlockStore blockStore = builder.BlockStore;
+ BlockTree tree = builder.TestObject;
+
+ Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithDifficulty(3).WithParent(block1).TestObject;
+ Block block3 = Build.A.Block.WithNumber(3).WithDifficulty(4).WithParent(block2).TestObject;
+
+ tree.SuggestBlock(block0);
+ tree.SuggestBlock(block1);
+ tree.SuggestBlock(block2);
+ tree.SuggestBlock(block3);
+
+ blockInfosDb.Set(BlockTree.DeletePointerAddressInDb, block1.Hash!.Bytes);
+ BlockTree tree2 = Build.A.BlockTree()
+ .WithoutSettingHead
+ .WithDatabaseFrom(builder)
+ .TestObject;
+
+ Assert.That(tree2.BestKnownNumber, Is.EqualTo(0L), "best known");
+ Assert.That(tree2.Head, Is.EqualTo(null), "head");
+ Assert.That(tree2.BestSuggestedHeader!.Number, Is.EqualTo(0L), "suggested");
+ Assert.That(blockStore.Get(block2.Number, block2.Hash!), Is.Null, "block 1");
+ Assert.That(blockStore.Get(block2.Number, block2.Hash!), Is.Null, "block 2");
+ Assert.That(blockStore.Get(block3.Number, block3.Hash!), Is.Null, "block 3");
+ Assert.That(blockInfosDb.Get(2), Is.Null, "level 1");
+ Assert.That(blockInfosDb.Get(2), Is.Null, "level 2");
+ Assert.That(blockInfosDb.Get(3), Is.Null, "level 3");
+ }
- Assert.IsNull(blockStore.Get(block2.Number, block2.Hash!), "block 1");
- Assert.IsNull(blockStore.Get(block2.Number, block2.Hash!), "block 2");
- Assert.IsNull(blockStore.Get(block3.Number, block3.Hash!), "block 3");
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void When_cleaning_descendants_of_invalid_does_not_touch_other_branches()
+ {
+ MemDb blockInfosDb = new();
+ BlockTreeBuilder builder = Build.A.BlockTree()
+ .WithBlockInfoDb(blockInfosDb)
+ .WithoutSettingHead;
+ IBlockStore blockStore = builder.BlockStore;
+ BlockTree tree = builder.TestObject;
+
+ Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithDifficulty(3).WithParent(block1).TestObject;
+ Block block3 = Build.A.Block.WithNumber(3).WithDifficulty(4).WithParent(block2).TestObject;
+
+ Block block1B = Build.A.Block.WithNumber(1).WithDifficulty(1).WithParent(block0).TestObject;
+ Block block2B = Build.A.Block.WithNumber(2).WithDifficulty(1).WithParent(block1B).TestObject;
+ Block block3B = Build.A.Block.WithNumber(3).WithDifficulty(1).WithParent(block2B).TestObject;
+
+ tree.SuggestBlock(block0);
+ tree.SuggestBlock(block1);
+ tree.SuggestBlock(block2);
+ tree.SuggestBlock(block3);
+
+ tree.SuggestBlock(block1B);
+ tree.SuggestBlock(block2B);
+ tree.SuggestBlock(block3B);
+
+ blockInfosDb.Set(BlockTree.DeletePointerAddressInDb, block1.Hash!.Bytes);
+ BlockTree tree2 = Build.A.BlockTree()
+ .WithoutSettingHead
+ .WithDatabaseFrom(builder)
+ .TestObject;
+
+ Assert.That(tree2.BestKnownNumber, Is.EqualTo(3L), "best known");
+ Assert.That(tree2.Head, Is.EqualTo(null), "head");
+ Assert.That(tree2.BestSuggestedHeader!.Hash, Is.EqualTo(block3B.Hash), "suggested");
+
+ blockStore.Get(block1.Number, block1.Hash!).Should().BeNull("block 1");
+ blockStore.Get(block2.Number, block2.Hash!).Should().BeNull("block 2");
+ blockStore.Get(block3.Number, block3.Hash!).Should().BeNull("block 3");
+
+ Assert.That(blockInfosDb.Get(1), Is.Not.Null, "level 1");
+ Assert.That(blockInfosDb.Get(2), Is.Not.Null, "level 2");
+ Assert.That(blockInfosDb.Get(3), Is.Not.Null, "level 3");
+ }
- Assert.IsNull(blockInfosDb.Get(2), "level 1");
- Assert.IsNull(blockInfosDb.Get(2), "level 2");
- Assert.IsNull(blockInfosDb.Get(3), "level 3");
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Can_load_best_known_up_to_256million()
+ {
+ _blocksDb = new TestMemDb();
+ _headersDb = new TestMemDb();
+ TestMemDb blocksInfosDb = new TestMemDb();
- [Test, Timeout(Timeout.MaxTestTime)]
- public void When_cleaning_descendants_of_invalid_does_not_touch_other_branches()
+ Rlp chainLevel = Rlp.Encode(new ChainLevelInfo(true, new BlockInfo(TestItem.KeccakA, 1)));
+ blocksInfosDb.ReadFunc = (key) =>
{
- MemDb blockInfosDb = new();
- BlockTreeBuilder builder = Build.A.BlockTree()
- .WithBlockInfoDb(blockInfosDb)
- .WithoutSettingHead;
- IBlockStore blockStore = builder.BlockStore;
- BlockTree tree = builder.TestObject;
-
- Block block0 = Build.A.Block.WithNumber(0).WithDifficulty(1).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithDifficulty(2).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithDifficulty(3).WithParent(block1).TestObject;
- Block block3 = Build.A.Block.WithNumber(3).WithDifficulty(4).WithParent(block2).TestObject;
-
- Block block1B = Build.A.Block.WithNumber(1).WithDifficulty(1).WithParent(block0).TestObject;
- Block block2B = Build.A.Block.WithNumber(2).WithDifficulty(1).WithParent(block1B).TestObject;
- Block block3B = Build.A.Block.WithNumber(3).WithDifficulty(1).WithParent(block2B).TestObject;
-
- tree.SuggestBlock(block0);
- tree.SuggestBlock(block1);
- tree.SuggestBlock(block2);
- tree.SuggestBlock(block3);
-
- tree.SuggestBlock(block1B);
- tree.SuggestBlock(block2B);
- tree.SuggestBlock(block3B);
-
- blockInfosDb.Set(BlockTree.DeletePointerAddressInDb, block1.Hash!.Bytes);
- BlockTree tree2 = Build.A.BlockTree()
- .WithoutSettingHead
- .WithDatabaseFrom(builder)
- .TestObject;
-
- Assert.That(tree2.BestKnownNumber, Is.EqualTo(3L), "best known");
- Assert.That(tree2.Head, Is.EqualTo(null), "head");
- Assert.That(tree2.BestSuggestedHeader!.Hash, Is.EqualTo(block3B.Hash), "suggested");
+ if (!Bytes.AreEqual(key, BlockTree.DeletePointerAddressInDb.Bytes))
+ {
+ return chainLevel.Bytes;
+ }
- blockStore.Get(block1.Number, block1.Hash!).Should().BeNull("block 1");
- blockStore.Get(block2.Number, block2.Hash!).Should().BeNull("block 2");
- blockStore.Get(block3.Number, block3.Hash!).Should().BeNull("block 3");
+ return null!;
+ };
- Assert.NotNull(blockInfosDb.Get(1), "level 1");
- Assert.NotNull(blockInfosDb.Get(2), "level 2");
- Assert.NotNull(blockInfosDb.Get(3), "level 3");
- }
+ BlockTree blockTree = Build.A.BlockTree()
+ .WithoutSettingHead
+ .WithBlocksDb(_blocksDb)
+ .WithHeadersDb(_headersDb)
+ .WithBlockInfoDb(blocksInfosDb)
+ .TestObject;
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Can_load_best_known_up_to_256million()
- {
- _blocksDb = new TestMemDb();
- _headersDb = new TestMemDb();
- TestMemDb blocksInfosDb = new TestMemDb();
+ Assert.That(blockTree.BestKnownNumber, Is.EqualTo(256000000));
+ }
- Rlp chainLevel = Rlp.Encode(new ChainLevelInfo(true, new BlockInfo(TestItem.KeccakA, 1)));
- blocksInfosDb.ReadFunc = (key) =>
- {
- if (!Bytes.AreEqual(key, BlockTree.DeletePointerAddressInDb.Bytes))
- {
- return chainLevel.Bytes;
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Add_and_find_branch()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block = Build.A.Block.TestObject;
+ blockTree.SuggestBlock(block);
+ Block? found = blockTree.FindBlock(block.Hash, BlockTreeLookupOptions.None);
+ Assert.That(found?.Header.CalculateHash(), Is.EqualTo(block.Hash));
+ }
- return null!;
- };
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Add_on_branch_move_find()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block = Build.A.Block.TestObject;
+ AddToMain(blockTree, block);
+ Block? found = blockTree.FindBlock(block.Hash, BlockTreeLookupOptions.RequireCanonical);
+ Assert.That(found?.Header.CalculateHash(), Is.EqualTo(block.Hash));
+ }
- BlockTree blockTree = Build.A.BlockTree()
- .WithoutSettingHead
- .WithBlocksDb(_blocksDb)
- .WithHeadersDb(_headersDb)
- .WithBlockInfoDb(blocksInfosDb)
- .TestObject;
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Add_on_branch_move_find_via_block_finder_interface()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block = Build.A.Block.TestObject;
+ AddToMain(blockTree, block);
+ Block? found = ((IBlockFinder)blockTree).FindBlock(new BlockParameter(block.Hash!, true));
+ Assert.That(found?.Header.CalculateHash(), Is.EqualTo(block.Hash));
+ }
- Assert.That(blockTree.BestKnownNumber, Is.EqualTo(256000000));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Add_on_branch_and_not_find_on_main()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block = Build.A.Block.TestObject;
+ blockTree.SuggestBlock(block);
+ Block? found = blockTree.FindBlock(block.Hash, BlockTreeLookupOptions.RequireCanonical);
+ Assert.That(found, Is.Null);
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Add_and_find_branch()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block = Build.A.Block.TestObject;
- blockTree.SuggestBlock(block);
- Block? found = blockTree.FindBlock(block.Hash, BlockTreeLookupOptions.None);
- Assert.That(found?.Header.CalculateHash(), Is.EqualTo(block.Hash));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Add_on_branch_and_not_find_on_main_via_block_finder_interface()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block = Build.A.Block.TestObject;
+ blockTree.SuggestBlock(block);
+ Block? found = ((IBlockFinder)blockTree).FindBlock(new BlockParameter(block.Hash!, true));
+ Assert.That(found, Is.Null);
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Add_on_branch_move_find()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block = Build.A.Block.TestObject;
- AddToMain(blockTree, block);
- Block? found = blockTree.FindBlock(block.Hash, BlockTreeLookupOptions.RequireCanonical);
- Assert.That(found?.Header.CalculateHash(), Is.EqualTo(block.Hash));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_by_number_basic()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ Block? found = blockTree.FindBlock(2, BlockTreeLookupOptions.None);
+ Assert.That(found?.Header.CalculateHash(), Is.EqualTo(block2.Hash));
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Add_on_branch_move_find_via_block_finder_interface()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block = Build.A.Block.TestObject;
- AddToMain(blockTree, block);
- Block? found = ((IBlockFinder)blockTree).FindBlock(new BlockParameter(block.Hash!, true));
- Assert.That(found?.Header.CalculateHash(), Is.EqualTo(block.Hash));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_by_number_beyond_what_is_known_returns_null()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ Block? found = blockTree.FindBlock(1920000, BlockTreeLookupOptions.None);
+ Assert.That(found, Is.Null);
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Add_on_branch_and_not_find_on_main()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block = Build.A.Block.TestObject;
- blockTree.SuggestBlock(block);
- Block? found = blockTree.FindBlock(block.Hash, BlockTreeLookupOptions.RequireCanonical);
- Assert.IsNull(found);
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_by_number_returns_null_when_block_is_missing()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+
+ Block? found = blockTree.FindBlock(5, BlockTreeLookupOptions.None);
+ Assert.That(found, Is.Null);
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Add_on_branch_and_not_find_on_main_via_block_finder_interface()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block = Build.A.Block.TestObject;
- blockTree.SuggestBlock(block);
- Block? found = ((IBlockFinder)blockTree).FindBlock(new BlockParameter(block.Hash!, true));
- Assert.IsNull(found);
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_headers_basic()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ using IOwnedReadOnlyList headers = blockTree.FindHeaders(block0.Hash, 2, 0, false);
+ Assert.That(headers.Count, Is.EqualTo(2));
+ Assert.That(headers[0].Hash, Is.EqualTo(block0.Hash));
+ Assert.That(headers[1].Hash, Is.EqualTo(block1.Hash));
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Find_by_number_basic()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
- AddToMain(blockTree, block0);
- AddToMain(blockTree, block1);
- AddToMain(blockTree, block2);
-
- Block? found = blockTree.FindBlock(2, BlockTreeLookupOptions.None);
- Assert.That(found?.Header.CalculateHash(), Is.EqualTo(block2.Hash));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_headers_skip()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ using IOwnedReadOnlyList headers = blockTree.FindHeaders(block0.Hash, 2, 1, false);
+ Assert.That(headers.Count, Is.EqualTo(2));
+ Assert.That(headers[0].Hash, Is.EqualTo(block0.Hash));
+ Assert.That(headers[1].Hash, Is.EqualTo(block2.Hash));
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Find_by_number_beyond_what_is_known_returns_null()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
- AddToMain(blockTree, block0);
- AddToMain(blockTree, block1);
- AddToMain(blockTree, block2);
-
- Block? found = blockTree.FindBlock(1920000, BlockTreeLookupOptions.None);
- Assert.Null(found);
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_headers_reverse()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ Block block3 = Build.A.Block.WithNumber(3).WithParent(block2).TestObject;
+ Block block4 = Build.A.Block.WithNumber(4).WithParent(block3).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+ AddToMain(blockTree, block3);
+ AddToMain(blockTree, block4);
+
+ using IOwnedReadOnlyList headers = blockTree.FindHeaders(block2.Hash, 2, 0, true);
+ Assert.That(headers.Count, Is.EqualTo(2));
+ Assert.That(headers[0].Hash, Is.EqualTo(block2.Hash));
+ Assert.That(headers[1].Hash, Is.EqualTo(block1.Hash));
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Find_by_number_returns_null_when_block_is_missing()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
- AddToMain(blockTree, block0);
- AddToMain(blockTree, block1);
-
- Block? found = blockTree.FindBlock(5, BlockTreeLookupOptions.None);
- Assert.IsNull(found);
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_headers_reverse_skip()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ using IOwnedReadOnlyList headers = blockTree.FindHeaders(block2.Hash, 2, 1, true);
+ Assert.That(headers.Count, Is.EqualTo(2));
+ Assert.That(headers[0].Hash, Is.EqualTo(block2.Hash));
+ Assert.That(headers[1].Hash, Is.EqualTo(block0.Hash));
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Find_headers_basic()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
- AddToMain(blockTree, block0);
- AddToMain(blockTree, block1);
- AddToMain(blockTree, block2);
-
- using IOwnedReadOnlyList headers = blockTree.FindHeaders(block0.Hash, 2, 0, false);
- Assert.That(headers.Count, Is.EqualTo(2));
- Assert.That(headers[0].Hash, Is.EqualTo(block0.Hash));
- Assert.That(headers[1].Hash, Is.EqualTo(block1.Hash));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_headers_reverse_below_zero()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ using IOwnedReadOnlyList headers = blockTree.FindHeaders(block0.Hash, 2, 1, true);
+ Assert.That(headers.Count, Is.EqualTo(2));
+ Assert.That(headers[0].Hash, Is.EqualTo(block0.Hash));
+ Assert.That(headers[1], Is.Null);
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Find_headers_skip()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
- AddToMain(blockTree, block0);
- AddToMain(blockTree, block1);
- AddToMain(blockTree, block2);
-
- using IOwnedReadOnlyList headers = blockTree.FindHeaders(block0.Hash, 2, 1, false);
- Assert.That(headers.Count, Is.EqualTo(2));
- Assert.That(headers[0].Hash, Is.EqualTo(block0.Hash));
- Assert.That(headers[1].Hash, Is.EqualTo(block2.Hash));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void When_finding_headers_does_not_find_a_header_it_breaks_the_loop()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ using IOwnedReadOnlyList headers = blockTree.FindHeaders(block0.Hash, 100, 0, false);
+ Assert.That(headers.Count, Is.EqualTo(100));
+ Assert.That(headers[0].Hash, Is.EqualTo(block0.Hash));
+ Assert.That(headers[3], Is.Null);
+
+ Assert.That(_headersDb.ReadsCount, Is.EqualTo(0));
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Find_headers_reverse()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
- Block block3 = Build.A.Block.WithNumber(3).WithParent(block2).TestObject;
- Block block4 = Build.A.Block.WithNumber(4).WithParent(block3).TestObject;
- AddToMain(blockTree, block0);
- AddToMain(blockTree, block1);
- AddToMain(blockTree, block2);
- AddToMain(blockTree, block3);
- AddToMain(blockTree, block4);
-
- using IOwnedReadOnlyList headers = blockTree.FindHeaders(block2.Hash, 2, 0, true);
- Assert.That(headers.Count, Is.EqualTo(2));
- Assert.That(headers[0].Hash, Is.EqualTo(block2.Hash));
- Assert.That(headers[1].Hash, Is.EqualTo(block1.Hash));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void When_finding_blocks_does_not_find_a_block_it_breaks_the_loop()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ using IOwnedReadOnlyList headers = blockTree.FindHeaders(block0.Hash, 100, 0, false);
+ Assert.That(headers.Count, Is.EqualTo(100));
+ Assert.That(headers[0].Hash, Is.EqualTo(block0.Hash));
+ Assert.That(headers[3], Is.Null);
+
+ Assert.That(_headersDb.ReadsCount, Is.EqualTo(0));
+ }
- [Test, Timeout(Timeout.MaxTestTime)]
- public void Find_headers_reverse_skip()
- {
- BlockTree blockTree = BuildBlockTree();
- Block block0 = Build.A.Block.WithNumber(0).TestObject;
- Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
- Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
- AddToMain(blockTree, block0);
- AddToMain(blockTree, block1);
- AddToMain(blockTree, block2);
-
- using IOwnedReadOnlyList headers = blockTree.FindHeaders(block2.Hash, 2, 1, true);
- Assert.That(headers.Count, Is.EqualTo(2));
- Assert.That(headers[0].Hash, Is.EqualTo(block2.Hash));
- Assert.That(headers[1].Hash, Is.EqualTo(block0.Hash));
- }
+ [Test, MaxTime(Timeout.MaxTestTime)]
+ public void Find_sequence_basic_longer()
+ {
+ BlockTree blockTree = BuildBlockTree();
+ Block block0 = Build.A.Block.WithNumber(0).TestObject;
+ Block block1 = Build.A.Block.WithNumber(1).WithParent(block0).TestObject;
+ Block block2 = Build.A.Block.WithNumber(2).WithParent(block1).TestObject;
+ AddToMain(blockTree, block0);
+ AddToMain(blockTree, block1);
+ AddToMain(blockTree, block2);
+
+ int length = 256;
+ using IOwnedReadOnlyList