29 std::shared_ptr<CompartmentWrapper> compartment,
30 std::shared_ptr<ModuleParams> module_params,
31 std::shared_ptr<IntrinsicModule> intrinsic_module,
32 std::shared_ptr<const InstanceEnvironmentFactory> instance_env_factory,
33 gsl::span<const uint8_t> code,
35 std::shared_ptr<SingleModuleCache> last_compiled_module)
49 std::shared_ptr<const RuntimeCodeProvider>,
59 OUTCOME_TRY(inst, module->instantiate());
81 virtual outcome::result<gsl::span<const uint8_t>>
getCodeAt(
91 std::shared_ptr<CompartmentWrapper> compartment,
92 std::shared_ptr<ModuleParams> module_params,
93 std::shared_ptr<IntrinsicModule> intrinsic_module,
94 std::shared_ptr<storage::trie::TrieStorage> storage,
95 std::shared_ptr<blockchain::BlockHeaderRepository> block_header_repo,
96 std::shared_ptr<const InstanceEnvironmentFactory> instance_env_factory,
97 std::shared_ptr<storage::changes_trie::ChangesTracker> changes_tracker,
98 std::shared_ptr<SingleModuleCache> last_compiled_module,
99 std::shared_ptr<runtime::RuntimePropertiesCache> cache)
108 cache_(std::move(cache)) {
121 std::shared_ptr<const crypto::Hasher> hasher,
122 const std::vector<uint8_t> &runtime_code)
const {
123 auto code_hash = hasher->sha2_256(runtime_code);
124 auto env_factory = std::make_shared<runtime::RuntimeEnvironmentFactory>(
125 std::make_shared<OneCodeProvider>(runtime_code),
126 std::make_shared<OneModuleRepository>(
131 gsl::span<const uint8_t>{
133 static_cast<gsl::span<const uint8_t>::index_type
>(
134 runtime_code.size())},
138 auto executor = std::make_unique<runtime::Executor>(env_factory,
cache_);
139 return std::make_unique<CoreImpl>(
virtual outcome::result< gsl::span< const uint8_t > > getCodeAt(const storage::trie::RootHash &) const
std::shared_ptr< storage::changes_trie::ChangesTracker > changes_tracker_
std::unique_ptr< Core > make(std::shared_ptr< const crypto::Hasher > hasher, const std::vector< uint8_t > &runtime_code) const override
std::shared_ptr< ModuleParams > module_params_
std::shared_ptr< ModuleParams > module_params_
std::shared_ptr< CompartmentWrapper > compartment_
std::shared_ptr< CompartmentWrapper > compartment_
CoreApiFactoryImpl(std::shared_ptr< CompartmentWrapper > compartment, std::shared_ptr< ModuleParams > module_params, std::shared_ptr< IntrinsicModule > intrinsic_module, std::shared_ptr< storage::trie::TrieStorage > storage, std::shared_ptr< blockchain::BlockHeaderRepository > block_header_repo, std::shared_ptr< const InstanceEnvironmentFactory > instance_env_factory, std::shared_ptr< storage::changes_trie::ChangesTracker > changes_tracker, std::shared_ptr< SingleModuleCache > last_compiled_module, std::shared_ptr< runtime::RuntimePropertiesCache > cache)
std::shared_ptr< runtime::RuntimePropertiesCache > cache_
const common::Hash256 code_hash_
std::shared_ptr< ModuleInstance > instance_
OneCodeProvider(gsl::span< const uint8_t > code)
static std::unique_ptr< ModuleImpl > compileFrom(std::shared_ptr< CompartmentWrapper > compartment, ModuleParams &module_params, std::shared_ptr< IntrinsicModule > intrinsic_module, std::shared_ptr< const InstanceEnvironmentFactory > env_factory, gsl::span< const uint8_t > code, const common::Hash256 &code_hash)
std::shared_ptr< IntrinsicModule > intrinsic_module_
std::shared_ptr< const InstanceEnvironmentFactory > instance_env_factory_
std::shared_ptr< IntrinsicModule > intrinsic_module_
std::shared_ptr< SingleModuleCache > last_compiled_module_
gsl::span< const uint8_t > code_
std::shared_ptr< SingleModuleCache > last_compiled_module_
std::shared_ptr< storage::trie::TrieStorage > storage_
OneModuleRepository(std::shared_ptr< CompartmentWrapper > compartment, std::shared_ptr< ModuleParams > module_params, std::shared_ptr< IntrinsicModule > intrinsic_module, std::shared_ptr< const InstanceEnvironmentFactory > instance_env_factory, gsl::span< const uint8_t > code, const common::Hash256 &code_hash, std::shared_ptr< SingleModuleCache > last_compiled_module)
gsl::span< const uint8_t > code_
outcome::result< std::shared_ptr< ModuleInstance > > getInstanceAt(std::shared_ptr< const RuntimeCodeProvider >, const primitives::BlockInfo &, const primitives::BlockHeader &) override
Returns a module instance for runtime at the.
std::shared_ptr< const InstanceEnvironmentFactory > instance_env_factory_
std::shared_ptr< blockchain::BlockHeaderRepository > block_header_repo_