Documentation ¶
Index ¶
- Constants
- Variables
- func BigCmp(a, b BigInt) int
- func CidArrsContains(a []cid.Cid, b cid.Cid) bool
- func CidArrsEqual(a, b []cid.Cid) bool
- func CidArrsSubset(a, b []cid.Cid) bool
- func DeciStr(bi BigInt) string
- func IsTicketWinner(vrfTicket []byte, mypow BigInt, totpow BigInt) bool
- func SizeStr(bi BigInt) string
- type Actor
- type BeaconEntry
- type BigInt
- type BlockHeader
- func (blk *BlockHeader) Cid() cid.Cid
- func (blk *BlockHeader) IsValidated() bool
- func (blk *BlockHeader) LastTicket() *Ticket
- func (t *BlockHeader) MarshalCBOR(w io.Writer) error
- func (blk *BlockHeader) Serialize() ([]byte, error)
- func (blk *BlockHeader) SetValidated()
- func (blk *BlockHeader) SigningBytes() ([]byte, error)
- func (blk *BlockHeader) ToStorageBlock() (block.Block, error)
- func (t *BlockHeader) UnmarshalCBOR(r io.Reader) error
- type BlockMsg
- type ChainMsg
- type ElectionProof
- type ExecutionTrace
- type ExpTipSet
- type FIL
- type FullBlock
- type GasTrace
- type KeyInfo
- type KeyStore
- type KeyType
- type Loc
- type LogCids
- type Message
- func (m *Message) Caller() address.Address
- func (m *Message) ChainLength() int
- func (m *Message) Cid() cid.Cid
- func (m *Message) EqualCall(o *Message) bool
- func (m *Message) Equals(o *Message) bool
- func (t *Message) MarshalCBOR(w io.Writer) error
- func (m *Message) MarshalJSON() ([]byte, error)
- func (m *Message) Receiver() address.Address
- func (m *Message) RequiredFunds() BigInt
- func (m *Message) Serialize() ([]byte, error)
- func (m *Message) ToStorageBlock() (block.Block, error)
- func (t *Message) UnmarshalCBOR(r io.Reader) error
- func (m *Message) VMMessage() *Message
- func (m *Message) ValidForBlockInclusion(minGas int64, version network.Version) error
- func (m *Message) ValueReceived() abi.TokenAmount
- type MessageReceipt
- type MpoolConfig
- type MsgMeta
- type RawMessage
- type RawSignedMessage
- type SignedMessage
- func (sm *SignedMessage) ChainLength() int
- func (sm *SignedMessage) Cid() cid.Cid
- func (t *SignedMessage) MarshalCBOR(w io.Writer) error
- func (sm *SignedMessage) MarshalJSON() ([]byte, error)
- func (sm *SignedMessage) Serialize() ([]byte, error)
- func (sm *SignedMessage) Size() int
- func (sm *SignedMessage) ToStorageBlock() (block.Block, error)
- func (t *SignedMessage) UnmarshalCBOR(r io.Reader) error
- func (sm *SignedMessage) VMMessage() *Message
- type StateInfo0
- type StateRoot
- type StateTree
- type StateTreeVersion
- type Storage
- type Ticket
- type TipSet
- func (ts *TipSet) Blocks() []*BlockHeader
- func (ts *TipSet) Cids() []cid.Cid
- func (ts *TipSet) Contains(oc cid.Cid) bool
- func (ts *TipSet) Equals(ots *TipSet) bool
- func (ts *TipSet) Height() abi.ChainEpoch
- func (ts *TipSet) IsChildOf(parent *TipSet) bool
- func (ts *TipSet) Key() TipSetKey
- func (ts *TipSet) MarshalCBOR(w io.Writer) error
- func (ts *TipSet) MarshalJSON() ([]byte, error)
- func (ts *TipSet) MinTicket() *Ticket
- func (ts *TipSet) MinTicketBlock() *BlockHeader
- func (ts *TipSet) MinTimestamp() uint64
- func (ts *TipSet) ParentState() cid.Cid
- func (ts *TipSet) ParentWeight() BigInt
- func (ts *TipSet) Parents() TipSetKey
- func (ts *TipSet) String() string
- func (ts *TipSet) UnmarshalCBOR(r io.Reader) error
- func (ts *TipSet) UnmarshalJSON(b []byte) error
- type TipSetKey
Constants ¶
const BigIntMaxSerializedLen = 128 // is this big enough? or too big?
const MessageVersion = 0
const TestGasLimit = 100e6
Variables ¶
var ( ErrKeyInfoNotFound = fmt.Errorf("key info not found") ErrKeyExists = fmt.Errorf("key already exists") )
var EmptyInt = BigInt{}
var EmptyTSK = TipSetKey{}
var ErrActorNotFound = errors.New("actor not found")
var MaxWinCount = 3 * int64(build.BlocksPerEpoch)
var TotalFilecoinInt = FromFil(build.FilBase)
Functions ¶
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
Types ¶
type Actor ¶
type BeaconEntry ¶ added in v0.3.0
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) error
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 []proof2.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) error
type BlockMsg ¶
type BlockMsg struct { Header *BlockHeader BlsMessages []cid.Cid SecpkMessages []cid.Cid }
func DecodeBlockMsg ¶
type ElectionProof ¶ added in v0.3.0
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) error
type ExecutionTrace ¶ added in v0.4.0
type ExecutionTrace struct { Msg *Message MsgRct *MessageReceipt Error string Duration time.Duration GasCharges []*GasTrace Subcalls []ExecutionTrace }
type ExpTipSet ¶
type ExpTipSet struct { Cids []cid.Cid Blocks []*BlockHeader Height abi.ChainEpoch }
type FIL ¶
type FIL BigInt
func MustParseFIL ¶ added in v0.10.2
func (FIL) MarshalText ¶ added in v0.5.0
func (FIL) UnmarshalText ¶ added in v0.5.0
type FullBlock ¶
type FullBlock struct { Header *BlockHeader BlsMessages []*Message SecpkMessages []*SignedMessage }
type GasTrace ¶ added in v0.4.0
type GasTrace struct { Name string Location []Loc `json:"loc"` TotalGas int64 `json:"tg"` ComputeGas int64 `json:"cg"` StorageGas int64 `json:"sg"` TotalVirtualGas int64 `json:"vtg"` VirtualComputeGas int64 `json:"vcg"` VirtualStorageGas int64 `json:"vsg"` TimeTaken time.Duration `json:"tt"` Extra interface{} `json:"ex,omitempty"` Callers []uintptr `json:"-"` }
func (*GasTrace) MarshalJSON ¶ added in v0.4.0
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
func (*KeyType) UnmarshalJSON ¶ added in v0.10.1
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 (*Message) ChainLength ¶ added in v0.3.0
func (*Message) MarshalJSON ¶ added in v0.10.1
func (*Message) RequiredFunds ¶
func (*Message) ValidForBlockInclusion ¶ added in v0.3.0
func (*Message) ValueReceived ¶ added in v0.3.0
func (m *Message) ValueReceived() abi.TokenAmount
type MessageReceipt ¶
func (*MessageReceipt) Equals ¶
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool
func (*MessageReceipt) MarshalCBOR ¶
func (t *MessageReceipt) MarshalCBOR(w io.Writer) error
func (*MessageReceipt) UnmarshalCBOR ¶
func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error
type MpoolConfig ¶ added in v0.5.0
type MpoolConfig struct { PriorityAddrs []address.Address SizeLimitHigh int SizeLimitLow int ReplaceByFeeRatio float64 PruneCooldown time.Duration GasLimitOverestimation float64 }
func (*MpoolConfig) Clone ¶ added in v0.5.0
func (mc *MpoolConfig) Clone() *MpoolConfig
type RawMessage ¶ added in v0.10.1
type RawMessage Message
type RawSignedMessage ¶ added in v0.10.1
type RawSignedMessage SignedMessage
type SignedMessage ¶
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) 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) 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 }
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 )
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 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) Height ¶
func (ts *TipSet) Height() abi.ChainEpoch
func (*TipSet) MarshalJSON ¶
func (*TipSet) MinTicketBlock ¶
func (ts *TipSet) MinTicketBlock() *BlockHeader
func (*TipSet) MinTimestamp ¶
func (*TipSet) ParentState ¶
func (ts *TipSet) ParentState() cid.Cid
func (*TipSet) ParentWeight ¶
func (*TipSet) UnmarshalJSON ¶
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 ¶
TipSetKeyFromBytes wraps an encoded key, validating correct decoding.
func (TipSetKey) Cids ¶
func (k TipSetKey) Cids() []cid.Cid
Cids returns a slice of the CIDs comprising this key.