6 #ifndef KAGOME_BABE_IMPL_HPP 7 #define KAGOME_BABE_IMPL_HPP 11 #include <boost/asio/basic_waitable_timer.hpp> 36 class AppConfiguration;
41 class BlockAnnounceTransmitter;
45 class OffchainWorkerApi;
50 class BabeConfigRepository;
51 class ConsistencyKeeper;
69 class BabeImpl :
public Babe,
public std::enable_shared_from_this<BabeImpl> {
76 std::shared_ptr<application::AppStateManager> app_state_manager,
77 std::shared_ptr<BabeLottery> lottery,
78 std::shared_ptr<consensus::babe::BabeConfigRepository> babe_config_repo,
79 std::shared_ptr<authorship::Proposer> proposer,
80 std::shared_ptr<blockchain::BlockTree> block_tree,
81 std::shared_ptr<network::BlockAnnounceTransmitter>
82 block_announce_transmitter,
83 std::shared_ptr<crypto::Sr25519Provider> sr25519_provider,
84 const std::shared_ptr<crypto::Sr25519Keypair> &keypair,
85 std::shared_ptr<clock::SystemClock> clock,
86 std::shared_ptr<crypto::Hasher> hasher,
87 std::unique_ptr<clock::Timer> timer,
88 std::shared_ptr<authority::AuthorityUpdateObserver>
89 authority_update_observer,
90 std::shared_ptr<network::Synchronizer> synchronizer,
91 std::shared_ptr<BabeUtil> babe_util,
93 std::shared_ptr<runtime::OffchainWorkerApi> offchain_worker_api,
94 std::shared_ptr<runtime::Core> core,
95 std::shared_ptr<babe::ConsistencyKeeper> consistency_keeper);
110 State getCurrentState()
const override;
118 void onSynchronized()
override;
120 bool wasSynchronized()
const override;
123 outcome::result<EpochDescriptor> getInitialEpochDescriptor();
125 void adjustEpochDescriptor();
145 void processSlotLeadership(
147 std::optional<std::reference_wrapper<const crypto::VRFOutput>> output,
153 void startNextEpoch();
155 void changeLotteryEpoch(
157 std::shared_ptr<const primitives::BabeConfiguration> babe_config)
const;
159 outcome::result<primitives::PreRuntime> babePreDigest(
161 std::optional<std::reference_wrapper<const crypto::VRFOutput>> output,
164 outcome::result<primitives::Seal> sealBlock(
172 std::shared_ptr<network::BlockAnnounceTransmitter>
174 const std::shared_ptr<crypto::Sr25519Keypair> &
keypair_;
175 std::shared_ptr<clock::SystemClock>
clock_;
179 std::shared_ptr<authority::AuthorityUpdateObserver>
184 std::shared_ptr<primitives::events::ChainEventSubscriber>
chain_sub_;
190 State current_state_{State::WAIT_REMOTE_STATUS};
192 bool was_synchronized_{
false};
194 std::atomic_bool active_{
false};
211 #endif // KAGOME_BABE_IMPL_HPP static constexpr auto kMaxBlockSlotsOvertime
telemetry::Telemetry telemetry_
std::shared_ptr< BabeUtil > babe_util_
std::shared_ptr< runtime::OffchainWorkerApi > offchain_worker_api_
std::shared_ptr< clock::SystemClock > clock_
Block class represents polkadot block primitive.
std::shared_ptr< authorship::Proposer > proposer_
std::shared_ptr< consensus::babe::BabeConfigRepository > babe_config_repo_
std::optional< primitives::Version > actual_runtime_version_
A histogram metric to represent aggregatable distributions of events.
std::shared_ptr< authority::AuthorityUpdateObserver > authority_update_observer_
std::shared_ptr< network::BlockAnnounceTransmitter > block_announce_transmitter_
std::unique_ptr< Registry > RegistryPtr
const application::AppConfiguration & app_config_
RegistryPtr createRegistry()
std::unique_ptr< clock::Timer > timer_
static outcome::result< Blob< size_ > > fromString(std::string_view data)
std::shared_ptr< ChainSubscriptionEngine > ChainSubscriptionEnginePtr
libp2p::peer::PeerId PeerId
std::shared_ptr< primitives::events::ChainEventSubscriber > chain_sub_
std::shared_ptr< soralog::Logger > Logger
EpochDescriptor current_epoch_
const std::shared_ptr< crypto::Sr25519Keypair > & keypair_
metrics::Histogram * metric_block_proposal_time_
std::shared_ptr< runtime::Core > runtime_core_
std::shared_ptr< BabeLottery > lottery_
uint64_t BabeSlotNumber
slot number of the Babe production
std::shared_ptr< babe::ConsistencyKeeper > consistency_keeper_
const auto kUnsupportedInherentId_uncles00
std::shared_ptr< crypto::Hasher > hasher_
std::shared_ptr< crypto::Sr25519Provider > sr25519_provider_
std::shared_ptr< network::Synchronizer > synchronizer_
std::shared_ptr< TelemetryService > Telemetry
std::shared_ptr< blockchain::BlockTree > block_tree_
primitives::events::ChainSubscriptionEnginePtr chain_events_engine_