From 8ff3c35ea0124218a363dca578c06d283e28b9cb Mon Sep 17 00:00:00 2001 From: tak Date: Fri, 20 Dec 2024 13:30:38 +0900 Subject: [PATCH 1/2] apply similar changes as BSC to address not latest chain config loaded first place issue --- core/genesis.go | 28 +++++++++++----------------- params/config.go | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/core/genesis.go b/core/genesis.go index 558ea2fff..d10e7dd92 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -338,6 +338,10 @@ func LoadChainConfig(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, // chain config corresponds to the canonical chain. stored := rawdb.ReadCanonicalHash(db, 0) if stored != (common.Hash{}) { + builtInConf := params.GetBuiltInChainConfig(stored) + if builtInConf != nil { + return builtInConf, nil + } storedcfg := rawdb.ReadChainConfig(db, stored) if storedcfg != nil { return storedcfg, nil @@ -364,24 +368,14 @@ func LoadChainConfig(db ethdb.Database, genesis *Genesis) (*params.ChainConfig, } func (g *Genesis) configOrDefault(ghash common.Hash) *params.ChainConfig { - switch { - case g != nil: - return g.Config - case ghash == params.MainnetGenesisHash: - return params.MainnetChainConfig - case ghash == params.HoleskyGenesisHash: - return params.HoleskyChainConfig - case ghash == params.SepoliaGenesisHash: - return params.SepoliaChainConfig - case ghash == params.GoerliGenesisHash: - return params.GoerliChainConfig - case ghash == params.OasysMainnetGenesisHash: - return params.OasysMainnetChainConfig - case ghash == params.OasysTestnetGenesisHash: - return params.OasysTestnetChainConfig - default: - return params.AllEthashProtocolChanges + conf := params.GetBuiltInChainConfig(ghash) + if conf != nil { + return conf + } + if g != nil { + return g.Config // it could be a custom config for QA test, just return } + return params.AllEthashProtocolChanges } // IsVerkle indicates whether the state is already stored in a verkle diff --git a/params/config.go b/params/config.go index 24ced540b..c7bc675c0 100644 --- a/params/config.go +++ b/params/config.go @@ -356,6 +356,25 @@ var ( TestRules = TestChainConfig.Rules(new(big.Int), false, 0) ) +func GetBuiltInChainConfig(ghash common.Hash) *ChainConfig { + switch ghash { + case MainnetGenesisHash: + return MainnetChainConfig + case HoleskyGenesisHash: + return HoleskyChainConfig + case SepoliaGenesisHash: + return SepoliaChainConfig + case GoerliGenesisHash: + return GoerliChainConfig + case OasysMainnetGenesisHash: + return OasysMainnetChainConfig + case OasysTestnetGenesisHash: + return OasysTestnetChainConfig + default: + return nil + } +} + // NetworkNames are user friendly names to use in the chain spec banner. var NetworkNames = map[string]string{ MainnetChainConfig.ChainID.String(): "mainnet", From 6a430df989eeea1d9b2d212a1d936be17763ef62 Mon Sep 17 00:00:00 2001 From: tak Date: Fri, 20 Dec 2024 13:55:54 +0900 Subject: [PATCH 2/2] increment version to v1.7.3 --- params/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/params/version.go b/params/version.go index 0346fb86a..9e0292a15 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 7 // Minor version component of the current release - VersionPatch = 2 // Patch version component of the current release + VersionPatch = 3 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string )