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

quasar

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: BSD-3-Clause Imports: 18 Imported by: 0

README

Quasar Post-Quantum Finality Layer

Quasar is a post-quantum finality layer for the Lux Network that provides dual-certificate finality using both classical BLS signatures and quantum-resistant Ringtail signatures.

Overview

Quasar acts as a cryptographic finality gadget that overlays the existing consensus ladder (Photon → Wave → Beam/Flare → Nova) and enforces finality on blocks in a manner resilient to quantum attacks.

Key Features
  • Dual-Certificate Finality: Blocks require both BLS and Ringtail signatures
  • Parallel Aggregation: BLS and Ringtail signatures are aggregated in parallel for performance
  • Precomputation: Ringtail signatures use precomputed values for <200ms signing
  • Key Rotation: Automatic rotation of post-quantum keys for enhanced security
  • Slashing Detection: Automatic detection of validator misbehavior
  • Sub-second Finality: Target <1s finality with ~700ms for BLS + ~200ms for Ringtail

Architecture

Nova Consensus
     ↓
OnNovaDecided()
     ↓
Quasar Engine
     ├── BLS Signing (parallel)
     └── Ringtail Signing (parallel)
           ↓
     Aggregator
     ├── BLS Aggregation
     └── Ringtail Aggregation
           ↓
    Dual Certificate
           ↓
    Block Finalized

Components

Engine (engine.go)

Main Quasar engine that coordinates finality process:

  • Receives blocks from Nova consensus
  • Manages dual signing process
  • Tracks finalized blocks
  • Emits finality and slashing events
Aggregator (aggregator.go)

Manages parallel signature aggregation:

  • Collects BLS and Ringtail shares
  • Performs threshold aggregation
  • Creates dual certificates
Key Manager (key_manager.go)

Handles cryptographic key lifecycle:

  • Manages BLS and Ringtail keypairs
  • Automatic key rotation
  • Epoch-based key validity
  • DKG support (for threshold Ringtail)
Precompute Pool (precompute_pool.go)

Optimizes Ringtail signing performance:

  • Maintains pool of precomputed values
  • Background generation
  • Automatic refilling
Slashing Detector (slashing_detector.go)

Detects validator misbehavior:

  • Double signing detection
  • Missing Ringtail signature detection
  • Invalid signature detection
Nova Integration (nova_integration.go)

Hooks Quasar into Nova consensus:

  • Intercepts Nova decisions
  • Triggers finality process
  • Reports finality status

Usage

Basic Integration
// Create Quasar configuration
quasarConfig := pq.Config{
    NodeID:          nodeID,
    Threshold:       67, // 67% of validators
    BLSSecretKey:    blsSK,
    RingtailSK:      rtSK,
    Validators:      validators,
    FinalityTimeout: 10 * time.Second,
    PrecompPoolSize: 100,
}

// Create Nova engine with Quasar
engine, err := nova.NewQuasarEngine(novaParams, quasarConfig)

// Initialize
ctx := context.Background()
err = engine.Initialize(ctx)

// Blocks will automatically achieve Quasar finality after Nova decides
Checking Finality
// Check if block is finalized
if engine.IsQuasarFinalized(blockID) {
    // Get certificate
    cert, _ := engine.GetQuasarCertificate(blockID)
    fmt.Printf("Block finalized with %d validators\n", len(cert.SignerIDs))
}
Monitoring
// Get performance metrics
metrics := engine.GetQuasarMetrics()
fmt.Printf("Blocks finalized: %d\n", metrics.BlocksFinalized)
fmt.Printf("Average latency: %v\n", metrics.FinalityLatency)
fmt.Printf("Slashing events: %d\n", metrics.SlashingEvents)

Security Considerations

  1. Dual Signatures: Both BLS and Ringtail must succeed for finality
  2. Key Rotation: Ringtail keys rotate periodically (default: 24h)
  3. Slashing: Automatic detection and evidence generation for misbehavior
  4. Threshold: Requires >67% of validators by default

