quasar

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: 17 Imported by: 0

README ยถ

Lux Consensus

Welcome to Lux Consensusโ€”the world's first unified quantum-secure consensus engine. By replacing Avalanche's complex Snowman++ with a streamlined Nova + Ringtail PQ architecture, Lux achieves both classical AND quantum finality in the same number of rounds that Avalanche needs for classical finality alone.

๐Ÿ† Revolutionary Achievement

Quasar = Nova + Ringtail PQ = Classical + Quantum Finality in k+2 rounds

While Avalanche needs k+3 rounds for classical finality (Nova + Snowball + Snowman + P-Chain callback), Lux achieves both classical AND quantum finality in just k+2 rounds:

  • Mainnet: Nova (k rounds) + Ringtail (2 rounds) = Quantum finality in <1s
  • Testnet: Nova (k rounds) + Ringtail (2 rounds) = Quantum finality in <800ms
  • Local: Nova only = Classical finality in <400ms

๐ŸŒŸ Overview

The Problem with Snowman++

Avalanche's C-Chain uses a complex multi-stage process:

  1. Nova/DAG: Assigns chits via k-peer sampling, builds confidence d(T)
  2. Snowball wrap: Once confidence crosses ฮฒ, vertex becomes "preferred"
  3. Snowman linearizer: Converts DAG decisions into a linear chain
  4. P-Chain callback: Validates against stake registry

Result: Multiple extra rounds, complex callbacks, no quantum security.

The Quasar Solution

Lux replaces this entire stack with one elegant engine:

  1. Nova/DAG: Unchanged - same k-peer sampling and confidence building
  2. Ringtail PQ: 2-phase lattice protocol on top of Nova's confidence
  3. Q-blocks: Embedded as P-Chain internal transactions

Result: Same total rounds, but with quantum security included!

๐Ÿ“ฆ Unified Architecture

nova/       # DAG consensus (unchanged from Avalanche)
ringtail/   # 2-phase PQ overlay
  phase1/     # Propose frontier
  phase2/     # Commit frontier
quasar/     # Unified engine combining Nova + Ringtail
  engine.go   # Main Quasar engine
  qblock.go   # Q-block structure
pchain/     # P-Chain with embedded Q-blocks

๐Ÿ”ฌ How Quasar Works

1. Nova DAG (Unchanged)
// Standard Avalanche DAG consensus
vertex := nova.NewVertex(txs)
nova.Add(vertex)
confidence := nova.GetConfidence(vertex)
if confidence > beta {
    // Vertex ready for finalization
}
2. Ringtail PQ Overlay
// Phase I: Propose (1 round)
frontier := nova.GetHighestConfidenceFrontier()
proposal := ringtail.Propose(frontier)
proposals := p2p.GossipProposal(proposal, k)

// Phase II: Commit (1 round)
if CountAgreement(proposals) > alphaCommit {
    qblock := ringtail.Commit(frontier)
    // Quantum finality achieved!
}
3. P-Chain Integration
// Q-blocks embedded as internal transactions
type PChainBlock struct {
    Transactions []Tx
    QBlocks     []QBlock  // Embedded quantum finality
}

// All chains watch P-Chain for finality
func (chain *AnyChain) IsFinalized(tx) bool {
    return pchain.HasQBlock(tx)
}

๐ŸŽฏ Key Innovation: Monotonic Lattice

Why Ringtail works in just 2 phases on top of Nova:

  1. Nova provides monotonicity: Confidence d(T) only increases
  2. Metastable property: High confidence vertices stay high
  3. Network convergence: All nodes see same high-confidence frontier

The Ringtail lattice leverages these properties:

    Q[n+1] (new Q-block)
   /   |   \
F[a]  F[b]  F[c] (possible frontiers)
   \   |   /
    Q[n] (previous Q-block)

Once Q[n+1] commits to frontier F[b], the lattice structure ensures all future Q-blocks build on F[b].

๐Ÿ”„ Consensus Flow

graph LR
    TX[Transaction] --> Nova[Nova DAG<br/>k rounds]
    Nova --> R1[Ringtail Phase I<br/>Propose]
    R1 --> R2[Ringtail Phase II<br/>Commit]
    R2 --> QB[Q-Block]
    QB --> PC[P-Chain<br/>Embedded]
    PC --> F[Universal Finality]

