diff --git a/api/api_full.go b/api/api_full.go index 61a2ebc53..382611fbf 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -320,11 +320,11 @@ type MethodCall struct { } type StartDealParams struct { - Data *storagemarket.DataRef - Wallet address.Address - Miner address.Address - EpochPrice types.BigInt - BlocksDuration uint64 + Data *storagemarket.DataRef + Wallet address.Address + Miner address.Address + EpochPrice types.BigInt + MinBlocksDuration uint64 } type IpldObject struct { diff --git a/api/test/deals.go b/api/test/deals.go index 1d3baf138..47856446c 100644 --- a/api/test/deals.go +++ b/api/test/deals.go @@ -83,11 +83,11 @@ func TestDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration, carExport t.Fatal(err) } deal, err := client.ClientStartDeal(ctx, &api.StartDealParams{ - Data: &storagemarket.DataRef{Root: fcid}, - Wallet: addr, - Miner: maddr, - EpochPrice: types.NewInt(1000000), - BlocksDuration: 100, + Data: &storagemarket.DataRef{Root: fcid}, + Wallet: addr, + Miner: maddr, + EpochPrice: types.NewInt(1000000), + MinBlocksDuration: 100, }) if err != nil { t.Fatalf("%+v", err) diff --git a/cli/client.go b/cli/client.go index 3ea509103..466630ac7 100644 --- a/cli/client.go +++ b/cli/client.go @@ -187,11 +187,11 @@ var clientDealCmd = &cli.Command{ } proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{ - Data: ref, - Wallet: a, - Miner: miner, - EpochPrice: types.BigInt(price), - BlocksDuration: uint64(dur), + Data: ref, + Wallet: a, + Miner: miner, + EpochPrice: types.BigInt(price), + MinBlocksDuration: uint64(dur), }) if err != nil { return err diff --git a/go.mod b/go.mod index 2a74e35bc..8a7187f96 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 github.com/filecoin-project/go-statestore v0.1.0 github.com/filecoin-project/sector-storage v0.0.0-20200411000242-61616264b16d - github.com/filecoin-project/specs-actors v0.0.0-20200416120818-2fbe2e4dee24 + github.com/filecoin-project/specs-actors v0.0.0-20200416213853-1bd9b52a4621 github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275 github.com/filecoin-project/storage-fsm v0.0.0-20200415180041-afc45d4b6e8b github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 diff --git a/go.sum b/go.sum index 8afdc159e..5b33dd424 100644 --- a/go.sum +++ b/go.sum @@ -190,6 +190,8 @@ github.com/filecoin-project/specs-actors v0.0.0-20200415170224-54c7b2a42e71 h1:k github.com/filecoin-project/specs-actors v0.0.0-20200415170224-54c7b2a42e71/go.mod h1:M2HNOBpYbgXl/V4GmJFOsY7lQNuAmOtrCQMa6Yfpfrc= github.com/filecoin-project/specs-actors v0.0.0-20200416120818-2fbe2e4dee24 h1:r/a/rs912gOE5Z5AzKJXa7jHu3asRt/cHO30odPTMoE= github.com/filecoin-project/specs-actors v0.0.0-20200416120818-2fbe2e4dee24/go.mod h1:qNIpwxs7WCtxbcbG4ZiS+Wf3qn36eyfqktlXJhi46X4= +github.com/filecoin-project/specs-actors v0.0.0-20200416213853-1bd9b52a4621 h1:czpP1yymltKqEjCfQptXkn01rkkAqgf1nEmIPcRbO/I= +github.com/filecoin-project/specs-actors v0.0.0-20200416213853-1bd9b52a4621/go.mod h1:qNIpwxs7WCtxbcbG4ZiS+Wf3qn36eyfqktlXJhi46X4= github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275 h1:6OTcpsTQBQM0f/A67oEi4E4YtYd6fzkMqbU8cPIWMMs= github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE= github.com/filecoin-project/storage-fsm v0.0.0-20200413200947-069c3b2468ca h1:TejufIAWDpEVqFUCszDpgOEzXBWuTVltsDQL/3F8Jxo= diff --git a/markets/storageadapter/client.go b/markets/storageadapter/client.go index 62f950755..0d3ca4e1e 100644 --- a/markets/storageadapter/client.go +++ b/markets/storageadapter/client.go @@ -172,7 +172,7 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor return 0, xerrors.Errorf("getting deal pubsish message: %w", err) } - mi, err := stmgr.StateMinerInfo(ctx, c.sm, nil, deal.Proposal.Provider) + mi, err := stmgr.StateMinerInfo(ctx, c.sm, c.cs.GetHeaviestTipSet(), deal.Proposal.Provider) if err != nil { return 0, xerrors.Errorf("getting miner worker failed: %w", err) } diff --git a/node/impl/client/client.go b/node/impl/client/client.go index 47658bde3..8ab51463f 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -6,9 +6,6 @@ import ( "io" "os" - "github.com/filecoin-project/sector-storage/ffiwrapper" - - "github.com/filecoin-project/specs-actors/actors/abi/big" "golang.org/x/xerrors" "github.com/ipfs/go-blockservice" @@ -29,7 +26,10 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/storagemarket" + "github.com/filecoin-project/sector-storage/ffiwrapper" "github.com/filecoin-project/specs-actors/actors/abi" + "github.com/filecoin-project/specs-actors/actors/abi/big" + "github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -86,13 +86,16 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams) return nil, xerrors.Errorf("failed getting chain height: %w", err) } + exp := ts.Height()+dealStartBuffer+abi.ChainEpoch(params.MinBlocksDuration) + exp += miner.WPoStProvingPeriod - (exp % miner.WPoStProvingPeriod) + mi.ProvingPeriodBoundary - 1 + result, err := a.SMDealClient.ProposeStorageDeal( ctx, params.Wallet, &providerInfo, params.Data, ts.Height()+dealStartBuffer, - ts.Height()+dealStartBuffer+abi.ChainEpoch(params.BlocksDuration), + exp, params.EpochPrice, big.Zero(), rt,