From feaf397dcc58bb8eb75e9030b65c6cb8875c6acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Sat, 11 Feb 2023 21:27:05 +0000 Subject: [PATCH] actors v12 migration + nv20 upgrade epochs. --- build/params_2k.go | 2 ++ build/params_butterfly.go | 2 ++ build/params_calibnet.go | 6 +++++- build/params_hyperspace.go | 3 +++ build/params_interop.go | 2 ++ build/params_mainnet.go | 3 +++ chain/consensus/filcns/upgrades.go | 23 ++++++++++++++++++++++- 7 files changed, 39 insertions(+), 2 deletions(-) diff --git a/build/params_2k.go b/build/params_2k.go index b6b09bb2e..a182ae405 100644 --- a/build/params_2k.go +++ b/build/params_2k.go @@ -63,6 +63,8 @@ var UpgradeHyggeHeight = abi.ChainEpoch(30) var UpgradeHyperspaceNV19Height = abi.ChainEpoch(60) +var UpgradeHyperspaceNV20Height = abi.ChainEpoch(70) + var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandMainnet, } diff --git a/build/params_butterfly.go b/build/params_butterfly.go index 442d604cc..db2c02103 100644 --- a/build/params_butterfly.go +++ b/build/params_butterfly.go @@ -55,6 +55,8 @@ const UpgradeHyggeHeight = abi.ChainEpoch(600) var UpgradeHyperspaceNV19Height = abi.ChainEpoch(99999999999999) +var UpgradeHyperspaceNV20Height = abi.ChainEpoch(99999999999999) + var SupportedProofTypes = []abi.RegisteredSealProof{ abi.RegisteredSealProof_StackedDrg512MiBV1, abi.RegisteredSealProof_StackedDrg32GiBV1, diff --git a/build/params_calibnet.go b/build/params_calibnet.go index 729ad1207..bfce0c8d0 100644 --- a/build/params_calibnet.go +++ b/build/params_calibnet.go @@ -73,7 +73,11 @@ const UpgradeSharkHeight = 16800 // 6 days after genesis const UpgradeHyggeHeight = math.MaxInt64 -var UpgradeHyperspaceNV19Height = abi.ChainEpoch(99999999999999) +// dummy +var UpgradeHyperspaceNV19Height = abi.ChainEpoch(math.MaxInt64) + +// dummy +var UpgradeHyperspaceNV20Height = abi.ChainEpoch(math.MaxInt64) var SupportedProofTypes = []abi.RegisteredSealProof{ abi.RegisteredSealProof_StackedDrg32GiBV1, diff --git a/build/params_hyperspace.go b/build/params_hyperspace.go index 5fa7b8f28..065f8c15c 100644 --- a/build/params_hyperspace.go +++ b/build/params_hyperspace.go @@ -58,6 +58,9 @@ var UpgradeHyggeHeight = abi.ChainEpoch(-21) // 2023-01-18T15:00:00Z var UpgradeHyperspaceNV19Height = abi.ChainEpoch(6840) +// TODO set upgrade epoch +var UpgradeHyperspaceNV20Height = abi.ChainEpoch(math.MaxInt64) + var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandMainnet, } diff --git a/build/params_interop.go b/build/params_interop.go index 36776f4b7..f716927aa 100644 --- a/build/params_interop.go +++ b/build/params_interop.go @@ -56,6 +56,8 @@ const UpgradeHyggeHeight = abi.ChainEpoch(99999999999999) var UpgradeHyperspaceNV19Height = abi.ChainEpoch(99999999999999) +var UpgradeHyperspaceNV20Height = abi.ChainEpoch(math.MaxInt64) + var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ 0: DrandMainnet, } diff --git a/build/params_mainnet.go b/build/params_mainnet.go index bad165187..42b7ec32d 100644 --- a/build/params_mainnet.go +++ b/build/params_mainnet.go @@ -92,6 +92,9 @@ var UpgradeHyggeHeight = abi.ChainEpoch(math.MaxInt64 - 1) // ?????????????? var UpgradeHyperspaceNV19Height = abi.ChainEpoch(math.MaxInt64) +// dummy +var UpgradeHyperspaceNV20Height = abi.ChainEpoch(math.MaxInt64) + var SupportedProofTypes = []abi.RegisteredSealProof{ abi.RegisteredSealProof_StackedDrg32GiBV1, abi.RegisteredSealProof_StackedDrg64GiBV1, diff --git a/chain/consensus/filcns/upgrades.go b/chain/consensus/filcns/upgrades.go index 0832ea0fb..80a574294 100644 --- a/chain/consensus/filcns/upgrades.go +++ b/chain/consensus/filcns/upgrades.go @@ -249,6 +249,10 @@ func DefaultUpgradeSchedule() stmgr.UpgradeSchedule { Height: build.UpgradeHyperspaceNV19Height, Network: network.Version19, Migration: UpgradeActorsV11, + }, { + Height: build.UpgradeHyperspaceNV20Height, + Network: network.Version20, + Migration: UpgradeActorsV12, }, } @@ -1724,7 +1728,24 @@ func UpgradeActorsV11(ctx context.Context, sm *stmgr.StateManager, _ stmgr.Migra } func UpgradeActorsV12(ctx context.Context, sm *stmgr.StateManager, _ stmgr.MigrationCache, _ stmgr.ExecMonitor, root cid.Cid, _ abi.ChainEpoch, _ *types.TipSet) (cid.Cid, error) { - return cid.Undef, nil + oldAv := actorstypes.Version11 + newAv := actorstypes.Version12 + // This may change for upgrade + oldStateTreeVersion := types.StateTreeVersion5 + newStateTreeVersion := types.StateTreeVersion5 + + // ensure that the manifest is loaded in the blockstore + if err := bundle.LoadBundles(ctx, sm.ChainStore().StateBlockstore(), newAv); err != nil { + return cid.Undef, xerrors.Errorf("failed to load manifest bundle: %w", err) + } + + newActorsManifestCid, ok := actors.GetManifest(newAv) + if !ok { + return cid.Undef, xerrors.Errorf("no manifest CID for actors v12 upgrade") + } + + bstore := sm.ChainStore().StateBlockstore() + return LiteMigration(ctx, bstore, newActorsManifestCid, root, oldAv, newAv, oldStateTreeVersion, newStateTreeVersion) } func LiteMigration(ctx context.Context, bstore blockstore.Blockstore, newActorsManifestCid cid.Cid, root cid.Cid, oldAv actorstypes.Version, newAv actorstypes.Version, oldStateTreeVersion types.StateTreeVersion, newStateTreeVersion types.StateTreeVersion) (cid.Cid, error) {