Compare to Snowman++:

graph LR
    TX[Transaction] --> Nova[Nova DAG<br/>k rounds]
    Nova --> SB[Snowball<br/>+1 round]
    SB --> SM[Snowman<br/>+1 round]
    SM --> CB[P-Chain Callback<br/>+1 round]
    CB --> F[Classical Finality Only]

๐Ÿ“Š Performance Comparison

Consensus Rounds to Classical Rounds to Quantum Total Time Complexity
Snowman++ k+3 N/A ~1.2s High (4 stages)
Quasar k+2 k+2 ~1.0s Low (2 stages)

Quasar achieves quantum security in fewer rounds than Snowman++ needs for classical!

๐Ÿš€ Usage

All Chains Use Same Engine
// Every chain (C, X, M, Z) uses identical Quasar engine
type Chain struct {
    quasar *QuasarEngine
}

func (c *Chain) ProcessBlock(block *Block) {
    // Add to Quasar (handles Nova + Ringtail internally)
    qblock := c.quasar.Process(block.Transactions)
    
    // Finality determined by P-Chain Q-blocks
    block.QBlockRef = qblock.ID
}
Smart Contract Access
interface IQuasar {
    function isFinalized(bytes32 txHash) external view returns (bool);
    function getQBlock(bytes32 txHash) external view returns (QBlock);
}

contract SecureTransfer {
    IQuasar quasar = IQuasar(0x0...001F);
    
    function transfer(uint amount) external {
        bytes32 txHash = keccak256(abi.encode(msg.sender, amount));
        require(quasar.isFinalized(txHash), "Awaiting Quasar finality");
        // Transfer is quantum-secure!
    }
}

๐Ÿ”ง Configuration

type QuasarParams struct {
    // Nova (unchanged from Avalanche)
    K    int  // Sample size (21 for mainnet)
    Beta int  // Confidence threshold (18 for mainnet)
    
    // Ringtail (new)
    AlphaPropose int  // Phase I threshold (13)
    AlphaCommit  int  // Phase II threshold (18)
    
    // Q-Chain
    QBlockInterval time.Duration  // 100ms
}

๐Ÿ“– Summary

Quasar represents a fundamental breakthrough in consensus design:

  1. Replaces Snowman++ entirely - No more complex multi-stage process
  2. Same rounds, better security - Quantum finality in k+2 rounds
  3. Universal engine - All chains use identical Quasar protocol
  4. Elegant simplicity - Nova + 2-phase Ringtail = done

The photonic journey is complete:

  • Photon: Transactions enter as light
  • Wave: K-sampling creates interference
  • Nova: Confidence explodes
  • Quasar: Ringtail focuses into quantum beam
  • Q-Chain: Beam recorded on P-Chain forever

Welcome to the age of unified quantum consensus. Welcome to Quasar.

๐Ÿ“ License

BSD 3โ€‘Clause โ€” free for academic & commercial use.

Documentation ยถ

Index ยถ

Constants ยถ

This section is empty.

Variables ยถ

View Source
var (
	// ErrNotFound is returned when a requested item is not found
	ErrNotFound = errors.New("not found")
)

Functions ยถ

func NewMetricsRegistererWrapper ยถ added in v1.14.2

func NewMetricsRegistererWrapper(reg metrics.Registerer) prometheus.Registerer

NewMetricsRegistererWrapper creates a new wrapper

Types ยถ

type Acceptor ยถ

type Acceptor interface {
	Accept(ctx *Context, containerID ids.ID, container []byte) error
}

Acceptor is something that can accept a piece of data

type AcceptorGroup ยถ added in v1.14.2

type AcceptorGroup interface {
	RegisterAcceptor(chainID ids.ID, name string, acceptor Acceptor, persist bool) error
	DeregisterAcceptor(chainID ids.ID, name string) error
	Accept(ctx *Context, containerID ids.ID, container []byte) error
}

AcceptorGroup manages multiple acceptors

func NewAcceptorGroup ยถ added in v1.14.2

func NewAcceptorGroup(log log.Logger) AcceptorGroup

NewAcceptorGroup creates a new acceptor group

type Batch ยถ added in v1.14.2

