Documentation ¶
Overview ¶
Package consensus provides the implementation agnostic consensus backend.
Index ¶
Constants ¶
const ( // HeightLatest is the height that represents the most recent block height. HeightLatest int64 = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { // Height contains the block height. Height int64 `json:"height"` // Hash contains the block header hash. Hash []byte `json:"hash"` // Time is the second-granular consensus time. Time time.Time `json:"time"` // StateRoot is the Merkle root of the consensus state tree. StateRoot mkvsNode.Root `json:"state_root"` // Meta contains the consensus backend specific block metadata. Meta cbor.RawMessage `json:"meta"` }
Block is a consensus block.
While some common fields are provided, most of the structure is dependent on the actual backend implementation.
type EstimateGasRequest ¶
type EstimateGasRequest struct { Signer signature.PublicKey `json:"signer"` Transaction *transaction.Transaction `json:"transaction"` }
EstimateGasRequest is a EstimateGas request.
type Evidence ¶
type Evidence struct { // Meta contains the consensus backend specific evidence. Meta []byte `json:"meta"` }
Evidence is evidence of a node's Byzantine behavior.
type FeatureMask ¶
type FeatureMask uint8
FeatureMask is the consensus backend feature bitmask.
const ( // FeatureServices indicates support for communicating with consensus services. FeatureServices FeatureMask = 1 << 0 // FeatureFullNode indicates that the consensus backend is independently fully verifying all // consensus-layer blocks. FeatureFullNode FeatureMask = 1 << 1 )
func (FeatureMask) String ¶
func (m FeatureMask) String() string
String returns a string representation of the consensus backend feature bitmask.
type GetSignerNonceRequest ¶
type GetSignerNonceRequest struct { AccountAddress staking.Address `json:"account_address"` Height int64 `json:"height"` }
GetSignerNonceRequest is a GetSignerNonce request.
type HaltHook ¶
HaltHook is a function that gets called when consensus needs to halt for some reason.
type LightBlock ¶
type LightBlock struct { // Height contains the block height. Height int64 `json:"height"` // Meta contains the consensus backend specific light block. Meta []byte `json:"meta"` }
LightBlock is a light consensus block suitable for syncing light clients.
type Parameters ¶
type Parameters struct { // Height contains the block height these consensus parameters are for. Height int64 `json:"height"` // Parameters are the backend agnostic consensus parameters. Parameters genesis.Parameters `json:"parameters"` // Meta contains the consensus backend specific consensus parameters. Meta []byte `json:"meta"` }
Parameters are the consensus backend parameters.
type Status ¶
type Status struct { // Version is the version of the consensus protocol that the node is using. Version version.Version `json:"version"` // Backend is the consensus backend identifier. Backend string `json:"backend"` // Features are the indicated consensus backend features. Features FeatureMask `json:"features"` // NodePeers is a list of node's peers. NodePeers []string `json:"node_peers"` // LatestHeight is the height of the latest block. LatestHeight int64 `json:"latest_height"` // LatestHash is the hash of the latest block. LatestHash []byte `json:"latest_hash"` // LatestTime is the timestamp of the latest block. LatestTime time.Time `json:"latest_time"` // LatestEpoch is the epoch of the latest block. LatestEpoch beacon.EpochTime `json:"latest_epoch"` // LatestStateRoot is the Merkle root of the consensus state tree. LatestStateRoot mkvsNode.Root `json:"latest_state_root"` // GenesisHeight is the height of the genesis block. GenesisHeight int64 `json:"genesis_height"` // GenesisHash is the hash of the genesis block. GenesisHash []byte `json:"genesis_hash"` // LastRetainedHeight is the height of the oldest retained block. LastRetainedHeight int64 `json:"last_retained_height"` // LastRetainedHash is the hash of the oldest retained block. LastRetainedHash []byte `json:"last_retained_hash"` // ChainContext is the chain domain separation context. ChainContext string `json:"chain_context"` // IsValidator returns whether the current node is part of the validator set. IsValidator bool `json:"is_validator"` }
Status is the current status overview.
type TransactionsWithResults ¶
type TransactionsWithResults struct { Transactions [][]byte `json:"transactions"` Results []*results.Result `json:"results"` }
TransactionsWithResults is GetTransactionsWithResults response.
Results[i] are the results of executing Transactions[i].