Kagome
Polkadot Runtime Engine in C++17
|
#include <babe_lottery_impl.hpp>
Public Member Functions | |
BabeLotteryImpl (std::shared_ptr< crypto::VRFProvider > vrf_provider, std::shared_ptr< consensus::babe::BabeConfigRepository > babe_config_repo, std::shared_ptr< crypto::Hasher > hasher) | |
void | changeEpoch (const EpochDescriptor &epoch, const Randomness &randomness, const Threshold &threshold, const crypto::Sr25519Keypair &keypair) override |
EpochDescriptor | getEpoch () const override |
std::optional< crypto::VRFOutput > | getSlotLeadership (primitives::BabeSlotNumber i) const override |
crypto::VRFOutput | slotVrfSignature (primitives::BabeSlotNumber slot) const override |
std::optional< primitives::AuthorityIndex > | secondarySlotAuthor (primitives::BabeSlotNumber slot, primitives::AuthorityListSize authorities_count, const Randomness &randomness) const override |
Public Member Functions inherited from kagome::consensus::BabeLottery | |
virtual | ~BabeLottery ()=default |
Private Attributes | |
std::shared_ptr< crypto::VRFProvider > | vrf_provider_ |
std::shared_ptr< crypto::Hasher > | hasher_ |
log::Logger | logger_ |
EpochDescriptor | epoch_ |
Randomness | randomness_ |
Threshold | threshold_ |
crypto::Sr25519Keypair | keypair_ |
Definition at line 24 of file babe_lottery_impl.hpp.
kagome::consensus::BabeLotteryImpl::BabeLotteryImpl | ( | std::shared_ptr< crypto::VRFProvider > | vrf_provider, |
std::shared_ptr< consensus::babe::BabeConfigRepository > | babe_config_repo, | ||
std::shared_ptr< crypto::Hasher > | hasher | ||
) |
Definition at line 21 of file babe_lottery_impl.cpp.
|
overridevirtual |
Set new epoch and corresponding randomness, threshold and keypair values
epoch | is an information about epoch where we calculate leadership |
randomness | is an epoch random byte sequence |
threshold | is a maximum value that is considered valid by vrf |
keypair | is a current babe sign pair |
Implements kagome::consensus::BabeLottery.
Definition at line 35 of file babe_lottery_impl.cpp.
|
overridevirtual |
Return lottery current epoch
Implements kagome::consensus::BabeLottery.
Definition at line 53 of file babe_lottery_impl.cpp.
|
overridevirtual |
Compute leadership for the slot
slot | is a slot number |
Implements kagome::consensus::BabeLottery.
Definition at line 57 of file babe_lottery_impl.cpp.
|
overridevirtual |
Compute the expected author for secondary slot
slot | - slot to have secondary block produced |
authorities_count | - quantity of authorities in current epoch |
randomness | - current randomness |
Implements kagome::consensus::BabeLottery.
Definition at line 94 of file babe_lottery_impl.cpp.
|
overridevirtual |
Computes VRF proof for the slot regardless threshold. Used when secondary VRF slots are enabled
slot | is a slot number |
Implements kagome::consensus::BabeLottery.
Definition at line 79 of file babe_lottery_impl.cpp.
|
private |
Definition at line 55 of file babe_lottery_impl.hpp.
|
private |
Definition at line 51 of file babe_lottery_impl.hpp.
|
private |
Definition at line 58 of file babe_lottery_impl.hpp.
|
private |
Definition at line 53 of file babe_lottery_impl.hpp.
|
private |
Definition at line 56 of file babe_lottery_impl.hpp.
|
private |
Definition at line 57 of file babe_lottery_impl.hpp.
|
private |
Definition at line 50 of file babe_lottery_impl.hpp.