types

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxHeaderBytes is a maximum header size.
	// NOTE: Because app hash can be of arbitrary size, the header is therefore not
	// capped in size and thus this number should be seen as a soft max
	MaxHeaderBytes       int64 = 725
	MaxCoreChainLockSize int64 = 132

	// MaxOverheadForBlock - maximum overhead to encode a block (up to
	// MaxBlockSizeBytes in size) not including it's parts except Data.
	// This means it also excludes the overhead for individual transactions.
	//
	// Uvarint length of MaxBlockSizeBytes: 4 bytes
	// 2 fields (2 embedded):               2 bytes
	// Uvarint length of Data.Txs:          4 bytes
	// Data.Txs field:                      1 byte
	MaxOverheadForBlock int64 = 11
)
View Source
const (
	// Block level events for mass consumption by users.
	// These events are triggered from the state package,
	// after a block has been committed.
	// These are also used by the tx indexer for async indexing.
	// All of this data can be fetched through the rpc.
	EventNewBlockValue           = "NewBlock"
	EventNewBlockHeaderValue     = "NewBlockHeader"
	EventNewEvidenceValue        = "NewEvidence"
	EventTxValue                 = "Tx"
	EventValidatorSetUpdateValue = "ValidatorSetUpdate"

	// Internal consensus events.
	// These are used for testing the consensus state machine.
	// They can also be used to build real-time consensus visualizers.
	EventCompleteProposalValue = "CompleteProposal"
	// The BlockSyncStatus event will be emitted when the node switching
	// state sync mechanism between the consensus reactor and the blocksync reactor.
	EventBlockSyncStatusValue = "BlockSyncStatus"
	EventLockValue            = "Lock"
	EventNewRoundValue        = "NewRound"
	EventNewRoundStepValue    = "NewRoundStep"
	EventPolkaValue           = "Polka"
	EventRelockValue          = "Relock"
	EventStateSyncStatusValue = "StateSyncStatus"
	EventTimeoutProposeValue  = "TimeoutPropose"
	EventTimeoutWaitValue     = "TimeoutWait"
	EventValidBlockValue      = "ValidBlock"
	EventVoteValue            = "Vote"
	EventCommitValue          = "Commit"

	// Events emitted by the evidence reactor when evidence is validated
	// and before it is committed
	EventEvidenceValidatedValue = "EvidenceValidated"
)

Reserved event types (alphabetically sorted).

View Source
const (
	// EventTypeKey is a reserved composite key for event name.
	EventTypeKey = "tm.event"

	// TxHashKey is a reserved key, used to specify transaction's hash.
	// see EventBus#PublishEventTx
	TxHashKey = "tx.hash"

	// TxHeightKey is a reserved key, used to specify transaction block's height.
	// see EventBus#PublishEventTx
	TxHeightKey = "tx.height"

	// BlockHeightKey is a reserved key used for indexing FinalizeBlock events.
	BlockHeightKey = "block.height"
)
View Source
const (
	// MaxBlockSizeBytes is the maximum permitted size of the blocks.
	MaxBlockSizeBytes = 104857600 // 100MB

	// BlockPartSizeBytes is the size of one block part.
	BlockPartSizeBytes uint32 = 65536 // 64kB

	// MaxBlockPartsCount is the maximum number of block parts.
	MaxBlockPartsCount = (MaxBlockSizeBytes / BlockPartSizeBytes) + 1
)
View Source
const (
	MockSignerClient      = PrivValidatorType(0x00) // mock signer
	FileSignerClient      = PrivValidatorType(0x01) // signer client via file
	RetrySignerClient     = PrivValidatorType(0x02) // signer client with retry via socket
	SignerSocketClient    = PrivValidatorType(0x03) // signer client via socket
	ErrorMockSignerClient = PrivValidatorType(0x04) // error mock signer
	SignerGRPCClient      = PrivValidatorType(0x05) // signer client via gRPC
	DashCoreRPCClient     = PrivValidatorType(0x06) // signer client via gRPC
)
View Source
const (
	ABCIPubKeyTypeEd25519            = ed25519.KeyType
	ABCIPubKeyTypeSecp256k1          = secp256k1.KeyType
	ABCIPubKeyTypeBLS12381           = bls12381.KeyType
	ABCIEvidenceTypeDuplicateVote    = "duplicate/vote"
	ABCIEvidenceTypePhantom          = "phantom"
	ABCIEvidenceTypeLunatic          = "lunatic"
	ABCIEvidenceTypePotentialAmnesia = "potential_amnesia"
	ABCIEvidenceTypeMock             = "mock/evidence"
)
View Source
const (
	// MaxTotalVotingPower - the maximum allowed total voting power.
	// It needs to be sufficiently small to, in all cases:
	// 1. prevent clipping in incrementProposerPriority()
	// 2. let (diff+diffMax-1) not overflow in IncrementProposerPriority()
	// (Proof of 1 is tricky, left to the reader).
	// It could be higher, but this is sufficiently large for our purposes,
	// and leaves room for defensive purposes.
	MaxTotalVotingPower = int64(math.MaxInt64) / 8

	DefaultDashVotingPower = int64(100)

	// PriorityWindowSizeFactor - is a constant that when multiplied with the
	// total voting power gives the maximum allowed distance between validator
	// priorities.
	PriorityWindowSizeFactor = 2
)
View Source
const (

	// MaxVoteBytes is a maximum vote size (including amino overhead).
	MaxVoteBytesBLS12381 int64 = 241
	MaxVoteBytesEd25519  int64 = 209
)
View Source
const EmptyNetAddress = "<nil-NetAddress>"

EmptyNetAddress defines the string representation of an empty NetAddress

View Source
const (
	// MaxChainIDLen is a maximum length of the chain ID.
	MaxChainIDLen = 50
)
View Source
const (
	// MaxCommitOverheadBytes is the max size of commit, with overhead but without vote extensions:
	// (110+2) for BlockID,  (8+2) for Height, (4+2) for Round,
	// (32+2) for QuorumHash, (96+2) for Block signature.
	MaxCommitOverheadBytes int64 = (110 + 2) + (8 + 2) + (4 + 2) + (32 + 2) + (96 + 2) + 0
)
View Source
const (
	// MaxVotesCount is the maximum number of votes in a set. Used in ValidateBasic funcs for
	// protection against DOS attacks. Note this implies a corresponding equal limit to
	// the number of validators.
	MaxVotesCount = 10000
)
View Source
const NodeIDByteLength = crypto.AddressSize

NodeIDByteLength is the length of a crypto.Address. Currently only 20. FIXME: support other length addresses?

View Source
const (
	SignatureSize = bls12381.SignatureSize
)
View Source
const StateIDVersion = 1
View Source
const TimeFormat = time.RFC3339Nano

TimeFormat is used for generating the sigs

Variables

View Source
var (
	EventNewBlock = abci.Event{
		Type: strings.Split(EventTypeKey, ".")[0],
		Attributes: []abci.EventAttribute{
			{
				Key:   strings.Split(EventTypeKey, ".")[1],
				Value: EventNewBlockValue,
			},
		},
	}

	EventNewBlockHeader = abci.Event{
		Type: strings.Split(EventTypeKey, ".")[0],
		Attributes: []abci.EventAttribute{
			{
				Key:   strings.Split(EventTypeKey, ".")[1],
				Value: EventNewBlockHeaderValue,
			},
		},
	}

	EventNewEvidence = abci.Event{
		Type: strings.Split(EventTypeKey, ".")[0],
		Attributes: []abci.EventAttribute{
			{
				Key:   strings.Split(EventTypeKey, ".")[1],
				Value: EventNewEvidenceValue,
			},
		},
	}

	EventTx = abci.Event{
		Type: strings.Split(EventTypeKey, ".")[0],
		Attributes: []abci.EventAttribute{
			{
				Key:   strings.Split(EventTypeKey, ".")[1],
				Value: EventTxValue,
			},
		},
	}
)

Pre-populated ABCI Tendermint-reserved events

View Source
var (
	EventQueryCompleteProposal    = QueryForEvent(EventCompleteProposalValue)
	EventQueryLock                = QueryForEvent(EventLockValue)
	EventQueryNewBlock            = QueryForEvent(EventNewBlockValue)
	EventQueryNewBlockHeader      = QueryForEvent(EventNewBlockHeaderValue)
	EventQueryNewEvidence         = QueryForEvent(EventNewEvidenceValue)
	EventQueryNewRound            = QueryForEvent(EventNewRoundValue)
	EventQueryNewRoundStep        = QueryForEvent(EventNewRoundStepValue)
	EventQueryPolka               = QueryForEvent(EventPolkaValue)
	EventQueryRelock              = QueryForEvent(EventRelockValue)
	EventQueryTimeoutPropose      = QueryForEvent(EventTimeoutProposeValue)
	EventQueryTimeoutWait         = QueryForEvent(EventTimeoutWaitValue)
	EventQueryTx                  = QueryForEvent(EventTxValue)
	EventQueryValidatorSetUpdates = QueryForEvent(EventValidatorSetUpdateValue)
	EventQueryValidBlock          = QueryForEvent(EventValidBlockValue)
	EventQueryVote                = QueryForEvent(EventVoteValue)
	EventQueryBlockSyncStatus     = QueryForEvent(EventBlockSyncStatusValue)
	EventQueryStateSyncStatus     = QueryForEvent(EventStateSyncStatusValue)
	EventQueryEvidenceValidated   = QueryForEvent(EventEvidenceValidatedValue)
)
View Source
var (
	ErrPartSetUnexpectedIndex = errors.New("error part set unexpected index")
	ErrPartSetInvalidProof    = errors.New("error part set invalid proof")
)
View Source
var (
	ErrInvalidBlockPartSignature = errors.New("error invalid block part signature")
	ErrInvalidBlockPartHash      = errors.New("error invalid block part hash")
)
View Source
var (
	// ErrNoHostname is returned when no hostname is set for the validator address
	ErrNoHostname = errors.New("no hostname")
	// ErrNoPort is returned when no valid port is set for the validator address
	ErrNoPort = errors.New("no port")
)
View Source
var (
	ErrTotalVotingPowerOverflow = fmt.Errorf("total voting power of resulting valset exceeds max %d", MaxTotalVotingPower)
	ErrValidatorSetNilOrEmpty   = errors.New("validator set is nil or empty")
)

ErrTotalVotingPowerOverflow is returned if the total voting power of the resulting validator set exceeds MaxTotalVotingPower.

View Source
var (
	ErrVoteUnexpectedStep             = errors.New("unexpected step")
	ErrVoteInvalidValidatorIndex      = errors.New("invalid validator index")
	ErrVoteInvalidValidatorAddress    = errors.New("invalid validator address")
	ErrVoteInvalidSignature           = errors.New("invalid signature")
	ErrVoteInvalidBlockHash           = errors.New("invalid block hash")
	ErrVoteNonDeterministicSignature  = errors.New("non-deterministic signature")
	ErrVoteNil                        = errors.New("nil vote")
	ErrVoteInvalidExtension           = errors.New("invalid vote extension")
	ErrVoteInvalidValidatorProTxHash  = errors.New("invalid validator pro_tx_hash")
	ErrVoteInvalidValidatorPubKeySize = errors.New("invalid validator public key size")
	ErrVoteInvalidBlockSignature      = errors.New("invalid block signature")
	ErrVoteInvalidStateSignature      = errors.New("invalid state signature")
	ErrVoteStateSignatureShouldBeNil  = errors.New("state signature when voting for nil block")
)
View Source
var ABCIPubKeyTypesToNames = map[string]string{
	ABCIPubKeyTypeEd25519:   ed25519.PubKeyName,
	ABCIPubKeyTypeSecp256k1: secp256k1.PubKeyName,
	ABCIPubKeyTypeBLS12381:  bls12381.PubKeyName,
}
View Source
var ErrTxInCache = errors.New("tx already exists in cache")

ErrTxInCache is returned to the client if we saw tx earlier

View Source
var ErroringMockPVErr = errors.New("erroringMockPV always returns an error")
View Source
var PB2TM = pb2tm{}

PB2TM is used for converting protobuf ABCI to Tendermint ABCI. UNSTABLE

View Source
var TM2PB = tm2pb{}

TM2PB is used for converting Tendermint ABCI to protobuf ABCI. UNSTABLE

VoteExtensionTypes is a list of all possible vote-extension types

Functions

func BlockRequestID

func BlockRequestID(height int64, round int32) []byte

BlockRequestID returns a block request ID

func CanonicalTime

func CanonicalTime(t time.Time) string

CanonicalTime can be used to stringify time in a canonical way.

func CanonicalizeProposal

func CanonicalizeProposal(chainID string, proposal *tmproto.Proposal) tmproto.CanonicalProposal

CanonicalizeVote transforms the given Proposal to a CanonicalProposal.

func CanonicalizeVoteExtension

func CanonicalizeVoteExtension(chainID string, ext *tmproto.VoteExtension, height int64, round int32) tmproto.CanonicalVoteExtension

CanonicalizeVoteExtension extracts the vote extension from the given vote and constructs a CanonicalizeVoteExtension struct, whose representation in bytes is what is signed in order to produce the vote extension's signature.

func ComputeProtoSizeForTxs

func ComputeProtoSizeForTxs(txs []Tx) int64

ComputeProtoSizeForTxs wraps the transactions in tmproto.Data{} and calculates the size. https://developers.google.com/protocol-buffers/docs/encoding

func EventQueryTxFor

func EventQueryTxFor(tx Tx) *tmquery.Query

func EvidenceToProto

func EvidenceToProto(evidence Evidence) (*tmproto.Evidence, error)

EvidenceToProto is a generalized function for encoding evidence that conforms to the evidence interface to protobuf

func GenKeysForQuorumHash

func GenKeysForQuorumHash(quorumHash crypto.QuorumHash) func(pv *MockPV)

GenKeysForQuorumHash generates the quorum keys for passed quorum hash

func GenerateValidatorSet

func GenerateValidatorSet(valParams []ValSetParam, opts ...ValSetOptionFunc) (*ValidatorSet, []PrivValidator)

GenerateValidatorSet generates a validator set and a list of private validators

func IsErrNotEnoughVotingPowerSigned

func IsErrNotEnoughVotingPowerSigned(err error) bool

IsErrNotEnoughVotingPowerSigned returns true if err is ErrNotEnoughVotingPowerSigned.

func IsPreCheckError

func IsPreCheckError(err error) bool

IsPreCheckError returns true if err is due to pre check failure.

func IsVoteTypeValid

func IsVoteTypeValid(t tmproto.SignedMsgType) bool

IsVoteTypeValid returns true if t is a valid vote type.

func MakeSignID

func MakeSignID(msgHash, reqID []byte, quorumType btcjson.LLMQType, quorumHash []byte) []byte

MakeSignID creates singID

func MakeVoteExtensionSignItems

func MakeVoteExtensionSignItems(
	chainID string,
	protoVote *types.Vote,
	quorumType btcjson.LLMQType,
	quorumHash []byte,
) (map[types.VoteExtensionType][]SignItem, error)

MakeVoteExtensionSignItems creates a list SignItem structs for a vote extensions

func MaxDataBytes

func MaxDataBytes(maxBytes int64, commit *Commit, evidenceBytes int64) (int64, error)

MaxDataBytes returns the maximum size of block's data. If `commit` is nil, it is assumed to use `MaxCommitOverheadBytes`

func MaxDataBytesNoEvidence

func MaxDataBytesNoEvidence(maxBytes int64) (int64, error)

