Merge pull request #8680 from filecoin-project/feat/nv16-migration-bundle

[nv16] Ensure v8 bundle is loaded during migration
This commit is contained in:
Aayush Rajasekaran 2022-05-24 14:33:22 -04:00 committed by GitHub
commit e87bb5db6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -18,10 +18,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var manifestCids map[Version]cid.Cid = map[Version]cid.Cid{
// TODO fill in manifest CIDs for v8 and upwards once these are fixed
}
var manifestCids map[Version]cid.Cid
var manifests map[Version]*manifest.Manifest
var actorMeta map[cid.Cid]actorEntry
@ -52,6 +49,10 @@ func AddManifest(av Version, manifestCid cid.Cid) {
manifestMx.Lock()
defer manifestMx.Unlock()
if manifestCids == nil {
manifestCids = make(map[Version]cid.Cid)
}
manifestCids[av] = manifestCid
}

View File

@ -44,6 +44,7 @@ import (
"github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/vm"
"github.com/filecoin-project/lotus/node/bundle"
)
func DefaultUpgradeSchedule() stmgr.UpgradeSchedule {
@ -1369,6 +1370,13 @@ func upgradeActorsV8Common(
buf := blockstore.NewTieredBstore(sm.ChainStore().StateBlockstore(), blockstore.NewMemorySync())
store := store.ActorStore(ctx, buf)
// ensure that the manifet is loaded in the blockstore
if err := bundle.FetchAndLoadBundles(ctx, buf, map[actors.Version]build.Bundle{
actors.Version8: build.BuiltinActorReleases[actors.Version8],
}); err != nil {
return cid.Undef, xerrors.Errorf("failed to load manifest bundle: %w", err)
}
// Load the state root.
var stateRoot types.StateRoot
if err := store.Get(ctx, root, &stateRoot); err != nil {