Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var (
utils.CachePreimagesFlag,
utils.OverridePassedForkTime,
utils.OverrideLorentz,
utils.OverrideMaxwell,
utils.OverrideVerkle,
utils.MultiDataBaseFlag,
}, utils.DatabaseFlags),
Expand Down Expand Up @@ -263,6 +264,10 @@ func initGenesis(ctx *cli.Context) error {
v := ctx.Uint64(utils.OverrideLorentz.Name)
overrides.OverrideLorentz = &v
}
if ctx.IsSet(utils.OverrideMaxwell.Name) {
v := ctx.Uint64(utils.OverrideMaxwell.Name)
overrides.OverrideMaxwell = &v
}
if ctx.IsSet(utils.OverrideVerkle.Name) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
overrides.OverrideVerkle = &v
Expand Down
4 changes: 4 additions & 0 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
v := ctx.Uint64(utils.OverrideLorentz.Name)
cfg.Eth.OverrideLorentz = &v
}
if ctx.IsSet(utils.OverrideMaxwell.Name) {
v := ctx.Uint64(utils.OverrideMaxwell.Name)
cfg.Eth.OverrideMaxwell = &v
}
if ctx.IsSet(utils.OverrideVerkle.Name) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
cfg.Eth.OverrideVerkle = &v
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ var (
utils.RialtoHash,
utils.OverridePassedForkTime,
utils.OverrideLorentz,
utils.OverrideMaxwell,
utils.OverrideVerkle,
utils.OverrideFullImmutabilityThreshold,
utils.OverrideMinBlocksForBlobRequests,
Expand Down
5 changes: 5 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ var (
Usage: "Manually specify the Lorentz fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideMaxwell = &cli.Uint64Flag{
Name: "override.maxwell",
Usage: "Manually specify the Maxwell fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideVerkle = &cli.Uint64Flag{
Name: "override.verkle",
Usage: "Manually specify the Verkle fork timestamp, overriding the bundled setting",
Expand Down
2 changes: 1 addition & 1 deletion consensus/misc/eip4844/eip4844.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func CalcExcessBlobGas(config *params.ChainConfig, parent *types.Header, headTim
func CalcBlobFee(config *params.ChainConfig, header *types.Header) *big.Int {
var frac uint64
switch config.LatestFork(header.Time) {
case forks.Lorentz, forks.Prague:
case forks.Maxwell, forks.Lorentz, forks.Prague:
frac = config.BlobScheduleConfig.Prague.UpdateFraction
case forks.Cancun:
frac = config.BlobScheduleConfig.Cancun.UpdateFraction
Expand Down
4 changes: 4 additions & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ func (e *GenesisMismatchError) Error() string {
type ChainOverrides struct {
OverridePassedForkTime *uint64
OverrideLorentz *uint64
OverrideMaxwell *uint64
OverrideVerkle *uint64
}

Expand All @@ -288,6 +289,9 @@ func (o *ChainOverrides) apply(cfg *params.ChainConfig) error {
if o.OverrideLorentz != nil {
cfg.LorentzTime = o.OverrideLorentz
}
if o.OverrideMaxwell != nil {
cfg.MaxwellTime = o.OverrideMaxwell
}
if o.OverrideVerkle != nil {
cfg.VerkleTime = o.OverrideVerkle
}
Expand Down
4 changes: 4 additions & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
chainConfig.LorentzTime = config.OverrideLorentz
overrides.OverrideLorentz = config.OverrideLorentz
}
if config.OverrideMaxwell != nil {
chainConfig.MaxwellTime = config.OverrideMaxwell
overrides.OverrideMaxwell = config.OverrideMaxwell
}
if config.OverrideVerkle != nil {
chainConfig.VerkleTime = config.OverrideVerkle
overrides.OverrideVerkle = config.OverrideVerkle
Expand Down
3 changes: 3 additions & 0 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ type Config struct {
// OverrideLorentz (TODO: remove after the fork)
OverrideLorentz *uint64 `toml:",omitempty"`

// OverrideMaxwell (TODO: remove after the fork)
OverrideMaxwell *uint64 `toml:",omitempty"`

// OverrideVerkle (TODO: remove after the fork)
OverrideVerkle *uint64 `toml:",omitempty"`

Expand Down
6 changes: 6 additions & 0 deletions eth/ethconfig/gen_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 34 additions & 3 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ var (
PascalTime: newUint64(1742436600), // 2025-03-20 02:10:00 AM UTC
PragueTime: newUint64(1742436600), // 2025-03-20 02:10:00 AM UTC
LorentzTime: newUint64(1745903100), // 2025-04-29 05:05:00 AM UTC
MaxwellTime: nil,

Parlia: &ParliaConfig{},
BlobScheduleConfig: &BlobScheduleConfig{
Expand Down Expand Up @@ -235,6 +236,7 @@ var (
PascalTime: newUint64(1740452880), // 2025-02-25 03:08:00 AM UTC
PragueTime: newUint64(1740452880), // 2025-02-25 03:08:00 AM UTC
LorentzTime: newUint64(1744097580), // 2025-04-08 07:33:00 AM UTC
MaxwellTime: nil,

Parlia: &ParliaConfig{},
BlobScheduleConfig: &BlobScheduleConfig{
Expand Down Expand Up @@ -282,6 +284,7 @@ var (
PragueTime: newUint64(0),
// TODO: set them to `0` when passed on the mainnet
LorentzTime: nil,
MaxwellTime: nil,

Parlia: &ParliaConfig{},
BlobScheduleConfig: &BlobScheduleConfig{
Expand Down Expand Up @@ -599,6 +602,7 @@ type ChainConfig struct {
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)
LorentzTime *uint64 `json:"lorentzTime,omitempty"` // Lorentz switch time (nil = no fork, 0 = already on lorentz)
MaxwellTime *uint64 `json:"maxwellTime,omitempty"` // Maxwell switch time (nil = no fork, 0 = already on maxwell)
VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)

// TerminalTotalDifficulty is the amount of total difficulty reached by
Expand Down Expand Up @@ -765,7 +769,12 @@ func (c *ChainConfig) String() string {
LorentzTime = big.NewInt(0).SetUint64(*c.LorentzTime)
}

return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Berlin: %v, YOLO v3: %v, CatalystBlock: %v, London: %v, ArrowGlacier: %v, MergeFork:%v, Euler: %v, Gibbs: %v, Nano: %v, Moran: %v, Planck: %v,Luban: %v, Plato: %v, Hertz: %v, Hertzfix: %v ShanghaiTime: %v, KeplerTime: %v, FeynmanTime: %v, FeynmanFixTime: %v, CancunTime: %v, HaberTime: %v, HaberFixTime: %v, BohrTime: %v, PascalTime: %v, PragueTime: %v, LorentzTime: %v, Engine: %v}",
var MaxwellTime *big.Int
if c.MaxwellTime != nil {
MaxwellTime = big.NewInt(0).SetUint64(*c.MaxwellTime)
}

return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Ramanujan: %v, Niels: %v, MirrorSync: %v, Bruno: %v, Berlin: %v, YOLO v3: %v, CatalystBlock: %v, London: %v, ArrowGlacier: %v, MergeFork:%v, Euler: %v, Gibbs: %v, Nano: %v, Moran: %v, Planck: %v,Luban: %v, Plato: %v, Hertz: %v, Hertzfix: %v ShanghaiTime: %v, KeplerTime: %v, FeynmanTime: %v, FeynmanFixTime: %v, CancunTime: %v, HaberTime: %v, HaberFixTime: %v, BohrTime: %v, PascalTime: %v, PragueTime: %v, LorentzTime: %v, MaxwellTime: %v, Engine: %v}",
c.ChainID,
c.HomesteadBlock,
c.DAOForkBlock,
Expand Down Expand Up @@ -808,6 +817,7 @@ func (c *ChainConfig) String() string {
PascalTime,
PragueTime,
LorentzTime,
MaxwellTime,
engine,
)
}
Expand Down Expand Up @@ -1164,6 +1174,20 @@ func (c *ChainConfig) IsOnLorentz(currentBlockNumber *big.Int, lastBlockTime uin
return !c.IsLorentz(lastBlockNumber, lastBlockTime) && c.IsLorentz(currentBlockNumber, currentBlockTime)
}

// IsMaxwell returns whether time is either equal to the Maxwell fork time or greater.
func (c *ChainConfig) IsMaxwell(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.MaxwellTime, time)
}

// IsOnMaxwell returns whether currentBlockTime is either equal to the Maxwell fork time or greater firstly.
func (c *ChainConfig) IsOnMaxwell(currentBlockNumber *big.Int, lastBlockTime uint64, currentBlockTime uint64) bool {
lastBlockNumber := new(big.Int)
if currentBlockNumber.Cmp(big.NewInt(1)) >= 0 {
lastBlockNumber.Sub(currentBlockNumber, big.NewInt(1))
}
return !c.IsMaxwell(lastBlockNumber, lastBlockTime) && c.IsMaxwell(currentBlockNumber, currentBlockTime)
}

// IsOsaka returns whether time is either equal to the Osaka fork time or greater.
func (c *ChainConfig) IsOsaka(num *big.Int, time uint64) bool {
return c.IsLondon(num) && isTimestampForked(c.OsakaTime, time)
Expand Down Expand Up @@ -1253,6 +1277,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
{name: "pragueTime", timestamp: c.PragueTime},
{name: "osakaTime", timestamp: c.OsakaTime, optional: true},
{name: "lorentzTime", timestamp: c.LorentzTime},
{name: "maxwellTime", timestamp: c.MaxwellTime},
{name: "verkleTime", timestamp: c.VerkleTime, optional: true},
} {
if lastFork.name != "" {
Expand Down Expand Up @@ -1459,6 +1484,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
if isForkTimestampIncompatible(c.LorentzTime, newcfg.LorentzTime, headTimestamp) {
return newTimestampCompatError("Lorentz fork timestamp", c.LorentzTime, newcfg.LorentzTime)
}
if isForkTimestampIncompatible(c.MaxwellTime, newcfg.MaxwellTime, headTimestamp) {
return newTimestampCompatError("Lorentz fork timestamp", c.MaxwellTime, newcfg.MaxwellTime)
}
if isForkTimestampIncompatible(c.VerkleTime, newcfg.VerkleTime, headTimestamp) {
return newTimestampCompatError("Verkle fork timestamp", c.VerkleTime, newcfg.VerkleTime)
}
Expand All @@ -1484,6 +1512,8 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
switch {
case c.IsOsaka(london, time):
return forks.Osaka
case c.IsMaxwell(london, time):
return forks.Maxwell
case c.IsLorentz(london, time):
return forks.Lorentz
case c.IsPrague(london, time):
Expand Down Expand Up @@ -1646,8 +1676,8 @@ type Rules struct {
IsHertz bool
IsHertzfix bool
IsShanghai, IsKepler, IsFeynman, IsCancun, IsHaber bool
IsBohr, IsPascal, IsPrague, IsLorentz, IsOsaka bool
IsVerkle bool
IsBohr, IsPascal, IsPrague, IsLorentz, IsMaxwell bool
IsOsaka, IsVerkle bool
}

// Rules ensures c's ChainID is not nil.
Expand Down Expand Up @@ -1690,6 +1720,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
IsPrague: c.IsPrague(num, timestamp),
IsOsaka: c.IsOsaka(num, timestamp),
IsLorentz: c.IsLorentz(num, timestamp),
IsMaxwell: c.IsMaxwell(num, timestamp),
IsVerkle: c.IsVerkle(num, timestamp),
IsEIP4762: isVerkle,
}
Expand Down
1 change: 1 addition & 0 deletions params/forks/forks.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ const (
Cancun
Prague
Lorentz
Maxwell
Osaka
)