From af2b5f4b26cc500a97f28448af3abdfbd3d6ba83 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Wed, 11 Oct 2023 09:37:53 +0000 Subject: [PATCH] fix: build node with benchmarks --- --- a/Cargo.lock +++ b/Cargo.lock @@ -6536,6 +6536,7 @@ "sp-runtime", "sp-session", "sp-std", + "sp-storage", "sp-transaction-pool", "sp-version", "staging-xcm", --- a/Cargo.toml +++ b/Cargo.toml @@ -170,6 +170,7 @@ sp-staking = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } sp-std = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } +sp-storage = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } sp-tracing = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } sp-transaction-pool = { default-features = false, git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" } --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -354,30 +354,38 @@ } #[cfg(feature = "runtime-benchmarks")] Some(Subcommand::Benchmark(cmd)) => { + use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; use polkadot_cli::Block; - use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE}; + use sp_io::SubstrateHostFunctions; + let runner = cli.create_runner(cmd)?; // Switch on the concrete benchmark sub-command- match cmd { BenchmarkCmd::Pallet(cmd) => { - runner.sync_run(|config| cmd.run::(config)) + runner.sync_run(|config| cmd.run::(config)) } BenchmarkCmd::Block(cmd) => runner.sync_run(|config| { let partials = new_partial::< + opal_runtime::Runtime, + opal_runtime::RuntimeApi, + OpalRuntimeExecutor, _, - default_runtime::RuntimeApi, - DefaultRuntimeExecutor, - _, - >(&config, crate::service::parachain_build_import_queue)?; + >( + &config, + crate::service::parachain_build_import_queue::, + )?; cmd.run(partials.client) }), BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| { let partials = new_partial::< + opal_runtime::Runtime, + opal_runtime::RuntimeApi, + OpalRuntimeExecutor, _, - default_runtime::RuntimeApi, - DefaultRuntimeExecutor, - _, - >(&config, crate::service::parachain_build_import_queue)?; + >( + &config, + crate::service::parachain_build_import_queue::, + )?; let db = partials.backend.expose_db(); let storage = partials.backend.expose_storage(); --- a/pallets/collator-selection/Cargo.toml +++ b/pallets/collator-selection/Cargo.toml @@ -14,7 +14,7 @@ [dependencies] log = { workspace = true } parity-scale-codec = { workspace = true } -rand = { version = "0.8.5", default-features = false } +rand = { version = "0.8.5", default-features = false, features = ["std_rng"] } scale-info = { workspace = true } serde = { workspace = true } --- a/pallets/unique/src/benchmarking.rs +++ b/pallets/unique/src/benchmarking.rs @@ -24,8 +24,8 @@ erc::CrossAccountId, Config as CommonConfig, }; +use sp_runtime::DispatchError; use sp_std::vec; -use sp_runtime::DispatchError; use up_data_structs::{ CollectionId, CollectionLimits, CollectionMode, MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH, --- a/runtime/common/runtime_apis.rs +++ b/runtime/common/runtime_apis.rs @@ -569,7 +569,8 @@ fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; + use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark}; + use sp_storage::TrackedStorageKey; let allowlist: Vec = vec![ // Total Issuance --- a/runtime/opal/Cargo.toml +++ b/runtime/opal/Cargo.toml @@ -136,6 +136,7 @@ 'sp-runtime/std', 'sp-session/std', 'sp-std/std', + 'sp-storage/std', 'sp-transaction-pool/std', 'sp-version/std', 'staging-xcm-builder/std', @@ -279,6 +280,7 @@ sp-runtime = { workspace = true } sp-session = { workspace = true } sp-std = { workspace = true } +sp-storage = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } staging-xcm = { workspace = true } -- gitstuff