Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix setting eth upgrades in genesis storedcfg #1356

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix setting eth upgrades in genesis storedcfg
  • Loading branch information
darioush committed Oct 3, 2024
commit 52111d8e00d1eec9a30a5544c0c40a06e8f5f96c
1 change: 1 addition & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ func SetupGenesisBlock(
rawdb.WriteChainConfig(db, stored, newcfg)
return newcfg, stored, nil
}
storedcfg.SetEthUpgrades(storedcfg.NetworkUpgrades)
// Check config compatibility and write the config. Compatibility errors
// are returned to the caller unless we're already at block zero.
// we use last accepted block for cfg compatibility check. Note this allows
Expand Down
12 changes: 6 additions & 6 deletions params/config_extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ type AvalancheContext struct {

// SetEthUpgrades sets the mapped upgrades Avalanche > EVM upgrades) for the chain config.
func (c *ChainConfig) SetEthUpgrades(avalancheUpgrades NetworkUpgrades) {
if c.BerlinBlock == nil {
c.BerlinBlock = big.NewInt(0)
}
if c.LondonBlock == nil {
c.LondonBlock = big.NewInt(0)
}
if avalancheUpgrades.DurangoTimestamp != nil {
c.ShanghaiTime = utils.NewUint64(*avalancheUpgrades.DurangoTimestamp)
}
Expand Down Expand Up @@ -263,12 +269,6 @@ func (c *ChainConfig) SetNetworkUpgradeDefaults() {
if c.MuirGlacierBlock == nil {
c.MuirGlacierBlock = big.NewInt(0)
}
if c.BerlinBlock == nil {
c.BerlinBlock = big.NewInt(0)
}
if c.LondonBlock == nil {
c.LondonBlock = big.NewInt(0)
}

c.NetworkUpgrades.setDefaults(c.SnowCtx.NetworkUpgrades)
}
Expand Down
Loading