Documentation
¶
Overview ¶
Package consensus provides GPU-accelerated consensus primitives.
Used for accelerating vote processing, validator set computations, and other consensus-critical operations that can benefit from parallelization.
Index ¶
- Variables
- func AggregateVotes(votes []VoteData, validators []ValidatorWeight) (map[[32]byte]uint64, error)
- func BatchVerifyVoteSignatures(votes []VoteData, signatures, pubkeys [][]byte) ([]bool, error)
- func ComputeValidatorSetHash(validators []ValidatorWeight) ([32]byte, error)
- func ProcessVotesBatch(votes []VoteData) (int, error)
- type QuorumResult
- type ValidatorWeight
- type VoteData
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AggregateVotes ¶
func AggregateVotes(votes []VoteData, validators []ValidatorWeight) (map[[32]byte]uint64, error)
AggregateVotes aggregates votes by block, returning vote counts per block. Returns a map of block ID to total weight voted for that block.
func BatchVerifyVoteSignatures ¶
BatchVerifyVoteSignatures verifies vote signatures in parallel. Returns a slice of booleans indicating validity of each vote.
func ComputeValidatorSetHash ¶
func ComputeValidatorSetHash(validators []ValidatorWeight) ([32]byte, error)
ComputeValidatorSetHash computes a hash of the validator set for checkpointing.
func ProcessVotesBatch ¶
ProcessVotesBatch processes a batch of votes in parallel. Returns the number of votes successfully processed.
Types ¶
type QuorumResult ¶
type QuorumResult struct {
HasQuorum bool
TotalWeight uint64
VotedWeight uint64
QuorumWeight uint64
}
QuorumResult contains the result of a quorum check.
func ComputeQuorum ¶
func ComputeQuorum(votes []VoteData, validators []ValidatorWeight, threshold float64) (*QuorumResult, error)
ComputeQuorum checks if a quorum is reached given votes and validators. threshold is the fraction of stake required (e.g., 0.67 for 2/3).
type ValidatorWeight ¶
ValidatorWeight represents a validator and its stake weight.