mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
* Remove Filter and use Contains instead * Fixes * Remove patch * Formatting * update Substrate Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -24,7 +24,7 @@ mod mock;
|
||||
mod tests;
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::traits::{Contains, EnsureOrigin, Filter, Get, OriginTrait};
|
||||
use frame_support::traits::{Contains, EnsureOrigin, Get, OriginTrait};
|
||||
use sp_runtime::{traits::BadOrigin, RuntimeDebug};
|
||||
use sp_std::{boxed::Box, convert::TryInto, marker::PhantomData, prelude::*, vec};
|
||||
use xcm::latest::prelude::*;
|
||||
@@ -352,10 +352,10 @@ where
|
||||
///
|
||||
/// May reasonably be used with `EnsureXcm`.
|
||||
pub struct IsMajorityOfBody<Prefix, Body>(PhantomData<(Prefix, Body)>);
|
||||
impl<Prefix: Get<MultiLocation>, Body: Get<BodyId>> Filter<MultiLocation>
|
||||
impl<Prefix: Get<MultiLocation>, Body: Get<BodyId>> Contains<MultiLocation>
|
||||
for IsMajorityOfBody<Prefix, Body>
|
||||
{
|
||||
fn filter(l: &MultiLocation) -> bool {
|
||||
fn contains(l: &MultiLocation) -> bool {
|
||||
let maybe_suffix = l.match_and_split(&Prefix::get());
|
||||
matches!(maybe_suffix, Some(Plurality { id, part }) if id == &Body::get() && part.is_majority())
|
||||
}
|
||||
@@ -364,7 +364,7 @@ impl<Prefix: Get<MultiLocation>, Body: Get<BodyId>> Filter<MultiLocation>
|
||||
/// `EnsureOrigin` implementation succeeding with a `MultiLocation` value to recognize and filter the
|
||||
/// `Origin::Xcm` item.
|
||||
pub struct EnsureXcm<F>(PhantomData<F>);
|
||||
impl<O: OriginTrait + From<Origin>, F: Filter<MultiLocation>> EnsureOrigin<O> for EnsureXcm<F>
|
||||
impl<O: OriginTrait + From<Origin>, F: Contains<MultiLocation>> EnsureOrigin<O> for EnsureXcm<F>
|
||||
where
|
||||
O::PalletsOrigin: From<Origin> + TryInto<Origin, Error = O::PalletsOrigin>,
|
||||
{
|
||||
@@ -373,7 +373,7 @@ where
|
||||
fn try_origin(outer: O) -> Result<Self::Success, O> {
|
||||
outer.try_with_caller(|caller| {
|
||||
caller.try_into().and_then(|Origin::Xcm(location)| {
|
||||
if F::filter(&location) {
|
||||
if F::contains(&location) {
|
||||
Ok(location)
|
||||
} else {
|
||||
Err(Origin::Xcm(location).into())
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{All, AllowAll},
|
||||
weights::Weight,
|
||||
};
|
||||
use frame_support::{construct_runtime, parameter_types, traits::Everything, weights::Weight};
|
||||
use polkadot_parachain::primitives::Id as ParaId;
|
||||
use polkadot_runtime_parachains::origin;
|
||||
use sp_core::H256;
|
||||
@@ -108,7 +104,7 @@ impl frame_system::Config for Test {
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type DbWeight = ();
|
||||
type BaseCallFilter = AllowAll;
|
||||
type BaseCallFilter = Everything;
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
@@ -157,7 +153,7 @@ parameter_types! {
|
||||
pub CurrencyPerSecond: (AssetId, u128) = (Concrete(RelayLocation::get()), 1);
|
||||
}
|
||||
|
||||
pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom<All<MultiLocation>>);
|
||||
pub type Barrier = (TakeWeightCredit, AllowTopLevelPaidExecutionFrom<Everything>);
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl xcm_executor::Config for XcmConfig {
|
||||
@@ -181,10 +177,10 @@ impl pallet_xcm::Config for Test {
|
||||
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type XcmRouter = (TestSendXcmErrX8, TestSendXcm);
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = All<(MultiLocation, xcm::latest::Xcm<Call>)>;
|
||||
type XcmExecuteFilter = Everything;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = All<(MultiLocation, Vec<MultiAsset>)>;
|
||||
type XcmReserveTransferFilter = All<(MultiLocation, Vec<MultiAsset>)>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, Call>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use codec::{Decode, Encode};
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{All, AllowAll},
|
||||
traits::Everything,
|
||||
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
||||
};
|
||||
use sp_core::H256;
|
||||
@@ -71,7 +71,7 @@ impl frame_system::Config for Runtime {
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type DbWeight = ();
|
||||
type BaseCallFilter = AllowAll;
|
||||
type BaseCallFilter = Everything;
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
@@ -127,7 +127,7 @@ pub type LocalAssetTransactor =
|
||||
XcmCurrencyAdapter<Balances, IsConcrete<KsmLocation>, LocationToAccountId, AccountId, ()>;
|
||||
|
||||
pub type XcmRouter = super::ParachainXcmRouter<MsgQueue>;
|
||||
pub type Barrier = AllowUnpaidExecutionFrom<All<MultiLocation>>;
|
||||
pub type Barrier = AllowUnpaidExecutionFrom<Everything>;
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl Config for XcmConfig {
|
||||
@@ -288,10 +288,10 @@ impl pallet_xcm::Config for Runtime {
|
||||
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type XcmRouter = XcmRouter;
|
||||
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = All<(MultiLocation, Xcm<Call>)>;
|
||||
type XcmExecuteFilter = Everything;
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = ();
|
||||
type XcmReserveTransferFilter = All<(MultiLocation, Vec<MultiAsset>)>;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,7 @@
|
||||
|
||||
//! Relay chain runtime mock.
|
||||
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{All, AllowAll},
|
||||
weights::Weight,
|
||||
};
|
||||
use frame_support::{construct_runtime, parameter_types, traits::Everything, weights::Weight};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32};
|
||||
|
||||
@@ -62,7 +58,7 @@ impl frame_system::Config for Runtime {
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type DbWeight = ();
|
||||
type BaseCallFilter = AllowAll;
|
||||
type BaseCallFilter = Everything;
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = ();
|
||||
type OnSetCode = ();
|
||||
@@ -117,7 +113,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
pub type XcmRouter = super::RelayChainXcmRouter;
|
||||
pub type Barrier = AllowUnpaidExecutionFrom<All<MultiLocation>>;
|
||||
pub type Barrier = AllowUnpaidExecutionFrom<Everything>;
|
||||
|
||||
pub struct XcmConfig;
|
||||
impl Config for XcmConfig {
|
||||
@@ -144,8 +140,8 @@ impl pallet_xcm::Config for Runtime {
|
||||
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
|
||||
type XcmExecuteFilter = ();
|
||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||
type XcmTeleportFilter = All<(MultiLocation, Vec<MultiAsset>)>;
|
||||
type XcmReserveTransferFilter = All<(MultiLocation, Vec<MultiAsset>)>;
|
||||
type XcmTeleportFilter = Everything;
|
||||
type XcmReserveTransferFilter = Everything;
|
||||
type Weigher = FixedWeightBounds<BaseXcmWeight, Call>;
|
||||
type LocationInverter = LocationInverter<Ancestry>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user