Skip to content

Commit

Permalink
Merge pull request #324 from peaqnetwork/bug/1207284892090625_benchma…
Browse files Browse the repository at this point in the history
…rk_build_fails

Bug/1207284892090625 benchmark build fails
  • Loading branch information
sfffaaa authored Jan 7, 2025
2 parents 0e9be32 + 7b99339 commit c772322
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

4 changes: 3 additions & 1 deletion node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ pub fn run() -> sc_cli::Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) => {
with_runtime_or_err!(chain_spec, {
runner.sync_run(|config| cmd.run::<Block>(config))
runner.sync_run(|config| {
cmd.run::<Block, parachain::ExtHostFunctions>(config)
})
})
},
BenchmarkCmd::Block(cmd) => {
Expand Down
2 changes: 2 additions & 0 deletions node/src/parachain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub mod krest_chain_spec;
pub mod peaq_chain_spec;

pub use service::build_import_queue;
#[cfg(feature = "runtime-benchmarks")]
pub use service::ExtHostFunctions;

/// Node `ChainSpec` extensions.
///
Expand Down
20 changes: 11 additions & 9 deletions node/src/parachain/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ declare_executor!(dev, peaq_dev_runtime);
declare_executor!(krest, peaq_krest_runtime);
declare_executor!(peaq, peaq_runtime);

type FullClient<RuntimeApi> = TFullClient<
Block,
RuntimeApi,
WasmExecutor<(
sp_io::SubstrateHostFunctions,
frame_benchmarking::benchmarking::HostFunctions,
peaq_primitives_ext::peaq_ext::HostFunctions,
)>,
>;
#[cfg(feature = "runtime-benchmarks")]
pub type ExtHostFunctions = (
frame_benchmarking::benchmarking::HostFunctions,
sp_io::SubstrateHostFunctions,
peaq_primitives_ext::peaq_ext::HostFunctions,
);
#[cfg(not(feature = "runtime-benchmarks"))]
pub type ExtHostFunctions =
(sp_io::SubstrateHostFunctions, peaq_primitives_ext::peaq_ext::HostFunctions);

type FullClient<RuntimeApi> = TFullClient<Block, RuntimeApi, WasmExecutor<ExtHostFunctions>>;
type FullBackend = TFullBackend<Block>;

pub fn frontier_database_dir(config: &Configuration, path: &str) -> std::path::PathBuf {
Expand Down
5 changes: 3 additions & 2 deletions runtime/krest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ mod benches {
[peaq_pallet_did, PeaqDid]
[peaq_pallet_rbac, PeaqRbac]
[peaq_pallet_storage, PeaqStorage]
[pallet_xcm, PolkadotXcm]
// [pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
[pallet_assets, Assets]
[xc_asset_config, XcAssetConfig]
[address_unification, AddressUnification]
Expand Down Expand Up @@ -2000,7 +2000,8 @@ impl_runtime_apis! {
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey};
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch};
use frame_support::traits::TrackedStorageKey;
use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;

Expand Down
2 changes: 0 additions & 2 deletions runtime/krest/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ impl pallet_xcm::Config for Runtime {
type SovereignAccountOf = LocationToAccountId;
type MaxLockers = ConstU32<8>;
type WeightInfo = crate::weights::pallet_xcm::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
type ReachableDest = ReachableDestBench;

type AdminOrigin = EnsureRoot<AccountId>;
type MaxRemoteLockConsumers = ConstU32<0>;
Expand Down
7 changes: 4 additions & 3 deletions runtime/peaq-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ mod benches {
[peaq_pallet_rbac, PeaqRbac]
[peaq_pallet_storage, PeaqStorage]
[peaq_pallet_mor, PeaqMor]
[pallet_xcm, PolkadotXcm]
// [pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
[pallet_assets, Assets]
[xc_asset_config, XcAssetConfig]
[address_unification, AddressUnification]
Expand Down Expand Up @@ -2016,7 +2016,8 @@ impl_runtime_apis! {
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey};
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch};
use frame_support::traits::TrackedStorageKey;
use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;

Expand All @@ -2038,7 +2039,7 @@ impl_runtime_apis! {
#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {

log::info!("try-runtime::on_runtime_upgrade polkadot.");
let weight = Executive::try_runtime_upgrade(checks).unwrap();
(weight, RuntimeBlockWeights::get().max_block)
}
Expand Down
2 changes: 0 additions & 2 deletions runtime/peaq-dev/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ impl pallet_xcm::Config for Runtime {
type SovereignAccountOf = LocationToAccountId;
type MaxLockers = ConstU32<8>;
type WeightInfo = crate::weights::pallet_xcm::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
type ReachableDest = ReachableDestBench;

type AdminOrigin = EnsureRoot<AccountId>;
type MaxRemoteLockConsumers = ConstU32<0>;
Expand Down
5 changes: 3 additions & 2 deletions runtime/peaq/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ mod benches {
[peaq_pallet_did, PeaqDid]
[peaq_pallet_rbac, PeaqRbac]
[peaq_pallet_storage, PeaqStorage]
[pallet_xcm, PolkadotXcm]
// [pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
[pallet_assets, Assets]
[xc_asset_config, XcAssetConfig]
[address_unification, AddressUnification]
Expand Down Expand Up @@ -2032,7 +2032,8 @@ impl_runtime_apis! {
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey};
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch};
use frame_support::traits::TrackedStorageKey;
use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;

Expand Down
2 changes: 0 additions & 2 deletions runtime/peaq/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@ impl pallet_xcm::Config for Runtime {
type SovereignAccountOf = LocationToAccountId;
type MaxLockers = ConstU32<8>;
type WeightInfo = crate::weights::pallet_xcm::WeightInfo<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
type ReachableDest = ReachableDestBench;

type AdminOrigin = EnsureRoot<AccountId>;
type MaxRemoteLockConsumers = ConstU32<0>;
Expand Down

0 comments on commit c772322

Please sign in to comment.