Skip to content

Commit

Permalink
params: add BerlinBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush committed Sep 10, 2024
1 parent 44db6c7 commit cd5adc9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 63 deletions.
1 change: 1 addition & 0 deletions core/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
80 changes: 18 additions & 62 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -111,7 +67,7 @@ var (
},
)

TestChainConfig = WithExtra(
TestPreSubnetEVMChainConfig = WithExtra(
&ChainConfig{
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
Expand All @@ -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),
Expand All @@ -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{},
},
Expand Down
5 changes: 4 additions & 1 deletion params/config_extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit cd5adc9

Please sign in to comment.