votecounter

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validators

type Validators[A types.Addr] interface {
	// TotalVotingPower represents N which is required to calculate the thresholds.
	TotalVotingPower(types.Height) types.VotingPower

	// ValidatorVotingPower returns the voting power of the a single validator. This is also required to implement
	// various thresholds. The assumption is that a single validator cannot have voting power more than f.
	ValidatorVotingPower(types.Height, *A) types.VotingPower

	// Proposer returns the proposer of the current round and height.
	Proposer(types.Height, types.Round) A
}

type VoteCounter

type VoteCounter[V types.Hashable[H], H types.Hash, A types.Addr] struct {
	// contains filtered or unexported fields
}

func New

func New[V types.Hashable[H], H types.Hash, A types.Addr](validators Validators[A], height types.Height) VoteCounter[V, H, A]

func (*VoteCounter[V, H, A]) AddPrecommit

func (v *VoteCounter[V, H, A]) AddPrecommit(precommit *types.Precommit[H, A]) bool

func (*VoteCounter[V, H, A]) AddPrevote

func (v *VoteCounter[V, H, A]) AddPrevote(prevote *types.Prevote[H, A]) bool

func (*VoteCounter[V, H, A]) AddProposal

func (v *VoteCounter[V, H, A]) AddProposal(proposal *types.Proposal[V, H, A]) bool

func (*VoteCounter[V, H, A]) AssertEmpty

func (v *VoteCounter[V, H, A]) AssertEmpty(t *testing.T)

func (*VoteCounter[V, H, A]) AssertProposal

func (v *VoteCounter[V, H, A]) AssertProposal(t *testing.T, expectedMsg starknet.Proposal)

assertProposal asserts that the proposal message is in the state machine, except when the state machine advanced to the next height.

func (*VoteCounter[V, H, A]) AssertVote

func (v *VoteCounter[V, H, A]) AssertVote(t *testing.T, vote *types.Vote[H, A], voteType VoteType)

func (*VoteCounter[V, H, A]) GetProposal

func (v *VoteCounter[V, H, A]) GetProposal(round types.Round) *types.Proposal[V, H, A]

func (*VoteCounter[V, H, A]) HasNonFaultyFutureMessage

func (v *VoteCounter[V, H, A]) HasNonFaultyFutureMessage(round types.Round) bool

func (*VoteCounter[V, H, A]) HasQuorumForAny

func (v *VoteCounter[V, H, A]) HasQuorumForAny(round types.Round, voteType VoteType) bool

func (*VoteCounter[V, H, A]) HasQuorumForVote

func (v *VoteCounter[V, H, A]) HasQuorumForVote(round types.Round, voteType VoteType, id *H) bool

func (*VoteCounter[V, H, A]) LoadFromMessages

func (v *VoteCounter[V, H, A]) LoadFromMessages(messages iter.Seq2[types.Message[V, H, A], error]) error

func (*VoteCounter[V, H, A]) Proposer

func (v *VoteCounter[V, H, A]) Proposer(round types.Round) A

func (*VoteCounter[V, H, A]) StartNewHeight

func (v *VoteCounter[V, H, A]) StartNewHeight()

type VoteType

type VoteType uint8
const (
	Prevote VoteType = iota
	Precommit
)

Jump to

Keyboard shortcuts

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