Versions in this module Expand all Collapse all v1 v1.1.1 Dec 18, 2024 Changes in this version + var ErrHeightIndexedVMNotImplemented = errors.New("vm does not implement HeightIndexedChainVM interface") + var ErrIndexIncomplete = errors.New("query failed because height index is incomplete") + var ErrRemoteVMNotImplemented = errors.New("vm does not implement RemoteVM interface") + var ErrStateSyncableVMNotImplemented = errors.New("vm does not implement StateSyncableVM interface") + func BatchedParseBlock(ctx context.Context, vm Parser, blks [][]byte) ([]snowman.Block, error) + func GetAncestors(ctx context.Context, vm Getter, blkID ids.ID, maxBlocksNum int, ...) ([][]byte, error) + type BatchedChainVM interface + BatchedParseBlock func(ctx context.Context, blks [][]byte) ([]snowman.Block, error) + GetAncestors func(ctx context.Context, blkID ids.ID, maxBlocksNum int, maxBlocksSize int, ...) ([][]byte, error) + type BuildBlockWithContextChainVM interface + BuildBlockWithContext func(ctx context.Context, blockCtx *Context) (snowman.Block, error) + type ChainVM interface + BuildBlock func(context.Context) (snowman.Block, error) + LastAccepted func(context.Context) (ids.ID, error) + SetPreference func(ctx context.Context, blkID ids.ID) error + type Context struct + PChainHeight uint64 + type Getter interface + GetBlock func(ctx context.Context, blkID ids.ID) (snowman.Block, error) + type HeightIndexedChainVM interface + GetBlockIDAtHeight func(ctx context.Context, height uint64) (ids.ID, error) + VerifyHeightIndex func(context.Context) error + type Parser interface + ParseBlock func(ctx context.Context, blockBytes []byte) (snowman.Block, error) + type StateSummary interface + Accept func(context.Context) (StateSyncMode, error) + Bytes func() []byte + Height func() uint64 + ID func() ids.ID + type StateSyncMode uint8 + const StateSyncDynamic + const StateSyncSkipped + const StateSyncStatic + func (s StateSyncMode) String() string + type StateSyncableVM interface + GetLastStateSummary func(context.Context) (StateSummary, error) + GetOngoingSyncStateSummary func(context.Context) (StateSummary, error) + GetStateSummary func(ctx context.Context, summaryHeight uint64) (StateSummary, error) + ParseStateSummary func(ctx context.Context, summaryBytes []byte) (StateSummary, error) + StateSyncEnabled func(context.Context) (bool, error) + type TestBatchedVM struct + BatchedParseBlockF func(ctx context.Context, blks [][]byte) ([]snowman.Block, error) + CantBatchParseBlock bool + CantGetAncestors bool + GetAncestorsF func(ctx context.Context, blkID ids.ID, maxBlocksNum int, maxBlocksSize int, ...) ([][]byte, error) + T *testing.T + func (vm *TestBatchedVM) BatchedParseBlock(ctx context.Context, blks [][]byte) ([]snowman.Block, error) + func (vm *TestBatchedVM) Default(cant bool) + func (vm *TestBatchedVM) GetAncestors(ctx context.Context, blkID ids.ID, maxBlocksNum int, maxBlocksSize int, ...) ([][]byte, error) + type TestHeightIndexedVM struct + CantGetBlockIDAtHeight bool + CantVerifyHeightIndex bool + GetBlockIDAtHeightF func(ctx context.Context, height uint64) (ids.ID, error) + T *testing.T + VerifyHeightIndexF func(context.Context) error + func (vm *TestHeightIndexedVM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error) + func (vm *TestHeightIndexedVM) VerifyHeightIndex(ctx context.Context) error + type TestStateSummary struct + AcceptF func(context.Context) (StateSyncMode, error) + BytesV []byte + CantAccept bool + HeightV uint64 + IDV ids.ID + T *testing.T + func (s *TestStateSummary) Accept(ctx context.Context) (StateSyncMode, error) + func (s *TestStateSummary) Bytes() []byte + func (s *TestStateSummary) Height() uint64 + func (s *TestStateSummary) ID() ids.ID + type TestStateSyncableVM struct + CantGetLastStateSummary bool + CantGetStateSummary bool + CantParseStateSummary bool + CantStateSyncEnabled bool + CantStateSyncGetOngoingSummary bool + GetLastStateSummaryF func(context.Context) (StateSummary, error) + GetOngoingSyncStateSummaryF func(context.Context) (StateSummary, error) + GetStateSummaryF func(ctx context.Context, summaryHeight uint64) (StateSummary, error) + ParseStateSummaryF func(ctx context.Context, summaryBytes []byte) (StateSummary, error) + StateSyncEnabledF func(context.Context) (bool, error) + T *testing.T + func (vm *TestStateSyncableVM) GetLastStateSummary(ctx context.Context) (StateSummary, error) + func (vm *TestStateSyncableVM) GetOngoingSyncStateSummary(ctx context.Context) (StateSummary, error) + func (vm *TestStateSyncableVM) GetStateSummary(ctx context.Context, summaryHeight uint64) (StateSummary, error) + func (vm *TestStateSyncableVM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (StateSummary, error) + func (vm *TestStateSyncableVM) StateSyncEnabled(ctx context.Context) (bool, error) + type TestVM struct + BuildBlockF func(context.Context) (snowman.Block, error) + CantBuildBlock bool + CantGetBlock bool + CantLastAccepted bool + CantParseBlock bool + CantSetPreference bool + GetBlockF func(context.Context, ids.ID) (snowman.Block, error) + LastAcceptedF func(context.Context) (ids.ID, error) + ParseBlockF func(context.Context, []byte) (snowman.Block, error) + SetPreferenceF func(context.Context, ids.ID) error + func (vm *TestVM) BuildBlock(ctx context.Context) (snowman.Block, error) + func (vm *TestVM) Default(cant bool) + func (vm *TestVM) GetBlock(ctx context.Context, id ids.ID) (snowman.Block, error) + func (vm *TestVM) LastAccepted(ctx context.Context) (ids.ID, error) + func (vm *TestVM) ParseBlock(ctx context.Context, b []byte) (snowman.Block, error) + func (vm *TestVM) SetPreference(ctx context.Context, id ids.ID) error + type WithVerifyContext interface + ShouldVerifyWithContext func(context.Context) (bool, error) + VerifyWithContext func(context.Context, *Context) error