MaxDataBytesNoEvidence returns the maximum size of block's data when no evidence is used.

func MaxNodeInfoSize

func MaxNodeInfoSize() int

Max size of the NodeInfo struct

func MaxVoteBytesForKeyType

func MaxVoteBytesForKeyType(keyType crypto.KeyType) int64

func ProposalBlockSignBytes

func ProposalBlockSignBytes(chainID string, p *tmproto.Proposal) []byte

ProposalBlockSignBytes returns the proto-encoding of the canonicalized Proposal, for signing. Panics if the marshaling fails.

The encoded Protobuf message is varint length-prefixed (using MarshalDelimited) for backwards-compatibility with the Amino encoding, due to e.g. hardware devices that rely on this encoding.

See CanonicalizeProposal

func ProposalBlockSignID

func ProposalBlockSignID(
	chainID string, p *tmproto.Proposal, quorumType btcjson.LLMQType, quorumHash crypto.QuorumHash,
) []byte

func ProposalRequestID

func ProposalRequestID(p *Proposal) []byte

func ProposalRequestIDProto

func ProposalRequestIDProto(p *tmproto.Proposal) []byte

func QueryForEvent

func QueryForEvent(eventValue string) *tmquery.Query

func RandStateID

func RandStateID() tmproto.StateID

func RandValidatorSet

func RandValidatorSet(n int) (*ValidatorSet, []PrivValidator)

RandValidatorSet returns a randomized validator set (size: +numValidators+), where each validator has the same default voting power.

func ThresholdExtensionSignToProto

func ThresholdExtensionSignToProto(extensions []ThresholdExtensionSign) []*tmproto.VoteExtension

ThresholdExtensionSignToProto transforms a list of domain ThresholdExtensionSign into the list of protobuf VoteExtension

func UseProTxHash

func UseProTxHash(proTxHash ProTxHash) func(pv *MockPV)

UseProTxHash sets pro-tx-hash to a private-validator

func ValidateAppHash

func ValidateAppHash(h []byte) error

ValidateAppHash returns an error if the app hash size is invalid.

func ValidateHash

func ValidateHash(h []byte) error

ValidateHash returns an error if the hash is not empty, but its size != crypto.HashSize.

func ValidateSignatureSize

func ValidateSignatureSize(keyType crypto.KeyType, h []byte) error

ValidateSignatureSize returns an error if the signature is not empty, but its size != hash.Size.

func ValidatorListString

func ValidatorListString(vals []*Validator) string

ValidatorListString returns a prettified validator list for logging purposes.

func ValidatorUpdatesRegenerateOnProTxHashes

func ValidatorUpdatesRegenerateOnProTxHashes(proTxHashes []crypto.ProTxHash) abci.ValidatorSetUpdate

func VoteBlockRequestIDProto

func VoteBlockRequestIDProto(vote *tmproto.Vote) []byte

func VoteBlockSignID

func VoteBlockSignID(chainID string, vote *tmproto.Vote, quorumType btcjson.LLMQType, quorumHash []byte) []byte

VoteBlockSignID returns signID that should be signed for the block

func VoteExtensionRequestID

func VoteExtensionRequestID(height int64, round int32) []byte

VoteExtensionRequestID returns vote extension request ID

func VoteExtensionSignBytes

func VoteExtensionSignBytes(chainID string, height int64, round int32, ext *tmproto.VoteExtension) []byte

VoteExtensionSignBytes returns the proto-encoding of the canonicalized vote extension for signing. Panics if the marshaling fails.

Similar to VoteSignBytes, the encoded Protobuf message is varint length-prefixed for backwards-compatibility with the Amino encoding.

func WithLogger

func WithLogger(logger log.Logger) func(*QuorumSingsVerifier)

WithLogger sets a logger

func WithQuorumReached

func WithQuorumReached(quorumReached bool) func(*SignsRecoverer)

WithQuorumReached sets a flag at SignsRecoverer to recovers threshold signatures for stateID and vote-extensions

func WithUpdatePrivValAt

func WithUpdatePrivValAt(privVals []PrivValidator, height int64) func(opt *ValSetOptions)

WithUpdatePrivValAt sets a list of the private validators to update validator set at passed the height

func WithVerifyBlock

func WithVerifyBlock(shouldVerify bool) func(*QuorumSingsVerifier)

WithVerifyBlock sets a flag that tells QuorumSingsVerifier to verify block signature or not

func WithVerifyExtensions

func WithVerifyExtensions(shouldVerify bool) func(*QuorumSingsVerifier)

WithVerifyExtensions sets a flag that tells QuorumSingsVerifier to verify vote-extension signatures or not

func WithVerifyReachedQuorum

func WithVerifyReachedQuorum(quorumReached bool) func(*QuorumSingsVerifier)

WithVerifyReachedQuorum sets a flag that tells QuorumSingsVerifier to verify vote-extension and stateID signatures or not

Types

type ABCIParams

type ABCIParams struct {
	RecheckTx bool `json:"recheck_tx"`
}

ABCIParams configure ABCI functionality specific to the Application Blockchain Interface.

func DefaultABCIParams

func DefaultABCIParams() ABCIParams

type Address

type Address = crypto.Address

Address is hex bytes.

type Block

type Block struct {
	Header        `json:"header"`
	Data          `json:"data"`
	CoreChainLock *CoreChainLock `json:"core_chain_lock"`
	Evidence      EvidenceList   `json:"evidence"`
	LastCommit    *Commit        `json:"last_commit"`
	// contains filtered or unexported fields
}

Block defines the atomic unit of a Tendermint blockchain.

func BlockFromProto

func BlockFromProto(bp *tmproto.Block) (*Block, error)

FromProto sets a protobuf Block to the given pointer. It returns an error if the block is invalid.

func MakeBlock

func MakeBlock(height int64, txs []Tx, lastCommit *Commit, evidence []Evidence) *Block

MakeBlock returns a new block with an empty header, except what can be computed from itself. It populates the same set of fields validated by ValidateBasic.

func (*Block) BlockID

func (b *Block) BlockID(partSet *PartSet) BlockID

BlockID returns a block ID of this block. BlockID of a nil block is zero-value (BlockID{}) If partSet is nil, new partSet will be created

func (*Block) Hash

func (b *Block) Hash() tmbytes.HexBytes

Hash computes and returns the block hash. If the block is incomplete, block hash is nil for safety.

func (*Block) HashesTo

func (b *Block) HashesTo(hash []byte) bool

HashesTo is a convenience function that checks if a block hashes to the given argument. Returns false if the block is nil or the hash is empty.

func (*Block) MakePartSet

func (b *Block) MakePartSet(partSize uint32) (*PartSet, error)

MakePartSet returns a PartSet containing parts of a serialized block. This is the form in which the block is gossipped to peers. CONTRACT: partSize is greater than zero.

func (*Block) SetCoreChainLock

func (b *Block) SetCoreChainLock(chainlock *CoreChainLock)

func (*Block) SetDashParams

func (b *Block) SetDashParams(
	lastCoreChainLockedBlockHeight uint32,
	coreChainLock *CoreChainLock,
	proposedAppVersion uint64,
	nextValidatorsHash tmbytes.HexBytes,
)

SetDashParams sets dash's some parameters to a block this method should call if we need to provide specific dash data

func (*Block) SetTxs

func (b *Block) SetTxs(txs []Tx)

SetTxs updates Data (in particular the transactions) and DataHash

func (*Block) Size

func (b *Block) Size() int

Size returns size of the block in bytes.

func (*Block) String

func (b *Block) String() string

String returns a string representation of the block

See StringIndented.

func (*Block) StringIndented

func (b *Block) StringIndented(indent string) string

StringIndented returns an indented String.

Header Data Evidence LastCommit Hash

func (*Block) StringShort

func (b *Block) StringShort() string

StringShort returns a shortened string representation of the block.

func (*Block) ToProto

func (b *Block) ToProto() (*tmproto.Block, error)

ToProto converts Block to protobuf

func (*Block) ValidateBasic

func (b *Block) ValidateBasic() error

ValidateBasic performs basic validation that doesn't involve state data. It checks the internal consistency of the block. Further validation is done using state#ValidateBlock.

type BlockEventPublisher

type BlockEventPublisher interface {
	TxEventPublisher
	PublishEventNewBlock(EventDataNewBlock) error
	PublishEventNewBlockHeader(EventDataNewBlockHeader) error
	PublishEventNewEvidence(EventDataNewEvidence) error
	PublishEventValidatorSetUpdates(EventDataValidatorSetUpdate) error
}

BlockEventPublisher publishes all block related events

type BlockID

type BlockID struct {
	Hash          tmbytes.HexBytes `json:"hash"`
	PartSetHeader PartSetHeader    `json:"parts"`
	StateID       tmbytes.HexBytes `json:"state_id"`
}

BlockID

func BlockIDFromProto

func BlockIDFromProto(bID *tmproto.BlockID) (*BlockID, error)

FromProto sets a protobuf BlockID to the given pointer. It returns an error if the block id is invalid.

func (BlockID) Copy

func (blockID BlockID) Copy() BlockID

func (BlockID) Equals

func (blockID BlockID) Equals(other BlockID) bool

Equals returns true if the BlockID matches the given BlockID

func (BlockID) IsComplete

func (blockID BlockID) IsComplete() bool

IsComplete returns true if this is a valid BlockID of a non-nil block.

func (BlockID) IsNil

func (blockID BlockID) IsNil() bool

IsNil returns true if this is the BlockID of a nil block.

func (BlockID) Key

func (blockID BlockID) Key() string

Key returns a machine-readable string representation of the BlockID

func (BlockID) String

func (blockID BlockID) String() string

String returns a human readable string representation of the BlockID.

1. hash 2. part set header 3. state ID hash

See PartSetHeader#String

func (*BlockID) ToProto

func (blockID *BlockID) ToProto() tmproto.BlockID

ToProto converts BlockID to protobuf

func (BlockID) ValidateBasic

func (blockID BlockID) ValidateBasic() error

ValidateBasic performs basic validation.

type BlockIDFlag

type BlockIDFlag byte

BlockIDFlag indicates which BlockID the signature is for.

const (
	// BlockIDFlagAbsent - no vote was received from a validator.
	BlockIDFlagAbsent BlockIDFlag = iota + 1
	// BlockIDFlagCommit - voted for the Commit.BlockID.
	BlockIDFlagCommit
	// BlockIDFlagNil - voted for nil.
	BlockIDFlagNil
)

type BlockMeta

type BlockMeta struct {
	BlockID   BlockID `json:"block_id"`
	BlockSize int     `json:"block_size,string"`
	Header    Header  `json:"header"`
	NumTxs    int     `json:"num_txs,string"`
	Round     int32   `json:"round,string"`

	// dash fields
	HasCoreChainLock bool `json:"has_core_chain_lock"`
}

BlockMeta contains meta information.

func BlockMetaFromProto

func BlockMetaFromProto(pb *tmproto.BlockMeta) (*BlockMeta, error)

func NewBlockMeta

func NewBlockMeta(block *Block, blockParts *PartSet, round int32) *BlockMeta

NewBlockMeta returns a new BlockMeta.

func (*BlockMeta) ToProto

func (bm *BlockMeta) ToProto() *tmproto.BlockMeta

func (*BlockMeta) ValidateBasic

func (bm *BlockMeta) ValidateBasic() error

ValidateBasic performs basic validation.

type BlockParams

type BlockParams struct {
	MaxBytes int64 `json:"max_bytes,string"`
	MaxGas   int64 `json:"max_gas,string"`
}

BlockParams define limits on the block size and gas plus minimum time between blocks.

func DefaultBlockParams

func DefaultBlockParams() BlockParams

DefaultBlockParams returns a default BlockParams.

type Commit

type Commit struct {
	// NOTE: The signatures are in order of proTxHash to preserve the bonded
	// ValidatorSet order.
	// Any peer with a block can gossip signatures by index with a peer without
	// recalculating the active ValidatorSet.
	Height                  int64             `json:"height"`
	Round                   int32             `json:"round"`
	BlockID                 BlockID           `json:"block_id"`
	QuorumHash              crypto.QuorumHash `json:"quorum_hash"`
	ThresholdBlockSignature []byte            `json:"threshold_block_signature"`
	// ThresholdVoteExtensions keeps the list of recovered threshold signatures for vote-extensions
	ThresholdVoteExtensions []ThresholdExtensionSign `json:"threshold_vote_extensions"`
	// contains filtered or unexported fields
}

Commit contains the evidence that a block was committed by a set of validators. NOTE: Commit is empty for height 1, but never nil.

func CommitFromProto

func CommitFromProto(cp *tmproto.Commit) (*Commit, error)

CommitFromProto creates a commit from a protobuf commit message. It returns an error if the commit is invalid.

func NewCommit

func NewCommit(height int64, round int32, blockID BlockID, commitSigns *CommitSigns) *Commit

NewCommit returns a new Commit.

func (*Commit) CanonicalVoteVerifySignBytes

func (commit *Commit) CanonicalVoteVerifySignBytes(chainID string) []byte

CanonicalVoteVerifySignBytes returns the bytes of the Canonical Vote that is threshold signed.

func (*Commit) CanonicalVoteVerifySignID

func (commit *Commit) CanonicalVoteVerifySignID(chainID string, quorumType btcjson.LLMQType, quorumHash []byte) []byte

CanonicalVoteVerifySignID returns the signID bytes of the Canonical Vote that is threshold signed.

func (*Commit) GetCanonicalVote

func (commit *Commit) GetCanonicalVote() *Vote

GetCanonicalVote returns the message that is being voted on in the form of a vote without signatures.

func (*Commit) GetHeight

func (commit *Commit) GetHeight() int64

GetHeight returns height of the commit. Implements VoteSetReader.

func (*Commit) GetRound

func (commit *Commit) GetRound() int32

GetRound returns height of the commit. Implements VoteSetReader.

func (*Commit) HasCommitMessage

func (commit *Commit) HasCommitMessage() *tmcons.HasCommit

Broadcasts HasCommitMessage to peers that care.

func (*Commit) Hash

func (commit *Commit) Hash() tmbytes.HexBytes

Hash returns the hash of the commit

func (*Commit) IsCommit

func (commit *Commit) IsCommit() bool

IsCommit returns true if there is at least one signature. Implements VoteSetReader.

func (*Commit) MarshalZerologObject

func (commit *Commit) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject formats this object for logging purposes

func (*Commit) String

func (commit *Commit) String() string

String returns a string representation of the block

See StringIndented.

func (*Commit) StringIndented

func (commit *Commit) StringIndented(indent string) string

StringIndented returns a string representation of the commit.

func (*Commit) ToCommitInfo

func (commit *Commit) ToCommitInfo() types.CommitInfo

ToCommitInfo convert and returns CommitInfo structure

func (*Commit) ToProto

func (commit *Commit) ToProto() *tmproto.Commit

ToProto converts Commit to protobuf

func (*Commit) Type

func (commit *Commit) Type() byte

Type returns the vote type of the commit, which is always VoteTypePrecommit Implements VoteSetReader.

func (*Commit) ValidateBasic

func (commit *Commit) ValidateBasic() error

ValidateBasic performs basic validation that doesn't involve state data. Does not actually check the cryptographic signatures.

func (*Commit) VoteBlockRequestID

func (commit *Commit) VoteBlockRequestID() []byte

VoteBlockRequestID returns the requestId Hash of the Vote corresponding to valIdx for signing.

