Skip to content

Commit

Permalink
expose handler (#20)
Browse files Browse the repository at this point in the history
* expose handler

* rm useless code

* fmt
  • Loading branch information
zqhxuyuan authored Jan 4, 2022
1 parent 4d3bb9d commit 87af52d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions xcm-emulator/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
Expand All @@ -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),
}
}
Expand All @@ -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),
}
}
Expand Down
10 changes: 4 additions & 6 deletions xcm-emulator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
) => {
Expand All @@ -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))
}
}

Expand All @@ -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))
}
}
};
Expand Down

0 comments on commit 87af52d

Please sign in to comment.