types

package
v1.28.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2024 License: Apache-2.0, MIT Imports: 30 Imported by: 544

Documentation

Index

Constants

View Source
const (
	EventFlagIndexedKey   = 0b00000001
	EventFlagIndexedValue = 0b00000010
)

EventEntry flags defined in fvm_shared

View Source
const BigIntMaxSerializedLen = 128 // is this big enough? or too big?
View Source
const EventAMTBitwidth = 5
View Source
const MessageVersion = 0
View Source
const TestGasLimit = 100e6

Variables

View Source
var (
	ErrKeyInfoNotFound = fmt.Errorf("key info not found")
	ErrKeyExists       = fmt.Errorf("key already exists")
)
View Source
var AttoFil = NewInt(1)
View Source
var EmptyInt = BigInt{}
View Source
var EmptyTSK = TipSetKey{}
View Source
var ErrActorNotFound = errors.New("actor not found")
View Source
var FemtoFil = BigMul(AttoFil, NewInt(1000))
View Source
var MaxWinCount = 3 * int64(build.BlocksPerEpoch)
View Source
var NanoFil = BigMul(PicoFil, NewInt(1000))
View Source
var PicoFil = BigMul(FemtoFil, NewInt(1000))
View Source
var TotalFilecoinInt = FromFil(build.FilBase)

Functions

func BigCmp

func BigCmp(a, b BigInt) int

func BigDivFloat added in v1.11.0

func BigDivFloat(num, den BigInt) float64

func CidArrsContains added in v0.3.0

func CidArrsContains(a []cid.Cid, b cid.Cid) bool

func CidArrsEqual

func CidArrsEqual(a, b []cid.Cid) bool

func CidArrsSubset added in v0.5.0

func CidArrsSubset(a, b []cid.Cid) bool

func DeciStr added in v0.3.0

func DeciStr(bi BigInt) string

func SizeStr added in v0.3.0

func SizeStr(bi BigInt) string

Types

type Actor

type Actor = ActorV5

type ActorEvent added in v1.26.0

type ActorEvent struct {
	// Event entries in log form.
	Entries []EventEntry `json:"entries"`

	// Filecoin address of the actor that emitted this event.
	// NOTE: In a future upgrade, this will change to always be an ID address. Currently this will be
	// either the f4 address, or ID address if an f4 is not available for this actor.
	Emitter address.Address `json:"emitter"`

	// Reverted is set to true if the message that produced this event was reverted because of a network re-org
	// in that case, the event should be considered as reverted as well.
	Reverted bool `json:"reverted"`

	// Height of the tipset that contained the message that produced this event.
	Height abi.ChainEpoch `json:"height"`

	// The tipset that contained the message that produced this event.
	TipSetKey TipSetKey `json:"tipsetKey"`

	// CID of message that produced this event.
	MsgCid cid.Cid `json:"msgCid"`
}

type ActorEventBlock added in v1.26.0

type ActorEventBlock struct {
	// The value codec to match when filtering event values.
	Codec uint64 `json:"codec"`

	// The value to want to match on associated with the corresponding "event key"
	// when filtering events.
	// Should be a byte array encoded with the specified codec.
	// Assumes base64 encoding when converting to/from JSON strings.
	Value []byte `json:"value"`
}

type ActorEventFilter added in v1.26.0

type ActorEventFilter struct {
	// Matches events from one of these actors, or any actor if empty.
	// For now, this MUST be a Filecoin address.
	Addresses []address.Address `json:"addresses,omitempty"`

	// Matches events with the specified key/values, or all events if empty.
	// If the value is an empty slice, the filter will match on the key only, accepting any value.
	Fields map[string][]ActorEventBlock `json:"fields,omitempty"`

	// The height of the earliest tipset to include in the query. If empty, the query starts at the
	// last finalized tipset.
	// NOTE: In a future upgrade, this will be strict when set and will result in an error if a filter
	// cannot be fulfilled by the depth of history available in the node. Currently, the node will
	// nott return an error, but will return starting from the epoch it has data for.
	FromHeight *abi.ChainEpoch `json:"fromHeight,omitempty"`

	// The height of the latest tipset to include in the query. If empty, the query ends at the
	// latest tipset.
	ToHeight *abi.ChainEpoch `json:"toHeight,omitempty"`

	// Restricts events returned to those emitted from messages contained in this tipset.
	// If `TipSetKey` is legt empty in the filter criteria, then neither `FromHeight` nor `ToHeight` are allowed.
	TipSetKey *TipSetKey `json:"tipsetKey,omitempty"`
}