Panics if valIdx >= commit.Size().

type CommitSigns

type CommitSigns struct {
	QuorumSigns
	QuorumHash []byte
}

CommitSigns is used to combine threshold signatures and quorum-hash that were used

func (*CommitSigns) CopyToCommit

func (c *CommitSigns) CopyToCommit(commit *Commit)

CopyToCommit copies threshold signature to commit

type ConsensusParams

type ConsensusParams struct {
	Block     BlockParams     `json:"block"`
	Evidence  EvidenceParams  `json:"evidence"`
	Validator ValidatorParams `json:"validator"`
	Version   VersionParams   `json:"version"`
	Synchrony SynchronyParams `json:"synchrony"`
	Timeout   TimeoutParams   `json:"timeout"`
	ABCI      ABCIParams      `json:"abci"`
}

ConsensusParams contains consensus critical parameters that determine the validity of blocks.

func ConsensusParamsFromProto

func ConsensusParamsFromProto(pbParams tmproto.ConsensusParams) ConsensusParams

func DefaultConsensusParams

func DefaultConsensusParams() *ConsensusParams

DefaultConsensusParams returns a default ConsensusParams.

func (*ConsensusParams) Complete

func (params *ConsensusParams) Complete()

func (*ConsensusParams) Equals

func (params *ConsensusParams) Equals(params2 *ConsensusParams) bool

func (ConsensusParams) HashConsensusParams

func (params ConsensusParams) HashConsensusParams() tmbytes.HexBytes

Hash returns a hash of a subset of the parameters to store in the block header. Only the Block.MaxBytes and Block.MaxGas are included in the hash. This allows the ConsensusParams to evolve more without breaking the block protocol. No need for a Merkle tree here, just a small struct to hash. TODO: We should hash the other parameters as well

func (ConsensusParams) IsZero

func (params ConsensusParams) IsZero() bool

func (*ConsensusParams) ToProto

func (params *ConsensusParams) ToProto() tmproto.ConsensusParams

func (ConsensusParams) UpdateConsensusParams

func (params ConsensusParams) UpdateConsensusParams(params2 *tmproto.ConsensusParams) ConsensusParams

Update returns a copy of the params with updates from the non-zero fields of p2. NOTE: note: must not modify the original

func (ConsensusParams) ValidateConsensusParams

func (params ConsensusParams) ValidateConsensusParams() error

Validate validates the ConsensusParams to ensure all values are within their allowed limits, and returns an error if they are not.

type CoreChainLock

type CoreChainLock struct {
	CoreBlockHeight uint32 `json:"core_block_height,string,omitempty"` // height of Chain Lock.
	CoreBlockHash   []byte `json:"core_block_hash,omitempty"`          // hash of Chain Lock.
	Signature       []byte `json:"signature,omitempty"`                // signature.
}

func CoreChainLockFromProto

func CoreChainLockFromProto(clp *tmproto.CoreChainLock) (*CoreChainLock, error)

FromProto sets a protobuf Header to the given pointer. It returns an error if the chain lock is invalid.

func NewMockChainLock

func NewMockChainLock(height uint32) CoreChainLock

func (CoreChainLock) Copy

func (cl CoreChainLock) Copy() CoreChainLock

Copy the chain lock.

func (*CoreChainLock) IsZero

func (cl *CoreChainLock) IsZero() bool

func (*CoreChainLock) PopulateFromProto

func (cl *CoreChainLock) PopulateFromProto(clp *tmproto.CoreChainLock) error

func (CoreChainLock) RequestID

func (cl CoreChainLock) RequestID() []byte

func (*CoreChainLock) StringIndented

func (cl *CoreChainLock) StringIndented(indent string) string

StringIndented returns a string representation of the header

func (*CoreChainLock) ToProto

func (cl *CoreChainLock) ToProto() *tmproto.CoreChainLock

ToProto converts Header to protobuf

func (CoreChainLock) ValidateBasic

func (cl CoreChainLock) ValidateBasic() error

ValidateBasic performs stateless validation on a Chain Lock returning an error if any validation fails. It does not verify the signature

type Data

type Data struct {

	// Txs that will be applied by state @ block.Height+1.
	// NOTE: not all txs here are valid.  We're just agreeing on the order first.
	// This means that block.AppHash does not include these txs.
	Txs Txs `json:"txs"`
	// contains filtered or unexported fields
}

Data contains the set of transactions included in the block

func DataFromProto

func DataFromProto(dp *tmproto.Data) (Data, error)

DataFromProto takes a protobuf representation of Data & returns the native type.

func (*Data) Hash

func (data *Data) Hash() tmbytes.HexBytes

Hash returns the hash of the data

func (*Data) StringIndented

func (data *Data) StringIndented(indent string) string

StringIndented returns an indented string representation of the transactions.

func (*Data) ToProto

func (data *Data) ToProto() tmproto.Data

ToProto converts Data to protobuf

type DuplicateVoteEvidence

type DuplicateVoteEvidence struct {
	VoteA *Vote `json:"vote_a"`
	VoteB *Vote `json:"vote_b"`

	// abci specific information
	TotalVotingPower int64 `json:",string"`
	ValidatorPower   int64 `json:",string"`
	Timestamp        time.Time
}

DuplicateVoteEvidence contains evidence of a single validator signing two conflicting votes.

func DuplicateVoteEvidenceFromProto

func DuplicateVoteEvidenceFromProto(pb *tmproto.DuplicateVoteEvidence) (*DuplicateVoteEvidence, error)

DuplicateVoteEvidenceFromProto decodes protobuf into DuplicateVoteEvidence

func NewDuplicateVoteEvidence

func NewDuplicateVoteEvidence(vote1, vote2 *Vote, blockTime time.Time, valSet *ValidatorSet) (*DuplicateVoteEvidence, error)

NewDuplicateVoteEvidence creates DuplicateVoteEvidence with right ordering given two conflicting votes. If one of the votes is nil, evidence returned is nil as well

func NewMockDuplicateVoteEvidence

func NewMockDuplicateVoteEvidence(
	ctx context.Context,
	height int64,
	time time.Time,
	chainID string,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
) (*DuplicateVoteEvidence, error)

NewMockDuplicateVoteEvidence assumes the round to be 0 and the validator index to be 0

func NewMockDuplicateVoteEvidenceWithPrivValInValidatorSet

func NewMockDuplicateVoteEvidenceWithPrivValInValidatorSet(height int64, time time.Time,
	pv PrivValidator, valSet *ValidatorSet, chainID string, quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash) (*DuplicateVoteEvidence, error)

assumes voting power to be DefaultDashVotingPower and validator to be the only one in the set

func NewMockDuplicateVoteEvidenceWithValidator

func NewMockDuplicateVoteEvidenceWithValidator(
	ctx context.Context,
	height int64,
	time time.Time,
	pv PrivValidator,
	chainID string,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
) (*DuplicateVoteEvidence, error)

NewMockDuplicateVoteEvidenceWithValidator assumes voting power to be DefaultDashVotingPower and validator to be the only one in the set TODO: discuss if this might be moved to some *_test.go file

func (*DuplicateVoteEvidence) ABCI

func (dve *DuplicateVoteEvidence) ABCI() []abci.Misbehavior

ABCI returns the application relevant representation of the evidence

func (*DuplicateVoteEvidence) Bytes

func (dve *DuplicateVoteEvidence) Bytes() []byte

Bytes returns the proto-encoded evidence as a byte array.

func (*DuplicateVoteEvidence) GenerateABCI

func (dve *DuplicateVoteEvidence) GenerateABCI(
	val *Validator,
	valSet *ValidatorSet,
	evidenceTime time.Time,
)

GenerateABCI populates the ABCI component of the evidence. This includes the validator power, timestamp and total voting power.

func (*DuplicateVoteEvidence) Hash

func (dve *DuplicateVoteEvidence) Hash() []byte

Hash returns the hash of the evidence.

func (*DuplicateVoteEvidence) Height

func (dve *DuplicateVoteEvidence) Height() int64

Height returns the height of the infraction

func (*DuplicateVoteEvidence) String

func (dve *DuplicateVoteEvidence) String() string

String returns a string representation of the evidence.

func (*DuplicateVoteEvidence) Time

func (dve *DuplicateVoteEvidence) Time() time.Time

Time returns the time of the infraction

func (*DuplicateVoteEvidence) ToProto

ToProto encodes DuplicateVoteEvidence to protobuf

func (*DuplicateVoteEvidence) TypeTag

func (*DuplicateVoteEvidence) TypeTag() string

TypeTag implements the jsontypes.Tagged interface.

func (*DuplicateVoteEvidence) ValidateABCI

func (dve *DuplicateVoteEvidence) ValidateABCI(
	val *Validator,
	valSet *ValidatorSet,
	evidenceTime time.Time,
) error

ValidateABCI validates the ABCI component of the evidence by checking the timestamp, validator power and total voting power.

func (*DuplicateVoteEvidence) ValidateBasic

func (dve *DuplicateVoteEvidence) ValidateBasic() error

ValidateBasic performs basic validation.

type ErrEvidenceOverflow

type ErrEvidenceOverflow struct {
	Max int64
	Got int64
}

ErrEvidenceOverflow is for when there the amount of evidence exceeds the max bytes.

func NewErrEvidenceOverflow

func NewErrEvidenceOverflow(max, got int64) *ErrEvidenceOverflow

NewErrEvidenceOverflow returns a new ErrEvidenceOverflow where got > max.

func (*ErrEvidenceOverflow) Error

func (err *ErrEvidenceOverflow) Error() string

Error returns a string representation of the error.

type ErrInvalidCommitHeight

type ErrInvalidCommitHeight struct {
	Expected int64
	Actual   int64
}

ErrInvalidCommitHeight is returned when we encounter a commit with an unexpected height.

func NewErrInvalidCommitHeight

func NewErrInvalidCommitHeight(expected, actual int64) ErrInvalidCommitHeight

func (ErrInvalidCommitHeight) Error

func (e ErrInvalidCommitHeight) Error() string

type ErrInvalidEvidence

type ErrInvalidEvidence struct {
	Evidence Evidence
	Reason   error
}

ErrInvalidEvidence wraps a piece of evidence and the error denoting how or why it is invalid.

func NewErrInvalidEvidence

func NewErrInvalidEvidence(ev Evidence, err error) *ErrInvalidEvidence

NewErrInvalidEvidence returns a new EvidenceInvalid with the given err.

func (*ErrInvalidEvidence) Error

func (err *ErrInvalidEvidence) Error() string

Error returns a string representation of the error.

type ErrInvalidVoteSignature

type ErrInvalidVoteSignature error

type ErrMempoolIsFull

type ErrMempoolIsFull struct {
	NumTxs      int
	MaxTxs      int
	TxsBytes    int64
	MaxTxsBytes int64
}

ErrMempoolIsFull defines an error where Tendermint and the application cannot handle that much load.

func (ErrMempoolIsFull) Error

func (e ErrMempoolIsFull) Error() string

type ErrNotEnoughVotingPowerSigned

type ErrNotEnoughVotingPowerSigned struct {
	Got    int64
	Needed int64
}

ErrNotEnoughVotingPowerSigned is returned when not enough validators signed a commit.

func (ErrNotEnoughVotingPowerSigned) Error

type ErrPreCheck

type ErrPreCheck struct {
	Reason error
}

ErrPreCheck defines an error where a transaction fails a pre-check.

func (ErrPreCheck) Error

func (e ErrPreCheck) Error() string

type ErrTxTooLarge

type ErrTxTooLarge struct {
	Max    int
	Actual int
}

ErrTxTooLarge defines an error when a transaction is too big to be sent in a message to other peers.

func (ErrTxTooLarge) Error

func (e ErrTxTooLarge) Error() string

type ErrVoteConflictingVotes

type ErrVoteConflictingVotes struct {
	VoteA *Vote
	VoteB *Vote
}

func NewConflictingVoteError

func NewConflictingVoteError(vote1, vote2 *Vote) *ErrVoteConflictingVotes

func (*ErrVoteConflictingVotes) Error

func (err *ErrVoteConflictingVotes) Error() string

type ErroringMockPV

type ErroringMockPV struct {
	MockPV
}

func NewErroringMockPV

func NewErroringMockPV() *ErroringMockPV

func (*ErroringMockPV) GetPubKey

func (pv *ErroringMockPV) GetPubKey(ctx context.Context, quorumHash crypto.QuorumHash) (crypto.PubKey, error)

GetPubKey Implements PrivValidator.

func (*ErroringMockPV) SignProposal

func (pv *ErroringMockPV) SignProposal(
	ctx context.Context, chainID string,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
	proposal *tmproto.Proposal,
) (tmbytes.HexBytes, error)

SignProposal Implements PrivValidator.

func (*ErroringMockPV) SignVote

func (pv *ErroringMockPV) SignVote(
	ctx context.Context, chainID string, quorumType btcjson.LLMQType, quorumHash crypto.QuorumHash,
	vote *tmproto.Vote, logger log.Logger) error

SignVote Implements PrivValidator.

type EventData

type EventData interface {
	// The value must support encoding as a type-tagged JSON object.
	jsontypes.Tagged
}

EventData is satisfied by types that can be published as event data.

Implementations of this interface that contain ABCI event metadata should also implement the eventlog.ABCIEventer extension interface to expose those metadata to the event log machinery. Event data that do not contain ABCI metadata can safely omit this.

type EventDataBlockSyncStatus

type EventDataBlockSyncStatus struct {
	Complete bool  `json:"complete"`
	Height   int64 `json:"height,string"`
}

EventDataBlockSyncStatus shows the fastsync status and the height when the node state sync mechanism changes.

func (EventDataBlockSyncStatus) TypeTag

func (EventDataBlockSyncStatus) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataCommit

type EventDataCommit struct {
	Commit *Commit
}

func (EventDataCommit) TypeTag

func (EventDataCommit) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataCompleteProposal

type EventDataCompleteProposal struct {
	Height int64  `json:"height,string"`
	Round  int32  `json:"round"`
	Step   string `json:"step"`

	BlockID BlockID `json:"block_id"`
}

func (EventDataCompleteProposal) TypeTag

TypeTag implements the required method of jsontypes.Tagged.

type EventDataEvidenceValidated

type EventDataEvidenceValidated struct {
	Evidence Evidence `json:"evidence"`

	Height int64 `json:"height,string"`
}

func (EventDataEvidenceValidated) TypeTag

TypeTag implements the required method of jsontypes.Tagged.

type EventDataNewBlock

type EventDataNewBlock struct {
	Block   *Block  `json:"block"`
	BlockID BlockID `json:"block_id"`

	ResultFinalizeBlock abci.ResponseFinalizeBlock `json:"result_finalize_block"`
}

func (EventDataNewBlock) ABCIEvents

func (e EventDataNewBlock) ABCIEvents() []abci.Event

ABCIEvents implements the eventlog.ABCIEventer interface.

func (EventDataNewBlock) TypeTag

func (EventDataNewBlock) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataNewBlockHeader

type EventDataNewBlockHeader struct {
	Header Header `json:"header"`

	NumTxs int64 `json:"num_txs,string"` // Number of txs in a block

	ResultProcessProposal abci.ResponseProcessProposal `json:"result_process_proposal"`
	ResultFinalizeBlock   abci.ResponseFinalizeBlock   `json:"result_finalize_block"`
}

func (EventDataNewBlockHeader) ABCIEvents

func (e EventDataNewBlockHeader) ABCIEvents() []abci.Event

