beam

package
v1.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrQuasarTimeout = errors.New("quasar certificate timeout")
	ErrBLS           = errors.New("BLS signature verification failed")
	ErrRingtail      = errors.New("Ringtail signature verification failed")
)

Functions

func VerifyBlock

func VerifyBlock(b *Block, pkGroup []byte, q *quasarState) error

VerifyBlock performs fast-path verification with no extra locks

Types

type Block

type Block struct {
	Header
	Certs CertBundle
	Txs   [][]byte
}

Block represents a Beam consensus block with dual certificates

func (*Block) Hash

func (b *Block) Hash() [32]byte

Hash computes the block hash

type CertBundle

type CertBundle struct {
	BLSAgg [96]byte // BLS aggregate signature
	RTCert []byte   // Ringtail certificate (nil until aggregated)
}

CertBundle contains both BLS and Ringtail certificates for dual finality

type Engine

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

Engine represents the Beam consensus engine

func (*Engine) Broadcast

func (e *Engine) Broadcast(msg interface{}) error

Broadcast sends a message to all peers

func (*Engine) BroadcastBlock

func (e *Engine) BroadcastBlock(block *Block) error

BroadcastBlock broadcasts a block to all peers

func (*Engine) LastBlockID

func (e *Engine) LastBlockID() ids.ID

LastBlockID returns the last block ID

func (*Engine) RecordSlashEvent

func (e *Engine) RecordSlashEvent(nodeID ids.NodeID, amount uint64, reason string) error

RecordSlashEvent records a slashing event

func (*Engine) SelfID

func (e *Engine) SelfID() ids.NodeID

SelfID returns the node's ID

func (*Engine) SignBLS

func (e *Engine) SignBLS(data []byte) ([]byte, error)

SignBLS signs data with BLS

type Header struct {
	Height    uint64
	ParentID  [32]byte
	Timestamp int64
	TxRoot    [32]byte
}

Header contains block metadata

type Proposer

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

Proposer manages block proposal with dual-certificate requirement

func NewProposer

func NewProposer(cfg ProposerConfig, quasar *quasarState, engine *Engine) *Proposer

NewProposer creates a new proposer instance

func (*Proposer) ProcessSlashEvents

func (p *Proposer) ProcessSlashEvents(events []SlashEvent) [][]byte

ProcessSlashEvents handles slashing for the previous block

func (*Proposer) Propose

func (p *Proposer) Propose(height uint64, txs [][]byte) (*Block, error)

Propose creates a new block with dual certificates or gets slashed

type ProposerConfig

type ProposerConfig struct {
	QuasarTimeout time.Duration // e.g., 50ms for mainnet, 5ms for devnet
	SlashAmount   uint64        // Amount to slash for missing RT cert
}

ProposerConfig contains proposer-specific settings

type QuasarConfig

type QuasarConfig struct {
	QPubKey       []byte        // Group public key
	QThreshold    int           // Threshold for aggregation
	QuasarTimeout time.Duration // Timeout for RT cert collection
}

QuasarConfig contains Quasar-specific configuration

type SlashEvent

type SlashEvent struct {
	Height    uint64
	Validator string
	Reason    string
	Amount    uint64
}

SlashEvent records a slashing event

Jump to

Keyboard shortcuts

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