Documentation ¶
Index ¶
- Constants
- Variables
- func ActorStore(ctx context.Context, bs bstore.Blockstore) adt.Store
- func ComputeNextBaseFee(baseFee types.BigInt, gasLimitUsed int64, noOfBlocks int, epoch abi.ChainEpoch) types.BigInt
- func DrawRandomness(rbase []byte, pers crypto.DomainSeparationTag, round abi.ChainEpoch, ...) ([]byte, error)
- func NewChainRand(cs *ChainStore, blks []cid.Cid) vm.Rand
- func PutMessage(bs bstore.Blockstore, m storable) (cid.Cid, error)
- func ReorgOps(lts func(types.TipSetKey) (*types.TipSet, error), a, b *types.TipSet) ([]*types.TipSet, []*types.TipSet, error)
- type BlockMessages
- type ChainIndex
- type ChainStore
- func (cs *ChainStore) AddBlock(ctx context.Context, b *types.BlockHeader) error
- func (cs *ChainStore) AddToTipSetTracker(b *types.BlockHeader) error
- func (cs *ChainStore) BlockMsgsForTipset(ts *types.TipSet) ([]BlockMessages, error)
- func (cs *ChainStore) Blockstore() bstore.Blockstore
- func (cs *ChainStore) ComputeBaseFee(ctx context.Context, ts *types.TipSet) (abi.TokenAmount, error)
- func (cs *ChainStore) Contains(ts *types.TipSet) (bool, error)
- func (cs *ChainStore) Export(ctx context.Context, ts *types.TipSet, inclRecentRoots abi.ChainEpoch, ...) error
- func (cs *ChainStore) GetBeaconRandomness(ctx context.Context, blks []cid.Cid, pers crypto.DomainSeparationTag, ...) ([]byte, error)
- func (cs *ChainStore) GetBlock(c cid.Cid) (*types.BlockHeader, error)
- func (cs *ChainStore) GetCMessage(c cid.Cid) (types.ChainMsg, error)
- func (cs *ChainStore) GetChainRandomness(ctx context.Context, blks []cid.Cid, pers crypto.DomainSeparationTag, ...) ([]byte, error)
- func (cs *ChainStore) GetGenesis() (*types.BlockHeader, error)
- func (cs *ChainStore) GetHeaviestTipSet() *types.TipSet
- func (cs *ChainStore) GetLatestBeaconEntry(ts *types.TipSet) (*types.BeaconEntry, error)
- func (cs *ChainStore) GetMessage(c cid.Cid) (*types.Message, error)
- func (cs *ChainStore) GetParentReceipt(b *types.BlockHeader, i int) (*types.MessageReceipt, error)
- func (cs *ChainStore) GetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*api.HeadChange, error)
- func (cs *ChainStore) GetSignedMessage(c cid.Cid) (*types.SignedMessage, error)
- func (cs *ChainStore) GetTipSetFromKey(tsk types.TipSetKey) (*types.TipSet, error)
- func (cs *ChainStore) GetTipsetByHeight(ctx context.Context, h abi.ChainEpoch, ts *types.TipSet, prev bool) (*types.TipSet, error)
- func (cs *ChainStore) Import(r io.Reader) (*types.TipSet, error)
- func (cs *ChainStore) IsAncestorOf(a, b *types.TipSet) (bool, error)
- func (cs *ChainStore) IsBlockValidated(ctx context.Context, blkid cid.Cid) (bool, error)
- func (cs *ChainStore) Load() error
- func (cs *ChainStore) LoadMessagesFromCids(cids []cid.Cid) ([]*types.Message, error)
- func (cs *ChainStore) LoadSignedMessagesFromCids(cids []cid.Cid) ([]*types.SignedMessage, error)
- func (cs *ChainStore) LoadTipSet(tsk types.TipSetKey) (*types.TipSet, error)
- func (cs *ChainStore) MarkBlockAsValidated(ctx context.Context, blkid cid.Cid) error
- func (cs *ChainStore) MaybeTakeHeavierTipSet(ctx context.Context, ts *types.TipSet) error
- func (cs *ChainStore) MessagesForBlock(b *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error)
- func (cs *ChainStore) MessagesForTipset(ts *types.TipSet) ([]types.ChainMsg, error)
- func (cs *ChainStore) NearestCommonAncestor(a, b *types.TipSet) (*types.TipSet, error)
- func (cs *ChainStore) PersistBlockHeaders(b ...*types.BlockHeader) error
- func (cs *ChainStore) PutMessage(m storable) (cid.Cid, error)
- func (cs *ChainStore) PutTipSet(ctx context.Context, ts *types.TipSet) error
- func (cs *ChainStore) ReadMsgMetaCids(mmc cid.Cid) ([]cid.Cid, []cid.Cid, error)
- func (cs *ChainStore) ReorgOps(a, b *types.TipSet) ([]*types.TipSet, []*types.TipSet, error)
- func (cs *ChainStore) SetGenesis(b *types.BlockHeader) error
- func (cs *ChainStore) SetHead(ts *types.TipSet) error
- func (cs *ChainStore) Store(ctx context.Context) adt.Store
- func (cs *ChainStore) SubHeadChanges(ctx context.Context) chan []*api.HeadChange
- func (cs *ChainStore) SubscribeHeadChanges(f ReorgNotifee)
- func (cs *ChainStore) TryFillTipSet(ts *types.TipSet) (*FullTipSet, error)
- func (cs *ChainStore) UnmarkBlockAsValidated(ctx context.Context, blkid cid.Cid) error
- func (cs *ChainStore) VMSys() vm.SyscallBuilder
- func (cs *ChainStore) Weight(ctx context.Context, ts *types.TipSet) (types.BigInt, error)
- type FullTipSet
- type HeadChangeEvt
- type ReorgNotifee
Constants ¶
const ( HCRevert = "revert" HCApply = "apply" HCCurrent = "current" )
Variables ¶
var DefaultChainIndexCacheSize = 32 << 10
var DefaultMsgMetaCacheSize = 2048
var DefaultTipSetCacheSize = 8192
Functions ¶
func ActorStore ¶ added in v0.3.0
func ComputeNextBaseFee ¶ added in v0.7.0
func DrawRandomness ¶ added in v0.3.0
func DrawRandomness(rbase []byte, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
func NewChainRand ¶
func NewChainRand(cs *ChainStore, blks []cid.Cid) vm.Rand
func PutMessage ¶
func PutMessage(bs bstore.Blockstore, m storable) (cid.Cid, error)
Types ¶
type BlockMessages ¶ added in v0.5.0
type ChainIndex ¶ added in v0.4.0
type ChainIndex struct {
// contains filtered or unexported fields
}
func NewChainIndex ¶ added in v0.4.0
func NewChainIndex(lts loadTipSetFunc) *ChainIndex
func (*ChainIndex) GetTipsetByHeight ¶ added in v0.4.0
func (ci *ChainIndex) GetTipsetByHeight(_ context.Context, from *types.TipSet, to abi.ChainEpoch) (*types.TipSet, error)
func (*ChainIndex) GetTipsetByHeightWithoutCache ¶ added in v0.4.0
func (ci *ChainIndex) GetTipsetByHeightWithoutCache(from *types.TipSet, to abi.ChainEpoch) (*types.TipSet, error)
type ChainStore ¶
type ChainStore struct {
// contains filtered or unexported fields
}
ChainStore is the main point of access to chain data.
Raw chain data is stored in the Blockstore, with relevant markers (genesis, latest head tipset references) being tracked in the Datastore (key-value store).
To alleviate disk access, the ChainStore has two ARC caches:
- a tipset cache
- a block => messages references cache.
func NewChainStore ¶
func NewChainStore(bs bstore.Blockstore, ds dstore.Batching, vmcalls vm.SyscallBuilder) *ChainStore
func (*ChainStore) AddBlock ¶
func (cs *ChainStore) AddBlock(ctx context.Context, b *types.BlockHeader) error
func (*ChainStore) AddToTipSetTracker ¶
func (cs *ChainStore) AddToTipSetTracker(b *types.BlockHeader) error
func (*ChainStore) BlockMsgsForTipset ¶ added in v0.5.0
func (cs *ChainStore) BlockMsgsForTipset(ts *types.TipSet) ([]BlockMessages, error)
func (*ChainStore) Blockstore ¶
func (cs *ChainStore) Blockstore() bstore.Blockstore
func (*ChainStore) ComputeBaseFee ¶ added in v0.5.0
func (cs *ChainStore) ComputeBaseFee(ctx context.Context, ts *types.TipSet) (abi.TokenAmount, error)
func (*ChainStore) Contains ¶
func (cs *ChainStore) Contains(ts *types.TipSet) (bool, error)
Contains returns whether our BlockStore has all blocks in the supplied TipSet.
func (*ChainStore) GetBeaconRandomness ¶ added in v0.5.0
func (cs *ChainStore) GetBeaconRandomness(ctx context.Context, blks []cid.Cid, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
func (*ChainStore) GetBlock ¶
func (cs *ChainStore) GetBlock(c cid.Cid) (*types.BlockHeader, error)
GetBlock fetches a BlockHeader with the supplied CID. It returns blockstore.ErrNotFound if the block was not found in the BlockStore.
func (*ChainStore) GetCMessage ¶
func (cs *ChainStore) GetCMessage(c cid.Cid) (types.ChainMsg, error)
func (*ChainStore) GetChainRandomness ¶ added in v0.5.0
func (cs *ChainStore) GetChainRandomness(ctx context.Context, blks []cid.Cid, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error)
func (*ChainStore) GetGenesis ¶
func (cs *ChainStore) GetGenesis() (*types.BlockHeader, error)
func (*ChainStore) GetHeaviestTipSet ¶
func (cs *ChainStore) GetHeaviestTipSet() *types.TipSet
GetHeaviestTipSet returns the current heaviest tipset known (i.e. our head).
func (*ChainStore) GetLatestBeaconEntry ¶ added in v0.3.0
func (cs *ChainStore) GetLatestBeaconEntry(ts *types.TipSet) (*types.BeaconEntry, error)
func (*ChainStore) GetMessage ¶
func (cs *ChainStore) GetMessage(c cid.Cid) (*types.Message, error)
func (*ChainStore) GetParentReceipt ¶
func (cs *ChainStore) GetParentReceipt(b *types.BlockHeader, i int) (*types.MessageReceipt, error)
func (*ChainStore) GetPath ¶ added in v0.2.5
func (cs *ChainStore) GetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*api.HeadChange, error)
func (*ChainStore) GetSignedMessage ¶
func (cs *ChainStore) GetSignedMessage(c cid.Cid) (*types.SignedMessage, error)
func (*ChainStore) GetTipSetFromKey ¶ added in v0.2.8
func (*ChainStore) GetTipsetByHeight ¶
func (cs *ChainStore) GetTipsetByHeight(ctx context.Context, h abi.ChainEpoch, ts *types.TipSet, prev bool) (*types.TipSet, error)
GetTipsetByHeight returns the tipset on the chain behind 'ts' at the given height. In the case that the given height is a null round, the 'prev' flag selects the tipset before the null round if true, and the tipset following the null round if false.
func (*ChainStore) IsAncestorOf ¶
func (cs *ChainStore) IsAncestorOf(a, b *types.TipSet) (bool, error)
IsAncestorOf returns true if 'a' is an ancestor of 'b'
func (*ChainStore) IsBlockValidated ¶ added in v0.4.0
func (cs *ChainStore) IsBlockValidated(ctx context.Context, blkid cid.Cid) (bool, error)
func (*ChainStore) Load ¶
func (cs *ChainStore) Load() error
func (*ChainStore) LoadMessagesFromCids ¶
func (cs *ChainStore) LoadMessagesFromCids(cids []cid.Cid) ([]*types.Message, error)
func (*ChainStore) LoadSignedMessagesFromCids ¶
func (cs *ChainStore) LoadSignedMessagesFromCids(cids []cid.Cid) ([]*types.SignedMessage, error)
func (*ChainStore) LoadTipSet ¶
func (*ChainStore) MarkBlockAsValidated ¶ added in v0.4.0
func (cs *ChainStore) MarkBlockAsValidated(ctx context.Context, blkid cid.Cid) error
func (*ChainStore) MaybeTakeHeavierTipSet ¶
MaybeTakeHeavierTipSet evaluates the incoming tipset and locks it in our internal state as our new head, if and only if it is heavier than the current head.
func (*ChainStore) MessagesForBlock ¶
func (cs *ChainStore) MessagesForBlock(b *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error)
func (*ChainStore) MessagesForTipset ¶
func (*ChainStore) NearestCommonAncestor ¶
func (*ChainStore) PersistBlockHeaders ¶
func (cs *ChainStore) PersistBlockHeaders(b ...*types.BlockHeader) error
func (*ChainStore) PutMessage ¶
func (cs *ChainStore) PutMessage(m storable) (cid.Cid, error)
func (*ChainStore) ReadMsgMetaCids ¶ added in v0.5.8
func (cs *ChainStore) ReadMsgMetaCids(mmc cid.Cid) ([]cid.Cid, []cid.Cid, error)
func (*ChainStore) SetGenesis ¶
func (cs *ChainStore) SetGenesis(b *types.BlockHeader) error
func (*ChainStore) SetHead ¶
func (cs *ChainStore) SetHead(ts *types.TipSet) error
SetHead sets the chainstores current 'best' head node. This should only be called if something is broken and needs fixing
func (*ChainStore) Store ¶ added in v0.3.0
func (cs *ChainStore) Store(ctx context.Context) adt.Store
func (*ChainStore) SubHeadChanges ¶
func (cs *ChainStore) SubHeadChanges(ctx context.Context) chan []*api.HeadChange
func (*ChainStore) SubscribeHeadChanges ¶
func (cs *ChainStore) SubscribeHeadChanges(f ReorgNotifee)
func (*ChainStore) TryFillTipSet ¶
func (cs *ChainStore) TryFillTipSet(ts *types.TipSet) (*FullTipSet, error)
func (*ChainStore) UnmarkBlockAsValidated ¶ added in v0.8.1
func (cs *ChainStore) UnmarkBlockAsValidated(ctx context.Context, blkid cid.Cid) error
func (*ChainStore) VMSys ¶ added in v0.2.1
func (cs *ChainStore) VMSys() vm.SyscallBuilder
type FullTipSet ¶
FullTipSet is an expanded version of the TipSet that contains all the blocks and messages
func NewFullTipSet ¶
func NewFullTipSet(blks []*types.FullBlock) *FullTipSet
func (*FullTipSet) Cids ¶
func (fts *FullTipSet) Cids() []cid.Cid
func (*FullTipSet) TipSet ¶
func (fts *FullTipSet) TipSet() *types.TipSet
TipSet returns a narrower view of this FullTipSet elliding the block messages.
type HeadChangeEvt ¶ added in v0.7.1
type HeadChangeEvt struct { From types.TipSetKey FromHeight abi.ChainEpoch To types.TipSetKey ToHeight abi.ChainEpoch RevertCount int ApplyCount int }
type ReorgNotifee ¶ added in v0.4.0
ReorgNotifee represents a callback that gets called upon reorgs.