ABCIEvents implements the eventlog.ABCIEventer interface.

func (EventDataNewBlockHeader) TypeTag

func (EventDataNewBlockHeader) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataNewEvidence

type EventDataNewEvidence struct {
	Evidence Evidence `json:"evidence"`

	Height int64 `json:"height,string"`
}

func (EventDataNewEvidence) TypeTag

func (EventDataNewEvidence) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataNewRound

type EventDataNewRound struct {
	Height int64  `json:"height,string"`
	Round  int32  `json:"round"`
	Step   string `json:"step"`

	Proposer ValidatorInfo `json:"proposer"`
}

func (EventDataNewRound) TypeTag

func (EventDataNewRound) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataRoundState

type EventDataRoundState struct {
	Height int64  `json:"height,string"`
	Round  int32  `json:"round"`
	Step   string `json:"step"`
}

NOTE: This goes into the replay WAL

func (EventDataRoundState) TypeTag

func (EventDataRoundState) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataStateSyncStatus

type EventDataStateSyncStatus struct {
	Complete bool  `json:"complete"`
	Height   int64 `json:"height,string"`
}

EventDataStateSyncStatus shows the statesync status and the height when the node state sync mechanism changes.

func (EventDataStateSyncStatus) TypeTag

func (EventDataStateSyncStatus) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataString

type EventDataString string

func (EventDataString) TypeTag

func (EventDataString) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataTx

type EventDataTx struct {
	abci.TxResult
}

All txs fire EventDataTx

func (EventDataTx) ABCIEvents

func (e EventDataTx) ABCIEvents() []abci.Event

ABCIEvents implements the eventlog.ABCIEventer interface.

func (EventDataTx) TypeTag

func (EventDataTx) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type EventDataValidatorSetUpdate

type EventDataValidatorSetUpdate struct {
	ValidatorSetUpdates []*Validator      `json:"validator_updates"`
	ThresholdPublicKey  crypto.PubKey     `json:"threshold_public_key"`
	QuorumHash          crypto.QuorumHash `json:"quorum_hash"`
}

func (EventDataValidatorSetUpdate) TypeTag

TypeTag implements the required method of jsontypes.Tagged.

type EventDataVote

type EventDataVote struct {
	Vote *Vote
}

func (EventDataVote) TypeTag

func (EventDataVote) TypeTag() string

TypeTag implements the required method of jsontypes.Tagged.

type Evidence

type Evidence interface {
	ABCI() []abci.Misbehavior // forms individual evidence to be sent to the application
	Bytes() []byte            // bytes which comprise the evidence
	Hash() []byte             // hash of the evidence
	Height() int64            // height of the infraction
	String() string           // string format of the evidence
	Time() time.Time          // time of the infraction
	ValidateBasic() error     // basic consistency check

	// Implementations must support tagged encoding in JSON.
	jsontypes.Tagged
}

Evidence represents any provable malicious activity by a validator. Verification logic for each evidence is part of the evidence module.

func EvidenceFromProto

func EvidenceFromProto(evidence *tmproto.Evidence) (Evidence, error)

EvidenceFromProto is a generalized function for decoding protobuf into the evidence interface

type EvidenceList

type EvidenceList []Evidence

EvidenceList is a list of Evidence. Evidences is not a word.

func (EvidenceList) ByteSize

func (evl EvidenceList) ByteSize() int64

ByteSize returns the total byte size of all the evidence

func (*EvidenceList) FromProto

func (evl *EvidenceList) FromProto(eviList *tmproto.EvidenceList) error

FromProto sets a protobuf EvidenceList to the given pointer.

func (EvidenceList) Has

func (evl EvidenceList) Has(evidence Evidence) bool

Has returns true if the evidence is in the EvidenceList.

func (EvidenceList) Hash

func (evl EvidenceList) Hash() []byte

Hash returns the simple merkle root hash of the EvidenceList.

func (EvidenceList) MarshalJSON

func (evl EvidenceList) MarshalJSON() ([]byte, error)

func (EvidenceList) String

func (evl EvidenceList) String() string

func (EvidenceList) StringIndented

func (evl EvidenceList) StringIndented(indent string) string

StringIndented returns a string representation of the evidence.

func (EvidenceList) ToABCI

func (evl EvidenceList) ToABCI() []abci.Misbehavior

ToABCI converts the evidence list to a slice of the ABCI protobuf messages for use when communicating the evidence to an application.

func (*EvidenceList) ToProto

func (evl *EvidenceList) ToProto() (*tmproto.EvidenceList, error)

ToProto converts EvidenceList to protobuf

func (*EvidenceList) UnmarshalJSON

func (evl *EvidenceList) UnmarshalJSON(data []byte) error

type EvidenceParams

type EvidenceParams struct {
	MaxAgeNumBlocks int64         `json:"max_age_num_blocks,string"` // only accept new evidence more recent than this
	MaxAgeDuration  time.Duration `json:"max_age_duration,string"`
	MaxBytes        int64         `json:"max_bytes,string"`
}

EvidenceParams determine how we handle evidence of malfeasance.

func DefaultEvidenceParams

func DefaultEvidenceParams() EvidenceParams

DefaultEvidenceParams returns a default EvidenceParams.

type GenesisDoc

type GenesisDoc struct {
	GenesisTime     time.Time
	ChainID         string
	InitialHeight   int64
	ConsensusParams *ConsensusParams
	Validators      []GenesisValidator
	AppHash         tmbytes.HexBytes
	AppState        json.RawMessage

	// dash fields
	InitialCoreChainLockedHeight uint32                 `json:"initial_core_chain_locked_height"`
	InitialProposalCoreChainLock *tmproto.CoreChainLock `json:"initial_proposal_core_chain_lock"`
	ThresholdPublicKey           crypto.PubKey          `json:"validator_quorum_threshold_public_key"`
	QuorumType                   btcjson.LLMQType       `json:"validator_quorum_type"`
	QuorumHash                   crypto.QuorumHash      `json:"validator_quorum_hash"`
}

GenesisDoc defines the initial conditions for a tendermint blockchain, in particular its validator set.

func GenesisDocFromFile

func GenesisDocFromFile(genDocFile string) (*GenesisDoc, error)

GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc.

func GenesisDocFromJSON

func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error)

GenesisDocFromJSON unmarshalls JSON data into a GenesisDoc.

func (GenesisDoc) MarshalJSON

func (genDoc GenesisDoc) MarshalJSON() ([]byte, error)

func (*GenesisDoc) SaveAs

func (genDoc *GenesisDoc) SaveAs(file string) error

SaveAs is a utility method for saving GenensisDoc as a JSON file.

func (*GenesisDoc) UnmarshalJSON

func (genDoc *GenesisDoc) UnmarshalJSON(data []byte) error

func (*GenesisDoc) ValidateAndComplete

func (genDoc *GenesisDoc) ValidateAndComplete() error

ValidateAndComplete checks that all necessary fields are present and fills in defaults for optional fields left empty

func (*GenesisDoc) ValidatorHash

func (genDoc *GenesisDoc) ValidatorHash() []byte

ValidatorHash returns the hash of the validator set contained in the GenesisDoc

type GenesisValidator

type GenesisValidator struct {
	PubKey    crypto.PubKey
	Power     int64
	Name      string
	ProTxHash crypto.ProTxHash
}

GenesisValidator is an initial validator.

func MakeGenesisValsFromValidatorSet

func MakeGenesisValsFromValidatorSet(valz *ValidatorSet) []GenesisValidator

MakeGenesisValsFromValidatorSet converts ValidatorSet data into a list of GenesisValidator

func (GenesisValidator) MarshalJSON

func (g GenesisValidator) MarshalJSON() ([]byte, error)

func (*GenesisValidator) UnmarshalJSON

func (g *GenesisValidator) UnmarshalJSON(data []byte) error

type HashedParams

type HashedParams struct {
	BlockMaxBytes int64
	BlockMaxGas   int64
}

HashedParams is a subset of ConsensusParams. It is amino encoded and hashed into the Header.ConsensusHash.

type Header struct {
	// basic block info
	Version               version.Consensus `json:"version"`
	ChainID               string            `json:"chain_id"`
	Height                int64             `json:"height,string"`
	CoreChainLockedHeight uint32            `json:"core_chain_locked_height"`
	Time                  time.Time         `json:"time"`

	// prev block info
	LastBlockID BlockID `json:"last_block_id"`

	// hashes of block data
	LastCommitHash tmbytes.HexBytes `json:"last_commit_hash"` // commit from validators from the last block
	DataHash       tmbytes.HexBytes `json:"data_hash"`        // transactions

	// hashes from the app output from the prev block
	ValidatorsHash     tmbytes.HexBytes `json:"validators_hash"`      // validators for the current block
	NextValidatorsHash tmbytes.HexBytes `json:"next_validators_hash"` // validators for the next block
	ConsensusHash      tmbytes.HexBytes `json:"consensus_hash"`       // consensus params for current block
	NextConsensusHash  tmbytes.HexBytes `json:"next_consensus_hash"`  // consensus params for next block
	AppHash            tmbytes.HexBytes `json:"app_hash"`             // state after txs from current block
	// ResultsHash is  the root hash of all results from the txs from the current block
	// see `deterministicResponseDeliverTx` to understand which parts of a tx is hashed into here
	ResultsHash tmbytes.HexBytes `json:"results_hash"`

	// consensus info
	EvidenceHash      tmbytes.HexBytes `json:"evidence_hash"`        // evidence included in the block
	ProposerProTxHash ProTxHash        `json:"proposer_pro_tx_hash"` // original proposer of the block

	ProposedAppVersion uint64 `json:"proposed_protocol_version"` // proposer's latest available app protocol version
}

Header defines the structure of a Tenderdash block header. NOTE: changes to the Header should be duplicated in: - header.Hash() - abci.Header - https://github.com/dashpay/tenderdash/blob/master/spec/core/data_structures.md

func HeaderFromProto

func HeaderFromProto(ph *tmproto.Header) (Header, error)

FromProto sets a protobuf Header to the given pointer. It returns an error if the header is invalid.

func (*Header) Hash

func (h *Header) Hash() tmbytes.HexBytes

Hash returns the hash of the header. It computes a Merkle tree from the header fields ordered as they appear in the Header. Returns nil if ValidatorHash is missing, since a Header is not valid unless there is a ValidatorsHash (corresponding to the validator set).

func (Header) IsTimely

func (h Header) IsTimely(recvTime time.Time, sp SynchronyParams, round int32) bool

IsTimely defines whether the the proposal time is correct, as per PBTS spec. NOTE: By definition, at initial height, recvTime MUST be genesis time.

func (*Header) Populate

func (h *Header) Populate(
	version version.Consensus, chainID string,
	timestamp time.Time, lastBlockID BlockID,
	valHash, nextValHash []byte,
	consensusHash, nextConsensusHash []byte,
	appHash, resultsHash []byte,
	proposerProTxHash ProTxHash,
	proposedAppVersion uint64,
)

Populate the Header with state-derived data. Call this after MakeBlock to complete the Header.

func (*Header) StateID

func (h *Header) StateID() tmproto.StateID

StateID returns a state ID of this block

func (*Header) StringIndented

func (h *Header) StringIndented(indent string) string

StringIndented returns an indented string representation of the header.

func (*Header) ToProto

func (h *Header) ToProto() *tmproto.Header

ToProto converts Header to protobuf

func (Header) ValidateBasic

func (h Header) ValidateBasic() error

ValidateBasic performs stateless validation on a Header returning an error if any validation fails.

NOTE: Timestamp validation is subtle and handled elsewhere.

type LightBlock

type LightBlock struct {
	*SignedHeader `json:"signed_header"`
	ValidatorSet  *ValidatorSet `json:"validator_set"`
}

LightBlock is a SignedHeader and a ValidatorSet. It is the basis of the light client

func LightBlockFromProto

func LightBlockFromProto(pb *tmproto.LightBlock) (*LightBlock, error)

LightBlockFromProto converts from protobuf back into the Lightblock. An error is returned if either the validator set or signed header are invalid

func (LightBlock) StateID

func (lb LightBlock) StateID() tmproto.StateID

StateID() returns StateID for a given light block

func (LightBlock) String

func (lb LightBlock) String() string

String returns a string representation of the LightBlock

func (LightBlock) StringIndented

func (lb LightBlock) StringIndented(indent string) string

StringIndented returns an indented string representation of the LightBlock

SignedHeader ValidatorSet

func (*LightBlock) ToProto

func (lb *LightBlock) ToProto() (*tmproto.LightBlock, error)

ToProto converts the LightBlock to protobuf

func (LightBlock) ValidateBasic

func (lb LightBlock) ValidateBasic(chainID string) error

ValidateBasic checks that the data is correct and consistent

This does no verification of the signatures

type LightClientInfo

type LightClientInfo struct {
	PrimaryID         string          `json:"primaryID"`
	WitnessesID       []string        `json:"witnessesID"`
	NumPeers          int             `json:"number_of_peers,string"`
	LastTrustedHeight int64           `json:"last_trusted_height,string"`
	LastTrustedHash   tbytes.HexBytes `json:"last_trusted_hash"`
	LatestBlockTime   time.Time       `json:"latest_block_time"`
	TrustingPeriod    string          `json:"trusting_period"`
	// Boolean that reflects whether LatestBlockTime + trusting period is before
	// time.Now() (time when /status is called)
	TrustedBlockExpired bool `json:"trusted_block_expired"`
}

Info about the status of the light client

type MockPV

type MockPV struct {
	PrivateKeys map[string]crypto.QuorumKeys
	// heightString -> quorumHash
	UpdateHeights map[string]crypto.QuorumHash
	// quorumHash -> heightString
	FirstHeightOfQuorums map[string]string
	ProTxHash            crypto.ProTxHash
	// contains filtered or unexported fields
}

MockPV implements PrivValidator without any safety or persistence. Only use it for testing.

func NewMockPV

func NewMockPV(opts ...func(pv *MockPV)) *MockPV

func NewMockPVForQuorum

func NewMockPVForQuorum(quorumHash crypto.QuorumHash) *MockPV

func NewMockPVWithParams

func NewMockPVWithParams(
	privKey crypto.PrivKey,
	proTxHash crypto.ProTxHash,
	quorumHash crypto.QuorumHash,
	thresholdPublicKey crypto.PubKey,
	breakProposalSigning bool,
	breakVoteSigning bool,
) *MockPV

NewMockPVWithParams allows one to create a MockPV instance, but with finer grained control over the operation of the mock validator. This is useful for mocking test failures.

func (*MockPV) DisableChecks

func (pv *MockPV) DisableChecks()

XXX: Implement.

func (*MockPV) ExtractIntoValidator

func (pv *MockPV) ExtractIntoValidator(ctx context.Context, quorumHash crypto.QuorumHash) *Validator

func (*MockPV) GetFirstQuorumHash

func (pv *MockPV) GetFirstQuorumHash(ctx context.Context) (crypto.QuorumHash, error)

func (*MockPV) GetHeight

func (pv *MockPV) GetHeight(ctx context.Context, quorumHash crypto.QuorumHash) (int64, error)

GetHeight ...

func (*MockPV) GetPrivateKey

func (pv *MockPV) GetPrivateKey(ctx context.Context, quorumHash crypto.QuorumHash) (crypto.PrivKey, error)

GetPrivateKey ...

func (*MockPV) GetProTxHash

