Kagome
Polkadot Runtime Engine in C++17
|
#include <babe_config_repository_impl.hpp>
Public Member Functions | |
BabeConfigRepositoryImpl (const std::shared_ptr< application::AppStateManager > &app_state_manager, std::shared_ptr< storage::BufferStorage > persistent_storage, std::shared_ptr< blockchain::BlockTree > block_tree, std::shared_ptr< blockchain::BlockHeaderRepository > header_repo, std::shared_ptr< runtime::BabeApi > babe_api, std::shared_ptr< crypto::Hasher > hasher, primitives::events::ChainSubscriptionEnginePtr chain_events_engine, const primitives::GenesisBlockHeader &genesis_block_header, const BabeClock &clock) | |
bool | prepare () |
outcome::result< void > | onDigest (const primitives::BlockInfo &block, const consensus::BabeBlockHeader &digest) override |
outcome::result< void > | onDigest (const primitives::BlockInfo &block, const primitives::BabeDigest &digest) override |
void | cancel (const primitives::BlockInfo &block) override |
BabeDuration | slotDuration () const override |
EpochLength | epochLength () const override |
std::shared_ptr< const primitives::BabeConfiguration > | config (const primitives::BlockInfo &parent_block, consensus::EpochNumber epoch_number) override |
BabeSlotNumber | syncEpoch (std::function< std::tuple< BabeSlotNumber, bool >()> &&f) override |
BabeSlotNumber | getCurrentSlot () const override |
BabeTimePoint | slotStartTime (BabeSlotNumber slot) const override |
BabeDuration | remainToStartOfSlot (BabeSlotNumber slot) const override |
BabeTimePoint | slotFinishTime (BabeSlotNumber slot) const override |
BabeDuration | remainToFinishOfSlot (BabeSlotNumber slot) const override |
EpochNumber | slotToEpoch (BabeSlotNumber slot) const override |
BabeSlotNumber | slotInEpoch (BabeSlotNumber slot) const override |
Public Member Functions inherited from kagome::consensus::babe::BabeConfigRepository | |
virtual | ~BabeConfigRepository ()=default |
Public Member Functions inherited from kagome::consensus::BabeDigestObserver | |
virtual | ~BabeDigestObserver ()=default |
Public Member Functions inherited from kagome::consensus::BabeUtil | |
virtual | ~BabeUtil ()=default |
Private Member Functions | |
outcome::result< void > | load () |
outcome::result< void > | save () |
void | prune (const primitives::BlockInfo &block) |
outcome::result< void > | onNextEpochData (const primitives::BlockInfo &block, const primitives::NextEpochData &msg) |
outcome::result< void > | onNextConfigData (const primitives::BlockInfo &block, const primitives::NextConfigDataV1 &msg) |
std::shared_ptr< BabeConfigNode > | getNode (const primitives::BlockInfo &block) const |
Find schedule_node according to the block. More... | |
bool | directChainExists (const primitives::BlockInfo &ancestor, const primitives::BlockInfo &descendant) const |
Check if one block is direct ancestor of second one. More... | |
BabeSlotNumber | getFirstBlockSlotNumber () |
Private Attributes | |
std::shared_ptr< storage::BufferStorage > | persistent_storage_ |
std::shared_ptr< blockchain::BlockTree > | block_tree_ |
std::shared_ptr< blockchain::BlockHeaderRepository > | header_repo_ |
std::shared_ptr< runtime::BabeApi > | babe_api_ |
std::shared_ptr< crypto::Hasher > | hasher_ |
std::shared_ptr< primitives::events::ChainEventSubscriber > | chain_sub_ |
primitives::BlockHash | genesis_block_hash_ |
const BabeDuration | slot_duration_ {} |
const EpochLength | epoch_length_ {} |
std::shared_ptr< BabeConfigNode > | root_ |
primitives::BlockNumber | last_saved_state_block_ = 0 |
const BabeClock & | clock_ |
std::optional< BabeSlotNumber > | first_block_slot_number_ |
bool | is_first_block_finalized_ = false |
log::Logger | logger_ |
Static Private Attributes | |
static const primitives::BlockNumber | kSavepointEachSuchBlock = 100000 |
Definition at line 34 of file babe_config_repository_impl.hpp.
kagome::consensus::babe::BabeConfigRepositoryImpl::BabeConfigRepositoryImpl | ( | const std::shared_ptr< application::AppStateManager > & | app_state_manager, |
std::shared_ptr< storage::BufferStorage > | persistent_storage, | ||
std::shared_ptr< blockchain::BlockTree > | block_tree, | ||
std::shared_ptr< blockchain::BlockHeaderRepository > | header_repo, | ||
std::shared_ptr< runtime::BabeApi > | babe_api, | ||
std::shared_ptr< crypto::Hasher > | hasher, | ||
primitives::events::ChainSubscriptionEnginePtr | chain_events_engine, | ||
const primitives::GenesisBlockHeader & | genesis_block_header, | ||
const BabeClock & | clock | ||
) |
Definition at line 22 of file babe_config_repository_impl.cpp.
|
overridevirtual |
Implements kagome::consensus::BabeDigestObserver.
Definition at line 679 of file babe_config_repository_impl.cpp.
|
overridevirtual |
Returns actual babe configuration
Implements kagome::consensus::babe::BabeConfigRepository.
Definition at line 440 of file babe_config_repository_impl.cpp.
|
private |
Check if one block is direct ancestor of second one.
ancestor | - hash of block, which is at the top of the chain |
descendant | - hash of block, which is the bottom of the chain |
ancestor | is direct ancestor of |
descendant |
Definition at line 630 of file babe_config_repository_impl.cpp.
|
overridevirtual |
Returns epoch length in number of slot
Implements kagome::consensus::babe::BabeConfigRepository.
Definition at line 455 of file babe_config_repository_impl.cpp.
|
overridevirtual |
Implements kagome::consensus::BabeUtil.
Definition at line 734 of file babe_config_repository_impl.cpp.
|
private |
Definition at line 764 of file babe_config_repository_impl.cpp.
|
private |
Find schedule_node according to the block.
block | for which to find the schedule node |
Definition at line 602 of file babe_config_repository_impl.cpp.
|
private |
Definition at line 91 of file babe_config_repository_impl.cpp.
|
overridevirtual |
Observes BabeDigest of block
block | - block digest of which observed |
digest | - BabeBlockHeader as decoded content of PreRuntime digest |
Implements kagome::consensus::BabeDigestObserver.
Definition at line 460 of file babe_config_repository_impl.cpp.
|
overridevirtual |
Observes BabeDigest of block
block | - block digest of which observed |
digest | - BabeDigest as particular variant of ConsensusLog digest |
Implements kagome::consensus::BabeDigestObserver.
Definition at line 494 of file babe_config_repository_impl.cpp.
|
private |
Definition at line 579 of file babe_config_repository_impl.cpp.
|
private |
Definition at line 556 of file babe_config_repository_impl.cpp.
bool kagome::consensus::babe::BabeConfigRepositoryImpl::prepare | ( | ) |
Definition at line 55 of file babe_config_repository_impl.cpp.
|
private |
Definition at line 647 of file babe_config_repository_impl.cpp.
|
overridevirtual |
slot} |
Implements kagome::consensus::BabeUtil.
Definition at line 759 of file babe_config_repository_impl.cpp.
|
overridevirtual |
slot} |
Implements kagome::consensus::BabeUtil.
Definition at line 744 of file babe_config_repository_impl.cpp.
|
private |
Definition at line 368 of file babe_config_repository_impl.cpp.
|
overridevirtual |
Returns duration of slot in milliseconds
Implements kagome::consensus::babe::BabeConfigRepository.
Definition at line 449 of file babe_config_repository_impl.cpp.
|
overridevirtual |
slot} |
Implements kagome::consensus::BabeUtil.
Definition at line 754 of file babe_config_repository_impl.cpp.
|
overridevirtual |
slot_number} |
Implements kagome::consensus::BabeUtil.
Definition at line 781 of file babe_config_repository_impl.cpp.
|
overridevirtual |
slot} |
Implements kagome::consensus::BabeUtil.
Definition at line 739 of file babe_config_repository_impl.cpp.
|
overridevirtual |
slot_number} |
Implements kagome::consensus::BabeUtil.
Definition at line 772 of file babe_config_repository_impl.cpp.
|
overridevirtual |
Init inner state by call {
f} | returning first block slot and flag if first block is already finalized |
Implements kagome::consensus::BabeUtil.
Definition at line 720 of file babe_config_repository_impl.cpp.
|
private |
Definition at line 127 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 125 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 129 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 138 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 133 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 139 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 130 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 128 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 126 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 140 of file babe_config_repository_impl.hpp.
|
staticprivate |
Definition at line 39 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 136 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 142 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 124 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 135 of file babe_config_repository_impl.hpp.
|
private |
Definition at line 132 of file babe_config_repository_impl.hpp.