From dd8c88b4182848bf4fa0f0fc9ed158dbf54656c3 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 28 Jul 2020 17:40:42 -0700 Subject: [PATCH 1/2] improve some seal duration things --- cmd/lotus-storage-miner/info.go | 7 +++++++ node/modules/storageminer.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/lotus-storage-miner/info.go b/cmd/lotus-storage-miner/info.go index bbcab62f2..6239d53c2 100644 --- a/cmd/lotus-storage-miner/info.go +++ b/cmd/lotus-storage-miner/info.go @@ -154,6 +154,13 @@ var infoCmd = &cli.Command{ fmt.Println() + sealdur, err := nodeApi.SectorGetExpectedSealDuration(ctx) + if err != nil { + return err + } + + fmt.Printf("Expected Seal Duration: %s\n\n", sealdur) + fmt.Println("Sectors:") err = sectorsInfo(ctx, nodeApi) if err != nil { diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index ba0178e10..de69c2462 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -420,7 +420,7 @@ func StorageProvider(minerAddress dtypes.MinerAddress, } earliest := abi.ChainEpoch(sealEpochs) + ht if deal.Proposal.StartEpoch < earliest { - log.Warnf("proposed deal would start before sealing can be completed; rejecting storage deal proposal from client: %s", deal.Proposal.PieceCID, deal.Client.String()) + log.Warnw("proposed deal would start before sealing can be completed; rejecting storage deal proposal from client", "piece_cid", deal.Proposal.PieceCID, "client", deal.Client.String(), "seal_duration", sealDuration, "earliest", earliest, "curepoch", ht) return false, fmt.Sprintf("cannot seal a sector before %s", deal.Proposal.StartEpoch), nil } From 005d60d6b4e464f30aafdb86b703f0ff9bac1c17 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Tue, 28 Jul 2020 18:18:21 -0700 Subject: [PATCH 2/2] better clientside calculation of default deal starts --- node/impl/client/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/node/impl/client/client.go b/node/impl/client/client.go index 9c320f832..715514c76 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -52,7 +52,7 @@ import ( var DefaultHashFunction = uint64(mh.BLAKE2B_MIN + 31) -const dealStartBuffer abi.ChainEpoch = 10000 // TODO: allow setting +const dealStartBufferHours uint64 = 24 type API struct { fx.In @@ -151,7 +151,8 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams) return nil, xerrors.Errorf("failed getting chain height: %w", err) } - dealStart = ts.Height() + dealStartBuffer + blocksPerHour := 60 * 60 / build.BlockDelaySecs + dealStart = ts.Height() + abi.ChainEpoch(dealStartBufferHours*blocksPerHour) } result, err := a.SMDealClient.ProposeStorageDeal(ctx, storagemarket.ProposeStorageDealParams{