diff --git a/pkg/state/wrapper.go b/pkg/state/wrapper.go index 7877efc..6143231 100644 --- a/pkg/state/wrapper.go +++ b/pkg/state/wrapper.go @@ -17,9 +17,6 @@ type Wrapper interface { // Returns the actor state at `address` (or an error if there is none). Actor(address address.Address) (Actor, error) - // Returns an abstraction over a payment channel actors state. - PaymentChannelActorState(address address.Address) (PaymentChannelActorState, error) - // Returns the actor storage for the actor at `address` (which is empty if there is no such actor). Storage(address address.Address) (Storage, error) diff --git a/pkg/suites/paymentchannel_actor.go b/pkg/suites/paymentchannel_actor.go deleted file mode 100644 index 5383823..0000000 --- a/pkg/suites/paymentchannel_actor.go +++ /dev/null @@ -1,65 +0,0 @@ -package suites - -import ( - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/filecoin-project/chain-validation/pkg/chain" - "github.com/filecoin-project/chain-validation/pkg/state/actors" - "github.com/filecoin-project/chain-validation/pkg/state/address" - "github.com/filecoin-project/chain-validation/pkg/state/types" -) - -func testSetup(t *testing.T, factory Factories) (*StateDriver, *chain.MessageProducer, *chain.Validator) { - drv := NewStateDriver(t, factory.NewState()) - - _, _, err := drv.State().SetSingletonActor(actors.InitAddress, types.NewInt(0)) - require.NoError(t, err) - - gasPrice := types.NewInt(1) - gasLimit := types.GasUnit(10000) - - producer := chain.NewMessageProducer(factory.NewMessageFactory(drv.State()), gasLimit, gasPrice) - validator := chain.NewValidator(factory) - - return drv, producer, validator -} - -func PaymentChannelCreateSuccess(t *testing.T, factory Factories, expGasUsed uint64) { - drv, producer, validator := testSetup(t, factory) - - expPayChAddress, err := address.NewIDAddress(103) - - alice := drv.NewAccountActor(30000) - bob := drv.NewAccountActor(0) - miner := drv.NewAccountActor(0) // Miner owner - - exeCtx := chain.NewExecutionContext(1, miner) - - msg, err := producer.PaymentChannelCreate(bob, alice, 0, 50) - require.NoError(t, err) - - msgReceipt, err := validator.ApplyMessage(exeCtx, drv.State(), msg) - require.NoError(t, err) - drv.AssertReceipt(msgReceipt, chain.MessageReceipt{ - ExitCode: 0, - ReturnValue: expPayChAddress.Bytes(), - GasUsed: types.GasUnit(expGasUsed), - }) - - // initial balance - paych amount - gas - drv.AssertBalance(alice, 30000-50-expGasUsed) - drv.AssertBalance(bob, 0) - drv.AssertBalance(miner, expGasUsed) - drv.AssertBalance(expPayChAddress, 50) - - pcaState, err := drv.State().PaymentChannelActorState(expPayChAddress) - require.NoError(t, err) - - assert.Equal(t, bob, pcaState.To()) - assert.Equal(t, alice, pcaState.From()) - assert.Zero(t, pcaState.MinCloseHeight()) - assert.Zero(t, pcaState.ClosingAt()) -}