type ActorTrace added in v1.26.0

type ActorTrace struct {
	Id    abi.ActorID
	State Actor
}

func (*ActorTrace) MarshalCBOR added in v1.26.0

func (t *ActorTrace) MarshalCBOR(w io.Writer) error

func (*ActorTrace) UnmarshalCBOR added in v1.26.0

func (t *ActorTrace) UnmarshalCBOR(r io.Reader) (err error)

type ActorV4 added in v1.20.0

type ActorV4 struct {
	// Identifies the type of actor (string coded as a CID), see `chain/actors/actors.go`.
	Code    cid.Cid
	Head    cid.Cid
	Nonce   uint64
	Balance BigInt
}

Actor State for state tree version up to 4

func AsActorV4 added in v1.20.0

func AsActorV4(a *ActorV5) *ActorV4

func (*ActorV4) MarshalCBOR added in v1.20.0

func (t *ActorV4) MarshalCBOR(w io.Writer) error

func (*ActorV4) UnmarshalCBOR added in v1.20.0

func (t *ActorV4) UnmarshalCBOR(r io.Reader) (err error)

type ActorV5 added in v1.20.0

type ActorV5 struct {
	// Identifies the type of actor (string coded as a CID), see `chain/actors/actors.go`.
	Code    cid.Cid
	Head    cid.Cid
	Nonce   uint64
	Balance BigInt
	// The f4 address of the actor, if any.
	DelegatedAddress *address.Address
}

Actor State for state tree version 5

func AsActorV5 added in v1.20.0

func AsActorV5(a *ActorV4) *ActorV5

func (*ActorV5) MarshalCBOR added in v1.20.0

func (t *ActorV5) MarshalCBOR(w io.Writer) error

func (*ActorV5) UnmarshalCBOR added in v1.20.0

func (t *ActorV5) UnmarshalCBOR(r io.Reader) (err error)

type BeaconEntry added in v0.3.0

type BeaconEntry struct {
	Round uint64
	Data  []byte
}

func NewBeaconEntry added in v0.3.0

func NewBeaconEntry(round uint64, data []byte) BeaconEntry

func (*BeaconEntry) MarshalCBOR added in v0.3.0

func (t *BeaconEntry) MarshalCBOR(w io.Writer) error

func (*BeaconEntry) UnmarshalCBOR added in v0.3.0

func (t *BeaconEntry) UnmarshalCBOR(r io.Reader) (err error)

type BigInt

type BigInt = big2.Int

func BigAdd

func BigAdd(a, b BigInt) BigInt

func BigDiv

func BigDiv(a, b BigInt) BigInt

func BigFromBytes

func BigFromBytes(b []byte) BigInt

func BigFromString

func BigFromString(s string) (BigInt, error)

func BigMod

func BigMod(a, b BigInt) BigInt

func BigMul

func BigMul(a, b BigInt) BigInt

func BigSub

func BigSub(a, b BigInt) BigInt

func FromFil

func FromFil(i uint64) BigInt

func NewInt

func NewInt(i uint64) BigInt

type BlockHeader