type Batch interface {
	// Write adds a put operation to the batch
	Write([]byte, []byte) error

	// Delete adds a delete operation to the batch
	Delete([]byte) error
}

Batch represents an atomic batch operation

type Block ยถ

type Block interface {
	Decidable

	// Parent returns the ID of this block's parent
	Parent() ids.ID

	// Verify that the state transition this block would make is valid
	Verify() error

	// Bytes returns the binary representation of this block
	Bytes() []byte

	// Height returns the height of this block
	Height() uint64

	// Timestamp returns the timestamp of this block
	Timestamp() int64
}

Block represents a block that can be decided by consensus

type BlockStore ยถ added in v1.14.2

type BlockStore interface {
	// GetBlock retrieves a block by ID
	GetBlock(id ids.ID) (interface{}, error)

	// PutBlock stores a block
	PutBlock(id ids.ID, block interface{}) error

	// DeleteBlock removes a block
	DeleteBlock(id ids.ID) error
}

BlockStore manages block storage

func NewMemoryStore ยถ added in v1.14.2

func NewMemoryStore() BlockStore

NewMemoryStore creates a new in-memory block store

type ChainValidatorSet ยถ added in v1.14.2

type ChainValidatorSet struct {
	ChainID        ids.ID
	Validators     []ids.NodeID
	IsGenesisGated bool
	MinValidators  int
}

ChainValidatorSet represents validators for a specific chain

type ChainWrapper ยถ added in v1.14.2

type ChainWrapper struct {
	ChainID   ids.ID
	ChainName string
	// contains filtered or unexported fields
}

ChainWrapper wraps a chain for quantum finality

type Clock ยถ added in v1.14.2

type Clock interface {
	Time() time.Time
}

Clock provides time functionality

type ConsensusBlock ยถ added in v1.14.2

type ConsensusBlock struct {
	// Block metadata
	Height    uint64    `serialize:"true"`
	Timestamp time.Time `serialize:"true"`
	ParentID  ids.ID    `serialize:"true"`

	// Chain operations - Operations from each of the 8 chains
	AChainOps []Operation `serialize:"true"` // AI operations
	BChainOps []Operation `serialize:"true"` // Bridge operations
	CChainOps []Operation `serialize:"true"` // EVM operations
	MChainOps []Operation `serialize:"true"` // MPC operations
	PChainOps []Operation `serialize:"true"` // Platform operations
	QChainOps []Operation `serialize:"true"` // Quantum operations
	XChainOps []Operation `serialize:"true"` // Exchange operations
	ZChainOps []Operation `serialize:"true"` // ZK operations

	// Finality requirements
	RequiredPChainBLS      bool `serialize:"true"`
	RequiredQChainRingtail bool `serialize:"true"`
	// contains filtered or unexported fields
}

ConsensusBlock represents a network-wide consensus block containing operations from all chains

func (*ConsensusBlock) Bytes ยถ added in v1.14.2

func (cb *ConsensusBlock) Bytes() []byte

Bytes returns the serialized block

func (*ConsensusBlock) GetAllOperations ยถ added in v1.14.2

func (cb *ConsensusBlock) GetAllOperations() []Operation

GetAllOperations returns all operations in the block

func (*ConsensusBlock) GetOperationsByChain ยถ added in v1.14.2

func (cb *ConsensusBlock) GetOperationsByChain(chainID ids.ID) []Operation

GetOperationsByChain returns operations for a specific chain

func (*ConsensusBlock) ID ยถ added in v1.14.2

func (cb *ConsensusBlock) ID() ids.ID

ID returns the block ID

type ConsensusBlockBuilder ยถ added in v1.14.2

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

ConsensusBlockBuilder builds consensus blocks

func NewConsensusBlockBuilder ยถ added in v1.14.2

func NewConsensusBlockBuilder(height uint64, parentID ids.ID) *ConsensusBlockBuilder

NewConsensusBlockBuilder creates a new builder

func (*ConsensusBlockBuilder) AddOperations ยถ added in v1.14.2

func (cbb *ConsensusBlockBuilder) AddOperations(chainID ids.ID, ops []Operation)

AddOperations adds operations from a chain

func (*ConsensusBlockBuilder) Build ยถ added in v1.14.2

