Documentation
¶
Overview ¶
Package nova provides linear blockchain consensus mode.
Nova implements classic linear chain consensus where blocks extend sequentially. It wraps the ray engine to provide blockchain-specific semantics: height tracking, preference management, and sequential finality.
In the cosmic metaphor, a nova is a stellar explosion - a singular, decisive event in linear time, representing the finality of each block in sequence.
Nova is designed for chains that require strict ordering and single-chain semantics, such as the P-Chain for platform operations.
Key concepts:
- Linear progression: blocks extend a single chain
- Sequential finality: one block finalized at a time
- Height tracking: maintains current blockchain height
- Preference tracking: manages preferred block selection
Usage:
cfg := nova.Config{
SampleSize: 20,
Alpha: 0.8,
Beta: 15,
RoundTO: 250 * time.Millisecond,
}
n := nova.NewNova(cfg, cut, transport, source, sink)
n.Start(ctx)
See also: ray (underlying engine), wave (voting primitive).
Index ¶
- type Config
- type Nova
- func (n *Nova[T]) GetPreference() (T, bool)
- func (n *Nova[T]) Height() uint64
- func (n *Nova[T]) IsFinalized(block T) bool
- func (n *Nova[T]) ProposeBlock(ctx context.Context, block T) error
- func (n *Nova[T]) Start(ctx context.Context) error
- func (n *Nova[T]) Stop(ctx context.Context) error
- func (n *Nova[T]) Tick(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
SampleSize int // k parameter for sampling
Alpha float64 // threshold ratio
Beta uint32 // confidence threshold
RoundTO time.Duration // round timeout
GenesisHash [32]byte // genesis block hash
}
Config holds configuration for Nova consensus mode
type Nova ¶
type Nova[T comparable] struct { // contains filtered or unexported fields }
Nova implements linear blockchain consensus using the internal Ray engine
func NewNova ¶
func NewNova[T comparable](cfg Config, cut prism.Cut[T], tx wave.Transport[T], source ray.Source[T], sink ray.Sink[T]) *Nova[T]
NewNova creates a new Nova instance with Ray engine
func (*Nova[T]) GetPreference ¶
GetPreference returns the current preferred block
func (*Nova[T]) IsFinalized ¶
IsFinalized checks if a block is finalized
func (*Nova[T]) ProposeBlock ¶
ProposeBlock proposes a new block for the current height