6 #ifndef KAGOME_CORE_RUNTIME_WAVM_IMPL_RUNTIME_UPGRADE_TRACKER_HPP 7 #define KAGOME_CORE_RUNTIME_WAVM_IMPL_RUNTIME_UPGRADE_TRACKER_HPP 22 class BlockHeaderRepository;
35 static outcome::result<std::unique_ptr<RuntimeUpgradeTrackerImpl>> create(
36 std::shared_ptr<const blockchain::BlockHeaderRepository> header_repo,
37 std::shared_ptr<storage::BufferStorage> storage,
38 std::shared_ptr<const primitives::CodeSubstituteBlockIds>
40 std::shared_ptr<blockchain::BlockStorage> block_storage);
47 template <
typename BlockInfo,
typename RootHash>
49 : block{std::forward<BlockInfo>(block)},
50 state{std::forward<RootHash>(state)} {}
56 void subscribeToBlockchainEvents(
57 std::shared_ptr<primitives::events::ChainSubscriptionEngine>
59 std::shared_ptr<const blockchain::BlockTree> block_tree);
61 outcome::result<storage::trie::RootHash> getLastCodeUpdateState(
64 outcome::result<primitives::BlockInfo> getLastCodeUpdateBlockInfo(
69 std::shared_ptr<const blockchain::BlockHeaderRepository> header_repo,
70 std::shared_ptr<storage::BufferStorage> storage,
71 std::shared_ptr<const primitives::CodeSubstituteBlockIds>
73 std::vector<RuntimeUpgradeData> &&saved_data,
74 std::shared_ptr<blockchain::BlockStorage> block_storage);
76 outcome::result<bool> isStateInChain(
80 outcome::result<std::optional<storage::trie::RootHash>> findProperFork(
82 std::vector<RuntimeUpgradeData>::const_reverse_iterator
83 latest_upgrade_it)
const;
85 bool hasCodeSubstitute(
88 outcome::result<storage::trie::RootHash> push(
97 std::shared_ptr<primitives::events::ChainEventSubscriber>
102 std::shared_ptr<const primitives::CodeSubstituteBlockIds>
110 #endif // KAGOME_CORE_RUNTIME_WAVM_IMPL_RUNTIME_UPGRADE_TRACKER_HPP
storage::trie::RootHash state
std::vector< RuntimeUpgradeData > runtime_upgrades_
RuntimeUpgradeData(BlockInfo &&block, RootHash &&state)
std::shared_ptr< primitives::events::ChainEventSubscriber > chain_subscription_
primitives::BlockInfo block
primitives::BlockInfo BlockInfo
std::shared_ptr< storage::BufferStorage > storage_
std::shared_ptr< const blockchain::BlockHeaderRepository > header_repo_
std::shared_ptr< soralog::Logger > Logger
std::shared_ptr< const primitives::CodeSubstituteBlockIds > known_code_substitutes_
std::shared_ptr< blockchain::BlockStorage > block_storage_
std::shared_ptr< const blockchain::BlockTree > block_tree_