type BlockHeader struct {
	Miner address.Address // 0 unique per block/miner

	Ticket                *Ticket           // 1 unique per block/miner: should be a valid VRF
	ElectionProof         *ElectionProof    // 2 unique per block/miner: should be a valid VRF
	BeaconEntries         []BeaconEntry     // 3 identical for all blocks in same tipset
	WinPoStProof          []proof.PoStProof // 4 unique per block/miner
	Parents               []cid.Cid         // 5 identical for all blocks in same tipset
	ParentWeight          BigInt            // 6 identical for all blocks in same tipset
	Height                abi.ChainEpoch    // 7 identical for all blocks in same tipset
	ParentStateRoot       cid.Cid           // 8 identical for all blocks in same tipset
	ParentMessageReceipts cid.Cid           // 9 identical for all blocks in same tipset
	Messages              cid.Cid           // 10 unique per block
	BLSAggregate          *crypto.Signature // 11 unique per block: aggrregate of BLS messages from above
	Timestamp             uint64            // 12 identical for all blocks in same tipset / hard-tied to the value of Height above
	BlockSig              *crypto.Signature // 13 unique per block/miner: miner signature
	ForkSignaling         uint64            // 14 currently unused/undefined
	ParentBaseFee         abi.TokenAmount   // 15 identical for all blocks in same tipset: the base fee after executing parent tipset
	// contains filtered or unexported fields
}

func DecodeBlock

func DecodeBlock(b []byte) (*BlockHeader, error)

func (*BlockHeader) Cid

func (blk *BlockHeader) Cid() cid.Cid

func (*BlockHeader) IsValidated added in v0.3.1

func (blk *BlockHeader) IsValidated() bool

func (*BlockHeader) LastTicket

func (blk *BlockHeader) LastTicket() *Ticket

func (*BlockHeader) MarshalCBOR

func (t *BlockHeader) MarshalCBOR(w io.Writer) error

func (*BlockHeader) Serialize

func (blk *BlockHeader) Serialize() ([]byte, error)

func (*BlockHeader) SetValidated added in v0.3.1

func (blk *BlockHeader) SetValidated()

func (*BlockHeader) SigningBytes

func (blk *BlockHeader) SigningBytes() ([]byte, error)

func (*BlockHeader) ToStorageBlock

func (blk *BlockHeader) ToStorageBlock() (block.Block, error)

func (*BlockHeader) UnmarshalCBOR

func (t *BlockHeader) UnmarshalCBOR(r io.Reader) (err error)

type BlockMsg

type BlockMsg struct {
	Header        *BlockHeader
	BlsMessages   []cid.Cid
	SecpkMessages []cid.Cid
}

func DecodeBlockMsg

func DecodeBlockMsg(b []byte) (*BlockMsg, error)

func (*BlockMsg) Cid

func (bm *BlockMsg) Cid() cid.Cid

func (*BlockMsg) MarshalCBOR

func (t *BlockMsg) MarshalCBOR(w io.Writer) error

func (*BlockMsg) Serialize

func (bm *BlockMsg) Serialize() ([]byte, error)

func (*BlockMsg) UnmarshalCBOR

func (t *BlockMsg) UnmarshalCBOR(r io.Reader) (err error)

type ChainMsg added in v0.3.0

type ChainMsg interface {
	Cid() cid.Cid
	VMMessage() *Message
	ToStorageBlock() (block.Block, error)
	// FIXME: This is the *message* length, this name is misleading.
	ChainLength() int
}

type ElectionProof added in v0.3.0

type ElectionProof struct {
	WinCount int64
	VRFProof []byte
}

func (*ElectionProof) ComputeWinCount added in v0.5.0

func (ep *ElectionProof) ComputeWinCount(power BigInt, totalPower BigInt) int64

ComputeWinCount uses VRFProof to compute number of wins The algorithm is based on Algorand's Sortition with Binomial distribution replaced by Poisson distribution.

func (*ElectionProof) MarshalCBOR added in v0.3.0

func (t *ElectionProof) MarshalCBOR(w io.Writer) error

func (*ElectionProof) UnmarshalCBOR added in v0.3.0

func (t *ElectionProof) UnmarshalCBOR(r io.Reader) (err error)

type Event added in v1.20.0

type Event struct {
	// The ID of the actor that emitted this event.
	Emitter abi.ActorID

	// Key values making up this event.
	Entries []EventEntry
}

func (*Event) MarshalCBOR added in v1.20.0

func (t *Event) MarshalCBOR(w io.Writer) error

func (*Event) UnmarshalCBOR added in v1.20.0

