dag

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Antichain

func Antichain[V VID](store Store[V], vertices []V) []V

Antichain computes an antichain (set of mutually unreachable vertices) in the DAG

func BeyondHorizon

func BeyondHorizon[V VID](store Store[V], vertex V, horizon EventHorizon[V]) bool

BeyondHorizon checks if a vertex is beyond the event horizon (finalized)

func ChooseFrontier

func ChooseFrontier[V VID](frontier []V) []V

ChooseFrontier selects appropriate parents for a new vertex proposal This typically involves choosing a subset of frontier vertices to reference

func ComputeFinalizableSet

func ComputeFinalizableSet[V VID](store Store[V], candidates []V, params Params) []V

ComputeFinalizableSet returns vertices that can be finalized based on cert/skip analysis

func ComputeHorizonOrder

func ComputeHorizonOrder[V VID](store Store[V], horizon EventHorizon[V]) []V

ComputeHorizonOrder determines the canonical order of vertices beyond the event horizon

func ComputeSafePrefix

func ComputeSafePrefix[V VID](store Store[V], frontier []V) []V

ComputeSafePrefix computes the safe prefix of vertices that can be committed based on DAG order theory using horizon (reachability) and flare (cert/skip) analysis

func HasCertificate

func HasCertificate(v View, proposer Meta, p Params) bool

Cert: >=2f+1 in r+1 support proposer(author,round). Skip: >=2f+1 in r+1 not supporting.

func HasCertificateGeneric

func HasCertificateGeneric[V VID](store Store[V], vertex V, params Params) bool

HasCertificateGeneric checks if a vertex has a certificate (≥2f+1 validators support it)

func HasSkip

func HasSkip(v View, proposer Meta, p Params) bool

func HasSkipGeneric

func HasSkipGeneric[V VID](store Store[V], vertex V, params Params) bool

HasSkipGeneric checks if a vertex has a skip certificate (≥2f+1 validators do not support it)

func IsReachable

func IsReachable[V VID](store Store[V], from, to V) bool

IsReachable checks if vertex 'from' can reach vertex 'to' in the DAG

func LCA

func LCA[V VID](store Store[V], a, b V) V

LCA finds the lowest common ancestor of two vertices

func UpdateDAGFrontier

func UpdateDAGFrontier[V VID](store Store[V], finalized []V) []V

UpdateDAGFrontier computes the new frontier after finalizing a set of vertices

Types

type BlockView

type BlockView[V VID] interface {
	ID() V
	Parents() []V
	Author() string
	Round() uint64
}

BlockView represents a view of a block/vertex in the DAG (generic version)

type Decision

type Decision int

Decision represents the outcome of cert/skip analysis

const (
	DecideUndecided Decision = iota
	DecideCommit             // Certificate found - vertex should be committed
	DecideSkip               // Skip certificate found - vertex should be skipped
)

func ClassifyGeneric

func ClassifyGeneric[V VID](store Store[V], vertex V, params Params) Decision

ClassifyGeneric determines the status of a vertex based on cert/skip analysis

type EventHorizon

type EventHorizon[V VID] struct {
	// Checkpoint represents a finalized state boundary
	Checkpoint V
	// Height at which this horizon was established
	Height uint64
	// Validators that signed this horizon
	Validators []string
	// Post-quantum signature (Ringtail + BLS)
	Signature []byte
}

EventHorizon represents the finality boundary in Quasar P-Chain consensus Beyond this horizon, no events can affect the finalized state

func Horizon

func Horizon[V VID](store Store[V], checkpoints []EventHorizon[V]) EventHorizon[V]

Horizon computes the event horizon for Quasar P-Chain finality This determines which vertices are beyond the point of no return

type Flare

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

func NewFlare

func NewFlare(p Params) *Flare

func (*Flare) Classify

func (f *Flare) Classify(v View, proposer Meta) Decision

type Meta

type Meta interface {
	ID() VertexID
	Author() string
	Round() uint64
	Parents() []VertexID
}

Meta interface represents metadata for a DAG vertex

type Params

type Params struct{ N, F int }

Params holds DAG consensus parameters

type Store

type Store[V VID] interface {
	Head() []V
	Get(V) (BlockView[V], bool)
	Children(V) []V
}

Store represents DAG storage interface (generic version)

type VID

type VID interface{ comparable }

VID represents a generic vertex identifier for new protocol interfaces

type VertexID

type VertexID [32]byte

VertexID represents a vertex identifier in the DAG

type View

type View interface {
	Get(VertexID) (Meta, bool)
	ByRound(round uint64) []Meta
	Supports(from VertexID, author string, round uint64) bool
}

View interface provides access to DAG structure and vertex relationships

Jump to

Keyboard shortcuts

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