types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: Apache-2.0, MIT Imports: 28 Imported by: 547

Documentation

Index

Constants

View Source
const BigIntMaxSerializedLen = 128 // is this big enough? or too big?
View Source
const MessageVersion = 0

Variables

View Source
var (
	ErrKeyInfoNotFound = fmt.Errorf("key info not found")
	ErrKeyExists       = fmt.Errorf("key already exists")
)
View Source
var EmptyInt = BigInt{}
View Source
var EmptyTSK = TipSetKey{}
View Source
var ErrActorNotFound = init_.ErrAddressNotFound
View Source
var TotalFilecoinInt = FromFil(build.TotalFilecoin)

Functions

func BigCmp

func BigCmp(a, b BigInt) int

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 DeciStr added in v0.3.0

func DeciStr(bi BigInt) string

func DecodeSignedVoucher

func DecodeSignedVoucher(s string) (*paych.SignedVoucher, error)

func IsTicketWinner

func IsTicketWinner(vrfTicket []byte, mypow BigInt, totpow BigInt) bool

func SizeStr added in v0.3.0

func SizeStr(bi BigInt) string

Types

type Actor

type Actor 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
}

func (*Actor) IsAccountActor added in v0.3.0

func (a *Actor) IsAccountActor() bool

func (*Actor) MarshalCBOR

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

func (*Actor) UnmarshalCBOR

func (t *Actor) UnmarshalCBOR(r io.Reader) 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) 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

	Ticket *Ticket // 1

	ElectionProof *ElectionProof // 2

	BeaconEntries []BeaconEntry // 3

	WinPoStProof []abi.PoStProof // 4

	Parents []cid.Cid // 5

	ParentWeight BigInt // 6

	Height abi.ChainEpoch // 7

	ParentStateRoot cid.Cid // 8

	ParentMessageReceipts cid.Cid // 8

	Messages cid.Cid // 10

	BLSAggregate *crypto.Signature // 11

	Timestamp uint64 // 12

	BlockSig *crypto.Signature // 13

	ForkSignaling uint64 // 14
	// 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

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) error

type ChainMsg added in v0.3.0

type ChainMsg interface {
	Cid() cid.Cid
	VMMessage() *Message
	ToStorageBlock() (block.Block, error)
	ChainLength() int
}

type ElectionProof added in v0.3.0

type ElectionProof struct {
	VRFProof []byte
}

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 ExecutionResult added in v0.3.0

type ExecutionResult struct {
	Msg      *Message
	MsgRct   *MessageReceipt
	Error    string
	Duration time.Duration

	Subcalls []*ExecutionResult
}

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) error

type FIL

type FIL BigInt

func ParseFIL

func ParseFIL(s string) (FIL, error)

func (FIL) Format

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

func (FIL) String

func (f FIL) String() string

type FullBlock

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

func (*FullBlock) Cid

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

type KeyInfo

type KeyInfo struct {
	Type       string
	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 LogCids

type LogCids []cid.Cid

func (LogCids) MarshalLogArray

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

type Message

type Message struct {
	Version int64

	To   address.Address
	From address.Address

	Nonce uint64

	Value BigInt

	GasPrice BigInt
	GasLimit int64

	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) Equals

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

func (*Message) MarshalCBOR

func (t *Message) MarshalCBOR(w io.Writer) 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) error

func (*Message) VMMessage

func (m *Message) VMMessage() *Message

func (*Message) ValidForBlockInclusion added in v0.3.0

func (m *Message) ValidForBlockInclusion(minGas int64) 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
}

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 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) 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 (m *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) 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 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)
}

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) UnmarshalCBOR

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

type TipSet

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

func NewTipSet

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

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) 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) 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) 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) 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) 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) 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