@@ -133,6 +133,7 @@ var (
133
133
ShanghaiTime : nil ,
134
134
CancunTime : nil ,
135
135
PragueTime : nil ,
136
+ OsakaTime : nil ,
136
137
VerkleTime : nil ,
137
138
Ethash : new (EthashConfig ),
138
139
Clique : nil ,
@@ -182,6 +183,7 @@ var (
182
183
ShanghaiTime : nil ,
183
184
CancunTime : nil ,
184
185
PragueTime : nil ,
186
+ OsakaTime : nil ,
185
187
VerkleTime : nil ,
186
188
TerminalTotalDifficulty : big .NewInt (math .MaxInt64 ),
187
189
Ethash : nil ,
@@ -211,6 +213,7 @@ var (
211
213
ShanghaiTime : nil ,
212
214
CancunTime : nil ,
213
215
PragueTime : nil ,
216
+ OsakaTime : nil ,
214
217
VerkleTime : nil ,
215
218
TerminalTotalDifficulty : big .NewInt (math .MaxInt64 ),
216
219
Ethash : new (EthashConfig ),
@@ -240,6 +243,7 @@ var (
240
243
ShanghaiTime : newUint64 (0 ),
241
244
CancunTime : newUint64 (0 ),
242
245
PragueTime : newUint64 (0 ),
246
+ OsakaTime : nil ,
243
247
VerkleTime : nil ,
244
248
TerminalTotalDifficulty : big .NewInt (0 ),
245
249
Ethash : new (EthashConfig ),
@@ -269,6 +273,7 @@ var (
269
273
ShanghaiTime : nil ,
270
274
CancunTime : nil ,
271
275
PragueTime : nil ,
276
+ OsakaTime : nil ,
272
277
VerkleTime : nil ,
273
278
TerminalTotalDifficulty : big .NewInt (math .MaxInt64 ),
274
279
Ethash : new (EthashConfig ),
@@ -318,6 +323,7 @@ type ChainConfig struct {
318
323
ShanghaiTime * uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai)
319
324
CancunTime * uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
320
325
PragueTime * uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
326
+ OsakaTime * uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka)
321
327
VerkleTime * uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
322
328
323
329
// TerminalTotalDifficulty is the amount of total difficulty reached by
@@ -432,6 +438,9 @@ func (c *ChainConfig) Description() string {
432
438
if c .PragueTime != nil {
433
439
banner += fmt .Sprintf (" - Prague: @%-10v\n " , * c .PragueTime )
434
440
}
441
+ if c .OsakaTime != nil {
442
+ banner += fmt .Sprintf (" - Osaka: @%-10v\n " , * c .OsakaTime )
443
+ }
435
444
if c .VerkleTime != nil {
436
445
banner += fmt .Sprintf (" - Verkle: @%-10v\n " , * c .VerkleTime )
437
446
}
@@ -533,6 +542,11 @@ func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool {
533
542
return c .IsLondon (num ) && isTimestampForked (c .PragueTime , time )
534
543
}
535
544
545
+ // IsOsaka returns whether time is either equal to the Osaka fork time or greater.
546
+ func (c * ChainConfig ) IsOsaka (num * big.Int , time uint64 ) bool {
547
+ return c .IsLondon (num ) && isTimestampForked (c .OsakaTime , time )
548
+ }
549
+
536
550
// IsVerkle returns whether time is either equal to the Verkle fork time or greater.
537
551
func (c * ChainConfig ) IsVerkle (num * big.Int , time uint64 ) bool {
538
552
return c .IsLondon (num ) && isTimestampForked (c .VerkleTime , time )
@@ -611,6 +625,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
611
625
{name : "shanghaiTime" , timestamp : c .ShanghaiTime },
612
626
{name : "cancunTime" , timestamp : c .CancunTime , optional : true },
613
627
{name : "pragueTime" , timestamp : c .PragueTime , optional : true },
628
+ {name : "osakaTime" , timestamp : c .OsakaTime , optional : true },
614
629
{name : "verkleTime" , timestamp : c .VerkleTime , optional : true },
615
630
} {
616
631
if lastFork .name != "" {
@@ -715,6 +730,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
715
730
if isForkTimestampIncompatible (c .PragueTime , newcfg .PragueTime , headTimestamp ) {
716
731
return newTimestampCompatError ("Prague fork timestamp" , c .PragueTime , newcfg .PragueTime )
717
732
}
733
+ if isForkTimestampIncompatible (c .OsakaTime , newcfg .OsakaTime , headTimestamp ) {
734
+ return newTimestampCompatError ("Osaka fork timestamp" , c .OsakaTime , newcfg .OsakaTime )
735
+ }
718
736
if isForkTimestampIncompatible (c .VerkleTime , newcfg .VerkleTime , headTimestamp ) {
719
737
return newTimestampCompatError ("Verkle fork timestamp" , c .VerkleTime , newcfg .VerkleTime )
720
738
}
@@ -737,6 +755,8 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
737
755
london := c .LondonBlock
738
756
739
757
switch {
758
+ case c .IsOsaka (london , time ):
759
+ return forks .Osaka
740
760
case c .IsPrague (london , time ):
741
761
return forks .Prague
742
762
case c .IsCancun (london , time ):
@@ -888,7 +908,7 @@ type Rules struct {
888
908
IsEIP2929 , IsEIP4762 bool
889
909
IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
890
910
IsBerlin , IsLondon bool
891
- IsMerge , IsShanghai , IsCancun , IsPrague bool
911
+ IsMerge , IsShanghai , IsCancun , IsPrague , IsOsaka bool
892
912
IsVerkle bool
893
913
}
894
914
@@ -918,6 +938,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
918
938
IsShanghai : isMerge && c .IsShanghai (num , timestamp ),
919
939
IsCancun : isMerge && c .IsCancun (num , timestamp ),
920
940
IsPrague : isMerge && c .IsPrague (num , timestamp ),
941
+ IsOsaka : isMerge && c .IsOsaka (num , timestamp ),
921
942
IsVerkle : isVerkle ,
922
943
IsEIP4762 : isVerkle ,
923
944
}
0 commit comments