Skip to content

Commit

Permalink
use latest specs-actors with uint64 lane and nonce from paych.Actor (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
shannonwells authored Feb 20, 2020
1 parent 2202549 commit bfd0308
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 46 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200210220012-eb75ec747d6b
github.com/filecoin-project/go-statestore v0.1.0
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf
github.com/filecoin-project/specs-actors v0.0.0-20200220011005-b2a2fbf40362
github.com/hannahhoward/cbor-gen-for v0.0.0-20191218204337-9ab7b1bcc099
github.com/ipfs/go-block-format v0.0.2
github.com/ipfs/go-blockservice v0.1.3-0.20190908200855-f22eea50656c
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ github.com/filecoin-project/go-statestore v0.1.0 h1:t56reH59843TwXHkMcwyuayStBIi
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf h1:fbxBG12yrxilPFV1EG2lYqpUyAlRZWkvtqjk2svSeXY=
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
github.com/filecoin-project/specs-actors v0.0.0-20200220011005-b2a2fbf40362 h1:6FKMQbj6UIsg7t2qm1YlSbHjh/ehnCjaiOWzFwJefO0=
github.com/filecoin-project/specs-actors v0.0.0-20200220011005-b2a2fbf40362/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-check/check v0.0.0-20180628173108-788fd7840127 h1:0gkP6mzaMqkmpcJYCFOLkIBwI7xFExG03bbkOkCvUPI=
Expand Down
4 changes: 2 additions & 2 deletions retrievalmarket/impl/clientstates/client_states_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestSetupPaymentChannel(t *testing.T) {
ctx := context.Background()
ds := testnet.NewTestRetrievalDealStream(testnet.TestDealStreamParams{})
expectedPayCh := address.TestAddress2
expectedLane := int64(10)
expectedLane := uint64(10)

environment := func(params testnodes.TestRetrievalClientNodeParams) clientstates.ClientDealEnvironment {
node := testnodes.NewTestRetrievalClientNode(params)
Expand Down Expand Up @@ -490,7 +490,7 @@ func makeDealState(status retrievalmarket.DealStatus) *retrievalmarket.ClientDea
MinerWallet: address.TestAddress,
ClientWallet: address.TestAddress2,
PayCh: address.TestAddress2,
Lane: int64(10),
Lane: uint64(10),
Status: status,
BytesPaidFor: defaultBytesPaidFor,
TotalReceived: defaultTotalReceived,
Expand Down
8 changes: 4 additions & 4 deletions retrievalmarket/impl/testnodes/test_retrieval_client_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
type TestRetrievalClientNode struct {
payCh address.Address
payChErr error
lane int64
lane uint64
laneError error
voucher *paych.SignedVoucher
voucherError error
Expand All @@ -28,7 +28,7 @@ type TestRetrievalClientNode struct {
type TestRetrievalClientNodeParams struct {
PayCh address.Address
PayChErr error
Lane int64
Lane uint64
LaneError error
Voucher *paych.SignedVoucher
VoucherError error
Expand Down Expand Up @@ -63,15 +63,15 @@ func (trcn *TestRetrievalClientNode) GetOrCreatePaymentChannel(ctx context.Conte
}

// AllocateLane creates a mock lane on a payment channel
func (trcn *TestRetrievalClientNode) AllocateLane(paymentChannel address.Address) (int64, error) {
func (trcn *TestRetrievalClientNode) AllocateLane(paymentChannel address.Address) (uint64, error) {
if trcn.allocateLaneRecorder != nil {
trcn.allocateLaneRecorder(paymentChannel)
}
return trcn.lane, trcn.laneError
}

// CreatePaymentVoucher creates a mock payment voucher based on a channel and lane
func (trcn *TestRetrievalClientNode) CreatePaymentVoucher(ctx context.Context, paymentChannel address.Address, amount abi.TokenAmount, lane int64) (*paych.SignedVoucher, error) {
func (trcn *TestRetrievalClientNode) CreatePaymentVoucher(ctx context.Context, paymentChannel address.Address, amount abi.TokenAmount, lane uint64) (*paych.SignedVoucher, error) {
if trcn.createPaymentVoucherRecorder != nil {
trcn.createPaymentVoucherRecorder(trcn.voucher)
}
Expand Down
6 changes: 3 additions & 3 deletions retrievalmarket/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type ClientDealState struct {
ClientWallet address.Address
MinerWallet address.Address
PayCh address.Address
Lane int64
Lane uint64
Status DealStatus
Sender peer.ID
TotalReceived uint64
Expand Down Expand Up @@ -117,12 +117,12 @@ type RetrievalClientNode interface {
// Allocate late creates a lane within a payment channel so that calls to
// CreatePaymentVoucher will automatically make vouchers only for the difference
// in total
AllocateLane(paymentChannel address.Address) (int64, error)
AllocateLane(paymentChannel address.Address) (uint64, error)

// CreatePaymentVoucher creates a new payment voucher in the given lane for a
// given payment channel so that all the payment vouchers in the lane add up
// to the given amount (so the payment voucher will be for the difference)
CreatePaymentVoucher(ctx context.Context, paymentChannel address.Address, amount abi.TokenAmount, lane int64) (*paych.SignedVoucher, error)
CreatePaymentVoucher(ctx context.Context, paymentChannel address.Address, amount abi.TokenAmount, lane uint64) (*paych.SignedVoucher, error)
}

// ProviderDealState is the current state of a deal from the point of view
Expand Down
43 changes: 11 additions & 32 deletions retrievalmarket/types_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions shared_testutil/test_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func MakeTestSignedVoucher() *paych.SignedVoucher {
TimeLock: abi.ChainEpoch(rand.Int63()),
SecretPreimage: []byte("secret-preimage"),
Extra: MakeTestModVerifyParams(),
Lane: rand.Int63(),
Nonce: rand.Int63(),
Lane: rand.Uint64(),
Nonce: rand.Uint64(),
Amount: MakeTestTokenAmount(),
Merges: []paych.Merge{MakeTestMerge()},
Signature: MakeTestSignature(),
Expand All @@ -45,8 +45,8 @@ func MakeTestModVerifyParams() *paych.ModVerifyParams {
// MakeTestMerge generates a random Merge that has all non-zero fields
func MakeTestMerge() paych.Merge {
return paych.Merge{
Lane: rand.Int63(),
Nonce: rand.Int63(),
Lane: rand.Uint64(),
Nonce: rand.Uint64(),
}
}

Expand Down

0 comments on commit bfd0308

Please sign in to comment.