Files
node/consensus
Hanzo AI 1ceb309a24 test: raise quasar coverage 40.6% -> 43.5%
Config validation, quorum params, lifecycle, set/get finalized,
BLS signature types, CoronaCoordinator sign/verify paths,
active/inactive validator weight filtering.

Remaining uncovered: GPU/NTT hardware code (requires CGO + GPU),
processFinality integration (requires P-Chain provider), Verify
(requires real BLS/Corona key material).
2026-04-13 05:07:24 -07:00
..

Consensus Package

This package provides consensus infrastructure for the Lux node.

Overview

The consensus package contains:

  • Acceptor: Callback mechanism for accepted blocks/vertices
  • Quasar: Hybrid quantum-safe finality engine (BLS + Corona)
  • Engine: Chain and DAG consensus engine interfaces

Vote Terminology

This package uses "Vote" as the semantic name for validator responses to block proposals.

Vote (wire format: Chits): A validator's agreement or preference for a specific block. On the network wire, votes are transmitted using the "Chits" message format for backwards compatibility with existing protocols.

// VoteMessage represents a vote for a specific block.
// This is a semantic wrapper - the wire format remains Chits.
type VoteMessage struct {
    BlockID   ids.ID
    RequestID uint32
}

The UnsolicitedVoteRequestID constant (value 0) indicates a vote sent without a prior request, used in fast-follow scenarios.

Package Structure

consensus/
  acceptor.go     # Acceptor interface and group management
  engine/
    chain/
      vote.go     # Vote message types (wire format: Chits)
  quasar/
    quasar.go     # Hybrid BLS + Corona finality
    types.go      # Signature types and interfaces
    config.go     # Configuration
    gpu_ntt.go    # GPU acceleration for NTT operations

Acceptor

The Acceptor interface is called before containers are committed as accepted:

type Acceptor interface {
    Accept(rt *runtime.Runtime, containerID ids.ID, container []byte) error
}

Multiple acceptors can be registered per chain via AcceptorGroup.

Quasar Consensus

Quasar provides hybrid quantum-safe finality by combining:

  1. BLS Aggregate Signatures - Fast classical signatures (96 bytes)
  2. Corona Threshold Signatures - Post-quantum threshold signatures (t-of-n)

Both signature paths run in parallel, and blocks achieve finality only when both complete with sufficient weight.

See quasar/README.md for detailed documentation.