Kagome
Polkadot Runtime Engine in C++17
kagome::consensus::babe Namespace Reference

Classes

class  Babe
 
class  BabeConfigRepository
 Keeps actual babe configuration. More...
 
class  BabeConfigRepositoryImpl
 
class  BabeImpl
 
struct  CandidateCommitments
 
struct  CandidateDescriptor
 
struct  CandidateReceipt
 
struct  CommittedCandidate
 
class  ConsistencyKeeper
 
class  ConsistencyKeeperImpl
 
struct  DisputeRequest
 
struct  OutboundHrmpMessage
 
struct  ParachainInherentData
 
struct  RecipientTag
 The recipient Id as defined in Definition 7.5 (non existent definition) More...
 
struct  UpwardMessageTag
 An upward message as defined in Definition 7.8 (non existent definition) More...
 
struct  Vote
 

Typedefs

using SyncMethod = application::AppConfiguration::SyncMethod
 
using Signature = crypto::Ed25519Signature
 
using ParachainId = uint32_t
 
using CollatorPublicKey = crypto::Ed25519PublicKey
 
using Recipient = Stub< RecipientTag >
 
using UpwardMessage = Stub< UpwardMessageTag >
 
using Attestation = boost::variant< Unused< 0 >, Tagged< Signature, struct Implicit >, Tagged< Signature, struct Explicit >>
 
using DisputeStatement = boost::variant< Tagged< Empty, struct ExplicitStatement >, Tagged< common::Hash256, struct SecondedStatement >, Tagged< common::Hash256, struct ValidStatement >, Tagged< Empty, struct AprovalVote >>
 

Functions

std::optional< uint64_t > getAuthorityIndex (const primitives::AuthorityList &authorities, const primitives::BabeSessionKey &authority_key)
 Get index of authority. More...
 
scale::ScaleEncoderStream & operator<< (scale::ScaleEncoderStream &s, const CandidateDescriptor &data)
 
scale::ScaleDecoderStream & operator>> (scale::ScaleDecoderStream &s, CandidateDescriptor &data)
 
scale::ScaleEncoderStream & operator<< (scale::ScaleEncoderStream &s, const OutboundHrmpMessage &data)
 
scale::ScaleDecoderStream & operator>> (scale::ScaleDecoderStream &s, OutboundHrmpMessage &data)
 
scale::ScaleEncoderStream & operator<< (scale::ScaleEncoderStream &s, const CandidateCommitments &data)
 
scale::ScaleDecoderStream & operator>> (scale::ScaleDecoderStream &s, CandidateCommitments &data)
 
scale::ScaleEncoderStream & operator<< (scale::ScaleEncoderStream &s, const CandidateReceipt &data)
 
scale::ScaleDecoderStream & operator>> (scale::ScaleDecoderStream &s, CandidateReceipt &data)
 
scale::ScaleEncoderStream & operator<< (scale::ScaleEncoderStream &s, const CommittedCandidate &data)
 
scale::ScaleDecoderStream & operator>> (scale::ScaleDecoderStream &s, CommittedCandidate &data)
 
scale::ScaleEncoderStream & operator<< (scale::ScaleEncoderStream &s, const Vote &data)
 
scale::ScaleDecoderStream & operator>> (scale::ScaleDecoderStream &s, Vote &data)
 
scale::ScaleEncoderStream & operator<< (scale::ScaleEncoderStream &s, const DisputeRequest &data)
 
scale::ScaleDecoderStream & operator>> (scale::ScaleDecoderStream &s, DisputeRequest &data)
 
scale::ScaleEncoderStream & operator<< (scale::ScaleEncoderStream &s, const ParachainInherentData &data)
 
scale::ScaleDecoderStream & operator>> (scale::ScaleDecoderStream &s, ParachainInherentData &data)
 

Variables

const auto kTimestampId
 
const auto kBabeSlotId
 
const auto kParachainId
 
const auto kUnsupportedInherentId_uncles00
 
static constexpr auto kMaxBlockSlotsOvertime = 2
 

Detailed Description

Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0


Class Documentation

struct kagome::consensus::babe::CandidateCommitments
Collaboration diagram for kagome::consensus::babe::CandidateCommitments:
Class Members
optional< Buffer > new_parachain_runtime A new parachain Runtime in case of an update.
uint32_t number_of_downward_messages

A unsigned 32-bit integer indicating the number of downward messages that were processed by the parachain. It is expected that the parachain processes the messages from first to last.

vector< OutboundHrmpMessage > outbound_messages

An array of individual outbound horizontal messages (Section 6.8.10) sent by the parachain.

Buffer parachain_head_data The parachain head data (Section 6.8.4).
vector< Buffer > upward_messages

An array of upward messages sent by the parachain. Each individual message, m, is an array of bytes.

uint32_t watermark

A unsigned 32-bit integer indicating the watermark which specifies the relay chain block number up to which all inbound horizontal messages have been processed.

