Rename polkadot-parachain to polkadot-parachain-primitives (#1334)

* Rename `polkadot-parachain` to `polkadot-parachain-primitives`

While doing this it also fixes some last `rustdoc` issues and fixes
another Cargo warning related to `pallet-paged-list`.

* Fix compilation

* ".git/.scripts/commands/fmt/fmt.sh"

* Fix XCM docs

---------

Co-authored-by: command-bot <>
This commit is contained in:
Bastian Köcher
2023-08-31 23:53:29 +02:00
committed by GitHub
parent ea5792508e
commit a33d7922f8
114 changed files with 249 additions and 260 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ xcm-executor = { package = "staging-xcm-executor", path = "../xcm-executor", def
[dev-dependencies]
pallet-balances = { path = "../../../substrate/frame/balances" }
polkadot-runtime-parachains = { path = "../../runtime/parachains" }
polkadot-parachain = { path = "../../parachain" }
polkadot-parachain-primitives = { path = "../../parachain" }
xcm-builder = { package = "staging-xcm-builder", path = "../xcm-builder" }
[features]
@@ -54,7 +54,7 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
+1 -1
View File
@@ -21,7 +21,7 @@ use frame_support::{
weights::Weight,
};
use frame_system::EnsureRoot;
use polkadot_parachain::primitives::Id as ParaId;
use polkadot_parachain_primitives::primitives::Id as ParaId;
use polkadot_runtime_parachains::origin;
use sp_core::H256;
use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage};
+1 -1
View File
@@ -24,7 +24,7 @@ use frame_support::{
traits::{Currency, Hooks},
weights::Weight,
};
use polkadot_parachain::primitives::Id as ParaId;
use polkadot_parachain_primitives::primitives::Id as ParaId;
use sp_runtime::traits::{AccountIdConversion, BlakeTwo256, Hash};
use xcm::{latest::QueryResponseInfo, prelude::*};
use xcm_builder::AllowKnownQueryResponses;
-8
View File
@@ -239,14 +239,12 @@ impl MultiLocation {
/// # Example
/// ```rust
/// # use staging_xcm::v2::{Junctions::*, Junction::*, MultiLocation};
/// # fn main() {
/// let mut m = MultiLocation::new(1, X2(PalletInstance(3), OnlyChild));
/// assert_eq!(
/// m.match_and_split(&MultiLocation::new(1, X1(PalletInstance(3)))),
/// Some(&OnlyChild),
/// );
/// assert_eq!(m.match_and_split(&MultiLocation::new(1, Here)), None);
/// # }
/// ```
pub fn match_and_split(&self, prefix: &MultiLocation) -> Option<&Junction> {
if self.parents != prefix.parents {
@@ -280,11 +278,9 @@ impl MultiLocation {
/// # Example
/// ```rust
/// # use staging_xcm::v2::{Junctions::*, Junction::*, MultiLocation};
/// # fn main() {
/// let mut m = MultiLocation::new(1, X1(Parachain(21)));
/// assert_eq!(m.append_with(X1(PalletInstance(3))), Ok(()));
/// assert_eq!(m, MultiLocation::new(1, X2(Parachain(21), PalletInstance(3))));
/// # }
/// ```
pub fn append_with(&mut self, suffix: Junctions) -> Result<(), Junctions> {
if self.interior.len().saturating_add(suffix.len()) > MAX_JUNCTIONS {
@@ -303,11 +299,9 @@ impl MultiLocation {
/// # Example
/// ```rust
/// # use staging_xcm::v2::{Junctions::*, Junction::*, MultiLocation};
/// # fn main() {
/// let mut m = MultiLocation::new(2, X1(PalletInstance(3)));
/// assert_eq!(m.prepend_with(MultiLocation::new(1, X2(Parachain(21), OnlyChild))), Ok(()));
/// assert_eq!(m, MultiLocation::new(1, X1(PalletInstance(3))));
/// # }
/// ```
pub fn prepend_with(&mut self, mut prefix: MultiLocation) -> Result<(), MultiLocation> {
// prefix self (suffix)
@@ -840,11 +834,9 @@ impl Junctions {
/// # Example
/// ```rust
/// # use staging_xcm::v2::{Junctions::*, Junction::*};
/// # fn main() {
/// let mut m = X3(Parachain(2), PalletInstance(3), OnlyChild);
/// assert_eq!(m.match_and_split(&X2(Parachain(2), PalletInstance(3))), Some(&OnlyChild));
/// assert_eq!(m.match_and_split(&X1(Parachain(2))), None);
/// # }
/// ```
pub fn match_and_split(&self, prefix: &Junctions) -> Option<&Junction> {
if prefix.len() + 1 != self.len() || !self.starts_with(prefix) {
-4
View File
@@ -438,11 +438,9 @@ impl Junctions {
/// # Example
/// ```rust
/// # use staging_xcm::v3::{Junctions::*, Junction::*, MultiLocation};
/// # fn main() {
/// let mut m = X1(Parachain(21));
/// assert_eq!(m.append_with(X1(PalletInstance(3))), Ok(()));
/// assert_eq!(m, X2(Parachain(21), PalletInstance(3)));
/// # }
/// ```
pub fn append_with(&mut self, suffix: impl Into<Junctions>) -> Result<(), Junctions> {
let suffix = suffix.into();
@@ -569,11 +567,9 @@ impl Junctions {
/// # Example
/// ```rust
/// # use staging_xcm::v3::{Junctions::*, Junction::*};
/// # fn main() {
/// let mut m = X3(Parachain(2), PalletInstance(3), OnlyChild);
/// assert_eq!(m.match_and_split(&X2(Parachain(2), PalletInstance(3))), Some(&OnlyChild));
/// assert_eq!(m.match_and_split(&X1(Parachain(2))), None);
/// # }
/// ```
pub fn match_and_split(&self, prefix: &Junctions) -> Option<&Junction> {
if prefix.len() + 1 != self.len() {
-10
View File
@@ -266,14 +266,12 @@ impl MultiLocation {
/// # Example
/// ```rust
/// # use staging_xcm::v3::{Junctions::*, Junction::*, MultiLocation};
/// # fn main() {
/// let mut m = MultiLocation::new(1, X2(PalletInstance(3), OnlyChild));
/// assert_eq!(
/// m.match_and_split(&MultiLocation::new(1, X1(PalletInstance(3)))),
/// Some(&OnlyChild),
/// );
/// assert_eq!(m.match_and_split(&MultiLocation::new(1, Here)), None);
/// # }
/// ```
pub fn match_and_split(&self, prefix: &MultiLocation) -> Option<&Junction> {
if self.parents != prefix.parents {
@@ -293,11 +291,9 @@ impl MultiLocation {
/// # Example
/// ```rust
/// # use staging_xcm::v3::{Junctions::*, Junction::*, MultiLocation, Parent};
/// # fn main() {
/// let mut m: MultiLocation = (Parent, Parachain(21), 69u64).into();
/// assert_eq!(m.append_with((Parent, PalletInstance(3))), Ok(()));
/// assert_eq!(m, MultiLocation::new(1, X2(Parachain(21), PalletInstance(3))));
/// # }
/// ```
pub fn append_with(&mut self, suffix: impl Into<Self>) -> Result<(), Self> {
let prefix = core::mem::replace(self, suffix.into());
@@ -314,11 +310,9 @@ impl MultiLocation {
/// # Example
/// ```rust
/// # use staging_xcm::v3::{Junctions::*, Junction::*, MultiLocation, Parent};
/// # fn main() {
/// let mut m: MultiLocation = (Parent, Parachain(21), 69u64).into();
/// let r = m.appended_with((Parent, PalletInstance(3))).unwrap();
/// assert_eq!(r, MultiLocation::new(1, X2(Parachain(21), PalletInstance(3))));
/// # }
/// ```
pub fn appended_with(mut self, suffix: impl Into<Self>) -> Result<Self, (Self, Self)> {
match self.append_with(suffix) {
@@ -334,11 +328,9 @@ impl MultiLocation {
/// # Example
/// ```rust
/// # use staging_xcm::v3::{Junctions::*, Junction::*, MultiLocation, Parent};
/// # fn main() {
/// let mut m: MultiLocation = (Parent, Parent, PalletInstance(3)).into();
/// assert_eq!(m.prepend_with((Parent, Parachain(21), OnlyChild)), Ok(()));
/// assert_eq!(m, MultiLocation::new(1, X1(PalletInstance(3))));
/// # }
/// ```
pub fn prepend_with(&mut self, prefix: impl Into<Self>) -> Result<(), Self> {
// prefix self (suffix)
@@ -383,11 +375,9 @@ impl MultiLocation {
/// # Example
/// ```rust
/// # use staging_xcm::v3::{Junctions::*, Junction::*, MultiLocation, Parent};
/// # fn main() {
/// let m: MultiLocation = (Parent, Parent, PalletInstance(3)).into();
/// let r = m.prepended_with((Parent, Parachain(21), OnlyChild)).unwrap();
/// assert_eq!(r, MultiLocation::new(1, X1(PalletInstance(3))));
/// # }
/// ```
pub fn prepended_with(mut self, prefix: impl Into<Self>) -> Result<Self, (Self, Self)> {
match self.prepend_with(prefix) {
+3 -3
View File
@@ -23,7 +23,7 @@ pallet-transaction-payment = { path = "../../../substrate/frame/transaction-paym
log = { version = "0.4.17", default-features = false }
# Polkadot dependencies
polkadot-parachain = { path = "../../parachain", default-features = false }
polkadot-parachain-primitives = { path = "../../parachain", default-features = false }
[dev-dependencies]
primitive-types = "0.12.1"
@@ -45,7 +45,7 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"pallet-salary/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"polkadot-test-runtime/runtime-benchmarks",
"primitives/runtime-benchmarks",
@@ -58,7 +58,7 @@ std = [
"log/std",
"pallet-transaction-payment/std",
"parity-scale-codec/std",
"polkadot-parachain/std",
"polkadot-parachain-primitives/std",
"scale-info/std",
"sp-arithmetic/std",
"sp-io/std",
+1 -1
View File
@@ -21,7 +21,7 @@ use frame_support::{
ensure,
traits::{Contains, Get, ProcessMessageError},
};
use polkadot_parachain::primitives::IsSystem;
use polkadot_parachain_primitives::primitives::IsSystem;
use sp_std::{cell::Cell, marker::PhantomData, ops::ControlFlow, result::Result};
use xcm::prelude::*;
use xcm_executor::traits::{CheckSuspension, OnResponse, Properties, ShouldExecute};
@@ -18,7 +18,7 @@
use frame_support::traits::{EnsureOrigin, Get, GetBacking, OriginTrait};
use frame_system::RawOrigin as SystemRawOrigin;
use polkadot_parachain::primitives::IsSystem;
use polkadot_parachain_primitives::primitives::IsSystem;
use sp_runtime::traits::TryConvert;
use sp_std::marker::PhantomData;
use xcm::latest::{BodyId, BodyPart, Junction, Junctions::*, MultiLocation, NetworkId, OriginKind};
+1 -1
View File
@@ -25,7 +25,7 @@ use primitive_types::H256;
use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage};
use sp_std::cell::RefCell;
use polkadot_parachain::primitives::Id as ParaId;
use polkadot_parachain_primitives::primitives::Id as ParaId;
use polkadot_runtime_parachains::{configuration, origin, shared};
use xcm::latest::{opaque, prelude::*};
use xcm_executor::XcmExecutor;
+1 -1
View File
@@ -20,7 +20,7 @@ use mock::{
fake_message_hash, kusama_like_with_balances, AccountId, Balance, Balances, BaseXcmWeight,
System, XcmConfig, CENTS,
};
use polkadot_parachain::primitives::Id as ParaId;
use polkadot_parachain_primitives::primitives::Id as ParaId;
use sp_runtime::traits::AccountIdConversion;
use xcm::latest::prelude::*;
use xcm_executor::XcmExecutor;
+1 -1
View File
@@ -18,5 +18,5 @@ xcm = { package = "staging-xcm", path = ".." }
xcm-executor = { package = "staging-xcm-executor", path = "../xcm-executor" }
xcm-builder = { package = "staging-xcm-builder", path = "../xcm-builder" }
polkadot-core-primitives = { path = "../../core-primitives" }
polkadot-parachain = { path = "../../parachain" }
polkadot-parachain-primitives = { path = "../../parachain" }
polkadot-runtime-parachains = { path = "../../runtime/parachains" }
@@ -29,7 +29,7 @@ xcm-builder = { package = "staging-xcm-builder", path = "../../xcm-builder" }
pallet-xcm = { path = "../../pallet-xcm" }
polkadot-core-primitives = { path = "../../../core-primitives" }
polkadot-runtime-parachains = { path = "../../../runtime/parachains" }
polkadot-parachain = { path = "../../../parachain" }
polkadot-parachain-primitives = { path = "../../../parachain" }
[features]
default = []
@@ -40,7 +40,7 @@ runtime-benchmarks = [
"pallet-message-queue/runtime-benchmarks",
"pallet-uniques/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
@@ -34,7 +34,7 @@ use sp_std::prelude::*;
use pallet_xcm::XcmPassthrough;
use polkadot_core_primitives::BlockNumber as RelayBlockNumber;
use polkadot_parachain::primitives::{
use polkadot_parachain_primitives::primitives::{
DmpMessageHandler, Id as ParaId, Sibling, XcmpMessageFormat, XcmpMessageHandler,
};
use xcm::{latest::prelude::*, VersionedXcm};
@@ -26,7 +26,7 @@ use frame_system::EnsureRoot;
use sp_core::{ConstU32, H256};
use sp_runtime::{traits::IdentityLookup, AccountId32};
use polkadot_parachain::primitives::Id as ParaId;
use polkadot_parachain_primitives::primitives::Id as ParaId;
use polkadot_runtime_parachains::{
configuration,
inclusion::{AggregateMessageOrigin, UmpQueueId},
+2 -2
View File
@@ -29,7 +29,7 @@ xcm-builder = { package = "staging-xcm-builder", path = "../../xcm-builder" }
pallet-xcm = { path = "../../pallet-xcm" }
polkadot-core-primitives = { path = "../../../core-primitives" }
polkadot-runtime-parachains = { path = "../../../runtime/parachains" }
polkadot-parachain = { path = "../../../parachain" }
polkadot-parachain-primitives = { path = "../../../parachain" }
[features]
runtime-benchmarks = [
@@ -38,7 +38,7 @@ runtime-benchmarks = [
"pallet-balances/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
@@ -19,7 +19,7 @@ mod relay_chain;
use codec::DecodeLimit;
use polkadot_core_primitives::AccountId;
use polkadot_parachain::primitives::Id as ParaId;
use polkadot_parachain_primitives::primitives::Id as ParaId;
use sp_runtime::{traits::AccountIdConversion, BuildStorage};
use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt};
@@ -33,7 +33,7 @@ use sp_std::prelude::*;
use pallet_xcm::XcmPassthrough;
use polkadot_core_primitives::BlockNumber as RelayBlockNumber;
use polkadot_parachain::primitives::{
use polkadot_parachain_primitives::primitives::{
DmpMessageHandler, Id as ParaId, Sibling, XcmpMessageFormat, XcmpMessageHandler,
};
use xcm::{latest::prelude::*, VersionedXcm};
@@ -26,7 +26,7 @@ use frame_system::EnsureRoot;
use sp_core::{ConstU32, H256};
use sp_runtime::{traits::IdentityLookup, AccountId32};
use polkadot_parachain::primitives::Id as ParaId;
use polkadot_parachain_primitives::primitives::Id as ParaId;
use polkadot_runtime_parachains::{
configuration,
inclusion::{AggregateMessageOrigin, UmpQueueId},
+1 -1
View File
@@ -27,7 +27,7 @@ pub use sp_io::{hashing::blake2_256, TestExternalities};
pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData};
pub use polkadot_core_primitives::BlockNumber as RelayBlockNumber;
pub use polkadot_parachain::primitives::{
pub use polkadot_parachain_primitives::primitives::{
DmpMessageHandler as DmpMessageHandlerT, Id as ParaId, XcmpMessageFormat,
XcmpMessageHandler as XcmpMessageHandlerT,
};