Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shed: include invariant checks as part of migration testing #9547

Merged
merged 3 commits into from
Oct 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add invariant checks to migration
  • Loading branch information
arajasek committed Oct 24, 2022
commit 04f32ba119913584525f0e91b161734b74d1991e
39 changes: 20 additions & 19 deletions cmd/lotus-shed/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/filecoin-project/go-state-types/builtin"
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
v9 "github.com/filecoin-project/go-state-types/builtin/v9"
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
Expand Down Expand Up @@ -216,25 +217,25 @@ func checkMigrationInvariants(ctx context.Context, v8StateRoot cid.Cid, v9StateR
}

// Load the state root.
//var stateRoot types.StateRoot
//if err := actorStore.Get(ctx, v9StateRoot, &stateRoot); err != nil {
// return xerrors.Errorf("failed to decode state root: %w", err)
//}
//
//actorCodeCids, err := actors.GetActorCodeIDs(actorstypes.Version9)
//if err != nil {
// return err
//}
//
//actorTree, err := builtin.LoadTree(actorStore, stateRoot.Actors)
//messages, err := v9.CheckStateInvariants(actorTree, epoch, actorCodeCids)
//if err != nil {
// return xerrors.Errorf("checking state invariants: %w", err)
//}
//
//for _, message := range messages.Messages() {
// fmt.Println("got the following error: ", message)
//}
var stateRoot types.StateRoot
if err := actorStore.Get(ctx, v9StateRoot, &stateRoot); err != nil {
return xerrors.Errorf("failed to decode state root: %w", err)
}

actorCodeCids, err := actors.GetActorCodeIDs(actorstypes.Version9)
if err != nil {
return err
}

actorTree, err := builtin.LoadTree(actorStore, stateRoot.Actors)
messages, err := v9.CheckStateInvariants(actorTree, epoch, actorCodeCids)
if err != nil {
return xerrors.Errorf("checking state invariants: %w", err)
}

for _, message := range messages.Messages() {
fmt.Println("got the following error: ", message)
}

fmt.Println("completed invariant checks, took ", time.Since(startTime))

Expand Down