Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRemoteVMNotImplemented is returned when the remote VM is not implemented ErrRemoteVMNotImplemented = errors.New("remote VM not implemented") // ErrStateSyncableVMNotImplemented is returned when state syncable VM is not implemented ErrStateSyncableVMNotImplemented = errors.New("state syncable VM not implemented") )
Functions ¶
This section is empty.
Types ¶
type AppSender ¶
type AppSender interface {
SendAppRequest(ctx context.Context, nodeIDs []ids.NodeID, requestID uint32, appRequestBytes []byte) error
SendAppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, appResponseBytes []byte) error
SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error
SendAppGossip(ctx context.Context, nodeIDs []ids.NodeID, appGossipBytes []byte) error
}
AppSender sends application messages
type BatchedChainVM ¶
type BatchedChainVM interface {
ChainVM
GetAncestors(
ctx context.Context,
blkID ids.ID,
maxBlocksNum int,
maxBlocksSize int,
maxBlocksRetrievalTime time.Duration,
) ([][]byte, error)
BatchedParseBlock(ctx context.Context, blks [][]byte) ([]Block, error)
}
BatchedChainVM extends ChainVM with batch operations
type Block ¶
type Block interface {
ID() ids.ID
Parent() ids.ID // Alias for ParentID for compatibility
ParentID() ids.ID
Height() uint64
Timestamp() time.Time
Status() uint8
Verify(context.Context) error
Accept(context.Context) error
Reject(context.Context) error
Bytes() []byte
}
Block is a block in the chain
type BuildBlockWithContextChainVM ¶
type BuildBlockWithContextChainVM interface {
ChainVM
BuildBlockWithContext(ctx context.Context, blockCtx *Context) (Block, error)
}
BuildBlockWithContextChainVM extends ChainVM with context-aware block building
type BuildBlockWithContextVM ¶
type BuildBlockWithContextVM interface {
ChainVM
BuildBlockWithContext(context.Context, *Context) (Block, error)
}
BuildBlockWithContextVM extends ChainVM with context support
type ChainContext ¶
type ChainContext struct {
*consensuscontext.Context
}
ChainContext provides chain context
type ChainVM ¶
type ChainVM interface {
// Initialize initializes the VM
Initialize(
ctx context.Context,
chainCtx interface{},
db interface{},
genesisBytes []byte,
upgradeBytes []byte,
configBytes []byte,
msgChan interface{},
fxs []interface{},
appSender interface{},
) error
// BuildBlock builds a new block
BuildBlock(context.Context) (Block, error)
// ParseBlock parses a block from bytes
ParseBlock(context.Context, []byte) (Block, error)
// GetBlock gets a block by ID
GetBlock(context.Context, ids.ID) (Block, error)
// GetBlockIDAtHeight gets block ID at a specific height
GetBlockIDAtHeight(context.Context, uint64) (ids.ID, error)
// SetPreference sets the preferred block
SetPreference(context.Context, ids.ID) error
// LastAccepted returns the last accepted block
LastAccepted(context.Context) (ids.ID, error)
}
ChainVM defines the interface for a blockchain VM
type Context ¶
type Context struct {
PChainHeight uint64
}
Context provides context for building blocks
type StateSummary ¶
type StateSummary interface {
ID() ids.ID
Height() uint64
Bytes() []byte
Accept(context.Context) (StateSyncMode, error)
}
StateSummary represents a state summary
type StateSyncMode ¶
type StateSyncMode uint8
StateSyncMode defines state sync modes
const ( StateSyncSkipped StateSyncMode = iota StateSyncStatic StateSyncDynamic )
type StateSyncableVM ¶
type StateSyncableVM interface {
ChainVM
// StateSyncEnabled returns whether state sync is enabled
StateSyncEnabled(context.Context) (bool, error)
// GetOngoingSyncStateSummary returns the ongoing sync state summary
GetOngoingSyncStateSummary(context.Context) (StateSummary, error)
// GetLastStateSummary returns the last state summary
GetLastStateSummary(context.Context) (StateSummary, error)
// ParseStateSummary parses a state summary
ParseStateSummary(context.Context, []byte) (StateSummary, error)
// GetStateSummary gets a state summary by height
GetStateSummary(context.Context, uint64) (StateSummary, error)
}
StateSyncableVM defines a VM that supports state sync
type WithVerifyContext ¶
type WithVerifyContext interface {
// VerifyWithContext verifies with context
VerifyWithContext(context.Context, *Context) error
// ShouldVerifyWithContext returns whether to verify with context
ShouldVerifyWithContext(context.Context) (bool, error)
}
WithVerifyContext provides verify context support
Click to show internal directories.
Click to hide internal directories.