func (cbb *ConsensusBlockBuilder) Build() *ConsensusBlock

Build creates the consensus block

type ConsensusContext ยถ

type ConsensusContext struct {
	// NetworkID is the ID of the network this node is running on
	NetworkID uint32

	// ChainID is the ID of the chain this consensus engine is running on
	ChainID ids.ID

	// SubnetID is the ID of the subnet this chain belongs to
	SubnetID ids.ID

	// NodeID is the ID of this node
	NodeID ids.NodeID

	// Log is the logger for this consensus engine
	Log log.Logger

	// Metrics registry for this consensus engine
	Metrics metrics.Registry

	// Network sender for consensus messages
	Sender Sender

	// Validators manager
	Validators validators.Manager

	// Current time provider
	Clock Clock

	// Consensus parameters
	Parameters Parameters

	// Metrics registerer
	Registerer metrics.Registerer

	// Validator state
	ValidatorState validators.State

	// Ringtail secret key
	RingtailSK []byte

	// Ringtail public key
	RingtailPK []byte

	// Nested context for advanced operations
	Context *Context

	// BCLookup provides blockchain lookup functionality
	BCLookup ids.AliaserReader

	// Lock provides synchronization for the consensus engine
	Lock sync.RWMutex

	// State provides the chain state management
	State *EngineState

	// LUXAssetID is the asset ID for LUX
	LUXAssetID ids.ID

	// SharedMemory for cross-chain communication
	SharedMemory SharedMemory

	// WarpSigner for warp message signing
	WarpSigner WarpSigner

	// NetworkUpgrades configuration
	NetworkUpgrades NetworkUpgrades

	// PublicKey of this node
	PublicKey []byte

	// XChainID is the ID of the X-Chain
	XChainID ids.ID

	// CChainID is the ID of the C-Chain
	CChainID ids.ID

	// ChainDataDir is the directory for chain data
	ChainDataDir string

	// ValidatorSet provides access to the current validator set
	ValidatorSet ValidatorSet

	// Bootstrappers is the set of nodes to bootstrap from
	Bootstrappers validators.Set

	// StartTime is the time the consensus engine started
	StartTime time.Time

	// RequestID for tracking requests
	RequestID RequestID
}

ConsensusContext provides the context needed for consensus engines

type ConsensusFlow ยถ added in v1.14.2

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

ConsensusFlow represents the consensus flow for quantum finality

func (*ConsensusFlow) ExecuteConsensusRound ยถ added in v1.14.2

func (cf *ConsensusFlow) ExecuteConsensusRound(height uint64) (*FinalizedBlock, error)

ExecuteConsensusRound executes a full consensus round

type ConsensusRound ยถ added in v1.14.2

type ConsensusRound struct {
	Height         uint64
	Block          *ConsensusBlock
	PChainFinality bool
	QChainFinality bool
	StartTime      time.Time
	EndTime        time.Time
}

ConsensusRound represents a complete consensus round

func (*ConsensusRound) Duration ยถ added in v1.14.2

func (cr *ConsensusRound) Duration() time.Duration

Duration returns how long the consensus round took

func (*ConsensusRound) IsFinalized ยถ added in v1.14.2

func (cr *ConsensusRound) IsFinalized() bool

IsFinalized returns true if the round achieved dual finality

type Context ยถ

type Context = ConsensusContext

Context is an alias for ConsensusContext

type ContextInitializable ยถ added in v1.14.2

type ContextInitializable interface {
	// Initialize initializes with the consensus context
	Initialize(ctx *Context) error
}

ContextInitializable defines the interface for types that need consensus context initialization

type Decidable ยถ

type Decidable interface {
	// ID returns the unique ID of this element
	ID() ids.ID

	// Accept marks this element as accepted
	Accept() error

	// Reject marks this element as rejected
	Reject() error

	// Status returns the current status
	Status() choices.Status
}

Decidable represents an element that can be decided by consensus

type DualFinalityProof ยถ added in v1.14.2

type DualFinalityProof struct {
	BlockID ids.ID
	Height  uint64

	// P-Chain BLS aggregate signature
	PChainSignature *bls.AggregateSignature
	PChainSigners   []ids.NodeID

	// Q-Chain Ringtail signature
	QChainSignature *ringtail.Signature
	QChainWitness   *ringtail.Witness

	// Combined proof
	ProofHash      ids.ID
	ProofTimestamp time.Time
}

