Fix deal publishing
This commit is contained in:
parent
918b759d03
commit
15a4565714
@ -320,11 +320,11 @@ type MethodCall struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StartDealParams struct {
|
type StartDealParams struct {
|
||||||
Data *storagemarket.DataRef
|
Data *storagemarket.DataRef
|
||||||
Wallet address.Address
|
Wallet address.Address
|
||||||
Miner address.Address
|
Miner address.Address
|
||||||
EpochPrice types.BigInt
|
EpochPrice types.BigInt
|
||||||
BlocksDuration uint64
|
MinBlocksDuration uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type IpldObject struct {
|
type IpldObject struct {
|
||||||
|
@ -83,11 +83,11 @@ func TestDealFlow(t *testing.T, b APIBuilder, blocktime time.Duration, carExport
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
deal, err := client.ClientStartDeal(ctx, &api.StartDealParams{
|
deal, err := client.ClientStartDeal(ctx, &api.StartDealParams{
|
||||||
Data: &storagemarket.DataRef{Root: fcid},
|
Data: &storagemarket.DataRef{Root: fcid},
|
||||||
Wallet: addr,
|
Wallet: addr,
|
||||||
Miner: maddr,
|
Miner: maddr,
|
||||||
EpochPrice: types.NewInt(1000000),
|
EpochPrice: types.NewInt(1000000),
|
||||||
BlocksDuration: 100,
|
MinBlocksDuration: 100,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%+v", err)
|
t.Fatalf("%+v", err)
|
||||||
|
@ -187,11 +187,11 @@ var clientDealCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{
|
proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{
|
||||||
Data: ref,
|
Data: ref,
|
||||||
Wallet: a,
|
Wallet: a,
|
||||||
Miner: miner,
|
Miner: miner,
|
||||||
EpochPrice: types.BigInt(price),
|
EpochPrice: types.BigInt(price),
|
||||||
BlocksDuration: uint64(dur),
|
MinBlocksDuration: uint64(dur),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
2
go.mod
2
go.mod
@ -25,7 +25,7 @@ require (
|
|||||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663
|
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/go-statestore v0.1.0
|
||||||
github.com/filecoin-project/sector-storage v0.0.0-20200411000242-61616264b16d
|
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/specs-storage v0.0.0-20200410185809-9fbaaa08f275
|
||||||
github.com/filecoin-project/storage-fsm v0.0.0-20200415180041-afc45d4b6e8b
|
github.com/filecoin-project/storage-fsm v0.0.0-20200415180041-afc45d4b6e8b
|
||||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
||||||
|
2
go.sum
2
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-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 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-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 h1:6OTcpsTQBQM0f/A67oEi4E4YtYd6fzkMqbU8cPIWMMs=
|
||||||
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE=
|
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=
|
github.com/filecoin-project/storage-fsm v0.0.0-20200413200947-069c3b2468ca h1:TejufIAWDpEVqFUCszDpgOEzXBWuTVltsDQL/3F8Jxo=
|
||||||
|
@ -172,7 +172,7 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor
|
|||||||
return 0, xerrors.Errorf("getting deal pubsish message: %w", err)
|
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 {
|
if err != nil {
|
||||||
return 0, xerrors.Errorf("getting miner worker failed: %w", err)
|
return 0, xerrors.Errorf("getting miner worker failed: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/ipfs/go-blockservice"
|
"github.com/ipfs/go-blockservice"
|
||||||
@ -29,7 +26,10 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"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"
|
||||||
|
"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/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"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)
|
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(
|
result, err := a.SMDealClient.ProposeStorageDeal(
|
||||||
ctx,
|
ctx,
|
||||||
params.Wallet,
|
params.Wallet,
|
||||||
&providerInfo,
|
&providerInfo,
|
||||||
params.Data,
|
params.Data,
|
||||||
ts.Height()+dealStartBuffer,
|
ts.Height()+dealStartBuffer,
|
||||||
ts.Height()+dealStartBuffer+abi.ChainEpoch(params.BlocksDuration),
|
exp,
|
||||||
params.EpochPrice,
|
params.EpochPrice,
|
||||||
big.Zero(),
|
big.Zero(),
|
||||||
rt,
|
rt,
|
||||||
|
Loading…
Reference in New Issue
Block a user