@@ -66,8 +66,9 @@ pub enum SpecId {
66
66
ECOTONE = 21 ,
67
67
FJORD = 22 ,
68
68
GRANITE = 23 ,
69
- PRAGUE = 24 ,
70
- PRAGUE_EOF = 25 ,
69
+ HOLOCENE = 24 ,
70
+ PRAGUE = 25 ,
71
+ PRAGUE_EOF = 26 ,
71
72
#[ default]
72
73
LATEST = u8:: MAX ,
73
74
}
@@ -123,6 +124,8 @@ impl From<&str> for SpecId {
123
124
"Fjord" => SpecId :: FJORD ,
124
125
#[ cfg( feature = "optimism" ) ]
125
126
"Granite" => SpecId :: GRANITE ,
127
+ #[ cfg( feature = "optimism" ) ]
128
+ "Holocene" => SpecId :: HOLOCENE ,
126
129
_ => Self :: LATEST ,
127
130
}
128
131
}
@@ -163,6 +166,8 @@ impl From<SpecId> for &'static str {
163
166
SpecId :: FJORD => "Fjord" ,
164
167
#[ cfg( feature = "optimism" ) ]
165
168
SpecId :: GRANITE => "Granite" ,
169
+ #[ cfg( feature = "optimism" ) ]
170
+ SpecId :: HOLOCENE => "Holocene" ,
166
171
SpecId :: LATEST => "Latest" ,
167
172
}
168
173
}
@@ -226,6 +231,8 @@ spec!(ECOTONE, EcotoneSpec);
226
231
spec ! ( FJORD , FjordSpec ) ;
227
232
#[ cfg( feature = "optimism" ) ]
228
233
spec ! ( GRANITE , GraniteSpec ) ;
234
+ #[ cfg( feature = "optimism" ) ]
235
+ spec ! ( HOLOCENE , HoloceneSpec ) ;
229
236
230
237
#[ cfg( not( feature = "optimism" ) ) ]
231
238
#[ macro_export]
@@ -389,6 +396,10 @@ macro_rules! spec_to_generic {
389
396
use $crate:: GraniteSpec as SPEC ;
390
397
$e
391
398
}
399
+ $crate:: SpecId :: HOLOCENE => {
400
+ use $crate:: HoloceneSpec as SPEC ;
401
+ $e
402
+ }
392
403
}
393
404
} } ;
394
405
}
@@ -431,6 +442,8 @@ mod tests {
431
442
spec_to_generic ! ( FJORD , assert_eq!( SPEC :: SPEC_ID , FJORD ) ) ;
432
443
#[ cfg( feature = "optimism" ) ]
433
444
spec_to_generic ! ( GRANITE , assert_eq!( SPEC :: SPEC_ID , GRANITE ) ) ;
445
+ #[ cfg( feature = "optimism" ) ]
446
+ spec_to_generic ! ( HOLOCENE , assert_eq!( SPEC :: SPEC_ID , HOLOCENE ) ) ;
434
447
spec_to_generic ! ( PRAGUE , assert_eq!( SPEC :: SPEC_ID , PRAGUE ) ) ;
435
448
spec_to_generic ! ( PRAGUE_EOF , assert_eq!( SPEC :: SPEC_ID , PRAGUE_EOF ) ) ;
436
449
spec_to_generic ! ( LATEST , assert_eq!( SPEC :: SPEC_ID , LATEST ) ) ;
@@ -581,4 +594,26 @@ mod optimism_tests {
581
594
assert ! ( SpecId :: enabled( SpecId :: GRANITE , SpecId :: FJORD ) ) ;
582
595
assert ! ( SpecId :: enabled( SpecId :: GRANITE , SpecId :: GRANITE ) ) ;
583
596
}
597
+
598
+ #[ test]
599
+ fn test_holocene_post_merge_hardforks ( ) {
600
+ // from MERGE to HOLOCENE
601
+ for i in 15 ..=24 {
602
+ if let Some ( spec) = SpecId :: try_from_u8 ( i) {
603
+ assert ! ( HoloceneSpec :: enabled( spec) ) ;
604
+ }
605
+ }
606
+ assert ! ( !HoloceneSpec :: enabled( SpecId :: LATEST ) ) ;
607
+ }
608
+
609
+ #[ test]
610
+ fn test_holocene_post_merge_hardforks_spec_id ( ) {
611
+ // from MERGE to HOLOCENE
612
+ for i in 15 ..=24 {
613
+ if let Some ( spec) = SpecId :: try_from_u8 ( i) {
614
+ assert ! ( SpecId :: enabled( SpecId :: HOLOCENE , spec) ) ;
615
+ }
616
+ }
617
+ assert ! ( !SpecId :: enabled( SpecId :: HOLOCENE , SpecId :: LATEST ) ) ;
618
+ }
584
619
}
0 commit comments