#include <babe_impl.hpp>
|
| BabeImpl (const application::AppConfiguration &app_config, std::shared_ptr< application::AppStateManager > app_state_manager, std::shared_ptr< BabeLottery > lottery, std::shared_ptr< consensus::babe::BabeConfigRepository > babe_config_repo, std::shared_ptr< authorship::Proposer > proposer, std::shared_ptr< blockchain::BlockTree > block_tree, std::shared_ptr< network::BlockAnnounceTransmitter > block_announce_transmitter, std::shared_ptr< crypto::Sr25519Provider > sr25519_provider, const std::shared_ptr< crypto::Sr25519Keypair > &keypair, std::shared_ptr< clock::SystemClock > clock, std::shared_ptr< crypto::Hasher > hasher, std::unique_ptr< clock::Timer > timer, std::shared_ptr< authority::AuthorityUpdateObserver > authority_update_observer, std::shared_ptr< network::Synchronizer > synchronizer, std::shared_ptr< BabeUtil > babe_util, primitives::events::ChainSubscriptionEnginePtr chain_events_engine, std::shared_ptr< runtime::OffchainWorkerApi > offchain_worker_api, std::shared_ptr< runtime::Core > core, std::shared_ptr< babe::ConsistencyKeeper > consistency_keeper) |
|
| ~BabeImpl () override=default |
|
bool | prepare () |
|
bool | start () |
|
void | stop () |
|
void | runEpoch (EpochDescriptor epoch) override |
|
State | getCurrentState () const override |
|
void | onRemoteStatus (const libp2p::peer::PeerId &peer_id, const network::Status &status) override |
|
void | onBlockAnnounce (const libp2p::peer::PeerId &peer_id, const network::BlockAnnounce &announce) override |
|
void | onSynchronized () override |
|
bool | wasSynchronized () const override |
|
| ~Babe () override=default |
|
virtual | ~BlockAnnounceObserver ()=default |
|
Definition at line 69 of file babe_impl.hpp.
kagome::consensus::babe::BabeImpl::BabeImpl |
( |
const application::AppConfiguration & |
app_config, |
|
|
std::shared_ptr< application::AppStateManager > |
app_state_manager, |
|
|
std::shared_ptr< BabeLottery > |
lottery, |
|
|
std::shared_ptr< consensus::babe::BabeConfigRepository > |
babe_config_repo, |
|
|
std::shared_ptr< authorship::Proposer > |
proposer, |
|
|
std::shared_ptr< blockchain::BlockTree > |
block_tree, |
|
|
std::shared_ptr< network::BlockAnnounceTransmitter > |
block_announce_transmitter, |
|
|
std::shared_ptr< crypto::Sr25519Provider > |
sr25519_provider, |
|
|
const std::shared_ptr< crypto::Sr25519Keypair > & |
keypair, |
|
|
std::shared_ptr< clock::SystemClock > |
clock, |
|
|
std::shared_ptr< crypto::Hasher > |
hasher, |
|
|
std::unique_ptr< clock::Timer > |
timer, |
|
|
std::shared_ptr< authority::AuthorityUpdateObserver > |
authority_update_observer, |
|
|
std::shared_ptr< network::Synchronizer > |
synchronizer, |
|
|
std::shared_ptr< BabeUtil > |
babe_util, |
|
|
primitives::events::ChainSubscriptionEnginePtr |
chain_events_engine, |
|
|
std::shared_ptr< runtime::OffchainWorkerApi > |
offchain_worker_api, |
|
|
std::shared_ptr< runtime::Core > |
core, |
|
|
std::shared_ptr< babe::ConsistencyKeeper > |
consistency_keeper |
|
) |
| |
kagome::consensus::babe::BabeImpl::~BabeImpl |
( |
| ) |
|
|
overridedefault |
void kagome::consensus::babe::BabeImpl::adjustEpochDescriptor |
( |
| ) |
|
|
private |
Babe::State kagome::consensus::babe::BabeImpl::getCurrentState |
( |
| ) |
const |
|
overridevirtual |
outcome::result< EpochDescriptor > kagome::consensus::babe::BabeImpl::getInitialEpochDescriptor |
( |
| ) |
|
|
private |
void kagome::consensus::babe::BabeImpl::onBlockAnnounce |
( |
const libp2p::peer::PeerId & |
peer_id, |
|
|
const network::BlockAnnounce & |
announce |
|
) |
| |
|
overridevirtual |
void kagome::consensus::babe::BabeImpl::onRemoteStatus |
( |
const libp2p::peer::PeerId & |
peer_id, |
|
|
const network::Status & |
remote_status |
|
) |
| |
|
overridevirtual |
void kagome::consensus::babe::BabeImpl::onSynchronized |
( |
| ) |
|
|
overridevirtual |
bool kagome::consensus::babe::BabeImpl::prepare |
( |
| ) |
|
- See also
- AppStateManager::takeControl
Definition at line 119 of file babe_impl.cpp.
void kagome::consensus::babe::BabeImpl::processSlot |
( |
| ) |
|
|
private |
Gather block and broadcast it
- Parameters
-
slot_type | - kind of slot to compose correct block header |
output | - VRF proof if required (determined by slot_type) |
authority_index | - this node index in epoch authorities list |
Definition at line 825 of file babe_impl.cpp.
Start a Babe production
- Parameters
-
epoch | - epoch, which is going to be run epoch.starting_slot_finish_time - when the slot, from which the BABE starts, ends; for example, we start from 5th slot of the some epoch. Then, we need to set time when 5th slot finishes; most probably, that time will be calculated using Median algorithm |
- Note
- the function will automatically continue launching all further epochs of the Babe production
-
in fact, it is an implementation of "Invoke-Block-Authoring" from the spec
Implements kagome::consensus::babe::Babe.
Definition at line 311 of file babe_impl.cpp.
void kagome::consensus::babe::BabeImpl::runSlot |
( |
| ) |
|
|
private |
bool kagome::consensus::babe::BabeImpl::start |
( |
| ) |
|
- See also
- AppStateManager::takeControl
Definition at line 167 of file babe_impl.cpp.
void kagome::consensus::babe::BabeImpl::startCatchUp |
( |
const libp2p::peer::PeerId & |
peer_id, |
|
|
const primitives::BlockInfo & |
target_block |
|
) |
| |
|
private |
void kagome::consensus::babe::BabeImpl::startNextEpoch |
( |
| ) |
|
|
private |
void kagome::consensus::babe::BabeImpl::startStateSyncing |
( |
const libp2p::peer::PeerId & |
peer_id | ) |
|
|
private |
void kagome::consensus::babe::BabeImpl::stop |
( |
| ) |
|
- See also
- AppStateManager::takeControl
Definition at line 217 of file babe_impl.cpp.
bool kagome::consensus::babe::BabeImpl::wasSynchronized |
( |
| ) |
const |
|
overridevirtual |
Checks whether the node was in a synchronized state at least once since startup.
- Returns
- true when current state was ever set to synchronized during the current run, otherwise - false.
Implements kagome::consensus::babe::Babe.
Definition at line 584 of file babe_impl.cpp.
std::atomic_bool kagome::consensus::babe::BabeImpl::active_ {false} |
|
private |
std::shared_ptr<BabeUtil> kagome::consensus::babe::BabeImpl::babe_util_ |
|
private |
std::shared_ptr<crypto::Hasher> kagome::consensus::babe::BabeImpl::hasher_ |
|
private |
std::shared_ptr<BabeLottery> kagome::consensus::babe::BabeImpl::lottery_ |
|
private |
std::shared_ptr<runtime::Core> kagome::consensus::babe::BabeImpl::runtime_core_ |
|
private |
std::unique_ptr<clock::Timer> kagome::consensus::babe::BabeImpl::timer_ |
|
private |
bool kagome::consensus::babe::BabeImpl::was_synchronized_ {false} |
|
private |
The documentation for this class was generated from the following files: