tendermint

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: May 20, 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 Application

type Application[V types.Hashable[H], H types.Hash] interface {
	// Value returns the value to the Tendermint consensus algorith which can be proposed to other validators.
	Value() V

	// Valid returns true if the provided value is valid according to the application context.
	Valid(V) bool
}

type Blockchain

type Blockchain[V types.Hashable[H], H types.Hash, A types.Addr] interface {
	// types.Height return the current blockchain height
	Height() types.Height

	// Commit is called by Tendermint when a block has been decided on and can be committed to the DB.
	Commit(types.Height, V, []types.Precommit[H, A])
}

type CachedProposal added in v0.14.4

type CachedProposal[V types.Hashable[H], H types.Hash, A types.Addr] struct {
	types.Proposal[V, H, A]
	Valid bool
	ID    *H
}

type Slasher

type Slasher[M types.Message[V, H, A], V types.Hashable[H], H types.Hash, A types.Addr] interface {
	// Equivocation informs the slasher that a validator has sent conflicting messages. Thus it can decide whether to
	// slash the validator and by how much.
	Equivocation(msgs ...M)
}

type StateMachine added in v0.14.4

type StateMachine[V types.Hashable[H], H types.Hash, A types.Addr] interface {
	ReplayWAL()
	ProcessStart(types.Round) []types.Action[V, H, A]
	ProcessTimeout(types.Timeout) []types.Action[V, H, A]
	ProcessProposal(types.Proposal[V, H, A]) []types.Action[V, H, A]
	ProcessPrevote(types.Prevote[H, A]) []types.Action[V, H, A]
	ProcessPrecommit(types.Precommit[H, A]) []types.Action[V, H, A]
}

func New

func New[V types.Hashable[H], H types.Hash, A types.Addr](
	db db.TendermintDB[V, H, A],
	log utils.Logger,
	nodeAddr A,
	app Application[V, H],
	chain Blockchain[V, H, A],
	vals Validators[A],
) StateMachine[V, H, A]

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(A) types.VotingPower

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

Jump to

Keyboard shortcuts

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