fpc

package
v1.22.45 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package fpc implements Fast Probabilistic Consensus thresholds.

For round "phase" and committee size k, it picks a θ ∈ [θ_min, θ_max] and returns α = ⌈θ·k⌉ for both preference and confidence. The PRF makes θ stable for a given phase, testable, and deterministic in simulations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SelectThreshold

func SelectThreshold(phase uint64, k int, thetaMin, thetaMax float64) int

SelectThreshold is a convenience function using default selector

Types

type Selector

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

Selector provides phase-dependent threshold selection for FPC

func DefaultSelector

func DefaultSelector() *Selector

DefaultSelector returns a selector with default parameters

func NewSelector

func NewSelector(thetaMin, thetaMax float64, seed []byte) *Selector

NewSelector creates a new FPC threshold selector

func (*Selector) Range

func (s *Selector) Range() (min, max float64)

Range returns the configured theta range

func (*Selector) SelectThreshold

func (s *Selector) SelectThreshold(phase uint64, k int) int

SelectThreshold picks θ ∈ [θ_min, θ_max] using PRF for phase Returns α = ⌈θ·k⌉ for both preference and confidence

func (*Selector) Theta

func (s *Selector) Theta(phase uint64) float64

Theta returns the raw theta value for a phase (for testing/debugging)

Jump to

Keyboard shortcuts

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