Kagome
Polkadot Runtime Engine in C++17
babe_lottery_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_BABE_LOTTERY_IMPL_HPP
7 #define KAGOME_BABE_LOTTERY_IMPL_HPP
8 
9 #include <memory>
10 #include <vector>
11 
13 #include "crypto/hasher.hpp"
14 #include "crypto/vrf_provider.hpp"
15 #include "log/logger.hpp"
17 
18 namespace kagome::consensus::babe {
19  class BabeConfigRepository;
20 }
21 
22 namespace kagome::consensus {
23 
24  class BabeLotteryImpl : public BabeLottery {
25  public:
27  std::shared_ptr<crypto::VRFProvider> vrf_provider,
28  std::shared_ptr<consensus::babe::BabeConfigRepository> babe_config_repo,
29  std::shared_ptr<crypto::Hasher> hasher);
30 
31  void changeEpoch(const EpochDescriptor &epoch,
32  const Randomness &randomness,
33  const Threshold &threshold,
34  const crypto::Sr25519Keypair &keypair) override;
35 
36  EpochDescriptor getEpoch() const override;
37 
38  std::optional<crypto::VRFOutput> getSlotLeadership(
39  primitives::BabeSlotNumber i) const override;
40 
41  crypto::VRFOutput slotVrfSignature(
42  primitives::BabeSlotNumber slot) const override;
43 
44  std::optional<primitives::AuthorityIndex> secondarySlotAuthor(
46  primitives::AuthorityListSize authorities_count,
47  const Randomness &randomness) const override;
48 
49  private:
50  std::shared_ptr<crypto::VRFProvider> vrf_provider_;
51  std::shared_ptr<crypto::Hasher> hasher_;
52 
54 
59  };
60 } // namespace kagome::consensus
61 
62 #endif // KAGOME_BABE_LOTTERY_IMPL_HPP
std::shared_ptr< crypto::Hasher > hasher_
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
uint64_t AuthorityListSize
Definition: authority.hpp:21
std::shared_ptr< crypto::VRFProvider > vrf_provider_
crypto::VRFThreshold Threshold
threshold, which must not be exceeded for the party to be a slot leader
Definition: common.hpp:33