func (pv *MockPV) GetProTxHash(ctx context.Context) (crypto.ProTxHash, error)

GetProTxHash implements PrivValidator.

func (*MockPV) GetPubKey

func (pv *MockPV) GetPubKey(ctx context.Context, quorumHash crypto.QuorumHash) (crypto.PubKey, error)

GetPubKey implements PrivValidator.

func (*MockPV) GetThresholdPublicKey

func (pv *MockPV) GetThresholdPublicKey(ctx context.Context, quorumHash crypto.QuorumHash) (crypto.PubKey, error)

GetThresholdPublicKey ...

func (*MockPV) SignProposal

func (pv *MockPV) SignProposal(
	ctx context.Context,
	chainID string,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
	proposal *tmproto.Proposal,
) (tmbytes.HexBytes, error)

SignProposal Implements PrivValidator.

func (*MockPV) SignVote

func (pv *MockPV) SignVote(
	ctx context.Context,
	chainID string,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
	vote *tmproto.Vote,
	logger log.Logger) error

SignVote implements PrivValidator.

func (*MockPV) String

func (pv *MockPV) String() string

String returns a string representation of the MockPV.

func (*MockPV) ThresholdPublicKeyForQuorumHash

func (pv *MockPV) ThresholdPublicKeyForQuorumHash(ctx context.Context, quorumHash crypto.QuorumHash) (crypto.PubKey, error)

ThresholdPublicKeyForQuorumHash ...

func (*MockPV) UpdatePrivateKey

func (pv *MockPV) UpdatePrivateKey(
	ctx context.Context,
	privateKey crypto.PrivKey,
	quorumHash crypto.QuorumHash,
	thresholdPublicKey crypto.PubKey,
	height int64,
)

type MockPrivValidatorsByProTxHash

type MockPrivValidatorsByProTxHash []*MockPV

func (MockPrivValidatorsByProTxHash) Len

func (MockPrivValidatorsByProTxHash) Less

func (pvs MockPrivValidatorsByProTxHash) Less(i, j int) bool

func (MockPrivValidatorsByProTxHash) Swap

func (pvs MockPrivValidatorsByProTxHash) Swap(i, j int)

type NetAddress

type NetAddress struct {
	ID   NodeID `json:"id"`
	IP   net.IP `json:"ip"`
	Port uint16 `json:"port"`
}

NetAddress defines information about a peer on the network including its ID, IP address, and port.

func NewNetAddress

func NewNetAddress(id NodeID, addr net.Addr) *NetAddress

NewNetAddress returns a new NetAddress using the provided TCP address. When testing, other net.Addr (except TCP) will result in using 0.0.0.0:0. When normal run, other net.Addr (except TCP) will panic. Panics if ID is invalid. TODO: socks proxies?

func NewNetAddressIPPort

func NewNetAddressIPPort(ip net.IP, port uint16) *NetAddress

NewNetAddressIPPort returns a new NetAddress using the provided IP and port number.

func ParseAddressString

func ParseAddressString(addr string) (*NetAddress, error)

ParseAddressString reads an address string, and returns the NetAddress struct with ip address, port and nodeID information, returning an error for any validation errors.

func (*NetAddress) Dial

func (na *NetAddress) Dial() (net.Conn, error)

Dial calls net.Dial on the address.

func (*NetAddress) DialString

func (na *NetAddress) DialString() string

func (*NetAddress) DialTimeout

func (na *NetAddress) DialTimeout(timeout time.Duration) (net.Conn, error)

DialTimeout calls net.DialTimeout on the address.

func (*NetAddress) Equals

func (na *NetAddress) Equals(other interface{}) bool

Equals reports whether na and other are the same addresses, including their ID, IP, and Port.

func (*NetAddress) Local

func (na *NetAddress) Local() bool

Local returns true if it is a local address.

func (*NetAddress) OnionCatTor

func (na *NetAddress) OnionCatTor() bool

func (*NetAddress) RFC1918

func (na *NetAddress) RFC1918() bool

func (*NetAddress) RFC3849

func (na *NetAddress) RFC3849() bool

func (*NetAddress) RFC3927

func (na *NetAddress) RFC3927() bool

func (*NetAddress) RFC3964

func (na *NetAddress) RFC3964() bool

func (*NetAddress) RFC4193

func (na *NetAddress) RFC4193() bool

func (*NetAddress) RFC4380

func (na *NetAddress) RFC4380() bool

func (*NetAddress) RFC4843

func (na *NetAddress) RFC4843() bool

func (*NetAddress) RFC4862

func (na *NetAddress) RFC4862() bool

func (*NetAddress) RFC6052

func (na *NetAddress) RFC6052() bool

func (*NetAddress) RFC6145

func (na *NetAddress) RFC6145() bool

func (*NetAddress) ReachabilityTo

func (na *NetAddress) ReachabilityTo(o *NetAddress) int

ReachabilityTo checks whenever o can be reached from na.

func (*NetAddress) Routable

func (na *NetAddress) Routable() bool

Routable returns true if the address is routable.

func (*NetAddress) Same

func (na *NetAddress) Same(other interface{}) bool

Same returns true is na has the same non-empty ID or DialString as other.

func (*NetAddress) String

func (na *NetAddress) String() string

String representation: <ID>@<IP>:<PORT>

func (*NetAddress) Valid

func (na *NetAddress) Valid() error

For IPv4 these are either a 0 or all bits set address. For IPv6 a zero address or one that matches the RFC3849 documentation address format.

type NodeID

type NodeID string

NodeID is a hex-encoded crypto.Address. It must be lowercased (for uniqueness) and of length 2*NodeIDByteLength.

func NewNodeID

func NewNodeID(nodeID string) (NodeID, error)

NewNodeID returns a lowercased (normalized) NodeID, or errors if the node ID is invalid.

func NodeIDFromPubKey

func NodeIDFromPubKey(pubKey crypto.PubKey) NodeID

NodeIDFromPubKey creates a node ID from a given PubKey address.

func (NodeID) AddressString

func (id NodeID) AddressString(protocolHostPort string) string

IDAddressString returns id@hostPort. It strips the leading protocol from protocolHostPort if it exists.

func (NodeID) Bytes

func (id NodeID) Bytes() ([]byte, error)

Bytes converts the node ID to its binary byte representation.

func (NodeID) Validate

func (id NodeID) Validate() error

Validate validates the NodeID.

type NodeInfo

type NodeInfo struct {
	ProtocolVersion ProtocolVersion `json:"protocol_version"`

	// Authenticate
	NodeID     NodeID `json:"id"`          // authenticated identifier
	ListenAddr string `json:"listen_addr"` // accepting incoming

	// Node Type
	ProTxHash crypto.ProTxHash

	// Check compatibility.
	// Channels are HexBytes so easier to read as JSON
	Network string `json:"network"` // network/chain ID
	Version string `json:"version"` // major.minor.revision
	// FIXME: This should be changed to uint16 to be consistent with the updated channel type
	Channels tmbytes.HexBytes `json:"channels"` // channels this node knows about

	// ASCIIText fields
	Moniker string        `json:"moniker"` // arbitrary moniker
	Other   NodeInfoOther `json:"other"`   // other application specific data
}

NodeInfo is the basic node information exchanged between two peers during the Tendermint P2P handshake.

func NodeInfoFromProto

func NodeInfoFromProto(pb *tmp2p.NodeInfo) (NodeInfo, error)

func (*NodeInfo) AddChannel

func (info *NodeInfo) AddChannel(channel uint16)

AddChannel is used by the router when a channel is opened to add it to the node info

func (NodeInfo) CompatibleWith

func (info NodeInfo) CompatibleWith(other NodeInfo) error

CompatibleWith checks if two NodeInfo are compatible with each other. CONTRACT: two nodes are compatible if the Block version and network match and they have at least one channel in common.

func (NodeInfo) Copy

func (info NodeInfo) Copy() NodeInfo

func (NodeInfo) GetProTxHash

func (info NodeInfo) GetProTxHash() crypto.ProTxHash

func (NodeInfo) ID

func (info NodeInfo) ID() NodeID

ID returns the node's peer ID.

func (NodeInfo) ToProto

func (info NodeInfo) ToProto() *tmp2p.NodeInfo

func (NodeInfo) Validate

func (info NodeInfo) Validate() error

Validate checks the self-reported DefaultNodeInfo is safe. It returns an error if there are too many Channels, if there are any duplicate Channels, if the ListenAddr is malformed, or if the ListenAddr is a host name that can not be resolved to some IP. TODO: constraints for Moniker/Other? Or is that for the UI ? JAE: It needs to be done on the client, but to prevent ambiguous unicode characters, maybe it's worth sanitizing it here. In the future we might want to validate these, once we have a name-resolution system up. International clients could then use punycode (or we could use url-encoding), and we just need to be careful with how we handle that in our clients. (e.g. off by default).

type NodeInfoOther

type NodeInfoOther struct {
	TxIndex    string `json:"tx_index"`
	RPCAddress string `json:"rpc_address"`
}

NodeInfoOther is the misc. applcation specific data

type NodeKey

type NodeKey struct {
	// Canonical ID - hex-encoded pubkey's address (IDByteLength bytes)
	ID NodeID
	// Private key
	PrivKey crypto.PrivKey
}

NodeKey is the persistent peer key. It contains the nodes private key for authentication.

func GenNodeKey

func GenNodeKey() NodeKey

GenNodeKey generates a new node key.

func LoadNodeKey

func LoadNodeKey(filePath string) (NodeKey, error)

LoadNodeKey loads NodeKey located in filePath.

func LoadOrGenNodeKey

func LoadOrGenNodeKey(filePath string) (NodeKey, error)

LoadOrGenNodeKey attempts to load the NodeKey from the given filePath. If the file does not exist, it generates and saves a new NodeKey.

func (NodeKey) MarshalJSON

func (nk NodeKey) MarshalJSON() ([]byte, error)

func (NodeKey) PubKey

func (nk NodeKey) PubKey() crypto.PubKey

PubKey returns the peer's PubKey

func (NodeKey) SaveAs

func (nk NodeKey) SaveAs(filePath string) error

SaveAs persists the NodeKey to filePath.

func (*NodeKey) UnmarshalJSON

func (nk *NodeKey) UnmarshalJSON(data []byte) error

type Part

type Part struct {
	Index uint32           `json:"index"`
	Bytes tmbytes.HexBytes `json:"bytes"`
	Proof merkle.Proof     `json:"proof"`
}

func PartFromProto

func PartFromProto(pb *tmproto.Part) (*Part, error)

func (*Part) MarshalZerologObject

func (part *Part) MarshalZerologObject(e *zerolog.Event)

func (*Part) String

func (part *Part) String() string

String returns a string representation of Part.

See StringIndented.

func (*Part) StringIndented

func (part *Part) StringIndented(indent string) string

StringIndented returns an indented Part.

See merkle.Proof#StringIndented

func (*Part) ToProto

func (part *Part) ToProto() (*tmproto.Part, error)

func (*Part) ValidateBasic

func (part *Part) ValidateBasic() error

ValidateBasic performs basic validation.

type PartSet

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

func NewPartSetFromData

func NewPartSetFromData(data []byte, partSize uint32) *PartSet

Returns an immutable, full PartSet from the data bytes. The data bytes are split into "partSize" chunks, and merkle tree computed. CONTRACT: partSize is greater than zero.

func NewPartSetFromHeader

func NewPartSetFromHeader(header PartSetHeader) *PartSet

Returns an empty PartSet ready to be populated.

func (*PartSet) AddPart

func (ps *PartSet) AddPart(part *Part) (bool, error)

func (*PartSet) BitArray

func (ps *PartSet) BitArray() *bits.BitArray

func (*PartSet) ByteSize

func (ps *PartSet) ByteSize() int64

func (*PartSet) Count

func (ps *PartSet) Count() uint32

func (*PartSet) GetPart

func (ps *PartSet) GetPart(index int) *Part

func (*PartSet) GetReader

func (ps *PartSet) GetReader() io.Reader

func (*PartSet) HasHeader

func (ps *PartSet) HasHeader(header PartSetHeader) bool

func (*PartSet) Hash

func (ps *PartSet) Hash() []byte

func (*PartSet) HashesTo

func (ps *PartSet) HashesTo(hash []byte) bool

func (*PartSet) Header

func (ps *PartSet) Header() PartSetHeader

func (*PartSet) IsComplete

func (ps *PartSet) IsComplete() bool

func (*PartSet) MarshalJSON

func (ps *PartSet) MarshalJSON() ([]byte, error)

func (*PartSet) StringShort

func (ps *PartSet) StringShort() string

StringShort returns a short version of String.

(Count of Total)

func (*PartSet) Total

func (ps *PartSet) Total() uint32

type PartSetHeader

type PartSetHeader struct {
	Total uint32           `json:"total"`
	Hash  tmbytes.HexBytes `json:"hash"`
}

func PartSetHeaderFromProto

func PartSetHeaderFromProto(ppsh *tmproto.PartSetHeader) (*PartSetHeader, error)

FromProto sets a protobuf PartSetHeader to the given pointer

func (PartSetHeader) Equals

func (psh PartSetHeader) Equals(other PartSetHeader) bool

func (PartSetHeader) IsZero

func (psh PartSetHeader) IsZero() bool

func (PartSetHeader) String

func (psh PartSetHeader) String() string

String returns a string representation of PartSetHeader.

1. total number of parts 2. first 6 bytes of the hash

func (*PartSetHeader) ToProto

func (psh *PartSetHeader) ToProto() tmproto.PartSetHeader

ToProto converts PartSetHeader to protobuf

func (PartSetHeader) ValidateBasic

func (psh PartSetHeader) ValidateBasic() error

ValidateBasic performs basic validation.

type PartSetReader

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

func NewPartSetReader

func NewPartSetReader(parts []*Part) *PartSetReader

func (*PartSetReader) Read

func (psr *PartSetReader) Read(p []byte) (n int, err error)

type PrivValidator

type PrivValidator interface {
	GetPubKey(ctx context.Context, quorumHash crypto.QuorumHash) (crypto.PubKey, error)
	UpdatePrivateKey(
		ctx context.Context,
		privateKey crypto.PrivKey,
		quorumHash crypto.QuorumHash,
		thresholdPublicKey crypto.PubKey,
		height int64,
	)

	GetProTxHash(context.Context) (crypto.ProTxHash, error)
	GetFirstQuorumHash(context.Context) (crypto.QuorumHash, error)
	GetPrivateKey(ctx context.Context, quorumHash crypto.QuorumHash) (crypto.PrivKey, error)
	GetThresholdPublicKey(ctx context.Context, quorumHash crypto.QuorumHash) (crypto.PubKey, error)
	GetHeight(ctx context.Context, quorumHash crypto.QuorumHash) (int64, error)

	SignVote(
		ctx context.Context, chainID string, quorumType btcjson.LLMQType, quorumHash crypto.QuorumHash,
		vote *tmproto.Vote, logger log.Logger) error
	SignProposal(
		ctx context.Context, chainID string, quorumType btcjson.LLMQType, quorumHash crypto.QuorumHash,
		proposal *tmproto.Proposal) (tmbytes.HexBytes, error)

	ExtractIntoValidator(ctx context.Context, quorumHash crypto.QuorumHash) *Validator
}

PrivValidator defines the functionality of a local Tendermint validator that signs votes and proposals, and never double signs.

type PrivValidatorType

type PrivValidatorType uint8

PrivValidatorType defines the implementation types.

type PrivValidatorsByProTxHash