Performance Targets

  • Finality Latency: <1 second
  • BLS Aggregation: ~700ms (network + computation)
  • Ringtail Addition: ~200ms (using precomputation)
  • Verification: <1ms per certificate
  • Throughput: No significant impact on consensus throughput

Testing

Run the test suite:

go test ./consensus/engine/quasar/...

Run benchmarks:

go test -bench=. ./consensus/engine/quasar/...

Future Enhancements

  1. Distributed Key Generation (DKG): Full implementation for threshold Ringtail
  2. Network Optimization: Dedicated channels for signature propagation
  3. Storage Optimization: Efficient certificate storage and pruning
  4. Light Client Support: Compact proofs for light clients

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInsufficientSignatures    = errors.New("insufficient signatures for finality")
	ErrBLSAggregationFailed      = errors.New("BLS aggregation failed")
	ErrRingtailAggregationFailed = errors.New("Ringtail aggregation failed")
	ErrDualCertMismatch          = errors.New("BLS and Ringtail certificates do not match")
	ErrQuasarTimeout             = errors.New("Quasar finality timeout")
)
View Source
var (
	ErrNoPrecompAvailable = errors.New("no precomputed signatures available")
	ErrPrecompExhausted   = errors.New("precomputation pool exhausted")
)
View Source
var DefaultParameters = Parameters{
	K:                     21,
	AlphaPreference:       13,
	AlphaConfidence:       18,
	Beta:                  8,
	MaxItemProcessingTime: 9630 * time.Millisecond,
}

Functions

func NewDAGEngine

func NewDAGEngine(ctx *core.Context, vm interface{}) dag.Engine

NewDAGEngine creates a new DAG consensus engine using Nebula This is used for the X-Chain (DAG-based UTXO chain)

func NewLinearEngine

func NewLinearEngine(ctx *core.Context, vm interface{}) chain.Engine

NewLinearEngine creates a new linear consensus engine using Pulsar This is used for the C-Chain (EVM-compatible chain)

func NewQChainEngine

func NewQChainEngine(ctx *core.Context, vm interface{}) chain.Engine

NewQChainEngine creates the quantum-safe platform chain engine This replaces the P-Chain with Q-Chain for platform operations

Types

type Aggregator

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

Aggregator manages parallel BLS and Ringtail signature aggregation

func NewAggregator

func NewAggregator(nodeID ids.NodeID, threshold int, validators map[ids.NodeID]*ValidatorKeys) *Aggregator

NewAggregator creates a new Quasar aggregator

func (*Aggregator) AddBLSShare

func (a *Aggregator) AddBLSShare(height uint64, nodeID ids.NodeID, sig *bls.Signature) error

AddBLSShare adds a BLS signature share for aggregation

func (*Aggregator) AddRingtailShare

func (a *Aggregator) AddRingtailShare(height uint64, nodeID ids.NodeID, share ringtail.Share) error

AddRingtailShare adds a Ringtail signature share for aggregation

func (*Aggregator) GetMetrics

func (a *Aggregator) GetMetrics() AggregatorMetrics

GetMetrics returns aggregator performance metrics

func (*Aggregator) UpdateValidatorKeys

func (a *Aggregator) UpdateValidatorKeys(validators map[ids.NodeID]*ValidatorKeys)

UpdateValidatorKeys updates the validator key set (for key rotation)

func (*Aggregator) WaitForCertificate

func (a *Aggregator) WaitForCertificate(ctx context.Context, height uint64, timeout time.Duration) (*DualCertificate, error)

WaitForCertificate waits for a dual certificate to be created for a block height

type AggregatorMetrics

type AggregatorMetrics struct {
	BLSAggregations      uint64
	RingtailAggregations uint64
	DualCertsCreated     uint64
	AggregationLatency   time.Duration
}

AggregatorMetrics tracks aggregation performance

type Cert

type Cert []byte

Cert represents a Ringtail certificate

func Aggregate

func Aggregate(shares []Share) (Cert, error)

Aggregate aggregates Ringtail shares into a certificate

type DoubleSignEvidence

type DoubleSignEvidence struct {
	Height     uint64
	BlockID1   ids.ID
	BlockID2   ids.ID
	Signature1 []byte
	Signature2 []byte
}