func (t *Event) UnmarshalCBOR(r io.Reader) (err error)

type EventEntry added in v1.20.0

type EventEntry struct {
	// A bitmap conveying metadata or hints about this entry.
	Flags uint8

	// The key of this event entry
	Key string

	// The event value's codec
	Codec uint64

	// The event value. It is encoded using the codec specified above
	Value []byte
}

func (*EventEntry) MarshalCBOR added in v1.20.0

func (t *EventEntry) MarshalCBOR(w io.Writer) error

func (*EventEntry) UnmarshalCBOR added in v1.20.0

func (t *EventEntry) UnmarshalCBOR(r io.Reader) (err error)

type ExecutionTrace added in v0.4.0

type ExecutionTrace struct {
	Msg          MessageTrace
	MsgRct       ReturnTrace
	InvokedActor *ActorTrace      `json:",omitempty"`
	GasCharges   []*GasTrace      `cborgen:"maxlen=1000000000"`
	Subcalls     []ExecutionTrace `cborgen:"maxlen=1000000000"`
}

func (*ExecutionTrace) MarshalCBOR added in v1.23.0

func (t *ExecutionTrace) MarshalCBOR(w io.Writer) error

func (ExecutionTrace) SumGas added in v1.20.0

func (et ExecutionTrace) SumGas() GasTrace

func (*ExecutionTrace) UnmarshalCBOR added in v1.23.0

func (t *ExecutionTrace) UnmarshalCBOR(r io.Reader) (err error)

type ExpTipSet

type ExpTipSet struct {
	Cids   []cid.Cid
	Blocks []*BlockHeader
	Height abi.ChainEpoch
}

func (*ExpTipSet) MarshalCBOR

func (t *ExpTipSet) MarshalCBOR(w io.Writer) error

func (*ExpTipSet) UnmarshalCBOR

func (t *ExpTipSet) UnmarshalCBOR(r io.Reader) (err error)

type FIL

type FIL BigInt

func MustParseFIL added in v0.10.2

func MustParseFIL(s string) FIL

func ParseFIL

func ParseFIL(s string) (FIL, error)

func (FIL) Format

func (f FIL) Format(s fmt.State, ch rune)

func (FIL) JSONSchema added in v1.27.0

func (f FIL) JSONSchema() *jsonschema.Schema

func (FIL) MarshalText added in v0.5.0

func (f FIL) MarshalText() (text []byte, err error)

func (FIL) Nano added in v1.11.0

func (f FIL) Nano() string

func (FIL) Short added in v1.2.2

func (f FIL) Short() string

func (FIL) String

func (f FIL) String() string

func (FIL) Unitless added in v0.9.1

func (f FIL) Unitless() string

func (FIL) UnmarshalText added in v0.5.0

func (f FIL) UnmarshalText(text []byte) error

type FilterID added in v1.20.0

type FilterID [32]byte // compatible with EthHash

type FullBlock

type FullBlock struct {
	Header        *BlockHeader
	BlsMessages   []*Message
	SecpkMessages []*SignedMessage
}

func (*FullBlock) Cid

func (fb *FullBlock) Cid() cid.Cid

type GasTrace added in v0.4.0

type GasTrace struct {
	Name       string
	TotalGas   int64         `json:"tg"`
	ComputeGas int64         `json:"cg"`
	StorageGas int64         `json:"sg"`
	TimeTaken  time.Duration `json:"tt"`
}

func SumGas added in v1.20.0

func SumGas(charges []*GasTrace) GasTrace

func (*GasTrace) MarshalCBOR added in v1.23.0

func (t *GasTrace) MarshalCBOR(w io.Writer) error

func (*GasTrace) MarshalJSON added in v0.4.0

func (gt *GasTrace) MarshalJSON() ([]byte, error)

func (*GasTrace) UnmarshalCBOR added in v1.23.0

func (t *GasTrace) UnmarshalCBOR(r io.Reader) (err error)

type KeyInfo

type KeyInfo struct {
	Type       KeyType
	PrivateKey []byte
}

KeyInfo is used for storing keys in KeyStore

type KeyStore

type KeyStore interface {
	// List lists all the keys stored in the KeyStore
	List() ([]string, error)
	// Get gets a key out of keystore and returns KeyInfo corresponding to named key
	Get(string) (KeyInfo, error)
	// Put saves a key info under given name
	Put(string, KeyInfo) error
	// Delete removes a key from keystore
	Delete(string) error
}

KeyStore is used for storing secret keys

type KeyType added in v0.10.1

type KeyType string

KeyType defines a type of a key

const (
	KTBLS             KeyType = "bls"
	KTSecp256k1       KeyType = "secp256k1"
	KTSecp256k1Ledger KeyType = "secp256k1-ledger"
	KTDelegated       KeyType = "delegated"
)

func (*KeyType) UnmarshalJSON added in v0.10.1

func (kt *KeyType) UnmarshalJSON(bb []byte) error

type LogCids

type LogCids []cid.Cid

func (LogCids) MarshalLogArray

func (cids LogCids) MarshalLogArray(ae zapcore.ArrayEncoder) error

type Message

type Message struct {
	Version uint64

	To   address.Address
	From address.Address

	Nonce uint64

	Value abi.TokenAmount

	GasLimit   int64
	GasFeeCap  abi.TokenAmount
	GasPremium abi.TokenAmount

	Method abi.MethodNum
	Params []byte
}

func DecodeMessage

func DecodeMessage(b []byte) (*Message, error)

func (*Message) Caller added in v0.3.0

func (m *Message) Caller() address.Address

func (*Message) ChainLength added in v0.3.0

func (m *Message) ChainLength() int

func (*Message) Cid

func (m *Message) Cid() cid.Cid

func (*Message) EffectiveGasPremium added in v1.23.0

func (m *Message) EffectiveGasPremium(baseFee abi.TokenAmount) abi.TokenAmount

EffectiveGasPremium returns the effective gas premium claimable by the miner given the supplied base fee. This method is not used anywhere except the Eth API.

Filecoin clamps the gas premium at GasFeeCap - BaseFee, if lower than the specified premium. Returns 0 if GasFeeCap is less than BaseFee.

func (*Message) EqualCall added in v0.5.0

func (m *Message) EqualCall(o *Message) bool

func (*Message) Equals

func (m *Message) Equals(o *Message) bool

func (*Message) MarshalCBOR

func (t *Message) MarshalCBOR(w io.Writer) error

func (*Message) MarshalJSON added in v0.10.1

func (m *Message) MarshalJSON() ([]byte, error)

func (*Message) Receiver added in v0.3.0

func (m *Message) Receiver() address.Address

func (*Message) RequiredFunds

func (m *Message) RequiredFunds() BigInt

func (*Message) Serialize

func (m *Message) Serialize() ([]byte, error)

func (*Message) ToStorageBlock

func (m *Message) ToStorageBlock() (block.Block, error)

func (*Message) UnmarshalCBOR

func (t *Message) UnmarshalCBOR(r io.Reader) (err error)

func (*Message) VMMessage

func (m *Message) VMMessage() *Message

func (*Message) ValidForBlockInclusion added in v0.3.0

func (m *Message) ValidForBlockInclusion(minGas int64, version network.Version) error

func (*Message) ValueReceived added in v0.3.0

func (m *Message) ValueReceived() abi.TokenAmount

type MessageReceipt

type MessageReceipt struct {
	ExitCode   exitcode.ExitCode
	Return     []byte
	GasUsed    int64
	EventsRoot *cid.Cid // Root of Event AMT with bitwidth = EventAMTBitwidth
	// contains filtered or unexported fields
}

func NewMessageReceiptV0 added in v1.20.0

func NewMessageReceiptV0(exitcode exitcode.ExitCode, ret []byte, gasUsed int64) MessageReceipt

NewMessageReceiptV0 creates a new pre FIP-0049 receipt with no capability to convey events.

func NewMessageReceiptV1 added in v1.20.0

func NewMessageReceiptV1(exitcode exitcode.ExitCode, ret []byte, gasUsed int64, eventsRoot *cid.Cid) MessageReceipt

