config: fix default value for PascalTime and add OverridePascal (#2693)

This commit is contained in:
buddho 2024-09-09 11:03:58 +08:00 committed by Ethan
parent df4dc499c7
commit 5c72898a0b
10 changed files with 37 additions and 8 deletions

@ -64,6 +64,7 @@ var (
utils.CachePreimagesFlag,
utils.OverridePassedForkTime,
utils.OverrideBohr,
utils.OverridePascal,
utils.OverrideVerkle,
utils.MultiDataBaseFlag,
}, utils.DatabaseFlags),
@ -262,6 +263,10 @@ func initGenesis(ctx *cli.Context) error {
v := ctx.Uint64(utils.OverrideBohr.Name)
overrides.OverrideBohr = &v
}
if ctx.IsSet(utils.OverridePascal.Name) {
v := ctx.Uint64(utils.OverridePascal.Name)
overrides.OverridePascal = &v
}
if ctx.IsSet(utils.OverrideVerkle.Name) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
overrides.OverrideVerkle = &v

@ -195,6 +195,10 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
v := ctx.Uint64(utils.OverrideBohr.Name)
cfg.Eth.OverrideBohr = &v
}
if ctx.IsSet(utils.OverridePascal.Name) {
v := ctx.Uint64(utils.OverridePascal.Name)
cfg.Eth.OverridePascal = &v
}
if ctx.IsSet(utils.OverrideVerkle.Name) {
v := ctx.Uint64(utils.OverrideVerkle.Name)
cfg.Eth.OverrideVerkle = &v

@ -74,6 +74,7 @@ var (
utils.RialtoHash,
utils.OverridePassedForkTime,
utils.OverrideBohr,
utils.OverridePascal,
utils.OverrideVerkle,
utils.OverrideFullImmutabilityThreshold,
utils.OverrideMinBlocksForBlobRequests,

@ -310,7 +310,7 @@ var (
}
OverridePassedForkTime = &cli.Uint64Flag{
Name: "override.passedforktime",
Usage: "Manually specify the hard fork timestamp except the last one, overriding the bundled setting",
Usage: "Manually specify the hard fork timestamps which have passed on the mainnet, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideBohr = &cli.Uint64Flag{
@ -318,6 +318,11 @@ var (
Usage: "Manually specify the Bohr fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverridePascal = &cli.Uint64Flag{
Name: "override.pascal",
Usage: "Manually specify the Pascal 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",

@ -218,6 +218,7 @@ func (e *GenesisMismatchError) Error() string {
type ChainOverrides struct {
OverridePassedForkTime *uint64
OverrideBohr *uint64
OverridePascal *uint64
OverrideVerkle *uint64
}
@ -252,11 +253,13 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, g
config.CancunTime = overrides.OverridePassedForkTime
config.HaberTime = overrides.OverridePassedForkTime
config.HaberFixTime = overrides.OverridePassedForkTime
config.PascalTime = overrides.OverridePassedForkTime
}
if overrides != nil && overrides.OverrideBohr != nil {
config.BohrTime = overrides.OverrideBohr
}
if overrides != nil && overrides.OverridePascal != nil {
config.PascalTime = overrides.OverridePascal
}
if overrides != nil && overrides.OverrideVerkle != nil {
config.VerkleTime = overrides.OverrideVerkle
}

@ -1064,7 +1064,6 @@ func init() {
},
},
}
}
func UpgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, statedb vm.StateDB) {

@ -193,13 +193,16 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
chainConfig.CancunTime = config.OverridePassedForkTime
chainConfig.HaberTime = config.OverridePassedForkTime
chainConfig.HaberFixTime = config.OverridePassedForkTime
chainConfig.PascalTime = config.OverridePassedForkTime
overrides.OverridePassedForkTime = config.OverridePassedForkTime
}
if config.OverrideBohr != nil {
chainConfig.BohrTime = config.OverrideBohr
overrides.OverrideBohr = config.OverrideBohr
}
if config.OverridePascal != nil {
chainConfig.PascalTime = config.OverridePascal
overrides.OverridePascal = config.OverridePascal
}
if config.OverrideVerkle != nil {
chainConfig.VerkleTime = config.OverrideVerkle
overrides.OverrideVerkle = config.OverrideVerkle

@ -194,6 +194,9 @@ type Config struct {
// OverrideBohr (TODO: remove after the fork)
OverrideBohr *uint64 `toml:",omitempty"`
// OverridePascal (TODO: remove after the fork)
OverridePascal *uint64 `toml:",omitempty"`
// OverrideVerkle (TODO: remove after the fork)
OverrideVerkle *uint64 `toml:",omitempty"`

@ -70,8 +70,9 @@ func (c Config) MarshalTOML() (interface{}, error) {
RPCGasCap uint64
RPCEVMTimeout time.Duration
RPCTxFeeCap float64
OverridePassedForkTime *uint64 `toml:",omitempty"`
OverridePassedForkTime *uint64 `toml:",omitempty"`
OverrideBohr *uint64 `toml:",omitempty"`
OverridePascal *uint64 `toml:",omitempty"`
OverrideVerkle *uint64 `toml:",omitempty"`
BlobExtraReserve uint64
}
@ -131,6 +132,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.RPCTxFeeCap = c.RPCTxFeeCap
enc.OverridePassedForkTime = c.OverridePassedForkTime
enc.OverrideBohr = c.OverrideBohr
enc.OverridePascal = c.OverridePascal
enc.OverrideVerkle = c.OverrideVerkle
enc.BlobExtraReserve = c.BlobExtraReserve
return &enc, nil
@ -192,8 +194,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
RPCGasCap *uint64
RPCEVMTimeout *time.Duration
RPCTxFeeCap *float64
OverridePassedForkTime *uint64 `toml:",omitempty"`
OverridePassedForkTime *uint64 `toml:",omitempty"`
OverrideBohr *uint64 `toml:",omitempty"`
OverridePascal *uint64 `toml:",omitempty"`
OverrideVerkle *uint64 `toml:",omitempty"`
BlobExtraReserve *uint64
}
@ -366,6 +369,9 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec.OverrideBohr != nil {
c.OverrideBohr = dec.OverrideBohr
}
if dec.OverridePascal != nil {
c.OverridePascal = dec.OverridePascal
}
if dec.OverrideVerkle != nil {
c.OverrideVerkle = dec.OverrideVerkle
}

@ -156,7 +156,7 @@ var (
HaberFixTime: newUint64(1727316120), // 2024-09-26 02:02:00 AM UTC
BohrTime: newUint64(1727317200), // 2024-09-26 02:20:00 AM UTC
// TODO
PascalTime: newUint64(0),
PascalTime: nil,
Parlia: &ParliaConfig{
Period: 3,
@ -199,7 +199,7 @@ var (
HaberFixTime: newUint64(1719986788), // 2024-07-03 06:06:28 AM UTC
BohrTime: newUint64(1724116996), // 2024-08-20 01:23:16 AM UTC
// TODO
PascalTime: newUint64(0),
PascalTime: nil,
Parlia: &ParliaConfig{
Period: 3,