DoubleSignEvidence proves a validator signed two different blocks at same height

type DualCertificate

type DualCertificate struct {
	BlockID      ids.ID
	BlockHeight  uint64
	Epoch        uint32
	BLSSignature []byte
	RingtailCert []byte
	SignerIDs    []ids.NodeID
	Timestamp    time.Time
}

DualCertificate represents a finalized block with both BLS and Ringtail signatures

type Engine

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

Engine represents the quantum consensus engine

func NewEngine

func NewEngine(params Parameters, nodeID NodeID) *Engine

NewEngine creates a new quantum engine

func (*Engine) ConsensusStatus

func (e *Engine) ConsensusStatus() interface{}

ConsensusStatus returns the current consensus status

func (*Engine) Initialize

func (e *Engine) Initialize(ctx interface{}) error

Initialize initializes the engine

type EpochKeys

type EpochKeys struct {
	Epoch          uint32
	GroupPublicKey []byte // For Ringtail threshold
	ValidatorKeys  map[ids.NodeID]*ValidatorKeys
	ActivationTime time.Time
	ExpirationTime time.Time
}

EpochKeys represents keys for a specific epoch

type InvalidSignatureEvidence

type InvalidSignatureEvidence struct {
	Height  uint64
	BlockID ids.ID
	HasBLS  bool
	HasRT   bool
}

InvalidSignatureEvidence proves a validator's signature is invalid

type KeyManager

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

KeyManager manages validator keys and rotation for Quasar

func NewKeyManager

func NewKeyManager(nodeID ids.NodeID, blsSigner bls.Signer, ringtailSK []byte) *KeyManager

NewKeyManager creates a new key manager

func (*KeyManager) GetBLSSigner

func (km *KeyManager) GetBLSSigner() (bls.Signer, *bls.PublicKey)

GetBLSSigner returns the current BLS signer and public key

func (*KeyManager) GetCurrentEpoch

func (km *KeyManager) GetCurrentEpoch() uint32

GetCurrentEpoch returns the current key epoch

func (*KeyManager) GetGroupPublicKey

func (km *KeyManager) GetGroupPublicKey(epoch uint32) []byte

GetGroupPublicKey returns the group public key for an epoch

func (*KeyManager) GetRingtailKeyPair

func (km *KeyManager) GetRingtailKeyPair() ([]byte, []byte)

GetRingtailKeyPair returns the current Ringtail keypair

func (*KeyManager) InitiateDKG

func (km *KeyManager) InitiateDKG(ctx context.Context, participants []ids.NodeID) error

InitiateDKG starts distributed key generation for a new epoch

func (*KeyManager) ProcessDKGMessage

func (km *KeyManager) ProcessDKGMessage(from ids.NodeID, msg []byte) error

ProcessDKGMessage handles DKG protocol messages

func (*KeyManager) SetRotationInterval

func (km *KeyManager) SetRotationInterval(interval time.Duration)

SetRotationInterval updates the key rotation interval

func (*KeyManager) Start

func (km *KeyManager) Start(ctx context.Context) error

Start begins key management operations

func (*KeyManager) Stop

func (km *KeyManager) Stop()

Stop stops key management operations

type MissingRingtailEvidence

type MissingRingtailEvidence struct {
	Height       uint64
	BlockID      ids.ID
	BLSSignature []byte
}

MissingRingtailEvidence proves a validator signed BLS but not Ringtail

type NebulaDAGEngine

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

NebulaDAGEngine implements DAG consensus using Nebula with Quasar validation Used for X-Chain (Exchange Chain) - UTXO-based with DAG structure

func (*NebulaDAGEngine) Accepted

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

func (*NebulaDAGEngine) AcceptedFrontier

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

func (*NebulaDAGEngine) AcceptedStateSummary

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

func (*NebulaDAGEngine) Ancestors

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

func (*NebulaDAGEngine) AppGossip

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

func (*NebulaDAGEngine) AppRequest

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

func (*NebulaDAGEngine) AppResponse

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

func (*NebulaDAGEngine) Chits

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

func (*NebulaDAGEngine) Connected

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

