From 00d69184294caa75df931427d655d1836fe705e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Moraczy=C5=84ski?= Date: Mon, 20 Mar 2023 16:24:27 +0100 Subject: [PATCH] Mainnet Shapella Configs (#5455) * added configs * whitespace fix * one more test * fixed network tests * fix one more test * fix EVM test --- src/Nethermind/Chains/foundation.json | 4 ++++ .../Nethermind.Evm.Test/InvalidOpcodeTests.cs | 4 ++-- .../Nethermind.Network.Test/ForkInfoTests.cs | 10 ++++++---- .../ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs | 3 ++- .../ChainSpecStyle/ChainSpecLoaderTests.cs | 3 +-- src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs | 10 +++++----- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/Nethermind/Chains/foundation.json b/src/Nethermind/Chains/foundation.json index 663ec40d383..52080dde6ec 100644 --- a/src/Nethermind/Chains/foundation.json +++ b/src/Nethermind/Chains/foundation.json @@ -181,6 +181,10 @@ "eip3198Transition": "0xC5D488", "eip3529Transition": "0xC5D488", "eip3541Transition": "0xC5D488", + "eip3651TransitionTimestamp": "0x64373057", + "eip3855TransitionTimestamp": "0x64373057", + "eip3860TransitionTimestamp": "0x64373057", + "eip4895TransitionTimestamp": "0x64373057", "terminalTotalDifficulty": "C70D808A128D7380000" }, "genesis": { diff --git a/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs b/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs index 328849ec830..8765a3d90ac 100644 --- a/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs +++ b/src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs @@ -148,8 +148,8 @@ protected override ILogManager GetLogManager() [TestCase(MainnetSpecProvider.MuirGlacierBlockNumber)] [TestCase(MainnetSpecProvider.BerlinBlockNumber)] [TestCase(MainnetSpecProvider.LondonBlockNumber)] - [TestCase(MainnetSpecProvider.GrayGlacierBlockNumber, MainnetSpecProvider.ShanghaiBlockTimestamp)] - [TestCase(MainnetSpecProvider.GrayGlacierBlockNumber, MainnetSpecProvider.CancunBlockTimestamp)] + [TestCase(MainnetSpecProvider.GrayGlacierBlockNumber + 1, MainnetSpecProvider.ShanghaiBlockTimestamp)] + [TestCase(MainnetSpecProvider.GrayGlacierBlockNumber + 2, MainnetSpecProvider.CancunBlockTimestamp)] [TestCase(long.MaxValue, ulong.MaxValue)] public void Test(long blockNumber, ulong? timestamp = null) { diff --git a/src/Nethermind/Nethermind.Network.Test/ForkInfoTests.cs b/src/Nethermind/Nethermind.Network.Test/ForkInfoTests.cs index 184b034ce6e..1d73b14f66b 100644 --- a/src/Nethermind/Nethermind.Network.Test/ForkInfoTests.cs +++ b/src/Nethermind/Nethermind.Network.Test/ForkInfoTests.cs @@ -41,8 +41,10 @@ public class ForkInfoTests [TestCase(13_772_999, 0ul, "0xb715077d", 13_773_000ul, "Last London")] [TestCase(13_773_000, 0ul, "0x20c327fc", 15_050_000ul, "First Arrow Glacier")] [TestCase(15_049_999, 0ul, "0x20c327fc", 15_050_000ul, "Last Arrow Glacier")] - [TestCase(15_050_000, 0ul, "0xf0afd0e3", 0ul, "First Gray Glacier")] - [TestCase(20_000_000, 0ul, "0xf0afd0e3", 0ul, "Future Gray Glacier")] + [TestCase(15_050_000, 0ul, "0xf0afd0e3", 1681338455ul, "First Gray Glacier")] + [TestCase(15_051_000, 0ul, "0xf0afd0e3", 1681338455ul, "Future Gray Glacier")] + [TestCase(15_051_000, 1681338455ul, "0xdce96c2d", 0ul, "First Shanghai timestamp")] + [TestCase(15_051_000, 9981338455ul, "0xdce96c2d", 0ul, "Future Shanghai timestamp")] public void Fork_id_and_hash_as_expected(long head, ulong headTimestamp, string forkHashHex, ulong next, string description) { Test(head, headTimestamp, KnownHashes.MainnetGenesis, forkHashHex, next, description, MainnetSpecProvider.Instance, "foundation.json"); @@ -83,8 +85,8 @@ public void Fork_id_and_hash_as_expected_with_timestamps(long head, ulong headTi } [TestCase(15_050_000, 0ul, "0xf0afd0e3", 21_000_000ul, "First Gray Glacier")] - [TestCase(21_000_000, 0ul, "0x3f5fd195", 0ul, "First Merge Fork Id test")] - [TestCase(21_811_000, 0ul, "0x3f5fd195", 0ul, "Future Merge Fork Id test")] + [TestCase(21_000_000, 0ul, "0x3f5fd195", 1681338455UL, "First Merge Fork Id test")] + [TestCase(21_811_000, 0ul, "0x3f5fd195", 1681338455UL, "Future Merge Fork Id test")] public void Fork_id_and_hash_as_expected_with_merge_fork_id(long head, ulong headTimestamp, string forkHashHex, ulong next, string description) { ChainSpecLoader loader = new ChainSpecLoader(new EthereumJsonSerializer()); diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs index 4a6674ab725..c8972ee29da 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs @@ -293,7 +293,8 @@ public void Mainnet_loads_properly() (ForkActivation)MainnetSpecProvider.ArrowGlacierBlockNumber, (ForkActivation)(MainnetSpecProvider.GrayGlacierBlockNumber - 1), (ForkActivation)MainnetSpecProvider.GrayGlacierBlockNumber, - (ForkActivation)99_000_000, // far in the future + MainnetSpecProvider.ShanghaiActivation, + new ForkActivation(99_000_000, 99_681_338_455) // far in the future }; CompareSpecProviders(mainnet, provider, forkActivationsToTest); diff --git a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecLoaderTests.cs b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecLoaderTests.cs index bd601d75568..7e5b671fcd9 100644 --- a/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecLoaderTests.cs +++ b/src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecLoaderTests.cs @@ -286,8 +286,7 @@ public void Can_load_mainnet() chainSpec.LondonBlockNumber.Should().Be(MainnetSpecProvider.LondonBlockNumber); chainSpec.ArrowGlacierBlockNumber.Should().Be(MainnetSpecProvider.ArrowGlacierBlockNumber); chainSpec.GrayGlacierBlockNumber.Should().Be(MainnetSpecProvider.GrayGlacierBlockNumber); - //should be added one the timestamp for Shanghai is know and included in the chainspec for mainent. - //chainSpec.ShanghaiTimestamp.Should().Be(MainnetSpecProvider.ShanghaiBlockTimestamp); + chainSpec.ShanghaiTimestamp.Should().Be(MainnetSpecProvider.ShanghaiBlockTimestamp); } [Test] diff --git a/src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs b/src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs index 31b671b7883..d5bd95ecf3f 100644 --- a/src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs +++ b/src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs @@ -57,14 +57,14 @@ public IReleaseSpec GetSpec(ForkActivation forkActivation) => public const long LondonBlockNumber = 12_965_000; public const long ArrowGlacierBlockNumber = 13_773_000; public const long GrayGlacierBlockNumber = 15_050_000; - public const ulong ShanghaiBlockTimestamp = ulong.MaxValue - 4; + public const ulong ShanghaiBlockTimestamp = 1_681_338_455; public const ulong CancunBlockTimestamp = ulong.MaxValue - 3; public const ulong PragueBlockTimestamp = ulong.MaxValue - 2; public const ulong OsakaBlockTimestamp = ulong.MaxValue - 1; - public static ForkActivation ShanghaiActivation = (15_050_000, ShanghaiBlockTimestamp); - public static ForkActivation CancunActivation = (15_050_000, CancunBlockTimestamp); - public static ForkActivation PragueActivation = (15_050_000, PragueBlockTimestamp); - public static ForkActivation OsakaActivation = (15_050_000, OsakaBlockTimestamp); + public static ForkActivation ShanghaiActivation = (15_050_001, ShanghaiBlockTimestamp); + public static ForkActivation CancunActivation = (15_050_002, CancunBlockTimestamp); + public static ForkActivation PragueActivation = (15_050_003, PragueBlockTimestamp); + public static ForkActivation OsakaActivation = (15_050_004, OsakaBlockTimestamp); public ulong NetworkId => Core.BlockchainIds.Mainnet; public ulong ChainId => NetworkId;