8 #include <boost/assert.hpp> 19 std::shared_ptr<const storage::trie::TrieStorage> storage,
20 std::shared_ptr<RuntimeUpgradeTracker> runtime_upgrade_tracker,
21 std::shared_ptr<const primitives::CodeSubstituteBlockIds>
23 std::shared_ptr<application::ChainSpec> chain_spec)
24 : storage_{std::move(storage)},
40 if (block_info.has_value()) {
44 chain_spec_->fetchCodeSubstituteByBlockInfo(block_info.value()));
49 OUTCOME_TRY(batch,
storage_->getEphemeralBatchAt(state));
59 return outcome::success();
virtual outcome::result< ConstValueView > get(const Key &key) const =0
Get value by key.
StorageCodeProvider(std::shared_ptr< const storage::trie::TrieStorage > storage, std::shared_ptr< RuntimeUpgradeTracker > runtime_upgrade_tracker, std::shared_ptr< const CodeSubstituteBlockIds > code_substitutes, std::shared_ptr< application::ChainSpec > chain_spec)
outcome::result< void > setCodeFromBatch(const storage::trie::EphemeralTrieBatch &batch) const
std::shared_ptr< const storage::trie::TrieStorage > storage_
storage::trie::RootHash last_state_root_
common::Buffer cached_code_
std::shared_ptr< RuntimeUpgradeTracker > runtime_upgrade_tracker_
std::shared_ptr< application::ChainSpec > chain_spec_
std::shared_ptr< const CodeSubstituteBlockIds > known_code_substitutes_
Logger createLogger(const std::string &tag)
const common::Buffer kRuntimeCodeKey
outcome::result< gsl::span< const uint8_t > > getCodeAt(const storage::trie::RootHash &state) const override
outcome::result< void > uncompressCodeIfNeeded(common::BufferView buf, common::Buffer &res)