func (*NebulaDAGEngine) Context

func (n *NebulaDAGEngine) Context() *core.Context

func (*NebulaDAGEngine) CrossChainAppRequest

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

func (*NebulaDAGEngine) CrossChainAppResponse

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

func (*NebulaDAGEngine) Disconnected

func (n *NebulaDAGEngine) Disconnected(ctx context.Context, nodeID ids.NodeID) error

func (*NebulaDAGEngine) Get

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

func (*NebulaDAGEngine) GetAccepted

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

func (*NebulaDAGEngine) GetAcceptedFrontier

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

func (*NebulaDAGEngine) GetAcceptedStateSummary

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

func (*NebulaDAGEngine) GetAncestors

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

func (*NebulaDAGEngine) GetStateSummaryFrontier

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

func (*NebulaDAGEngine) GetVM

func (n *NebulaDAGEngine) GetVM() interface{}

func (*NebulaDAGEngine) GetVertex

func (n *NebulaDAGEngine) GetVertex(vtxID ids.ID) (dag.Vertex, error)

func (*NebulaDAGEngine) GetVtx

func (n *NebulaDAGEngine) GetVtx(vtxID ids.ID) (dag.Vertex, error)

func (*NebulaDAGEngine) HealthCheck

func (n *NebulaDAGEngine) HealthCheck(ctx context.Context) (interface{}, error)

func (*NebulaDAGEngine) Initialize

func (n *NebulaDAGEngine) Initialize(ctx context.Context, params dag.Parameters) error

func (*NebulaDAGEngine) Issued

func (n *NebulaDAGEngine) Issued(vtx dag.Vertex) bool

func (*NebulaDAGEngine) Notify

func (n *NebulaDAGEngine) Notify(ctx context.Context, msg core.Message) error

func (*NebulaDAGEngine) PullQuery

func (n *NebulaDAGEngine) PullQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID, requestedHeight uint64) error

func (*NebulaDAGEngine) PushQuery

func (n *NebulaDAGEngine) PushQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte, requestedHeight uint64) error

func (*NebulaDAGEngine) Put

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

Put handles incoming vertices - convert to Nebula photons

func (*NebulaDAGEngine) QueryFailed

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

func (*NebulaDAGEngine) Shutdown

func (n *NebulaDAGEngine) Shutdown(ctx context.Context) error

func (*NebulaDAGEngine) Start

func (n *NebulaDAGEngine) Start(ctx context.Context, startReqID uint32) error

func (*NebulaDAGEngine) StateSummaryFrontier

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

func (*NebulaDAGEngine) Stop

func (n *NebulaDAGEngine) Stop(ctx context.Context) error

func (*NebulaDAGEngine) StopVertexAccepted

func (n *NebulaDAGEngine) StopVertexAccepted() bool

type NodeID

type NodeID string

NodeID represents a node identifier

type NovaDecision

type NovaDecision struct {
	BlockID   ids.ID
	Height    uint64
	Hash      []byte
	Timestamp int64
	Status    choices.Status
}

NovaDecision represents a block decided by Nova

type NovaHook

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

NovaHook provides integration between Nova consensus and Quasar finality

func AttachQuasarToNova

func AttachQuasarToNova(novaEngine interface{}, quasarEngine *QuasarEngineWrapper) (*NovaHook, error)

AttachQuasarToNova attaches Quasar finality to a Nova engine

func NewNovaHook

func NewNovaHook(quasarEngine *QuasarEngineWrapper) *NovaHook

NewNovaHook creates a new Nova-Quasar integration hook

func (*NovaHook) Disable

func (nh *NovaHook) Disable()

Disable disables Quasar finality (for testing/rollback)

func (*NovaHook) Enable

func (nh *NovaHook) Enable()

Enable enables Quasar finality for Nova decisions

func (*NovaHook) GetPendingCount

func (nh *NovaHook) GetPendingCount() int

GetPendingCount returns the number of blocks awaiting finality

func (*NovaHook) IsFinalized

func (nh *NovaHook) IsFinalized(blockID ids.ID) bool

IsFinalized checks if a block has achieved Quasar finality

func (*NovaHook) OnNovaDecided

func (nh *NovaHook) OnNovaDecided(ctx context.Context, blockID ids.ID, height uint64, blockHash []byte) error

OnNovaDecided is called when Nova decides on a block This is the main integration point

func (*NovaHook) OnQuasarFinalized

func (nh *NovaHook) OnQuasarFinalized(blockID ids.ID, cert *DualCertificate)

OnQuasarFinalized is called when Quasar achieves finality

func (*NovaHook) OnSlashingDetected

func (nh *NovaHook) OnSlashingDetected(event *SlashingEvent)

OnSlashingDetected is called when misbehavior is detected

func (*NovaHook) SetFinalizedCallback

func (nh *NovaHook) SetFinalizedCallback(cb func(ids.ID, *DualCertificate))

SetFinalizedCallback sets the callback for finalized blocks

func (*NovaHook) SetSlashingCallback

func (nh *NovaHook) SetSlashingCallback(cb func(*SlashingEvent))

SetSlashingCallback sets the callback for slashing events

func (*NovaHook) Start

func (nh *NovaHook) Start(ctx context.Context)

Start starts listening to Quasar events

type Parameters

type Parameters struct {
	K                     int
	AlphaPreference       int
	AlphaConfidence       int
	Beta                  int
	MaxItemProcessingTime time.Duration
}

Parameters for quantum consensus

type PendingBlock

type PendingBlock struct {
	ID        ids.ID
	BlockID   ids.ID
	Height    uint64
	Timestamp time.Time
	Hash      []byte
}

PendingBlock represents a block pending finalization

type Photon

type Photon struct {
	ID        interface{}
	Frequency float64
	Amplitude float64
	Phase     float64
	Timestamp time.Time
	Data      []byte
}

Photon represents a quantum photon in the system

type Precomp

type Precomp interface{}

Precomp represents precomputed Ringtail values

func Precompute

func Precompute(sk []byte) (Precomp, error)

Precompute precomputes Ringtail values from a secret key

type PrecomputePool

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

PrecomputePool manages a pool of precomputed Ringtail signatures

func NewPrecomputePool

func NewPrecomputePool(targetSize int) *PrecomputePool

NewPrecomputePool creates a new precomputation pool

func (*PrecomputePool) Get

func (p *PrecomputePool) Get() (ringtail.Precomp, error)

Get retrieves a precomputed signature from the pool

func (*PrecomputePool) Initialize

func (p *PrecomputePool) Initialize(sk []byte) error

Initialize starts the precomputation worker with the given secret key

func (*PrecomputePool) Metrics

func (p *PrecomputePool) Metrics() map[string]uint64

Metrics returns pool statistics

func (*PrecomputePool) Size

func (p *PrecomputePool) Size() int

Size returns the current pool size

func (*PrecomputePool) Stop

func (p *PrecomputePool) Stop()

Stop stops the precomputation worker

type QBlock

type QBlock struct {
	QBlockID  ids.ID
	Height    uint64
	VertexIDs []ids.ID
}

QBlock represents a quantum block

type QuasarBlock

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

Block implementation for Quasar

func (*QuasarBlock) Accept

func (b *QuasarBlock) Accept() error

func (*QuasarBlock) Bytes

func (b *QuasarBlock) Bytes() []byte

func (*QuasarBlock) Height

func (b *QuasarBlock) Height() uint64

func (*QuasarBlock) ID

func (b *QuasarBlock) ID() ids.ID

func (*QuasarBlock) Parent

func (b *QuasarBlock) Parent() ids.ID

func (*QuasarBlock) Reject

func (b *QuasarBlock) Reject() error

func (*QuasarBlock) Status

func (b *QuasarBlock) Status() choices.Status

func (*QuasarBlock) Time

func (b *QuasarBlock) Time() uint64

func (*QuasarBlock) Verify

func (b *QuasarBlock) Verify(context.Context) error

type QuasarEngineWrapper

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

QuasarEngineWrapper wraps the quantum-safe Quasar consensus engine to implement both DAG and Linear engine interfaces for the node

