aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--params/config.go11
-rw-r--r--plugin/evm/vm.go8
2 files changed, 13 insertions, 6 deletions
diff --git a/params/config.go b/params/config.go
index d5db94f..a0b4a51 100644
--- a/params/config.go
+++ b/params/config.go
@@ -53,6 +53,7 @@ var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{
GoerliGenesisHash: GoerliCheckpointOracle,
}
+// Avalanche ChainIDs
var (
// AvalancheMainnetChainID ...
AvalancheMainnetChainID = big.NewInt(43114)
@@ -60,6 +61,12 @@ var (
AvalancheFujiChainID = big.NewInt(43113)
)
+// Network upgrade block timestamps
+var (
+ AvalancheMainnetApricotTimestamp = new(big.Int).SetUint64(uint64(time.Date(2021, 1, 7, 5, 00, 0, 0, time.UTC).Unix()))
+ AvalancheFujiApricotTimestamp = new(big.Int).SetUint64(uint64(time.Date(2020, 12, 23, 5, 00, 0, 0, time.UTC).Unix()))
+)
+
var (
// AvalancheApricotMainnetChainConfig is the configuration for Avalanche Main Network
AvalancheApricotMainnetChainConfig = &ChainConfig{
@@ -75,7 +82,7 @@ var (
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
- ApricotBlockTimestamp: new(big.Int).SetUint64(uint64(time.Date(2021, 1, 7, 5, 00, 0, 0, time.UTC).Unix())),
+ ApricotBlockTimestamp: AvalancheMainnetApricotTimestamp,
}
// AvalancheApricotFujiChainConfig is the configuration for the Fuji Test Network
@@ -92,7 +99,7 @@ var (
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
- ApricotBlockTimestamp: new(big.Int).SetUint64(uint64(time.Date(2020, 12, 23, 5, 00, 0, 0, time.UTC).Unix())),
+ ApricotBlockTimestamp: AvalancheFujiApricotTimestamp,
}
// MainnetChainConfig is the chain parameters to run a node on the main network.
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index 2732a79..9f5607a 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -239,13 +239,13 @@ func (vm *VM) Initialize(
return err
}
- // Set the Apricot Fork Block on the ChainConfig
- // TODO switch to correct block number of the fork
+ // If Mainnet or Fuji ChainID is present then switch
+ // manually set the config
switch {
case g.Config.ChainID.Cmp(params.AvalancheMainnetChainID) == 0:
- g.Config = params.AvalancheApricotMainnetChainConfig
+ g.Config.ApricotBlockTimestamp = params.AvalancheMainnetApricotTimestamp
case g.Config.ChainID.Cmp(params.AvalancheFujiChainID) == 0:
- g.Config = params.AvalancheApricotFujiChainConfig
+ g.Config.ApricotBlockTimestamp = params.AvalancheFujiApricotTimestamp
}
vm.acceptedDB = prefixdb.New([]byte(acceptedPrefix), db)