Documentation ¶
Index ¶
- Constants
- Variables
- func NewNullReader(size abi.UnpaddedPieceSize) io.Reader
- type BasicPreCommitPolicy
- type Chain
- type DealInfo
- type DealSchedule
- type ErrApi
- type ErrBadCommD
- type ErrBadSeed
- type ErrBadTicket
- type ErrCommitWaitFailed
- type ErrExpiredDeals
- type ErrExpiredTicket
- type ErrInvalidDeals
- type ErrInvalidPiece
- type ErrInvalidProof
- type ErrNoPrecommit
- type ErrPrecommitOnChain
- type ErrSectorNumberAllocated
- type Events
- type FeeConfig
- type GetSealingConfigFunc
- type HeightHandler
- type Ignorable
- type Log
- type MessageReceipt
- type MsgLookup
- type NullReader
- type Piece
- type PieceWithDealInfo
- type PreCommitPolicy
- type ReturnState
- type RevertHandler
- type Sealing
- func (m *Sealing) AddPieceToAnySector(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, d DealInfo) (abi.SectorNumber, abi.PaddedPieceSize, error)
- func (m *Sealing) Address() address.Address
- func (m *Sealing) ForceSectorState(ctx context.Context, id abi.SectorNumber, state SectorState) error
- func (m *Sealing) GetSectorInfo(sid abi.SectorNumber) (SectorInfo, error)
- func (m *Sealing) IsMarkedForUpgrade(id abi.SectorNumber) bool
- func (m *Sealing) ListSectors() ([]SectorInfo, error)
- func (m *Sealing) MarkForUpgrade(id abi.SectorNumber) error
- func (m *Sealing) Plan(events []statemachine.Event, user interface{}) (interface{}, uint64, error)
- func (m *Sealing) PledgeSector() error
- func (m *Sealing) Remove(ctx context.Context, sid abi.SectorNumber) error
- func (m *Sealing) Run(ctx context.Context) error
- func (m *Sealing) StartPacking(sectorID abi.SectorNumber) error
- func (m *Sealing) Stop(ctx context.Context) error
- type SealingAPI
- type SectorAddPiece
- type SectorChainPreCommitFailed
- type SectorCommitFailed
- type SectorCommitSubmitted
- type SectorCommitted
- type SectorComputeProofFailed
- type SectorDealsExpired
- type SectorFatalError
- type SectorFaultReported
- type SectorFaultedFinal
- type SectorFaulty
- type SectorFinalizeFailed
- type SectorFinalized
- type SectorForceState
- type SectorIDCounter
- type SectorInfo
- type SectorInvalidDealIDs
- type SectorLocation
- type SectorOldTicket
- type SectorPacked
- type SectorPreCommit1
- type SectorPreCommit2
- type SectorPreCommitLanded
- type SectorPreCommitted
- type SectorProving
- type SectorRemove
- type SectorRemoveFailed
- type SectorRemoved
- type SectorRestart
- type SectorRetryCommitWait
- type SectorRetryComputeProof
- type SectorRetryFinalize
- type SectorRetryInvalidProof
- type SectorRetryPreCommit
- type SectorRetryPreCommitWait
- type SectorRetrySealPreCommit1
- type SectorRetrySealPreCommit2
- type SectorRetrySubmitCommit
- type SectorRetryWaitSeed
- type SectorSealPreCommit1Failed
- type SectorSealPreCommit2Failed
- type SectorSeedReady
- type SectorStart
- type SectorStartCC
- type SectorStartPacking
- type SectorState
- type SectorStateNotifee
- type SectorStats
- type SectorTicket
- type SectorTicketExpired
- type SectorUpdateDealIDs
- type TipSetToken
- type UnsealedSectorInfo
- type UnsealedSectorMap
Constants ¶
const ( RetPreCommit1 = ReturnState(PreCommit1) RetPreCommitting = ReturnState(PreCommitting) RetPreCommitFailed = ReturnState(PreCommitFailed) RetCommitFailed = ReturnState(CommitFailed) )
const InteractivePoRepConfidence = 6
Epochs
const SectorStorePrefix = "/sectors"
Variables ¶
var DealSectorPriority = 1024
var ErrSectorAllocated = errors.New("sectorNumber is allocated, but PreCommit info wasn't found on chain")
var ErrTooManySectorsSealing = xerrors.New("too many sectors sealing")
var ExistSectorStateList = map[SectorState]struct{}{
Empty: {},
WaitDeals: {},
Packing: {},
GetTicket: {},
PreCommit1: {},
PreCommit2: {},
PreCommitting: {},
PreCommitWait: {},
WaitSeed: {},
Committing: {},
SubmitCommit: {},
CommitWait: {},
FinalizeSector: {},
Proving: {},
FailedUnrecoverable: {},
SealPreCommit1Failed: {},
SealPreCommit2Failed: {},
PreCommitFailed: {},
ComputeProofFailed: {},
CommitFailed: {},
PackingFailed: {},
FinalizeFailed: {},
DealsExpired: {},
RecoverDealIDs: {},
Faulty: {},
FaultReported: {},
FaultedFinal: {},
Removing: {},
RemoveFailed: {},
Removed: {},
}
var MaxTicketAge = abi.ChainEpoch(builtin0.EpochsInDay * 2)
Functions ¶
func NewNullReader ¶
func NewNullReader(size abi.UnpaddedPieceSize) io.Reader
Types ¶
type BasicPreCommitPolicy ¶
type BasicPreCommitPolicy struct {
// contains filtered or unexported fields
}
BasicPreCommitPolicy satisfies PreCommitPolicy. It has two modes:
Mode 1: The sector contains a non-zero quantity of pieces with deal info Mode 2: The sector contains no pieces with deal info
The BasicPreCommitPolicy#Expiration method is given a slice of the pieces which the miner has encoded into the sector, and from that slice picks either the first or second mode.
If we're in Mode 1: The pre-commit expiration epoch will be the maximum deal end epoch of a piece in the sector.
If we're in Mode 2: The pre-commit expiration epoch will be set to the current epoch + the provided default duration.
func NewBasicPreCommitPolicy ¶
func NewBasicPreCommitPolicy(api Chain, duration abi.ChainEpoch, provingBoundary abi.ChainEpoch) BasicPreCommitPolicy
NewBasicPreCommitPolicy produces a BasicPreCommitPolicy
func (*BasicPreCommitPolicy) Expiration ¶
func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi.ChainEpoch, error)
Expiration produces the pre-commit sector expiration epoch for an encoded replica containing the provided enumeration of pieces and deals.
type Chain ¶
type Chain interface { ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error) StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error) }
type DealInfo ¶
type DealInfo struct { PublishCid *cid.Cid DealID abi.DealID DealSchedule DealSchedule KeepUnsealed bool }
DealInfo is a tuple of deal identity and its schedule
type DealSchedule ¶
type DealSchedule struct { StartEpoch abi.ChainEpoch EndEpoch abi.ChainEpoch }
DealSchedule communicates the time interval of a storage deal. The deal must appear in a sealed (proven) sector no later than StartEpoch, otherwise it is invalid.
func (*DealSchedule) MarshalCBOR ¶
func (t *DealSchedule) MarshalCBOR(w io.Writer) error
func (*DealSchedule) UnmarshalCBOR ¶
func (t *DealSchedule) UnmarshalCBOR(r io.Reader) error
type ErrApi ¶
type ErrApi struct {
// contains filtered or unexported fields
}
TODO: For now we handle this by halting state execution, when we get jsonrpc reconnecting
We should implement some wait-for-api logic
type ErrBadCommD ¶
type ErrBadCommD struct {
// contains filtered or unexported fields
}
type ErrBadSeed ¶
type ErrBadSeed struct {
// contains filtered or unexported fields
}
type ErrBadTicket ¶
type ErrBadTicket struct {
// contains filtered or unexported fields
}
type ErrCommitWaitFailed ¶
type ErrCommitWaitFailed struct {
// contains filtered or unexported fields
}
type ErrExpiredDeals ¶
type ErrExpiredDeals struct {
// contains filtered or unexported fields
}
type ErrExpiredTicket ¶
type ErrExpiredTicket struct {
// contains filtered or unexported fields
}
type ErrInvalidDeals ¶
type ErrInvalidDeals struct {
// contains filtered or unexported fields
}
type ErrInvalidPiece ¶
type ErrInvalidPiece struct {
// contains filtered or unexported fields
}
type ErrInvalidProof ¶
type ErrInvalidProof struct {
// contains filtered or unexported fields
}
type ErrNoPrecommit ¶
type ErrNoPrecommit struct {
// contains filtered or unexported fields
}
type ErrPrecommitOnChain ¶
type ErrPrecommitOnChain struct {
// contains filtered or unexported fields
}
type ErrSectorNumberAllocated ¶
type ErrSectorNumberAllocated struct {
// contains filtered or unexported fields
}
type Events ¶
type Events interface {
ChainAt(hnd HeightHandler, rev RevertHandler, confidence int, h abi.ChainEpoch) error
}
type FeeConfig ¶
type FeeConfig struct { MaxPreCommitGasFee abi.TokenAmount MaxCommitGasFee abi.TokenAmount }
type GetSealingConfigFunc ¶
type HeightHandler ¶
type HeightHandler func(ctx context.Context, tok TipSetToken, curH abi.ChainEpoch) error
`curH`-`ts.Height` = `confidence`
type Log ¶
type MessageReceipt ¶
func (*MessageReceipt) Equals ¶
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool
type MsgLookup ¶
type MsgLookup struct { Receipt MessageReceipt TipSetTok TipSetToken Height abi.ChainEpoch }
type NullReader ¶
type NullReader struct {
*io.LimitedReader
}
func (NullReader) NullBytes ¶
func (m NullReader) NullBytes() int64
type Piece ¶
type Piece struct { Piece abi.PieceInfo DealInfo *DealInfo // nil for pieces which do not appear in deals (e.g. filler pieces) }
Piece is a tuple of piece info and optional deal
type PieceWithDealInfo ¶
Piece is a tuple of piece and deal info
type PreCommitPolicy ¶
type ReturnState ¶ added in v0.5.5
type ReturnState string
type RevertHandler ¶
type RevertHandler func(ctx context.Context, tok TipSetToken) error
type Sealing ¶
type Sealing struct {
// contains filtered or unexported fields
}
func New ¶
func New(api SealingAPI, fc FeeConfig, events Events, maddr address.Address, ds datastore.Batching, sealer sectorstorage.SectorManager, sc SectorIDCounter, verif ffiwrapper.Verifier, pcp PreCommitPolicy, gc GetSealingConfigFunc, notifee SectorStateNotifee) *Sealing
func (*Sealing) AddPieceToAnySector ¶
func (m *Sealing) AddPieceToAnySector(ctx context.Context, size abi.UnpaddedPieceSize, r io.Reader, d DealInfo) (abi.SectorNumber, abi.PaddedPieceSize, error)
func (*Sealing) ForceSectorState ¶
func (m *Sealing) ForceSectorState(ctx context.Context, id abi.SectorNumber, state SectorState) error
func (*Sealing) GetSectorInfo ¶
func (m *Sealing) GetSectorInfo(sid abi.SectorNumber) (SectorInfo, error)
func (*Sealing) IsMarkedForUpgrade ¶ added in v0.5.2
func (m *Sealing) IsMarkedForUpgrade(id abi.SectorNumber) bool
func (*Sealing) ListSectors ¶
func (m *Sealing) ListSectors() ([]SectorInfo, error)
func (*Sealing) MarkForUpgrade ¶
func (m *Sealing) MarkForUpgrade(id abi.SectorNumber) error
func (*Sealing) Plan ¶
func (m *Sealing) Plan(events []statemachine.Event, user interface{}) (interface{}, uint64, error)
func (*Sealing) PledgeSector ¶
func (*Sealing) StartPacking ¶
func (m *Sealing) StartPacking(sectorID abi.SectorNumber) error
Caller should NOT hold m.unsealedInfoMap.lk
type SealingAPI ¶
type SealingAPI interface { StateWaitMsg(context.Context, cid.Cid) (MsgLookup, error) StateSearchMsg(context.Context, cid.Cid) (*MsgLookup, error) StateComputeDataCommitment(ctx context.Context, maddr address.Address, sectorType abi.RegisteredSealProof, deals []abi.DealID, tok TipSetToken) (cid.Cid, error) // Can return ErrSectorAllocated in case precommit info wasn't found, but the sector number is marked as allocated StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*miner.SectorPreCommitOnChainInfo, error) StateSectorGetInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*miner.SectorOnChainInfo, error) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok TipSetToken) (*SectorLocation, error) StateMinerSectorSize(context.Context, address.Address, TipSetToken) (abi.SectorSize, error) StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tok TipSetToken) (address.Address, error) StateMinerPreCommitDepositForPower(context.Context, address.Address, miner.SectorPreCommitInfo, TipSetToken) (big.Int, error) StateMinerInitialPledgeCollateral(context.Context, address.Address, miner.SectorPreCommitInfo, TipSetToken) (big.Int, error) StateMinerInfo(context.Context, address.Address, TipSetToken) (miner.MinerInfo, error) StateMinerSectorAllocated(context.Context, address.Address, abi.SectorNumber, TipSetToken) (bool, error) StateMarketStorageDeal(context.Context, abi.DealID, TipSetToken) (market.DealProposal, error) StateNetworkVersion(ctx context.Context, tok TipSetToken) (network.Version, error) SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error) ChainHead(ctx context.Context) (TipSetToken, abi.ChainEpoch, error) ChainGetRandomnessFromBeacon(ctx context.Context, tok TipSetToken, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) ChainGetRandomnessFromTickets(ctx context.Context, tok TipSetToken, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) ChainReadObj(context.Context, cid.Cid) ([]byte, error) }
type SectorAddPiece ¶
type SectorAddPiece struct {
NewPiece Piece
}
type SectorChainPreCommitFailed ¶
type SectorChainPreCommitFailed struct {
// contains filtered or unexported fields
}
func (SectorChainPreCommitFailed) FormatError ¶
func (evt SectorChainPreCommitFailed) FormatError(xerrors.Printer) (next error)
type SectorCommitFailed ¶
type SectorCommitFailed struct {
// contains filtered or unexported fields
}
func (SectorCommitFailed) FormatError ¶
func (evt SectorCommitFailed) FormatError(xerrors.Printer) (next error)
type SectorCommitSubmitted ¶ added in v0.5.5
type SectorCommitSubmitted struct {
Message cid.Cid
}
type SectorCommitted ¶
type SectorCommitted struct {
Proof []byte
}
type SectorComputeProofFailed ¶
type SectorComputeProofFailed struct {
// contains filtered or unexported fields
}
func (SectorComputeProofFailed) FormatError ¶
func (evt SectorComputeProofFailed) FormatError(xerrors.Printer) (next error)
type SectorDealsExpired ¶ added in v0.5.5
type SectorDealsExpired struct {
// contains filtered or unexported fields
}
func (SectorDealsExpired) FormatError ¶ added in v0.5.5
func (evt SectorDealsExpired) FormatError(xerrors.Printer) (next error)
type SectorFatalError ¶
type SectorFatalError struct {
// contains filtered or unexported fields
}
func (SectorFatalError) FormatError ¶
func (evt SectorFatalError) FormatError(xerrors.Printer) (next error)
type SectorFaultReported ¶
type SectorFaultReported struct {
// contains filtered or unexported fields
}
type SectorFaultedFinal ¶
type SectorFaultedFinal struct{}
type SectorFaulty ¶
type SectorFaulty struct{}
type SectorFinalizeFailed ¶
type SectorFinalizeFailed struct {
// contains filtered or unexported fields
}
func (SectorFinalizeFailed) FormatError ¶
func (evt SectorFinalizeFailed) FormatError(xerrors.Printer) (next error)
type SectorFinalized ¶
type SectorFinalized struct{}
type SectorForceState ¶
type SectorForceState struct {
State SectorState
}
type SectorIDCounter ¶
type SectorIDCounter interface {
Next() (abi.SectorNumber, error)
}
type SectorInfo ¶
type SectorInfo struct { State SectorState SectorNumber abi.SectorNumber SectorType abi.RegisteredSealProof // Packing Pieces []Piece // PreCommit1 TicketValue abi.SealRandomness TicketEpoch abi.ChainEpoch PreCommit1Out storage.PreCommit1Out // PreCommit2 CommD *cid.Cid CommR *cid.Cid Proof []byte PreCommitInfo *miner.SectorPreCommitInfo PreCommitDeposit big.Int PreCommitMessage *cid.Cid PreCommitTipSet TipSetToken PreCommit2Fails uint64 // WaitSeed SeedValue abi.InteractiveSealRandomness SeedEpoch abi.ChainEpoch // Committing CommitMessage *cid.Cid InvalidProofs uint64 // failed proof computations (doesn't validate with proof inputs; can't compute) // Faults FaultReportMsg *cid.Cid // Recovery Return ReturnState // Debug LastErr string Log []Log }
func (*SectorInfo) MarshalCBOR ¶
func (t *SectorInfo) MarshalCBOR(w io.Writer) error
func (*SectorInfo) UnmarshalCBOR ¶
func (t *SectorInfo) UnmarshalCBOR(r io.Reader) error
type SectorInvalidDealIDs ¶ added in v0.5.5
type SectorInvalidDealIDs struct {
Return ReturnState
}
type SectorLocation ¶
type SectorOldTicket ¶ added in v1.1.3
type SectorOldTicket struct{}
type SectorPacked ¶
type SectorPreCommit1 ¶
type SectorPreCommit1 struct {
PreCommit1Out storage.PreCommit1Out
}
type SectorPreCommit2 ¶
type SectorPreCommit2 struct { Sealed cid.Cid Unsealed cid.Cid }
type SectorPreCommitLanded ¶
type SectorPreCommitLanded struct {
TipSet TipSetToken
}
type SectorPreCommitted ¶
type SectorPreCommitted struct { Message cid.Cid PreCommitDeposit big.Int PreCommitInfo miner.SectorPreCommitInfo }
type SectorProving ¶
type SectorProving struct{}
type SectorRemove ¶
type SectorRemove struct{}
type SectorRemoveFailed ¶
type SectorRemoveFailed struct {
// contains filtered or unexported fields
}
func (SectorRemoveFailed) FormatError ¶
func (evt SectorRemoveFailed) FormatError(xerrors.Printer) (next error)
type SectorRemoved ¶
type SectorRemoved struct{}
type SectorRestart ¶
type SectorRestart struct{}
type SectorRetryCommitWait ¶
type SectorRetryCommitWait struct{}
type SectorRetryComputeProof ¶
type SectorRetryComputeProof struct{}
type SectorRetryFinalize ¶
type SectorRetryFinalize struct{}
type SectorRetryInvalidProof ¶
type SectorRetryInvalidProof struct{}
type SectorRetryPreCommit ¶
type SectorRetryPreCommit struct{}
type SectorRetryPreCommitWait ¶
type SectorRetryPreCommitWait struct{}
type SectorRetrySealPreCommit1 ¶
type SectorRetrySealPreCommit1 struct{}
type SectorRetrySealPreCommit2 ¶
type SectorRetrySealPreCommit2 struct{}
type SectorRetrySubmitCommit ¶ added in v0.5.5
type SectorRetrySubmitCommit struct{}
type SectorRetryWaitSeed ¶
type SectorRetryWaitSeed struct{}
type SectorSealPreCommit1Failed ¶
type SectorSealPreCommit1Failed struct {
// contains filtered or unexported fields
}
func (SectorSealPreCommit1Failed) FormatError ¶
func (evt SectorSealPreCommit1Failed) FormatError(xerrors.Printer) (next error)
type SectorSealPreCommit2Failed ¶
type SectorSealPreCommit2Failed struct {
// contains filtered or unexported fields
}
func (SectorSealPreCommit2Failed) FormatError ¶
func (evt SectorSealPreCommit2Failed) FormatError(xerrors.Printer) (next error)
type SectorSeedReady ¶
type SectorSeedReady struct { SeedValue abi.InteractiveSealRandomness SeedEpoch abi.ChainEpoch }
type SectorStart ¶
type SectorStart struct { ID abi.SectorNumber SectorType abi.RegisteredSealProof }
type SectorStartCC ¶
type SectorStartCC struct { ID abi.SectorNumber SectorType abi.RegisteredSealProof Pieces []Piece }
type SectorStartPacking ¶
type SectorStartPacking struct{}
func (SectorStartPacking) Ignore ¶
func (evt SectorStartPacking) Ignore()
type SectorState ¶
type SectorState string
const ( UndefinedSectorState SectorState = "" // happy path Empty SectorState = "Empty" WaitDeals SectorState = "WaitDeals" // waiting for more pieces (deals) to be added to 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 PreCommitting SectorState = "PreCommitting" // on chain pre-commit PreCommitWait SectorState = "PreCommitWait" // waiting for precommit to land on chain WaitSeed SectorState = "WaitSeed" // waiting for seed Committing SectorState = "Committing" // compute PoRep SubmitCommit SectorState = "SubmitCommit" // send commit message to the chain CommitWait SectorState = "CommitWait" // wait for the commit message to land on chain FinalizeSector SectorState = "FinalizeSector" Proving SectorState = "Proving" // error modes FailedUnrecoverable SectorState = "FailedUnrecoverable" SealPreCommit1Failed SectorState = "SealPreCommit1Failed" SealPreCommit2Failed SectorState = "SealPreCommit2Failed" PreCommitFailed SectorState = "PreCommitFailed" ComputeProofFailed SectorState = "ComputeProofFailed" CommitFailed SectorState = "CommitFailed" PackingFailed SectorState = "PackingFailed" // TODO: deprecated, remove FinalizeFailed SectorState = "FinalizeFailed" DealsExpired SectorState = "DealsExpired" RecoverDealIDs SectorState = "RecoverDealIDs" 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 Removing SectorState = "Removing" RemoveFailed SectorState = "RemoveFailed" Removed SectorState = "Removed" )
type SectorStateNotifee ¶ added in v0.7.1
type SectorStateNotifee func(before, after SectorInfo)
type SectorStats ¶
type SectorStats struct {
// contains filtered or unexported fields
}
type SectorTicket ¶ added in v1.1.3
type SectorTicket struct { TicketValue abi.SealRandomness TicketEpoch abi.ChainEpoch }
type SectorTicketExpired ¶ added in v1.1.3
type SectorTicketExpired struct {
// contains filtered or unexported fields
}
func (SectorTicketExpired) FormatError ¶ added in v1.1.3
func (evt SectorTicketExpired) FormatError(xerrors.Printer) (next error)
type SectorUpdateDealIDs ¶ added in v0.5.5
type TipSetToken ¶
type TipSetToken []byte
type UnsealedSectorInfo ¶
type UnsealedSectorInfo struct {
// contains filtered or unexported fields
}
type UnsealedSectorMap ¶
type UnsealedSectorMap struct {
// contains filtered or unexported fields
}