This commit is contained in:
Keith Yeung
2022-09-22 23:16:22 +08:00
parent 1dba83a903
commit e02878e87a
4 changed files with 11 additions and 6 deletions
+2 -1
View File
@@ -240,7 +240,8 @@ pub mod pallet {
Ok(Weight::zero()) Ok(Weight::zero())
}, },
Ok(Ok(x)) => { Ok(Ok(x)) => {
let outcome = T::XcmExecutor::execute_xcm(Parent, x, message_id, limit.ref_time()); let outcome =
T::XcmExecutor::execute_xcm(Parent, x, message_id, limit.ref_time());
match outcome { match outcome {
Outcome::Error(XcmError::WeightLimitReached(required)) => Outcome::Error(XcmError::WeightLimitReached(required)) =>
Err((message_id, Weight::from_ref_time(required))), Err((message_id, Weight::from_ref_time(required))),
@@ -284,7 +284,8 @@ fn check_inherents_are_unsigned_and_before_all_other_extrinsics() {
.expect("Runs the test"); .expect("Runs the test");
assert!(output.status.success()); assert!(output.status.success());
assert!(String::from_utf8(output.stderr).unwrap() assert!(String::from_utf8(output.stderr)
.unwrap()
.contains("Could not find `set_validation_data` inherent")); .contains("Could not find `set_validation_data` inherent"));
} }
} }
+2 -1
View File
@@ -157,7 +157,8 @@ impl<T: Config> DmpMessageHandler for LimitAndDropDmpExecution<T> {
Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)), Ok(Err(())) => Pallet::<T>::deposit_event(Event::UnsupportedVersion(id)),
Ok(Ok(x)) => { Ok(Ok(x)) => {
let weight_limit = limit.saturating_sub(used); let weight_limit = limit.saturating_sub(used);
let outcome = T::XcmExecutor::execute_xcm(Parent, x, id, weight_limit.ref_time()); let outcome =
T::XcmExecutor::execute_xcm(Parent, x, id, weight_limit.ref_time());
used += Weight::from_ref_time(outcome.weight_used()); used += Weight::from_ref_time(outcome.weight_used());
Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome)); Pallet::<T>::deposit_event(Event::ExecutedDownward(id, outcome));
}, },
+5 -3
View File
@@ -2,7 +2,7 @@ use crate::impls::AccountIdOf;
use core::marker::PhantomData; use core::marker::PhantomData;
use frame_support::{ use frame_support::{
log, log,
traits::{fungibles::Inspect, tokens::BalanceConversion}, traits::{fungibles::Inspect, tokens::BalanceConversion, ContainsPair},
weights::{Weight, WeightToFee, WeightToFeePolynomial}, weights::{Weight, WeightToFee, WeightToFeePolynomial},
}; };
use sp_runtime::traits::Get; use sp_runtime::traits::Get;
@@ -111,8 +111,10 @@ where
/// Accepts an asset if it is a native asset from a particular `MultiLocation`. /// Accepts an asset if it is a native asset from a particular `MultiLocation`.
pub struct ConcreteNativeAssetFrom<Location>(PhantomData<Location>); pub struct ConcreteNativeAssetFrom<Location>(PhantomData<Location>);
impl<Location: Get<MultiLocation>> FilterAssetLocation for ConcreteNativeAssetFrom<Location> { impl<Location: Get<MultiLocation>> ContainsPair<MultiAsset, MultiLocation>
fn filter_asset_location(asset: &MultiAsset, origin: &MultiLocation) -> bool { for ConcreteNativeAssetFrom<Location>
{
fn contains(asset: &MultiAsset, origin: &MultiLocation) -> bool {
log::trace!(target: "xcm::filter_asset_location", log::trace!(target: "xcm::filter_asset_location",
"ConcreteNativeAsset asset: {:?}, origin: {:?}, location: {:?}", "ConcreteNativeAsset asset: {:?}, origin: {:?}, location: {:?}",
asset, origin, Location::get()); asset, origin, Location::get());