NewMessageReceiptV1 creates a new pre FIP-0049 receipt with the ability to convey events.

func (*MessageReceipt) Equals

func (mr *MessageReceipt) Equals(o *MessageReceipt) bool

func (*MessageReceipt) MarshalCBOR

func (mr *MessageReceipt) MarshalCBOR(w io.Writer) error

func (*MessageReceipt) UnmarshalCBOR

func (mr *MessageReceipt) UnmarshalCBOR(r io.Reader) (err error)

func (*MessageReceipt) Version added in v1.20.0

func (mr *MessageReceipt) Version() MessageReceiptVersion

type MessageReceiptVersion added in v1.20.0

type MessageReceiptVersion byte
const (
	// MessageReceiptV0 refers to pre FIP-0049 receipts.
	MessageReceiptV0 MessageReceiptVersion = 0
	// MessageReceiptV1 refers to post FIP-0049 receipts.
	MessageReceiptV1 MessageReceiptVersion = 1
)

type MessageTrace added in v1.23.0

type MessageTrace struct {
	From        address.Address
	To          address.Address
	Value       abi.TokenAmount
	Method      abi.MethodNum
	Params      []byte
	ParamsCodec uint64
	GasLimit    uint64
	ReadOnly    bool
}

func (*MessageTrace) MarshalCBOR added in v1.23.0

func (t *MessageTrace) MarshalCBOR(w io.Writer) error

func (*MessageTrace) UnmarshalCBOR added in v1.23.0

func (t *MessageTrace) UnmarshalCBOR(r io.Reader) (err error)

type MpoolConfig added in v0.5.0

type MpoolConfig struct {
	PriorityAddrs          []address.Address
	SizeLimitHigh          int
	SizeLimitLow           int
	ReplaceByFeeRatio      Percent
	PruneCooldown          time.Duration
	GasLimitOverestimation float64
}

func (*MpoolConfig) Clone added in v0.5.0

func (mc *MpoolConfig) Clone() *MpoolConfig

type MsgMeta

type MsgMeta struct {
	BlsMessages   cid.Cid
	SecpkMessages cid.Cid
}

func (*MsgMeta) Cid

func (mm *MsgMeta) Cid() cid.Cid

func (*MsgMeta) MarshalCBOR

func (t *MsgMeta) MarshalCBOR(w io.Writer) error

func (*MsgMeta) ToStorageBlock

func (mm *MsgMeta) ToStorageBlock() (block.Block, error)

func (*MsgMeta) UnmarshalCBOR

func (t *MsgMeta) UnmarshalCBOR(r io.Reader) (err error)

type Percent added in v1.20.2

type Percent int64

Percent stores a signed percentage as an int64. When converted to a string (or json), it's stored as a decimal with two places (e.g., 100% -> 1.00).

func (Percent) MarshalJSON added in v1.20.2

func (p Percent) MarshalJSON() ([]byte, error)

func (Percent) String added in v1.20.2

func (p Percent) String() string

func (*Percent) UnmarshalJSON added in v1.20.2

func (p *Percent) UnmarshalJSON(b []byte) error

type RawMessage added in v0.10.1

type RawMessage Message

type RawSignedMessage added in v0.10.1

type RawSignedMessage SignedMessage

type ReturnTrace added in v1.23.0

type ReturnTrace struct {
	ExitCode    exitcode.ExitCode
	Return      []byte
	ReturnCodec uint64
}

func (*ReturnTrace) MarshalCBOR added in v1.23.0

func (t *ReturnTrace) MarshalCBOR(w io.Writer) error

func (*ReturnTrace) UnmarshalCBOR added in v1.23.0

func (t *ReturnTrace) UnmarshalCBOR(r io.Reader) (err error)

type SignedMessage

type SignedMessage struct {
	Message   Message
	Signature crypto.Signature
}

func DecodeSignedMessage

func DecodeSignedMessage(data []byte) (*SignedMessage, error)

func (*SignedMessage) ChainLength added in v0.3.0

func (sm *SignedMessage) ChainLength() int

func (*SignedMessage) Cid

func (sm *SignedMessage) Cid() cid.Cid

func (*SignedMessage) MarshalCBOR

func (t *SignedMessage) MarshalCBOR(w io.Writer) error

func (*SignedMessage) MarshalJSON added in v0.10.1

func (sm *SignedMessage) MarshalJSON() ([]byte, error)

func (*SignedMessage) Serialize

func (sm *SignedMessage) Serialize() ([]byte, error)

func (*SignedMessage) Size

func (sm *SignedMessage) Size() int

func (*SignedMessage) ToStorageBlock

func (sm *SignedMessage) ToStorageBlock() (block.Block, error)

func (*SignedMessage) UnmarshalCBOR

func (t *SignedMessage) UnmarshalCBOR(r io.Reader) (err error)

func (*SignedMessage) VMMessage

func (sm *SignedMessage) VMMessage() *Message

type StateInfo0 added in v0.9.0

type StateInfo0 struct{}

TODO: version this.

func (*StateInfo0) MarshalCBOR added in v0.9.0

func (t *StateInfo0) MarshalCBOR(w io.Writer) error

func (*StateInfo0) UnmarshalCBOR added in v0.9.0

func (t *StateInfo0) UnmarshalCBOR(r io.Reader) (err error)

type StateRoot added in v0.7.2

type StateRoot struct {
	// State tree version.
	Version StateTreeVersion
	// Actors tree. The structure depends on the state root version.
	Actors cid.Cid
	// Info. The structure depends on the state root version.
	Info cid.Cid
}

func (*StateRoot) MarshalCBOR added in v0.7.2

func (t *StateRoot) MarshalCBOR(w io.Writer) error

func (*StateRoot) UnmarshalCBOR added in v0.7.2

func (t *StateRoot) UnmarshalCBOR(r io.Reader) (err error)

type StateTree

type StateTree interface {
	SetActor(addr address.Address, act *Actor) error
	// GetActor returns the actor from any type of `addr` provided.
	GetActor(addr address.Address) (*Actor, error)

	Version() StateTreeVersion
}

type StateTreeVersion added in v0.9.0

type StateTreeVersion uint64

StateTreeVersion is the version of the state tree itself, independent of the network version or the actors version.

const (
	// StateTreeVersion0 corresponds to actors < v2.
	StateTreeVersion0 StateTreeVersion = iota
	// StateTreeVersion1 corresponds to actors v2
	StateTreeVersion1
	// StateTreeVersion2 corresponds to actors v3.
	StateTreeVersion2
	// StateTreeVersion3 corresponds to actors v4.
	StateTreeVersion3
	// StateTreeVersion4 corresponds to actors v5 and above.
	StateTreeVersion4
	// StateTreeVersion5 corresponds to actors v10 and above.
	StateTreeVersion5
)

type Storage

type Storage interface {
	Put(cbg.CBORMarshaler) (cid.Cid, aerrors.ActorError)
	Get(cid.Cid, cbg.CBORUnmarshaler) aerrors.ActorError

	GetHead() cid.Cid

	// Commit sets the new head of the actors state as long as the current
	// state matches 'oldh'
	Commit(oldh cid.Cid, newh cid.Cid) aerrors.ActorError
}

type Ticket

type Ticket struct {
	VRFProof []byte
}

func (*Ticket) Equals

func (t *Ticket) Equals(ot *Ticket) bool

func (*Ticket) Less

func (t *Ticket) Less(o *Ticket) bool

func (*Ticket) MarshalCBOR

func (t *Ticket) MarshalCBOR(w io.Writer) error

func (*Ticket) Quality added in v0.5.0

func (t *Ticket) Quality() float64

func (*Ticket) UnmarshalCBOR

func (t *Ticket) UnmarshalCBOR(r io.Reader) (err error)

type TipSet

type TipSet struct {
	// contains filtered or unexported fields
}

func NewTipSet

func NewTipSet(blks []*BlockHeader) (*TipSet, error)

