From 8de959c82b138026d9a958413e9f410135dc9941 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Wed, 21 Feb 2024 13:47:07 +0200 Subject: [PATCH 1/3] benchmark fix --- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index d1eac089f670..c87aa7c389e2 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -102,8 +102,6 @@ use polkadot_runtime_common::prod_or_fast; #[cfg(feature = "runtime-benchmarks")] use benchmark_helpers::DoNothingRouter; -#[cfg(not(feature = "runtime-benchmarks"))] -use bridge_hub_common::BridgeHubMessageRouter; /// The address format for describing accounts. pub type Address = MultiAddress; @@ -367,11 +365,11 @@ parameter_types! { impl pallet_message_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = weights::pallet_message_queue::WeightInfo; - #[cfg(feature = "runtime-benchmarks")] + #[cfg(all(not(feature = "std"), feature = "runtime-benchmarks"))] type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor; - #[cfg(not(feature = "runtime-benchmarks"))] - type MessageProcessor = BridgeHubMessageRouter< + #[cfg(not(all(not(feature = "std"), feature = "runtime-benchmarks")))] + type MessageProcessor = bridge_hub_common::BridgeHubMessageRouter< xcm_builder::ProcessXcmMessage< AggregateMessageOrigin, xcm_executor::XcmExecutor, From 5304fa1fee7d66aed59906326fc146eb301c37bf Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Mon, 26 Feb 2024 10:57:24 +0200 Subject: [PATCH 2/3] add comment --- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index c87aa7c389e2..38f0f27849c1 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -365,10 +365,14 @@ parameter_types! { impl pallet_message_queue::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = weights::pallet_message_queue::WeightInfo; - #[cfg(all(not(feature = "std"), feature = "runtime-benchmarks"))] + // Use the NoopMessageProcessor exclusively for benchmarks, not for tests with the + // runtime-benchmarks feature as tests require the BridgeHubMessageRouter to process messages. + // The "test" feature flag doesn't work, hence the reliance on the "std" feature, which is + // enabled during tests. + #[cfg(all(not(feature = "std"), not(test), feature = "runtime-benchmarks"))] type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor; - #[cfg(not(all(not(feature = "std"), feature = "runtime-benchmarks")))] + #[cfg(not(all(not(feature = "std"), not(test), feature = "runtime-benchmarks")))] type MessageProcessor = bridge_hub_common::BridgeHubMessageRouter< xcm_builder::ProcessXcmMessage< AggregateMessageOrigin, From c77a03e521cd948d89098d1f24794ab0bd913527 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Mon, 26 Feb 2024 10:59:25 +0200 Subject: [PATCH 3/3] remove the test flag --- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 38f0f27849c1..7ab60825e65e 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -369,10 +369,10 @@ impl pallet_message_queue::Config for Runtime { // runtime-benchmarks feature as tests require the BridgeHubMessageRouter to process messages. // The "test" feature flag doesn't work, hence the reliance on the "std" feature, which is // enabled during tests. - #[cfg(all(not(feature = "std"), not(test), feature = "runtime-benchmarks"))] + #[cfg(all(not(feature = "std"), feature = "runtime-benchmarks"))] type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor; - #[cfg(not(all(not(feature = "std"), not(test), feature = "runtime-benchmarks")))] + #[cfg(not(all(not(feature = "std"), feature = "runtime-benchmarks")))] type MessageProcessor = bridge_hub_common::BridgeHubMessageRouter< xcm_builder::ProcessXcmMessage< AggregateMessageOrigin,