Skip to content

Commit

Permalink
fix xcm_config after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
weezy20 committed Aug 8, 2023
1 parent f03e138 commit 54d85db
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use polkadot_parachain::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use xcm::{latest::prelude::*, CreateMatcher, MatchXcm};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
CreateMatcher, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, MatchXcm,
Expand Down Expand Up @@ -122,33 +122,37 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
message: &mut [Instruction<RuntimeCall>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> Result<(), ()> {
) -> Result<(), ProcessMessageError> {
message.matcher().match_next_inst_while(
|_| true,
|inst| match inst {
InitiateReserveWithdraw {
reserve: MultiLocation { parents: 1, interior: Here },
..
} | DepositReserveAsset { dest: MultiLocation { parents: 1, interior: Here }, .. }
| TransferReserveAsset {
dest: MultiLocation { parents: 1, interior: Here },
..
}
)
}) {
return Err(()); // Deny
}

// An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve`
// should not allow this, but we just log it here.
if matches!(origin, MultiLocation { parents: 1, interior: Here })
&& message.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. }))
{
log::warn!(
target: "xcm::barriers",
"Unexpected ReserveAssetDeposited from the Relay Chain",
);
}
}
| DepositReserveAsset {
dest: MultiLocation { parents: 1, interior: Here }, ..
}
| TransferReserveAsset {
dest: MultiLocation { parents: 1, interior: Here }, ..
} => {
Err(ProcessMessageError::Unsupported) // Deny
},
// An unexpected reserve transfer has arrived from the Relay Chain. Generally,
// `IsReserve` should not allow this, but we just log it here.
ReserveAssetDeposited { .. }
if matches!(origin, MultiLocation { parents: 1, interior: Here }) =>
{
log::warn!(
target: "xcm::barrier",
"Unexpected ReserveAssetDeposited from the Relay Chain",
);
Ok(ControlFlow::Continue(()))
},
_ => Ok(ControlFlow::Continue(())),
},
)?;

// Permit everything else
Ok(())
}
Expand Down

0 comments on commit 54d85db

Please sign in to comment.