adapter

package
v1.14.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainAdapter

type ChainAdapter struct {
	// contains filtered or unexported fields
}

ChainAdapter adapts the external consensus protocol (nova) to the node's chain.Engine interface

func NewChainAdapter

func NewChainAdapter() *ChainAdapter

NewChainAdapter creates a new adapter for linear chain consensus

func (*ChainAdapter) Accepted

func (ca *ChainAdapter) Accepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error

Accepted handles accepted blocks notification

func (*ChainAdapter) AcceptedFrontier

func (ca *ChainAdapter) AcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error

AcceptedFrontier handles an accepted frontier message

func (*ChainAdapter) AcceptedStateSummary

func (ca *ChainAdapter) AcceptedStateSummary(ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryIDs []ids.ID) error

AcceptedStateSummary is called when the requested state summary is received

func (*ChainAdapter) Ancestors

func (ca *ChainAdapter) Ancestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte) error

Ancestors is called when a container and its ancestors are received

func (*ChainAdapter) AppGossip

func (ca *ChainAdapter) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

AppGossip is called when an application gossip message is received

func (*ChainAdapter) AppRequest

func (ca *ChainAdapter) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, msg []byte) error

AppRequest is called when an application request is received

func (*ChainAdapter) AppResponse

func (ca *ChainAdapter) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error

AppResponse is called when an application response is received

func (*ChainAdapter) Chits

func (ca *ChainAdapter) Chits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, preferredIDAtHeight ids.ID, acceptedID ids.ID) error

Chits handles chits (votes) from a node

func (*ChainAdapter) Connected

func (ca *ChainAdapter) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error

Connected handles a node connection event

func (*ChainAdapter) Context

func (ca *ChainAdapter) Context() *core.Context

Context returns the engine's context

func (*ChainAdapter) CrossChainAppRequest

func (ca *ChainAdapter) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, msg []byte) error

CrossChainAppRequest is called when a cross-chain application request is received

func (*ChainAdapter) CrossChainAppResponse

func (ca *ChainAdapter) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error

CrossChainAppResponse is called when a cross-chain application response is received

func (*ChainAdapter) Disconnected

func (ca *ChainAdapter) Disconnected(ctx context.Context, nodeID ids.NodeID) error

Disconnected handles a node disconnection event

func (*ChainAdapter) Get

func (ca *ChainAdapter) Get(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error

Get retrieves a container and its ancestors

func (*ChainAdapter) GetAccepted

func (ca *ChainAdapter) GetAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error

GetAccepted returns accepted blocks

func (*ChainAdapter) GetAcceptedFrontier

func (ca *ChainAdapter) GetAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

GetAcceptedFrontier returns the accepted frontier

func (*ChainAdapter) GetAcceptedStateSummary

func (ca *ChainAdapter) GetAcceptedStateSummary(ctx context.Context, nodeID ids.NodeID, requestID uint32, heights []uint64) error

GetAcceptedStateSummary retrieves the state summary for the given block heights

func (*ChainAdapter) GetAncestor

func (ca *ChainAdapter) GetAncestor(blkID ids.ID, height uint64) (ids.ID, error)

GetAncestor retrieves an ancestor block at the given height

func (*ChainAdapter) GetAncestors

func (ca *ChainAdapter) GetAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error

GetAncestors retrieves a container and its ancestors

func (*ChainAdapter) GetBlock

func (ca *ChainAdapter) GetBlock(blkID ids.ID) (chain.Block, error)

GetBlock retrieves a block by its ID

func (*ChainAdapter) GetStateSummaryFrontier

func (ca *ChainAdapter) GetStateSummaryFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

GetStateSummaryFrontier returns the state summary frontier

func (*ChainAdapter) GetVM

func (ca *ChainAdapter) GetVM() interface{}

GetVM returns the VM associated with this engine

func (*ChainAdapter) Gossip

func (ca *ChainAdapter) Gossip() error

Gossip handles a gossip message

func (*ChainAdapter) Halt

func (ca *ChainAdapter) Halt()

Halt halts the engine

func (*ChainAdapter) HealthCheck

func (ca *ChainAdapter) HealthCheck(ctx context.Context) (interface{}, error)

HealthCheck returns the engine's health status

func (*ChainAdapter) Initialize

func (ca *ChainAdapter) Initialize(ctx context.Context, params chain.Parameters) error

Initialize initializes the chain consensus engine

func (*ChainAdapter) LastAccepted

func (ca *ChainAdapter) LastAccepted() (ids.ID, uint64)

LastAccepted returns the ID of the last accepted block

func (*ChainAdapter) Notify

func (ca *ChainAdapter) Notify(ctx context.Context, msg core.Message) error

Notify notifies the engine of an event

func (*ChainAdapter) PullQuery

func (ca *ChainAdapter) PullQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, blkID ids.ID, requestedHeight uint64) error