struct kagome::consensus::babe::CandidateDescriptor
Collaboration diagram for kagome::consensus::babe::CandidateDescriptor:
Class Members
CollatorPublicKey collator_public_key The collators public key.
Signature collator_signature The collator signature of the concatenated components.
Hash256 merkle The root of the block’s erasure encoding Merkle tree.
Hash256 parachain_head_data_hash The hash of the parachain head data (Section 6.8.4) of this candidate.
ParachainId parachain_id The parachain Id.
Hash256 parachain_runtime_hash The hash of the parachain Runtime.
BlockHash pov_block_hash The hash of the PoV block.
BlockHash relay_chain_block_hash

The hash of the relay chain block the candidate is executed in the context of.

Hash256 validation_data_hash The hash of the persisted validation data (Definition 188).
struct kagome::consensus::babe::CandidateReceipt

A candidate receipt, contains information about the candidate and a proof of the results of its execution

https://spec.polkadot.network/#defn-candidate-receipt

Definition at line 163 of file parachains_inherent_data.hpp.

Collaboration diagram for kagome::consensus::babe::CandidateReceipt:
Class Members
CandidateCommitments commitments
CandidateDescriptor descriptor
struct kagome::consensus::babe::CommittedCandidate

Definition at line 187 of file parachains_inherent_data.hpp.

Collaboration diagram for kagome::consensus::babe::CommittedCandidate:
Class Members
CandidateReceipt candidate Committed candidate receipt.
BitVec indices A bitfield of indices of the validators within the validator group.
vector< Attestation > validity_votes An array of validity votes themselves, expressed as signatures.
struct kagome::consensus::babe::DisputeRequest

The dispute request is sent by clients who want to issue a dispute about a candidate.

https://spec.polkadot.network/#net-msg-dispute-request

Definition at line 255 of file parachains_inherent_data.hpp.

Collaboration diagram for kagome::consensus::babe::DisputeRequest:
Class Members
CandidateReceipt candidate The candidate that is being disputed.
Vote invalid_vote The invalid vote that makes up the request.
uint32_t session_index

An unsigned 32-bit integer indicating the session index the candidate appears in

Vote valid_vote The valid vote that makes this dispute request valid.
struct kagome::consensus::babe::OutboundHrmpMessage
Collaboration diagram for kagome::consensus::babe::OutboundHrmpMessage:
Class Members
UpwardMessage message An upward message.
Recipient recipient The recipient Id.
struct kagome::consensus::babe::ParachainInherentData

Definition at line 290 of file parachains_inherent_data.hpp.

Collaboration diagram for kagome::consensus::babe::ParachainInherentData:
Class Members
vector< Empty > backed_candidates The array of backed candidates for inclusion in the current block.
vector< SignedBitfield > bitfields

The array of signed bitfields by validators claiming the candidate is available (or not).

Note
The array must be sorted by validator index corresponding to the authority set
vector< DisputeRequest > disputes Array of disputes.
BlockHeader parent_header

The head data is contains information about a parachain block. The head data is returned by executing the parachain Runtime and relay chain validators are not concerned with its inner structure and treat it as a byte arrays.

struct kagome::consensus::babe::RecipientTag

The recipient Id as defined in Definition 7.5 (non existent definition)

Definition at line 82 of file parachains_inherent_data.hpp.

Collaboration diagram for kagome::consensus::babe::RecipientTag:
struct kagome::consensus::babe::UpwardMessageTag

An upward message as defined in Definition 7.8 (non existent definition)

Definition at line 86 of file parachains_inherent_data.hpp.

Collaboration diagram for kagome::consensus::babe::UpwardMessageTag:
struct kagome::consensus::babe::Vote

Definition at line 222 of file parachains_inherent_data.hpp.

Collaboration diagram for kagome::consensus::babe::Vote:
Class Members
Signature signature The signature of the validator.
DisputeStatement statement A varying datatype and implies the dispute statement.
uint32_t validator_index

An unsigned 32-bit integer indicating the validator index in the authority set

Typedef Documentation

using kagome::consensus::babe::Attestation = typedef boost::variant<Unused<0>, Tagged<Signature, struct Implicit>, Tagged<Signature, struct Explicit>>

Attestation is either an implicit or explicit attestation of the validity of a parachain candidate, where 1 implies an implicit vote (in correspondence of a Seconded statement) and 2 implies an explicit attestation (in correspondence of a Valid statement). Both variants are followed by the signature of the validator.

Definition at line 185 of file parachains_inherent_data.hpp.

using kagome::consensus::babe::CollatorPublicKey = typedef crypto::Ed25519PublicKey

Definition at line 18 of file parachains_inherent_data.hpp.

using kagome::consensus::babe::DisputeStatement = typedef boost::variant<Tagged<Empty, struct ExplicitStatement>, Tagged<common::Hash256, struct SecondedStatement>, Tagged<common::Hash256, struct ValidStatement>, Tagged<Empty, struct AprovalVote>>

Definition at line 220 of file parachains_inherent_data.hpp.

using kagome::consensus::babe::ParachainId = typedef uint32_t

Definition at line 16 of file parachains_inherent_data.hpp.

using kagome::consensus::babe::Signature = typedef crypto::Ed25519Signature

