Skip to content

Commit b118c08

Browse files
committed
More tests
1 parent f52a595 commit b118c08

File tree

1 file changed

+33
-40
lines changed

1 file changed

+33
-40
lines changed

runtimes/bulletin-polkadot/src/xcm_config.rs

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ pub(crate) mod tests {
283283
use pallet_bridge_messages::Config as MessagesConfig;
284284
use sp_keyring::Sr25519Keyring as AccountKeyring;
285285
use xcm_builder::BridgeMessage;
286+
use xcm_executor::traits::Properties;
286287

287288
type Dispatcher =
288289
<Runtime as MessagesConfig<WithPeoplePolkadotMessagesInstance>>::MessageDispatch;
@@ -399,44 +400,36 @@ pub(crate) mod tests {
399400
// })
400401
// }
401402
//
402-
// #[test]
403-
// fn encoded_test_xcm_message_to_bulletin_chain() {
404-
// // this "test" is currently used to encode dummy message for Polkadot BH -> Bulletin
405-
// // bridge. Once we have real sending chain (Kawabunga), it could be removed
406-
// println!("{}", hex::encode(&encoded_xcm_message_from_bridge_hub_polkadot()));
407-
// }
408-
//
409-
// #[test]
410-
// fn expected_message_from_kawabunga_passes_barrier() {
411-
// // prepare message that we expect to come from the Polkadot BH
412-
// // (everything is relative to Polkadot BH)
413-
// let bridge_hub_universal_location = X2(GlobalConsensus(Polkadot), Parachain(1002));
414-
// let kawabunga_origin = MultiLocation::new(1, Parachain(KAWABUNGA_PARACHAIN_ID));
415-
// let universal_source =
416-
// bridge_hub_universal_location.within_global(kawabunga_origin).unwrap();
417-
// let (local_net, local_sub) = universal_source.split_global().unwrap();
418-
// let mut xcm: Xcm<RuntimeCall> = vec![
419-
// UniversalOrigin(GlobalConsensus(local_net)),
420-
// DescendOrigin(local_sub),
421-
// Transact {
422-
// origin_kind: OriginKind::Superuser,
423-
// require_weight_at_most: Weight::MAX,
424-
// call: RuntimeCall::System(frame_system::Call::remark { remark: vec![42] })
425-
// .encode()
426-
// .into(),
427-
// },
428-
// ]
429-
// .into();
430-
//
431-
// // ensure that it passes local XCM Barrier
432-
// assert_eq!(
433-
// Barrier::should_execute(
434-
// &Here.into(),
435-
// xcm.inner_mut(),
436-
// Weight::MAX,
437-
// &mut Properties { weight_credit: Weight::MAX, message_id: None },
438-
// ),
439-
// Ok(())
440-
// );
441-
// }
403+
#[test]
404+
fn expected_message_from_people_polkadot_passes_barrier() {
405+
// prepare a message that we expect to come from the Polkadot BH
406+
// (everything is relative to Polkadot BH)
407+
let people_polkadot_as_universal_source: InteriorLocation =
408+
[GlobalConsensus(BridgedNetwork::get()), Parachain(PEOPLE_POLKADOT_PARACHAIN_ID)]
409+
.into();
410+
let (local_net, local_sub) = people_polkadot_as_universal_source.split_global().unwrap();
411+
let mut xcm: Xcm<RuntimeCall> = vec![
412+
UniversalOrigin(GlobalConsensus(local_net)),
413+
DescendOrigin(local_sub),
414+
Transact {
415+
origin_kind: OriginKind::Superuser,
416+
fallback_max_weight: None,
417+
call: RuntimeCall::System(frame_system::Call::remark { remark: vec![42] })
418+
.encode()
419+
.into(),
420+
},
421+
]
422+
.into();
423+
424+
// ensure that it passes local XCM Barrier
425+
assert_eq!(
426+
Barrier::should_execute(
427+
&Here.into(),
428+
xcm.inner_mut(),
429+
Weight::MAX,
430+
&mut Properties { weight_credit: Weight::MAX, message_id: None },
431+
),
432+
Ok(())
433+
);
434+
}
442435
}

0 commit comments

Comments
 (0)