Kagome
Polkadot Runtime Engine in C++17
kagome::authority Namespace Reference

Classes

class  AuthorityManager
 
class  AuthorityManagerImpl
 
class  AuthorityUpdateObserver
 
struct  ConsensusMessages
 
class  ScheduleNode
 Node of scheduler tree. Contains actual authorities for the accorded block and all its descendant blocks until any changes are applied. May contain one of the changes. More...
 

Typedefs

using IsBlockFinalized = Tagged< bool, struct IsBlockFinalizedTag >
 

Enumerations

enum  AuthorityManagerError {
  AuthorityManagerError::UNKNOWN_ENGINE_ID = 1, AuthorityManagerError::ORPHAN_BLOCK_OR_ALREADY_FINALIZED, AuthorityManagerError::CAN_NOT_SAVE_STATE, AuthorityManagerError::CANT_RECALCULATE_ON_PRUNED_STATE,
  AuthorityManagerError::FAILED_TO_INITIALIZE_SET_ID
}
 
enum  AuthorityUpdateObserverError {
  AuthorityUpdateObserverError::UNSUPPORTED_MESSAGE_TYPE = 1, AuthorityUpdateObserverError::WRONG_AUTHORITY_INDEX, AuthorityUpdateObserverError::NO_SCHEDULED_CHANGE_APPLIED_YET, AuthorityUpdateObserverError::NO_FORCED_CHANGE_APPLIED_YET,
  AuthorityUpdateObserverError::NO_PAUSE_APPLIED_YET, AuthorityUpdateObserverError::NO_RESUME_APPLIED_YET
}
 

Functions

outcome::result< std::stack< ConsensusMessages > > collectMsgsFromNonFinalBlocks (blockchain::BlockTree const &block_tree, primitives::BlockHash const &finalized_block_hash)
 
outcome::result< std::optional< AuthoritySetId > > fetchSetIdFromTrieStorage (storage::trie::TrieBatch const &trie_batch, crypto::Hasher const &hasher, storage::trie::RootHash const &state)
 
outcome::result< std::optional< std::unique_ptr< ScheduleNode > > > fetchScheduleGraphRoot (storage::BufferStorage const &storage)
 
outcome::result< void > storeScheduleGraphRoot (storage::BufferStorage &storage, ScheduleNode const &root)
 
outcome::result< void > clearScheduleGraphRoot (storage::BufferStorage &storage)
 
outcome::result< primitives::BlockInfocollectConsensusMsgsUntilNearestSetChangeTo (std::stack< ConsensusMessages > &collected_msgs, const primitives::BlockInfo &finalized_block, const blockchain::BlockTree &block_tree, log::Logger &log)
 

Variables

static const common::Buffer kScheduleGraphRootKey
 

Detailed Description

Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0


Class Documentation

struct kagome::authority::ConsensusMessages

Definition at line 61 of file authority_manager_impl.cpp.

Collaboration diagram for kagome::authority::ConsensusMessages:
Class Members
BlockInfo block
Consensus message

Typedef Documentation

typedef Tagged< bool, struct IsBlockFinalizedTag > kagome::authority::IsBlockFinalized

Definition at line 26 of file authority_manager.hpp.

Enumeration Type Documentation

Enumerator
UNKNOWN_ENGINE_ID 
ORPHAN_BLOCK_OR_ALREADY_FINALIZED 
CAN_NOT_SAVE_STATE 
CANT_RECALCULATE_ON_PRUNED_STATE 
FAILED_TO_INITIALIZE_SET_ID 

Definition at line 12 of file authority_manager_error.hpp.

Enumerator
UNSUPPORTED_MESSAGE_TYPE 
WRONG_AUTHORITY_INDEX 
NO_SCHEDULED_CHANGE_APPLIED_YET 
NO_FORCED_CHANGE_APPLIED_YET 
NO_PAUSE_APPLIED_YET 
NO_RESUME_APPLIED_YET 

Definition at line 13 of file authority_update_observer_error.hpp.

Function Documentation

outcome::result<void> kagome::authority::clearScheduleGraphRoot ( storage::BufferStorage storage)

Definition at line 146 of file authority_manager_impl.cpp.

outcome::result<primitives::BlockInfo> kagome::authority::collectConsensusMsgsUntilNearestSetChangeTo ( std::stack< ConsensusMessages > &  collected_msgs,
const primitives::BlockInfo finalized_block,
const blockchain::BlockTree block_tree,
log::Logger log 
)

Collect all consensus messages found in finalized block starting from {

Parameters
finalized_block_hash}and until an authority set change is reached.
collected_msgs- output stack of msgs
finalized_block_hash- last finalized block
block_tree- block tree
log- logger
Returns
block significant to make root node (or error)

Definition at line 162 of file authority_manager_impl.cpp.

outcome::result<std::stack<ConsensusMessages> > kagome::authority::collectMsgsFromNonFinalBlocks ( blockchain::BlockTree const &  block_tree,
primitives::BlockHash const &  finalized_block_hash 
)

Definition at line 66 of file authority_manager_impl.cpp.

outcome::result<std::optional<std::unique_ptr<ScheduleNode> > > kagome::authority::fetchScheduleGraphRoot ( storage::BufferStorage const &  storage)

Definition at line 130 of file authority_manager_impl.cpp.

outcome::result<std::optional<AuthoritySetId> > kagome::authority::fetchSetIdFromTrieStorage ( storage::trie::TrieBatch const &  trie_batch,
crypto::Hasher const &  hasher,
storage::trie::RootHash const &  state 
)

Definition at line 104 of file authority_manager_impl.cpp.

outcome::result<void> kagome::authority::storeScheduleGraphRoot ( storage::BufferStorage storage,
ScheduleNode const &  root 
)

Definition at line 138 of file authority_manager_impl.cpp.

Variable Documentation

const common::Buffer kagome::authority::kScheduleGraphRootKey
static
Initial value:
=
common::Buffer::fromString(":authority_manager:schedule_graph_root")

Definition at line 126 of file authority_manager_impl.cpp.