consensusv2

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConsensus

func NewConsensus(
	ctx context.Context,
	conf *Config,
	bcState state.Facade,
	valKey *bls.ValidatorKey,
	rewardAddr crypto.Address,
	broadcastPipe pipeline.Pipeline[message.Message],
	mediator mediator,
) consensus.Consensus

Types

type ConcreteMediator

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

ConcreteMediator struct.

func (*ConcreteMediator) OnBlockAnnounce

func (m *ConcreteMediator) OnBlockAnnounce(from consensus.Consensus)

func (*ConcreteMediator) OnPublishProposal

func (m *ConcreteMediator) OnPublishProposal(from consensus.Consensus, prop *proposal.Proposal)

func (*ConcreteMediator) OnPublishVote

func (m *ConcreteMediator) OnPublishVote(from consensus.Consensus, vte *vote.Vote)

func (*ConcreteMediator) Register

func (m *ConcreteMediator) Register(cons consensus.Consensus)

Register a new Consensus instance to the mediator.

type Config

type Config struct {
	ChangeProposerTimeout    time.Duration `toml:"-"`
	ChangeProposerDelta      time.Duration `toml:"-"`
	QueryVoteTimeout         time.Duration `toml:"-"`
	MinimumAvailabilityScore float64       `toml:"-"`
}

Config defines parameters for the consensusv2 algorithm.

func DefaultConfig

func DefaultConfig() *Config

func (*Config) BasicCheck

func (conf *Config) BasicCheck() error

BasicCheck performs basic checks on the configuration.

func (*Config) CalculateChangeProposerTimeout

func (conf *Config) CalculateChangeProposerTimeout(round int16) time.Duration

type ConfigError

type ConfigError struct {
	Reason string
}

ConfigError is returned when the config is not valid with a descriptive Reason message.

func (ConfigError) Error

func (e ConfigError) Error() string

type InvalidJustificationError

type InvalidJustificationError struct {
	Reason string
}

InvalidJustificationError is returned when the justification for a change-proposer vote is invalid.

func (InvalidJustificationError) Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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