PullQuery sends a query for a block ID

func (*ChainAdapter) PushQuery

func (ca *ChainAdapter) PushQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, blkBytes []byte, requestedHeight uint64) error

PushQuery sends a query for a block

func (*ChainAdapter) Put

func (ca *ChainAdapter) Put(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) error

Put is called when a container is received

func (*ChainAdapter) QueryFailed

func (ca *ChainAdapter) QueryFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

QueryFailed handles a failed query

func (*ChainAdapter) Shutdown

func (ca *ChainAdapter) Shutdown(ctx context.Context) error

Shutdown the engine

func (*ChainAdapter) Start

func (ca *ChainAdapter) Start(ctx context.Context, startReqID uint32) error

Start starts the consensus engine

func (*ChainAdapter) StateSummaryFrontier

func (ca *ChainAdapter) StateSummaryFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, summary []byte) error

StateSummaryFrontier is called when the state summary frontier is received

func (*ChainAdapter) Stop

func (ca *ChainAdapter) Stop(ctx context.Context) error

Stop stops the consensus engine

func (*ChainAdapter) Timeout

func (ca *ChainAdapter) Timeout() error

Timeout handles a timeout event

func (*ChainAdapter) VerifyHeightIndex

func (ca *ChainAdapter) VerifyHeightIndex() error

VerifyHeightIndex returns whether height index is enabled

type Config

type Config struct {
	VM         vertex.LinearizableVM
	Sender     sender.Sender
	Validators validators.State
}

Config contains the configuration for a DAG consensus engine

type DAGAdapter

type DAGAdapter struct {
	// contains filtered or unexported fields
}

DAGAdapter adapts the external consensus protocol (nebula) to the node's dag.Engine interface

func NewDAGAdapter

func NewDAGAdapter() *DAGAdapter

NewDAGAdapter creates a new adapter for DAG consensus

func (*DAGAdapter) Accepted

func (da *DAGAdapter) Accepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error

Accepted handles accepted vertices notification

func (*DAGAdapter) AcceptedFrontier

func (da *DAGAdapter) AcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error

AcceptedFrontier handles an accepted frontier message

func (*DAGAdapter) AcceptedStateSummary

func (da *DAGAdapter) AcceptedStateSummary(ctx context.Context, nodeID ids.NodeID, requestID uint32, summaryIDs []ids.ID) error

AcceptedStateSummary is called when the requested state summary is received

func (*DAGAdapter) Ancestors

func (da *DAGAdapter) Ancestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containers [][]byte) error

Ancestors is called when a container and its ancestors are received

func (*DAGAdapter) AppGossip

func (da *DAGAdapter) AppGossip(ctx context.Context, nodeID ids.NodeID, msg []byte) error

AppGossip is called when an application gossip message is received

func (*DAGAdapter) AppRequest

func (da *DAGAdapter) AppRequest(ctx context.Context, nodeID ids.NodeID, requestID uint32, deadline time.Time, msg []byte) error

AppRequest is called when an application request is received

func (*DAGAdapter) AppResponse

func (da *DAGAdapter) AppResponse(ctx context.Context, nodeID ids.NodeID, requestID uint32, msg []byte) error

AppResponse is called when an application response is received

func (*DAGAdapter) Chits

func (da *DAGAdapter) Chits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, preferredIDAtHeight ids.ID, acceptedID ids.ID) error

Chits handles chits (votes) from a node

func (*DAGAdapter) Connected

