Documentation
¶
Overview ¶
Package prism provides DAG geometry: frontiers, cuts, and refractions.
Given a partial order (the transaction/vertex DAG), Prism helps project that poset into slices that are easy to vote on and schedule. "Refraction" is the deterministic projection into sub-slices; "frontier" returns a maximal antichain; "cut" selects a thin slice across causal layers.
Prism is DAG-only; linear chains never need antichains or cuts.
Index ¶
- Variables
- type Config
- type Cut
- type Engine
- func (e *Engine) GetProposal(ctx context.Context, proposalID ids.ID) (Proposal, error)
- func (e *Engine) Initialize(ctx context.Context, config *Config) error
- func (e *Engine) Propose(ctx context.Context, data []byte) error
- func (e *Engine) Vote(ctx context.Context, proposalID ids.ID, accept bool) error
- type Frontier
- type Luminance
- type Metrics
- type NodeConfig
- type Prism
- type Proposal
- type Refractor
- type UniformCut
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidK is returned when K is invalid ErrInvalidK = errors.New("invalid K value") // ErrInvalidAlpha is returned when Alpha is invalid ErrInvalidAlpha = errors.New("invalid Alpha value") // ErrInvalidBeta is returned when Beta is invalid ErrInvalidBeta = errors.New("invalid Beta value") // ErrNoSampler is returned when no sampler is provided ErrNoSampler = errors.New("no sampler provided") )
var DefaultConfig = Config{ K: 1, AlphaPreference: 1, AlphaConfidence: 1, Beta: 1, ConcurrentPolls: 1, OptimalProcessing: 1, MaxOutstandingItems: 16, MaxItemProcessingTime: 10 * time.Second, }
DefaultConfig returns default photon configuration
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
K int
AlphaPreference int
AlphaConfidence int
Beta int
ConcurrentPolls int
OptimalProcessing int
MaxOutstandingItems int
MaxItemProcessingTime time.Duration
}
Config represents photon protocol configuration
type Cut ¶
type Cut[T comparable] interface { // Sample returns k random peers for voting (cuts k rays from the population) Sample(k int) []types.NodeID // Luminance returns light intensity metrics for the cut Luminance() Luminance }
Cut provides random cutting of peers for consensus voting (like a prism cuts light)
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine defines prism consensus engine
func (*Engine) GetProposal ¶
GetProposal gets a proposal
func (*Engine) Initialize ¶
Initialize initializes the engine
type Luminance ¶
type Luminance struct {
ActivePeers int
TotalPeers int
Lx float64 // Illuminance in lux (lx) - minimum 1 lx per active peer/photon
}
Luminance measures the intensity of light across the peer network Following SI units: lux (lx) = lumens per square meter
type NodeConfig ¶
NodeConfig defines prism node configuration
type Prism ¶
type Prism interface {
// Initialize prism consensus
Initialize(context.Context, *Config) error
// Propose proposes a value
Propose(context.Context, []byte) error
// Vote votes on a proposal
Vote(context.Context, ids.ID, bool) error
// GetProposal gets a proposal
GetProposal(context.Context, ids.ID) (Proposal, error)
}
Prism consensus interface
type Refractor ¶
type Refractor interface {
// ComputeFrontier returns the current frontier of the DAG
ComputeFrontier() Frontier
// RefractPath determines the optimal path through conflicting vertices
RefractPath(from, to types.NodeID) []types.NodeID
// Interference checks if two vertices conflict
Interference(a, b types.NodeID) bool
}
Refractor analyzes light paths through the DAG structure to determine optimal ordering and conflict resolution
type UniformCut ¶
type UniformCut struct {
// contains filtered or unexported fields
}
UniformCut implements uniform random cutting
func NewUniformCut ¶
func NewUniformCut(peers []types.NodeID) *UniformCut
NewUniformCut creates a new uniform cut
func (*UniformCut) Luminance ¶
func (c *UniformCut) Luminance() Luminance
Luminance implements Cut interface