@@ -448,16 +448,17 @@ type ChainConfig struct {
448
448
449
449
// Fork scheduling was switched from blocks to timestamps here
450
450
451
- ShanghaiTime * uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai)
452
- CancunTime * uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
453
- PragueTime * uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
454
- OsakaTime * uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka)
455
- VerkleTime * uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
456
- BPO1Time * uint64 `json:"bpo1Time,omitempty"` // BPO1 switch time (nil = no fork, 0 = already on bpo1)
457
- BPO2Time * uint64 `json:"bpo2Time,omitempty"` // BPO2 switch time (nil = no fork, 0 = already on bpo2)
458
- BPO3Time * uint64 `json:"bpo3Time,omitempty"` // BPO3 switch time (nil = no fork, 0 = already on bpo3)
459
- BPO4Time * uint64 `json:"bpo4Time,omitempty"` // BPO4 switch time (nil = no fork, 0 = already on bpo4)
460
- BPO5Time * uint64 `json:"bpo5Time,omitempty"` // BPO5 switch time (nil = no fork, 0 = already on bpo5)
451
+ ShanghaiTime * uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai)
452
+ CancunTime * uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
453
+ PragueTime * uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
454
+ OsakaTime * uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka)
455
+ BPO1Time * uint64 `json:"bpo1Time,omitempty"` // BPO1 switch time (nil = no fork, 0 = already on bpo1)
456
+ BPO2Time * uint64 `json:"bpo2Time,omitempty"` // BPO2 switch time (nil = no fork, 0 = already on bpo2)
457
+ BPO3Time * uint64 `json:"bpo3Time,omitempty"` // BPO3 switch time (nil = no fork, 0 = already on bpo3)
458
+ BPO4Time * uint64 `json:"bpo4Time,omitempty"` // BPO4 switch time (nil = no fork, 0 = already on bpo4)
459
+ BPO5Time * uint64 `json:"bpo5Time,omitempty"` // BPO5 switch time (nil = no fork, 0 = already on bpo5)
460
+ AmsterdamTime * uint64 `json:"amsterdamTime,omitempty"` // Amsterdam switch time (nil = no fork, 0 = already on amsterdam)
461
+ VerkleTime * uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
461
462
462
463
// TerminalTotalDifficulty is the amount of total difficulty reached by
463
464
// the network that triggers the consensus upgrade.
@@ -575,9 +576,6 @@ func (c *ChainConfig) Description() string {
575
576
if c .OsakaTime != nil {
576
577
banner += fmt .Sprintf (" - Osaka: @%-10v (https://ethereum.github.io/execution-specs/src/ethereum/forks/osaka/__init__.py.html)\n " , * c .OsakaTime )
577
578
}
578
- if c .VerkleTime != nil {
579
- banner += fmt .Sprintf (" - Verkle: @%-10v\n " , * c .VerkleTime )
580
- }
581
579
if c .BPO1Time != nil {
582
580
banner += fmt .Sprintf (" - BPO1: @%-10v\n " , * c .BPO1Time )
583
581
}
@@ -593,6 +591,12 @@ func (c *ChainConfig) Description() string {
593
591
if c .BPO5Time != nil {
594
592
banner += fmt .Sprintf (" - BPO5: @%-10v\n " , * c .BPO5Time )
595
593
}
594
+ if c .AmsterdamTime != nil {
595
+ banner += fmt .Sprintf (" - Amsterdam: @%-10v\n " , * c .AmsterdamTime )
596
+ }
597
+ if c .VerkleTime != nil {
598
+ banner += fmt .Sprintf (" - Verkle: @%-10v\n " , * c .VerkleTime )
599
+ }
596
600
return banner
597
601
}
598
602
@@ -605,15 +609,16 @@ type BlobConfig struct {
605
609
606
610
// BlobScheduleConfig determines target and max number of blobs allow per fork.
607
611
type BlobScheduleConfig struct {
608
- Cancun * BlobConfig `json:"cancun,omitempty"`
609
- Prague * BlobConfig `json:"prague,omitempty"`
610
- Osaka * BlobConfig `json:"osaka,omitempty"`
611
- Verkle * BlobConfig `json:"verkle,omitempty"`
612
- BPO1 * BlobConfig `json:"bpo1,omitempty"`
613
- BPO2 * BlobConfig `json:"bpo2,omitempty"`
614
- BPO3 * BlobConfig `json:"bpo3,omitempty"`
615
- BPO4 * BlobConfig `json:"bpo4,omitempty"`
616
- BPO5 * BlobConfig `json:"bpo5,omitempty"`
612
+ Cancun * BlobConfig `json:"cancun,omitempty"`
613
+ Prague * BlobConfig `json:"prague,omitempty"`
614
+ Osaka * BlobConfig `json:"osaka,omitempty"`
615
+ Verkle * BlobConfig `json:"verkle,omitempty"`
616
+ BPO1 * BlobConfig `json:"bpo1,omitempty"`
617
+ BPO2 * BlobConfig `json:"bpo2,omitempty"`
618
+ BPO3 * BlobConfig `json:"bpo3,omitempty"`
619
+ BPO4 * BlobConfig `json:"bpo4,omitempty"`
620
+ BPO5 * BlobConfig `json:"bpo5,omitempty"`
621
+ Amsterdam * BlobConfig `json:"amsterdam,omitempty"`
617
622
}
618
623
619
624
// IsHomestead returns whether num is either equal to the homestead block or greater.
@@ -726,11 +731,6 @@ func (c *ChainConfig) IsOsaka(num *big.Int, time uint64) bool {
726
731
return c .IsLondon (num ) && isTimestampForked (c .OsakaTime , time )
727
732
}
728
733
729
- // IsVerkle returns whether time is either equal to the Verkle fork time or greater.
730
- func (c * ChainConfig ) IsVerkle (num * big.Int , time uint64 ) bool {
731
- return c .IsLondon (num ) && isTimestampForked (c .VerkleTime , time )
732
- }
733
-
734
734
// IsBPO1 returns whether time is either equal to the BPO1 fork time or greater.
735
735
func (c * ChainConfig ) IsBPO1 (num * big.Int , time uint64 ) bool {
736
736
return c .IsLondon (num ) && isTimestampForked (c .BPO1Time , time )
@@ -756,6 +756,16 @@ func (c *ChainConfig) IsBPO5(num *big.Int, time uint64) bool {
756
756
return c .IsLondon (num ) && isTimestampForked (c .BPO5Time , time )
757
757
}
758
758
759
+ // IsAmsterdam returns whether time is either equal to the Amsterdam fork time or greater.
760
+ func (c * ChainConfig ) IsAmsterdam (num * big.Int , time uint64 ) bool {
761
+ return c .IsLondon (num ) && isTimestampForked (c .AmsterdamTime , time )
762
+ }
763
+
764
+ // IsVerkle returns whether time is either equal to the Verkle fork time or greater.
765
+ func (c * ChainConfig ) IsVerkle (num * big.Int , time uint64 ) bool {
766
+ return c .IsLondon (num ) && isTimestampForked (c .VerkleTime , time )
767
+ }
768
+
759
769
// IsVerkleGenesis checks whether the verkle fork is activated at the genesis block.
760
770
//
761
771
// Verkle mode is considered enabled if the verkle fork time is configured,
@@ -836,6 +846,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
836
846
{name : "bpo3" , timestamp : c .BPO3Time , optional : true },
837
847
{name : "bpo4" , timestamp : c .BPO4Time , optional : true },
838
848
{name : "bpo5" , timestamp : c .BPO5Time , optional : true },
849
+ {name : "amsterdam" , timestamp : c .AmsterdamTime , optional : true },
839
850
} {
840
851
if lastFork .name != "" {
841
852
switch {
@@ -890,6 +901,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
890
901
{name : "bpo3" , timestamp : c .BPO3Time , config : bsc .BPO3 },
891
902
{name : "bpo4" , timestamp : c .BPO4Time , config : bsc .BPO4 },
892
903
{name : "bpo5" , timestamp : c .BPO5Time , config : bsc .BPO5 },
904
+ {name : "amsterdam" , timestamp : c .AmsterdamTime , config : bsc .Amsterdam },
893
905
} {
894
906
if cur .config != nil {
895
907
if err := cur .config .validate (); err != nil {
@@ -1005,6 +1017,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
1005
1017
if isForkTimestampIncompatible (c .BPO5Time , newcfg .BPO5Time , headTimestamp ) {
1006
1018
return newTimestampCompatError ("BPO5 fork timestamp" , c .BPO5Time , newcfg .BPO5Time )
1007
1019
}
1020
+ if isForkTimestampIncompatible (c .AmsterdamTime , newcfg .AmsterdamTime , headTimestamp ) {
1021
+ return newTimestampCompatError ("Amsterdam fork timestamp" , c .AmsterdamTime , newcfg .AmsterdamTime )
1022
+ }
1008
1023
return nil
1009
1024
}
1010
1025
@@ -1024,6 +1039,8 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
1024
1039
london := c .LondonBlock
1025
1040
1026
1041
switch {
1042
+ case c .IsAmsterdam (london , time ):
1043
+ return forks .Amsterdam
1027
1044
case c .IsBPO5 (london , time ):
1028
1045
return forks .BPO5
1029
1046
case c .IsBPO4 (london , time ):
@@ -1259,7 +1276,7 @@ type Rules struct {
1259
1276
IsByzantium , IsConstantinople , IsPetersburg , IsIstanbul bool
1260
1277
IsBerlin , IsLondon bool
1261
1278
IsMerge , IsShanghai , IsCancun , IsPrague , IsOsaka bool
1262
- IsVerkle bool
1279
+ IsAmsterdam , IsVerkle bool
1263
1280
}
1264
1281
1265
1282
// Rules ensures c's ChainID is not nil.
@@ -1289,6 +1306,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
1289
1306
IsCancun : isMerge && c .IsCancun (num , timestamp ),
1290
1307
IsPrague : isMerge && c .IsPrague (num , timestamp ),
1291
1308
IsOsaka : isMerge && c .IsOsaka (num , timestamp ),
1309
+ IsAmsterdam : isMerge && c .IsAmsterdam (num , timestamp ),
1292
1310
IsVerkle : isVerkle ,
1293
1311
IsEIP4762 : isVerkle ,
1294
1312
}
0 commit comments