6 #ifndef KAGOME_CONSENSUS_GRANDPA_VOTINGROUNDIMPL 7 #define KAGOME_CONSENSUS_GRANDPA_VOTINGROUNDIMPL 11 #include <boost/asio/basic_waitable_timer.hpp> 12 #include <boost/signals2.hpp> 13 #include <libp2p/basic/scheduler.hpp> 32 const std::shared_ptr<Grandpa> &grandpa,
34 std::shared_ptr<authority::AuthorityManager> authority_manager,
35 std::shared_ptr<Environment>
env,
36 std::shared_ptr<VoteCryptoProvider> vote_crypto_provider,
37 std::shared_ptr<VoteTracker> prevotes,
38 std::shared_ptr<VoteTracker> precommits,
39 std::shared_ptr<VoteGraph> vote_graph,
40 std::shared_ptr<Clock> clock,
41 std::shared_ptr<libp2p::basic::Scheduler> scheduler);
49 const std::shared_ptr<Grandpa> &grandpa,
51 const std::shared_ptr<authority::AuthorityManager> authority_manager,
52 const std::shared_ptr<Environment> &env,
53 const std::shared_ptr<VoteCryptoProvider> &vote_crypto_provider,
54 const std::shared_ptr<VoteTracker> &prevotes,
55 const std::shared_ptr<VoteTracker> &precommits,
56 const std::shared_ptr<VoteGraph> &vote_graph,
57 const std::shared_ptr<Clock> &clock,
58 const std::shared_ptr<libp2p::basic::Scheduler> &scheduler,
62 const std::shared_ptr<Grandpa> &grandpa,
64 const std::shared_ptr<authority::AuthorityManager> authority_manager,
65 const std::shared_ptr<Environment> &env,
66 const std::shared_ptr<VoteCryptoProvider> &vote_crypto_provider,
67 const std::shared_ptr<VoteTracker> &prevotes,
68 const std::shared_ptr<VoteTracker> &precommits,
69 const std::shared_ptr<VoteGraph> &vote_graph,
70 const std::shared_ptr<Clock> &clock,
71 const std::shared_ptr<libp2p::basic::Scheduler> &scheduler,
72 const std::shared_ptr<VotingRound> &previous_round);
102 void play()
override;
249 template <
typename T>
273 const BlockInfo &estimate,
const std::vector<VoteVariant> &votes)
const;
284 const std::vector<VoteVariant> &votes)
const;
307 const std::optional<Id>
id_;
313 std::shared_ptr<Environment>
env_;
326 std::chrono::duration_cast<std::chrono::milliseconds>(
327 std::max<Clock::Duration>(duration_ * 10,
328 std::chrono::seconds(12)));
373 #endif // KAGOME_CONSENSUS_GRANDPA_VOTINGROUNDIMPL RoundNumber roundNumber() const override
VoterSetId voterSetId() const override
libp2p::basic::Scheduler::Handle pending_timer_handle_
const RoundNumber round_number_
std::shared_ptr< libp2p::basic::Scheduler > scheduler_
std::chrono::milliseconds start_time_
void sendPrevote(const Prevote &prevote)
std::shared_ptr< VotingRound > previous_round_
void doPrecommit() override
Calculate precommit and broadcast signed precommit message.
libp2p::basic::Scheduler::Handle stage_timer_handle_
std::optional< BlockInfo > precommit_
std::shared_ptr< VotingRound > getPreviousRound() const override
void sendProposal(const PrimaryPropose &primary_proposal)
void startPrecommitStage()
const std::optional< BlockInfo > & finalizedBlock() const override
std::optional< BlockInfo > primary_vote_
bool completable() const override
std::shared_ptr< VoteTracker > precommits_
BlockInfo bestFinalCandidate() override
static const wasm::Name env
const std::chrono::milliseconds pending_interval_
outcome::result< void > validatePrecommitJustification(const BlockInfo &vote, const GrandpaJustification &justification) const
std::shared_ptr< const primitives::AuthorityList > authorities_
crypto::Ed25519PublicKey Id
MovableRoundState state() const override
std::function< void()> on_complete_handler_
const std::optional< Id > id_
libp2p::peer::PeerId PeerId
std::optional< BlockInfo > prevote_
BlockInfo last_finalized_block_
void forgetPreviousRound() override
outcome::result< void > onSigned(const SignedMessage &vote)
Triggered when we receive {.
std::shared_ptr< Clock > clock_
std::shared_ptr< soralog::Logger > Logger
void sendPrecommit(const Precommit &precommit)
void sendNeighborMessage()
BlockInfo lastFinalizedBlock() const override
void update(IsPreviousRoundChanged is_previous_round_changed, IsPrevotesChanged is_prevotes_changed, IsPrecommitsChanged is_precommits_changed) override
std::vector< bool > prevote_equivocators_
outcome::result< void > applyJustification(const BlockInfo &block_info, const GrandpaJustification &justification) override
std::shared_ptr< authority::AuthorityManager > authority_manager_
bool updateGrandpaGhost()
std::shared_ptr< VoteTracker > prevotes_
std::optional< BlockInfo > finalized_
void doPrevote() override
Calculate prevote and broadcast signed prevote message.
void doCatchUpResponse(const libp2p::peer::PeerId &peer_id) override
BlockInfo bestPrevoteCandidate() override
std::vector< bool > precommit_equivocators_
Stores the current state of the round.
void doFinalize() override
Collect and save justifications finalizing this round.
bool onPrevote(const SignedMessage &prevote, Propagation propagation) override
std::shared_ptr< VoterSet > voter_set_
void doProposal() override
bool isPrimary(const Id &id) const
Check if peer.
std::vector< SignedPrevote > getPrevoteJustification(const BlockInfo &estimate, const std::vector< VoteVariant > &votes) const
std::optional< BlockInfo > prevote_ghost_
Logger createLogger(const std::string &tag)
void onProposal(const SignedMessage &proposal, Propagation propagation) override
std::optional< BlockInfo > estimate_
bool onPrecommit(const SignedMessage &precommit, Propagation propagation) override
std::shared_ptr< VoteGraph > graph_
std::shared_ptr< Environment > env_
void doCommit() override
Broadcast commit message.
void attemptToFinalizeRound() override
std::weak_ptr< Grandpa > grandpa_
std::shared_ptr< VoteCryptoProvider > vote_crypto_provider_
std::vector< SignedPrecommit > getPrecommitJustification(const BlockInfo &precommits, const std::vector< VoteVariant > &votes) const