2022-06-14 17:27:04 +00:00
|
|
|
package wdpost
|
2020-09-02 18:45:25 +00:00
|
|
|
|
|
|
|
import (
|
2022-06-14 15:00:51 +00:00
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
|
2020-09-14 11:17:45 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
"github.com/filecoin-project/go-state-types/dline"
|
2023-11-14 00:06:11 +00:00
|
|
|
|
2023-08-29 13:16:05 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
2020-09-02 18:45:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// SchedulerState defines the possible states in which the scheduler could be,
|
|
|
|
// for the purposes of journalling.
|
|
|
|
type SchedulerState string
|
|
|
|
|
|
|
|
const (
|
|
|
|
// SchedulerStateStarted gets recorded when a WdPoSt cycle for an
|
|
|
|
// epoch begins.
|
|
|
|
SchedulerStateStarted = SchedulerState("started")
|
|
|
|
// SchedulerStateAborted gets recorded when a WdPoSt cycle for an
|
|
|
|
// epoch is aborted, normally because of a chain reorg or advancement.
|
|
|
|
SchedulerStateAborted = SchedulerState("aborted")
|
|
|
|
// SchedulerStateFaulted gets recorded when a WdPoSt cycle for an
|
|
|
|
// epoch terminates abnormally, in which case the error is also recorded.
|
|
|
|
SchedulerStateFaulted = SchedulerState("faulted")
|
|
|
|
// SchedulerStateSucceeded gets recorded when a WdPoSt cycle for an
|
|
|
|
// epoch ends successfully.
|
|
|
|
SchedulerStateSucceeded = SchedulerState("succeeded")
|
|
|
|
)
|
|
|
|
|
|
|
|
// Journal event types.
|
|
|
|
const (
|
|
|
|
evtTypeWdPoStScheduler = iota
|
|
|
|
evtTypeWdPoStProofs
|
|
|
|
evtTypeWdPoStRecoveries
|
|
|
|
evtTypeWdPoStFaults
|
|
|
|
)
|
|
|
|
|
|
|
|
// evtCommon is a common set of attributes for Windowed PoSt journal events.
|
|
|
|
type evtCommon struct {
|
2020-09-14 11:17:45 +00:00
|
|
|
Deadline *dline.Info
|
2020-09-02 18:45:25 +00:00
|
|
|
Height abi.ChainEpoch
|
|
|
|
TipSet []cid.Cid
|
|
|
|
Error error `json:",omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// WdPoStSchedulerEvt is the journal event that gets recorded on scheduler
|
|
|
|
// actions.
|
|
|
|
type WdPoStSchedulerEvt struct {
|
|
|
|
evtCommon
|
|
|
|
State SchedulerState
|
|
|
|
}
|
|
|
|
|
|
|
|
// WdPoStProofsProcessedEvt is the journal event that gets recorded when
|
|
|
|
// Windowed PoSt proofs have been processed.
|
|
|
|
type WdPoStProofsProcessedEvt struct {
|
|
|
|
evtCommon
|
|
|
|
Partitions []miner.PoStPartition
|
|
|
|
MessageCID cid.Cid `json:",omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// WdPoStRecoveriesProcessedEvt is the journal event that gets recorded when
|
|
|
|
// Windowed PoSt recoveries have been processed.
|
|
|
|
type WdPoStRecoveriesProcessedEvt struct {
|
|
|
|
evtCommon
|
|
|
|
Declarations []miner.RecoveryDeclaration
|
|
|
|
MessageCID cid.Cid `json:",omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// WdPoStFaultsProcessedEvt is the journal event that gets recorded when
|
|
|
|
// Windowed PoSt faults have been processed.
|
|
|
|
type WdPoStFaultsProcessedEvt struct {
|
|
|
|
evtCommon
|
|
|
|
Declarations []miner.FaultDeclaration
|
|
|
|
MessageCID cid.Cid `json:",omitempty"`
|
|
|
|
}
|