From 6bfa8ef1d991e1d7617b1f04f580cd4b5ec36cd7 Mon Sep 17 00:00:00 2001 From: zqhxuyuan Date: Wed, 5 Jan 2022 06:23:40 +0800 Subject: [PATCH] expose handler (#20) * expose handler * rm useless code * fmt --- xcm-emulator/example/src/lib.rs | 6 ++++++ xcm-emulator/src/lib.rs | 10 ++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/xcm-emulator/example/src/lib.rs b/xcm-emulator/example/src/lib.rs index a6ff889..5286c30 100644 --- a/xcm-emulator/example/src/lib.rs +++ b/xcm-emulator/example/src/lib.rs @@ -15,6 +15,8 @@ decl_test_parachain! { pub struct YayoiPumpkin { Runtime = yayoi::Runtime, Origin = yayoi::Origin, + XcmpMessageHandler = yayoi::XcmpQueue, + DmpMessageHandler = yayoi::DmpQueue, new_ext = yayoi_ext(1), } } @@ -23,6 +25,8 @@ decl_test_parachain! { pub struct YayoiMushroom { Runtime = yayoi::Runtime, Origin = yayoi::Origin, + XcmpMessageHandler = yayoi::XcmpQueue, + DmpMessageHandler = yayoi::DmpQueue, new_ext = yayoi_ext(2), } } @@ -31,6 +35,8 @@ decl_test_parachain! { pub struct YayoiOctopus { Runtime = yayoi::Runtime, Origin = yayoi::Origin, + XcmpMessageHandler = yayoi::XcmpQueue, + DmpMessageHandler = yayoi::DmpQueue, new_ext = yayoi_ext(3), } } diff --git a/xcm-emulator/src/lib.rs b/xcm-emulator/src/lib.rs index d1856c5..b632f01 100644 --- a/xcm-emulator/src/lib.rs +++ b/xcm-emulator/src/lib.rs @@ -71,6 +71,8 @@ macro_rules! decl_test_parachain { pub struct $name:ident { Runtime = $runtime:path, Origin = $origin:path, + XcmpMessageHandler = $xcmp_message_handler:path, + DmpMessageHandler = $dmp_message_handler:path, new_ext = $new_ext:expr, } ) => { @@ -85,9 +87,7 @@ macro_rules! decl_test_parachain { ) -> $crate::Weight { use $crate::{TestExt, XcmpMessageHandler}; - $name::execute_with(|| { - $crate::cumulus_pallet_xcmp_queue::Pallet::<$runtime>::handle_xcmp_messages(iter, max_weight) - }) + $name::execute_with(|| <$xcmp_message_handler>::handle_xcmp_messages(iter, max_weight)) } } @@ -98,9 +98,7 @@ macro_rules! decl_test_parachain { ) -> $crate::Weight { use $crate::{DmpMessageHandler, TestExt}; - $name::execute_with(|| { - $crate::cumulus_pallet_dmp_queue::Pallet::<$runtime>::handle_dmp_messages(iter, max_weight) - }) + $name::execute_with(|| <$dmp_message_handler>::handle_dmp_messages(iter, max_weight)) } } };