From 53fe0f2e77a9c9bd4714bb9c733b19571c4e3915 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Wed, 24 Jul 2024 09:27:24 -0700 Subject: [PATCH] Enables cancun at EUpgrade --- params/config_extra.go | 7 +++++++ plugin/evm/vm.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/params/config_extra.go b/params/config_extra.go index 908878f72f..0e86411b19 100644 --- a/params/config_extra.go +++ b/params/config_extra.go @@ -129,3 +129,10 @@ func getUpgradeTime(networkID uint32, upgradeTimes map[uint32]time.Time) *uint64 // genesis. return utils.NewUint64(0) } + +// SetEVMUpgrades sets the mapped upgrades (Avalanche > EVM upgrades) for the chain config. +func (c *ChainConfig) SetEVMUpgrades() { + if c.EUpgradeTime != nil { + c.CancunTime = utils.NewUint64(*c.EUpgradeTime) + } +} diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 291722941c..d93a835bb5 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -490,6 +490,8 @@ func (vm *VM) Initialize( vm.chainID = g.Config.ChainID + g.Config.SetEVMUpgrades() + vm.ethConfig = ethconfig.NewDefaultConfig() vm.ethConfig.Genesis = g vm.ethConfig.NetworkId = vm.chainID.Uint64()