DualFinalityProof proves both P-Chain and Q-Chain consensus

type Element ยถ added in v1.14.2

type Element struct {
	Key    []byte   `serialize:"true"`
	Value  []byte   `serialize:"true"`
	Traits [][]byte `serialize:"true"`
}

Element represents a shared memory element

type Engine ยถ added in v1.14.2

type Engine struct{}

Engine represents the Lux consensus engine This is a stub implementation when the external consensus package is not available

func NewEngine ยถ added in v1.14.2

func NewEngine(network string) (*Engine, error)

NewEngine creates a new Lux consensus engine

func NewEngineWithParams ยถ added in v1.14.2

func NewEngineWithParams(params interface{}) (*Engine, error)

NewEngineWithParams creates a new engine with custom parameters

func NewTestEngine ยถ added in v1.14.2

func NewTestEngine(params interface{}) (*Engine, error)

NewTestEngine creates a new engine for testing

type EngineState ยถ

type EngineState struct {
	State State
}

EngineState represents the state of the consensus engine

func (*EngineState) Get ยถ added in v1.14.2

func (s *EngineState) Get() *EngineState

Get gets the engine state

func (*EngineState) Set ยถ added in v1.14.2

func (s *EngineState) Set(state EngineState)

Set sets the engine state

type FinalizedBlock ยถ added in v1.14.2

type FinalizedBlock struct {
	PendingBlock

	// Dual finality proof
	FinalityProof *DualFinalityProof
	FinalizedAt   time.Time
}

FinalizedBlock represents a block with quantum finality

type Logger ยถ added in v1.14.2

type Logger func(log.Logger) log.Logger

Logger creates a logger from a base logger

type NetworkUpgrades ยถ added in v1.14.2

type NetworkUpgrades interface {
	// IsActivated checks if an upgrade is activated at a given time
	IsActivated(upgradeTime time.Time) bool
}

NetworkUpgrades represents network upgrade configuration

type Operation ยถ added in v1.14.2

type Operation struct {
	ChainID       ids.ID
	OperationType string
	Payload       []byte
	Signature     []byte
	Timestamp     time.Time
}

Operation represents an operation from any chain (A/B/C/M/X/Z)

func (*Operation) Hash ยถ added in v1.14.2

func (op *Operation) Hash() []byte

Hash returns the hash of an operation

type OperationPool ยถ added in v1.14.2

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

OperationPool manages operations from a chain

func NewOperationPool ยถ added in v1.14.2

func NewOperationPool(maxSize int) *OperationPool

NewOperationPool creates a new operation pool

func (*OperationPool) Add ยถ added in v1.14.2

func (op *OperationPool) Add(operation Operation) error

Add adds an operation to the pool

func (*OperationPool) GetBatch ยถ added in v1.14.2

func (op *OperationPool) GetBatch(maxBatch int) []Operation

GetBatch gets a batch of operations

type Parameters ยถ added in v1.14.2

type Parameters struct {
	// K is the number of consecutive successful polls required for finalization
	K int

	// Alpha is the required percentage of stake to consider a poll successful
	Alpha int

	// Beta is the number of polls with no progress before declaring the block stuck
	Beta int

	// ConcurrentRepolls is the number of concurrent polls to run
	ConcurrentRepolls int

	// OptimalProcessing is the optimal number of processing items
	OptimalProcessing int

	// MaxOutstandingItems is the maximum number of outstanding items
	MaxOutstandingItems int

	// MaxItemProcessingTime is the maximum time to process an item
	MaxItemProcessingTime time.Duration
}

Parameters holds consensus parameters

type PendingBlock ยถ added in v1.14.2

type PendingBlock struct {
	BlockID   ids.ID
	ChainID   ids.ID
	Height    uint64
	Timestamp time.Time

	// Operations from each chain
	Operations map[ids.ID][]Operation // Chain -> Operations

	// Finality signatures
	PChainBLS      *bls.Signature
	QChainRingtail *ringtail.Signature

	// Status
	PChainFinalized bool
	QChainFinalized bool
}

PendingBlock represents a block awaiting dual finality

