Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion for paritytech/polkadot#6670 #2174

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions parachain-template/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -107,7 +107,7 @@ where
message: &mut [Instruction<RuntimeCall>],
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)
}
Expand All @@ -121,7 +121,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
message: &mut [Instruction<RuntimeCall>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> Result<(), ()> {
) -> Result<(), RejectReason> {
if message.iter().any(|inst| {
matches!(
inst,
Expand All @@ -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`
Expand Down
8 changes: 4 additions & 4 deletions parachains/common/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -27,7 +27,7 @@ where
message: &mut [Instruction<RuntimeCall>],
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)
}
Expand All @@ -41,7 +41,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
message: &mut [Instruction<RuntimeCall>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> Result<(), ()> {
) -> Result<(), RejectReason> {
if message.iter().any(|inst| {
matches!(
inst,
Expand All @@ -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`
Expand Down