@@ -131,6 +131,8 @@ var (
131131 PetersburgBlock : big .NewInt (0 ),
132132 IstanbulBlock : big .NewInt (3_230_000 ),
133133 NeoBlock : big .NewInt (4_650_000 ),
134+ MergeBlock : nil ,
135+ OsakaTime : nil ,
134136 TerminalTotalDifficulty : nil ,
135137 TerminalTotalDifficultyPassed : false ,
136138 Cuckoo : new (CuckooConfig ),
@@ -151,6 +153,8 @@ var (
151153 PetersburgBlock : big .NewInt (0 ),
152154 IstanbulBlock : big .NewInt (0 ),
153155 NeoBlock : big .NewInt (5_000_000 ),
156+ MergeBlock : nil ,
157+ OsakaTime : nil ,
154158 TerminalTotalDifficulty : nil ,
155159 TerminalTotalDifficultyPassed : false ,
156160 Clique : & CliqueConfig {
@@ -174,6 +178,8 @@ var (
174178 PetersburgBlock : big .NewInt (0 ),
175179 IstanbulBlock : big .NewInt (0 ),
176180 NeoBlock : big .NewInt (0 ),
181+ MergeBlock : nil ,
182+ OsakaTime : nil ,
177183 TerminalTotalDifficulty : nil ,
178184 TerminalTotalDifficultyPassed : false ,
179185 Cuckoo : new (CuckooConfig ),
@@ -194,6 +200,8 @@ var (
194200 PetersburgBlock : big .NewInt (0 ),
195201 IstanbulBlock : big .NewInt (0 ),
196202 NeoBlock : big .NewInt (0 ),
203+ MergeBlock : nil ,
204+ OsakaTime : nil ,
197205 TerminalTotalDifficulty : nil ,
198206 TerminalTotalDifficultyPassed : false ,
199207 Clique : & CliqueConfig {
@@ -221,6 +229,8 @@ var (
221229 PetersburgBlock : big .NewInt (0 ),
222230 IstanbulBlock : nil ,
223231 NeoBlock : nil ,
232+ MergeBlock : nil ,
233+ OsakaTime : nil ,
224234 TerminalTotalDifficulty : nil ,
225235 TerminalTotalDifficultyPassed : false ,
226236 Cuckoo : new (CuckooConfig ),
@@ -231,9 +241,9 @@ var (
231241 //
232242 // This configuration is intentionally not using keyed fields to force anyone
233243 // adding flags to the config to also have to set these fields.
234- AllCliqueProtocolChanges = & ChainConfig {big .NewInt (1337 ), big .NewInt (0 ), nil , false , big .NewInt (0 ), common.Hash {}, big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), nil , nil , nil , nil , false , nil , & CliqueConfig {Period : 0 , Epoch : 30000 }}
244+ AllCliqueProtocolChanges = & ChainConfig {big .NewInt (1337 ), big .NewInt (0 ), nil , false , big .NewInt (0 ), common.Hash {}, big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), nil , nil , nil , nil , nil , nil , false , nil , & CliqueConfig {Period : 0 , Epoch : 30000 }}
235245
236- TestChainConfig = & ChainConfig {big .NewInt (1 ), big .NewInt (0 ), nil , false , big .NewInt (0 ), common.Hash {}, big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), nil , nil , nil , nil , false , new (CuckooConfig ), nil }
246+ TestChainConfig = & ChainConfig {big .NewInt (1 ), big .NewInt (0 ), nil , false , big .NewInt (0 ), common.Hash {}, big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), big .NewInt (0 ), nil , nil , nil , nil , nil , nil , false , new (CuckooConfig ), nil }
237247 TestRules = TestChainConfig .Rules (new (big.Int ), false , 0 )
238248)
239249
@@ -269,6 +279,8 @@ type ChainConfig struct {
269279 PetersburgBlock * big.Int `json:"petersburgBlock,omitempty"` // Petersburg switch block (nil = same as Constantinople)
270280 IstanbulBlock * big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul)
271281 NeoBlock * big.Int `json:"neoBlock,omitempty"`
282+ MergeBlock * big.Int `json:"mergeBlock,omitempty"`
283+ OsakaTime * uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka)
272284 // TerminalTotalDifficulty is the amount of total difficulty reached by
273285 // the network that triggers the consensus upgrade.
274286 TerminalTotalDifficulty * big.Int `json:"terminalTotalDifficulty,omitempty"`
@@ -378,6 +390,10 @@ func (c *ChainConfig) IsNeo(num *big.Int) bool {
378390 return isForked (c .NeoBlock , num )
379391}
380392
393+ func (c * ChainConfig ) IsMerge (num * big.Int ) bool {
394+ return isForked (c .MergeBlock , num )
395+ }
396+
381397// IsTerminalPoWBlock returns whether the given block is the last block of PoW stage.
382398func (c * ChainConfig ) IsTerminalPoWBlock (parentTotalDiff * big.Int , totalDiff * big.Int ) bool {
383399 if c .TerminalTotalDifficulty == nil {
@@ -625,7 +641,7 @@ type Rules struct {
625641 ChainID * big.Int
626642 IsHomestead , IsEIP150 , IsEIP155 , IsEIP158 bool
627643 IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul , IsNeo bool
628- IsMerge bool
644+ IsMerge , IsOsaka bool
629645}
630646
631647// Rules ensures c's ChainID is not nil.
@@ -634,7 +650,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
634650 if chainID == nil {
635651 chainID = new (big.Int )
636652 }
637- return Rules {ChainID : new (big.Int ).Set (chainID ), IsHomestead : c .IsHomestead (num ), IsEIP150 : c .IsEIP150 (num ), IsEIP155 : c .IsEIP155 (num ), IsEIP158 : c .IsEIP158 (num ), IsByzantium : c .IsByzantium (num ), IsPetersburg : c .IsPetersburg (num ), IsIstanbul : c .IsIstanbul (num ), IsNeo : c .IsNeo (num ), IsMerge : isMerge }
653+ return Rules {ChainID : new (big.Int ).Set (chainID ), IsHomestead : c .IsHomestead (num ), IsEIP150 : c .IsEIP150 (num ), IsEIP155 : c .IsEIP155 (num ), IsEIP158 : c .IsEIP158 (num ), IsByzantium : c .IsByzantium (num ), IsPetersburg : c .IsPetersburg (num ), IsIstanbul : c .IsIstanbul (num ), IsNeo : c .IsNeo (num ), IsMerge : isMerge , IsOsaka : isMerge && c . IsOsaka ( num , timestamp ) }
638654}
639655
640656// Get Mature Block
@@ -648,6 +664,11 @@ func (c *ChainConfig) GetMatureBlock() int64 {
648664 return MatureBlks
649665}
650666
667+ // IsOsaka returns whether time is either equal to the Osaka fork time or greater.
668+ func (c * ChainConfig ) IsOsaka (num * big.Int , time uint64 ) bool {
669+ return c .IsMerge (num ) && isTimestampForked (c .OsakaTime , time )
670+ }
671+
651672// Get Block uploading quota
652673func (c * ChainConfig ) GetBlockQuota (num * big.Int ) uint64 {
653674 if c .ChainID .Uint64 () == 42 {
0 commit comments