Kagome
Polkadot Runtime Engine in C++17
|
#include <authority_manager_impl.hpp>
Classes | |
struct | Config |
Public Member Functions | |
AuthorityManagerImpl (Config config, std::shared_ptr< application::AppStateManager > app_state_manager, std::shared_ptr< blockchain::BlockTree > block_tree, std::shared_ptr< storage::trie::TrieStorage > trie_storage, std::shared_ptr< runtime::GrandpaApi > grandpa_api, std::shared_ptr< crypto::Hasher > hash, std::shared_ptr< storage::BufferStorage > persistent_storage, std::shared_ptr< blockchain::BlockHeaderRepository > header_repo) | |
~AuthorityManagerImpl () override | |
outcome::result< void > | recalculateStoredState (primitives::BlockNumber last_finalized_number) override |
bool | prepare () |
primitives::BlockInfo | base () const override |
std::optional< std::shared_ptr< const primitives::AuthoritySet > > | authorities (const primitives::BlockInfo &target_block, IsBlockFinalized finalized) const override |
Returns authorities according specified block. More... | |
outcome::result< void > | applyScheduledChange (const primitives::BlockInfo &block, const primitives::AuthorityList &authorities, primitives::BlockNumber activate_at) override |
Schedule an authority set change after the given delay of N blocks, after next one would be finalized by the finality consensus engine. More... | |
outcome::result< void > | applyForcedChange (const primitives::BlockInfo &block, const primitives::AuthorityList &authorities, primitives::BlockNumber delay_start, size_t delay) override |
Force an authority set change after the given delay of N blocks, after next one would be imported block which has been validated by the block production consensus engine. More... | |
outcome::result< void > | applyOnDisabled (const primitives::BlockInfo &block, uint64_t authority_index) override |
An index of the individual authority in the current authority list that should be immediately disabled until the next authority set change. When an authority gets disabled, the node should stop performing any authority functionality from that authority, including authoring blocks and casting GRANDPA votes for finalization. Similarly, other nodes should ignore all messages from the indicated authority which pertain to their authority role. Once an authority set change after the given delay of N blocks, is an imported block which has been validated by the block production consensus engine. More... | |
outcome::result< void > | applyPause (const primitives::BlockInfo &block, primitives::BlockNumber activate_at) override |
A signal to pause the current authority set after the given delay, is a block finalized by the finality consensus engine. After finalizing block, the authorities should stop voting. More... | |
outcome::result< void > | applyResume (const primitives::BlockInfo &block, primitives::BlockNumber activate_at) override |
A signal to resume the current authority set after the given delay, is an imported block and validated by the block production consensus engine. After authoring the block B 0 , the authorities should resume voting. More... | |
outcome::result< void > | onConsensus (const primitives::BlockInfo &block, const primitives::Consensus &message) override |
void | cancel (const primitives::BlockInfo &block) override |
Cancel changes. Should be called when the block is rolled back. More... | |
void | prune (const primitives::BlockInfo &block) override |
Prunes data which was needed only till {. More... | |
Public Member Functions inherited from kagome::authority::AuthorityManager | |
virtual | ~AuthorityManager ()=default |
Public Member Functions inherited from kagome::authority::AuthorityUpdateObserver | |
virtual | ~AuthorityUpdateObserver ()=default |
Static Public Attributes | |
static const std::vector< primitives::ConsensusEngineId > | kKnownEngines {primitives::kBabeEngineId, primitives::kGrandpaEngineId} |
Private Member Functions | |
outcome::result< void > | initializeAt (const primitives::BlockInfo &root_block) |
std::shared_ptr< ScheduleNode > | getAppropriateAncestor (const primitives::BlockInfo &block) const |
Find schedule_node according to the block. More... | |
outcome::result< std::optional< primitives::AuthoritySetId > > | readSetIdFromRuntime (primitives::BlockHeader const &targetBlock) const |
bool | directChainExists (const primitives::BlockInfo &ancestor, const primitives::BlockInfo &descendant) const |
Check if one block is direct ancestor of second one. More... | |
void | reorganize (std::shared_ptr< ScheduleNode > node, std::shared_ptr< ScheduleNode > new_node) |
Private Attributes | |
Config | config_ |
std::shared_ptr< const blockchain::BlockTree > | block_tree_ |
std::shared_ptr< storage::trie::TrieStorage > | trie_storage_ |
std::shared_ptr< runtime::GrandpaApi > | grandpa_api_ |
std::shared_ptr< crypto::Hasher > | hasher_ |
std::shared_ptr< storage::BufferStorage > | persistent_storage_ |
std::shared_ptr< blockchain::BlockHeaderRepository > | header_repo_ |
std::shared_ptr< ScheduleNode > | root_ |
log::Logger | log_ |
Definition at line 44 of file authority_manager_impl.hpp.
struct kagome::authority::AuthorityManagerImpl::Config |
Definition at line 50 of file authority_manager_impl.hpp.
Class Members | ||
---|---|---|
bool | on_disable_enabled |
kagome::authority::AuthorityManagerImpl::AuthorityManagerImpl | ( | Config | config, |
std::shared_ptr< application::AppStateManager > | app_state_manager, | ||
std::shared_ptr< blockchain::BlockTree > | block_tree, | ||
std::shared_ptr< storage::trie::TrieStorage > | trie_storage, | ||
std::shared_ptr< runtime::GrandpaApi > | grandpa_api, | ||
std::shared_ptr< crypto::Hasher > | hash, | ||
std::shared_ptr< storage::BufferStorage > | persistent_storage, | ||
std::shared_ptr< blockchain::BlockHeaderRepository > | header_repo | ||
) |
Definition at line 33 of file authority_manager_impl.cpp.
|
override |
Definition at line 246 of file authority_manager_impl.cpp.
|
overridevirtual |
Force an authority set change after the given delay of N blocks, after next one would be imported block which has been validated by the block production consensus engine.
block | the block where a digest with this change was discovered |
authorities | new authority set |
delay_start | block at which the delay before this change is applied starts |
delay | the chain length until the delay is over |
Implements kagome::authority::AuthorityManager.
Definition at line 612 of file authority_manager_impl.cpp.
|
overridevirtual |
An index of the individual authority in the current authority list that should be immediately disabled until the next authority set change. When an authority gets disabled, the node should stop performing any authority functionality from that authority, including authoring blocks and casting GRANDPA votes for finalization. Similarly, other nodes should ignore all messages from the indicated authority which pertain to their authority role. Once an authority set change after the given delay of N blocks, is an imported block which has been validated by the block production consensus engine.
block | the block where a digest with this change was discovered |
authority_index | is index of one authority in current authority set |
Implements kagome::authority::AuthorityManager.
Definition at line 688 of file authority_manager_impl.cpp.
|
overridevirtual |
A signal to pause the current authority set after the given delay, is a block finalized by the finality consensus engine. After finalizing block, the authorities should stop voting.
block | the block where a digest with this change was discovered |
activateAt | is number of block when changes will applied |
Implements kagome::authority::AuthorityManager.
Definition at line 757 of file authority_manager_impl.cpp.
|
overridevirtual |
A signal to resume the current authority set after the given delay, is an imported block and validated by the block production consensus engine. After authoring the block B 0 , the authorities should resume voting.
block | the block where a digest with this change was discovered |
activateAt | is number of block when changes will applied |
Implements kagome::authority::AuthorityManager.
Definition at line 790 of file authority_manager_impl.cpp.
|
overridevirtual |
Schedule an authority set change after the given delay of N blocks, after next one would be finalized by the finality consensus engine.
block | the block where a digest with this change was discovered |
authorities | is authority set for renewal |
activateAt | is number of block when changes will applied |
Implements kagome::authority::AuthorityManager.
Definition at line 495 of file authority_manager_impl.cpp.
|
overridevirtual |
Returns authorities according specified block.
block | for which authority set is requested |
finalized | - true if we consider that the provided block is finalized |
Implements kagome::authority::AuthorityManager.
Definition at line 457 of file authority_manager_impl.cpp.
|
overridevirtual |
Implements kagome::authority::AuthorityManager.
Definition at line 448 of file authority_manager_impl.cpp.
|
overridevirtual |
Cancel changes. Should be called when the block is rolled back.
block | - corresponding block |
Implements kagome::authority::AuthorityUpdateObserver.
Definition at line 984 of file authority_manager_impl.cpp.
|
private |
Check if one block is direct ancestor of second one.
ancestor | - hash of block, which is at the top of the chain |
descendant | - hash of block, which is the bottom of the chain |
ancestor | is direct ancestor of |
descendant |
Definition at line 934 of file authority_manager_impl.cpp.
|
private |
Find schedule_node according to the block.
block | for which to find the schedule node |
Definition at line 904 of file authority_manager_impl.cpp.
|
private |
Definition at line 259 of file authority_manager_impl.cpp.
|
overridevirtual |
Processes consensus message in block digest
message |
Implements kagome::authority::AuthorityUpdateObserver.
Definition at line 815 of file authority_manager_impl.cpp.
bool kagome::authority::AuthorityManagerImpl::prepare | ( | ) |
Definition at line 248 of file authority_manager_impl.cpp.
|
overridevirtual |
Prunes data which was needed only till {.
block} | and won't be used anymore |
Implements kagome::authority::AuthorityManager.
Definition at line 868 of file authority_manager_impl.cpp.
|
private |
Definition at line 361 of file authority_manager_impl.cpp.
|
overridevirtual |
Recalculate the authority change graph starting from genesis and up to the last finalized block. The result shall be stored in the provided storage. This operation may take a considerable amount of time.
Implements kagome::authority::AuthorityManager.
Definition at line 397 of file authority_manager_impl.cpp.
|
private |
Definition at line 953 of file authority_manager_impl.cpp.
|
private |
Definition at line 138 of file authority_manager_impl.hpp.
|
private |
Definition at line 137 of file authority_manager_impl.hpp.
|
private |
Definition at line 140 of file authority_manager_impl.hpp.
|
private |
Definition at line 141 of file authority_manager_impl.hpp.
|
private |
Definition at line 143 of file authority_manager_impl.hpp.
|
inlinestatic |
Definition at line 48 of file authority_manager_impl.hpp.
|
private |
Definition at line 146 of file authority_manager_impl.hpp.
|
private |
Definition at line 142 of file authority_manager_impl.hpp.
|
private |
Definition at line 145 of file authority_manager_impl.hpp.
|
private |
Definition at line 139 of file authority_manager_impl.hpp.