This commit is contained in:
Keith Yeung
2022-03-10 23:25:36 -08:00
parent 9e70ba8317
commit 484e63daf1
3 changed files with 14 additions and 14 deletions
+5 -3
View File
@@ -345,7 +345,10 @@ mod tests {
};
use sp_version::RuntimeVersion;
use std::cell::RefCell;
use xcm::latest::{MultiLocation, OriginKind, Weightless};
use xcm::{
latest::{MultiLocation, OriginKind},
v3::traits::Weightless,
};
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
@@ -428,12 +431,11 @@ mod tests {
Err(message)
}
fn execute_xcm_in_credit(
fn execute(
_origin: impl Into<MultiLocation>,
message: Xcm,
_hash: XcmHash,
weight_limit: Weight,
_credit: Weight,
) -> Outcome {
let o = match (message.0.len(), &message.0.first()) {
(1, Some(Transact { require_weight_at_most, .. })) => {
+5 -7
View File
@@ -52,7 +52,7 @@ use rand_chacha::{
ChaChaRng,
};
use scale_info::TypeInfo;
use sp_runtime::{traits::Hash, RuntimeDebug};
use sp_runtime::RuntimeDebug;
use sp_std::{convert::TryFrom, prelude::*};
use xcm::{latest::prelude::*, VersionedXcm, WrapVersion, MAX_XCM_DECODE_DEPTH};
use xcm_executor::traits::ConvertOrigin;
@@ -598,7 +598,7 @@ impl<T: Config> Pallet<T> {
log::debug!("Processing XCMP-XCM: {:?}", &hash);
let (result, event) = match Xcm::<T::Call>::try_from(xcm) {
Ok(xcm) => {
let location = (1, Parachain(sender.into()));
let location = (Parent, Parachain(sender.into()));
match T::XcmExecutor::execute_xcm(location, xcm, hash, max_weight) {
Outcome::Error(e) => (Err(e.clone()), Event::Fail(Some(hash), e)),
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
@@ -1099,7 +1099,7 @@ impl<T: Config> SendXcm for Pallet<T> {
_ => {
*dest = Some(d);
Err(SendError::NotApplicable)
}
},
}
}
@@ -1110,10 +1110,8 @@ impl<T: Config> SendXcm for Pallet<T> {
Ok(_) => {
Self::deposit_event(Event::XcmpMessageSent(Some(hash)));
Ok(hash)
}
Err(e) => {
Err(SendError::Transport(<&'static str>::from(e)))
}
},
Err(e) => Err(SendError::Transport(<&'static str>::from(e))),
}
}
}
+4 -4
View File
@@ -89,8 +89,8 @@ pub mod pallet {
*seq += 1;
*seq
});
match T::XcmSender::send_xcm(
(1, Junction::Parachain(para.into())),
match send_xcm::<T::XcmSender>(
(Parent, Junction::Parachain(para.into())),
Xcm(vec![Transact {
origin_kind: OriginKind::Native,
require_weight_at_most: 1_000,
@@ -165,8 +165,8 @@ pub mod pallet {
let para = ensure_sibling_para(<T as Config>::Origin::from(origin))?;
Self::deposit_event(Event::Pinged(para, seq, payload.clone()));
match T::XcmSender::send_xcm(
(1, Junction::Parachain(para.into())),
match send_xcm::<T::XcmSender>(
(Parent, Junction::Parachain(para.into())),
Xcm(vec![Transact {
origin_kind: OriginKind::Native,
require_weight_at_most: 1_000,