mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 02:51:01 +00:00
Fix ParentOrSiblings (#2428)
We were not filtering for sibling parachains, but for sibling anything --------- Co-authored-by: Branislav Kontur <bkontur@gmail.com> Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
575b8f8d15
commit
313b2c4b6e
@@ -139,6 +139,21 @@ impl<AssetLocation: Get<MultiLocation>> ContainsPair<MultiAsset, MultiLocation>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Filter to check if a given location is the parent Relay Chain or a sibling parachain.
|
||||||
|
///
|
||||||
|
/// This type should only be used within the context of a parachain, since it does not verify that
|
||||||
|
/// the parent is indeed a Relay Chain.
|
||||||
|
pub struct ParentRelayOrSiblingParachains;
|
||||||
|
impl Contains<MultiLocation> for ParentRelayOrSiblingParachains {
|
||||||
|
fn contains(location: &MultiLocation) -> bool {
|
||||||
|
matches!(
|
||||||
|
location,
|
||||||
|
MultiLocation { parents: 1, interior: Here } |
|
||||||
|
MultiLocation { parents: 1, interior: X1(Parachain(_)) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use frame_support::{parameter_types, traits::Contains};
|
use frame_support::{parameter_types, traits::Contains};
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ use parachains_common::{
|
|||||||
impls::ToStakingPot,
|
impls::ToStakingPot,
|
||||||
xcm_config::{
|
xcm_config::{
|
||||||
AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier,
|
AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier,
|
||||||
ConcreteAssetFromSystem, RelayOrOtherSystemParachains,
|
ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains,
|
||||||
},
|
},
|
||||||
TREASURY_PALLET_ID,
|
TREASURY_PALLET_ID,
|
||||||
};
|
};
|
||||||
@@ -238,10 +238,6 @@ match_types! {
|
|||||||
MultiLocation { parents: 1, interior: Here } |
|
MultiLocation { parents: 1, interior: Here } |
|
||||||
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
||||||
};
|
};
|
||||||
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
|
|
||||||
MultiLocation { parents: 1, interior: Here } |
|
|
||||||
MultiLocation { parents: 1, interior: X1(_) }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
||||||
@@ -486,7 +482,7 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
Equals<bridging::SiblingBridgeHub>,
|
Equals<bridging::SiblingBridgeHub>,
|
||||||
)>,
|
)>,
|
||||||
// Subscriptions for version tracking are OK.
|
// Subscriptions for version tracking are OK.
|
||||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
|
||||||
),
|
),
|
||||||
UniversalLocation,
|
UniversalLocation,
|
||||||
ConstU32<8>,
|
ConstU32<8>,
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ use pallet_xcm::XcmPassthrough;
|
|||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::ToStakingPot,
|
impls::ToStakingPot,
|
||||||
xcm_config::{
|
xcm_config::{
|
||||||
AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains,
|
AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains,
|
||||||
|
RelayOrOtherSystemParachains,
|
||||||
},
|
},
|
||||||
TREASURY_PALLET_ID,
|
TREASURY_PALLET_ID,
|
||||||
};
|
};
|
||||||
@@ -126,10 +127,6 @@ match_types! {
|
|||||||
MultiLocation { parents: 1, interior: Here } |
|
MultiLocation { parents: 1, interior: Here } |
|
||||||
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
||||||
};
|
};
|
||||||
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
|
|
||||||
MultiLocation { parents: 1, interior: Here } |
|
|
||||||
MultiLocation { parents: 1, interior: X1(_) }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
||||||
@@ -212,7 +209,7 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
Equals<RelayTreasuryLocation>,
|
Equals<RelayTreasuryLocation>,
|
||||||
)>,
|
)>,
|
||||||
// Subscriptions for version tracking are OK.
|
// Subscriptions for version tracking are OK.
|
||||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
|
||||||
),
|
),
|
||||||
UniversalLocation,
|
UniversalLocation,
|
||||||
ConstU32<8>,
|
ConstU32<8>,
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ use pallet_xcm::XcmPassthrough;
|
|||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::ToStakingPot,
|
impls::ToStakingPot,
|
||||||
xcm_config::{
|
xcm_config::{
|
||||||
AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains,
|
AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains,
|
||||||
|
RelayOrOtherSystemParachains,
|
||||||
},
|
},
|
||||||
TREASURY_PALLET_ID,
|
TREASURY_PALLET_ID,
|
||||||
};
|
};
|
||||||
@@ -115,10 +116,6 @@ match_types! {
|
|||||||
MultiLocation { parents: 1, interior: Here } |
|
MultiLocation { parents: 1, interior: Here } |
|
||||||
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
||||||
};
|
};
|
||||||
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
|
|
||||||
MultiLocation { parents: 1, interior: Here } |
|
|
||||||
MultiLocation { parents: 1, interior: X1(_) }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
||||||
@@ -201,7 +198,7 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
Equals<RelayTreasuryLocation>,
|
Equals<RelayTreasuryLocation>,
|
||||||
)>,
|
)>,
|
||||||
// Subscriptions for version tracking are OK.
|
// Subscriptions for version tracking are OK.
|
||||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
|
||||||
),
|
),
|
||||||
UniversalLocation,
|
UniversalLocation,
|
||||||
ConstU32<8>,
|
ConstU32<8>,
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ use pallet_xcm::XcmPassthrough;
|
|||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::ToStakingPot,
|
impls::ToStakingPot,
|
||||||
xcm_config::{
|
xcm_config::{
|
||||||
AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains,
|
AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains,
|
||||||
|
RelayOrOtherSystemParachains,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use polkadot_parachain_primitives::primitives::Sibling;
|
use polkadot_parachain_primitives::primitives::Sibling;
|
||||||
@@ -137,10 +138,6 @@ match_types! {
|
|||||||
MultiLocation { parents: 1, interior: Here } |
|
MultiLocation { parents: 1, interior: Here } |
|
||||||
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
||||||
};
|
};
|
||||||
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
|
|
||||||
MultiLocation { parents: 1, interior: Here } |
|
|
||||||
MultiLocation { parents: 1, interior: X1(_) }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
|
||||||
@@ -242,7 +239,7 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
// Parent and its pluralities (i.e. governance bodies) get free execution.
|
||||||
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
|
||||||
// Subscriptions for version tracking are OK.
|
// Subscriptions for version tracking are OK.
|
||||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
|
||||||
),
|
),
|
||||||
UniversalLocation,
|
UniversalLocation,
|
||||||
ConstU32<8>,
|
ConstU32<8>,
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ use frame_system::EnsureRoot;
|
|||||||
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough};
|
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough};
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
xcm_config::{
|
xcm_config::{
|
||||||
AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains,
|
AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains,
|
||||||
|
RelayOrOtherSystemParachains,
|
||||||
},
|
},
|
||||||
TREASURY_PALLET_ID,
|
TREASURY_PALLET_ID,
|
||||||
};
|
};
|
||||||
@@ -124,10 +125,6 @@ match_types! {
|
|||||||
MultiLocation { parents: 1, interior: Here } |
|
MultiLocation { parents: 1, interior: Here } |
|
||||||
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
MultiLocation { parents: 1, interior: X1(Plurality { .. }) }
|
||||||
};
|
};
|
||||||
pub type ParentOrSiblings: impl Contains<MultiLocation> = {
|
|
||||||
MultiLocation { parents: 1, interior: Here } |
|
|
||||||
MultiLocation { parents: 1, interior: X1(_) }
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Barrier = TrailingSetTopicAsId<
|
pub type Barrier = TrailingSetTopicAsId<
|
||||||
@@ -150,7 +147,7 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
Equals<RelayTreasuryLocation>,
|
Equals<RelayTreasuryLocation>,
|
||||||
)>,
|
)>,
|
||||||
// Subscriptions for version tracking are OK.
|
// Subscriptions for version tracking are OK.
|
||||||
AllowSubscriptionsFrom<ParentOrSiblings>,
|
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
|
||||||
),
|
),
|
||||||
UniversalLocation,
|
UniversalLocation,
|
||||||
ConstU32<8>,
|
ConstU32<8>,
|
||||||
|
|||||||
Reference in New Issue
Block a user