Skip to content

Commit

Permalink
Sepolia and Holesky Cancun spec and config (#6571)
Browse files Browse the repository at this point in the history
  • Loading branch information
smartprogrammer93 authored and kamilchodola committed Jan 22, 2024
1 parent 7c6dacd commit e64bee7
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 29 deletions.
5 changes: 5 additions & 0 deletions src/Nethermind/Chains/holesky.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
"eip3855TransitionTimestamp": "0x6516eac0",
"eip3860TransitionTimestamp": "0x6516eac0",
"eip4895TransitionTimestamp": "0x6516eac0",
"eip1153TransitionTimestamp": "0x65C36AC0",
"eip4788TransitionTimestamp": "0x65C36AC0",
"eip4844TransitionTimestamp": "0x65C36AC0",
"eip5656TransitionTimestamp": "0x65C36AC0",
"eip6780TransitionTimestamp": "0x65C36AC0",
"terminalTotalDifficulty": "0x0",
"gasLimitBoundDivisor": "0x400",
"maxCodeSize": "0x6000",
Expand Down
7 changes: 6 additions & 1 deletion src/Nethermind/Chains/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@
"eip4895TransitionTimestamp": "0x63FD7D60",
"eip3855TransitionTimestamp": "0x63FD7D60",
"eip3651TransitionTimestamp": "0x63FD7D60",
"eip3860TransitionTimestamp": "0x63FD7D60"
"eip3860TransitionTimestamp": "0x63FD7D60",
"eip1153TransitionTimestamp": "0x65B97D60",
"eip4788TransitionTimestamp": "0x65B97D60",
"eip4844TransitionTimestamp": "0x65B97D60",
"eip5656TransitionTimestamp": "0x65B97D60",
"eip6780TransitionTimestamp": "0x65B97D60"
},
"genesis": {
"seal": {
Expand Down
15 changes: 10 additions & 5 deletions src/Nethermind/Nethermind.Network.Test/ForkInfoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,22 @@ public void Fork_id_and_hash_as_expected_on_goerli(long head, ulong headTimestam

[TestCase(0, 0ul, "0xc61a6098", 1_696_000_704ul, "Unsynced")]
[TestCase(1, 1_696_000_703ul, "0xc61a6098", 1_696_000_704ul, "Last genesis spec block")]
[TestCase(2, 1_696_000_704ul, "0xfd4f016b", 0ul, "First Shanghai block")]
[TestCase(2, 1_696_000_704ul, "0xfd4f016b", 1_707_305_664ul, "First Shanghai block")]
[TestCase(3, 1_707_305_663ul, "0xfd4f016b", 1_707_305_664ul, "Future Shanghai timestamp")]
[TestCase(4, 1_707_305_664ul, "0x9b192ad0", 0ul, "First Cancun timestamp")]
[TestCase(5, 1_717_305_664ul, "0x9b192ad0", 0ul, "Future Cancun timestamp")]
public void Fork_id_and_hash_as_expected_on_holesky(long head, ulong headTimestamp, string forkHashHex, ulong next, string description)
{
Test(head, headTimestamp, KnownHashes.HoleskyGenesis, forkHashHex, next, description, HoleskySpecProvider.Instance, "holesky.json");
}

[TestCase(0, 0ul, "0xFE3366E7", 1735371ul, "Sepolia genesis")]
[TestCase(1735370, 0ul, "0xFE3366E7", 1735371ul, "Sepolia Last block before MergeForkIdTranstion")]
[TestCase(1735371, 0ul, "0xb96cbd13", 1677557088UL, "First block - Sepolia MergeForkIdTransition")]
[TestCase(1735372, 1677557088ul, "0xf7f9bc08", 0ul, "Shanghai")]
[TestCase(1735372, 2677557088ul, "0xf7f9bc08", 0ul, "Future Shanghai")]
[TestCase(1735370, 0ul, "0xFE3366E7", 1_735_371ul, "Sepolia Last block before MergeForkIdTranstion")]
[TestCase(1735371, 0ul, "0xb96cbd13", 1_677_557_088ul, "First block - Sepolia MergeForkIdTransition")]
[TestCase(1735372, 1_677_557_088ul, "0xf7f9bc08", 1_706_655_072ul, "Shanghai")]
[TestCase(1735372, 1_706_655_071ul, "0xf7f9bc08", 1_706_655_072ul, "Future Shanghai")]
[TestCase(1735373, 1_706_655_072ul, "0x88cf81d9", 0ul, "First Cancun timestamp")]
[TestCase(1735374, 1_716_655_072ul, "0x88cf81d9", 0ul, "Future Cancun timestamp")]
public void Fork_id_and_hash_as_expected_on_sepolia(long head, ulong headTimestamp, string forkHashHex, ulong next, string description)
{
Test(head, headTimestamp, KnownHashes.SepoliaGenesis, forkHashHex, next, description, SepoliaSpecProvider.Instance, "sepolia.json");
Expand Down
14 changes: 7 additions & 7 deletions src/Nethermind/Nethermind.Runner.Test/ConfigFilesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,13 @@ public void Network_diag_tracer_disabled_by_default(string configWildcard)
}

[TestCase("mainnet", 2048)]
[TestCase("holesky", 2048)]
[TestCase("holesky", 1024)]
[TestCase("sepolia", 1024)]
[TestCase("gnosis", 2048)]
[TestCase("poacore", 2048)]
[TestCase("energy", 2048)]
[TestCase("chiado", 2048)]
[TestCase("^mainnet ^holesky ^spaceneth ^volta ^energy ^poacore ^gnosis ^chiado", 1024)]
[TestCase("chiado", 1024)]
[TestCase("^mainnet ^spaceneth ^volta ^energy ^poacore ^gnosis ^chiado", 1024)]
[TestCase("spaceneth", 128)]
public void Tx_pool_defaults_are_correct(string configWildcard, int poolSize)
{
Expand Down Expand Up @@ -327,11 +328,10 @@ public void Basic_configs_are_as_expected(string configWildcard, bool isProducti
}

[TestCase("goerli", BlobsSupportMode.StorageWithReorgs)]
[TestCase("^goerli", BlobsSupportMode.Disabled)]
[TestCase("sepolia", BlobsSupportMode.Disabled)]
[TestCase("holesky", BlobsSupportMode.Disabled)]
[TestCase("sepolia", BlobsSupportMode.StorageWithReorgs)]
[TestCase("holesky", BlobsSupportMode.StorageWithReorgs)]
[TestCase("chiado", BlobsSupportMode.StorageWithReorgs)]
[TestCase("mainnet", BlobsSupportMode.Disabled)]
[TestCase("chiado", BlobsSupportMode.Disabled)]
[TestCase("gnosis", BlobsSupportMode.Disabled)]
public void Blob_txs_support_is_correct(string configWildcard, BlobsSupportMode blobsSupportMode)
{
Expand Down
6 changes: 5 additions & 1 deletion src/Nethermind/Nethermind.Runner/configs/chiado.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"BaseDbPath": "nethermind_db/chiado",
"LogFileName": "chiado.logs.txt"
},
"TxPool": {
"Size": 1024,
"BlobsSupport": "StorageWithReorgs"
},
"JsonRpc": {
"Enabled": true,
"Port": 8545,
Expand Down Expand Up @@ -40,4 +44,4 @@
16
]
}
}
}
8 changes: 6 additions & 2 deletions src/Nethermind/Nethermind.Runner/configs/chiado_archive.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
"Init": {
"MemoryHint": 768000000,
"ChainSpecPath": "chainspec/chiado.json",
"BaseDbPath": "nethermind_db/chiado_archive",
"BaseDbPath": "nethermind_db/chiado_archive",
"LogFileName": "chiado_archive.logs.txt"
},
"TxPool": {
"Size": 1024,
"BlobsSupport": "StorageWithReorgs"
},
"JsonRpc": {
"Enabled": true,
"Port": 8545,
Expand Down Expand Up @@ -44,6 +48,6 @@
"Mode": "None"
},
"Merge": {
"FinalTotalDifficulty": "231708131825107706987652208063906496124457284"
"FinalTotalDifficulty": "231708131825107706987652208063906496124457284"
}
}
4 changes: 4 additions & 0 deletions src/Nethermind/Nethermind.Runner/configs/holesky.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"BaseDbPath": "nethermind_db/holesky",
"LogFileName": "holesky.logs.txt"
},
"TxPool": {
"Size": 1024,
"BlobsSupport": "StorageWithReorgs"
},
"Sync": {
"FastSync": true,
"SnapSync": true,
Expand Down
4 changes: 4 additions & 0 deletions src/Nethermind/Nethermind.Runner/configs/holesky_archive.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"BaseDbPath": "nethermind_db/holesky_archive",
"LogFileName": "holesky_archive.logs.txt"
},
"TxPool": {
"Size": 1024,
"BlobsSupport": "StorageWithReorgs"
},
"Metrics": {
"NodeName": "Holesky Archive"
},
Expand Down
5 changes: 3 additions & 2 deletions src/Nethermind/Nethermind.Runner/configs/sepolia.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"MemoryHint": 1024000000
},
"TxPool": {
"Size": 1024
"Size": 1024,
"BlobsSupport": "StorageWithReorgs"
},
"Metrics": {
"NodeName": "Sepolia"
Expand Down Expand Up @@ -38,4 +39,4 @@
"Merge": {
"Enabled": true
}
}
}
3 changes: 2 additions & 1 deletion src/Nethermind/Nethermind.Runner/configs/sepolia_archive.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"MemoryHint": 1024000000
},
"TxPool": {
"Size": 1024
"Size": 1024,
"BlobsSupport": "StorageWithReorgs"
},
"Metrics": {
"NodeName": "Sepolia Archive"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ public static IEnumerable<TestCaseData> SepoliaActivations
yield return new TestCaseData((ForkActivation)(1735372, 3)) { TestName = "Low timestamp" };
yield return new TestCaseData((ForkActivation)(1735372, 1677557088)) { TestName = "1677557088" };
yield return new TestCaseData((ForkActivation)(1735372, 1677557087)) { TestName = "1677557087" };
yield return new TestCaseData(new ForkActivation(1735372, SepoliaSpecProvider.CancunTimestamp - 1)) { TestName = "Before Cancun" };
yield return new TestCaseData(new ForkActivation(1735372, SepoliaSpecProvider.CancunTimestamp)) { TestName = "Cancun" };
yield return new TestCaseData(new ForkActivation(1735372, SepoliaSpecProvider.CancunTimestamp + 100000000)) { TestName = "Future" };
}
}

