Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

frame-benchmarking-cli: Remove native dispatch requirement #14474

Merged
merged 4 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions utils/frame/benchmarking-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ sp-runtime = { version = "24.0.0", path = "../../../primitives/runtime" }
sp-state-machine = { version = "0.28.0", path = "../../../primitives/state-machine" }
sp-storage = { version = "13.0.0", path = "../../../primitives/storage" }
sp-trie = { version = "22.0.0", path = "../../../primitives/trie" }
sp-io = { version = "23.0.0", path = "../../../primitives/io" }
gethostname = "0.2.3"

[features]
Expand Down
21 changes: 9 additions & 12 deletions utils/frame/benchmarking-cli/src/pallet/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use sc_cli::{
execution_method_from_cli, CliConfiguration, ExecutionStrategy, Result, SharedParams,
};
use sc_client_db::BenchmarkingState;
use sc_executor::{NativeElseWasmExecutor, WasmExecutor};
use sc_service::{Configuration, NativeExecutionDispatch};
use sc_executor::WasmExecutor;
use sc_service::Configuration;
use serde::Serialize;
use sp_core::{
offchain::{
Expand Down Expand Up @@ -143,11 +143,10 @@ not created by a node that was compiled with the flag";

impl PalletCmd {
/// Runs the command and benchmarks the chain.
pub fn run<BB, ExecDispatch>(&self, config: Configuration) -> Result<()>
pub fn run<BB>(&self, config: Configuration) -> Result<()>
where
BB: BlockT + Debug,
<<<BB as BlockT>::Header as HeaderT>::Number as std::str::FromStr>::Err: std::fmt::Debug,
ExecDispatch: NativeExecutionDispatch + 'static,
{
if let Some(output_path) = &self.output {
if !output_path.is_dir() && output_path.file_name().is_none() {
Expand Down Expand Up @@ -182,7 +181,7 @@ impl PalletCmd {
}

let spec = config.chain_spec;
let strategy = self.execution.unwrap_or(ExecutionStrategy::Native);
let strategy = self.execution.unwrap_or(ExecutionStrategy::Wasm);
let pallet = self.pallet.clone().unwrap_or_default();
let pallet = pallet.as_bytes();
let extrinsic = self.extrinsic.clone().unwrap_or_default();
Expand Down Expand Up @@ -212,13 +211,11 @@ impl PalletCmd {
let method =
execution_method_from_cli(self.wasm_method, self.wasmtime_instantiation_strategy);

let executor = NativeElseWasmExecutor::<ExecDispatch>::new_with_wasm_executor(
WasmExecutor::builder()
.with_execution_method(method)
.with_max_runtime_instances(2)
.with_runtime_cache_size(2)
.build(),
);
let executor = WasmExecutor::<sp_io::SubstrateHostFunctions>::builder()
.with_execution_method(method)
.with_max_runtime_instances(2)
.with_runtime_cache_size(2)
.build();

let extensions = || -> Extensions {
let mut extensions = Extensions::default();
Expand Down