type QuantumFinalityEngine ยถ added in v1.14.2

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

QuantumFinalityEngine coordinates dual-finality between P-Chain and Q-Chain

func NewQuantumFinalityEngine ยถ added in v1.14.2

func NewQuantumFinalityEngine(pChainID, qChainID ids.ID, validatorManager ValidatorChainManager) *QuantumFinalityEngine

NewQuantumFinalityEngine creates a new quantum finality engine

func (*QuantumFinalityEngine) CreateConsensusBlock ยถ added in v1.14.2

func (qfe *QuantumFinalityEngine) CreateConsensusBlock(height uint64) (*PendingBlock, error)

CreateConsensusBlock creates a new consensus block with operations from all chains

func (*QuantumFinalityEngine) GetFinalityStatus ยถ added in v1.14.2

func (qfe *QuantumFinalityEngine) GetFinalityStatus(blockID ids.ID) (pChain bool, qChain bool, finalized bool)

GetFinalityStatus returns the finality status of a block

func (*QuantumFinalityEngine) SubmitOperation ยถ added in v1.14.2

func (qfe *QuantumFinalityEngine) SubmitOperation(chainID ids.ID, op Operation) error

SubmitOperation submits an operation from a wrapped chain

func (*QuantumFinalityEngine) SubmitPChainBLS ยถ added in v1.14.2

func (qfe *QuantumFinalityEngine) SubmitPChainBLS(blockID ids.ID, sig *bls.Signature) error

SubmitPChainBLS submits P-Chain BLS signature for a block

func (*QuantumFinalityEngine) SubmitQChainRingtail ยถ added in v1.14.2

func (qfe *QuantumFinalityEngine) SubmitQChainRingtail(blockID ids.ID, sig *ringtail.Signature) error

SubmitQChainRingtail submits Q-Chain Ringtail signature for a block

func (*QuantumFinalityEngine) WaitForFinality ยถ added in v1.14.2

func (qfe *QuantumFinalityEngine) WaitForFinality(ctx context.Context, blockID ids.ID) (*FinalizedBlock, error)

WaitForFinality waits for a block to achieve quantum finality

func (*QuantumFinalityEngine) WrapChain ยถ added in v1.14.2

func (qfe *QuantumFinalityEngine) WrapChain(chainID ids.ID, chainName string) error

WrapChain adds a chain to be wrapped by quantum finality

type QuasarBlock ยถ

type QuasarBlock interface {
	Block

	// HasDualCert returns true if both BLS and RT certificates are present
	HasDualCert() bool

	// BLSSignature returns the aggregated BLS signature
	BLSSignature() []byte

	// RTCertificate returns the Ringtail certificate
	RTCertificate() []byte

	// SetQuantum marks this block as having quantum-secure finality
	SetQuantum() error
}

QuasarBlock extends Block with quantum-secure features

type QuasarVertex ยถ

type QuasarVertex interface {
	Vertex

	// HasDualCert returns true if both BLS and RT certificates are present
	HasDualCert() bool

	// BLSSignature returns the aggregated BLS signature
	BLSSignature() []byte

	// RTCertificate returns the Ringtail certificate
	RTCertificate() []byte

	// SetQuantum marks this vertex as having quantum-secure finality
	SetQuantum() error
}

QuasarVertex extends Vertex with quantum-secure features

type Registerer ยถ added in v1.14.2

type Registerer func(metrics.Registry) metrics.Registry

Registerer creates a metrics registerer

type RequestID ยถ added in v1.14.2

type RequestID struct {
}

RequestID represents a request identifier

type Requests ยถ added in v1.14.2

type Requests struct {
	RemoveRequests [][]byte   `serialize:"true"`
	PutRequests    []*Element `serialize:"true"`
	// contains filtered or unexported fields
}

Requests represents shared memory requests

type Sender ยถ added in v1.14.2

type Sender interface {
	// SendGetAcceptedFrontier sends a GetAcceptedFrontier message
	SendGetAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32) error

	// SendAcceptedFrontier sends an AcceptedFrontier message
	SendAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error

	// SendGetAccepted sends a GetAccepted message
	SendGetAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error

	// SendAccepted sends an Accepted message
	SendAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error

	// SendGet sends a Get message
	SendGet(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error

	// SendPut sends a Put message
	SendPut(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) error

	// SendPushQuery sends a PushQuery message
	SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, container []byte) error

	// SendPullQuery sends a PullQuery message
	SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerID ids.ID) error

	// SendChits sends a Chits message
	SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, acceptedID ids.ID) error
}

Sender sends consensus messages

type SharedMemory ยถ

type SharedMemory interface {
	// Get fetches the values corresponding to [keys] that have been sent from
	// [peerChainID]
	//
	// Invariant: Get guarantees that the resulting values array is the same
	//            length as keys.
	Get(peerChainID ids.ID, keys [][]byte) (values [][]byte, err error)

	// Indexed returns a paginated result of values that possess any of the
	// given traits and were sent from [peerChainID].
	Indexed(
		peerChainID ids.ID,
		traits [][]byte,
		startTrait,
		startKey []byte,
		limit int,
	) (
		values [][]byte,
		lastTrait,
		lastKey []byte,
		err error,
	)

	// Apply performs the requested set of operations by atomically applying
	// [requests] to their respective chainID keys in the map along with the
	// atomic value batch.
	Apply(requests map[ids.ID]*Requests, batch Batch) error
}

SharedMemory is the interface for shared memory operations

type State ยถ

type State uint32

State represents the current state of the consensus engine

const (
	// Bootstrapping state
	Bootstrapping State = iota
	// NormalOp represents normal operation state
	NormalOp
	// StateSyncing state
	StateSyncing
)

type ValidatorChainManager ยถ added in v1.14.2

type ValidatorChainManager interface {
	CanValidateChain(validatorID ids.NodeID, chainID ids.ID) bool
	GetValidatorsForChain(chainID ids.ID) []ids.NodeID
	GetChainValidatorSet(chainID ids.ID) (*ChainValidatorSet, error)
}

ValidatorChainManager interface for checking validator permissions

type ValidatorSet ยถ added in v1.14.2

type ValidatorSet interface {
	// GetValidatorSet returns the validator set at a given height
	GetValidatorSet(height uint64) (validators.Set, error)
}

ValidatorSet provides access to the validator set

type Vertex ยถ

type Vertex interface {
	Decidable

	// Parents returns the IDs of this vertex's parents
	Parents() []ids.ID

	// Verify that the state transition this vertex would make is valid
	Verify() error

	// Bytes returns the binary representation of this vertex
	Bytes() []byte

	// Height returns the height of this vertex
	Height() uint64

	// Epoch returns the epoch of this vertex
	Epoch() uint32

	// Txs returns the transactions in this vertex
	Txs() [][]byte
}

Vertex represents a vertex in a DAG that can be decided by consensus

type WarpMessage ยถ added in v1.14.2

type WarpMessage struct {
}

WarpMessage represents a warp message

type WarpSignature ยถ added in v1.14.2

type WarpSignature struct {
}

WarpSignature represents a warp signature

type WarpSigner ยถ added in v1.14.2

type WarpSigner interface {
	// Sign signs a warp message
	Sign(msg *WarpMessage) (*WarpSignature, error)
}

WarpSigner provides warp message signing functionality

Directories ยถ

Path Synopsis
consensus
crypto
bls
core/appsender/appsendermock
Package appsendermock is a generated GoMock package.
Package appsendermock is a generated GoMock package.
core/coremock
Package coremock is a generated GoMock package.
Package coremock is a generated GoMock package.
dag
dag/vertex/vertexmock
Package vertexmock is a generated GoMock package.
Package vertexmock is a generated GoMock package.
engines
networking
router/routermock
Package routermock is a generated GoMock package.
Package routermock is a generated GoMock package.
tracker/trackermock
Package trackermock is a generated GoMock package.
Package trackermock is a generated GoMock package.
SPDX-License-Identifier: BUSL-1.1
SPDX-License-Identifier: BUSL-1.1
ringtail
Package ringtail provides placeholder implementations for the Ringtail cryptographic library
Package ringtail provides placeholder implementations for the Ringtail cryptographic library
uptimemock
Package uptimemock is a generated GoMock package.
Package uptimemock is a generated GoMock package.
validatorsmock
Package validatorsmock is a generated GoMock package.
Package validatorsmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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