func (*QuasarEngineWrapper) Accepted

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

func (*QuasarEngineWrapper) AcceptedFrontier

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

func (*QuasarEngineWrapper) AcceptedStateSummary

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

func (*QuasarEngineWrapper) Ancestors

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

func (*QuasarEngineWrapper) AppGossip

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

func (*QuasarEngineWrapper) AppRequest

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

func (*QuasarEngineWrapper) AppResponse

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

func (*QuasarEngineWrapper) Chits

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

func (*QuasarEngineWrapper) Connected

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

func (*QuasarEngineWrapper) Context

func (w *QuasarEngineWrapper) Context() *core.Context

func (*QuasarEngineWrapper) CrossChainAppRequest

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

func (*QuasarEngineWrapper) CrossChainAppResponse

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

func (*QuasarEngineWrapper) Disconnected

func (w *QuasarEngineWrapper) Disconnected(ctx context.Context, nodeID ids.NodeID) error

func (*QuasarEngineWrapper) Get

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

func (*QuasarEngineWrapper) GetAccepted

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

func (*QuasarEngineWrapper) GetAcceptedFrontier

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

func (*QuasarEngineWrapper) GetAcceptedStateSummary

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

func (*QuasarEngineWrapper) GetAncestor

func (w *QuasarEngineWrapper) GetAncestor(blkID ids.ID, height uint64) (ids.ID, error)

func (*QuasarEngineWrapper) GetAncestors

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

func (*QuasarEngineWrapper) GetBlock

func (w *QuasarEngineWrapper) GetBlock(blkID ids.ID) (block.Block, error)

func (*QuasarEngineWrapper) GetFinalityChannel

func (w *QuasarEngineWrapper) GetFinalityChannel() <-chan *DualCertificate

GetFinalityChannel returns a channel that signals when finality is achieved

func (*QuasarEngineWrapper) GetSlashingChannel

func (w *QuasarEngineWrapper) GetSlashingChannel() <-chan *SlashingEvent

GetSlashingChannel returns a channel that signals slashing events

func (*QuasarEngineWrapper) GetStateSummaryFrontier

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

func (*QuasarEngineWrapper) GetVM

func (w *QuasarEngineWrapper) GetVM() interface{}

func (*QuasarEngineWrapper) GetVertex

func (w *QuasarEngineWrapper) GetVertex(vtxID ids.ID) (dag.Vertex, error)

func (*QuasarEngineWrapper) GetVtx

func (w *QuasarEngineWrapper) GetVtx(vtxID ids.ID) (dag.Vertex, error)

func (*QuasarEngineWrapper) HealthCheck

func (w *QuasarEngineWrapper) HealthCheck(ctx context.Context) (interface{}, error)

func (*QuasarEngineWrapper) Initialize

func (w *QuasarEngineWrapper) Initialize(ctx context.Context, params dag.Parameters) error

func (*QuasarEngineWrapper) IsFinalized

func (w *QuasarEngineWrapper) IsFinalized(blockID ids.ID) bool

IsFinalized checks if a block has achieved Quasar finality

func (*QuasarEngineWrapper) Issued

func (w *QuasarEngineWrapper) Issued(vtx dag.Vertex) bool

func (*QuasarEngineWrapper) LastAccepted

func (w *QuasarEngineWrapper) LastAccepted() (ids.ID, uint64)

func (*QuasarEngineWrapper) Notify

func (w *QuasarEngineWrapper) Notify(ctx context.Context, msg core.Message) error

func (*QuasarEngineWrapper) OnNovaDecided

func (w *QuasarEngineWrapper) OnNovaDecided(ctx context.Context, blockID ids.ID, height uint64, blockHash []byte) error

OnNovaDecided is called when Nova DAG reaches a decision

func (*QuasarEngineWrapper) PullQuery

func (w *QuasarEngineWrapper) PullQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID, requestedHeight uint64) error

func (*QuasarEngineWrapper) PushQuery

func (w *QuasarEngineWrapper) PushQuery(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte, requestedHeight uint64) error

func (*QuasarEngineWrapper) Put

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

func (*QuasarEngineWrapper) QueryFailed

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

func (*QuasarEngineWrapper) Shutdown

func (w *QuasarEngineWrapper) Shutdown(ctx context.Context) error

func (*QuasarEngineWrapper) Start

func (w *QuasarEngineWrapper) Start(ctx context.Context, startReqID uint32) error

func (*QuasarEngineWrapper) StateSummaryFrontier

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

func (*QuasarEngineWrapper) Stop

func (*QuasarEngineWrapper) StopVertexAccepted

func (w *QuasarEngineWrapper) StopVertexAccepted() bool

func (*QuasarEngineWrapper) VerifyHeightIndex

func (w *QuasarEngineWrapper) VerifyHeightIndex() error

type QuasarVertex

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

Vertex implementation for Quasar

func (*QuasarVertex) Accept

func (v *QuasarVertex) Accept() error

func (*QuasarVertex) Bytes

func (v *QuasarVertex) Bytes() []byte

func (*QuasarVertex) Epoch

func (v *QuasarVertex) Epoch() uint32

func (*QuasarVertex) Height

func (v *QuasarVertex) Height() uint64

func (*QuasarVertex) ID

func (v *QuasarVertex) ID() ids.ID

func (*QuasarVertex) Parents

func (v *QuasarVertex) Parents() ([]ids.ID, error)

func (*QuasarVertex) Reject

func (v *QuasarVertex) Reject() error

func (*QuasarVertex) Status

func (v *QuasarVertex) Status() choices.Status

func (*QuasarVertex) Timestamp

func (v *QuasarVertex) Timestamp() int64

func (*QuasarVertex) Verify

func (v *QuasarVertex) Verify(context.Context) error

type Share

type Share []byte

Share represents a Ringtail share

func QuickSign

func QuickSign(pre Precomp, msg []byte) (Share, error)

QuickSign creates a Ringtail share

type SignatureRecord

type SignatureRecord struct {
	BlockID   ids.ID
	BlockHash []byte
	Signature []byte
	Timestamp int64
}

SignatureRecord tracks signature details for slashing detection

type SlashingDetector

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

SlashingDetector detects validator misbehavior in Quasar finality

func NewSlashingDetector

func NewSlashingDetector(validators map[ids.NodeID]*ValidatorKeys) *SlashingDetector

NewSlashingDetector creates a new slashing detector

func (*SlashingDetector) Analyze

func (sd *SlashingDetector) Analyze(block *PendingBlock, cert *DualCertificate) *SlashingEvent

Analyze analyzes a failed certificate for misbehavior

func (*SlashingDetector) CheckDoubleSign

func (sd *SlashingDetector) CheckDoubleSign(height uint64, nodeID ids.NodeID, blockID ids.ID) bool

CheckDoubleSign checks if a validator has double-signed at a height

func (*SlashingDetector) CleanupHeight

func (sd *SlashingDetector) CleanupHeight(height uint64)

CleanupHeight removes tracking data for old heights

func (*SlashingDetector) RecordBLSSignature

func (sd *SlashingDetector) RecordBLSSignature(height uint64, nodeID ids.NodeID, blockID ids.ID, blockHash []byte, sig []byte) *SlashingEvent

RecordBLSSignature records a BLS signature for tracking

func (*SlashingDetector) RecordRingtailShare

func (sd *SlashingDetector) RecordRingtailShare(height uint64, nodeID ids.NodeID, blockID ids.ID, share []byte) *SlashingEvent

RecordRingtailShare records a Ringtail signature share

type SlashingEvent

type SlashingEvent struct {
	Type      string
	NodeID    ids.NodeID
	Height    uint64
	BlockID   ids.ID
	Evidence  []byte
	Timestamp time.Time
}

SlashingEvent represents a detected slashing condition

type ValidatorKeys

type ValidatorKeys struct {
	NodeID         ids.NodeID
	BLSPublicKey   *bls.PublicKey
	RingtailPubKey []byte
	Epoch          uint32
}

ValidatorKeys holds both BLS and Ringtail public keys for a validator

Jump to

Keyboard shortcuts

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