Kagome
Polkadot Runtime Engine in C++17
storage_code_provider.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_STORAGE_WASM_PROVIDER_HPP
7 #define KAGOME_CORE_RUNTIME_STORAGE_WASM_PROVIDER_HPP
8 
10 
12 #include "log/logger.hpp"
13 
14 namespace kagome::storage::trie {
15  class EphemeralTrieBatch;
16  class TrieStorage;
17 } // namespace kagome::storage::trie
18 
19 namespace kagome::runtime {
20 
21  class RuntimeUpgradeTracker;
22  using primitives::CodeSubstituteBlockIds;
23 
25  public:
26  ~StorageCodeProvider() override = default;
27 
28  explicit StorageCodeProvider(
29  std::shared_ptr<const storage::trie::TrieStorage> storage,
30  std::shared_ptr<RuntimeUpgradeTracker> runtime_upgrade_tracker,
31  std::shared_ptr<const CodeSubstituteBlockIds> code_substitutes,
32  std::shared_ptr<application::ChainSpec> chain_spec);
33 
34  outcome::result<gsl::span<const uint8_t>> getCodeAt(
35  const storage::trie::RootHash &state) const override;
36 
37  private:
38  outcome::result<void> setCodeFromBatch(
39  const storage::trie::EphemeralTrieBatch &batch) const;
40  std::shared_ptr<const storage::trie::TrieStorage> storage_;
41  std::shared_ptr<RuntimeUpgradeTracker> runtime_upgrade_tracker_;
42  std::shared_ptr<const CodeSubstituteBlockIds> known_code_substitutes_;
43  std::shared_ptr<application::ChainSpec> chain_spec_;
47  };
48 
49 } // namespace kagome::runtime
50 
51 #endif // KAGOME_CORE_RUNTIME_STORAGE_WASM_PROVIDER_HPP
Class represents arbitrary (including empty) byte buffer.
Definition: buffer.hpp:29
std::shared_ptr< const storage::trie::TrieStorage > storage_
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
std::shared_ptr< RuntimeUpgradeTracker > runtime_upgrade_tracker_
std::shared_ptr< application::ChainSpec > chain_spec_
std::shared_ptr< const CodeSubstituteBlockIds > known_code_substitutes_