Help us shape the future of Go! Take the 2026 Go Developer Survey

vertex

package
v1.16.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2025 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodecVersion            uint16 = 0
	CodecVersionWithStopVtx uint16 = 1
)

Variables

Functions

This section is empty.

Types

type Builder added in v0.15.6

type Builder interface {
	// Build a new stop vertex from the parents
	BuildStopVtx(ctx context.Context, parentIDs []ids.ID) (dag.Vertex, error)
}

Builder builds a vertex given a set of parentIDs and transactions.

type GRAPHVM added in v1.1.11

type GRAPHVM interface {
	block.ChainVM

	// Convert a stream of bytes to a transaction or return an error
	ParseTx(ctx context.Context, txBytes []byte) (dag.Tx, error)
}

GRAPHVM defines the minimum functionality that an lux VM must implement

type LinearizableVM

type LinearizableVM interface {
	GRAPHVM

	// 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

type LinearizableVMWithEngine interface {
	GRAPHVM

	// 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 Manager

type Manager interface {
	Builder
	Parser
	Storage
}

Manager defines all the vertex related functionality that is required by the consensus engine.

type Parser added in v0.15.6

type Parser interface {
	// Parse a vertex from a slice of bytes
	ParseVtx(ctx context.Context, vertex []byte) (dag.Vertex, error)
}

Parser parses bytes into a vertex.

type StatelessVertex added in v0.15.6

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 v0.15.6

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 v0.15.6

func BuildStopVertex(chainID ids.ID, height uint64, parentIDs []ids.ID) (StatelessVertex, error)

Build a new stateless vertex from the contents of a vertex

func Parse added in v0.15.6

func Parse(bytes []byte) (StatelessVertex, error)

Parse parses the provided vertex bytes into a stateless vertex

type Storage

type Storage interface {
	// Get a vertex by its hash from storage.
	GetVtx(ctx context.Context, vtxID ids.ID) (dag.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.

Directories

Path Synopsis
vertexmock
Package vertexmock is a generated GoMock package.
Package vertexmock is a generated GoMock package.
Package vertexmock is a generated GoMock package.
Package vertexmock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL