Documentation
¶
Index ¶
- Constants
- Variables
- func MakeLastAcceptedBlockF(blocks []*Block) func(context.Context) (ids.ID, error)
- type BatchedVM
- func (vm *BatchedVM) BatchedParseBlock(ctx context.Context, blks [][]byte) ([]block.Block, error)
- func (vm *BatchedVM) GetAncestors(ctx context.Context, blkID ids.ID, maxBlocksNum int, maxBlocksSize int, ...) ([][]byte, error)
- func (vm *BatchedVM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- type Block
- func (b *Block) Accept(context.Context) error
- func (b *Block) Bytes() []byte
- func (b *Block) Height() uint64
- func (b *Block) ID() ids.ID
- func (b *Block) Parent() ids.ID
- func (b *Block) ParentID() ids.ID
- func (b *Block) Reject(context.Context) error
- func (b *Block) State() state.ReadOnlyChain
- func (b *Block) Status() uint8
- func (b *Block) Timestamp() time.Time
- func (b *Block) Verify(context.Context) error
- type ChainVM
- type StateSummary
- type StateSyncableVM
- func (vm *StateSyncableVM) GetLastStateSummary(ctx context.Context) (block.StateSummary, error)
- func (vm *StateSyncableVM) GetOngoingSyncStateSummary(ctx context.Context) (block.StateSummary, error)
- func (vm *StateSyncableVM) GetStateSummary(ctx context.Context, height uint64) (block.StateSummary, error)
- func (vm *StateSyncableVM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (block.StateSummary, error)
- func (vm *StateSyncableVM) StateSyncEnabled(ctx context.Context) (bool, error)
- type VM
- func (vm *VM) BuildBlock(ctx context.Context) (block.Block, error)
- func (vm *VM) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion interface{}) error
- func (vm *VM) Disconnected(ctx context.Context, nodeID ids.NodeID) error
- func (vm *VM) GetBlock(ctx context.Context, blkID ids.ID) (block.Block, error)
- func (vm *VM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error)
- func (vm *VM) GetStatelessBlock(ctx context.Context, blkID ids.ID) (block.Block, error)
- func (vm *VM) HealthCheck(ctx context.Context) (interface{}, error)
- func (vm *VM) Initialize(ctx context.Context, chainCtx interface{}, db interface{}, genesisBytes []byte, ...) error
- func (vm *VM) LastAccepted(ctx context.Context) (ids.ID, error)
- func (vm *VM) NewHTTPHandler(ctx context.Context) (interface{}, error)
- func (vm *VM) ParseBlock(ctx context.Context, blockBytes []byte) (block.Block, error)
- func (vm *VM) SetPreference(ctx context.Context, blkID ids.ID) error
- func (vm *VM) SetState(ctx context.Context, state uint32) error
- func (vm *VM) Shutdown(ctx context.Context) error
- func (vm *VM) VerifyHeightIndex(ctx context.Context) error
- func (vm *VM) Version(ctx context.Context) (string, error)
- func (vm *VM) WaitForEvent(ctx context.Context) (interface{}, error)
Constants ¶
View Source
const ( Unknown uint8 = 0 Processing uint8 = 1 Rejected uint8 = 2 Accepted uint8 = 3 )
Status constants
Variables ¶
View Source
var ( GenesisID = ids.GenerateTestID() GenesisHeight = uint64(0) GenesisTimestamp = time.Unix(1, 0) GenesisBytes = []byte("genesis") )
View Source
var Genesis = &Block{ IDV: GenesisID, HeightV: GenesisHeight, TimestampV: GenesisTimestamp, ParentV: ids.Empty, BytesV: GenesisBytes, StatusV: Accepted, }
Functions ¶
Types ¶
type BatchedVM ¶ added in v1.16.56
type BatchedVM struct {
T *testing.T
GetAncestorsF func(context.Context, ids.ID, int, int, time.Duration) ([][]byte, error)
BatchedParseBlockF func(context.Context, [][]byte) ([]block.Block, error)
GetBlockIDAtHeightF func(context.Context, uint64) (ids.ID, error)
}
BatchedVM is a test VM that supports batch operations
func (*BatchedVM) BatchedParseBlock ¶ added in v1.16.56
func (*BatchedVM) GetAncestors ¶ added in v1.16.56
type Block ¶
type Block struct {
IDV ids.ID
HeightV uint64
TimestampV time.Time
ParentV ids.ID
BytesV []byte
StatusV uint8
ErrV error
// contains filtered or unexported fields
}
Block is a test block that implements block.Block
func BuildChild ¶
BuildChild creates a child block of the given parent
func (*Block) State ¶
func (b *Block) State() state.ReadOnlyChain
type ChainVM ¶ added in v1.16.56
type ChainVM = VM
ChainVM is a type alias for VM to maintain compatibility
type StateSummary ¶ added in v1.16.56
type StateSummary struct {
IDV ids.ID
HeightV uint64
BytesV []byte
AcceptF func(context.Context) (block.StateSyncMode, error)
}
StateSummary is a test state summary that implements block.StateSummary
func (*StateSummary) Accept ¶ added in v1.16.56
func (s *StateSummary) Accept(ctx context.Context) (block.StateSyncMode, error)
func (*StateSummary) Bytes ¶ added in v1.16.56
func (s *StateSummary) Bytes() []byte
func (*StateSummary) Height ¶ added in v1.16.56
func (s *StateSummary) Height() uint64
func (*StateSummary) ID ¶ added in v1.16.56
func (s *StateSummary) ID() ids.ID
type StateSyncableVM ¶ added in v1.16.56
type StateSyncableVM struct {
T *testing.T
StateSyncEnabledF func(context.Context) (bool, error)
GetOngoingSyncStateSummaryF func(context.Context) (block.StateSummary, error)
GetLastStateSummaryF func(context.Context) (block.StateSummary, error)
ParseStateSummaryF func(context.Context, []byte) (block.StateSummary, error)
GetStateSummaryF func(context.Context, uint64) (block.StateSummary, error)
}
StateSyncableVM is a test VM that supports state sync
func (*StateSyncableVM) GetLastStateSummary ¶ added in v1.16.56
func (vm *StateSyncableVM) GetLastStateSummary(ctx context.Context) (block.StateSummary, error)
func (*StateSyncableVM) GetOngoingSyncStateSummary ¶ added in v1.16.56
func (vm *StateSyncableVM) GetOngoingSyncStateSummary(ctx context.Context) (block.StateSummary, error)
func (*StateSyncableVM) GetStateSummary ¶ added in v1.16.56
func (vm *StateSyncableVM) GetStateSummary(ctx context.Context, height uint64) (block.StateSummary, error)
func (*StateSyncableVM) ParseStateSummary ¶ added in v1.16.56
func (vm *StateSyncableVM) ParseStateSummary(ctx context.Context, summaryBytes []byte) (block.StateSummary, error)
func (*StateSyncableVM) StateSyncEnabled ¶ added in v1.16.56
func (vm *StateSyncableVM) StateSyncEnabled(ctx context.Context) (bool, error)
type VM ¶ added in v1.16.56
type VM struct {
T *testing.T
InitializeF func(context.Context, interface{}, interface{}, []byte, []byte, []byte, interface{}, []interface{}, interface{}) error
BuildBlockF func(context.Context) (block.Block, error)
ParseBlockF func(context.Context, []byte) (block.Block, error)
GetBlockF func(context.Context, ids.ID) (block.Block, error)
LastAcceptedF func(context.Context) (ids.ID, error)
SetPreferenceF func(context.Context, ids.ID) error
SetStateF func(context.Context, uint32) error
VerifyHeightIndexF func(context.Context) error
GetBlockIDAtHeightF func(context.Context, uint64) (ids.ID, error)
GetStatelessBlockF func(context.Context, ids.ID) (block.Block, error)
}
VM is a test VM that can be used for testing
func (*VM) BuildBlock ¶ added in v1.16.56
func (*VM) Disconnected ¶ added in v1.16.56
Disconnected is called when the node disconnects from a peer
func (*VM) GetBlockIDAtHeight ¶ added in v1.16.56
func (*VM) GetStatelessBlock ¶ added in v1.16.56
func (*VM) HealthCheck ¶ added in v1.16.56
HealthCheck returns the health status of the VM
func (*VM) Initialize ¶ added in v1.16.56
func (*VM) LastAccepted ¶ added in v1.16.56
func (*VM) NewHTTPHandler ¶ added in v1.16.56
NewHTTPHandler returns an HTTP handler for the VM
func (*VM) ParseBlock ¶ added in v1.16.56
func (*VM) SetPreference ¶ added in v1.16.56
func (*VM) VerifyHeightIndex ¶ added in v1.16.56
Click to show internal directories.
Click to hide internal directories.