Env var to control v2 actor migration

Env var to control v2 actor migration
This commit is contained in:
Łukasz Magiera 2020-10-08 00:17:24 +02:00 committed by Aayush Rajasekaran
parent d1555106a4
commit f9f54819d4
3 changed files with 46 additions and 5 deletions

View File

@ -3,6 +3,9 @@
package build package build
import ( import (
"math"
"os"
"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"
@ -14,8 +17,9 @@ const BreezeGasTampingDuration = 0
const UpgradeSmokeHeight = -1 const UpgradeSmokeHeight = -1
const UpgradeIgnitionHeight = -2 const UpgradeIgnitionHeight = -2
const UpgradeRefuelHeight = -3 const UpgradeRefuelHeight = -3
const UpgradeActorsV2Height = 10
const UpgradeLiftoffHeight = -4 var UpgradeActorsV2Height = abi.ChainEpoch(10)
var UpgradeLiftoffHeight = abi.ChainEpoch(-4)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet, 0: DrandMainnet,
@ -26,6 +30,11 @@ func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048))
policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) policy.SetMinVerifiedDealSize(abi.NewStoragePower(256))
if os.Getenv("LOTUS_DISABLE_V2_ACTOR_MIGRATION") == "1" {
UpgradeActorsV2Height = math.MaxInt64
UpgradeLiftoffHeight = 11
}
BuildType |= Build2k BuildType |= Build2k
} }

View File

@ -5,6 +5,7 @@
package build package build
import ( import (
"math"
"os" "os"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
@ -26,7 +27,8 @@ const UpgradeSmokeHeight = 51000
const UpgradeIgnitionHeight = 94000 const UpgradeIgnitionHeight = 94000
const UpgradeRefuelHeight = 130800 const UpgradeRefuelHeight = 130800
const UpgradeActorsV2Height = 138720
var UpgradeActorsV2Height = abi.ChainEpoch(138720)
// This signals our tentative epoch for mainnet launch. Can make it later, but not earlier. // This signals our tentative epoch for mainnet launch. Can make it later, but not earlier.
// Miners, clients, developers, custodians all need time to prepare. // Miners, clients, developers, custodians all need time to prepare.
@ -44,6 +46,10 @@ func init() {
SetAddressNetwork(address.Mainnet) SetAddressNetwork(address.Mainnet)
} }
if os.Getenv("LOTUS_DISABLE_V2_ACTOR_MIGRATION") == "1" {
UpgradeActorsV2Height = math.MaxInt64
}
Devnet = false Devnet = false
} }

View File

@ -56,7 +56,7 @@ type UpgradeSchedule []Upgrade
func DefaultUpgradeSchedule() UpgradeSchedule { func DefaultUpgradeSchedule() UpgradeSchedule {
var us UpgradeSchedule var us UpgradeSchedule
for _, u := range []Upgrade{{ updates := []Upgrade{{
Height: build.UpgradeBreezeHeight, Height: build.UpgradeBreezeHeight,
Network: network.Version1, Network: network.Version1,
Migration: UpgradeFaucetBurnRecovery, Migration: UpgradeFaucetBurnRecovery,
@ -81,7 +81,33 @@ func DefaultUpgradeSchedule() UpgradeSchedule {
Height: build.UpgradeLiftoffHeight, Height: build.UpgradeLiftoffHeight,
Network: network.Version4, Network: network.Version4,
Migration: UpgradeLiftoff, Migration: UpgradeLiftoff,
}} { }}
if build.UpgradeActorsV2Height == math.MaxInt64 { // disable actors upgrade
updates = []Upgrade{{
Height: build.UpgradeBreezeHeight,
Network: network.Version1,
Migration: UpgradeFaucetBurnRecovery,
}, {
Height: build.UpgradeSmokeHeight,
Network: network.Version2,
Migration: nil,
}, {
Height: build.UpgradeIgnitionHeight,
Network: network.Version3,
Migration: UpgradeIgnition,
}, {
Height: build.UpgradeRefuelHeight,
Network: network.Version3,
Migration: UpgradeRefuel,
}, {
Height: build.UpgradeLiftoffHeight,
Network: network.Version3,
Migration: UpgradeLiftoff,
}}
}
for _, u := range updates {
if u.Height < 0 { if u.Height < 0 {
// upgrade disabled // upgrade disabled
continue continue