Kagome
Polkadot Runtime Engine in C++17
kagome::runtime::RuntimeUpgradeTrackerImpl Class Referencefinal

#include <runtime_upgrade_tracker_impl.hpp>

Inheritance diagram for kagome::runtime::RuntimeUpgradeTrackerImpl:
Collaboration diagram for kagome::runtime::RuntimeUpgradeTrackerImpl:

Classes

struct  RuntimeUpgradeData
 

Public Member Functions

void subscribeToBlockchainEvents (std::shared_ptr< primitives::events::ChainSubscriptionEngine > chain_sub_engine, std::shared_ptr< const blockchain::BlockTree > block_tree)
 
outcome::result< storage::trie::RootHashgetLastCodeUpdateState (const primitives::BlockInfo &block) override
 
outcome::result< primitives::BlockInfogetLastCodeUpdateBlockInfo (const storage::trie::RootHash &state) const override
 
- Public Member Functions inherited from kagome::runtime::RuntimeUpgradeTracker
virtual ~RuntimeUpgradeTracker ()=default
 

Static Public Member Functions

static outcome::result< std::unique_ptr< RuntimeUpgradeTrackerImpl > > create (std::shared_ptr< const blockchain::BlockHeaderRepository > header_repo, std::shared_ptr< storage::BufferStorage > storage, std::shared_ptr< const primitives::CodeSubstituteBlockIds > code_substitutes, std::shared_ptr< blockchain::BlockStorage > block_storage)
 

Private Member Functions

 RuntimeUpgradeTrackerImpl (std::shared_ptr< const blockchain::BlockHeaderRepository > header_repo, std::shared_ptr< storage::BufferStorage > storage, std::shared_ptr< const primitives::CodeSubstituteBlockIds > code_substitutes, std::vector< RuntimeUpgradeData > &&saved_data, std::shared_ptr< blockchain::BlockStorage > block_storage)
 
outcome::result< bool > isStateInChain (const primitives::BlockInfo &state, const primitives::BlockInfo &chain_end) const noexcept
 
outcome::result< std::optional< storage::trie::RootHash > > findProperFork (const primitives::BlockInfo &block, std::vector< RuntimeUpgradeData >::const_reverse_iterator latest_upgrade_it) const
 
bool hasCodeSubstitute (const kagome::primitives::BlockInfo &block_info) const
 
outcome::result< storage::trie::RootHashpush (const primitives::BlockHash &hash)
 
void save ()
 

Private Attributes

std::vector< RuntimeUpgradeDataruntime_upgrades_
 
std::shared_ptr< primitives::events::ChainEventSubscriberchain_subscription_
 
std::shared_ptr< const blockchain::BlockTreeblock_tree_
 
std::shared_ptr< const blockchain::BlockHeaderRepositoryheader_repo_
 
std::shared_ptr< storage::BufferStoragestorage_
 
std::shared_ptr< const primitives::CodeSubstituteBlockIdsknown_code_substitutes_
 
std::shared_ptr< blockchain::BlockStorageblock_storage_
 
log::Logger logger_
 

Detailed Description

Definition at line 29 of file runtime_upgrade_tracker_impl.hpp.

Constructor & Destructor Documentation

kagome::runtime::RuntimeUpgradeTrackerImpl::RuntimeUpgradeTrackerImpl ( std::shared_ptr< const blockchain::BlockHeaderRepository header_repo,
std::shared_ptr< storage::BufferStorage storage,
std::shared_ptr< const primitives::CodeSubstituteBlockIds code_substitutes,
std::vector< RuntimeUpgradeData > &&  saved_data,
std::shared_ptr< blockchain::BlockStorage block_storage 
)
private

Definition at line 46 of file runtime_upgrade_tracker_impl.cpp.

Member Function Documentation

outcome::result< std::unique_ptr< RuntimeUpgradeTrackerImpl > > kagome::runtime::RuntimeUpgradeTrackerImpl::create ( std::shared_ptr< const blockchain::BlockHeaderRepository header_repo,
std::shared_ptr< storage::BufferStorage storage,
std::shared_ptr< const primitives::CodeSubstituteBlockIds code_substitutes,
std::shared_ptr< blockchain::BlockStorage block_storage 
)
static

