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

Namespaces

 babe
 
 grandpa
 

Classes

struct  BabeBlockHeader
 
class  BabeBlockValidator
 
class  BabeConfigNode
 
class  BabeDigestObserver
 
struct  BabeLottery
 
class  BabeLotteryImpl
 
class  BabeUtil
 
class  BlockAppender
 
class  BlockAppenderImpl
 
class  BlockExecutor
 
class  BlockExecutorImpl
 
class  BlockValidator
 
struct  EpochDescriptor
 
struct  EpochDigest
 Data are corresponding to the epoch. More...
 
struct  Seal
 

Typedefs

using BabeClock = clock::SystemClock
 
using BabeTimePoint = BabeClock::TimePoint
 BABE uses system clock's time points. More...
 
using BabeDuration = BabeClock::Duration
 
using BabeSlotNumber = uint64_t
 slot number of the Babe production More...
 
using EpochNumber = uint64_t
 number of the epoch in the Babe production More...
 
using EpochLength = EpochNumber
 
using Threshold = crypto::VRFThreshold
 threshold, which must not be exceeded for the party to be a slot leader More...
 
using Randomness = common::Blob< crypto::constants::sr25519::vrf::OUTPUT_SIZE >
 random value, which serves as a seed for VRF slot leadership selection More...
 
using IsBlockFinalized = Tagged< bool, struct IsBlockFinalizedTag >
 

Enumerations

enum  BabeError {
  BabeError::TIMER_ERROR = 1, BabeError::NODE_FALL_BEHIND, BabeError::MISSING_PROOF, BabeError::BAD_ORDER_OF_DIGEST_ITEM,
  BabeError::UNKNOWN_DIGEST_TYPE
}
 
enum  DigestError { DigestError::REQUIRED_DIGESTS_NOT_FOUND = 1, DigestError::NO_TRAILING_SEAL_DIGEST, DigestError::MULTIPLE_EPOCH_CHANGE_DIGESTS, DigestError::NEXT_EPOCH_DIGEST_DOES_NOT_EXIST }
 
enum  SlotType : uint8_t { SlotType::Primary = 1, SlotType::SecondaryPlain = 2, SlotType::SecondaryVRF = 3 }
 

Functions

outcome::result< std::pair< Seal, BabeBlockHeader > > getBabeDigests (const primitives::BlockHeader &block_header)
 
outcome::result< EpochDigestgetNextEpochDigest (const primitives::BlockHeader &header)
 
template<typename T , typename VarT >
std::optional< std::reference_wrapper< const std::decay_t< T > > > getFromVariant (VarT &&v)
 
Threshold calculateThreshold (const std::pair< uint64_t, uint64_t > &ratio, const primitives::AuthorityList &authorities, primitives::AuthorityIndex authority_index)
 
std::string_view to_string (SlotType s)
 
primitives::TranscriptprepareTranscript (primitives::Transcript &transcript, const Randomness &randomness, BabeSlotNumber slot_number, EpochNumber epoch)
 

Variables

constexpr size_t kMaxValidatorsNumber = 2048
 

Detailed Description

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

Typedef Documentation

Definition at line 15 of file common.hpp.

Definition at line 21 of file common.hpp.

using kagome::consensus::BabeSlotNumber = typedef uint64_t

slot number of the Babe production

Definition at line 24 of file common.hpp.

BABE uses system clock's time points.

Definition at line 18 of file common.hpp.

Definition at line 30 of file common.hpp.

using kagome::consensus::EpochNumber = typedef uint64_t

number of the epoch in the Babe production

Definition at line 27 of file common.hpp.

using kagome::consensus::IsBlockFinalized = typedef Tagged<bool, struct IsBlockFinalizedTag>

Definition at line 16 of file babe_config_node.hpp.

random value, which serves as a seed for VRF slot leadership selection

Definition at line 36 of file common.hpp.

threshold, which must not be exceeded for the party to be a slot leader

Definition at line 33 of file common.hpp.

Enumeration Type Documentation

Enumerator
TIMER_ERROR 
NODE_FALL_BEHIND 
MISSING_PROOF 
BAD_ORDER_OF_DIGEST_ITEM 
UNKNOWN_DIGEST_TYPE 

Definition at line 12 of file babe_error.hpp.

Enumerator
REQUIRED_DIGESTS_NOT_FOUND 
NO_TRAILING_SEAL_DIGEST 
MULTIPLE_EPOCH_CHANGE_DIGESTS 
NEXT_EPOCH_DIGEST_DOES_NOT_EXIST 

Definition at line 21 of file babe_digests_util.hpp.

enum kagome::consensus::SlotType : uint8_t
strong
Enumerator
Primary 

A primary VRF-based slot assignment.

SecondaryPlain 

A secondary deterministic slot assignment.

SecondaryVRF 

A secondary deterministic slot assignment with VRF outputs.

Definition at line 13 of file slot.hpp.

Function Documentation

Threshold kagome::consensus::calculateThreshold ( const std::pair< uint64_t, uint64_t > &  ratio,
const primitives::AuthorityList authorities,
primitives::AuthorityIndex  authority_index 
)

Calculates the primary selection threshold for a given authority, taking into account c (1 - c represents the probability of a slot being empty). https://github.com/paritytech/substrate/blob/7010ec7716e0edf97d61a29bd0c337648b3a57ae/core/consensus/babe/src/authorship.rs#L30

Definition at line 13 of file threshold_util.cpp.

outcome::result< std::pair< Seal, BabeBlockHeader > > kagome::consensus::getBabeDigests ( const primitives::BlockHeader block_header)

Definition at line 28 of file babe_digests_util.cpp.

template<typename T , typename VarT >
std::optional<std::reference_wrapper<const std::decay_t<T> > > kagome::consensus::getFromVariant ( VarT &&  v)

Definition at line 29 of file babe_digests_util.hpp.

outcome::result< EpochDigest > kagome::consensus::getNextEpochDigest ( const primitives::BlockHeader header)

Definition at line 60 of file babe_digests_util.cpp.

primitives::Transcript& kagome::consensus::prepareTranscript ( primitives::Transcript transcript,
const Randomness randomness,
BabeSlotNumber  slot_number,
EpochNumber  epoch 
)
inline

Definition at line 14 of file prepare_transcript.hpp.

std::string_view kagome::consensus::to_string ( SlotType  s)
inline

Definition at line 22 of file slot.hpp.

Variable Documentation

constexpr size_t kagome::consensus::kMaxValidatorsNumber = 2048

Definition at line 11 of file constants.hpp.