type PrivValidatorsByProTxHash []PrivValidator

func (PrivValidatorsByProTxHash) Len

func (pvs PrivValidatorsByProTxHash) Len() int

func (PrivValidatorsByProTxHash) Less

func (pvs PrivValidatorsByProTxHash) Less(i, j int) bool

func (PrivValidatorsByProTxHash) Swap

func (pvs PrivValidatorsByProTxHash) Swap(i, j int)

type ProTxHash

type ProTxHash = crypto.ProTxHash

type Proposal

type Proposal struct {
	Type      tmproto.SignedMsgType
	Height    int64     `json:"height,string"`
	Round     int32     `json:"round"`     // there can not be greater than 2_147_483_647 rounds
	POLRound  int32     `json:"pol_round"` // -1 if null.
	BlockID   BlockID   `json:"block_id"`
	Timestamp time.Time `json:"timestamp"`
	Signature []byte    `json:"signature"`

	// dash fields
	CoreChainLockedHeight uint32 `json:"core_height"`
	CoreChainLockUpdate   *CoreChainLock
}

Proposal defines a block proposal for the consensus. It refers to the block by BlockID field. It must be signed by the correct proposer for the given Height/Round to be considered valid. It may depend on votes from a previous round, a so-called Proof-of-Lock (POL) round, as noted in the POLRound. If POLRound >= 0, then BlockID corresponds to the block that is locked in POLRound.

func NewProposal

func NewProposal(height int64, coreChainLockedHeight uint32, round int32, polRound int32, blockID BlockID, ts time.Time) *Proposal

NewProposal returns a new Proposal. If there is no POLRound, polRound should be -1.

func ProposalFromProto

func ProposalFromProto(pp *tmproto.Proposal) (*Proposal, error)

FromProto sets a protobuf Proposal to the given pointer. It returns an error if the proposal is invalid.

func (*Proposal) IsTimely

func (p *Proposal) IsTimely(recvTime time.Time, sp SynchronyParams, round int32) bool

IsTimely validates that the block timestamp is 'timely' according to the proposer-based timestamp algorithm. To evaluate if a block is timely, its timestamp is compared to the local time of the validator along with the configured Precision and MsgDelay parameters. Specifically, a proposed block timestamp is considered timely if it is satisfies the following inequalities:

localtime >= proposedBlockTime - Precision localtime <= proposedBlockTime + MsgDelay + Precision

For more information on the meaning of 'timely', see the proposer-based timestamp specification: https://github.com/dashpay/tenderdash/tree/master/spec/consensus/proposer-based-timestamp

NOTE: by definition, at initial height, recvTime MUST be genesis time.

func (*Proposal) MarshalZerologObject

func (p *Proposal) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog.LogObjectMarshaler

func (*Proposal) SetCoreChainLockUpdate

func (p *Proposal) SetCoreChainLockUpdate(coreChainLock *CoreChainLock)

SetCoreChainLockUpdate sets CoreChainLock to Proposal.CoreChainLockUpdate field

func (*Proposal) String

func (p *Proposal) String() string

String returns a string representation of the Proposal.

1. height 2. round 3. block ID 4. POL round 5. first 6 bytes of signature 6. timestamp

See BlockID#String.

func (*Proposal) ToProto

func (p *Proposal) ToProto() *tmproto.Proposal

ToProto converts Proposal to protobuf

func (*Proposal) ValidateBasic

func (p *Proposal) ValidateBasic() error

ValidateBasic performs basic validation.

type ProtocolVersion

type ProtocolVersion struct {
	P2P   uint64 `json:"p2p,string"`
	Block uint64 `json:"block,string"`
	App   uint64 `json:"app,string"`
}

ProtocolVersion contains the protocol versions for the software.

type QuorumSignData

type QuorumSignData struct {
	Block      SignItem
	Extensions map[types.VoteExtensionType][]SignItem
}

QuorumSignData holds data which is necessary for signing and verification block, state, and each vote-extension in a list

func MakeQuorumSigns

func MakeQuorumSigns(
	chainID string,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
	protoVote *types.Vote,
) (QuorumSignData, error)

MakeQuorumSigns builds signing data for block, state and vote-extensions each a sign-id item consist of request-id, raw data, hash of raw and id

func MakeQuorumSignsWithVoteSet

func MakeQuorumSignsWithVoteSet(voteSet *VoteSet, vote *types.Vote) (QuorumSignData, error)

MakeQuorumSignsWithVoteSet creates and returns QuorumSignData struct built with a vote-set and an added vote

func (QuorumSignData) Verify

func (q QuorumSignData) Verify(pubKey crypto.PubKey, signs QuorumSigns) error

Verify verifies a quorum signatures: block, state and vote-extensions

type QuorumSigns

type QuorumSigns struct {
	BlockSign      []byte
	ExtensionSigns []ThresholdExtensionSign
}

QuorumSigns holds all created signatures, block, state and for each recovered vote-extensions

func NewQuorumSignsFromCommit

func NewQuorumSignsFromCommit(commit *Commit) QuorumSigns

NewQuorumSignsFromCommit creates and returns QuorumSigns using threshold signatures from a commit

type QuorumSingsVerifier

type QuorumSingsVerifier struct {
	QuorumSignData
	// contains filtered or unexported fields
}

QuorumSingsVerifier ...

func NewQuorumSignsVerifier

func NewQuorumSignsVerifier(quorumData QuorumSignData, opts ...func(*QuorumSingsVerifier)) *QuorumSingsVerifier

NewQuorumSignsVerifier creates and returns an instance of QuorumSingsVerifier that is used for verification quorum signatures

func (*QuorumSingsVerifier) Verify

func (q *QuorumSingsVerifier) Verify(pubKey crypto.PubKey, signs QuorumSigns) error

Verify verifies quorum data using public key and passed signatures

type SignItem

type SignItem struct {
	ReqID []byte // Request ID for quorum signing
	ID    []byte // Signature ID
	Raw   []byte // Raw data to be signed
	Hash  []byte // Checksum of Raw
}

SignItem represents quorum sign data, like a request id, message bytes, sha256 hash of message and signID

func MakeBlockSignItem

func MakeBlockSignItem(chainID string, vote *types.Vote, quorumType btcjson.LLMQType, quorumHash []byte) SignItem

MakeBlockSignItem creates SignItem struct for a block

func NewSignItem

func NewSignItem(quorumType btcjson.LLMQType, quorumHash, reqID, raw []byte) SignItem

NewSignItem creates a new instance of SignItem with calculating a hash for a raw and creating signID

func (SignItem) MarshalZerologObject

func (i SignItem) MarshalZerologObject(e *zerolog.Event)

func (*SignItem) Validate

func (i *SignItem) Validate() error

Validate validates prepared data for signing

type SignedHeader

type SignedHeader struct {
	*Header `json:"header"`

	Commit *Commit `json:"commit"`
}

SignedHeader is a header along with the commits that prove it.

func SignedHeaderFromProto

func SignedHeaderFromProto(shp *tmproto.SignedHeader) (*SignedHeader, error)

SignedHeaderFromProto sets a protobuf SignedHeader to the given pointer. It returns an error if the header or the commit is invalid.

func (SignedHeader) String

func (sh SignedHeader) String() string

String returns a string representation of SignedHeader.

func (SignedHeader) StringIndented

func (sh SignedHeader) StringIndented(indent string) string

StringIndented returns an indented string representation of SignedHeader.

Header Commit

func (*SignedHeader) ToProto

func (sh *SignedHeader) ToProto() *tmproto.SignedHeader

ToProto converts SignedHeader to protobuf

func (SignedHeader) ValidateBasic

func (sh SignedHeader) ValidateBasic(chainID string) error

ValidateBasic does basic consistency checks and makes sure the header and commit are consistent.

NOTE: This does not actually check the cryptographic signatures. Make sure to use a Verifier to validate the signatures actually provide a significantly strong proof for this header's validity.

type SignsRecoverer

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

SignsRecoverer is used to recover threshold block, state, and vote-extension signatures it's possible to avoid recovering state and vote-extension for specific case

func NewSignsRecoverer

func NewSignsRecoverer(votes []*Vote, opts ...func(*SignsRecoverer)) *SignsRecoverer

NewSignsRecoverer creates and returns a new instance of SignsRecoverer the state fills with signatures from the votes

func (*SignsRecoverer) Recover

func (v *SignsRecoverer) Recover() (*QuorumSigns, error)

Recover recovers threshold signatures for block, state and vote-extensions

type SynchronyParams

type SynchronyParams struct {
	Precision    time.Duration `json:"precision,string"`
	MessageDelay time.Duration `json:"message_delay,string"`
}

SynchronyParams influence the validity of block timestamps. For more information on the relationship of the synchrony parameters to block validity, see the Proposer-Based Timestamps specification: https://github.com/tendermint/tendermint/blob/master/spec/consensus/proposer-based-timestamp/README.md

func DefaultSynchronyParams

func DefaultSynchronyParams() SynchronyParams

func (SynchronyParams) SynchronyParamsOrDefaults

func (s SynchronyParams) SynchronyParamsOrDefaults() SynchronyParams

SynchronyParamsOrDefaults returns the SynchronyParams, filling in any zero values with the Tendermint defined default values.

type ThresholdExtensionSign

type ThresholdExtensionSign struct {
	Extension          []byte
	ThresholdSignature []byte
}

ThresholdExtensionSign is used for keeping extension and recovered threshold signature

func MakeThresholdExtensionSigns

func MakeThresholdExtensionSigns(voteExtensions VoteExtensions) []ThresholdExtensionSign

MakeThresholdExtensionSigns creates and returns the list of ThresholdExtensionSign for given VoteExtensions container

func MakeThresholdVoteExtensions

func MakeThresholdVoteExtensions(extensions []VoteExtension, thresholdSigs [][]byte) []ThresholdExtensionSign

MakeThresholdVoteExtensions creates a list of ThresholdExtensionSign from the list of VoteExtension and recovered threshold signatures. The lengths of vote-extensions and threshold signatures must be the same

func ThresholdExtensionSignFromProto

func ThresholdExtensionSignFromProto(protoExtensions []*tmproto.VoteExtension) []ThresholdExtensionSign

ThresholdExtensionSignFromProto transforms a list of protobuf ThresholdVoteExtension into the list of domain ThresholdExtensionSign

type TimeoutParams

type TimeoutParams struct {
	Propose             time.Duration `json:"propose,string"`
	ProposeDelta        time.Duration `json:"propose_delta,string"`
	Vote                time.Duration `json:"vote,string"`
	VoteDelta           time.Duration `json:"vote_delta,string"`
	Commit              time.Duration `json:"commit,string"`
	BypassCommitTimeout bool          `json:"bypass_commit_timeout"`
}

TimeoutParams configure the timings of the steps of the Tendermint consensus algorithm.

func DefaultTimeoutParams

func DefaultTimeoutParams() TimeoutParams

func (TimeoutParams) CommitTime

func (t TimeoutParams) CommitTime(ti time.Time) time.Time

CommitTime accepts ti, the time at which the consensus engine received +2/3 precommits for a block and returns the point in time at which the consensus engine should begin consensus on the next block.

func (TimeoutParams) ProposeTimeout

func (t TimeoutParams) ProposeTimeout(round int32) time.Duration

ProposeTimeout returns the amount of time to wait for a proposal.

func (TimeoutParams) TimeoutParamsOrDefaults

func (t TimeoutParams) TimeoutParamsOrDefaults() TimeoutParams

TimeoutParamsOrDefaults returns the SynchronyParams, filling in any zero values with the Tendermint defined default values.

func (TimeoutParams) VoteTimeout

func (t TimeoutParams) VoteTimeout(round int32) time.Duration

VoteTimeout returns the amount of time to wait for remaining votes after receiving any +2/3 votes.

type Tx

type Tx []byte

Tx is an arbitrary byte array. NOTE: Tx has no types at this level, so when wire encoded it's just length-prefixed. Might we want types here ?

func (Tx) Hash

func (tx Tx) Hash() tmbytes.HexBytes

Hash computes the TMHASH hash of the wire encoded transaction.

func (Tx) Key

func (tx Tx) Key() TxKey

Key produces a fixed-length key for use in indexing.

func (Tx) String

func (tx Tx) String() string

String returns the hex-encoded transaction as a string.

type TxEventPublisher

type TxEventPublisher interface {
	PublishEventTx(EventDataTx) error
}

type TxKey

type TxKey [sha256.Size]byte

TxKey is the fixed length array key used as an index.

type TxProof

type TxProof struct {
	RootHash tmbytes.HexBytes `json:"root_hash"`
	Data     Tx               `json:"data"`
	Proof    merkle.Proof     `json:"proof"`
}

TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree.

func TxProofFromProto

func TxProofFromProto(pb tmproto.TxProof) (TxProof, error)

func (TxProof) Leaf

func (tp TxProof) Leaf() []byte

Leaf returns the hash(tx), which is the leaf in the merkle tree which this proof refers to.

func (TxProof) ToProto

func (tp TxProof) ToProto() tmproto.TxProof

func (TxProof) Validate

func (tp TxProof) Validate(dataHash []byte) error

Validate verifies the proof. It returns nil if the RootHash matches the dataHash argument, and if the proof is internally consistent. Otherwise, it returns a sensible error.

type TxRecordSet

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

TxRecordSet contains indexes into an underlying set of transactions. These indexes are useful for validating and working with a list of TxRecords from the PrepareProposal response.

Only one copy of the original data is referenced by all of the indexes but a transaction may appear in multiple indexes.

func NewTxRecordSet

func NewTxRecordSet(trs []*abci.TxRecord) TxRecordSet

NewTxRecordSet constructs a new set from the given transaction records. The contents of the input transactions are shared by the set, and must not be modified during the lifetime of the set.

func (TxRecordSet) IncludedTxs

func (t TxRecordSet) IncludedTxs() []Tx

IncludedTxs returns the transactions marked for inclusion in a block. This list maintains the order that the transactions were included in the list of TxRecords that were used to construct the TxRecordSet.

func (TxRecordSet) RemovedTxs

func (t TxRecordSet) RemovedTxs() []Tx

RemovedTxs returns the transactions marked for removal by the application.

func (TxRecordSet) Validate

func (t TxRecordSet) Validate(maxSizeBytes int64, otxs Txs) error

Validate checks that the record set was correctly constructed from the original list of transactions.

type Txs

type Txs []Tx

Txs is a slice of Tx.

func NewTxs

func NewTxs(in [][]byte) Txs

NewTxs creates new transactions object based on raw transactions

func (Txs) Hash

func (txs Txs) Hash() []byte

Hash returns the Merkle root hash of the transaction hashes. i.e. the leaves of the tree are the hashes of the txs.

func (Txs) Index

func (txs Txs) Index(tx Tx) int

Index returns the index of this transaction in the list, or -1 if not found

func (Txs) IndexByHash

func (txs Txs) IndexByHash(hash []byte) int

IndexByHash returns the index of this transaction hash in the list, or -1 if not found

func (Txs) Len

func (txs Txs) Len() int

Txs is a slice of transactions. Sorting a Txs value orders the transactions lexicographically.

func (Txs) Less

func (txs Txs) Less(i, j int) bool

func (Txs) Proof

func (txs Txs) Proof(i int) TxProof

func (Txs) Swap

func (txs Txs) Swap(i, j int)

func (Txs) ToSliceOfBytes

func (txs Txs) ToSliceOfBytes() [][]byte

