Documentation
¶
Index ¶
- Constants
- Variables
- type AckRes
- type AckStatus
- type BlockGetter
- type BlockResultsStorer
- type BlockStore
- type BlockStorer
- type CommitInfo
- type ConsensusReset
- type DiscoveryRequest
- type DiscoveryResponse
- type Hash
- type HexBytes
- type MemPool
- type NackStatus
- type NamedTx
- type NodeStatus
- type OutOfSyncProof
- type QualifiedBlock
- type RawGetter
- type Role
- type Signature
- type TxGetter
- type VoteInfo
Constants ¶
const HashLen = types.HashLen
Variables ¶
var ( HashBytes = types.HashBytes ErrTxNotFound = errors.New("tx not available") ErrTxAlreadyExists = errors.New("transaction already exists") ErrBlkNotFound = errors.New("block not available") ErrStillProcessing = errors.New("block still being executed") ErrNoResponse = errors.New("stream closed without response") )
var ErrNotFound = types.ErrNotFound
var (
SerializationByteOrder = types.SerializationByteOrder
)
Functions ¶
This section is empty.
Types ¶
type AckRes ¶
type AckRes struct { ACK bool // only required if ACK is false NackStatus *NackStatus Height int64 BlkHash Hash // only required if ACK is true AppHash *Hash // optional, only required if the nack status is NackStatusOutOfSync OutOfSyncProof *OutOfSyncProof // Signature Signature *Signature }
func (AckRes) MarshalBinary ¶
func (*AckRes) OutOfSync ¶
func (ar *AckRes) OutOfSync() (*OutOfSyncProof, bool)
func (*AckRes) UnmarshalBinary ¶
type AckStatus ¶
type AckStatus int
const ( // Rejected means the validator did not accept the proposed block and // responded with a NACK. This can occur due to issues like apphash mismatch, // validator set mismatch, consensus params mismatch, merkle root mismatch, etc. Rejected AckStatus = iota // Agreed means the validator accepted the proposed block and // computed the same AppHash as the leader after processing the block. Agreed // Forked means the validator accepted the proposed block and // successfully processed it, but diverged after processing the block. // The leader identifies this from the app hash mismatch in the vote. Forked )
type BlockGetter ¶
type BlockResultsStorer ¶
type BlockStore ¶
type BlockStore interface { BlockGetter BlockStorer TxGetter BlockResultsStorer Best() (height int64, blkHash, appHash Hash, stamp time.Time) PreFetch(Hash) (bool, func()) // should be app level instead (TODO: remove) Close() error }
type BlockStorer ¶
type BlockStorer interface {
Store(*types.Block, *CommitInfo) error
}
type CommitInfo ¶
type CommitInfo struct { AppHash Hash Votes []*VoteInfo ParamUpdates types.ParamUpdates ValidatorUpdates []*types.Validator }
CommitInfo includes the information about the commit of the block. Such as the signatures of the validators aggreeing to the block.
func (*CommitInfo) MarshalBinary ¶
func (ci *CommitInfo) MarshalBinary() ([]byte, error)
func (*CommitInfo) UnmarshalBinary ¶
func (ci *CommitInfo) UnmarshalBinary(data []byte) error
type ConsensusReset ¶
func (ConsensusReset) Bytes ¶
func (cr ConsensusReset) Bytes() []byte
func (ConsensusReset) MarshalBinary ¶
func (cr ConsensusReset) MarshalBinary() ([]byte, error)
func (ConsensusReset) String ¶
func (cr ConsensusReset) String() string
func (*ConsensusReset) UnmarshalBinary ¶
func (cr *ConsensusReset) UnmarshalBinary(data []byte) error
type DiscoveryRequest ¶
type DiscoveryRequest struct{}
func (DiscoveryRequest) String ¶
func (dr DiscoveryRequest) String() string
type DiscoveryResponse ¶
type DiscoveryResponse struct {
BestHeight int64
}
func (DiscoveryResponse) Bytes ¶
func (dr DiscoveryResponse) Bytes() []byte
func (DiscoveryResponse) MarshalBinary ¶
func (dr DiscoveryResponse) MarshalBinary() ([]byte, error)
func (DiscoveryResponse) String ¶
func (dr DiscoveryResponse) String() string
func (*DiscoveryResponse) UnmarshalBinary ¶
func (dr *DiscoveryResponse) UnmarshalBinary(data []byte) error
type NackStatus ¶
type NackStatus string
NackStatus desribes the reason for a nack response.
const ( // If the block validation fails either due to invalid header info such as // AppHash or the ValidatorHash or Invalid Merkle hash etc. NackStatusInvalidBlock NackStatus = "invalid_block" // If leader proposes a new block for an already committed height, indicating // that the leader may potentially be out of sync with the rest of the network. // This requires the validator to prove to the leader that the block is indeed // committed by sending the block header with the leaders signature in the Vote. NackStatusOutOfSync NackStatus = "out_of_sync" // other unknown miscellaneous reasons for nack NackStatusUnknown NackStatus = "unknown" )
func (NackStatus) String ¶
func (ns NackStatus) String() string
type NamedTx ¶
type NamedTx struct { Hash Hash Tx *types.Transaction }
type NodeStatus ¶
type NodeStatus struct { Role string `json:"role"` CatchingUp bool `json:"catching_up"` CommittedHeader *types.BlockHeader `json:"committed_header"` CommitInfo *CommitInfo `json:"commit_info"` Params *types.NetworkParameters `json:"params"` }
type OutOfSyncProof ¶
type OutOfSyncProof struct { // Header is the block header corresponding to the best height the node is at. Header *types.BlockHeader // Signature is the signature of the block header provided by the leader. Signature []byte }
OutOfSyncProof is the evidence that the validator provides to the leader in the NACK vote to inform leader that it is out of sync with the network.
type QualifiedBlock ¶
type Signature ¶
type Signature struct { PubKeyType crypto.KeyType PubKey []byte // public key of the validator Data []byte }
func DecodeSignature ¶
type VoteInfo ¶
type VoteInfo struct { // VoteSignature is the signature of the blkHash + nack | blkHash + ack + appHash Signature Signature // Ack is set to true if the validator agrees with the block // in terms of the AppHash, ValidatorSet, MerkleRoot of Txs etc. AckStatus AckStatus // AppHash is optional, it set only if the AckStatus is AckStatusDivereged. // AppHash is implied to be the AppHash in the CommitInfo if the AckStatus is AckStatusAgree. // AppHash is nil if the AckStatus is AckStatusDisagree. AppHash *Hash }
VoteInfo represents the leader's interpretation of the AckRes vote received from the validator. This only includes the votes that influenced the commit decision of the block. It does not include the feedback votes for an already committed block such as OutOfSync Vote etc. Validators and sentry nodes use this information from the CommitInfo to verify that the committed block state was agreed upon by the majority of the validators from the validator set.