Definition at line 15 of file parachains_inherent_data.hpp.

Function Documentation

std::optional<uint64_t> kagome::consensus::babe::getAuthorityIndex ( const primitives::AuthorityList authorities,
const primitives::BabeSessionKey authority_key 
)

Get index of authority.

Parameters
authoritieslist of authorities
authority_keyauthority
Returns
index of authority in list of authorities

Definition at line 225 of file babe_impl.cpp.

scale::ScaleEncoderStream& kagome::consensus::babe::operator<< ( scale::ScaleEncoderStream &  s,
const CandidateDescriptor data 
)

Definition at line 51 of file parachains_inherent_data.hpp.

scale::ScaleEncoderStream& kagome::consensus::babe::operator<< ( scale::ScaleEncoderStream &  s,
const OutboundHrmpMessage data 
)

Definition at line 98 of file parachains_inherent_data.hpp.

scale::ScaleEncoderStream& kagome::consensus::babe::operator<< ( scale::ScaleEncoderStream &  s,
const CandidateCommitments data 
)

Definition at line 136 of file parachains_inherent_data.hpp.

scale::ScaleEncoderStream& kagome::consensus::babe::operator<< ( scale::ScaleEncoderStream &  s,
const CandidateReceipt data 
)

Definition at line 168 of file parachains_inherent_data.hpp.

scale::ScaleEncoderStream& kagome::consensus::babe::operator<< ( scale::ScaleEncoderStream &  s,
const CommittedCandidate data 
)

Definition at line 198 of file parachains_inherent_data.hpp.

scale::ScaleEncoderStream& kagome::consensus::babe::operator<< ( scale::ScaleEncoderStream &  s,
const Vote data 
)

Definition at line 234 of file parachains_inherent_data.hpp.

scale::ScaleEncoderStream& kagome::consensus::babe::operator<< ( scale::ScaleEncoderStream &  s,
const DisputeRequest data 
)

Definition at line 270 of file parachains_inherent_data.hpp.

scale::ScaleEncoderStream& kagome::consensus::babe::operator<< ( scale::ScaleEncoderStream &  s,
const ParachainInherentData data 
)

Definition at line 310 of file parachains_inherent_data.hpp.

scale::ScaleDecoderStream& kagome::consensus::babe::operator>> ( scale::ScaleDecoderStream &  s,
CandidateDescriptor data 
)

Definition at line 66 of file parachains_inherent_data.hpp.

scale::ScaleDecoderStream& kagome::consensus::babe::operator>> ( scale::ScaleDecoderStream &  s,
OutboundHrmpMessage data 
)

Definition at line 103 of file parachains_inherent_data.hpp.

scale::ScaleDecoderStream& kagome::consensus::babe::operator>> ( scale::ScaleDecoderStream &  s,
CandidateCommitments data 
)

Definition at line 148 of file parachains_inherent_data.hpp.

scale::ScaleDecoderStream& kagome::consensus::babe::operator>> ( scale::ScaleDecoderStream &  s,
CandidateReceipt data 
)

Definition at line 173 of file parachains_inherent_data.hpp.

scale::ScaleDecoderStream& kagome::consensus::babe::operator>> ( scale::ScaleDecoderStream &  s,
CommittedCandidate data 
)

Definition at line 207 of file parachains_inherent_data.hpp.

scale::ScaleDecoderStream& kagome::consensus::babe::operator>> ( scale::ScaleDecoderStream &  s,
Vote data 
)

Definition at line 243 of file parachains_inherent_data.hpp.

scale::ScaleDecoderStream& kagome::consensus::babe::operator>> ( scale::ScaleDecoderStream &  s,
DisputeRequest data 
)

Definition at line 280 of file parachains_inherent_data.hpp.

scale::ScaleDecoderStream& kagome::consensus::babe::operator>> ( scale::ScaleDecoderStream &  s,
ParachainInherentData data 
)

Definition at line 320 of file parachains_inherent_data.hpp.

Variable Documentation

const auto kagome::consensus::babe::kBabeSlotId
inline
Initial value:
=
primitives::InherentIdentifier::fromString("babeslot").value()

Definition at line 58 of file babe_impl.hpp.

constexpr auto kagome::consensus::babe::kMaxBlockSlotsOvertime = 2
static

The maximum allowed number of slots past the expected slot as a delay for block production. This is an intentional relaxation of block dropping algo

Definition at line 67 of file babe_impl.hpp.

const auto kagome::consensus::babe::kParachainId
inline
Initial value:
=
primitives::InherentIdentifier::fromString("parachn0").value()

Definition at line 60 of file babe_impl.hpp.

const auto kagome::consensus::babe::kTimestampId
inline
Initial value:
=
primitives::InherentIdentifier::fromString("timstap0").value()

Definition at line 56 of file babe_impl.hpp.

const auto kagome::consensus::babe::kUnsupportedInherentId_uncles00
inline
Initial value:
=
primitives::InherentIdentifier::fromString("uncles00").value()

Definition at line 62 of file babe_impl.hpp.