Skip to content

Commit

Permalink
Optimise imports
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondkfcheung committed Jan 30, 2025
1 parent b4ca885 commit c8d0a66
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions polkadot/xcm/xcm-builder/src/tests/barriers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,6 @@ fn deny_then_try_works() {

#[test]
fn recursive_deny_and_try_xcm_works() {
use crate::barriers::RecursiveDenyThenTry;

frame_support::__private::sp_tracing::try_init_simple();

type Barrier = RecursiveDenyThenTry<DenyReserveTransferToRelayChain, AllowAll>;
Expand Down Expand Up @@ -826,36 +824,36 @@ fn deny_reserve_transfer_to_relaychain_should_work() {
assert_deny_execution(vec![ClearOrigin], Here.into_location(), Ok(()));
}

#[test]
fn deny_instructions_with_xcm_works() {
impl<Inner: DenyExecution> ShouldExecute for DenyInstructionsWithXcm<Inner> {
fn should_execute<RuntimeCall>(
origin: &Location,
instructions: &mut [Instruction<RuntimeCall>],
max_weight: Weight,
properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
Self::deny_execution(origin, instructions, max_weight, properties)
}
impl<Inner: DenyExecution> ShouldExecute for DenyInstructionsWithXcm<Inner> {
fn should_execute<RuntimeCall>(
origin: &Location,
instructions: &mut [Instruction<RuntimeCall>],
max_weight: Weight,
properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
Self::deny_execution(origin, instructions, max_weight, properties)
}
}

#[test]
fn deny_instructions_with_xcm_works() {
type Barrier = DenyInstructionsWithXcm<DenyClearOrigin>;
assert_deny_nested_instructions_with_xcm::<Barrier>(Ok(()));
}

#[test]
fn deny_first_instructions_with_xcm_works() {
impl<Inner: DenyExecution> ShouldExecute for DenyFirstInstructionsWithXcm<Inner> {
fn should_execute<RuntimeCall>(
origin: &Location,
instructions: &mut [Instruction<RuntimeCall>],
max_weight: Weight,
properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
Self::deny_execution(origin, instructions, max_weight, properties)
}
impl<Inner: DenyExecution> ShouldExecute for DenyFirstInstructionsWithXcm<Inner> {
fn should_execute<RuntimeCall>(
origin: &Location,
instructions: &mut [Instruction<RuntimeCall>],
max_weight: Weight,
properties: &mut Properties,
) -> Result<(), ProcessMessageError> {
Self::deny_execution(origin, instructions, max_weight, properties)
}
}

#[test]
fn deny_first_instructions_with_xcm_works() {
type Barrier = DenyFirstInstructionsWithXcm<DenyClearOrigin>;
assert_deny_nested_instructions_with_xcm::<Barrier>(Err(ProcessMessageError::Unsupported));
}
Expand Down

0 comments on commit c8d0a66

Please sign in to comment.