2020-04-06 18:07:26 +00:00
|
|
|
package sealing
|
|
|
|
|
2020-04-06 20:23:37 +00:00
|
|
|
type SectorState string
|
2020-04-06 18:07:26 +00:00
|
|
|
|
2020-09-17 02:38:07 +00:00
|
|
|
var ExistSectorStateList = map[SectorState]struct{}{
|
2021-03-10 15:16:44 +00:00
|
|
|
Empty: {},
|
|
|
|
WaitDeals: {},
|
|
|
|
Packing: {},
|
|
|
|
AddPiece: {},
|
|
|
|
AddPieceFailed: {},
|
|
|
|
GetTicket: {},
|
|
|
|
PreCommit1: {},
|
|
|
|
PreCommit2: {},
|
|
|
|
PreCommitting: {},
|
|
|
|
PreCommitWait: {},
|
2021-05-18 15:21:10 +00:00
|
|
|
SubmitPreCommitBatch: {},
|
|
|
|
PreCommitBatchWait: {},
|
2021-03-10 15:16:44 +00:00
|
|
|
WaitSeed: {},
|
|
|
|
Committing: {},
|
2021-06-11 09:41:28 +00:00
|
|
|
CommitFinalize: {},
|
|
|
|
CommitFinalizeFailed: {},
|
2021-03-10 15:16:44 +00:00
|
|
|
SubmitCommit: {},
|
|
|
|
CommitWait: {},
|
|
|
|
SubmitCommitAggregate: {},
|
|
|
|
CommitAggregateWait: {},
|
|
|
|
FinalizeSector: {},
|
|
|
|
Proving: {},
|
|
|
|
FailedUnrecoverable: {},
|
|
|
|
SealPreCommit1Failed: {},
|
|
|
|
SealPreCommit2Failed: {},
|
|
|
|
PreCommitFailed: {},
|
|
|
|
ComputeProofFailed: {},
|
|
|
|
CommitFailed: {},
|
|
|
|
PackingFailed: {},
|
|
|
|
FinalizeFailed: {},
|
|
|
|
DealsExpired: {},
|
|
|
|
RecoverDealIDs: {},
|
|
|
|
Faulty: {},
|
|
|
|
FaultReported: {},
|
|
|
|
FaultedFinal: {},
|
|
|
|
Terminating: {},
|
|
|
|
TerminateWait: {},
|
|
|
|
TerminateFinality: {},
|
|
|
|
TerminateFailed: {},
|
|
|
|
Removing: {},
|
|
|
|
RemoveFailed: {},
|
|
|
|
Removed: {},
|
2020-09-17 02:38:07 +00:00
|
|
|
}
|
2020-09-16 11:49:45 +00:00
|
|
|
|
2020-04-06 18:07:26 +00:00
|
|
|
const (
|
2020-04-06 20:23:37 +00:00
|
|
|
UndefinedSectorState SectorState = ""
|
2020-04-06 18:07:26 +00:00
|
|
|
|
|
|
|
// happy path
|
2021-05-18 15:21:10 +00:00
|
|
|
Empty SectorState = "Empty" // deprecated
|
|
|
|
WaitDeals SectorState = "WaitDeals" // waiting for more pieces (deals) to be added to the sector
|
|
|
|
AddPiece SectorState = "AddPiece" // put deal data (and padding if required) into the sector
|
|
|
|
Packing SectorState = "Packing" // sector not in sealStore, and not on chain
|
|
|
|
GetTicket SectorState = "GetTicket" // generate ticket
|
|
|
|
PreCommit1 SectorState = "PreCommit1" // do PreCommit1
|
|
|
|
PreCommit2 SectorState = "PreCommit2" // do PreCommit2
|
|
|
|
|
2021-03-10 15:16:44 +00:00
|
|
|
PreCommitting SectorState = "PreCommitting" // on chain pre-commit
|
|
|
|
PreCommitWait SectorState = "PreCommitWait" // waiting for precommit to land on chain
|
2021-05-18 15:21:10 +00:00
|
|
|
|
|
|
|
SubmitPreCommitBatch SectorState = "SubmitPreCommitBatch"
|
|
|
|
PreCommitBatchWait SectorState = "PreCommitBatchWait"
|
|
|
|
|
2021-06-11 09:42:54 +00:00
|
|
|
WaitSeed SectorState = "WaitSeed" // waiting for seed
|
|
|
|
Committing SectorState = "Committing" // compute PoRep
|
|
|
|
CommitFinalize SectorState = "CommitFinalize" // cleanup sector metadata before submitting the proof (early finalize)
|
|
|
|
CommitFinalizeFailed SectorState = "CommitFinalizeFailed"
|
2021-03-10 15:16:44 +00:00
|
|
|
|
|
|
|
// single commit
|
|
|
|
SubmitCommit SectorState = "SubmitCommit" // send commit message to the chain
|
|
|
|
CommitWait SectorState = "CommitWait" // wait for the commit message to land on chain
|
|
|
|
|
|
|
|
SubmitCommitAggregate SectorState = "SubmitCommitAggregate"
|
|
|
|
CommitAggregateWait SectorState = "CommitAggregateWait"
|
|
|
|
|
2020-04-06 20:23:37 +00:00
|
|
|
FinalizeSector SectorState = "FinalizeSector"
|
|
|
|
Proving SectorState = "Proving"
|
2020-04-06 18:07:26 +00:00
|
|
|
// error modes
|
2020-06-04 15:29:31 +00:00
|
|
|
FailedUnrecoverable SectorState = "FailedUnrecoverable"
|
2021-01-20 17:42:22 +00:00
|
|
|
AddPieceFailed SectorState = "AddPieceFailed"
|
2020-06-04 15:29:31 +00:00
|
|
|
SealPreCommit1Failed SectorState = "SealPreCommit1Failed"
|
|
|
|
SealPreCommit2Failed SectorState = "SealPreCommit2Failed"
|
|
|
|
PreCommitFailed SectorState = "PreCommitFailed"
|
|
|
|
ComputeProofFailed SectorState = "ComputeProofFailed"
|
|
|
|
CommitFailed SectorState = "CommitFailed"
|
2020-08-27 20:41:35 +00:00
|
|
|
PackingFailed SectorState = "PackingFailed" // TODO: deprecated, remove
|
2020-06-04 15:29:31 +00:00
|
|
|
FinalizeFailed SectorState = "FinalizeFailed"
|
2020-08-27 11:51:13 +00:00
|
|
|
DealsExpired SectorState = "DealsExpired"
|
2020-08-27 19:04:43 +00:00
|
|
|
RecoverDealIDs SectorState = "RecoverDealIDs"
|
2020-06-03 21:42:13 +00:00
|
|
|
|
|
|
|
Faulty SectorState = "Faulty" // sector is corrupted or gone for some reason
|
|
|
|
FaultReported SectorState = "FaultReported" // sector has been declared as a fault on chain
|
|
|
|
FaultedFinal SectorState = "FaultedFinal" // fault declared on chain
|
2020-06-22 16:42:38 +00:00
|
|
|
|
2021-01-12 23:42:01 +00:00
|
|
|
Terminating SectorState = "Terminating"
|
|
|
|
TerminateWait SectorState = "TerminateWait"
|
|
|
|
TerminateFinality SectorState = "TerminateFinality"
|
|
|
|
TerminateFailed SectorState = "TerminateFailed"
|
|
|
|
|
2020-06-22 16:42:38 +00:00
|
|
|
Removing SectorState = "Removing"
|
|
|
|
RemoveFailed SectorState = "RemoveFailed"
|
|
|
|
Removed SectorState = "Removed"
|
2020-04-06 18:07:26 +00:00
|
|
|
)
|
2020-08-18 14:54:05 +00:00
|
|
|
|
2021-09-02 17:27:10 +00:00
|
|
|
func toStatState(st SectorState, finEarly bool) statSectorState {
|
2020-08-18 14:54:05 +00:00
|
|
|
switch st {
|
2021-02-11 12:52:00 +00:00
|
|
|
case UndefinedSectorState, Empty, WaitDeals, AddPiece:
|
2021-01-18 13:26:03 +00:00
|
|
|
return sstStaging
|
2021-09-02 17:27:10 +00:00
|
|
|
case Packing, GetTicket, PreCommit1, PreCommit2, PreCommitting, PreCommitWait, SubmitPreCommitBatch, PreCommitBatchWait, WaitSeed, Committing, CommitFinalize, FinalizeSector:
|
|
|
|
return sstSealing
|
|
|
|
case SubmitCommit, CommitWait, SubmitCommitAggregate, CommitAggregateWait:
|
|
|
|
if finEarly {
|
|
|
|
// we use statSectorState for throttling storage use. With FinalizeEarly
|
|
|
|
// we can consider sectors in states after CommitFinalize as finalized, so
|
|
|
|
// that more sectors can enter the sealing pipeline (and later be aggregated together)
|
|
|
|
return sstProving
|
|
|
|
}
|
2020-08-18 14:54:05 +00:00
|
|
|
return sstSealing
|
2021-01-14 11:44:27 +00:00
|
|
|
case Proving, Removed, Removing, Terminating, TerminateWait, TerminateFinality, TerminateFailed:
|
2020-08-18 14:54:05 +00:00
|
|
|
return sstProving
|
|
|
|
}
|
|
|
|
|
|
|
|
return sstFailed
|
|
|
|
}
|