Expand Down Expand Up @@ -155,8 +158,9 @@ public static IEnumerable<TestCaseData> HoleskyActivations
yield return new TestCaseData(new ForkActivation(0, HoleskySpecProvider.GenesisTimestamp)) { TestName = "Genesis" };
yield return new TestCaseData(new ForkActivation(1, HoleskySpecProvider.ShanghaiTimestamp)) { TestName = "Shanghai" };
yield return new TestCaseData(new ForkActivation(3, HoleskySpecProvider.ShanghaiTimestamp + 24)) { TestName = "Post Shanghai" };
//new ForkActivation(4, HoleskySpecProvider.CancunTimestamp),
//new ForkActivation(5, HoleskySpecProvider.CancunTimestamp + 12),
yield return new TestCaseData(new ForkActivation(4, HoleskySpecProvider.CancunTimestamp - 1)) { TestName = "Before Cancun" };
yield return new TestCaseData(new ForkActivation(5, HoleskySpecProvider.CancunTimestamp)) { TestName = "Cancun" };
yield return new TestCaseData(new ForkActivation(6, HoleskySpecProvider.CancunTimestamp + 100000000)) { TestName = "Future" };
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/Nethermind/Nethermind.Specs/HoleskySpecProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class HoleskySpecProvider : ISpecProvider
{
public const ulong GenesisTimestamp = 0x65156994;
public const ulong ShanghaiTimestamp = 0x6516eac0;
// public const ulong CancunTimestamp = 0x77359400;
public const ulong CancunTimestamp = 0x65C36AC0;

private HoleskySpecProvider() { }

Expand All @@ -21,8 +21,8 @@ public IReleaseSpec GetSpec(ForkActivation forkActivation)
return forkActivation.Timestamp switch
{
null or < ShanghaiTimestamp => GenesisSpec,
// < CancunTimestamp => Shanghai.Instance,
_ => Shanghai.Instance
< CancunTimestamp => Shanghai.Instance,
_ => Cancun.Instance
};
}

