privval

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHeightRegression = errors.New("height regression")
	ErrRoundRegression  = errors.New("round regression")
	ErrStepRegression   = errors.New("step regression")
	ErrNilSignature     = errors.New("signature is nil")
	ErrUnknownVoteType  = errors.New("unknown vote type")
)

Functions

This section is empty.

Types

type AtomicReadWriter

type AtomicReadWriter interface {
	// Write should overwrite the current value with the given value
	Write([]byte) error
	// Read should return the current value
	// if the value is empty, it should return empty bytes and no error
	Read() ([]byte, error)
}

AtomicReadWriter is an interface for any store that can atomically read and write to a persistent store

type LastSignState

type LastSignState struct {
	// Height is the height of the block that the message was signed for
	Height int64 `json:"height"`

	// Round is the consensus round that the message was signed for
	// CometBFT can have an arbitrary number of rounds per height
	Round int32 `json:"round"`

	// Step is the consensus step that the message was signed for
	// e.g. propose, prevote, precommit
	Step int8 `json:"step"`

	// Signature is the signature generated by the validator
	Signature []byte `json:"signature"`

	// SignBytes is the bytes that were signed by the validator
	SignBytes coreTypes.HexBytes `json:"sign_bytes"`
	// contains filtered or unexported fields
}

LastSignState tracks the most recent signature made by this validator. It is atomically committed to disk before it is used for anything else, and can be reloaded in case of a crash

type ValidatorSigner

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

ValidatorSigner implements CometBFT's cometTypes.PrivValidator It persists its most recent signature, which can be used during recovery to prevent double signing

func NewValidatorSigner

func NewValidatorSigner(privKey cometEd25519.PrivKey, storer AtomicReadWriter) (*ValidatorSigner, error)

NewValidatorSigner returns a new ValidatorSigner from an ed25519 key and a keyvalue store. The key values stored should NOT be atomically committed with other KV stores. Instead, it should simply fsync after every write/commit

func (*ValidatorSigner) GetPubKey

func (v *ValidatorSigner) GetPubKey() (crypto.PubKey, error)

GetPubKey returns the public key of the validator It is part of the cometTypes.PrivValidator interface

func (*ValidatorSigner) SignProposal

func (v *ValidatorSigner) SignProposal(chainID string, proposal *tendermintTypes.Proposal) error

SignProposal signs a proposal message It is part of the cometTypes.PrivValidator interface

func (*ValidatorSigner) SignVote

func (v *ValidatorSigner) SignVote(chainID string, vote *tendermintTypes.Vote) error

SignVote signs a vote message It is part of the cometTypes.PrivValidator interface

Jump to

Keyboard shortcuts

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