Performs a storage read to fetch saved upgrade states on initialization, which may fail, thus construction only from a factory method

Definition at line 17 of file runtime_upgrade_tracker_impl.cpp.

outcome::result< std::optional< storage::trie::RootHash > > kagome::runtime::RuntimeUpgradeTrackerImpl::findProperFork ( const primitives::BlockInfo block,
std::vector< RuntimeUpgradeData >::const_reverse_iterator  latest_upgrade_it 
) const
private

Definition at line 90 of file runtime_upgrade_tracker_impl.cpp.

outcome::result< primitives::BlockInfo > kagome::runtime::RuntimeUpgradeTrackerImpl::getLastCodeUpdateBlockInfo ( const storage::trie::RootHash state) const
overridevirtual
outcome::result< storage::trie::RootHash > kagome::runtime::RuntimeUpgradeTrackerImpl::getLastCodeUpdateState ( const primitives::BlockInfo block)
overridevirtual
Returns
the latest block earlier or equal to
Parameters
block,whereruntime upgrade happened

Implements kagome::runtime::RuntimeUpgradeTracker.

Definition at line 111 of file runtime_upgrade_tracker_impl.cpp.

bool kagome::runtime::RuntimeUpgradeTrackerImpl::hasCodeSubstitute ( const kagome::primitives::BlockInfo block_info) const
private

Definition at line 60 of file runtime_upgrade_tracker_impl.cpp.

outcome::result< bool > kagome::runtime::RuntimeUpgradeTrackerImpl::isStateInChain ( const primitives::BlockInfo state,
const primitives::BlockInfo chain_end 
) const
privatenoexcept

Definition at line 65 of file runtime_upgrade_tracker_impl.cpp.

outcome::result< storage::trie::RootHash > kagome::runtime::RuntimeUpgradeTrackerImpl::push ( const primitives::BlockHash hash)
private

Definition at line 218 of file runtime_upgrade_tracker_impl.cpp.

void kagome::runtime::RuntimeUpgradeTrackerImpl::save ( )
private

Definition at line 232 of file runtime_upgrade_tracker_impl.cpp.

void kagome::runtime::RuntimeUpgradeTrackerImpl::subscribeToBlockchainEvents ( std::shared_ptr< primitives::events::ChainSubscriptionEngine chain_sub_engine,
std::shared_ptr< const blockchain::BlockTree block_tree 
)

Definition at line 184 of file runtime_upgrade_tracker_impl.cpp.

Member Data Documentation

std::shared_ptr<blockchain::BlockStorage> kagome::runtime::RuntimeUpgradeTrackerImpl::block_storage_
private

Definition at line 104 of file runtime_upgrade_tracker_impl.hpp.

std::shared_ptr<const blockchain::BlockTree> kagome::runtime::RuntimeUpgradeTrackerImpl::block_tree_
private

Definition at line 99 of file runtime_upgrade_tracker_impl.hpp.

std::shared_ptr<primitives::events::ChainEventSubscriber> kagome::runtime::RuntimeUpgradeTrackerImpl::chain_subscription_
private

Definition at line 98 of file runtime_upgrade_tracker_impl.hpp.

std::shared_ptr<const blockchain::BlockHeaderRepository> kagome::runtime::RuntimeUpgradeTrackerImpl::header_repo_
private

Definition at line 100 of file runtime_upgrade_tracker_impl.hpp.

std::shared_ptr<const primitives::CodeSubstituteBlockIds> kagome::runtime::RuntimeUpgradeTrackerImpl::known_code_substitutes_
private

Definition at line 103 of file runtime_upgrade_tracker_impl.hpp.

log::Logger kagome::runtime::RuntimeUpgradeTrackerImpl::logger_
private

Definition at line 105 of file runtime_upgrade_tracker_impl.hpp.

std::vector<RuntimeUpgradeData> kagome::runtime::RuntimeUpgradeTrackerImpl::runtime_upgrades_
private

Definition at line 95 of file runtime_upgrade_tracker_impl.hpp.

std::shared_ptr<storage::BufferStorage> kagome::runtime::RuntimeUpgradeTrackerImpl::storage_
private

Definition at line 101 of file runtime_upgrade_tracker_impl.hpp.


The documentation for this class was generated from the following files: