lotus/types.go

137 lines
2.8 KiB
Go
Raw Normal View History

package sealing
import (
2020-04-06 20:23:37 +00:00
"bytes"
2020-04-06 20:27:14 +00:00
"github.com/ipfs/go-cid"
2020-02-08 02:18:32 +00:00
"github.com/filecoin-project/specs-actors/actors/abi"
2020-04-06 20:23:37 +00:00
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
2020-04-03 16:54:01 +00:00
"github.com/filecoin-project/specs-storage/storage"
)
// Piece is a tuple of piece and deal info
type PieceWithDealInfo struct {
Piece abi.PieceInfo
DealInfo DealInfo
}
// Piece is a tuple of piece info and optional deal
type Piece struct {
Piece abi.PieceInfo
DealInfo *DealInfo // nil for pieces which do not appear in deals (e.g. filler pieces)
}
// DealInfo is a tuple of deal identity and its schedule
type DealInfo struct {
DealID abi.DealID
DealSchedule DealSchedule
}
// 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.
type DealSchedule struct {
StartEpoch abi.ChainEpoch
EndEpoch abi.ChainEpoch
}
2020-01-22 02:41:39 +00:00
type Log struct {
Timestamp uint64
Trace string // for errors
Message string
// additional data (Event info)
Kind string
2020-01-22 02:41:39 +00:00
}
type SectorInfo struct {
2020-04-06 22:31:33 +00:00
State SectorState
SectorNumber abi.SectorNumber // TODO: this field's name should be changed to SectorNumber
Nonce uint64 // TODO: remove
2020-02-27 00:42:39 +00:00
SectorType abi.RegisteredProof
// Packing
Pieces []Piece
2020-04-03 16:54:01 +00:00
// PreCommit1
TicketValue abi.SealRandomness
TicketEpoch abi.ChainEpoch
2020-04-03 16:54:01 +00:00
PreCommit1Out storage.PreCommit1Out
// PreCommit2
CommD *cid.Cid
CommR *cid.Cid
Proof []byte
PreCommitMessage *cid.Cid
2020-05-18 22:49:21 +00:00
PreCommitTipSet TipSetToken
2020-01-20 22:04:46 +00:00
// WaitSeed
SeedValue abi.InteractiveSealRandomness
SeedEpoch abi.ChainEpoch
// Committing
CommitMessage *cid.Cid
2020-04-04 01:50:05 +00:00
InvalidProofs uint64 // failed proof computations (doesn't validate with proof inputs)
// Faults
FaultReportMsg *cid.Cid
// Debug
LastErr string
2020-01-22 02:41:39 +00:00
Log []Log
}
2020-02-27 00:42:39 +00:00
func (t *SectorInfo) pieceInfos() []abi.PieceInfo {
out := make([]abi.PieceInfo, len(t.Pieces))
for i, p := range t.Pieces {
out[i] = p.Piece
}
return out
}
func (t *SectorInfo) dealIDs() []abi.DealID {
out := make([]abi.DealID, 0, len(t.Pieces))
for _, p := range t.Pieces {
if p.DealInfo == nil {
2020-02-23 00:47:47 +00:00
continue
}
out = append(out, p.DealInfo.DealID)
}
return out
}
func (t *SectorInfo) existingPieceSizes() []abi.UnpaddedPieceSize {
out := make([]abi.UnpaddedPieceSize, len(t.Pieces))
for i, p := range t.Pieces {
out[i] = p.Piece.Size.Unpadded()
}
return out
}
2020-04-06 20:23:37 +00:00
type SectorIDCounter interface {
Next() (abi.SectorNumber, error)
}
type TipSetToken []byte
type MsgLookup struct {
Receipt MessageReceipt
TipSetTok TipSetToken
Height abi.ChainEpoch
}
type MessageReceipt struct {
ExitCode exitcode.ExitCode
Return []byte
GasUsed int64
}
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed
}