Skip to content

Commit 94c54d5

Browse files
Snowbridge benchmark tests fix (#3424)
When running `cargo test -p bridge-hub-rococo-runtime --features runtime-benchmarks`, two of the Snowbridge benchmark tests fails. The reason is that when the runtime-benchmarks feature is enabled, the `NoopMessageProcessor` message processor is used. The Snowbridge tests rely on the outbound messages to be processed using the message queue, so that we can check the expected nonce and block digest logs. This PR changes the conditional compilation to only use `NoopMessageProcessor` when compiling the executable to run benchmarks against, not when running tests. --------- Co-authored-by: claravanstaden <Cats 4 life!>
1 parent f5de090 commit 94c54d5

File tree

1 file changed

+7
-5
lines changed
  • cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src

1 file changed

+7
-5
lines changed

cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ use polkadot_runtime_common::prod_or_fast;
102102

103103
#[cfg(feature = "runtime-benchmarks")]
104104
use benchmark_helpers::DoNothingRouter;
105-
#[cfg(not(feature = "runtime-benchmarks"))]
106-
use bridge_hub_common::BridgeHubMessageRouter;
107105

108106
/// The address format for describing accounts.
109107
pub type Address = MultiAddress<AccountId, ()>;
@@ -367,11 +365,15 @@ parameter_types! {
367365
impl pallet_message_queue::Config for Runtime {
368366
type RuntimeEvent = RuntimeEvent;
369367
type WeightInfo = weights::pallet_message_queue::WeightInfo<Runtime>;
370-
#[cfg(feature = "runtime-benchmarks")]
368+
// Use the NoopMessageProcessor exclusively for benchmarks, not for tests with the
369+
// runtime-benchmarks feature as tests require the BridgeHubMessageRouter to process messages.
370+
// The "test" feature flag doesn't work, hence the reliance on the "std" feature, which is
371+
// enabled during tests.
372+
#[cfg(all(not(feature = "std"), feature = "runtime-benchmarks"))]
371373
type MessageProcessor =
372374
pallet_message_queue::mock_helpers::NoopMessageProcessor<AggregateMessageOrigin>;
373-
#[cfg(not(feature = "runtime-benchmarks"))]
374-
type MessageProcessor = BridgeHubMessageRouter<
375+
#[cfg(not(all(not(feature = "std"), feature = "runtime-benchmarks")))]
376+
type MessageProcessor = bridge_hub_common::BridgeHubMessageRouter<
375377
xcm_builder::ProcessXcmMessage<
376378
AggregateMessageOrigin,
377379
xcm_executor::XcmExecutor<xcm_config::XcmConfig>,

0 commit comments

Comments
 (0)