mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 09:51:10 +00:00
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.
This commit is contained in:
@@ -25,7 +25,7 @@ use frame_support::traits::StorageInfo;
|
|||||||
use linked_hash_map::LinkedHashMap;
|
use linked_hash_map::LinkedHashMap;
|
||||||
use sc_cli::{execution_method_from_cli, CliConfiguration, Result, SharedParams};
|
use sc_cli::{execution_method_from_cli, CliConfiguration, Result, SharedParams};
|
||||||
use sc_client_db::BenchmarkingState;
|
use sc_client_db::BenchmarkingState;
|
||||||
use sc_executor::WasmExecutor;
|
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
|
||||||
use sc_service::Configuration;
|
use sc_service::Configuration;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sp_core::{
|
use sp_core::{
|
||||||
@@ -219,12 +219,20 @@ impl PalletCmd {
|
|||||||
let method =
|
let method =
|
||||||
execution_method_from_cli(self.wasm_method, self.wasmtime_instantiation_strategy);
|
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::<(
|
let executor = WasmExecutor::<(
|
||||||
sp_io::SubstrateHostFunctions,
|
sp_io::SubstrateHostFunctions,
|
||||||
frame_benchmarking::benchmarking::HostFunctions,
|
frame_benchmarking::benchmarking::HostFunctions,
|
||||||
ExtraHostFunctions,
|
ExtraHostFunctions,
|
||||||
)>::builder()
|
)>::builder()
|
||||||
.with_execution_method(method)
|
.with_execution_method(method)
|
||||||
|
.with_onchain_heap_alloc_strategy(heap_pages)
|
||||||
|
.with_offchain_heap_alloc_strategy(heap_pages)
|
||||||
.with_max_runtime_instances(2)
|
.with_max_runtime_instances(2)
|
||||||
.with_runtime_cache_size(2)
|
.with_runtime_cache_size(2)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
Reference in New Issue
Block a user