From 550f3771ea1efd9d5c4e494856e30a852e35ba60 Mon Sep 17 00:00:00 2001 From: Ingar Shu Date: Mon, 5 Oct 2020 10:32:49 -0700 Subject: [PATCH 1/2] Reject deals that are > 90 days in the future in the BasicDealFilter --- node/modules/storageminer.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 5eab2ec6202..494603ba26a 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -44,6 +44,7 @@ import ( paramfetch "github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-storedcounter" + "github.com/filecoin-project/specs-actors/actors/builtin" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" @@ -468,6 +469,13 @@ func BasicDealFilter(user dtypes.DealFilter) func(onlineOk dtypes.ConsiderOnline return false, fmt.Sprintf("cannot seal a sector before %s", deal.Proposal.StartEpoch), nil } + // Reject if it's more than 90 days in the future + // TODO: read from cfg + maxStartEpoch := ht + abi.ChainEpoch(90*builtin.EpochsInDay) + if deal.Proposal.StartEpoch > maxStartEpoch { + return false, fmt.Sprintf("deal start epoch is too far in the future: %s > %s", deal.Proposal.StartEpoch, maxStartEpoch), nil + } + if user != nil { return user(ctx, deal) } From 1227bf28936b988f2cc638e9140a208618ff490b Mon Sep 17 00:00:00 2001 From: Ingar Shu Date: Mon, 5 Oct 2020 12:35:58 -0700 Subject: [PATCH 2/2] Change max time in future for StartEpoch to 7 days --- node/modules/storageminer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 494603ba26a..95bfb6c115a 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -469,9 +469,9 @@ func BasicDealFilter(user dtypes.DealFilter) func(onlineOk dtypes.ConsiderOnline return false, fmt.Sprintf("cannot seal a sector before %s", deal.Proposal.StartEpoch), nil } - // Reject if it's more than 90 days in the future + // Reject if it's more than 7 days in the future // TODO: read from cfg - maxStartEpoch := ht + abi.ChainEpoch(90*builtin.EpochsInDay) + maxStartEpoch := ht + abi.ChainEpoch(7*builtin.EpochsInDay) if deal.Proposal.StartEpoch > maxStartEpoch { return false, fmt.Sprintf("deal start epoch is too far in the future: %s > %s", deal.Proposal.StartEpoch, maxStartEpoch), nil }