nebula

package
v1.22.25 Latest Latest
Warning

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

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

Documentation

Overview

Package nebula provides DAG consensus mode.

Nebula implements directed acyclic graph (DAG) consensus where vertices can have multiple parents and progress in parallel. It wraps the field engine to provide DAG-specific semantics: frontier tracking, vertex proposal, and parallel finality.

In the cosmic metaphor, a nebula is a stellar nursery - a cloud of possibilities collapsing into ordered structure, representing parallel block creation that eventually achieves consensus ordering.

Nebula is designed for high-throughput chains that benefit from parallel block production, such as the X-Chain for asset transfers.

Key concepts:

  • DAG structure: vertices can have multiple parents
  • Parallel finality: multiple vertices can be finalized concurrently
  • Frontier tracking: maintains the DAG tips (unfinalized vertices)
  • Causal ordering: ensures consistent total ordering of finalized vertices

Usage:

cfg := nebula.Config{
    PollSize:   20,
    Alpha:      0.8,
    Beta:       15,
    RoundTO:    250 * time.Millisecond,
}
n := nebula.NewNebula(cfg, cut, transport, store, proposer, committer)
n.Start(ctx)

See also: field (underlying engine), wave (voting primitive), horizon (finality).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PollSize   int           // sample size for voting
	Alpha      float64       // threshold ratio
	Beta       uint32        // confidence threshold
	RoundTO    time.Duration // round timeout
	GenesisSet []byte        // genesis vertex set
}

Config holds configuration for Nebula consensus mode

type Nebula

type Nebula[V VID] struct {
	// contains filtered or unexported fields
}

Nebula implements DAG consensus using the internal Field engine

func NewNebula

func NewNebula[V VID](cfg Config, cut prism.Cut[V], tx wave.Transport[V], store field.Store[V], prop field.Proposer[V], com field.Committer[V]) *Nebula[V]

NewNebula creates a new Nebula instance with Field engine

func (*Nebula[V]) GetCommittedVertices

func (n *Nebula[V]) GetCommittedVertices() []V

GetCommittedVertices returns vertices that have been committed in order

func (*Nebula[V]) GetFrontier

func (n *Nebula[V]) GetFrontier() []V

GetFrontier returns the current DAG frontier (tips)

func (*Nebula[V]) IsFinalized

func (n *Nebula[V]) IsFinalized(vertex V) bool

IsFinalized checks if a vertex is finalized in the DAG

func (*Nebula[V]) OnObserve

func (n *Nebula[V]) OnObserve(ctx context.Context, vertex V)

OnObserve should be called when observing new vertices from the network

func (*Nebula[V]) ProposeVertex

func (n *Nebula[V]) ProposeVertex(ctx context.Context, parents []V) (V, error)

ProposeVertex proposes a new vertex to the DAG

func (*Nebula[V]) Start

func (n *Nebula[V]) Start(ctx context.Context) error

Start begins Nebula DAG consensus operation

func (*Nebula[V]) Stop

func (n *Nebula[V]) Stop(ctx context.Context) error

Stop ends Nebula DAG consensus operation

func (*Nebula[V]) Tick

func (n *Nebula[V]) Tick(ctx context.Context) error

Tick performs one consensus round for DAG progression

type VID

type VID interface{ comparable }

VID represents a vertex identifier in the DAG

Jump to

Keyboard shortcuts

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