Skip to content

Commit e8ac1da

Browse files
rubokamilchodola
authored andcommitted
Add Gnosis Shanghai hard-fork timestamp (#5848)
1 parent 8f9172c commit e8ac1da

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

src/Nethermind/Chains/gnosis.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@
4141
}
4242
},
4343
"params": {
44+
"networkID": "100",
4445
"gasLimitBoundDivisor": "0x400",
4546
"maximumExtraDataSize": "0x20",
47+
"maxCodeSize": "0x6000",
48+
"maxCodeSizeTransitionTimestamp": "0x64c8edbc",
4649
"minGasLimit": "0x1388",
47-
"networkID": "100",
4850
"eip140Transition": "0x0",
4951
"eip211Transition": "0x0",
5052
"eip214Transition": "0x0",
@@ -68,6 +70,10 @@
6870
"eip3529Transition": 19040000,
6971
"eip3541Transition": 19040000,
7072
"eip1559Transition": 19040000,
73+
"eip3651TransitionTimestamp": "0x64c8edbc",
74+
"eip3855TransitionTimestamp": "0x64c8edbc",
75+
"eip3860TransitionTimestamp": "0x64c8edbc",
76+
"eip4895TransitionTimestamp": "0x64c8edbc",
7177
"eip1559BaseFeeMaxChangeDenominator": "0x8",
7278
"eip1559ElasticityMultiplier": "0x2",
7379
"eip1559BaseFeeInitialValue": "0x3b9aca00",

src/Nethermind/Nethermind.Network.Test/ForkInfoTests.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ public void Fork_id_and_hash_as_expected_on_sepolia(long head, ulong headTimesta
176176
[TestCase(16101499, 0ul, "0xb6e6cd81", 16101500ul, "Last POSDAO Activation block")]
177177
[TestCase(16101500, 0ul, "0x069a83d9", 19040000ul, "First Berlin block")]
178178
[TestCase(19039999, 0ul, "0x069a83d9", 19040000ul, "Last Berlin block")]
179-
[TestCase(19040000, 0ul, "0x018479d3", 0ul, "First London block")]
180-
[TestCase(21735000, 0ul, "0x018479d3", 0ul, "First GIP-31 block")]
179+
[TestCase(19040000, 0ul, "0x018479d3", GnosisSpecProvider.ShanghaiTimestamp, "First London block")]
180+
[TestCase(21735000, 0ul, "0x018479d3", GnosisSpecProvider.ShanghaiTimestamp, "First GIP-31 block")]
181+
[TestCase(31735000, GnosisSpecProvider.ShanghaiTimestamp, "0x2efe91ba", 0ul, "First Shanghai timestamp")]
182+
[TestCase(91735000, GnosisSpecProvider.ShanghaiTimestamp, "0x2efe91ba", 0ul, "Future Shanghai timestamp")]
181183
public void Fork_id_and_hash_as_expected_on_gnosis(long head, ulong headTimestamp, string forkHashHex, ulong next, string description)
182184
{
183185
ChainSpecLoader loader = new ChainSpecLoader(new EthereumJsonSerializer());

src/Nethermind/Nethermind.Specs.Test/ChainSpecStyle/ChainSpecBasedSpecProviderTests.cs

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace Nethermind.Specs.Test.ChainSpecStyle;
2222
[TestFixture]
2323
public class ChainSpecBasedSpecProviderTests
2424
{
25-
private const ulong GnosisBlockTime = 5;
25+
private const double GnosisBlockTime = 5;
2626

2727
[TestCase(0, null, false)]
2828
[TestCase(0, 0ul, false)]
@@ -265,15 +265,14 @@ public void Gnosis_loads_properly()
265265

266266
VerifyGnosisPreShanghaiExceptions(provider);
267267

268-
/* ToDo uncomment with Gnosis fork specified
269268
IReleaseSpec? preShanghaiSpec = provider.GetSpec((GnosisSpecProvider.LondonBlockNumber + 1,
270269
GnosisSpecProvider.ShanghaiTimestamp - 1));
271270
IReleaseSpec? postShanghaiSpec = provider.GetSpec((GnosisSpecProvider.LondonBlockNumber + 1,
272271
GnosisSpecProvider.ShanghaiTimestamp));
273272

274-
VerifyGnosisPreShanghaiExceptions(preShanghaiSpec, postShanghaiSpec);
273+
VerifyGnosisShanghaiExceptions(preShanghaiSpec, postShanghaiSpec);
275274
GetTransitionTimestamps(chainSpec.Parameters).Should().AllSatisfy(
276-
t => ValidateSlotByTimestamp(t, GnosisSpecProvider.BeaconChainGenesisTimestamp, GnosisBlockTime).Should().BeTrue()); */
275+
t => ValidateSlotByTimestamp(t, GnosisSpecProvider.BeaconChainGenesisTimestamp, GnosisBlockTime).Should().BeTrue());
277276
}
278277

279278
private void VerifyGnosisShanghaiExceptions(IReleaseSpec preShanghaiSpec, IReleaseSpec postShanghaiSpec)
@@ -830,6 +829,8 @@ private static IEnumerable<ulong> GetTransitionTimestamps(ChainParameters parame
830829
/// <param name="genesisTimestamp">The network's genesis timestamp</param>
831830
/// <param name="blockTime">The network's block time in seconds</param>
832831
/// <returns><c>true</c> if the timestamp is valid; otherwise, <c>false</c>.</returns>
833-
private static bool ValidateSlotByTimestamp(ulong timestamp, ulong genesisTimestamp, ulong blockTime = 12) =>
834-
timestamp > genesisTimestamp && (timestamp - genesisTimestamp) / blockTime % 0x2000 == 0;
832+
private static bool ValidateSlotByTimestamp(ulong timestamp, ulong genesisTimestamp, double blockTime = 12) =>
833+
timestamp > genesisTimestamp &&
834+
Math.Round((timestamp - genesisTimestamp) / blockTime) % 0x2000 == 0 &&
835+
Math.Ceiling((timestamp - genesisTimestamp) / blockTime) % 0x2000 == 0;
835836
}

src/Nethermind/Nethermind.Specs/GnosisSpecProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class GnosisSpecProvider : ISpecProvider
1616
public const long BerlinBlockNumber = 16_101_500;
1717
public const long LondonBlockNumber = 19_040_000;
1818
public const ulong BeaconChainGenesisTimestamp = 0x61b10dbc;
19-
public const ulong ShanghaiTimestamp = long.MaxValue;
19+
public const ulong ShanghaiTimestamp = 0x64c8edbc;
2020

2121
private GnosisSpecProvider() { }
2222

0 commit comments

Comments
 (0)