From 80ab783828ef8f6601b072167760dfc4e3ed30f0 Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Mon, 5 Jun 2023 13:53:52 +0200 Subject: [PATCH 01/12] Working on GnosisSpecProvider --- .../ChainSpecBasedSpecProviderTests.cs | 29 ++++++++++++ .../Nethermind.Specs/GnosisSpecProvider.cs | 45 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 80194534802..9c57ea32a00 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -232,6 +232,35 @@ public void Chiado_loads_properly() provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L); } + [Test] + public void Gnosis_loads_properly() + { + ChainSpecLoader loader = new(new EthereumJsonSerializer()); + string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/gnosis.json"); + ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); + + ChainSpecBasedSpecProvider provider = new(chainSpec); + GnosisSpecProvider gnosisSpecProvider = GnosisSpecProvider.Instance; + + List forkActivationsToTest = new() + { + (ForkActivation)0, + //(ForkActivation)1, + (1, ChiadoSpecProvider.ShanghaiTimestamp - 1), + (1, ChiadoSpecProvider.ShanghaiTimestamp), + (999_999_999, 999_999_999) // far in the future + }; + + CompareSpecProviders(gnosisSpecProvider, provider, forkActivationsToTest, CompareSpecsOptions.IsGnosis); + Assert.That(provider.TerminalTotalDifficulty, Is.EqualTo(ChiadoSpecProvider.Instance.TerminalTotalDifficulty)); + Assert.That(provider.ChainId, Is.EqualTo(BlockchainIds.Gnosis)); + Assert.That(provider.NetworkId, Is.EqualTo(BlockchainIds.Gnosis)); + + provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp - 1)).MaxCodeSize.Should().Be(long.MaxValue); + provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxCodeSize.Should().Be(24576L); + provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L); + } + [Test] public void Mainnet_loads_properly() diff --git a/src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs b/src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs new file mode 100644 index 00000000000..216ac975c0b --- /dev/null +++ b/src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs @@ -0,0 +1,45 @@ +// SPDX-FileCopyrightText: 2023 Demerzel Solutions Limited +// SPDX-License-Identifier: LGPL-3.0-only + +using Nethermind.Core; +using Nethermind.Core.Specs; +using Nethermind.Int256; +using Nethermind.Specs.Forks; + +namespace Nethermind.Specs; + +public class GnosisSpecProvider : ISpecProvider +{ + public const ulong ShanghaiTimestamp = 0x646e0e4cUL; + + private GnosisSpecProvider() { } + + public IReleaseSpec GetSpec(ForkActivation forkActivation) => forkActivation.BlockNumber switch + { + _ => forkActivation.Timestamp switch + { + null or < ShanghaiTimestamp => GenesisSpec, + _ => Shanghai.Instance + } + }; + + public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalDifficulty = null) + { + if (blockNumber is not null) + MergeBlockNumber = (ForkActivation)blockNumber; + + if (terminalTotalDifficulty is not null) + TerminalTotalDifficulty = terminalTotalDifficulty; + } + + public ForkActivation? MergeBlockNumber { get; private set; } + public ulong TimestampFork => ShanghaiTimestamp; + public UInt256? TerminalTotalDifficulty { get; private set; } = UInt256.Parse("231707791542740786049188744689299064356246512"); + public IReleaseSpec GenesisSpec => London.Instance; + public long? DaoBlockNumber => null; + public ulong NetworkId => BlockchainIds.Gnosis; + public ulong ChainId => BlockchainIds.Gnosis; + public ForkActivation[] TransitionActivations { get; } + + public static GnosisSpecProvider Instance { get; } = new(); +} From 652d09c75244e3313a06b77d545880c33967d42d Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Mon, 5 Jun 2023 14:08:01 +0200 Subject: [PATCH 02/12] Passed test --- .../ChainSpecBasedSpecProviderTests.cs | 14 ++++---- .../Nethermind.Specs/GnosisSpecProvider.cs | 33 +++++++++++++------ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 9c57ea32a00..cd853b77253 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -246,19 +246,21 @@ public void Gnosis_loads_properly() { (ForkActivation)0, //(ForkActivation)1, - (1, ChiadoSpecProvider.ShanghaiTimestamp - 1), - (1, ChiadoSpecProvider.ShanghaiTimestamp), + (1, GnosisSpecProvider.ShanghaiTimestamp - 1), + (1, GnosisSpecProvider.ShanghaiTimestamp), (999_999_999, 999_999_999) // far in the future }; CompareSpecProviders(gnosisSpecProvider, provider, forkActivationsToTest, CompareSpecsOptions.IsGnosis); - Assert.That(provider.TerminalTotalDifficulty, Is.EqualTo(ChiadoSpecProvider.Instance.TerminalTotalDifficulty)); + Assert.That(provider.TerminalTotalDifficulty, Is.EqualTo(GnosisSpecProvider.Instance.TerminalTotalDifficulty)); Assert.That(provider.ChainId, Is.EqualTo(BlockchainIds.Gnosis)); Assert.That(provider.NetworkId, Is.EqualTo(BlockchainIds.Gnosis)); - provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp - 1)).MaxCodeSize.Should().Be(long.MaxValue); - provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxCodeSize.Should().Be(24576L); - provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L); + provider.GetSpec((1, GnosisSpecProvider.ShanghaiTimestamp - 1)).MaxCodeSize.Should().Be(long.MaxValue); + + /* ToDo uncomment when we have gnosis shapella timestamp + provider.GetSpec((1, GnosisSpecProvider.ShanghaiTimestamp)).MaxCodeSize.Should().Be(24576L); + provider.GetSpec((1, GnosisSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L);*/ } diff --git a/src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs b/src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs index 216ac975c0b..935f8c77d28 100644 --- a/src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs +++ b/src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs @@ -10,18 +10,24 @@ namespace Nethermind.Specs; public class GnosisSpecProvider : ISpecProvider { - public const ulong ShanghaiTimestamp = 0x646e0e4cUL; - private GnosisSpecProvider() { } - public IReleaseSpec GetSpec(ForkActivation forkActivation) => forkActivation.BlockNumber switch + public IReleaseSpec GetSpec(ForkActivation forkActivation) { - _ => forkActivation.Timestamp switch + return forkActivation.BlockNumber switch { - null or < ShanghaiTimestamp => GenesisSpec, - _ => Shanghai.Instance - } - }; + < ConstantinopoleBlockNumber => GenesisSpec, + < ConstantinopoleFixBlockNumber => Constantinople.Instance, + < IstanbulBlockNumber => ConstantinopleFix.Instance, + < BerlinBlockNumber => Istanbul.Instance, + < LondonBlockNumber => Berlin.Instance, + _ => forkActivation.Timestamp switch + { + null or < ShanghaiTimestamp => London.Instance, + _ => Shanghai.Instance + } + }; + } public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalDifficulty = null) { @@ -34,12 +40,19 @@ public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalD public ForkActivation? MergeBlockNumber { get; private set; } public ulong TimestampFork => ShanghaiTimestamp; - public UInt256? TerminalTotalDifficulty { get; private set; } = UInt256.Parse("231707791542740786049188744689299064356246512"); - public IReleaseSpec GenesisSpec => London.Instance; + public UInt256? TerminalTotalDifficulty { get; private set; } = UInt256.Parse("8626000000000000000000058750000000000000000000"); + public IReleaseSpec GenesisSpec => Byzantium.Instance; public long? DaoBlockNumber => null; public ulong NetworkId => BlockchainIds.Gnosis; public ulong ChainId => BlockchainIds.Gnosis; public ForkActivation[] TransitionActivations { get; } + public const long ConstantinopoleBlockNumber = 1_604_400; + public const long ConstantinopoleFixBlockNumber = 2_508_800; + public const long IstanbulBlockNumber = 7_298_030; + public const long BerlinBlockNumber = 16_101_500; + public const long LondonBlockNumber = 19_040_000; + public const ulong ShanghaiTimestamp = long.MaxValue; + public static GnosisSpecProvider Instance { get; } = new(); } From e331b140915f0ca72b32501d32e6c1a7b1d4075c Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Mon, 5 Jun 2023 14:14:07 +0200 Subject: [PATCH 03/12] More GetSpec checks --- .../ChainSpecBasedSpecProviderTests.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index cd853b77253..84b64b91bae 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -245,7 +245,17 @@ public void Gnosis_loads_properly() List forkActivationsToTest = new() { (ForkActivation)0, - //(ForkActivation)1, + (ForkActivation)1, + (ForkActivation)(GnosisSpecProvider.ConstantinopoleBlockNumber -1), + (ForkActivation)(GnosisSpecProvider.ConstantinopoleBlockNumber), + (ForkActivation)(GnosisSpecProvider.ConstantinopoleFixBlockNumber -1), + (ForkActivation)(GnosisSpecProvider.ConstantinopoleFixBlockNumber), + (ForkActivation)(GnosisSpecProvider.IstanbulBlockNumber -1), + (ForkActivation)(GnosisSpecProvider.IstanbulBlockNumber), + (ForkActivation)(GnosisSpecProvider.BerlinBlockNumber -1), + (ForkActivation)(GnosisSpecProvider.BerlinBlockNumber), + (ForkActivation)(GnosisSpecProvider.LondonBlockNumber -1), + (ForkActivation)(GnosisSpecProvider.LondonBlockNumber), (1, GnosisSpecProvider.ShanghaiTimestamp - 1), (1, GnosisSpecProvider.ShanghaiTimestamp), (999_999_999, 999_999_999) // far in the future From deaf1f84af22d00cffd16119dfb550c564adf79e Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Mon, 5 Jun 2023 22:17:50 +0200 Subject: [PATCH 04/12] Working on gnosis exceptions --- .../ChainSpecBasedSpecProviderTests.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 84b64b91bae..7ab77a3a297 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -216,7 +216,7 @@ public void Chiado_loads_properly() List forkActivationsToTest = new() { (ForkActivation)0, - //(ForkActivation)1, + // (ForkActivation)(1, null), (1, ChiadoSpecProvider.ShanghaiTimestamp - 1), (1, ChiadoSpecProvider.ShanghaiTimestamp), (999_999_999, 999_999_999) // far in the future @@ -227,9 +227,25 @@ public void Chiado_loads_properly() Assert.That(provider.ChainId, Is.EqualTo(BlockchainIds.Chiado)); Assert.That(provider.NetworkId, Is.EqualTo(BlockchainIds.Chiado)); + VerifyGnosisForkExceptions(provider, ChiadoSpecProvider.ShanghaiTimestamp); + provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp - 1)).MaxCodeSize.Should().Be(long.MaxValue); provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxCodeSize.Should().Be(24576L); provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L); + provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).LimitCodeSize.Should().Be(true); + } + + private void VerifyGnosisForkExceptions(ISpecProvider specProvider, ulong shanghaiTimestamp) + { + long blockNumber = GnosisSpecProvider.LondonBlockNumber + 1; // for Chiado it doesn't matter, for Gnosis we need something after LondonHardfork + specProvider.GetSpec((blockNumber, shanghaiTimestamp - 1)).MaxCodeSize.Should().Be(long.MaxValue); + specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp)).MaxCodeSize.Should().Be(24576L); + + specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp - 1)).MaxInitCodeSize.Should().Be(0L); + specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L); + + specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp)).LimitCodeSize.Should().Be(true); + specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp)).LimitCodeSize.Should().Be(true); } [Test] From 919f99102f5064c1735dea78c280288b0e4943f6 Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Thu, 15 Jun 2023 13:38:59 +0200 Subject: [PATCH 05/12] handle gnosis exceptions --- src/Nethermind/Nethermind.GitBook/docs | 2 +- .../ChainSpecBasedSpecProviderTests.cs | 68 ++++++++++++------- src/tests | 2 +- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/src/Nethermind/Nethermind.GitBook/docs b/src/Nethermind/Nethermind.GitBook/docs index a88697c8982..51c81f93f99 160000 --- a/src/Nethermind/Nethermind.GitBook/docs +++ b/src/Nethermind/Nethermind.GitBook/docs @@ -1 +1 @@ -Subproject commit a88697c89826fb12ea4976c21396d4a8f79cb196 +Subproject commit 51c81f93f99e824cd5f0b911bd160d8f63198578 diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 7ab77a3a297..13a2d011cac 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -37,8 +37,8 @@ public void Timstamp_activation_equal_to_genesis_timestamp_loads_correctly(long string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../Specs/Timstamp_activation_equal_to_genesis_timestamp_test.json"); ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); chainSpec.Parameters.Eip2537Transition.Should().BeNull(); - var logger = Substitute.ForPartsOf(); - var logManager = Substitute.For(); + LimboTraceLogger? logger = Substitute.ForPartsOf(); + ILogManager? logManager = Substitute.For(); logManager.GetClassLogger().Returns(logger); ChainSpecBasedSpecProvider provider = new(chainSpec); ReleaseSpec expectedSpec = ((ReleaseSpec)MainnetSpecProvider @@ -82,9 +82,9 @@ public void Logs_warning_when_timestampActivation_happens_before_blockActivation string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../Specs/Logs_warning_when_timestampActivation_happens_before_blockActivation_test.json"); ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); chainSpec.Parameters.Eip2537Transition.Should().BeNull(); - var logger = Substitute.For(); + ILogger? logger = Substitute.For(); logger.IsWarn.Returns(true); - var logManager = Substitute.For(); + ILogManager? logManager = Substitute.For(); logManager.GetClassLogger().Returns(logger); ChainSpecBasedSpecProvider provider = new(chainSpec, logManager); ReleaseSpec expectedSpec = ((ReleaseSpec)MainnetSpecProvider @@ -227,25 +227,10 @@ public void Chiado_loads_properly() Assert.That(provider.ChainId, Is.EqualTo(BlockchainIds.Chiado)); Assert.That(provider.NetworkId, Is.EqualTo(BlockchainIds.Chiado)); - VerifyGnosisForkExceptions(provider, ChiadoSpecProvider.ShanghaiTimestamp); + IReleaseSpec? preShanghaiSpec = provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp - 1)); + IReleaseSpec? postShanghaiSpec = provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)); - provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp - 1)).MaxCodeSize.Should().Be(long.MaxValue); - provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxCodeSize.Should().Be(24576L); - provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L); - provider.GetSpec((1, ChiadoSpecProvider.ShanghaiTimestamp)).LimitCodeSize.Should().Be(true); - } - - private void VerifyGnosisForkExceptions(ISpecProvider specProvider, ulong shanghaiTimestamp) - { - long blockNumber = GnosisSpecProvider.LondonBlockNumber + 1; // for Chiado it doesn't matter, for Gnosis we need something after LondonHardfork - specProvider.GetSpec((blockNumber, shanghaiTimestamp - 1)).MaxCodeSize.Should().Be(long.MaxValue); - specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp)).MaxCodeSize.Should().Be(24576L); - - specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp - 1)).MaxInitCodeSize.Should().Be(0L); - specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L); - - specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp)).LimitCodeSize.Should().Be(true); - specProvider.GetSpec((blockNumber, ChiadoSpecProvider.ShanghaiTimestamp)).LimitCodeSize.Should().Be(true); + VerifyGnosisShanghaiExceptions(preShanghaiSpec, postShanghaiSpec); } [Test] @@ -281,14 +266,45 @@ public void Gnosis_loads_properly() Assert.That(provider.TerminalTotalDifficulty, Is.EqualTo(GnosisSpecProvider.Instance.TerminalTotalDifficulty)); Assert.That(provider.ChainId, Is.EqualTo(BlockchainIds.Gnosis)); Assert.That(provider.NetworkId, Is.EqualTo(BlockchainIds.Gnosis)); + VerifyGnosisPreShanghaiExceptions(provider); - provider.GetSpec((1, GnosisSpecProvider.ShanghaiTimestamp - 1)).MaxCodeSize.Should().Be(long.MaxValue); + /* ToDo uncomment with Gnosis fork specified + IReleaseSpec? preShanghaiSpec = provider.GetSpec((GnosisSpecProvider.LondonBlockNumber + 1, + GnosisSpecProvider.ShanghaiTimestamp - 1)); + IReleaseSpec? postShanghaiSpec = provider.GetSpec((GnosisSpecProvider.LondonBlockNumber + 1, + GnosisSpecProvider.ShanghaiTimestamp)); - /* ToDo uncomment when we have gnosis shapella timestamp - provider.GetSpec((1, GnosisSpecProvider.ShanghaiTimestamp)).MaxCodeSize.Should().Be(24576L); - provider.GetSpec((1, GnosisSpecProvider.ShanghaiTimestamp)).MaxInitCodeSize.Should().Be(2 * 24576L);*/ + VerifyGnosisForkExceptions(preShanghaiSpec, postShanghaiSpec); */ } + private void VerifyGnosisShanghaiExceptions(IReleaseSpec preShanghaiSpec, IReleaseSpec postShanghaiSpec) + { + preShanghaiSpec.MaxCodeSize.Should().Be(long.MaxValue); + postShanghaiSpec.MaxCodeSize.Should().Be(24576L); + + preShanghaiSpec.MaxInitCodeSize.Should().Be(-2L); // doesn't have meaningful value before EIP3860 + postShanghaiSpec.MaxInitCodeSize.Should().Be(2 * 24576L); + + preShanghaiSpec.LimitCodeSize.Should().Be(false); + postShanghaiSpec.LimitCodeSize.Should().Be(true); + + preShanghaiSpec.IsEip170Enabled.Should().Be(false); + postShanghaiSpec.IsEip170Enabled.Should().Be(true); + } + + private void VerifyGnosisPreShanghaiExceptions(ISpecProvider specProvider) + { + specProvider.GenesisSpec.MaximumUncleCount.Should().Be(0); + specProvider.GetSpec((ForkActivation)(GnosisSpecProvider.ConstantinopoleBlockNumber - (1))).IsEip1283Enabled.Should() + .BeFalse(); + specProvider.GetSpec((ForkActivation)GnosisSpecProvider.ConstantinopoleBlockNumber).IsEip1283Enabled.Should() + .BeTrue(); + + specProvider.GetSpec((ForkActivation)(GnosisSpecProvider.ConstantinopoleBlockNumber -1)).UseConstantinopleNetGasMetering.Should() + .BeFalse(); + specProvider.GetSpec((ForkActivation)GnosisSpecProvider.ConstantinopoleBlockNumber).UseConstantinopleNetGasMetering.Should() + .BeTrue(); + } [Test] public void Mainnet_loads_properly() diff --git a/src/tests b/src/tests index b25623d4d7d..be07adc7436 160000 --- a/src/tests +++ b/src/tests @@ -1 +1 @@ -Subproject commit b25623d4d7df10e38498cace7adc7eb413c4b20d +Subproject commit be07adc743652812dff63f424366c78db99e3420 From 3e5c81725b4d8a166bd8af3a397426a2a757cb7c Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Tue, 13 Jun 2023 23:33:12 +0200 Subject: [PATCH 06/12] cosmetic --- .../ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 13a2d011cac..186eb0da2d3 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -216,7 +216,7 @@ public void Chiado_loads_properly() List forkActivationsToTest = new() { (ForkActivation)0, - // (ForkActivation)(1, null), + //(ForkActivation)(1, null), (1, ChiadoSpecProvider.ShanghaiTimestamp - 1), (1, ChiadoSpecProvider.ShanghaiTimestamp), (999_999_999, 999_999_999) // far in the future From 93f5d97b82a718a344f309cb953796cb518867d0 Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Thu, 15 Jun 2023 14:02:15 +0200 Subject: [PATCH 07/12] refactoring chainspec loading --- .../ChainSpecBasedSpecProviderTests.cs | 45 +++++++------------ 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 186eb0da2d3..a58843fc91b 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -117,12 +117,7 @@ public void Logs_warning_when_timestampActivation_happens_before_blockActivation [Test] public void Sepolia_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/sepolia.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - chainSpec.Parameters.Eip2537Transition.Should().BeNull(); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("sepolia"); SepoliaSpecProvider sepolia = SepoliaSpecProvider.Instance; List forkActivationsToTest = new() @@ -174,12 +169,7 @@ public void Rinkeby_loads_properly() [Test] public void Goerli_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/goerli.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - chainSpec.Parameters.Eip2537Transition.Should().BeNull(); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("goerli"); GoerliSpecProvider goerli = GoerliSpecProvider.Instance; List forkActivationsToTest = new() @@ -206,17 +196,13 @@ public void Goerli_loads_properly() [Test] public void Chiado_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/chiado.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("chiado"); ChiadoSpecProvider chiado = ChiadoSpecProvider.Instance; List forkActivationsToTest = new() { (ForkActivation)0, - //(ForkActivation)(1, null), + //(ForkActivation)1, (1, ChiadoSpecProvider.ShanghaiTimestamp - 1), (1, ChiadoSpecProvider.ShanghaiTimestamp), (999_999_999, 999_999_999) // far in the future @@ -236,11 +222,7 @@ public void Chiado_loads_properly() [Test] public void Gnosis_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/gnosis.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("gnosis"); GnosisSpecProvider gnosisSpecProvider = GnosisSpecProvider.Instance; List forkActivationsToTest = new() @@ -309,12 +291,7 @@ private void VerifyGnosisPreShanghaiExceptions(ISpecProvider specProvider) [Test] public void Mainnet_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/foundation.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - chainSpec.Parameters.Eip2537Transition.Should().BeNull(); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("foundation"); MainnetSpecProvider mainnet = MainnetSpecProvider.Instance; List forkActivationsToTest = new() @@ -353,6 +330,7 @@ public void Mainnet_loads_properly() provider.GetSpec((MainnetSpecProvider.SpuriousDragonBlockNumber, null)).MaxCodeSize.Should().Be(24576L); provider.GetSpec((MainnetSpecProvider.SpuriousDragonBlockNumber, null)).MaxInitCodeSize.Should().Be(2 * 24576L); + provider.GetSpec((ForkActivation)(long.MaxValue - 1)).IsEip2537Enabled.Should().BeFalse(); Assert.That(provider.GenesisSpec.Eip1559TransitionBlock, Is.EqualTo(MainnetSpecProvider.LondonBlockNumber)); Assert.That(provider.GetSpec((ForkActivation)4_369_999).DifficultyBombDelay, Is.EqualTo(0_000_000)); Assert.That(provider.GetSpec((ForkActivation)4_370_000).DifficultyBombDelay, Is.EqualTo(3_000_000)); @@ -478,6 +456,15 @@ public void Ropsten_loads_properly() Assert.That(provider.GenesisSpec.Eip1559TransitionBlock, Is.EqualTo(RopstenSpecProvider.LondonBlockNumber)); } + private ChainSpecBasedSpecProvider LoadChainSpecFromChainFolder(string chain) + { + ChainSpecLoader loader = new(new EthereumJsonSerializer()); + string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, $"../../../../Chains/{chain}.json"); + ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); + + return new(chainSpec); + } + [Test] public void Chain_id_is_set_correctly() { From f44558659a7453459b30b0d909884b828eb947da Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Thu, 15 Jun 2023 14:21:23 +0200 Subject: [PATCH 08/12] chainspec tests refactoring --- .../ChainSpecBasedSpecProviderTests.cs | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index ea72a250007..f2b6a872709 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -119,12 +119,7 @@ public void Logs_warning_when_timestampActivation_happens_before_blockActivation [Test] public void Sepolia_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/sepolia.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - chainSpec.Parameters.Eip2537Transition.Should().BeNull(); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("sepolia"); SepoliaSpecProvider sepolia = SepoliaSpecProvider.Instance; List forkActivationsToTest = new() @@ -176,12 +171,7 @@ public void Rinkeby_loads_properly() [Test] public void Goerli_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/goerli.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - chainSpec.Parameters.Eip2537Transition.Should().BeNull(); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("goerli"); GoerliSpecProvider goerli = GoerliSpecProvider.Instance; List forkActivationsToTest = new() @@ -208,11 +198,7 @@ public void Goerli_loads_properly() [Test] public void Chiado_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/chiado.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("chiado"); ChiadoSpecProvider chiado = ChiadoSpecProvider.Instance; List forkActivationsToTest = new() @@ -311,12 +297,7 @@ private void VerifyGnosisPreShanghaiExceptions(ISpecProvider specProvider) [Test] public void Mainnet_loads_properly() { - ChainSpecLoader loader = new(new EthereumJsonSerializer()); - string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "../../../../Chains/foundation.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - chainSpec.Parameters.Eip2537Transition.Should().BeNull(); - - ChainSpecBasedSpecProvider provider = new(chainSpec); + ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("foundation"); MainnetSpecProvider mainnet = MainnetSpecProvider.Instance; List forkActivationsToTest = new() @@ -355,6 +336,7 @@ public void Mainnet_loads_properly() provider.GetSpec((MainnetSpecProvider.SpuriousDragonBlockNumber, null)).MaxCodeSize.Should().Be(24576L); provider.GetSpec((MainnetSpecProvider.SpuriousDragonBlockNumber, null)).MaxInitCodeSize.Should().Be(2 * 24576L); + provider.GetSpec((ForkActivation)(long.MaxValue - 1)).IsEip2537Enabled.Should().BeFalse(); Assert.That(provider.GenesisSpec.Eip1559TransitionBlock, Is.EqualTo(MainnetSpecProvider.LondonBlockNumber)); Assert.That(provider.GetSpec((ForkActivation)4_369_999).DifficultyBombDelay, Is.EqualTo(0_000_000)); Assert.That(provider.GetSpec((ForkActivation)4_370_000).DifficultyBombDelay, Is.EqualTo(3_000_000)); From 9e9501b07c087317f68c7a72eaddad830c5537f6 Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Thu, 15 Jun 2023 14:31:50 +0200 Subject: [PATCH 09/12] chainspec tests refactoring --- .../ChainSpecBasedSpecProviderTests.cs | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index f2b6a872709..1ceac9d910e 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -119,7 +119,8 @@ public void Logs_warning_when_timestampActivation_happens_before_blockActivation [Test] public void Sepolia_loads_properly() { - ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("sepolia"); + ChainSpec chainSpec = LoadChainSpecFromChainFolder("sepolia"); + ChainSpecBasedSpecProvider provider = new(chainSpec); SepoliaSpecProvider sepolia = SepoliaSpecProvider.Instance; List forkActivationsToTest = new() @@ -137,6 +138,9 @@ public void Sepolia_loads_properly() Assert.That(provider.GenesisSpec.DifficultyBombDelay, Is.EqualTo(long.MaxValue)); Assert.That(provider.ChainId, Is.EqualTo(BlockchainIds.Sepolia)); Assert.That(provider.NetworkId, Is.EqualTo(BlockchainIds.Sepolia)); + + GetTransitionTimestamps(chainSpec.Parameters).Should().AllSatisfy( + t => ValidateSlotByTimestamp(t, SepoliaSpecProvider.BeaconChainGenesisTimestamp).Should().BeTrue()); } [Test] @@ -171,7 +175,8 @@ public void Rinkeby_loads_properly() [Test] public void Goerli_loads_properly() { - ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("goerli"); + ChainSpec chainSpec = LoadChainSpecFromChainFolder("goerli"); + ChainSpecBasedSpecProvider provider = new(chainSpec); GoerliSpecProvider goerli = GoerliSpecProvider.Instance; List forkActivationsToTest = new() @@ -193,12 +198,16 @@ public void Goerli_loads_properly() Assert.That(provider.TerminalTotalDifficulty, Is.EqualTo(GoerliSpecProvider.Instance.TerminalTotalDifficulty)); Assert.That(provider.ChainId, Is.EqualTo(BlockchainIds.Goerli)); Assert.That(provider.NetworkId, Is.EqualTo(BlockchainIds.Goerli)); + + GetTransitionTimestamps(chainSpec.Parameters).Should().AllSatisfy( + t => ValidateSlotByTimestamp(t, GoerliSpecProvider.BeaconChainGenesisTimestamp).Should().BeTrue()); } [Test] public void Chiado_loads_properly() { - ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("chiado"); + ChainSpec chainSpec = LoadChainSpecFromChainFolder("chiado"); + ChainSpecBasedSpecProvider provider = new(chainSpec); ChiadoSpecProvider chiado = ChiadoSpecProvider.Instance; List forkActivationsToTest = new() @@ -226,7 +235,8 @@ public void Chiado_loads_properly() [Test] public void Gnosis_loads_properly() { - ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("gnosis"); + ChainSpec chainSpec = LoadChainSpecFromChainFolder("gnosis"); + ChainSpecBasedSpecProvider provider = new(chainSpec); GnosisSpecProvider gnosisSpecProvider = GnosisSpecProvider.Instance; List forkActivationsToTest = new() @@ -261,7 +271,9 @@ public void Gnosis_loads_properly() IReleaseSpec? postShanghaiSpec = provider.GetSpec((GnosisSpecProvider.LondonBlockNumber + 1, GnosisSpecProvider.ShanghaiTimestamp)); - VerifyGnosisPreShanghaiExceptions(preShanghaiSpec, postShanghaiSpec); */ + VerifyGnosisPreShanghaiExceptions(preShanghaiSpec, postShanghaiSpec); + GetTransitionTimestamps(chainSpec.Parameters).Should().AllSatisfy( + t => ValidateSlotByTimestamp(t, GnosisSpecProvider.BeaconChainGenesisTimestamp, GnosisBlockTime).Should().BeTrue()); */ } private void VerifyGnosisShanghaiExceptions(IReleaseSpec preShanghaiSpec, IReleaseSpec postShanghaiSpec) @@ -297,7 +309,8 @@ private void VerifyGnosisPreShanghaiExceptions(ISpecProvider specProvider) [Test] public void Mainnet_loads_properly() { - ChainSpecBasedSpecProvider provider = LoadChainSpecFromChainFolder("foundation"); + ChainSpec chainSpec = LoadChainSpecFromChainFolder("foundation"); + ChainSpecBasedSpecProvider provider = new(chainSpec); MainnetSpecProvider mainnet = MainnetSpecProvider.Instance; List forkActivationsToTest = new() @@ -356,6 +369,9 @@ public void Mainnet_loads_properly() Assert.That(provider.TerminalTotalDifficulty, Is.EqualTo(MainnetSpecProvider.Instance.TerminalTotalDifficulty)); Assert.That(provider.ChainId, Is.EqualTo(BlockchainIds.Mainnet)); Assert.That(provider.NetworkId, Is.EqualTo(BlockchainIds.Mainnet)); + + GetTransitionTimestamps(chainSpec.Parameters).Should().AllSatisfy( + t => ValidateSlotByTimestamp(t, MainnetSpecProvider.BeaconChainGenesisTimestamp).Should().BeTrue()); } [Flags] @@ -462,13 +478,11 @@ public void Ropsten_loads_properly() Assert.That(provider.GenesisSpec.Eip1559TransitionBlock, Is.EqualTo(RopstenSpecProvider.LondonBlockNumber)); } - private ChainSpecBasedSpecProvider LoadChainSpecFromChainFolder(string chain) + private ChainSpec LoadChainSpecFromChainFolder(string chain) { ChainSpecLoader loader = new(new EthereumJsonSerializer()); string path = Path.Combine(TestContext.CurrentContext.WorkDirectory, $"../../../../Chains/{chain}.json"); - ChainSpec chainSpec = loader.Load(File.ReadAllText(path)); - - return new(chainSpec); + return loader.Load(File.ReadAllText(path)); } [Test] From 01987a3f3b96586ddb0c37fde42817a31fdd33e0 Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Thu, 15 Jun 2023 15:08:22 +0200 Subject: [PATCH 10/12] whitespace fix --- .../ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 1ceac9d910e..a3324d7d0cc 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -213,7 +213,7 @@ public void Chiado_loads_properly() List forkActivationsToTest = new() { (ForkActivation)0, - //(ForkActivation)1, + (ForkActivation)(1, null), (1, ChiadoSpecProvider.ShanghaiTimestamp - 1), (1, ChiadoSpecProvider.ShanghaiTimestamp), (999_999_999, 999_999_999) // far in the future @@ -298,7 +298,6 @@ private void VerifyGnosisPreShanghaiExceptions(ISpecProvider specProvider) .BeFalse(); specProvider.GetSpec((ForkActivation)GnosisSpecProvider.ConstantinopoleBlockNumber).IsEip1283Enabled.Should() .BeTrue(); - specProvider.GetSpec((ForkActivation)(GnosisSpecProvider.ConstantinopoleBlockNumber -1)).UseConstantinopleNetGasMetering.Should() .BeFalse(); specProvider.GetSpec((ForkActivation)GnosisSpecProvider.ConstantinopoleBlockNumber).UseConstantinopleNetGasMetering.Should() @@ -413,7 +412,6 @@ private static void CompareSpecs(IReleaseSpec expectedSpec, IReleaseSpec actualS typeof(IReleaseSpec).GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo propertyInfo in propertyInfos .Where(p => p.Name != nameof(IReleaseSpec.Name)) - // handle mainnet specific exceptions .Where(p => isMainnet || p.Name != nameof(IReleaseSpec.MaximumExtraDataSize)) .Where(p => isMainnet || p.Name != nameof(IReleaseSpec.BlockReward)) @@ -421,12 +419,10 @@ private static void CompareSpecs(IReleaseSpec expectedSpec, IReleaseSpec actualS p.Name != nameof(IReleaseSpec.DifficultyBombDelay)) .Where(p => isMainnet || checkDifficultyBomb || p.Name != nameof(IReleaseSpec.DifficultyBoundDivisor)) - // handle RLP decoders .Where(p => p.Name != nameof(IReleaseSpec.Eip1559TransitionBlock)) .Where(p => p.Name != nameof(IReleaseSpec.WithdrawalTimestamp)) .Where(p => p.Name != nameof(IReleaseSpec.Eip4844TransitionTimestamp)) - // handle gnosis specific exceptions .Where(p => !isGnosis || p.Name != nameof(IReleaseSpec.MaxCodeSize)) .Where(p => !isGnosis || p.Name != nameof(IReleaseSpec.MaxInitCodeSize)) From b7bc70961c2a0c9e0d17d6d8addff6e1baa562f6 Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Thu, 15 Jun 2023 15:10:07 +0200 Subject: [PATCH 11/12] fix test --- .../ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index a3324d7d0cc..22831dc14af 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -213,7 +213,7 @@ public void Chiado_loads_properly() List forkActivationsToTest = new() { (ForkActivation)0, - (ForkActivation)(1, null), + (ForkActivation)(1, 20), (1, ChiadoSpecProvider.ShanghaiTimestamp - 1), (1, ChiadoSpecProvider.ShanghaiTimestamp), (999_999_999, 999_999_999) // far in the future From d392c463ce9f589546b2d85eb7e340ade110b1ef Mon Sep 17 00:00:00 2001 From: MarekM25 Date: Thu, 15 Jun 2023 15:18:03 +0200 Subject: [PATCH 12/12] whitespace --- .../ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 22831dc14af..0a388ca0ea2 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -298,7 +298,7 @@ private void VerifyGnosisPreShanghaiExceptions(ISpecProvider specProvider) .BeFalse(); specProvider.GetSpec((ForkActivation)GnosisSpecProvider.ConstantinopoleBlockNumber).IsEip1283Enabled.Should() .BeTrue(); - specProvider.GetSpec((ForkActivation)(GnosisSpecProvider.ConstantinopoleBlockNumber -1)).UseConstantinopleNetGasMetering.Should() + specProvider.GetSpec((ForkActivation)(GnosisSpecProvider.ConstantinopoleBlockNumber - 1)).UseConstantinopleNetGasMetering.Should() .BeFalse(); specProvider.GetSpec((ForkActivation)GnosisSpecProvider.ConstantinopoleBlockNumber).UseConstantinopleNetGasMetering.Should() .BeTrue(); @@ -412,6 +412,7 @@ private static void CompareSpecs(IReleaseSpec expectedSpec, IReleaseSpec actualS typeof(IReleaseSpec).GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo propertyInfo in propertyInfos .Where(p => p.Name != nameof(IReleaseSpec.Name)) + // handle mainnet specific exceptions .Where(p => isMainnet || p.Name != nameof(IReleaseSpec.MaximumExtraDataSize)) .Where(p => isMainnet || p.Name != nameof(IReleaseSpec.BlockReward)) @@ -419,10 +420,12 @@ private static void CompareSpecs(IReleaseSpec expectedSpec, IReleaseSpec actualS p.Name != nameof(IReleaseSpec.DifficultyBombDelay)) .Where(p => isMainnet || checkDifficultyBomb || p.Name != nameof(IReleaseSpec.DifficultyBoundDivisor)) + // handle RLP decoders .Where(p => p.Name != nameof(IReleaseSpec.Eip1559TransitionBlock)) .Where(p => p.Name != nameof(IReleaseSpec.WithdrawalTimestamp)) .Where(p => p.Name != nameof(IReleaseSpec.Eip4844TransitionTimestamp)) + // handle gnosis specific exceptions .Where(p => !isGnosis || p.Name != nameof(IReleaseSpec.MaxCodeSize)) .Where(p => !isGnosis || p.Name != nameof(IReleaseSpec.MaxInitCodeSize))