Documentation
¶
Index ¶
Constants ¶
View Source
const ( CodecVersion uint16 = 0 CodecVersionWithStopVtx uint16 = 1 )
Variables ¶
View Source
var Codec codec.Manager
Functions ¶
This section is empty.
Types ¶
type Builder ¶ added in v1.1.1
type Builder interface {
// Build a new stop vertex from the parents
BuildStopVtx(ctx context.Context, parentIDs []ids.ID) (avalanche.Vertex, error)
}
Builder builds a vertex given a set of parentIDs and transactions.
type DAGVM ¶
type DAGVM interface {
block.ChainVM
// Convert a stream of bytes to a transaction or return an error
ParseTx(ctx context.Context, txBytes []byte) (snowstorm.Tx, error)
}
DAGVM defines the minimum functionality that an avalanche VM must implement
type LinearizableVM ¶ added in v1.9.12
type LinearizableVM interface {
DAGVM
// Linearize is called after [Initialize] and after the DAG has been
// finalized. After Linearize is called:
//
// - PendingTxs will never be called again
// - GetTx will never be called again
// - ParseTx may still be called
// - All the block based functions of the [block.ChainVM] must work as
// expected.
//
// Linearize is part of the VM initialization, and will be called at most
// once per VM instantiation. This means that Linearize should be called
// every time the chain restarts after the DAG has finalized.
Linearize(ctx context.Context, stopVertexID ids.ID) error
}
type LinearizableVMWithEngine ¶ added in v1.9.12
type LinearizableVMWithEngine interface {
DAGVM
// Linearize is called after [Initialize] and after the DAG has been
// finalized. After Linearize is called:
//
// - PendingTxs will never be called again
// - GetTx will never be called again
// - ParseTx may still be called
// - All the block based functions of the [block.ChainVM] must work as
// expected.
//
// Linearize is part of the VM initialization, and will be called at most
// once per VM instantiation. This means that Linearize should be called
// every time the chain restarts after the DAG has finalized.
Linearize(
ctx context.Context,
stopVertexID ids.ID,
toEngine chan<- common.Message,
) error
}
type Manager ¶
Manager defines all the vertex related functionality that is required by the consensus engine.
type Parser ¶ added in v1.1.1
type Parser interface {
// Parse a vertex from a slice of bytes
ParseVtx(ctx context.Context, vertex []byte) (avalanche.Vertex, error)
}
Parser parses bytes into a vertex.
type StatelessVertex ¶ added in v1.1.1
type StatelessVertex interface {
verify.Verifiable
ID() ids.ID
Bytes() []byte
Version() uint16
ChainID() ids.ID
StopVertex() bool
Height() uint64
Epoch() uint32
ParentIDs() []ids.ID
Txs() [][]byte
}
func Build ¶ added in v1.1.1
func Build( chainID ids.ID, height uint64, parentIDs []ids.ID, txs [][]byte, ) (StatelessVertex, error)
Build a new stateless vertex from the contents of a vertex
func BuildStopVertex ¶ added in v1.7.4
Build a new stateless vertex from the contents of a vertex
func Parse ¶ added in v1.1.1
func Parse(bytes []byte) (StatelessVertex, error)
Parse parses the provided vertex bytes into a stateless vertex
type Storage ¶ added in v1.1.1
type Storage interface {
// Get a vertex by its hash from storage.
GetVtx(ctx context.Context, vtxID ids.ID) (avalanche.Vertex, error)
// Edge returns a list of accepted vertex IDs with no accepted children.
Edge(ctx context.Context) (vtxIDs []ids.ID)
// Returns "true" if accepted frontier ("Edge") is stop vertex.
StopVertexAccepted(ctx context.Context) (bool, error)
}
Storage defines the persistent storage that is required by the consensus engine.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package vertexmock is a generated GoMock package.
|
Package vertexmock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.