Documentation
¶
Overview ¶
Package engine houses the three consensus engines: chain, dag, and pq.
Each engine orchestrates a specific transaction topology: - chain: Linear consensus for sequential blocks - dag: DAG-based consensus for parallel, causally-ordered vertices - pq: Post-quantum hardened consensus with quantum-safe certificates
All engines share the same algorithmic pipeline but differ in their data structures and finality mechanisms.
Index ¶
- func DefaultConfig() types.Config
- type Chain
- func (c *Chain) Add(ctx context.Context, block *types.Block) error
- func (c *Chain) GetStatus(id types.ID) types.Status
- func (c *Chain) IsAccepted(id types.ID) bool
- func (c *Chain) RecordVote(ctx context.Context, vote *types.Vote) error
- func (c *Chain) Start(ctx context.Context) error
- func (c *Chain) Stop() error
- type Engine
- type LuxConsensus
- func (lc *LuxConsensus) Decided() bool
- func (lc *LuxConsensus) Decision(item ids.ID) (types.Decision, bool)
- func (lc *LuxConsensus) Parameters() config.Parameters
- func (lc *LuxConsensus) Poll(responses map[ids.ID]int) bool
- func (lc *LuxConsensus) Preference() ids.ID
- func (lc *LuxConsensus) RecordVote(item ids.ID)
- type SimpleCut
- type SimpleTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶ added in v1.22.0
DefaultConfig returns the default chain configuration
Types ¶
type Chain ¶ added in v1.22.0
type Chain struct {
// contains filtered or unexported fields
}
Chain represents a linear blockchain consensus engine
func (*Chain) IsAccepted ¶ added in v1.22.0
IsAccepted returns whether a block has been accepted
func (*Chain) RecordVote ¶ added in v1.22.0
RecordVote records a vote for a block
type Engine ¶ added in v1.22.0
type Engine interface {
// Add a new block to the consensus
Add(ctx context.Context, block *types.Block) error
// RecordVote records a vote for a block
RecordVote(ctx context.Context, vote *types.Vote) error
// IsAccepted returns whether a block has been accepted
IsAccepted(id types.ID) bool
// GetStatus returns the status of a block
GetStatus(id types.ID) types.Status
// Start the consensus engine
Start(ctx context.Context) error
// Stop the consensus engine
Stop() error
}
Engine is the main consensus engine interface
type LuxConsensus ¶
type LuxConsensus struct {
// contains filtered or unexported fields
}
LuxConsensus implements Lux's consensus protocol using Photon → Wave → Focus → Prism → Quasar
func NewLuxConsensus ¶
func NewLuxConsensus(k int, alpha int, beta int) *LuxConsensus
NewLuxConsensus creates a new Lux consensus instance
func (*LuxConsensus) Decided ¶
func (lc *LuxConsensus) Decided() bool
Decided returns whether consensus has been reached
func (*LuxConsensus) Parameters ¶
func (lc *LuxConsensus) Parameters() config.Parameters
Parameters returns the consensus parameters
func (*LuxConsensus) Poll ¶
func (lc *LuxConsensus) Poll(responses map[ids.ID]int) bool
Poll conducts a consensus poll using Lux protocols
func (*LuxConsensus) Preference ¶
func (lc *LuxConsensus) Preference() ids.ID
Preference returns the current preferred item
func (*LuxConsensus) RecordVote ¶
func (lc *LuxConsensus) RecordVote(item ids.ID)
RecordVote records a vote for an item
type SimpleCut ¶
type SimpleCut struct {
// contains filtered or unexported fields
}
SimpleCut implements a basic Cut for sampling
type SimpleTransport ¶
type SimpleTransport struct {
// contains filtered or unexported fields
}
SimpleTransport implements basic transport for voting
func (*SimpleTransport) MakeLocalPhoton ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bft provides a thin wrapper around github.com/luxfi/bft (Simplex BFT) for integration with the Lux consensus engine interface.
|
Package bft provides a thin wrapper around github.com/luxfi/bft (Simplex BFT) for integration with the Lux consensus engine interface. |
|
Package chain implements linear consensus protocol.
|
Package chain implements linear consensus protocol. |
|
block/blockmock
Package blockmock is a generated GoMock package.
|
Package blockmock is a generated GoMock package. |
|
block/blocktest
Package blocktest provides test utilities for blocks
|
Package blocktest provides test utilities for blocks |
|
chainmock
Package chainmock provides mock implementations for testing
|
Package chainmock provides mock implementations for testing |
|
chaintest
Package chaintest provides test utilities for chains
|
Package chaintest provides test utilities for chains |
|
syncer
Package syncer provides state synchronization for blockchain engines
|
Package syncer provides state synchronization for blockchain engines |
|
coremock
Package coremock provides mock implementations for core consensus
|
Package coremock provides mock implementations for core consensus |
|
coretest
Package coretest provides test utilities for consensus engine core
|
Package coretest provides test utilities for consensus engine core |
|
Package dag provides DAG consensus functionality
|
Package dag provides DAG consensus functionality |
|
vertex/vertexmock
Package vertexmock provides mock implementations for DAG vertices
|
Package vertexmock provides mock implementations for DAG vertices |
|
Package enginetest provides test utilities for consensus engines
|
Package enginetest provides test utilities for consensus engines |
|
Package pq implements the post-quantum consensus engine that combines classical and quantum-resistant consensus mechanisms.
|
Package pq implements the post-quantum consensus engine that combines classical and quantum-resistant consensus mechanisms. |