diff --git a/core/genesis_test.go b/core/genesis_test.go index 9ec1692e20..63ee2f78df 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -367,6 +367,7 @@ func TestVerkleGenesisCommit(t *testing.T) { PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), + BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), ShanghaiTime: &verkleTime, CancunTime: &verkleTime, diff --git a/params/config.go b/params/config.go index 767990b2b4..46aaf28239 100644 --- a/params/config.go +++ b/params/config.go @@ -49,59 +49,15 @@ var ( &ChainConfig{ ChainID: DefaultChainID, - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(0), - PetersburgBlock: big.NewInt(0), - IstanbulBlock: big.NewInt(0), - MuirGlacierBlock: big.NewInt(0), - NetworkUpgrades: getDefaultNetworkUpgrades(upgrade.GetConfig(constants.MainnetID)), // This can be changed to correct network (local, test) via VM. - GenesisPrecompiles: Precompiles{}, - } - - TestChainConfig = &ChainConfig{ - AvalancheContext: AvalancheContext{utils.TestSnowContext()}, - ChainID: big.NewInt(1), - FeeConfig: DefaultFeeConfig, - AllowFeeRecipients: false, - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(0), - PetersburgBlock: big.NewInt(0), - IstanbulBlock: big.NewInt(0), - MuirGlacierBlock: big.NewInt(0), - LondonBlock: big.NewInt(0), - ShanghaiTime: utils.TimeToNewUint64(upgrade.GetConfig(constants.UnitTestID).DurangoTime), - CancunTime: utils.TimeToNewUint64(upgrade.GetConfig(constants.UnitTestID).EtnaTime), - NetworkUpgrades: getDefaultNetworkUpgrades(upgrade.GetConfig(constants.UnitTestID)), // This can be changed to correct network (local, test) via VM. - GenesisPrecompiles: Precompiles{}, - UpgradeConfig: UpgradeConfig{}, - } - - TestPreSubnetEVMChainConfig = &ChainConfig{ - AvalancheContext: AvalancheContext{utils.TestSnowContext()}, - ChainID: big.NewInt(1), - FeeConfig: DefaultFeeConfig, - AllowFeeRecipients: false, - HomesteadBlock: big.NewInt(0), - EIP150Block: big.NewInt(0), - EIP155Block: big.NewInt(0), - EIP158Block: big.NewInt(0), - ByzantiumBlock: big.NewInt(0), - ConstantinopleBlock: big.NewInt(0), - PetersburgBlock: big.NewInt(0), - IstanbulBlock: big.NewInt(0), - MuirGlacierBlock: big.NewInt(0), - NetworkUpgrades: NetworkUpgrades{ - SubnetEVMTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), - DurangoTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), - EtnaTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), + HomesteadBlock: big.NewInt(0), + EIP150Block: big.NewInt(0), + EIP155Block: big.NewInt(0), + EIP158Block: big.NewInt(0), + ByzantiumBlock: big.NewInt(0), + ConstantinopleBlock: big.NewInt(0), + PetersburgBlock: big.NewInt(0), + IstanbulBlock: big.NewInt(0), + MuirGlacierBlock: big.NewInt(0), }, &ChainConfigExtra{ FeeConfig: DefaultFeeConfig, @@ -111,7 +67,7 @@ var ( }, ) - TestChainConfig = WithExtra( + TestPreSubnetEVMChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), @@ -125,19 +81,22 @@ var ( MuirGlacierBlock: big.NewInt(0), BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), - CancunTime: utils.TimeToNewUint64(upgrade.GetConfig(constants.UnitTestID).EtnaTime), }, &ChainConfigExtra{ AvalancheContext: AvalancheContext{utils.TestSnowContext()}, FeeConfig: DefaultFeeConfig, AllowFeeRecipients: false, - NetworkUpgrades: getDefaultNetworkUpgrades(upgrade.GetConfig(constants.UnitTestID)), // This can be changed to correct network (local, test) via VM. + NetworkUpgrades: NetworkUpgrades{ + SubnetEVMTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), + DurangoTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), + EtnaTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), + }, GenesisPrecompiles: Precompiles{}, UpgradeConfig: UpgradeConfig{}, }, ) - TestPreSubnetEVMChainConfig = WithExtra( + TestChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), @@ -151,16 +110,13 @@ var ( MuirGlacierBlock: big.NewInt(0), BerlinBlock: big.NewInt(0), LondonBlock: big.NewInt(0), + CancunTime: utils.TimeToNewUint64(upgrade.GetConfig(constants.UnitTestID).EtnaTime), }, &ChainConfigExtra{ AvalancheContext: AvalancheContext{utils.TestSnowContext()}, FeeConfig: DefaultFeeConfig, AllowFeeRecipients: false, - NetworkUpgrades: NetworkUpgrades{ - SubnetEVMTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), - DurangoTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), - EtnaTimestamp: utils.TimeToNewUint64(upgrade.UnscheduledActivationTime), - }, + NetworkUpgrades: getDefaultNetworkUpgrades(upgrade.GetConfig(constants.UnitTestID)), // This can be changed to correct network (local, test) via VM. GenesisPrecompiles: Precompiles{}, UpgradeConfig: UpgradeConfig{}, }, diff --git a/params/config_extra.go b/params/config_extra.go index 00ae5abe33..f6879ba4d0 100644 --- a/params/config_extra.go +++ b/params/config_extra.go @@ -71,7 +71,7 @@ type AvalancheContext struct { } // SetEthUpgrades sets the mapped upgrades Avalanche > EVM upgrades) for the chain config. -func (c *ChainConfigExtra) SetEthUpgrades(avalancheUpgrades NetworkUpgrades) { +func SetEthUpgrades(c *ChainConfig, avalancheUpgrades NetworkUpgrades) { if avalancheUpgrades.DurangoTimestamp != nil { c.ShanghaiTime = utils.NewUint64(*avalancheUpgrades.DurangoTimestamp) } @@ -267,6 +267,9 @@ func SetNetworkUpgradeDefaults(c *ChainConfig) { 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) }