Kagome
Polkadot Runtime Engine in C++17
|
#include <environment_impl.hpp>
Public Member Functions | |
EnvironmentImpl (std::shared_ptr< blockchain::BlockTree > block_tree, std::shared_ptr< blockchain::BlockHeaderRepository > header_repository, std::shared_ptr< authority::AuthorityManager > authority_manager, std::shared_ptr< network::GrandpaTransmitter > transmitter) | |
~EnvironmentImpl () override=default | |
void | setJustificationObserver (std::weak_ptr< JustificationObserver > justification_observer) override |
outcome::result< bool > | hasBlock (const primitives::BlockHash &block) const override |
Checks if {. More... | |
outcome::result< std::vector< primitives::BlockHash > > | getAncestry (const primitives::BlockHash &base, const primitives::BlockHash &block) const override |
Get the ancestry of a {. More... | |
bool | hasAncestry (const primitives::BlockHash &base, const primitives::BlockHash &block) const override |
Check if block is ancestor for second one. More... | |
outcome::result< BlockInfo > | bestChainContaining (const primitives::BlockHash &base, std::optional< VoterSetId > voter_set_id) const override |
outcome::result< void > | onCatchUpRequested (const libp2p::peer::PeerId &peer_id, VoterSetId set_id, RoundNumber round_number) override |
outcome::result< void > | onCatchUpRespond (const libp2p::peer::PeerId &peer_id, VoterSetId set_id, RoundNumber round_number, std::vector< SignedPrevote > prevote_justification, std::vector< SignedPrecommit > precommit_justification, BlockInfo best_final_candidate) override |
void | sendState (const libp2p::peer::PeerId &peer_id, const MovableRoundState &state, VoterSetId voter_set_id) override |
outcome::result< void > | onVoted (RoundNumber round, VoterSetId set_id, const SignedMessage &vote) override |
outcome::result< void > | onCommitted (RoundNumber round, VoterSetId voter_ser_id, const BlockInfo &vote, const GrandpaJustification &justification) override |
outcome::result< void > | onNeighborMessageSent (RoundNumber round, VoterSetId set_id, BlockNumber last_finalized) override |
outcome::result< void > | applyJustification (const BlockInfo &block_info, const primitives::Justification &justification) override |
outcome::result< void > | finalize (VoterSetId id, const GrandpaJustification &justification) override |
outcome::result< GrandpaJustification > | getJustification (const BlockHash &block_hash) override |
Public Member Functions inherited from kagome::consensus::grandpa::Environment | |
~Environment () override=default | |
Public Member Functions inherited from kagome::consensus::grandpa::Chain | |
virtual | ~Chain ()=default |
bool | isEqualOrDescendOf (const primitives::BlockHash &base, const primitives::BlockHash &block) const |
Private Attributes | |
std::shared_ptr< blockchain::BlockTree > | block_tree_ |
std::shared_ptr< blockchain::BlockHeaderRepository > | header_repository_ |
std::shared_ptr< authority::AuthorityManager > | authority_manager_ |
std::shared_ptr< network::GrandpaTransmitter > | transmitter_ |
std::weak_ptr< JustificationObserver > | justification_observer_ |
log::Logger | logger_ |
Additional Inherited Members | |
Public Types inherited from kagome::consensus::grandpa::Environment | |
using | CompleteHandler = std::function< void(outcome::result< MovableRoundState >)> |
Definition at line 20 of file environment_impl.hpp.
kagome::consensus::grandpa::EnvironmentImpl::EnvironmentImpl | ( | std::shared_ptr< blockchain::BlockTree > | block_tree, |
std::shared_ptr< blockchain::BlockHeaderRepository > | header_repository, | ||
std::shared_ptr< authority::AuthorityManager > | authority_manager, | ||
std::shared_ptr< network::GrandpaTransmitter > | transmitter | ||
) |
Definition at line 25 of file environment_impl.cpp.
|
overridedefault |
|
overridevirtual |
Validate provided {
justification} | for finalization { |
block}. | If it valid finalize { |
block} | and save { |
justification} | in storage. |
block | is observed block info |
justification | justification of finalization of provided block |
Implements kagome::consensus::grandpa::Environment.
Definition at line 211 of file environment_impl.cpp.
|
overridevirtual |
base} | itself. If base is unknown, return None. |
Implements kagome::consensus::grandpa::Chain.
Definition at line 63 of file environment_impl.cpp.
|
overridevirtual |
Triggered when blovk
block | justified by |
justification | should be applied to the storage |
Implements kagome::consensus::grandpa::Environment.
Definition at line 232 of file environment_impl.cpp.
|
overridevirtual |
Get the ancestry of a {.
block} | up to the { |
base} | hash. Should be in reverse order from block's parent. |
Implements kagome::consensus::grandpa::Chain.
Definition at line 46 of file environment_impl.cpp.
|
overridevirtual |
Returns justification for given block
block_hash | hash of the block that we are trying to get justification for |
Implements kagome::consensus::grandpa::Environment.
Definition at line 243 of file environment_impl.cpp.
|
overridevirtual |
Check if block is ancestor for second one.
base | is potential ancestor |
block | is testee block |
base | is ancestor for |
block |
Implements kagome::consensus::grandpa::Chain.
Definition at line 58 of file environment_impl.cpp.
|
overridevirtual |
Checks if {.
block} | exists locally |
Implements kagome::consensus::grandpa::Chain.
Definition at line 41 of file environment_impl.cpp.
|
overridevirtual |
Make catch-up-request
Implements kagome::consensus::grandpa::Environment.
Definition at line 93 of file environment_impl.cpp.
|
overridevirtual |
Make catch-up-response
Implements kagome::consensus::grandpa::Environment.
Definition at line 103 of file environment_impl.cpp.
|
overridevirtual |
Triggered when current peer appears in given round and has given voter_ser_id intends to send committed vote justified by provided justification
Implements kagome::consensus::grandpa::Environment.
Definition at line 173 of file environment_impl.cpp.
|
overridevirtual |
Triggered when current peer should send neighbor message
round | current round |
set_id | id of actual voter set |
last_finalized | last known finalized block |
Implements kagome::consensus::grandpa::Environment.
Definition at line 199 of file environment_impl.cpp.
|
overridevirtual |
Note that we've done a vote in the given round. Triggered when current peer appears in provided round with provided set_id and given vote is ready to be sent.
Implements kagome::consensus::grandpa::Environment.
Definition at line 121 of file environment_impl.cpp.
|
overridevirtual |
Propagate round state
Implements kagome::consensus::grandpa::Environment.
Definition at line 141 of file environment_impl.cpp.
|
inlineoverridevirtual |
Sets back-link to Grandpa
Implements kagome::consensus::grandpa::Environment.
Definition at line 32 of file environment_impl.hpp.
|
private |
Definition at line 104 of file environment_impl.hpp.
|
private |
Definition at line 102 of file environment_impl.hpp.
|
private |
Definition at line 103 of file environment_impl.hpp.
|
private |
Definition at line 106 of file environment_impl.hpp.
|
private |
Definition at line 108 of file environment_impl.hpp.
|
private |
Definition at line 105 of file environment_impl.hpp.