Skip to content
Snippets Groups Projects
Commit 359ade2b authored by Gavin Wood's avatar Gavin Wood Committed by GitHub
Browse files

Dedupe some code and companion for #8589 (#2873)

* Dedupe some code and companion for #8589

* Bump Substrate
parent 025200fb
Branches
No related merge requests found
This diff is collapsed.
......@@ -41,7 +41,7 @@ use runtime_parachains::{
};
use frame_support::{
construct_runtime, parameter_types,
traits::{Filter, KeyOwnerProofSystem, Randomness},
traits::{Filter, KeyOwnerProofSystem, Randomness, All, IsInVec},
weights::Weight,
PalletId
};
......@@ -618,16 +618,6 @@ parameter_types! {
pub AllowUnpaidFrom: Vec<MultiLocation> = vec![ X1(Parachain{id: 100}), X1(Parachain{id: 110}), X1(Parachain{id: 120}) ];
}
pub struct All<T>(sp_std::marker::PhantomData<T>);
impl<T: Ord> frame_support::traits::Contains<T> for All<T> {
fn contains(_: &T) -> bool { true }
fn sorted_members() -> Vec<T> { vec![] }
}
pub struct IsInVec<T>(sp_std::marker::PhantomData<T>);
impl<X: Ord + PartialOrd, T: frame_support::traits::Get<Vec<X>>> frame_support::traits::Contains<X> for IsInVec<T> {
fn sorted_members() -> Vec<X> { let mut r = T::get(); r.sort(); r }
}
use xcm_builder::{TakeWeightCredit, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom};
pub type Barrier = (
TakeWeightCredit,
......
......@@ -26,7 +26,7 @@ pub use frame_support::{
dispatch::{Dispatchable, Parameter, Weight, DispatchError, DispatchResultWithPostInfo, DispatchInfo},
weights::{PostDispatchInfo, GetDispatchInfo},
sp_runtime::DispatchErrorWithPostInfo,
traits::{Get, Contains},
traits::{Get, Contains, IsInVec},
};
pub use xcm_executor::{
Assets, Config, traits::{TransactAsset, ConvertOrigin, FilterAssetLocation, InvertLocation, OnResponse}
......@@ -254,11 +254,6 @@ parameter_types! {
pub static WeightPrice: (MultiLocation, u128) = (Null, 1_000_000_000_000);
}
pub struct IsInVec<T>(PhantomData<T>);
impl<X: Ord + PartialOrd, T: Get<Vec<X>>> Contains<X> for IsInVec<T> {
fn sorted_members() -> Vec<X> { let mut r = T::get(); r.sort(); r }
}
pub type TestBarrier = (
TakeWeightCredit,
AllowKnownQueryResponses<TestResponseHandler>,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment