Repository: filecoin-project/lotus

Issue #6959: proposal: reject deals with an expiration date beyond 540d from now
Created: 2021-07-30T20:40:48Z
Some miners have begun to see this error:
  2021-07-30T14:59:43.549Z    WARN    sectors storage-sealing/fsm.go:609  sector
  1460 got error event sealing.SectorChainPreCommitFailed: precommit batch
  error: sending message failed: GasEstimateMessageGas error: estimating gas
  used: message execution failed: exit 16, reason: invalid expiration 2556588,
  cannot be more than 1555200 past current epoch 978360 (RetCode=16)
  
  2021-07-30T14:59:43.549Z    WARN    sectors storage-sealing/fsm.go:609  sector
  1459 got error event sealing.SectorChainPreCommitFailed: precommit batch
  error: sending message failed: GasEstimateMessageGas error: estimating gas
  used: message execution failed: exit 16, reason: invalid expiration 2556588,
  cannot be more than 1555200 past current epoch 978360 (RetCode=16)

This is caused by a client setting a deal expiry that's too far out into the future. Concretely, if the expiry epoch is later than 540d away from the time the sector is being precommitted, the precommit will fail with that message.
In the exhibit case, Estuary was setting:

a start date 7 days from when the deal was proposed (to give miners plenty time to seal the sector)
an end date that is the maximum sector duration (540d) + start date (7d) = 547d (!) from the proposal time.

If a client wants to make a deal with the longest lifetime possible, the only safe option is to make it with an expiry 540d from now (i.e. from the time the deal is proposed), not from the start date. The reason is that the client doesn't know when the miner will pack the deal into a sector and will precommit that sector. For all it knows it could be instantaneous (technically, e.g. if the miner already has the piece and doesn't need to transfer it?).

The simple solution to protect miners from this failure by default is to reject deals with an expiration date higher than 540d from the time the deal is proposed.
The harder (but more correct) solution is to accept the deal if the slack left by expiration - start is deemed enough to precommit and seal the sector in time. This might be useful if I want to schedule a deals into the future (e.g. start date 80 days from now, with an expiration of 500 days from then [this would be 580d from now], which gives me 40 days to precommit and seal the deal: days 40-80). However, in practice this is worthless because miners will reject deals with a start date too late into the future.

Duplicate issue #7093: Storage providers should never accept 540-day deals
Created: 2021-08-16T18:33:49Z
Checklist

 This is not a new feature or an enhancement to the Filecoin protocol. If it is,  please open an FIP issue.
 This is not a new feature request. If it is, please file a feature request instead.
 This is not brainstorming ideas. If you have an idea you'd like to discuss, please open a new discussion on the lotus forum and select the category as Ideas.
 I have a specific, actionable, and well motivated improvement to propose.

Lotus component
lotus miner/market - storage deal
Improvement Suggestion
Maybe I'm missing something but because max sector lifetime = max deal lifetime = 540 days, it's nearly impossible to ever actually activate a deal of 540 days -- I think your sector has to be activated at precisely the deal start epoch in order to succeed. Any earlier and the sector has an invalidly long lifetime, any later and the deal wasn't activated on time.
If this is true, let's just modify Lotus storage providers to never consider 540 day deals.

Closing comment (2021-08-17T11:36:02Z): Closing as a duplicate of #6959, which has a more detailed explanation. Please reopen if this issue is substantially different.