ToSliceOfBytes converts a Txs to slice of byte slices.

type ValSetOptionFunc

type ValSetOptionFunc func(opt *ValSetOptions)

ValSetOptionFunc is a type of validator-set function to manage options of generator

type ValSetOptions

type ValSetOptions struct {
	PrivValsMap      map[string]PrivValidator
	PrivValsAtHeight int64
}

ValSetOptions is the options for generation of validator set and private validators

type ValSetParam

type ValSetParam struct {
	ProTxHash   ProTxHash
	VotingPower int64
}

ValSetParam is a structure of parameters to make a validator set

func NewValSetParam

func NewValSetParam(proTxHashes []crypto.ProTxHash) []ValSetParam

NewValSetParam returns a list of validator set parameters with for every proTxHashes with default voting power

type Validator

type Validator struct {
	ProTxHash   ProTxHash
	PubKey      crypto.PubKey
	VotingPower int64
	NodeAddress ValidatorAddress

	ProposerPriority int64
}

Validator Volatile state for each Validator NOTE: The ProposerPriority is not included in Validator.Hash(); make sure to update that method if changes are made here The ProTxHash is part of Dash additions required for BLS threshold signatures

func NewTestRemoveValidatorGeneratedFromProTxHash

func NewTestRemoveValidatorGeneratedFromProTxHash(proTxHash crypto.ProTxHash) *Validator

func NewTestValidatorGeneratedFromProTxHash

func NewTestValidatorGeneratedFromProTxHash(proTxHash crypto.ProTxHash) *Validator

func NewValidator

func NewValidator(pubKey crypto.PubKey, votingPower int64, proTxHash ProTxHash, address string) *Validator

NewValidator returns a new validator with the given pubkey and voting power.

func NewValidatorDefaultVotingPower

func NewValidatorDefaultVotingPower(pubKey crypto.PubKey, proTxHash []byte) *Validator

func ValidatorFromProto

func ValidatorFromProto(vp *tmproto.Validator) (*Validator, error)

ValidatorFromProto sets a protobuf Validator to the given pointer. It returns an error if the public key is invalid.

func (*Validator) Bytes

func (v *Validator) Bytes() []byte

Bytes computes the unique encoding of a validator with a given voting power. These are the bytes that gets hashed in consensus. It excludes address as its redundant with the pubkey. This also excludes ProposerPriority which changes every round.

func (*Validator) CompareProposerPriority

func (v *Validator) CompareProposerPriority(other *Validator) *Validator

CompareProposerPriority Returns the one with higher ProposerPriority.

func (*Validator) Copy

func (v *Validator) Copy() *Validator

Copy creates a new copy of the validator so we can mutate ProposerPriority. Panics if the validator is nil.

func (Validator) MarshalJSON

func (v Validator) MarshalJSON() ([]byte, error)

func (*Validator) MarshalZerologObject

func (v *Validator) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog.LogObjectMarshaler

func (*Validator) ShortStringBasic

func (v *Validator) ShortStringBasic() string

func (*Validator) String

func (v *Validator) String() string

String returns a string representation of String.

1. address 2. public key 3. voting power 4. proposer priority 5. node address

func (*Validator) ToProto

func (v *Validator) ToProto() (*tmproto.Validator, error)

ToProto converts Validator to protobuf

func (*Validator) UnmarshalJSON

func (v *Validator) UnmarshalJSON(data []byte) error

func (*Validator) ValidateBasic

func (v *Validator) ValidateBasic() error

ValidateBasic performs basic validation.

func (*Validator) ValidatePubKey

func (v *Validator) ValidatePubKey() error

ValidatePubKey performs basic validation on the public key.

type ValidatorAddress

type ValidatorAddress struct {
	NodeID   NodeID
	Hostname string
	Port     uint16
}

ValidatorAddress is a ValidatorAddress that does not require node ID to be set We cannot just use p2p.ValidatorAddress because it causes dependency loop

func ParseValidatorAddress

func ParseValidatorAddress(address string) (ValidatorAddress, error)

ParseValidatorAddress parses provided address, which should be in `proto://nodeID@host:port` form. `proto://` and `nodeID@` parts are optional.

func RandValidatorAddress

func RandValidatorAddress() ValidatorAddress

RandValidatorAddress generates a random validator address. Used in tests. It will panic in (very unlikely) case of error.

func (ValidatorAddress) NetAddress

func (va ValidatorAddress) NetAddress() (*NetAddress, error)

NetAddress converts ValidatorAddress to a NetAddress object

func (ValidatorAddress) String

func (va ValidatorAddress) String() string

String formats the address as a URL string.

func (ValidatorAddress) Validate

func (va ValidatorAddress) Validate() error

Validate ensures the validator address is correct. It ignores missing node IDs.

func (ValidatorAddress) Zero

func (va ValidatorAddress) Zero() bool

Zero returns true if the ValidatorAddress is not initialized

type ValidatorInfo

type ValidatorInfo struct {
	ProTxHash ProTxHash `json:"pro_tx_hash"`
	Index     int32     `json:"index"`
}

type ValidatorParams

type ValidatorParams struct {
	PubKeyTypes []string `json:"pub_key_types"`
}

ValidatorParams restrict the public key types validators can use. NOTE: uses ABCI pubkey naming, not Amino names.

func DefaultValidatorParams

func DefaultValidatorParams() ValidatorParams

DefaultValidatorParams returns a default ValidatorParams, which allows only bls12381 pubkeys.

func (*ValidatorParams) IsValidPubkeyType

func (val *ValidatorParams) IsValidPubkeyType(pubkeyType string) bool

type ValidatorSet

type ValidatorSet struct {
	// NOTE: persisted via reflect, must be exported.
	Validators         []*Validator      `json:"validators"`
	Proposer           *Validator        `json:"proposer"`
	ThresholdPublicKey crypto.PubKey     `json:"threshold_public_key"`
	QuorumHash         crypto.QuorumHash `json:"quorum_hash"`
	QuorumType         btcjson.LLMQType  `json:"quorum_type"`
	HasPublicKeys      bool              `json:"has_public_keys"`
	// contains filtered or unexported fields
}

ValidatorSet represent a set of *Validator at a given height.

The validators can be fetched by address or index. The index is in order of .VotingPower, so the indices are fixed for all rounds of a given blockchain height - ie. the validators are sorted by their voting power (descending). Secondary index - .ProTxHash (ascending).

On the other hand, the .ProposerPriority of each validator and the designated .GetProposer() of a set changes every round, upon calling .IncrementProposerPriority().

NOTE: Not goroutine-safe. NOTE: All get/set to validators should copy the value for safety.

func NewEmptyValidatorSet

func NewEmptyValidatorSet() *ValidatorSet

NewEmptyValidatorSet initializes a ValidatorSet with no validators

func NewValidatorSet

func NewValidatorSet(valz []*Validator, newThresholdPublicKey crypto.PubKey, quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash, hasPublicKeys bool) *ValidatorSet

NewValidatorSet initializes a ValidatorSet by copying over the values from `valz`, a list of Validators. If valz is nil or empty, the new ValidatorSet will have an empty list of Validators.

The addresses of validators in `valz` must be unique otherwise the function panics.

Note the validator set size has an implied limit equal to that of the MaxVotesCount - commits by a validator set larger than this will fail validation.

func NewValidatorSetWithLocalNodeProTxHash

func NewValidatorSetWithLocalNodeProTxHash(
	valz []*Validator,
	newThresholdPublicKey crypto.PubKey,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
	localNodeProTxHash crypto.ProTxHash,
) *ValidatorSet

NewValidatorSetWithLocalNodeProTxHash initializes a ValidatorSet the same way as NewValidatorSet does, however it does allows to set the localNodeProTxHash to more easily identify if the validator set should have public keys. If the local node is part of the validator set the public keys must be present

func ValidatorSetFromExistingValidators

func ValidatorSetFromExistingValidators(
	valz []*Validator,
	thresholdPublicKey crypto.PubKey,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
) (*ValidatorSet, error)

ValidatorSetFromExistingValidators takes an existing array of validators and rebuilds the exact same validator set that corresponds to it without changing the proposer priority or power if any of the validators fail validate basic then an empty set is returned.

func ValidatorSetFromProto

func ValidatorSetFromProto(vp *tmproto.ValidatorSet) (*ValidatorSet, error)

ValidatorSetFromProto sets a protobuf ValidatorSet to the given pointer. It returns an error if any of the validators from the set or the proposer is invalid

func (*ValidatorSet) ABCIEquivalentValidatorUpdates

func (vals *ValidatorSet) ABCIEquivalentValidatorUpdates() *abci.ValidatorSetUpdate

func (*ValidatorSet) BasicInfoString

func (vals *ValidatorSet) BasicInfoString() string

BasicInfoString returns a string representation of ValidatorSet without power and priority.

See StringIndented.

func (*ValidatorSet) Copy

func (vals *ValidatorSet) Copy() *ValidatorSet

Copy each validator into a new ValidatorSet.

func (*ValidatorSet) CopyIncrementProposerPriority

func (vals *ValidatorSet) CopyIncrementProposerPriority(times int32) *ValidatorSet

CopyIncrementProposerPriority increments ProposerPriority and updates the proposer on a copy, and returns it.

func (*ValidatorSet) Equals

func (vals *ValidatorSet) Equals(other *ValidatorSet) bool

func (*ValidatorSet) GetByIndex

func (vals *ValidatorSet) GetByIndex(index int32) *Validator

GetByIndex returns the validator's address and validator itself (copy) by index. It returns nil values if index is less than 0 or greater or equal to len(ValidatorSet.Validators).

func (*ValidatorSet) GetByProTxHash

func (vals *ValidatorSet) GetByProTxHash(proTxHash []byte) (index int32, val *Validator)

GetByProTxHash returns an index of the validator with protxhash and validator itself (copy) if found. Otherwise, -1 and nil are returned.

func (*ValidatorSet) GetProTxHashes

func (vals *ValidatorSet) GetProTxHashes() []crypto.ProTxHash

GetProTxHashes returns the all validator proTxHashes

func (*ValidatorSet) GetProTxHashesAsByteArrays

func (vals *ValidatorSet) GetProTxHashesAsByteArrays() [][]byte

GetProTxHashesAsByteArrays returns the all validator proTxHashes as byte arrays for convenience

func (*ValidatorSet) GetProTxHashesOrdered

func (vals *ValidatorSet) GetProTxHashesOrdered() []crypto.ProTxHash

GetProTxHashesOrdered returns the all validator proTxHashes in order

func (*ValidatorSet) GetProposer

func (vals *ValidatorSet) GetProposer() (proposer *Validator)

GetProposer returns the current proposer. If the validator set is empty, nil is returned.

func (*ValidatorSet) GetPublicKeys

func (vals *ValidatorSet) GetPublicKeys() []crypto.PubKey

GetPublicKeys returns the all validator publicKeys

func (*ValidatorSet) HasProTxHash

func (vals *ValidatorSet) HasProTxHash(proTxHash crypto.ProTxHash) bool

HasProTxHash returns true if proTxHash given is in the validator set, false - otherwise.

func (*ValidatorSet) Hash

func (vals *ValidatorSet) Hash() tmbytes.HexBytes

Hash returns the Quorum Hash.

func (*ValidatorSet) IncrementProposerPriority

func (vals *ValidatorSet) IncrementProposerPriority(times int32)

IncrementProposerPriority increments ProposerPriority of each validator and updates the proposer. Panics if validator set is empty. `times` must be positive.

func (*ValidatorSet) IsNilOrEmpty

func (vals *ValidatorSet) IsNilOrEmpty() bool

IsNilOrEmpty returns true if validator set is nil or empty.

func (*ValidatorSet) Iterate

func (vals *ValidatorSet) Iterate(fn func(index int, val *Validator) bool)

Iterate will run the given function over the set.

func (*ValidatorSet) MarshalZerologObject

func (vals *ValidatorSet) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject implements zerolog.LogObjectMarshaler

func (*ValidatorSet) QuorumHashValid

func (vals *ValidatorSet) QuorumHashValid() error

QuorumHashValid returns true if quorum hash is valid.

func (*ValidatorSet) QuorumTypeMemberCount

func (vals *ValidatorSet) QuorumTypeMemberCount() int

QuorumTypeMemberCount returns a number of validators for a quorum by a type

func (*ValidatorSet) QuorumTypeThresholdCount

func (vals *ValidatorSet) QuorumTypeThresholdCount() int

QuorumTypeThresholdCount returns a threshold number for a quorum by a type

func (*ValidatorSet) QuorumVotingPower

func (vals *ValidatorSet) QuorumVotingPower() int64

QuorumVotingPower returns the voting power of the quorum if all the members existed.

func (*ValidatorSet) QuorumVotingThresholdPower

func (vals *ValidatorSet) QuorumVotingThresholdPower() int64

QuorumVotingThresholdPower returns the threshold power of the voting power of the quorum if all the members existed. Voting is considered successful when voting power is at or above this threshold.

func (*ValidatorSet) RescalePriorities

func (vals *ValidatorSet) RescalePriorities(diffMax int64)

RescalePriorities rescales the priorities such that the distance between the maximum and minimum is smaller than `diffMax`. Panics if validator set is empty.

func (*ValidatorSet) Size

func (vals *ValidatorSet) Size() int

Size returns the length of the validator set.

func (*ValidatorSet) String

func (vals *ValidatorSet) String() string

String returns a string representation of ValidatorSet.

See StringIndented.

func (*ValidatorSet) StringIndented

func (vals *ValidatorSet) StringIndented(indent string) string

StringIndented returns an intended String.

See Validator#String.

func (*ValidatorSet) StringIndentedBasic

func (vals *ValidatorSet) StringIndentedBasic(indent string) string

func (*ValidatorSet) ThresholdPublicKeyValid

func (vals *ValidatorSet) ThresholdPublicKeyValid() error

ThresholdPublicKeyValid returns true if threshold public key is valid.

func (*ValidatorSet) ToProto

func (vals *ValidatorSet) ToProto() (*tmproto.ValidatorSet, error)

ToProto converts ValidatorSet to protobuf

func (*ValidatorSet) TotalVotingPower

func (vals *ValidatorSet) TotalVotingPower() int64

TotalVotingPower returns the sum of the voting powers of all validators. It recomputes the total voting power if required.

func (*ValidatorSet) UpdateWithChangeSet

func (vals *ValidatorSet) UpdateWithChangeSet(
	changes []*Validator,
	newThresholdPublicKey crypto.PubKey,
	newQuorumHash crypto.QuorumHash,
) error

UpdateWithChangeSet attempts to update the validator set with 'changes'. It performs the following steps:

  • validates the changes making sure there are no duplicates and splits them in updates and deletes
  • verifies that applying the changes will not result in errors
  • computes the total voting power BEFORE removals to ensure that in the next steps the priorities across old and newly added validators are fair
  • computes the priorities of new validators against the final set
  • applies the updates against the validator set
  • applies the removals against the validator set
  • performs scaling and centering of priority values

If an error is detected during verification steps, it is returned and the validator set is not changed.

func (*ValidatorSet) ValidateBasic

func (vals *ValidatorSet) ValidateBasic() error

func (*ValidatorSet) VerifyCommit

func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID,
	height int64, commit *Commit) error

VerifyCommit verifies +2/3 of the set had signed the given commit.

It checks all the signatures! While it's safe to exit as soon as we have 2/3+ signatures, doing so would impact incentivization logic in the ABCI application that depends on the LastCommitInfo sent in BeginBlock, which includes which validators signed. For instance, Gaia incentivizes proposers with a bonus for including more than +2/3 of the signatures.

