Skip to content
Snippets Groups Projects
Unverified Commit 8ce16ee6 authored by Vadim Smirnov's avatar Vadim Smirnov Committed by GitHub
Browse files

fix(frame-benchmarking-cli): Pass heap_pages param to WasmExecutor (#2075)

In https://github.com/paritytech/substrate/pull/13740 the use of the
`heap-pages` param inside the `frame-benchmarking-cli` has been removed.
This results in running out of memory and this PR fixes the heap
allocation strategy for benchmarks wasm executor.
parent a7061712
No related merge requests found
Pipeline #406508 passed with stages
in 37 minutes and 55 seconds
......@@ -25,7 +25,7 @@ use frame_support::traits::StorageInfo;
use linked_hash_map::LinkedHashMap;
use sc_cli::{execution_method_from_cli, CliConfiguration, Result, SharedParams};
use sc_client_db::BenchmarkingState;
use sc_executor::WasmExecutor;
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_service::Configuration;
use serde::Serialize;
use sp_core::{
......@@ -219,12 +219,20 @@ impl PalletCmd {
let method =
execution_method_from_cli(self.wasm_method, self.wasmtime_instantiation_strategy);
let heap_pages =
self.heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |p| HeapAllocStrategy::Static {
extra_pages: p as _,
});
let executor = WasmExecutor::<(
sp_io::SubstrateHostFunctions,
frame_benchmarking::benchmarking::HostFunctions,
ExtraHostFunctions,
)>::builder()
.with_execution_method(method)
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
.with_max_runtime_instances(2)
.with_runtime_cache_size(2)
.build();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment