Documentation
ยถ
Index ยถ
- Variables
- func NewMetricsRegistererWrapper(reg metrics.Registerer) prometheus.Registerer
- type Acceptor
- type AcceptorGroup
- type Batch
- type Block
- type BlockStore
- type ChainValidatorSet
- type ChainWrapper
- type Clock
- type ConsensusBlock
- type ConsensusBlockBuilder
- type ConsensusContext
- type ConsensusFlow
- type ConsensusRound
- type Context
- type ContextInitializable
- type Decidable
- type DualFinalityProof
- type Element
- type Engine
- type EngineState
- type FinalizedBlock
- type Logger
- type NetworkUpgrades
- type Operation
- type OperationPool
- type Parameters
- type PendingBlock
- type QuantumFinalityEngine
- func (qfe *QuantumFinalityEngine) CreateConsensusBlock(height uint64) (*PendingBlock, error)
- func (qfe *QuantumFinalityEngine) GetFinalityStatus(blockID ids.ID) (pChain bool, qChain bool, finalized bool)
- func (qfe *QuantumFinalityEngine) SubmitOperation(chainID ids.ID, op Operation) error
- func (qfe *QuantumFinalityEngine) SubmitPChainBLS(blockID ids.ID, sig *bls.Signature) error
- func (qfe *QuantumFinalityEngine) SubmitQChainRingtail(blockID ids.ID, sig *ringtail.Signature) error
- func (qfe *QuantumFinalityEngine) WaitForFinality(ctx context.Context, blockID ids.ID) (*FinalizedBlock, error)
- func (qfe *QuantumFinalityEngine) WrapChain(chainID ids.ID, chainName string) error
- type QuasarBlock
- type QuasarVertex
- type Registerer
- type RequestID
- type Requests
- type Sender
- type SharedMemory
- type State
- type ValidatorChainManager
- type ValidatorSet
- type Vertex
- type WarpMessage
- type WarpSignature
- type WarpSigner
Constants ยถ
This section is empty.
Variables ยถ
var ( // ErrNotFound is returned when a requested item is not found ErrNotFound = errors.New("not found") )
Functions ยถ
func NewMetricsRegistererWrapper ยถ added in v1.14.2
func NewMetricsRegistererWrapper(reg metrics.Registerer) prometheus.Registerer
NewMetricsRegistererWrapper creates a new wrapper
Types ยถ
type AcceptorGroup ยถ added in v1.14.2
type AcceptorGroup interface {
RegisterAcceptor(chainID ids.ID, name string, acceptor Acceptor, persist bool) error
DeregisterAcceptor(chainID ids.ID, name string) error
Accept(ctx *Context, containerID ids.ID, container []byte) error
}
AcceptorGroup manages multiple acceptors
func NewAcceptorGroup ยถ added in v1.14.2
func NewAcceptorGroup(log log.Logger) AcceptorGroup
NewAcceptorGroup creates a new acceptor group
type Batch ยถ added in v1.14.2
type Batch interface {
// Write adds a put operation to the batch
Write([]byte, []byte) error
// Delete adds a delete operation to the batch
Delete([]byte) error
}
Batch represents an atomic batch operation
type Block ยถ
type Block interface {
Decidable
// Parent returns the ID of this block's parent
Parent() ids.ID
// Verify that the state transition this block would make is valid
Verify() error
// Bytes returns the binary representation of this block
Bytes() []byte
// Height returns the height of this block
Height() uint64
// Timestamp returns the timestamp of this block
Timestamp() int64
}
Block represents a block that can be decided by consensus
type BlockStore ยถ added in v1.14.2
type BlockStore interface {
// GetBlock retrieves a block by ID
GetBlock(id ids.ID) (interface{}, error)
// PutBlock stores a block
PutBlock(id ids.ID, block interface{}) error
// DeleteBlock removes a block
DeleteBlock(id ids.ID) error
}
BlockStore manages block storage
func NewMemoryStore ยถ added in v1.14.2
func NewMemoryStore() BlockStore
NewMemoryStore creates a new in-memory block store
type ChainValidatorSet ยถ added in v1.14.2
type ChainValidatorSet struct {
ChainID ids.ID
Validators []ids.NodeID
IsGenesisGated bool
MinValidators int
}
ChainValidatorSet represents validators for a specific chain
type ChainWrapper ยถ added in v1.14.2
type ChainWrapper struct {
ChainID ids.ID
ChainName string
// contains filtered or unexported fields
}
ChainWrapper wraps a chain for quantum finality
type ConsensusBlock ยถ added in v1.14.2
type ConsensusBlock struct {
// Block metadata
Height uint64 `serialize:"true"`
Timestamp time.Time `serialize:"true"`
ParentID ids.ID `serialize:"true"`
// Chain operations - Operations from each of the 8 chains
AChainOps []Operation `serialize:"true"` // AI operations
BChainOps []Operation `serialize:"true"` // Bridge operations
CChainOps []Operation `serialize:"true"` // EVM operations
MChainOps []Operation `serialize:"true"` // MPC operations
PChainOps []Operation `serialize:"true"` // Platform operations
QChainOps []Operation `serialize:"true"` // Quantum operations
XChainOps []Operation `serialize:"true"` // Exchange operations
ZChainOps []Operation `serialize:"true"` // ZK operations
// Finality requirements
RequiredPChainBLS bool `serialize:"true"`
RequiredQChainRingtail bool `serialize:"true"`
// contains filtered or unexported fields
}
ConsensusBlock represents a network-wide consensus block containing operations from all chains
func (*ConsensusBlock) Bytes ยถ added in v1.14.2
func (cb *ConsensusBlock) Bytes() []byte
Bytes returns the serialized block
func (*ConsensusBlock) GetAllOperations ยถ added in v1.14.2
func (cb *ConsensusBlock) GetAllOperations() []Operation
GetAllOperations returns all operations in the block
func (*ConsensusBlock) GetOperationsByChain ยถ added in v1.14.2
func (cb *ConsensusBlock) GetOperationsByChain(chainID ids.ID) []Operation
GetOperationsByChain returns operations for a specific chain
func (*ConsensusBlock) ID ยถ added in v1.14.2
func (cb *ConsensusBlock) ID() ids.ID
ID returns the block ID
type ConsensusBlockBuilder ยถ added in v1.14.2
type ConsensusBlockBuilder struct {
// contains filtered or unexported fields
}
ConsensusBlockBuilder builds consensus blocks
func NewConsensusBlockBuilder ยถ added in v1.14.2
func NewConsensusBlockBuilder(height uint64, parentID ids.ID) *ConsensusBlockBuilder
NewConsensusBlockBuilder creates a new builder
func (*ConsensusBlockBuilder) AddOperations ยถ added in v1.14.2
func (cbb *ConsensusBlockBuilder) AddOperations(chainID ids.ID, ops []Operation)
AddOperations adds operations from a chain
func (*ConsensusBlockBuilder) Build ยถ added in v1.14.2
func (cbb *ConsensusBlockBuilder) Build() *ConsensusBlock
Build creates the consensus block
type ConsensusContext ยถ
type ConsensusContext struct {
// NetworkID is the ID of the network this node is running on
NetworkID uint32
// ChainID is the ID of the chain this consensus engine is running on
ChainID ids.ID
// SubnetID is the ID of the subnet this chain belongs to
SubnetID ids.ID
// NodeID is the ID of this node
NodeID ids.NodeID
// Log is the logger for this consensus engine
Log log.Logger
// Metrics registry for this consensus engine
Metrics metrics.Registry
// Network sender for consensus messages
Sender Sender
// Validators manager
Validators validators.Manager
// Current time provider
Clock Clock
// Consensus parameters
Parameters Parameters
// Metrics registerer
Registerer metrics.Registerer
// Validator state
ValidatorState validators.State
// Ringtail secret key
RingtailSK []byte
// Ringtail public key
RingtailPK []byte
// Nested context for advanced operations
Context *Context
// BCLookup provides blockchain lookup functionality
BCLookup ids.AliaserReader
// Lock provides synchronization for the consensus engine
Lock sync.RWMutex
// State provides the chain state management
State *EngineState
// LUXAssetID is the asset ID for LUX
LUXAssetID ids.ID
SharedMemory SharedMemory
// WarpSigner for warp message signing
WarpSigner WarpSigner
// NetworkUpgrades configuration
NetworkUpgrades NetworkUpgrades
// PublicKey of this node
PublicKey []byte
// XChainID is the ID of the X-Chain
XChainID ids.ID
// CChainID is the ID of the C-Chain
CChainID ids.ID
// ChainDataDir is the directory for chain data
ChainDataDir string
// ValidatorSet provides access to the current validator set
ValidatorSet ValidatorSet
// Bootstrappers is the set of nodes to bootstrap from
Bootstrappers validators.Set
// StartTime is the time the consensus engine started
StartTime time.Time
// RequestID for tracking requests
RequestID RequestID
}
ConsensusContext provides the context needed for consensus engines
type ConsensusFlow ยถ added in v1.14.2
type ConsensusFlow struct {
// contains filtered or unexported fields
}
ConsensusFlow represents the consensus flow for quantum finality
func (*ConsensusFlow) ExecuteConsensusRound ยถ added in v1.14.2
func (cf *ConsensusFlow) ExecuteConsensusRound(height uint64) (*FinalizedBlock, error)
ExecuteConsensusRound executes a full consensus round
type ConsensusRound ยถ added in v1.14.2
type ConsensusRound struct {
Height uint64
Block *ConsensusBlock
PChainFinality bool
QChainFinality bool
StartTime time.Time
EndTime time.Time
}
ConsensusRound represents a complete consensus round
func (*ConsensusRound) Duration ยถ added in v1.14.2
func (cr *ConsensusRound) Duration() time.Duration
Duration returns how long the consensus round took
func (*ConsensusRound) IsFinalized ยถ added in v1.14.2
func (cr *ConsensusRound) IsFinalized() bool
IsFinalized returns true if the round achieved dual finality
type ContextInitializable ยถ added in v1.14.2
type ContextInitializable interface {
// Initialize initializes with the consensus context
Initialize(ctx *Context) error
}
ContextInitializable defines the interface for types that need consensus context initialization
type Decidable ยถ
type Decidable interface {
// ID returns the unique ID of this element
ID() ids.ID
// Accept marks this element as accepted
Accept() error
// Reject marks this element as rejected
Reject() error
// Status returns the current status
Status() choices.Status
}
Decidable represents an element that can be decided by consensus
type DualFinalityProof ยถ added in v1.14.2
type DualFinalityProof struct {
BlockID ids.ID
Height uint64
// P-Chain BLS aggregate signature
PChainSignature *bls.AggregateSignature
PChainSigners []ids.NodeID
// Q-Chain Ringtail signature
QChainSignature *ringtail.Signature
QChainWitness *ringtail.Witness
// Combined proof
ProofHash ids.ID
ProofTimestamp time.Time
}
DualFinalityProof proves both P-Chain and Q-Chain consensus
type Element ยถ added in v1.14.2
type Element struct {
Key []byte `serialize:"true"`
Value []byte `serialize:"true"`
Traits [][]byte `serialize:"true"`
}
Element represents a shared memory element
type Engine ยถ added in v1.14.2
type Engine struct{}
Engine represents the Lux consensus engine This is a stub implementation when the external consensus package is not available
func NewEngineWithParams ยถ added in v1.14.2
NewEngineWithParams creates a new engine with custom parameters
func NewTestEngine ยถ added in v1.14.2
NewTestEngine creates a new engine for testing
type EngineState ยถ
type EngineState struct {
State State
}
EngineState represents the state of the consensus engine
func (*EngineState) Get ยถ added in v1.14.2
func (s *EngineState) Get() *EngineState
Get gets the engine state
func (*EngineState) Set ยถ added in v1.14.2
func (s *EngineState) Set(state EngineState)
Set sets the engine state
type FinalizedBlock ยถ added in v1.14.2
type FinalizedBlock struct {
PendingBlock
// Dual finality proof
FinalityProof *DualFinalityProof
FinalizedAt time.Time
}
FinalizedBlock represents a block with quantum finality
type NetworkUpgrades ยถ added in v1.14.2
type NetworkUpgrades interface {
// IsActivated checks if an upgrade is activated at a given time
IsActivated(upgradeTime time.Time) bool
}
NetworkUpgrades represents network upgrade configuration
type Operation ยถ added in v1.14.2
type Operation struct {
ChainID ids.ID
OperationType string
Payload []byte
Signature []byte
Timestamp time.Time
}
Operation represents an operation from any chain (A/B/C/M/X/Z)
type OperationPool ยถ added in v1.14.2
type OperationPool struct {
// contains filtered or unexported fields
}
OperationPool manages operations from a chain
func NewOperationPool ยถ added in v1.14.2
func NewOperationPool(maxSize int) *OperationPool
NewOperationPool creates a new operation pool
func (*OperationPool) Add ยถ added in v1.14.2
func (op *OperationPool) Add(operation Operation) error
Add adds an operation to the pool
func (*OperationPool) GetBatch ยถ added in v1.14.2
func (op *OperationPool) GetBatch(maxBatch int) []Operation
GetBatch gets a batch of operations
type Parameters ยถ added in v1.14.2
type Parameters struct {
// K is the number of consecutive successful polls required for finalization
K int
// Alpha is the required percentage of stake to consider a poll successful
Alpha int
// Beta is the number of polls with no progress before declaring the block stuck
Beta int
// ConcurrentRepolls is the number of concurrent polls to run
ConcurrentRepolls int
// OptimalProcessing is the optimal number of processing items
OptimalProcessing int
// MaxOutstandingItems is the maximum number of outstanding items
MaxOutstandingItems int
// MaxItemProcessingTime is the maximum time to process an item
MaxItemProcessingTime time.Duration
}
Parameters holds consensus parameters
type PendingBlock ยถ added in v1.14.2
type PendingBlock struct {
BlockID ids.ID
ChainID ids.ID
Height uint64
Timestamp time.Time
// Operations from each chain
Operations map[ids.ID][]Operation // Chain -> Operations
// Finality signatures
PChainBLS *bls.Signature
QChainRingtail *ringtail.Signature
// Status
PChainFinalized bool
QChainFinalized bool
}
PendingBlock represents a block awaiting dual finality
type QuantumFinalityEngine ยถ added in v1.14.2
type QuantumFinalityEngine struct {
// contains filtered or unexported fields
}
QuantumFinalityEngine coordinates dual-finality between P-Chain and Q-Chain
func NewQuantumFinalityEngine ยถ added in v1.14.2
func NewQuantumFinalityEngine(pChainID, qChainID ids.ID, validatorManager ValidatorChainManager) *QuantumFinalityEngine
NewQuantumFinalityEngine creates a new quantum finality engine
func (*QuantumFinalityEngine) CreateConsensusBlock ยถ added in v1.14.2
func (qfe *QuantumFinalityEngine) CreateConsensusBlock(height uint64) (*PendingBlock, error)
CreateConsensusBlock creates a new consensus block with operations from all chains
func (*QuantumFinalityEngine) GetFinalityStatus ยถ added in v1.14.2
func (qfe *QuantumFinalityEngine) GetFinalityStatus(blockID ids.ID) (pChain bool, qChain bool, finalized bool)
GetFinalityStatus returns the finality status of a block
func (*QuantumFinalityEngine) SubmitOperation ยถ added in v1.14.2
func (qfe *QuantumFinalityEngine) SubmitOperation(chainID ids.ID, op Operation) error
SubmitOperation submits an operation from a wrapped chain
func (*QuantumFinalityEngine) SubmitPChainBLS ยถ added in v1.14.2
SubmitPChainBLS submits P-Chain BLS signature for a block
func (*QuantumFinalityEngine) SubmitQChainRingtail ยถ added in v1.14.2
func (qfe *QuantumFinalityEngine) SubmitQChainRingtail(blockID ids.ID, sig *ringtail.Signature) error
SubmitQChainRingtail submits Q-Chain Ringtail signature for a block
func (*QuantumFinalityEngine) WaitForFinality ยถ added in v1.14.2
func (qfe *QuantumFinalityEngine) WaitForFinality(ctx context.Context, blockID ids.ID) (*FinalizedBlock, error)
WaitForFinality waits for a block to achieve quantum finality
type QuasarBlock ยถ
type QuasarBlock interface {
Block
// HasDualCert returns true if both BLS and RT certificates are present
HasDualCert() bool
// BLSSignature returns the aggregated BLS signature
BLSSignature() []byte
// RTCertificate returns the Ringtail certificate
RTCertificate() []byte
// SetQuantum marks this block as having quantum-secure finality
SetQuantum() error
}
QuasarBlock extends Block with quantum-secure features
type QuasarVertex ยถ
type QuasarVertex interface {
Vertex
// HasDualCert returns true if both BLS and RT certificates are present
HasDualCert() bool
// BLSSignature returns the aggregated BLS signature
BLSSignature() []byte
// RTCertificate returns the Ringtail certificate
RTCertificate() []byte
// SetQuantum marks this vertex as having quantum-secure finality
SetQuantum() error
}
QuasarVertex extends Vertex with quantum-secure features
type Registerer ยถ added in v1.14.2
Registerer creates a metrics registerer
type RequestID ยถ added in v1.14.2
type RequestID struct {
}
RequestID represents a request identifier
type Requests ยถ added in v1.14.2
type Requests struct {
RemoveRequests [][]byte `serialize:"true"`
PutRequests []*Element `serialize:"true"`
// contains filtered or unexported fields
}
Requests represents shared memory requests
type Sender ยถ added in v1.14.2
type Sender interface {
// SendGetAcceptedFrontier sends a GetAcceptedFrontier message
SendGetAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32) error
// SendAcceptedFrontier sends an AcceptedFrontier message
SendAcceptedFrontier(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error
// SendGetAccepted sends a GetAccepted message
SendGetAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error
// SendAccepted sends an Accepted message
SendAccepted(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerIDs []ids.ID) error
// SendGet sends a Get message
SendGet(ctx context.Context, nodeID ids.NodeID, requestID uint32, containerID ids.ID) error
// SendPut sends a Put message
SendPut(ctx context.Context, nodeID ids.NodeID, requestID uint32, container []byte) error
// SendPushQuery sends a PushQuery message
SendPushQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, container []byte) error
// SendPullQuery sends a PullQuery message
SendPullQuery(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, containerID ids.ID) error
// SendChits sends a Chits message
SendChits(ctx context.Context, nodeID ids.NodeID, requestID uint32, preferredID ids.ID, acceptedID ids.ID) error
}
Sender sends consensus messages
type SharedMemory ยถ
type SharedMemory interface {
// [peerChainID]
//
// Invariant: Get guarantees that the resulting values array is the same
// length as keys.
Get(peerChainID ids.ID, keys [][]byte) (values [][]byte, err error)
// given traits and were sent from [peerChainID].
Indexed(
peerChainID ids.ID,
traits [][]byte,
startTrait,
startKey []byte,
limit int,
) (
values [][]byte,
lastTrait,
lastKey []byte,
err error,
)
// [requests] to their respective chainID keys in the map along with the
// atomic value batch.
Apply(requests map[ids.ID]*Requests, batch Batch) error
}
SharedMemory is the interface for shared memory operations
type ValidatorChainManager ยถ added in v1.14.2
type ValidatorChainManager interface {
CanValidateChain(validatorID ids.NodeID, chainID ids.ID) bool
GetValidatorsForChain(chainID ids.ID) []ids.NodeID
GetChainValidatorSet(chainID ids.ID) (*ChainValidatorSet, error)
}
ValidatorChainManager interface for checking validator permissions
type ValidatorSet ยถ added in v1.14.2
type ValidatorSet interface {
// GetValidatorSet returns the validator set at a given height
GetValidatorSet(height uint64) (validators.Set, error)
}
ValidatorSet provides access to the validator set
type Vertex ยถ
type Vertex interface {
Decidable
// Parents returns the IDs of this vertex's parents
Parents() []ids.ID
// Verify that the state transition this vertex would make is valid
Verify() error
// Bytes returns the binary representation of this vertex
Bytes() []byte
// Height returns the height of this vertex
Height() uint64
// Epoch returns the epoch of this vertex
Epoch() uint32
// Txs returns the transactions in this vertex
Txs() [][]byte
}
Vertex represents a vertex in a DAG that can be decided by consensus
type WarpMessage ยถ added in v1.14.2
type WarpMessage struct {
}
WarpMessage represents a warp message
type WarpSignature ยถ added in v1.14.2
type WarpSignature struct {
}
WarpSignature represents a warp signature
type WarpSigner ยถ added in v1.14.2
type WarpSigner interface {
// Sign signs a warp message
Sign(msg *WarpMessage) (*WarpSignature, error)
}
WarpSigner provides warp message signing functionality
Source Files
ยถ
Directories
ยถ
| Path | Synopsis |
|---|---|
|
consensus
|
|
|
crypto
|
|
|
core/appsender/appsendermock
Package appsendermock is a generated GoMock package.
|
Package appsendermock is a generated GoMock package. |
|
core/coremock
Package coremock is a generated GoMock package.
|
Package coremock is a generated GoMock package. |
|
dag/vertex/vertexmock
Package vertexmock is a generated GoMock package.
|
Package vertexmock is a generated GoMock package. |
|
engines
|
|
|
networking
|
|
|
router/routermock
Package routermock is a generated GoMock package.
|
Package routermock is a generated GoMock package. |
|
tracker/trackermock
Package trackermock is a generated GoMock package.
|
Package trackermock is a generated GoMock package. |
|
SPDX-License-Identifier: BUSL-1.1
|
SPDX-License-Identifier: BUSL-1.1 |
|
ringtail
Package ringtail provides placeholder implementations for the Ringtail cryptographic library
|
Package ringtail provides placeholder implementations for the Ringtail cryptographic library |
|
uptimemock
Package uptimemock is a generated GoMock package.
|
Package uptimemock is a generated GoMock package. |
|
validatorsmock
Package validatorsmock is a generated GoMock package.
|
Package validatorsmock is a generated GoMock package. |