type ValidatorsByProTxHashes

type ValidatorsByProTxHashes []*Validator

ValidatorsByAddress implements sort.Interface for []*Validator based on the Address field.

func (ValidatorsByProTxHashes) Len

func (valz ValidatorsByProTxHashes) Len() int

func (ValidatorsByProTxHashes) Less

func (valz ValidatorsByProTxHashes) Less(i, j int) bool

func (ValidatorsByProTxHashes) Swap

func (valz ValidatorsByProTxHashes) Swap(i, j int)

type ValidatorsByVotingPower

type ValidatorsByVotingPower []*Validator

ValidatorsByVotingPower implements sort.Interface for []*Validator based on the VotingPower and Address fields.

func (ValidatorsByVotingPower) Len

func (valz ValidatorsByVotingPower) Len() int

func (ValidatorsByVotingPower) Less

func (valz ValidatorsByVotingPower) Less(i, j int) bool

func (ValidatorsByVotingPower) Swap

func (valz ValidatorsByVotingPower) Swap(i, j int)

type VersionParams

type VersionParams struct {
	AppVersion uint64 `json:"app_version,string"`
}

func DefaultVersionParams

func DefaultVersionParams() VersionParams

type Vote

type Vote struct {
	Type               tmproto.SignedMsgType `json:"type"`
	Height             int64                 `json:"height,string"`
	Round              int32                 `json:"round"`    // assume there will not be greater than 2^32 rounds
	BlockID            BlockID               `json:"block_id"` // zero if vote is nil.
	ValidatorProTxHash ProTxHash             `json:"validator_pro_tx_hash"`
	ValidatorIndex     int32                 `json:"validator_index"`
	BlockSignature     tmbytes.HexBytes      `json:"block_signature"`
	VoteExtensions     VoteExtensions        `json:"vote_extensions"`
}

Vote represents a prevote, precommit, or commit vote from validators for consensus.

func VoteFromProto

func VoteFromProto(pv *tmproto.Vote) (*Vote, error)

VoteFromProto attempts to convert the given serialization (Protobuf) type to our Vote domain type. No validation is performed on the resulting vote - this is left up to the caller to decide whether to call ValidateBasic or ValidateWithExtension.

func (*Vote) Copy

func (vote *Vote) Copy() *Vote

Copy creates a deep copy of the vote

func (*Vote) GetVoteExtensionsSigns

func (vote *Vote) GetVoteExtensionsSigns(extType tmproto.VoteExtensionType) [][]byte

GetVoteExtensionsSigns returns the list of signatures for given vote-extension type

func (*Vote) HasVoteMessage

func (vote *Vote) HasVoteMessage() *tmcons.HasVote

func (*Vote) MarshalZerologObject

func (vote *Vote) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject formats this object for logging purposes

func (*Vote) PopulateSignsFromProto

func (vote *Vote) PopulateSignsFromProto(pv *tmproto.Vote) error

PopulateSignsFromProto updates the signatures of the current Vote with values are taken from the Vote's protobuf

func (*Vote) PopulateSignsToProto

func (vote *Vote) PopulateSignsToProto(pv *tmproto.Vote) error

PopulateSignsToProto updates the signatures of the given protobuf Vote entity with values are taken from the current Vote's

func (*Vote) String

func (vote *Vote) String() string

String returns a string representation of Vote.

1. validator index 2. first 6 bytes of validator proTxHash 3. height 4. round, 5. type byte 6. type string 7. first 6 bytes of block hash 8. first 6 bytes of signature 9. first 6 bytes of vote extension 10. timestamp

func (*Vote) ToProto

func (vote *Vote) ToProto() *tmproto.Vote

ToProto converts the handwritten type to proto generated type return type, nil if everything converts safely, otherwise nil, error

func (*Vote) ValidateBasic

func (vote *Vote) ValidateBasic() error

ValidateBasic checks whether the vote is well-formed. It does not, however, check vote extensions - for vote validation with vote extension validation, use ValidateWithExtension.

func (*Vote) ValidateWithExtension

func (vote *Vote) ValidateWithExtension() error

ValidateWithExtension performs the same validations as ValidateBasic, but additionally checks whether a vote extension signature is present. This function is used in places where vote extension signatures are expected.

func (*Vote) Verify

func (vote *Vote) Verify(
	chainID string,
	quorumType btcjson.LLMQType,
	quorumHash []byte,
	pubKey crypto.PubKey,
	proTxHash crypto.ProTxHash,
	stateID tmproto.StateID,
) error

func (*Vote) VerifyExtensionSign

func (vote *Vote) VerifyExtensionSign(chainID string, pubKey crypto.PubKey, quorumType btcjson.LLMQType, quorumHash crypto.QuorumHash) error

VerifyExtensionSign checks whether the vote extension signature corresponds to the given chain ID and public key.

func (*Vote) VerifyWithExtension

func (vote *Vote) VerifyWithExtension(
	chainID string,
	quorumType btcjson.LLMQType,
	quorumHash crypto.QuorumHash,
	pubKey crypto.PubKey,
	proTxHash ProTxHash,
) error

VerifyVoteAndExtension performs the same verification as Verify, but additionally checks whether the vote extension signature corresponds to the given chain ID and public key. We only verify vote extension signatures for precommits.

type VoteExtension

type VoteExtension struct {
	Extension []byte           `json:"extension"`
	Signature tmbytes.HexBytes `json:"signature"`
}

VoteExtension represents a vote extension data, with possible types: default or threshold recover

func (*VoteExtension) Clone

func (v *VoteExtension) Clone() VoteExtension

Clone returns a copy of current vote-extension

func (*VoteExtension) Validate

func (v *VoteExtension) Validate() error

Validate ...

type VoteExtensions

type VoteExtensions map[tmproto.VoteExtensionType][]VoteExtension

VoteExtensions is a container where the key is vote-extension type and value is a list of VoteExtension

func NewVoteExtensionsFromABCIExtended

func NewVoteExtensionsFromABCIExtended(exts []*abci.ExtendVoteExtension) VoteExtensions

NewVoteExtensionsFromABCIExtended returns vote-extensions container for given ExtendVoteExtension

func VoteExtensionsFromProto

func VoteExtensionsFromProto(pve []*tmproto.VoteExtension) VoteExtensions

VoteExtensionsFromProto creates VoteExtensions container from VoteExtensions's protobuf

func (VoteExtensions) Add

func (e VoteExtensions) Add(t tmproto.VoteExtensionType, ext []byte)

Add creates and adds VoteExtension into a container by vote-extension type

func (VoteExtensions) Copy

func (e VoteExtensions) Copy() VoteExtensions

Copy creates a deep copy of VoteExtensions

func (VoteExtensions) CopySignsFromProto

func (e VoteExtensions) CopySignsFromProto(src tmproto.VoteExtensions) error

CopySignsFromProto copies the signatures from VoteExtensions's protobuf into the current VoteExtension state

func (VoteExtensions) CopySignsToProto

func (e VoteExtensions) CopySignsToProto(dist tmproto.VoteExtensions) error

CopySignsToProto copies the signatures from the current VoteExtensions into VoteExtension's protobuf

func (VoteExtensions) Fingerprint

func (e VoteExtensions) Fingerprint() []byte

Fingerprint returns a fingerprint of all vote-extensions in a state of this container

func (VoteExtensions) IsEmpty

func (e VoteExtensions) IsEmpty() bool

IsEmpty returns true if a vote-extension container is empty, otherwise false

func (VoteExtensions) IsSameWithProto

func (e VoteExtensions) IsSameWithProto(proto tmproto.VoteExtensions) bool

IsSameWithProto compares the current state of the vote-extension with the same in VoteExtensions's protobuf checks only the value of extensions

func (VoteExtensions) ToExtendProto

func (e VoteExtensions) ToExtendProto() []*abci.ExtendVoteExtension

ToExtendProto transforms the current state of vote-extension container into ExtendVoteExtension's protobuf

func (VoteExtensions) ToProto

func (e VoteExtensions) ToProto() []*tmproto.VoteExtension

ToProto transforms the current state of vote-extension container into VoteExtensions's protobuf

func (VoteExtensions) Validate

func (e VoteExtensions) Validate() error

Validate returns error if an added vote-extension is invalid

type VoteSet

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

VoteSet helps collect signatures from validators at each height+round for a predefined vote type.

We need VoteSet to be able to keep track of conflicting votes when validators double-sign. Yet, we can't keep track of *all* the votes seen, as that could be a DoS attack vector.

There are two storage areas for votes. 1. voteSet.votes 2. voteSet.votesByBlock

`.votes` is the "canonical" list of votes. It always has at least one vote, if a vote from a validator had been seen at all. Usually it keeps track of the first vote seen, but when a 2/3 majority is found, votes for that get priority and are copied over from `.votesByBlock`.

`.votesByBlock` keeps track of a list of votes for a particular block. There are two ways a &blockVotes{} gets created in `.votesByBlock`. 1. the first vote seen by a validator was for the particular block. 2. a peer claims to have seen 2/3 majority for the particular block.

Since the first vote from a validator will always get added in `.votesByBlock` , all votes in `.votes` will have a corresponding entry in `.votesByBlock`.

When a &blockVotes{} in `.votesByBlock` reaches a 2/3 majority quorum, its votes are copied into `.votes`.

All this is memory bounded because conflicting votes only get added if a peer told us to track that block, each peer only gets to tell us 1 such block, and, there's only a limited number of peers.

NOTE: Assumes that the sum total of voting power does not exceed MaxUInt64.

func NewVoteSet

func NewVoteSet(chainID string, height int64, round int32,
	signedMsgType tmproto.SignedMsgType, valSet *ValidatorSet) *VoteSet

NewVoteSet instantiates all fields of a new vote set. This constructor requires that no vote extension data be present on the votes that are added to the set.

func (*VoteSet) AddVote

func (voteSet *VoteSet) AddVote(vote *Vote) (added bool, err error)

AddVote Returns added=true if vote is valid and new. Otherwise returns err=ErrVote[

UnexpectedStep | InvalidIndex | InvalidAddress |
InvalidSignature | InvalidBlockHash | ConflictingVotes ]

Duplicate votes return added=false, err=nil. Conflicting votes return added=*, err=ErrVoteConflictingVotes. NOTE: vote should not be mutated after adding. NOTE: VoteSet must not be nil NOTE: Vote must not be nil

func (*VoteSet) BitArray

func (voteSet *VoteSet) BitArray() *bits.BitArray

Implements VoteSetReader.

func (*VoteSet) BitArrayByBlockID

func (voteSet *VoteSet) BitArrayByBlockID(blockID BlockID) *bits.BitArray

func (*VoteSet) BitArrayString

func (voteSet *VoteSet) BitArrayString() string

Return the bit-array of votes including the fraction of power that has voted like: "BA{29:xx__x__x_x___x__x_______xxx__} 856/1304 = 0.66"

func (*VoteSet) ChainID

func (voteSet *VoteSet) ChainID() string

func (*VoteSet) GetByIndex

func (voteSet *VoteSet) GetByIndex(valIndex int32) *Vote

NOTE: if validator has conflicting votes, returns "canonical" vote Implements VoteSetReader.

func (*VoteSet) GetByProTxHash

func (voteSet *VoteSet) GetByProTxHash(proTxHash []byte) *Vote

func (*VoteSet) GetHeight

func (voteSet *VoteSet) GetHeight() int64

Implements VoteSetReader.

func (*VoteSet) GetRound

func (voteSet *VoteSet) GetRound() int32

Implements VoteSetReader.

func (*VoteSet) HasAll

func (voteSet *VoteSet) HasAll() bool

func (*VoteSet) HasTwoThirdsAny

func (voteSet *VoteSet) HasTwoThirdsAny() bool

HasTwoThirdsAny returns true if we are above voting threshold, regardless of the block id voted

func (*VoteSet) HasTwoThirdsMajority

func (voteSet *VoteSet) HasTwoThirdsMajority() bool

func (*VoteSet) IsCommit

func (voteSet *VoteSet) IsCommit() bool

Implements VoteSetReader.

func (*VoteSet) IsQuorumReached

func (voteSet *VoteSet) IsQuorumReached() bool

IsQuorumReached returns true if quorum was reached otherwise returns false

func (*VoteSet) List

func (voteSet *VoteSet) List() []Vote

List returns a copy of the list of votes stored by the VoteSet.

func (*VoteSet) MakeCommit

func (voteSet *VoteSet) MakeCommit() *Commit

MakeCommit constructs a Commit from the VoteSet. It only includes precommits for the block, which has 2/3+ majority, and nil.

Panics if the vote type is not PrecommitType or if there's no +2/3 votes for a single block.

func (*VoteSet) MarshalJSON

func (voteSet *VoteSet) MarshalJSON() ([]byte, error)

Marshal the VoteSet to JSON. Same as String(), just in JSON, and without the height/round/signedMsgType (since its already included in the votes).

func (*VoteSet) MarshalZerologObject

func (voteSet *VoteSet) MarshalZerologObject(e *zerolog.Event)

MarshalZerologObject marshals vote-set into the zerolog structure

func (*VoteSet) SetPeerMaj23

func (voteSet *VoteSet) SetPeerMaj23(peerID string, blockID BlockID, height int64, round int32) error

If a peer claims that it has 2/3 majority for given blockKey, call this. NOTE: if there are too many peers, or too much peer churn, this can cause memory issues. TODO: implement ability to remove peers too NOTE: VoteSet must not be nil

func (*VoteSet) Size

func (voteSet *VoteSet) Size() int

Implements VoteSetReader.

func (*VoteSet) String

func (voteSet *VoteSet) String() string

String returns a string representation of VoteSet.

See StringIndented.

func (*VoteSet) StringIndented

func (voteSet *VoteSet) StringIndented(indent string) string

StringIndented returns an indented String.

Height Round Type Votes Votes bit array 2/3+ majority

See Vote#String.

func (*VoteSet) StringShort

func (voteSet *VoteSet) StringShort() string

StringShort returns a short representation of VoteSet.

1. height 2. round 3. signed msg type 4. first 2/3+ majority 5. fraction of voted power 6. votes bit array 7. 2/3+ majority for each peer

func (*VoteSet) TwoThirdsMajority

func (voteSet *VoteSet) TwoThirdsMajority() (blockID BlockID, ok bool)

If there was a +2/3 majority for blockID, return blockID and true. Else, return the empty BlockID{} and false.

func (*VoteSet) Type

func (voteSet *VoteSet) Type() byte

Implements VoteSetReader.

func (*VoteSet) VoteStrings

func (voteSet *VoteSet) VoteStrings() []string

Returns a list of votes compressed to more readable strings.

type VoteSetJSON

type VoteSetJSON struct {
	Votes         []string             `json:"votes"`
	VotesBitArray string               `json:"votes_bit_array"`
	PeerMaj23s    map[string]maj23Info `json:"peer_maj_23s"`
}

More human readable JSON of the vote set NOTE: insufficient for unmarshaling from (compressed votes) TODO: make the peerMaj23s nicer to read (eg just the block hash)

type VoteSetReader

type VoteSetReader interface {
	GetHeight() int64
	GetRound() int32
	Type() byte
	Size() int
	BitArray() *bits.BitArray
	GetByIndex(int32) *Vote
	IsCommit() bool
}

Common interface between *consensus.VoteSet and types.Commit

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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