func (da *DAGAdapter) Connected(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error

Connected handles a node connection event

func (*DAGAdapter) Context

func (da *DAGAdapter) Context() *core.Context

Context returns the engine's context

func (*DAGAdapter) CrossChainAppRequest

func (da *DAGAdapter) CrossChainAppRequest(ctx context.Context, chainID ids.ID, requestID uint32, deadline time.Time, msg []byte) error

CrossChainAppRequest is called when a cross-chain application request is received

func (*DAGAdapter) CrossChainAppResponse

func (da *DAGAdapter) CrossChainAppResponse(ctx context.Context, chainID ids.ID, requestID uint32, msg []byte) error

CrossChainAppResponse is called when a cross-chain application response is received

func (*DAGAdapter) Disconnected

func (da *DAGAdapter) Disconnected(ctx context.Context, nodeID ids.NodeID) error

Disconnected handles a node disconnection event

func (*DAGAdapter) Get

func (da *DAGAdapter) Get(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error

Get retrieves a container and its ancestors

func (*DAGAdapter) GetAccepted

func (da *DAGAdapter) GetAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error

GetAccepted returns accepted vertices

func (*DAGAdapter) GetAcceptedFrontier

func (da *DAGAdapter) GetAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

GetAcceptedFrontier returns the accepted frontier

func (*DAGAdapter) GetAcceptedStateSummary

func (da *DAGAdapter) GetAcceptedStateSummary(ctx context.Context, nodeID ids.NodeID, requestID uint32, heights []uint64) error

GetAcceptedStateSummary retrieves the state summary for the given block heights

func (*DAGAdapter) GetAncestors

func (da *DAGAdapter) GetAncestors(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error

GetAncestors retrieves a container and its ancestors

func (*DAGAdapter) GetStateSummaryFrontier

func (da *DAGAdapter) GetStateSummaryFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

GetStateSummaryFrontier returns the state summary frontier

func (*DAGAdapter) GetVM

func (da *DAGAdapter) GetVM() interface{}

GetVM returns the VM associated with this engine

func (*DAGAdapter) GetVertex

func (da *DAGAdapter) GetVertex(vtxID ids.ID) (dag.Vertex, error)

GetVertex retrieves a vertex from storage

func (*DAGAdapter) GetVtx

func (da *DAGAdapter) GetVtx(vtxID ids.ID) (dag.Vertex, error)

GetVtx retrieves a vertex by its ID

func (*DAGAdapter) Gossip

func (da *DAGAdapter) Gossip() error

Gossip handles a gossip message

func (*DAGAdapter) Halt

func (da *DAGAdapter) Halt()

Halt halts the engine

func (*DAGAdapter) HealthCheck

func (da *DAGAdapter) HealthCheck(ctx context.Context) (interface{}, error)

HealthCheck returns the engine's health status

func (*DAGAdapter) Initialize

func (da *DAGAdapter) Initialize(ctx context.Context, params dag.Parameters) error

Initialize initializes the DAG consensus engine

func (*DAGAdapter) Issued

func (da *DAGAdapter) Issued(vtx dag.Vertex) bool

Issued returns true if the vertex has been issued

func (*DAGAdapter) Notify

func (da *DAGAdapter) Notify(ctx context.Context, msg core.Message) error

Notify notifies the engine of an event

func (*DAGAdapter) PullQuery

func (da *DAGAdapter) PullQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, vtxID ids.ID, requestedHeight uint64) error

PullQuery sends a query for a vertex ID

func (*DAGAdapter) PushQuery

func (da *DAGAdapter) PushQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, vtxBytes []byte, requestedHeight uint64) error

PushQuery sends a query for a vertex

func (*DAGAdapter) Put

func (da *DAGAdapter) Put(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) error

Put is called when a container is received

func (*DAGAdapter) QueryFailed

func (da *DAGAdapter) QueryFailed(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

QueryFailed handles a failed query

func (*DAGAdapter) Shutdown

func (da *DAGAdapter) Shutdown(ctx context.Context) error

Shutdown the engine

func (*DAGAdapter) Start

func (da *DAGAdapter) Start(ctx context.Context, startReqID uint32) error

Start starts the consensus engine

func (*DAGAdapter) StateSummaryFrontier

func (da *DAGAdapter) StateSummaryFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, summary []byte) error

StateSummaryFrontier is called when the state summary frontier is received

func (*DAGAdapter) Stop

func (da *DAGAdapter) Stop(ctx context.Context) error

Stop stops the consensus engine

func (*DAGAdapter) StopVertexAccepted

func (da *DAGAdapter) StopVertexAccepted() bool

StopVertexAccepted returns true if all new vertices should be rejected

func (*DAGAdapter) Timeout

func (da *DAGAdapter) Timeout() error

Timeout handles a timeout event

Jump to

Keyboard shortcuts

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