Debug mode: Make upgrade heights controllable by an envvar

This commit is contained in:
Aayush Rajasekaran 2021-03-30 20:59:15 -04:00
parent f357530efc
commit fd140c3eaf

View File

@ -3,6 +3,9 @@
package build package build
import ( import (
"os"
"strconv"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
) )
@ -10,25 +13,27 @@ import (
const BootstrappersFile = "" const BootstrappersFile = ""
const GenesisFile = "" const GenesisFile = ""
const UpgradeBreezeHeight = -1 var UpgradeBreezeHeight = abi.ChainEpoch(-1)
const BreezeGasTampingDuration = 0 const BreezeGasTampingDuration = 0
const UpgradeSmokeHeight = -1 var UpgradeSmokeHeight = abi.ChainEpoch(-1)
const UpgradeIgnitionHeight = -2 var UpgradeIgnitionHeight = abi.ChainEpoch(-2)
const UpgradeRefuelHeight = -3 var UpgradeRefuelHeight = abi.ChainEpoch(-3)
const UpgradeTapeHeight = -4 var UpgradeTapeHeight = abi.ChainEpoch(-4)
const UpgradeActorsV2Height = 10 var UpgradeActorsV2Height = abi.ChainEpoch(10)
const UpgradeLiftoffHeight = -5 var UpgradeLiftoffHeight = abi.ChainEpoch(-5)
const UpgradeKumquatHeight = 15 var UpgradeKumquatHeight = abi.ChainEpoch(15)
const UpgradeCalicoHeight = 20 var UpgradeCalicoHeight = abi.ChainEpoch(20)
const UpgradePersianHeight = 25 var UpgradePersianHeight = abi.ChainEpoch(25)
const UpgradeOrangeHeight = 27 var UpgradeOrangeHeight = abi.ChainEpoch(27)
const UpgradeClausHeight = 30 var UpgradeClausHeight = abi.ChainEpoch(30)
const UpgradeActorsV3Height = 35 var UpgradeActorsV3Height = abi.ChainEpoch(35)
const UpgradeNorwegianHeight = 40
var UpgradeNorwegianHeight = abi.ChainEpoch(40)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet, 0: DrandMainnet,
@ -39,6 +44,35 @@ func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048))
policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) policy.SetMinVerifiedDealSize(abi.NewStoragePower(256))
getUpgradeHeight := func(ev string, def abi.ChainEpoch) abi.ChainEpoch {
hs, found := os.LookupEnv(ev)
if found {
h, err := strconv.Atoi(hs)
if err != nil {
log.Panicf("failed to parse %s env var", ev)
}
return abi.ChainEpoch(h)
}
return def
}
UpgradeBreezeHeight = getUpgradeHeight("LOTUS_BREEZE_HEIGHT", UpgradeBreezeHeight)
UpgradeSmokeHeight = getUpgradeHeight("LOTUS_SMOKE_HEIGHT", UpgradeSmokeHeight)
UpgradeIgnitionHeight = getUpgradeHeight("LOTUS_IGNITION_HEIGHT", UpgradeIgnitionHeight)
UpgradeRefuelHeight = getUpgradeHeight("LOTUS_REFUEL_HEIGHT", UpgradeRefuelHeight)
UpgradeTapeHeight = getUpgradeHeight("LOTUS_TAPE_HEIGHT", UpgradeTapeHeight)
UpgradeActorsV2Height = getUpgradeHeight("LOTUS_ACTORSV2_HEIGHT", UpgradeActorsV2Height)
UpgradeLiftoffHeight = getUpgradeHeight("LOTUS_LIFTOFF_HEIGHT", UpgradeLiftoffHeight)
UpgradeKumquatHeight = getUpgradeHeight("LOTUS_KUMQUAT_HEIGHT", UpgradeKumquatHeight)
UpgradeCalicoHeight = getUpgradeHeight("LOTUS_CALICO_HEIGHT", UpgradeCalicoHeight)
UpgradePersianHeight = getUpgradeHeight("LOTUS_PERSIAN_HEIGHT", UpgradePersianHeight)
UpgradeOrangeHeight = getUpgradeHeight("LOTUS_ORANGE_HEIGHT", UpgradeOrangeHeight)
UpgradeClausHeight = getUpgradeHeight("LOTUS_CLAUS_HEIGHT", UpgradeClausHeight)
UpgradeActorsV3Height = getUpgradeHeight("LOTUS_ACTORSV3_HEIGHT", UpgradeActorsV3Height)
UpgradeNorwegianHeight = getUpgradeHeight("LOTUS_NORWEGIAN_HEIGHT", UpgradeNorwegianHeight)
BuildType |= Build2k BuildType |= Build2k
} }