From 01cab86a29ac05760293cf83c074b3d1fed5908b Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Sat, 20 Sep 2025 11:06:36 +0200 Subject: [PATCH 1/4] params: add amsterdam fork config --- params/config.go | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/params/config.go b/params/config.go index 42a2c61ab56..b0c17729a89 100644 --- a/params/config.go +++ b/params/config.go @@ -448,16 +448,17 @@ type ChainConfig struct { // Fork scheduling was switched from blocks to timestamps here - ShanghaiTime *uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai) - CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun) - PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague) - OsakaTime *uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka) - VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle) - BPO1Time *uint64 `json:"bpo1Time,omitempty"` // BPO1 switch time (nil = no fork, 0 = already on bpo1) - BPO2Time *uint64 `json:"bpo2Time,omitempty"` // BPO2 switch time (nil = no fork, 0 = already on bpo2) - BPO3Time *uint64 `json:"bpo3Time,omitempty"` // BPO3 switch time (nil = no fork, 0 = already on bpo3) - BPO4Time *uint64 `json:"bpo4Time,omitempty"` // BPO4 switch time (nil = no fork, 0 = already on bpo4) - BPO5Time *uint64 `json:"bpo5Time,omitempty"` // BPO5 switch time (nil = no fork, 0 = already on bpo5) + ShanghaiTime *uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai) + CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun) + PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague) + OsakaTime *uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka) + AmsterdamTime *uint64 `json:"amsterdamTime,omitempty"` // Amsterdam switch time (nil = no fork, 0 = already on amsterdam) + VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle) + BPO1Time *uint64 `json:"bpo1Time,omitempty"` // BPO1 switch time (nil = no fork, 0 = already on bpo1) + BPO2Time *uint64 `json:"bpo2Time,omitempty"` // BPO2 switch time (nil = no fork, 0 = already on bpo2) + BPO3Time *uint64 `json:"bpo3Time,omitempty"` // BPO3 switch time (nil = no fork, 0 = already on bpo3) + BPO4Time *uint64 `json:"bpo4Time,omitempty"` // BPO4 switch time (nil = no fork, 0 = already on bpo4) + BPO5Time *uint64 `json:"bpo5Time,omitempty"` // BPO5 switch time (nil = no fork, 0 = already on bpo5) // TerminalTotalDifficulty is the amount of total difficulty reached by // the network that triggers the consensus upgrade. @@ -726,6 +727,11 @@ func (c *ChainConfig) IsOsaka(num *big.Int, time uint64) bool { return c.IsLondon(num) && isTimestampForked(c.OsakaTime, time) } +// IsAmsterdam returns whether time is either equal to the Amsterdam fork time or greater. +func (c *ChainConfig) IsAmsterdam(num *big.Int, time uint64) bool { + return c.IsLondon(num) && isTimestampForked(c.AmsterdamTime, time) +} + // IsVerkle returns whether time is either equal to the Verkle fork time or greater. func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool { return c.IsLondon(num) && isTimestampForked(c.VerkleTime, time) @@ -1253,13 +1259,13 @@ func (err *ConfigCompatError) Error() string { // Rules is a one time interface meaning that it shouldn't be used in between transition // phases. type Rules struct { - ChainID *big.Int - IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool - IsEIP2929, IsEIP4762 bool - IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool - IsBerlin, IsLondon bool - IsMerge, IsShanghai, IsCancun, IsPrague, IsOsaka bool - IsVerkle bool + ChainID *big.Int + IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool + IsEIP2929, IsEIP4762 bool + IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool + IsBerlin, IsLondon bool + IsMerge, IsShanghai, IsCancun, IsPrague, IsOsaka, IsAmsterdam bool + IsVerkle bool } // Rules ensures c's ChainID is not nil. @@ -1289,6 +1295,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules IsCancun: isMerge && c.IsCancun(num, timestamp), IsPrague: isMerge && c.IsPrague(num, timestamp), IsOsaka: isMerge && c.IsOsaka(num, timestamp), + IsAmsterdam: isMerge && c.IsAmsterdam(num, timestamp), IsVerkle: isVerkle, IsEIP4762: isVerkle, } From 73b1092d301a8f5f5098ff7d7024a547d8241f50 Mon Sep 17 00:00:00 2001 From: lightclient Date: Fri, 26 Sep 2025 07:53:36 -0600 Subject: [PATCH 2/4] params/forks: add amsterdam to forks list --- params/forks/forks.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/params/forks/forks.go b/params/forks/forks.go index adb65c86241..641d59434b7 100644 --- a/params/forks/forks.go +++ b/params/forks/forks.go @@ -45,6 +45,7 @@ const ( BPO3 BPO4 BPO5 + Amsterdam ) // String implements fmt.Stringer. @@ -82,4 +83,5 @@ var forkToString = map[Fork]string{ BPO3: "BPO3", BPO4: "BPO4", BPO5: "BPO5", + Amsterdam: "Amsterdam", } From 1977f63b1a40e0f4a9a308e8832b052b13c7b42a Mon Sep 17 00:00:00 2001 From: lightclient Date: Fri, 26 Sep 2025 08:05:40 -0600 Subject: [PATCH 3/4] params/config: add amsterdam to config helpers --- params/config.go | 59 ++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/params/config.go b/params/config.go index b0c17729a89..b5884fac13f 100644 --- a/params/config.go +++ b/params/config.go @@ -452,13 +452,13 @@ type ChainConfig struct { CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun) PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague) OsakaTime *uint64 `json:"osakaTime,omitempty"` // Osaka switch time (nil = no fork, 0 = already on osaka) - AmsterdamTime *uint64 `json:"amsterdamTime,omitempty"` // Amsterdam switch time (nil = no fork, 0 = already on amsterdam) - VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle) BPO1Time *uint64 `json:"bpo1Time,omitempty"` // BPO1 switch time (nil = no fork, 0 = already on bpo1) BPO2Time *uint64 `json:"bpo2Time,omitempty"` // BPO2 switch time (nil = no fork, 0 = already on bpo2) BPO3Time *uint64 `json:"bpo3Time,omitempty"` // BPO3 switch time (nil = no fork, 0 = already on bpo3) BPO4Time *uint64 `json:"bpo4Time,omitempty"` // BPO4 switch time (nil = no fork, 0 = already on bpo4) BPO5Time *uint64 `json:"bpo5Time,omitempty"` // BPO5 switch time (nil = no fork, 0 = already on bpo5) + AmsterdamTime *uint64 `json:"amsterdamTime,omitempty"` // Amsterdam switch time (nil = no fork, 0 = already on amsterdam) + VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle) // TerminalTotalDifficulty is the amount of total difficulty reached by // the network that triggers the consensus upgrade. @@ -576,9 +576,6 @@ func (c *ChainConfig) Description() string { if c.OsakaTime != nil { banner += fmt.Sprintf(" - Osaka: @%-10v (https://ethereum.github.io/execution-specs/src/ethereum/forks/osaka/__init__.py.html)\n", *c.OsakaTime) } - if c.VerkleTime != nil { - banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime) - } if c.BPO1Time != nil { banner += fmt.Sprintf(" - BPO1: @%-10v\n", *c.BPO1Time) } @@ -594,6 +591,12 @@ func (c *ChainConfig) Description() string { if c.BPO5Time != nil { banner += fmt.Sprintf(" - BPO5: @%-10v\n", *c.BPO5Time) } + if c.AmsterdamTime != nil { + banner += fmt.Sprintf(" - Amsterdam: @%-10v\n", *c.AmsterdamTime) + } + if c.VerkleTime != nil { + banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime) + } return banner } @@ -606,15 +609,16 @@ type BlobConfig struct { // BlobScheduleConfig determines target and max number of blobs allow per fork. type BlobScheduleConfig struct { - Cancun *BlobConfig `json:"cancun,omitempty"` - Prague *BlobConfig `json:"prague,omitempty"` - Osaka *BlobConfig `json:"osaka,omitempty"` - Verkle *BlobConfig `json:"verkle,omitempty"` - BPO1 *BlobConfig `json:"bpo1,omitempty"` - BPO2 *BlobConfig `json:"bpo2,omitempty"` - BPO3 *BlobConfig `json:"bpo3,omitempty"` - BPO4 *BlobConfig `json:"bpo4,omitempty"` - BPO5 *BlobConfig `json:"bpo5,omitempty"` + Cancun *BlobConfig `json:"cancun,omitempty"` + Prague *BlobConfig `json:"prague,omitempty"` + Osaka *BlobConfig `json:"osaka,omitempty"` + Verkle *BlobConfig `json:"verkle,omitempty"` + BPO1 *BlobConfig `json:"bpo1,omitempty"` + BPO2 *BlobConfig `json:"bpo2,omitempty"` + BPO3 *BlobConfig `json:"bpo3,omitempty"` + BPO4 *BlobConfig `json:"bpo4,omitempty"` + BPO5 *BlobConfig `json:"bpo5,omitempty"` + Amsterdam *BlobConfig `json:"amsterdam,omitempty"` } // IsHomestead returns whether num is either equal to the homestead block or greater. @@ -727,16 +731,6 @@ func (c *ChainConfig) IsOsaka(num *big.Int, time uint64) bool { return c.IsLondon(num) && isTimestampForked(c.OsakaTime, time) } -// IsAmsterdam returns whether time is either equal to the Amsterdam fork time or greater. -func (c *ChainConfig) IsAmsterdam(num *big.Int, time uint64) bool { - return c.IsLondon(num) && isTimestampForked(c.AmsterdamTime, time) -} - -// IsVerkle returns whether time is either equal to the Verkle fork time or greater. -func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool { - return c.IsLondon(num) && isTimestampForked(c.VerkleTime, time) -} - // IsBPO1 returns whether time is either equal to the BPO1 fork time or greater. func (c *ChainConfig) IsBPO1(num *big.Int, time uint64) bool { return c.IsLondon(num) && isTimestampForked(c.BPO1Time, time) @@ -762,6 +756,16 @@ func (c *ChainConfig) IsBPO5(num *big.Int, time uint64) bool { return c.IsLondon(num) && isTimestampForked(c.BPO5Time, time) } +// IsAmsterdam returns whether time is either equal to the Amsterdam fork time or greater. +func (c *ChainConfig) IsAmsterdam(num *big.Int, time uint64) bool { + return c.IsLondon(num) && isTimestampForked(c.AmsterdamTime, time) +} + +// IsVerkle returns whether time is either equal to the Verkle fork time or greater. +func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool { + return c.IsLondon(num) && isTimestampForked(c.VerkleTime, time) +} + // IsVerkleGenesis checks whether the verkle fork is activated at the genesis block. // // Verkle mode is considered enabled if the verkle fork time is configured, @@ -842,6 +846,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { {name: "bpo3", timestamp: c.BPO3Time, optional: true}, {name: "bpo4", timestamp: c.BPO4Time, optional: true}, {name: "bpo5", timestamp: c.BPO5Time, optional: true}, + {name: "amsterdam", timestamp: c.AmsterdamTime, optional: true}, } { if lastFork.name != "" { switch { @@ -896,6 +901,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { {name: "bpo3", timestamp: c.BPO3Time, config: bsc.BPO3}, {name: "bpo4", timestamp: c.BPO4Time, config: bsc.BPO4}, {name: "bpo5", timestamp: c.BPO5Time, config: bsc.BPO5}, + {name: "amsterdam", timestamp: c.AmsterdamTime, config: bsc.Amsterdam}, } { if cur.config != nil { if err := cur.config.validate(); err != nil { @@ -1011,6 +1017,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, if isForkTimestampIncompatible(c.BPO5Time, newcfg.BPO5Time, headTimestamp) { return newTimestampCompatError("BPO5 fork timestamp", c.BPO5Time, newcfg.BPO5Time) } + if isForkTimestampIncompatible(c.AmsterdamTime, newcfg.AmsterdamTime, headTimestamp) { + return newTimestampCompatError("Amsterdam fork timestamp", c.AmsterdamTime, newcfg.AmsterdamTime) + } return nil } @@ -1030,6 +1039,8 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork { london := c.LondonBlock switch { + case c.IsAmsterdam(london, time): + return forks.Amsterdam case c.IsBPO5(london, time): return forks.BPO5 case c.IsBPO4(london, time): From d3cf179b3cc08211f9f93bb0a956f182186f4419 Mon Sep 17 00:00:00 2001 From: lightclient Date: Fri, 26 Sep 2025 15:37:57 -0600 Subject: [PATCH 4/4] params/config: fix spacing of Rules struct --- params/config.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/params/config.go b/params/config.go index b5884fac13f..0cf3198ff92 100644 --- a/params/config.go +++ b/params/config.go @@ -1270,13 +1270,13 @@ func (err *ConfigCompatError) Error() string { // Rules is a one time interface meaning that it shouldn't be used in between transition // phases. type Rules struct { - ChainID *big.Int - IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool - IsEIP2929, IsEIP4762 bool - IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool - IsBerlin, IsLondon bool - IsMerge, IsShanghai, IsCancun, IsPrague, IsOsaka, IsAmsterdam bool - IsVerkle bool + ChainID *big.Int + IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool + IsEIP2929, IsEIP4762 bool + IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool + IsBerlin, IsLondon bool + IsMerge, IsShanghai, IsCancun, IsPrague, IsOsaka bool + IsAmsterdam, IsVerkle bool } // Rules ensures c's ChainID is not nil.