Expand All @@ -44,7 +44,7 @@ public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalD
public ForkActivation[] TransitionActivations { get; } =
{
(1, ShanghaiTimestamp),
// (2, CancunTimestamp)
(2, CancunTimestamp)
};

public static readonly HoleskySpecProvider Instance = new();
Expand Down
11 changes: 7 additions & 4 deletions src/Nethermind/Nethermind.Specs/SepoliaSpecProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ namespace Nethermind.Specs;
public class SepoliaSpecProvider : ISpecProvider
{
public const ulong BeaconChainGenesisTimestamp = 0x62b07d60;
public const ulong ShanghaiBlockTimestamp = 0x63fd7d60;
public const ulong ShanghaiTimestamp = 0x63fd7d60;
public const ulong CancunTimestamp = 0x65B97D60;

private SepoliaSpecProvider() { }

public IReleaseSpec GetSpec(ForkActivation forkActivation) =>
forkActivation switch
{
{ Timestamp: null } or { Timestamp: < ShanghaiBlockTimestamp } => London.Instance,
_ => Shanghai.Instance
{ Timestamp: null } or { Timestamp: < ShanghaiTimestamp } => London.Instance,
{ Timestamp: < CancunTimestamp } => Shanghai.Instance,
_ => Cancun.Instance
};

public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalDifficulty = null)
Expand All @@ -39,7 +41,8 @@ public void UpdateMergeTransitionInfo(long? blockNumber, UInt256? terminalTotalD
public ForkActivation[] TransitionActivations { get; } =
{
(ForkActivation)1735371,
(1735371, 1677557088)
(1735371, ShanghaiTimestamp),
(1735371, CancunTimestamp),
};

public static SepoliaSpecProvider Instance { get; } = new();
Expand Down

0 comments on commit e64bee7

Please sign in to comment.