Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Miner Migration tests additions #1573

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Changes from all commits
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
24 changes: 17 additions & 7 deletions actors/migration/nv15/test/miner_migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@ package test

import (
"context"
"strings"

"github.com/filecoin-project/specs-actors/v7/actors/builtin"
"github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
"github.com/filecoin-project/specs-actors/v7/actors/states"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/rt"
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"

ipld2 "github.com/filecoin-project/specs-actors/v2/support/ipld"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power"
"github.com/filecoin-project/specs-actors/v6/actors/util/adt"
vm6 "github.com/filecoin-project/specs-actors/v6/support/vm"
power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power"
vm7 "github.com/filecoin-project/specs-actors/v7/support/vm"

"github.com/filecoin-project/specs-actors/v7/actors/builtin"
"github.com/filecoin-project/specs-actors/v7/actors/builtin/exported"
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power"
"github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
"github.com/filecoin-project/specs-actors/v7/actors/migration/nv15"
"github.com/filecoin-project/specs-actors/v7/support/ipld"
vm7 "github.com/filecoin-project/specs-actors/v7/support/vm"
"github.com/filecoin-project/specs-actors/v7/support/vm6Util"

"testing"
Expand Down Expand Up @@ -146,7 +148,7 @@ func createMinersAndSectorsV6(t *testing.T, ctx context.Context, ctxStore adt.St

func TestNv15Migration(t *testing.T) {
ctx := context.Background()
bs := ipld2.NewSyncBlockStoreInMemory()
bs := ipld.NewBlockStoreInMemory()
v := vm6.NewVMWithSingletons(ctx, t, bs)
ctxStore := adt.WrapBlockStore(ctx, bs)
log := nv15.TestLogger{TB: t}
Expand Down Expand Up @@ -189,6 +191,14 @@ func TestNv15Migration(t *testing.T) {
networkStatsAfter := vm7.GetNetworkStats(t, v7)
compareNetworkStats(t, networkStatsBefore, networkStatsAfter)

stateTree, err := v7.GetStateTree()
require.NoError(t, err)
totalBalance, err := v7.GetTotalActorBalance()
require.NoError(t, err)
acc, err := states.CheckStateInvariants(stateTree, totalBalance, v7.GetEpoch()-1)
require.NoError(t, err)
require.True(t, acc.IsEmpty(), strings.Join(acc.Messages(), "\n"))

// Compare miner states
for _, minerInfo := range minerInfos {
var oldMinerState miner6.State
Expand Down