diff --git a/parachain-template/runtime/src/xcm_config.rs b/parachain-template/runtime/src/xcm_config.rs index fa056fc65d3..7a1f5798c2e 100644 --- a/parachain-template/runtime/src/xcm_config.rs +++ b/parachain-template/runtime/src/xcm_config.rs @@ -19,7 +19,7 @@ use xcm_builder::{ SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, }; -use xcm_executor::{traits::ShouldExecute, XcmExecutor}; +use xcm_executor::{traits::{RejectReason, ShouldExecute}, XcmExecutor}; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); @@ -107,7 +107,7 @@ where message: &mut [Instruction], max_weight: Weight, weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), RejectReason> { Deny::should_execute(origin, message, max_weight, weight_credit)?; Allow::should_execute(origin, message, max_weight, weight_credit) } @@ -121,7 +121,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { message: &mut [Instruction], _max_weight: Weight, _weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), RejectReason> { if message.iter().any(|inst| { matches!( inst, @@ -135,7 +135,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { } ) }) { - return Err(()) // Deny + return Err(RejectReason::ForbiddenInstructions) // Deny } // An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve` diff --git a/parachains/common/src/xcm_config.rs b/parachains/common/src/xcm_config.rs index ac4cd8858e7..ede60b3fcbd 100644 --- a/parachains/common/src/xcm_config.rs +++ b/parachains/common/src/xcm_config.rs @@ -7,7 +7,7 @@ use frame_support::{ }; use sp_runtime::traits::Get; use xcm::latest::prelude::*; -use xcm_executor::traits::ShouldExecute; +use xcm_executor::traits::{RejectReason, ShouldExecute}; //TODO: move DenyThenTry to polkadot's xcm module. /// Deny executing the XCM if it matches any of the Deny filter regardless of anything else. @@ -27,7 +27,7 @@ where message: &mut [Instruction], max_weight: Weight, weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), RejectReason> { Deny::should_execute(origin, message, max_weight, weight_credit)?; Allow::should_execute(origin, message, max_weight, weight_credit) } @@ -41,7 +41,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { message: &mut [Instruction], _max_weight: Weight, _weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), RejectReason> { if message.iter().any(|inst| { matches!( inst, @@ -55,7 +55,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { } ) }) { - return Err(()) // Deny + return Err(RejectReason::ForbiddenInstructions) // Deny } // An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve`