Make xcm-simulator async with more tests (#3618)

* make xcm simulator async

* fmt

* nightly fmt

* Update xcm/xcm-simulator/example/src/parachain.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* accept keith review suggestion

* master.into

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Amar Singh
2021-08-17 17:48:28 -04:00
committed by GitHub
parent 7b054850fb
commit 6718e10f20
3 changed files with 249 additions and 30 deletions
@@ -166,6 +166,11 @@ pub mod mock_msg_queue {
#[pallet::getter(fn parachain_id)]
pub(super) type ParachainId<T: Config> = StorageValue<_, ParaId, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn received_dmp)]
/// A queue of received DMP messages
pub(super) type ReceivedDmp<T: Config> = StorageValue<_, Vec<Xcm<T::Call>>, ValueQuery>;
impl<T: Config> Get<ParaId> for Pallet<T> {
fn get() -> ParaId {
Self::parachain_id()
@@ -266,7 +271,8 @@ pub mod mock_msg_queue {
Self::deposit_event(Event::UnsupportedVersion(id));
},
Ok(Ok(x)) => {
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x, limit);
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x.clone(), limit);
<ReceivedDmp<T>>::append(x);
Self::deposit_event(Event::ExecutedDownward(id, outcome));
},
}