@@ -22,7 +22,7 @@ namespace Nethermind.Specs.Test.ChainSpecStyle;
22
22
[ TestFixture ]
23
23
public class ChainSpecBasedSpecProviderTests
24
24
{
25
- private const ulong GnosisBlockTime = 5 ;
25
+ private const double GnosisBlockTime = 5 ;
26
26
27
27
[ TestCase ( 0 , null , false ) ]
28
28
[ TestCase ( 0 , 0ul , false ) ]
@@ -265,15 +265,14 @@ public void Gnosis_loads_properly()
265
265
266
266
VerifyGnosisPreShanghaiExceptions ( provider ) ;
267
267
268
- /* ToDo uncomment with Gnosis fork specified
269
268
IReleaseSpec ? preShanghaiSpec = provider . GetSpec ( ( GnosisSpecProvider . LondonBlockNumber + 1 ,
270
269
GnosisSpecProvider . ShanghaiTimestamp - 1 ) ) ;
271
270
IReleaseSpec ? postShanghaiSpec = provider . GetSpec ( ( GnosisSpecProvider . LondonBlockNumber + 1 ,
272
271
GnosisSpecProvider . ShanghaiTimestamp ) ) ;
273
272
274
- VerifyGnosisPreShanghaiExceptions (preShanghaiSpec, postShanghaiSpec);
273
+ VerifyGnosisShanghaiExceptions ( preShanghaiSpec , postShanghaiSpec ) ;
275
274
GetTransitionTimestamps ( chainSpec . Parameters ) . Should ( ) . AllSatisfy (
276
- t => ValidateSlotByTimestamp(t, GnosisSpecProvider.BeaconChainGenesisTimestamp, GnosisBlockTime).Should().BeTrue()); */
275
+ t => ValidateSlotByTimestamp ( t , GnosisSpecProvider . BeaconChainGenesisTimestamp , GnosisBlockTime ) . Should ( ) . BeTrue ( ) ) ;
277
276
}
278
277
279
278
private void VerifyGnosisShanghaiExceptions ( IReleaseSpec preShanghaiSpec , IReleaseSpec postShanghaiSpec )
@@ -830,6 +829,8 @@ private static IEnumerable<ulong> GetTransitionTimestamps(ChainParameters parame
830
829
/// <param name="genesisTimestamp">The network's genesis timestamp</param>
831
830
/// <param name="blockTime">The network's block time in seconds</param>
832
831
/// <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 ;
835
836
}
0 commit comments