diff --git a/core/state_prefetcher.go b/core/state_prefetcher.go index 12e90998f2..5e616b29e5 100644 --- a/core/state_prefetcher.go +++ b/core/state_prefetcher.go @@ -59,7 +59,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c for i := 0; i < prefetchThread; i++ { go func() { newStatedb := statedb.CopyDoPrefetch() - if header.Number.Uint64() < 33968300 { + if !p.config.IsHertzfix(header.Number) { newStatedb.EnableWriteOnSharedStorage() } gaspool := new(GasPool).AddGas(block.GasLimit()) @@ -108,7 +108,7 @@ func (p *statePrefetcher) PrefetchMining(txs TransactionsByPriceAndNonce, header go func(startCh <-chan *types.Transaction, stopCh <-chan struct{}) { idx := 0 newStatedb := statedb.CopyDoPrefetch() - if header.Number.Uint64() < 33968300 { + if !p.config.IsHertzfix(header.Number) { newStatedb.EnableWriteOnSharedStorage() } gaspool := new(GasPool).AddGas(gasLimit) diff --git a/params/config.go b/params/config.go index fc1f40e6de..93a0b83c1d 100644 --- a/params/config.go +++ b/params/config.go @@ -165,10 +165,10 @@ var ( LubanBlock: big.NewInt(29020050), PlatoBlock: big.NewInt(30720096), // TODO modify blockNumber, make sure HertzBlock=BerlinBlock=LondonBlock to enable Berlin and London EIPs - BerlinBlock: big.NewInt(31302048), - LondonBlock: big.NewInt(31302048), - HertzBlock: big.NewInt(31302048), - + BerlinBlock: big.NewInt(31302048), + LondonBlock: big.NewInt(31302048), + HertzBlock: big.NewInt(31302048), + HertzfixBlock: big.NewInt(34140700), Parlia: &ParliaConfig{ Period: 3, Epoch: 200, @@ -201,9 +201,10 @@ var ( LubanBlock: big.NewInt(29295050), PlatoBlock: big.NewInt(29861024), // TODO modify blockNumber, make sure HertzBlock=BerlinBlock=LondonBlock to enable Berlin and London EIPs - BerlinBlock: big.NewInt(31103030), - LondonBlock: big.NewInt(31103030), - HertzBlock: big.NewInt(31103030), + BerlinBlock: big.NewInt(31103030), + LondonBlock: big.NewInt(31103030), + HertzBlock: big.NewInt(31103030), + HertzfixBlock: big.NewInt(35682300), Parlia: &ParliaConfig{ Period: 3, @@ -233,10 +234,11 @@ var ( PlanckBlock: nil, // TODO - LubanBlock: nil, - PlatoBlock: nil, - BerlinBlock: nil, - HertzBlock: nil, + LubanBlock: nil, + PlatoBlock: nil, + BerlinBlock: nil, + HertzBlock: nil, + HertzfixBlock: nil, Parlia: &ParliaConfig{ Period: 3, @@ -269,7 +271,7 @@ var ( BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), HertzBlock: big.NewInt(0), - + HertzfixBlock: big.NewInt(0), Parlia: &ParliaConfig{ Period: 3, Epoch: 200, @@ -483,7 +485,7 @@ type ChainConfig struct { LubanBlock *big.Int `json:"lubanBlock,omitempty" toml:",omitempty"` // lubanBlock switch block (nil = no fork, 0 = already activated) PlatoBlock *big.Int `json:"platoBlock,omitempty" toml:",omitempty"` // platoBlock switch block (nil = no fork, 0 = already activated) HertzBlock *big.Int `json:"hertzBlock,omitempty" toml:",omitempty"` // hertzBlock switch block (nil = no fork, 0 = already activated) - + HertzfixBlock *big.Int `json:"hertzfixBlock,omitempty" toml:",omitempty"` // hertzfixBlock switch block (nil = no fork, 0 = already activated) // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty" toml:",omitempty"` Clique *CliqueConfig `json:"clique,omitempty" toml:",omitempty"` @@ -540,7 +542,7 @@ func (c *ChainConfig) String() string { engine = "unknown" } - 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, Engine: %v}", + 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, Engine: %v}", c.ChainID, c.HomesteadBlock, c.DAOForkBlock, @@ -571,6 +573,7 @@ func (c *ChainConfig) String() string { c.LubanBlock, c.PlatoBlock, c.HertzBlock, + c.HertzfixBlock, engine, ) } @@ -690,6 +693,14 @@ func (c *ChainConfig) IsOnHertz(num *big.Int) bool { return configBlockEqual(c.HertzBlock, num) } +func (c *ChainConfig) IsHertzfix(num *big.Int) bool { + return isBlockForked(c.HertzfixBlock, num) +} + +func (c *ChainConfig) IsOnHertzfix(num *big.Int) bool { + return configBlockEqual(c.HertzfixBlock, num) +} + // IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater. func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool { return isBlockForked(c.MuirGlacierBlock, num) @@ -837,6 +848,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error { {name: "lubanBlock", block: c.LubanBlock}, {name: "platoBlock", block: c.PlatoBlock}, {name: "hertzBlock", block: c.HertzBlock}, + {name: "hertzfixBlock", block: c.HertzfixBlock}, {name: "shanghaiTime", timestamp: c.ShanghaiTime}, {name: "cancunTime", timestamp: c.CancunTime, optional: true}, {name: "pragueTime", timestamp: c.PragueTime, optional: true}, @@ -968,6 +980,9 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int, if isForkBlockIncompatible(c.HertzBlock, newcfg.HertzBlock, headNumber) { return newBlockCompatError("hertz fork block", c.HertzBlock, newcfg.HertzBlock) } + if isForkBlockIncompatible(c.HertzfixBlock, newcfg.HertzfixBlock, headNumber) { + return newBlockCompatError("hertzfix fork block", c.HertzfixBlock, newcfg.HertzfixBlock) + } if isForkTimestampIncompatible(c.ShanghaiTime, newcfg.ShanghaiTime, headTimestamp) { return newTimestampCompatError("Shanghai fork timestamp", c.ShanghaiTime, newcfg.ShanghaiTime) } @@ -1131,6 +1146,7 @@ type Rules struct { IsLuban bool IsPlato bool IsHertz bool + IsHertzfix bool IsShanghai, IsCancun, IsPrague bool IsVerkle bool } @@ -1160,6 +1176,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules IsLuban: c.IsLuban(num), IsPlato: c.IsPlato(num), IsHertz: c.IsHertz(num), + IsHertzfix: c.IsHertzfix(num), IsShanghai: c.IsShanghai(num, timestamp), IsCancun: c.IsCancun(num, timestamp), IsPrague: c.IsPrague(num, timestamp),