Skip to content

Commit

Permalink
fix setting eth upgrades in genesis storedcfg (#1356)
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush authored Oct 7, 2024
1 parent ec41faa commit 1ac6d25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
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

0 comments on commit 1ac6d25

Please sign in to comment.