Skip to content

Commit

Permalink
Example V9 migration function
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-vball committed Jun 10, 2022
1 parent bec1dc4 commit 10638a3
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions chain/consensus/filcns/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -1431,9 +1431,28 @@ func upgradeActorsV8Common(
return newRoot, nil
}

func UpgradeActorsCode(ctx context.Context, sm *stmgr.StateManager, newActorsManifestCid cid.Cid, root cid.Cid, av actors.Version, oldStateTreeVersion types.StateTreeVersion, newStateTreeVersion types.StateTreeVersion) (cid.Cid, error) {
func UpgradeActorsV9(ctx context.Context, sm *stmgr.StateManager, _ stmgr.MigrationCache, _ stmgr.ExecMonitor, root cid.Cid, _ abi.ChainEpoch, _ *types.TipSet) (cid.Cid, error) {
buf := blockstore.NewTieredBstore(sm.ChainStore().StateBlockstore(), blockstore.NewMemorySync())

// This MUST change for upgrade
av := actors.Version8
// This may change for upgrade
newStateTreeVersion := types.StateTreeVersion4

// ensure that the manifest is loaded in the blockstore
if err := bundle.FetchAndLoadBundles(ctx, buf, map[actors.Version]build.Bundle{
av: build.BuiltinActorReleases[av],
}); err != nil {
return cid.Undef, xerrors.Errorf("failed to load manifest bundle: %w", err)
}

newActorsManifestCid, ok := actors.GetManifest(av)
if !ok {
return cid.Undef, xerrors.Errorf("no manifest CID for v8 upgrade")
}

bstore := sm.ChainStore().StateBlockstore()
return LiteMigration(ctx, bstore, newActorsManifestCid, root, av, oldStateTreeVersion, newStateTreeVersion)
return LiteMigration(ctx, bstore, newActorsManifestCid, root, av, types.StateTreeVersion4, newStateTreeVersion)
}

func LiteMigration(ctx context.Context, bstore blockstore.Blockstore, newActorsManifestCid cid.Cid, root cid.Cid, av actors.Version, oldStateTreeVersion types.StateTreeVersion, newStateTreeVersion types.StateTreeVersion) (cid.Cid, error) {
Expand Down

0 comments on commit 10638a3

Please sign in to comment.