Documentation
¶
Index ¶
- Variables
- type ChainMessage
- type ChainStateReadWriter
- func (chn *ChainStateReadWriter) AccountStateView(ts *block.TipSet) (state.AccountStateView, error)
- func (chn *ChainStateReadWriter) ChainExport(ctx context.Context, head block.TipSetKey, out io.Writer) error
- func (chn *ChainStateReadWriter) ChainGetRandomnessFromBeacon(ctx context.Context, tsk block.TipSetKey, ...) (abi.Randomness, error)
- func (chn *ChainStateReadWriter) ChainNotify(ctx context.Context) chan []*chain.HeadChange
- func (chn *ChainStateReadWriter) ChainStateTree(ctx context.Context, c cid.Cid) ([]format.Node, error)
- func (chn *ChainStateReadWriter) FaultStateView(ts *block.TipSet) (slashing.FaultStateView, error)
- func (chn *ChainStateReadWriter) GetActorAt(ctx context.Context, ts *block.TipSet, addr address.Address) (*types.Actor, error)
- func (chn *ChainStateReadWriter) GetActorSignature(ctx context.Context, actorAddr address.Address, method abi.MethodNum) (vm.ActorMethodSignature, error)
- func (chn *ChainStateReadWriter) GetBlock(ctx context.Context, id cid.Cid) (*block.Block, error)
- func (chn *ChainStateReadWriter) GetGenesisBlock(ctx context.Context) (*block.Block, error)
- func (chn *ChainStateReadWriter) GetHeadHeight() (abi.ChainEpoch, error)
- func (chn *ChainStateReadWriter) GetMessages(ctx context.Context, metaCid cid.Cid) ([]*types.UnsignedMessage, []*types.SignedMessage, error)
- func (chn *ChainStateReadWriter) GetReceipts(ctx context.Context, id cid.Cid) ([]types.MessageReceipt, error)
- func (chn *ChainStateReadWriter) GetTipSet(key block.TipSetKey) (*block.TipSet, error)
- func (chn *ChainStateReadWriter) GetTipSetByHeight(ctx context.Context, ts *block.TipSet, h abi.ChainEpoch, prev bool) (*block.TipSet, error)
- func (chn *ChainStateReadWriter) GetTipSetState(ctx context.Context, ts *block.TipSet) (vmstate.Tree, error)
- func (chn *ChainStateReadWriter) GetTipSetStateRoot(ctx context.Context, ts *block.TipSet) (cid.Cid, error)
- func (chn *ChainStateReadWriter) HasObj(ctx context.Context, obj cid.Cid) (bool, error)
- func (chn *ChainStateReadWriter) Head() *block.TipSet
- func (chn *ChainStateReadWriter) Ls(ctx context.Context, key block.TipSetKey) (*chain.TipsetIterator, error)
- func (chn *ChainStateReadWriter) LsActors(ctx context.Context) (map[address.Address]*types.Actor, error)
- func (chn *ChainStateReadWriter) ParentStateView(ts *block.TipSet) (*state.View, error)
- func (chn *ChainStateReadWriter) ReadObj(ctx context.Context, obj cid.Cid) ([]byte, error)
- func (chn *ChainStateReadWriter) ReadOnlyStateStore() util.ReadOnlyIpldStore
- func (chn *ChainStateReadWriter) ResolveAddressAt(ctx context.Context, ts *block.TipSet, addr address.Address) (address.Address, error)
- func (chn *ChainStateReadWriter) SampleChainRandomness(ctx context.Context, tsk block.TipSetKey, tag acrypto.DomainSeparationTag, ...) (abi.Randomness, error)
- func (chn *ChainStateReadWriter) SetHead(ctx context.Context, key block.TipSetKey) error
- func (chn *ChainStateReadWriter) StateView(ts *block.TipSet) (*state.View, error)
- func (chn *ChainStateReadWriter) Store(ctx context.Context) adt.Store
- type MsgLookup
- type WaitPredicate
- type Waiter
- func (w *Waiter) Find(ctx context.Context, msg types.ChainMsg, lookback abi.ChainEpoch, ...) (*ChainMessage, bool, error)
- func (w *Waiter) Wait(ctx context.Context, msg types.ChainMsg, confidence abi.ChainEpoch, ...) (*ChainMessage, error)
- func (w *Waiter) WaitPredicate(ctx context.Context, msg types.ChainMsg, confidence abi.ChainEpoch, ...) (*ChainMessage, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoMethod is returned by Get when there is no method signature (eg, transfer). ErrNoMethod = errors.New("no method") // ErrNoActorImpl is returned by Get when the actor implementation doesn't exist, eg // the actor address is an empty actor, an address that has received a transfer of FIL // but hasn't yet been upgraded to an account actor. (The actor implementation might // also genuinely be missing, which is not expected.) ErrNoActorImpl = errors.New("no actor implementation") )
Functions ¶
This section is empty.
Types ¶
type ChainMessage ¶
type ChainMessage struct { Ts *block.TipSet Message types.ChainMsg Block *block.Block Receipt *types.MessageReceipt }
ChainMessage is an on-chain message with its block and receipt.
type ChainStateReadWriter ¶
type ChainStateReadWriter struct { util.ReadOnlyIpldStore // contains filtered or unexported fields }
ChainStateReadWriter composes a: ChainReader providing read access to the chain and its associated state. ChainWriter providing write access to the chain head.
func NewChainStateReadWriter ¶
func NewChainStateReadWriter(crw chainReadWriter, messages chain.MessageProvider, bs blockstore.Blockstore, ba vm.ActorCodeLoader, drand beacon.Schedule) *ChainStateReadWriter
NewChainStateReadWriter returns a new ChainStateReadWriter.
func (*ChainStateReadWriter) AccountStateView ¶
func (chn *ChainStateReadWriter) AccountStateView(ts *block.TipSet) (state.AccountStateView, error)
func (*ChainStateReadWriter) ChainExport ¶
func (chn *ChainStateReadWriter) ChainExport(ctx context.Context, head block.TipSetKey, out io.Writer) error
ChainExport exports the chain from `head` up to and including the genesis block to `out`
func (*ChainStateReadWriter) ChainGetRandomnessFromBeacon ¶
func (chn *ChainStateReadWriter) ChainGetRandomnessFromBeacon(ctx context.Context, tsk block.TipSetKey, personalization acrypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
func (*ChainStateReadWriter) ChainNotify ¶
func (chn *ChainStateReadWriter) ChainNotify(ctx context.Context) chan []*chain.HeadChange
ChainNotify notify head change
func (*ChainStateReadWriter) ChainStateTree ¶
func (chn *ChainStateReadWriter) ChainStateTree(ctx context.Context, c cid.Cid) ([]format.Node, error)
ChainStateTree returns the state tree as a slice of IPLD nodes at the passed stateroot cid `c`.
func (*ChainStateReadWriter) FaultStateView ¶
func (chn *ChainStateReadWriter) FaultStateView(ts *block.TipSet) (slashing.FaultStateView, error)
func (*ChainStateReadWriter) GetActorAt ¶
func (chn *ChainStateReadWriter) GetActorAt(ctx context.Context, ts *block.TipSet, addr address.Address) (*types.Actor, error)
GetActorAt returns an actor at a specified tipset key.
func (*ChainStateReadWriter) GetActorSignature ¶
func (chn *ChainStateReadWriter) GetActorSignature(ctx context.Context, actorAddr address.Address, method abi.MethodNum) (vm.ActorMethodSignature, error)
GetActorSignature returns the signature of the given actor's given method. The function signature is typically used to enable a caller to decode the output of an actor method call (message).
func (*ChainStateReadWriter) GetGenesisBlock ¶
GetGenesisBlock returns the genesis block
func (*ChainStateReadWriter) GetHeadHeight ¶
func (chn *ChainStateReadWriter) GetHeadHeight() (abi.ChainEpoch, error)
func (*ChainStateReadWriter) GetMessages ¶
func (chn *ChainStateReadWriter) GetMessages(ctx context.Context, metaCid cid.Cid) ([]*types.UnsignedMessage, []*types.SignedMessage, error)
GetMessages gets a message collection by CID returned as unsigned bls and signed secp
func (*ChainStateReadWriter) GetReceipts ¶
func (chn *ChainStateReadWriter) GetReceipts(ctx context.Context, id cid.Cid) ([]types.MessageReceipt, error)
GetReceipts gets a receipt collection by CID.
func (*ChainStateReadWriter) GetTipSetByHeight ¶
func (chn *ChainStateReadWriter) GetTipSetByHeight(ctx context.Context, ts *block.TipSet, h abi.ChainEpoch, prev bool) (*block.TipSet, error)
ChainGetTipSetByHeight looks back for a tipset at the specified epoch
func (*ChainStateReadWriter) GetTipSetState ¶
func (*ChainStateReadWriter) GetTipSetStateRoot ¶
func (chn *ChainStateReadWriter) GetTipSetStateRoot(ctx context.Context, ts *block.TipSet) (cid.Cid, error)
GetTipSetStateRoot produces the state root for the provided tipset key.
func (*ChainStateReadWriter) HasObj ¶
func (chn *ChainStateReadWriter) HasObj(ctx context.Context, obj cid.Cid) (bool, error)
func (*ChainStateReadWriter) Head ¶
func (chn *ChainStateReadWriter) Head() *block.TipSet
Head returns the head tipset
func (*ChainStateReadWriter) Ls ¶
func (chn *ChainStateReadWriter) Ls(ctx context.Context, key block.TipSetKey) (*chain.TipsetIterator, error)
Ls returns an iterator over tipsets from head to genesis.
func (*ChainStateReadWriter) LsActors ¶
func (chn *ChainStateReadWriter) LsActors(ctx context.Context) (map[address.Address]*types.Actor, error)
LsActors returns a channel with actors from the latest state on the chain
func (*ChainStateReadWriter) ParentStateView ¶
func (*ChainStateReadWriter) ReadObj ¶
func (chn *ChainStateReadWriter) ReadObj(ctx context.Context, obj cid.Cid) ([]byte, error)
func (*ChainStateReadWriter) ReadOnlyStateStore ¶
func (chn *ChainStateReadWriter) ReadOnlyStateStore() util.ReadOnlyIpldStore
ReadOnlyStateStore returns a read-only state store.
func (*ChainStateReadWriter) ResolveAddressAt ¶
func (chn *ChainStateReadWriter) ResolveAddressAt(ctx context.Context, ts *block.TipSet, addr address.Address) (address.Address, error)
ResolveAddressAt resolves ID address for actor
func (*ChainStateReadWriter) SampleChainRandomness ¶
func (chn *ChainStateReadWriter) SampleChainRandomness(ctx context.Context, tsk block.TipSetKey, tag acrypto.DomainSeparationTag, epoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)
SampleChainRandomness computes randomness seeded by a ticket from the chain `head` at `sampleHeight`.
func (*ChainStateReadWriter) SetHead ¶
SetHead sets `key` as the new head of this chain iff it exists in the nodes chain store.
type MsgLookup ¶
type MsgLookup struct { Message cid.Cid // Can be different than requested, in case it was replaced, but only gas values changed Receipt types.MessageReceipt ReturnDec interface{} TipSet block.TipSetKey Height abi.ChainEpoch }
type WaitPredicate ¶
type WaitPredicate func(msg *types.UnsignedMessage, msgCid cid.Cid) bool
WaitPredicate is a function that identifies a message and returns true when found.
type Waiter ¶
type Waiter struct {
// contains filtered or unexported fields
}
Waiter waits for a message to appear on chain.
func NewWaiter ¶
func NewWaiter(chainStore waiterChainReader, messages chain.MessageProvider, bs bstore.Blockstore, cst cbor.IpldStore) *Waiter
NewWaiter returns a new Waiter.
func (*Waiter) Find ¶
func (w *Waiter) Find(ctx context.Context, msg types.ChainMsg, lookback abi.ChainEpoch, ts *block.TipSet) (*ChainMessage, bool, error)
Find searches the blockchain history (but doesn't wait).
func (*Waiter) Wait ¶
func (w *Waiter) Wait(ctx context.Context, msg types.ChainMsg, confidence abi.ChainEpoch, lookbackLimit abi.ChainEpoch) (*ChainMessage, error)
Wait uses WaitPredicate to invoke the callback when a message with the given cid appears on chain.
func (*Waiter) WaitPredicate ¶
func (w *Waiter) WaitPredicate(ctx context.Context, msg types.ChainMsg, confidence abi.ChainEpoch, lookback abi.ChainEpoch) (*ChainMessage, error)
WaitPredicate invokes the callback when the passed predicate succeeds. See api description.
Note: this method does too much -- the callback should just receive the tipset containing the message and the caller should pull the receipt out of the block if in fact that's what it wants to do, using something like receiptFromTipset. Something like receiptFromTipset is necessary because not every message in a block will have a receipt in the tipset: it might be a duplicate message. This method will always check for the message in the current head tipset. A lookback parameter > 1 will cause this method to check for the message in up to that many previous tipsets on the chain of the current head.