@@ -133,6 +133,7 @@ var (
133133 ShanghaiTime : nil ,
134134 CancunTime : nil ,
135135 PragueTime : nil ,
136+ OsakaTime : nil ,
136137 VerkleTime : nil ,
137138 Ethash : new (EthashConfig ),
138139 Clique : nil ,
@@ -182,6 +183,7 @@ var (
182183 ShanghaiTime : nil ,
183184 CancunTime : nil ,
184185 PragueTime : nil ,
186+ OsakaTime : nil ,
185187 VerkleTime : nil ,
186188 TerminalTotalDifficulty : big .NewInt (math .MaxInt64 ),
187189 Ethash : nil ,
@@ -211,6 +213,7 @@ var (
211213 ShanghaiTime : nil ,
212214 CancunTime : nil ,
213215 PragueTime : nil ,
216+ OsakaTime : nil ,
214217 VerkleTime : nil ,
215218 TerminalTotalDifficulty : big .NewInt (math .MaxInt64 ),
216219 Ethash : new (EthashConfig ),
@@ -240,6 +243,7 @@ var (
240243 ShanghaiTime : newUint64 (0 ),
241244 CancunTime : newUint64 (0 ),
242245 PragueTime : newUint64 (0 ),
246+ OsakaTime : nil ,
243247 VerkleTime : nil ,
244248 TerminalTotalDifficulty : big .NewInt (0 ),
245249 Ethash : new (EthashConfig ),
@@ -269,6 +273,7 @@ var (
269273 ShanghaiTime : nil ,
270274 CancunTime : nil ,
271275 PragueTime : nil ,
276+ OsakaTime : nil ,
272277 VerkleTime : nil ,
273278 TerminalTotalDifficulty : big .NewInt (math .MaxInt64 ),
274279 Ethash : new (EthashConfig ),
@@ -321,6 +326,7 @@ type ChainConfig struct {
321326 NeoXEthSigBlock * big.Int `json:"neoXEthSigBlock,omitempty"` // Block-based switch to fix block signature from NeoXAMEVBlock (nil = no fork, 0 = already activated)
322327 CancunTime * uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
323328 PragueTime * uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
329+ OsakaTime * uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka)
324330 VerkleTime * uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
325331
326332 // TerminalTotalDifficulty is the amount of total difficulty reached by
@@ -459,6 +465,9 @@ func (c *ChainConfig) Description() string {
459465 if c .PragueTime != nil {
460466 banner += fmt .Sprintf (" - Prague: @%-10v\n " , * c .PragueTime )
461467 }
468+ if c .OsakaTime != nil {
469+ banner += fmt .Sprintf (" - Osaka: @%-10v\n " , * c .OsakaTime )
470+ }
462471 if c .VerkleTime != nil {
463472 banner += fmt .Sprintf (" - Verkle: @%-10v\n " , * c .VerkleTime )
464473 }
@@ -575,6 +584,11 @@ func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool {
575584 return c .IsLondon (num ) && isTimestampForked (c .PragueTime , time )
576585}
577586
587+ // IsOsaka returns whether time is either equal to the Osaka fork time or greater.
588+ func (c * ChainConfig ) IsOsaka (num * big.Int , time uint64 ) bool {
589+ return c .IsLondon (num ) && isTimestampForked (c .OsakaTime , time )
590+ }
591+
578592// IsVerkle returns whether time is either equal to the Verkle fork time or greater.
579593func (c * ChainConfig ) IsVerkle (num * big.Int , time uint64 ) bool {
580594 return c .IsLondon (num ) && isTimestampForked (c .VerkleTime , time )
@@ -656,6 +670,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
656670 {name : "neoXEthSigBlock" , block : c .NeoXEthSigBlock , optional : true },
657671 {name : "cancunTime" , timestamp : c .CancunTime , optional : true },
658672 {name : "pragueTime" , timestamp : c .PragueTime , optional : true },
673+ {name : "osakaTime" , timestamp : c .OsakaTime , optional : true },
659674 {name : "verkleTime" , timestamp : c .VerkleTime , optional : true },
660675 } {
661676 if lastFork .name != "" {
@@ -769,6 +784,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
769784 if isForkTimestampIncompatible (c .PragueTime , newcfg .PragueTime , headTimestamp ) {
770785 return newTimestampCompatError ("Prague fork timestamp" , c .PragueTime , newcfg .PragueTime )
771786 }
787+ if isForkTimestampIncompatible (c .OsakaTime , newcfg .OsakaTime , headTimestamp ) {
788+ return newTimestampCompatError ("Osaka fork timestamp" , c .OsakaTime , newcfg .OsakaTime )
789+ }
772790 if isForkTimestampIncompatible (c .VerkleTime , newcfg .VerkleTime , headTimestamp ) {
773791 return newTimestampCompatError ("Verkle fork timestamp" , c .VerkleTime , newcfg .VerkleTime )
774792 }
@@ -815,6 +833,8 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
815833 london := c .LondonBlock
816834
817835 switch {
836+ case c .IsOsaka (london , time ):
837+ return forks .Osaka
818838 case c .IsPrague (london , time ):
819839 return forks .Prague
820840 case c .IsCancun (london , time ):
@@ -961,13 +981,13 @@ func (err *ConfigCompatError) Error() string {
961981// Rules is a one time interface meaning that it shouldn't be used in between transition
962982// phases.
963983type Rules struct {
964- ChainID * big.Int
965- IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
966- IsEIP2929 , IsEIP4762 bool
967- IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
968- IsBerlin , IsLondon bool
969- IsMerge , IsShanghai , IsNeoXDKG , IsCancun , IsPrague bool
970- IsVerkle bool
984+ ChainID * big.Int
985+ IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
986+ IsEIP2929 , IsEIP4762 bool
987+ IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
988+ IsBerlin , IsLondon bool
989+ IsMerge , IsShanghai , IsNeoXDKG , IsCancun , IsPrague , IsOsaka bool
990+ IsVerkle bool
971991}
972992
973993// Rules ensures c's ChainID is not nil.
@@ -995,6 +1015,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
9951015 IsNeoXDKG : c .IsNeoXDKG (num ),
9961016 IsCancun : c .IsCancun (num , timestamp ),
9971017 IsPrague : c .IsPrague (num , timestamp ),
1018+ IsOsaka : c .IsOsaka (num , timestamp ),
9981019 IsVerkle : isVerkle ,
9991020 IsEIP4762 : isVerkle ,
10001021 }
0 commit comments