Skip to content

Commit

Permalink
Mainnet Shapella Configs (#5455)
Browse files Browse the repository at this point in the history
* added configs

* whitespace fix

* one more test

* fixed network tests

* fix one more test

* fix EVM test
  • Loading branch information
MarekM25 authored and kamilchodola committed Mar 21, 2023
1 parent 0255cdd commit 00d6918
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/Nethermind/Chains/foundation.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@
"eip3198Transition": "0xC5D488",
"eip3529Transition": "0xC5D488",
"eip3541Transition": "0xC5D488",
"eip3651TransitionTimestamp": "0x64373057",
"eip3855TransitionTimestamp": "0x64373057",
"eip3860TransitionTimestamp": "0x64373057",
"eip4895TransitionTimestamp": "0x64373057",
"terminalTotalDifficulty": "C70D808A128D7380000"
},
"genesis": {
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Evm.Test/InvalidOpcodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
10 changes: 6 additions & 4 deletions src/Nethermind/Nethermind.Network.Test/ForkInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
10 changes: 5 additions & 5 deletions src/Nethermind/Nethermind.Specs/MainNetSpecProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 00d6918

Please sign in to comment.