Checks:

  • A tipset is composed of at least one block. (Because of our variable number of blocks per tipset, determined by randomness, we do not impose an upper limit.)
  • All blocks have the same height.
  • All blocks have the same parents (same number of them and matching CIDs).

func (*TipSet) Blocks

func (ts *TipSet) Blocks() []*BlockHeader

func (*TipSet) Cids

func (ts *TipSet) Cids() []cid.Cid

func (*TipSet) Contains

func (ts *TipSet) Contains(oc cid.Cid) bool

func (*TipSet) Equals

func (ts *TipSet) Equals(ots *TipSet) bool

func (*TipSet) Height

func (ts *TipSet) Height() abi.ChainEpoch

func (*TipSet) IsChildOf added in v0.5.0

func (ts *TipSet) IsChildOf(parent *TipSet) bool

func (*TipSet) Key

func (ts *TipSet) Key() TipSetKey

func (*TipSet) MarshalCBOR

func (ts *TipSet) MarshalCBOR(w io.Writer) error

func (*TipSet) MarshalJSON

func (ts *TipSet) MarshalJSON() ([]byte, error)

func (*TipSet) MinTicket

func (ts *TipSet) MinTicket() *Ticket

func (*TipSet) MinTicketBlock

func (ts *TipSet) MinTicketBlock() *BlockHeader

func (*TipSet) MinTimestamp

func (ts *TipSet) MinTimestamp() uint64

func (*TipSet) ParentMessageReceipts added in v1.23.0

func (ts *TipSet) ParentMessageReceipts() cid.Cid

func (*TipSet) ParentState

func (ts *TipSet) ParentState() cid.Cid

func (*TipSet) ParentWeight

func (ts *TipSet) ParentWeight() BigInt

func (*TipSet) Parents

func (ts *TipSet) Parents() TipSetKey

func (*TipSet) String added in v0.5.2

func (ts *TipSet) String() string

func (*TipSet) UnmarshalCBOR

func (ts *TipSet) UnmarshalCBOR(r io.Reader) error

func (*TipSet) UnmarshalJSON

func (ts *TipSet) UnmarshalJSON(b []byte) error

type TipSetKey

type TipSetKey struct {
	// contains filtered or unexported fields
}

A TipSetKey is an immutable collection of CIDs forming a unique key for a tipset. The CIDs are assumed to be distinct and in canonical order. Two keys with the same CIDs in a different order are not considered equal. TipSetKey is a lightweight value type, and may be compared for equality with ==.

func NewTipSetKey

func NewTipSetKey(cids ...cid.Cid) TipSetKey

NewTipSetKey builds a new key from a slice of CIDs. The CIDs are assumed to be ordered correctly.

func TipSetKeyFromBytes

func TipSetKeyFromBytes(encoded []byte) (TipSetKey, error)

TipSetKeyFromBytes wraps an encoded key, validating correct decoding.

func (TipSetKey) Bytes

func (k TipSetKey) Bytes() []byte

Bytes() returns a binary representation of the key.

func (TipSetKey) Cid added in v1.20.0

func (k TipSetKey) Cid() (cid.Cid, error)

func (TipSetKey) Cids

func (k TipSetKey) Cids() []cid.Cid

Cids returns a slice of the CIDs comprising this key.

func (TipSetKey) IsEmpty added in v0.2.8

func (k TipSetKey) IsEmpty() bool

func (TipSetKey) MarshalCBOR added in v1.17.0

func (k TipSetKey) MarshalCBOR(writer io.Writer) error

func (TipSetKey) MarshalJSON

func (k TipSetKey) MarshalJSON() ([]byte, error)

func (TipSetKey) String

func (k TipSetKey) String() string

String() returns a human-readable representation of the key.

func (TipSetKey) ToStorageBlock added in v1.20.0

func (k TipSetKey) ToStorageBlock() (block.Block, error)

func (*TipSetKey) UnmarshalCBOR added in v1.17.0

func (k *TipSetKey) UnmarshalCBOR(reader io.Reader) error

func (*TipSetKey) UnmarshalJSON

func (k *TipSetKey) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL