fix tests
This commit is contained in:
parent
9175a1be55
commit
b908096a88
@ -56,12 +56,6 @@ const testForkHeight = 40
|
|||||||
type testActor struct {
|
type testActor struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type mockExecutor struct {
|
|
||||||
vm.Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*mockExecutor) Done() {}
|
|
||||||
|
|
||||||
// must use existing actor that an account is allowed to exec.
|
// must use existing actor that an account is allowed to exec.
|
||||||
func (testActor) Code() cid.Cid { return builtin0.PaymentChannelActorCodeID }
|
func (testActor) Code() cid.Cid { return builtin0.PaymentChannelActorCodeID }
|
||||||
func (testActor) State() cbor.Er { return new(testActorState) }
|
func (testActor) State() cbor.Er { return new(testActorState) }
|
||||||
@ -184,13 +178,13 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
||||||
inv.Register(actorstypes.Version0, nil, registry)
|
inv.Register(actorstypes.Version0, nil, registry)
|
||||||
|
|
||||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Executor, error) {
|
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
nvm.SetInvoker(inv)
|
nvm.SetInvoker(inv)
|
||||||
return &mockExecutor{nvm}, nil
|
return nvm, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
cg.SetStateManager(sm)
|
cg.SetStateManager(sm)
|
||||||
@ -302,13 +296,13 @@ func testForkRefuseCall(t *testing.T, nullsBefore, nullsAfter int) {
|
|||||||
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
||||||
inv.Register(actorstypes.Version0, nil, registry)
|
inv.Register(actorstypes.Version0, nil, registry)
|
||||||
|
|
||||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Executor, error) {
|
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
nvm.SetInvoker(inv)
|
nvm.SetInvoker(inv)
|
||||||
return &mockExecutor{nvm}, nil
|
return nvm, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
cg.SetStateManager(sm)
|
cg.SetStateManager(sm)
|
||||||
@ -524,13 +518,13 @@ func TestForkPreMigration(t *testing.T) {
|
|||||||
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
||||||
inv.Register(actorstypes.Version0, nil, registry)
|
inv.Register(actorstypes.Version0, nil, registry)
|
||||||
|
|
||||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Executor, error) {
|
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
nvm.SetInvoker(inv)
|
nvm.SetInvoker(inv)
|
||||||
return &mockExecutor{nvm}, nil
|
return nvm, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
cg.SetStateManager(sm)
|
cg.SetStateManager(sm)
|
||||||
@ -598,11 +592,11 @@ func TestDisablePreMigration(t *testing.T) {
|
|||||||
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
||||||
inv.Register(actorstypes.Version0, nil, registry)
|
inv.Register(actorstypes.Version0, nil, registry)
|
||||||
|
|
||||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Executor, error) {
|
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
nvm.SetInvoker(inv)
|
nvm.SetInvoker(inv)
|
||||||
return &mockExecutor{nvm}, nil
|
return nvm, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
cg.SetStateManager(sm)
|
cg.SetStateManager(sm)
|
||||||
@ -653,11 +647,11 @@ func TestMigrtionCache(t *testing.T) {
|
|||||||
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
registry := builtin.MakeRegistryLegacy([]rtt.VMActor{testActor{}})
|
||||||
inv.Register(actorstypes.Version0, nil, registry)
|
inv.Register(actorstypes.Version0, nil, registry)
|
||||||
|
|
||||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Executor, error) {
|
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
nvm.SetInvoker(inv)
|
nvm.SetInvoker(inv)
|
||||||
return &mockExecutor{nvm}, nil
|
return nvm, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
cg.SetStateManager(sm)
|
cg.SetStateManager(sm)
|
||||||
@ -697,11 +691,11 @@ func TestMigrtionCache(t *testing.T) {
|
|||||||
index.DummyMsgIndex,
|
index.DummyMsgIndex,
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Executor, error) {
|
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||||
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
nvm, err := vm.NewLegacyVM(ctx, vmopt)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
nvm.SetInvoker(inv)
|
nvm.SetInvoker(inv)
|
||||||
return &mockExecutor{nvm}, nil
|
return nvm, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
@ -158,7 +158,7 @@ func (d *Driver) ExecuteTipset(bs blockstore.Blockstore, ds ds.Batching, params
|
|||||||
results: []*vm.ApplyRet{},
|
results: []*vm.ApplyRet{},
|
||||||
}
|
}
|
||||||
|
|
||||||
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Executor, error) {
|
sm.SetVMConstructor(func(ctx context.Context, vmopt *vm.VMOpts) (vm.Interface, error) {
|
||||||
vmopt.CircSupplyCalc = func(context.Context, abi.ChainEpoch, *state.StateTree) (abi.TokenAmount, error) {
|
vmopt.CircSupplyCalc = func(context.Context, abi.ChainEpoch, *state.StateTree) (abi.TokenAmount, error) {
|
||||||
return big.Zero(), nil
|
return big.Zero(), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user