diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index f96a1e433..fff38616f 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -130,7 +130,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("bifrost_polkadot"), impl_name: create_runtime_str!("bifrost_polkadot"), authoring_version: 0, - spec_version: 987, + spec_version: 988, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/bifrost-polkadot/src/xcm_config.rs b/runtime/bifrost-polkadot/src/xcm_config.rs index 809744930..7f59128bf 100644 --- a/runtime/bifrost-polkadot/src/xcm_config.rs +++ b/runtime/bifrost-polkadot/src/xcm_config.rs @@ -306,7 +306,32 @@ impl> ShouldExecute for AllowTopLevelPaidExecutionDes } } -pub type Barrier = ( +/// Sets the message ID to `t` using a `SetTopic(t)` in the last position if present. +/// +/// Requires some inner barrier to pass on the rest of the message. +pub struct TrailingSetTopicAsId(PhantomData); +impl ShouldExecute for TrailingSetTopicAsId { + fn should_execute( + origin: &MultiLocation, + instructions: &mut [Instruction], + max_weight: Weight, + weight_credit: &mut Weight, + ) -> Result<(), ProcessMessageError> { + log::trace!( + target: "xcm::barriers", + "TrailingSetTopicAsId origin: {:?}, instructions: {:?}, max_weight: {:?}", + origin, instructions, max_weight, + ); + let until = if let Some(SetTopic(_)) = instructions.last() { + instructions.len() - 1 + } else { + instructions.len() + }; + InnerBarrier::should_execute(&origin, &mut instructions[..until], max_weight, weight_credit) + } +} + +pub type Barrier = TrailingSetTopicAsId<( // Weight that is paid for may be consumed. TakeWeightCredit, // Expected responses are OK. @@ -317,7 +342,7 @@ pub type Barrier = ( AllowSubscriptionsFrom, // Barrier allowing a top level paid message with DescendOrigin instruction AllowTopLevelPaidExecutionDescendOriginFirst, -); +)>; pub type BifrostAssetTransactor = MultiCurrencyAdapter< Currencies,