mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 17:51:09 +00:00
Companion for paritytech/substrate#11631 (#5671)
* Companion for paritytech/substrate#11631 * Fixes * Update sp-runtime * Fixes * update lockfile for {"substrate"} * remove unused Co-authored-by: parity-processbot <> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Generated
+174
-173
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
|
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
|
||||||
parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive"] }
|
parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||||
log = { version = "0.4.17", default-features = false }
|
log = { version = "0.4.17", default-features = false }
|
||||||
rustc-hex = { version = "2.1.0", default-features = false }
|
rustc-hex = { version = "2.1.0", default-features = false }
|
||||||
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
|
||||||
|
|||||||
@@ -54,7 +54,16 @@ pub mod pallet {
|
|||||||
|
|
||||||
/// Origin for the parachains.
|
/// Origin for the parachains.
|
||||||
#[pallet::origin]
|
#[pallet::origin]
|
||||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, sp_core::RuntimeDebug, scale_info::TypeInfo)]
|
#[derive(
|
||||||
|
PartialEq,
|
||||||
|
Eq,
|
||||||
|
Clone,
|
||||||
|
Encode,
|
||||||
|
Decode,
|
||||||
|
sp_core::RuntimeDebug,
|
||||||
|
scale_info::TypeInfo,
|
||||||
|
MaxEncodedLen,
|
||||||
|
)]
|
||||||
pub enum Origin {
|
pub enum Origin {
|
||||||
/// It comes from a parachain.
|
/// It comes from a parachain.
|
||||||
Parachain(ParaId),
|
Parachain(ParaId),
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ use xcm_builder::{
|
|||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const WndLocation: MultiLocation = Here.into();
|
pub const WndLocation: MultiLocation = Here.into();
|
||||||
pub const Ancestry: MultiLocation = Here.into();
|
pub const Ancestry: MultiLocation = Here.into();
|
||||||
pub WestendNetwork: NetworkId = NetworkId::Named(b"Westend".to_vec());
|
pub WestendNetwork: NetworkId =
|
||||||
|
NetworkId::Named(b"Westend".to_vec().try_into().expect("shorter than length limit; qed"));
|
||||||
pub CheckAccount: AccountId = XcmPallet::check_account();
|
pub CheckAccount: AccountId = XcmPallet::check_account();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
impl-trait-for-tuples = "0.2.2"
|
impl-trait-for-tuples = "0.2.2"
|
||||||
parity-scale-codec = { version = "3.1.2", default-features = false, features = [ "derive" ] }
|
parity-scale-codec = { version = "3.1.2", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||||
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
|
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
|
||||||
|
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
derivative = {version = "2.2.0", default-features = false, features = [ "use_core" ] }
|
derivative = {version = "2.2.0", default-features = false, features = [ "use_core" ] }
|
||||||
log = { version = "0.4.17", default-features = false }
|
log = { version = "0.4.17", default-features = false }
|
||||||
xcm-procedural = { path = "procedural" }
|
xcm-procedural = { path = "procedural" }
|
||||||
@@ -16,8 +17,11 @@ xcm-procedural = { path = "procedural" }
|
|||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
wasm-api = []
|
wasm-api = []
|
||||||
runtime-benchmarks = []
|
runtime-benchmarks = [
|
||||||
|
"sp-runtime/runtime-benchmarks",
|
||||||
|
]
|
||||||
std = [
|
std = [
|
||||||
"parity-scale-codec/std",
|
"parity-scale-codec/std",
|
||||||
"scale-info/std",
|
"scale-info/std",
|
||||||
|
"sp-runtime/std",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ mod mock;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use codec::{Decode, Encode, EncodeLike};
|
use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
|
||||||
use frame_support::traits::{Contains, EnsureOrigin, Get, OriginTrait};
|
use frame_support::traits::{Contains, EnsureOrigin, Get, OriginTrait};
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
@@ -212,7 +212,7 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::origin]
|
#[pallet::origin]
|
||||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
|
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
|
||||||
pub enum Origin {
|
pub enum Origin {
|
||||||
/// It comes from somewhere in the XCM space wanting to transact.
|
/// It comes from somewhere in the XCM space wanting to transact.
|
||||||
Xcm(MultiLocation),
|
Xcm(MultiLocation),
|
||||||
|
|||||||
@@ -16,17 +16,17 @@
|
|||||||
|
|
||||||
//! Support data structures for `MultiLocation`, primarily the `Junction` datatype.
|
//! Support data structures for `MultiLocation`, primarily the `Junction` datatype.
|
||||||
|
|
||||||
use alloc::vec::Vec;
|
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||||
use parity_scale_codec::{Decode, Encode};
|
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
|
use sp_runtime::{traits::ConstU32, WeakBoundedVec};
|
||||||
|
|
||||||
/// A global identifier of an account-bearing consensus system.
|
/// A global identifier of an account-bearing consensus system.
|
||||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo)]
|
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||||
pub enum NetworkId {
|
pub enum NetworkId {
|
||||||
/// Unidentified/any.
|
/// Unidentified/any.
|
||||||
Any,
|
Any,
|
||||||
/// Some named network.
|
/// Some named network.
|
||||||
Named(Vec<u8>),
|
Named(WeakBoundedVec<u8, ConstU32<32>>),
|
||||||
/// The Polkadot Relay chain
|
/// The Polkadot Relay chain
|
||||||
Polkadot,
|
Polkadot,
|
||||||
/// Kusama.
|
/// Kusama.
|
||||||
@@ -34,12 +34,12 @@ pub enum NetworkId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An identifier of a pluralistic body.
|
/// An identifier of a pluralistic body.
|
||||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo)]
|
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||||
pub enum BodyId {
|
pub enum BodyId {
|
||||||
/// The only body in its context.
|
/// The only body in its context.
|
||||||
Unit,
|
Unit,
|
||||||
/// A named body.
|
/// A named body.
|
||||||
Named(Vec<u8>),
|
Named(WeakBoundedVec<u8, ConstU32<32>>),
|
||||||
/// An indexed body.
|
/// An indexed body.
|
||||||
Index(#[codec(compact)] u32),
|
Index(#[codec(compact)] u32),
|
||||||
/// The unambiguous executive body (for Polkadot, this would be the Polkadot council).
|
/// The unambiguous executive body (for Polkadot, this would be the Polkadot council).
|
||||||
@@ -55,7 +55,7 @@ pub enum BodyId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A part of a pluralistic body.
|
/// A part of a pluralistic body.
|
||||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo)]
|
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||||
pub enum BodyPart {
|
pub enum BodyPart {
|
||||||
/// The body's declaration, under whatever means it decides.
|
/// The body's declaration, under whatever means it decides.
|
||||||
Voice,
|
Voice,
|
||||||
@@ -102,7 +102,7 @@ impl BodyPart {
|
|||||||
/// A single item in a path to describe the relative location of a consensus system.
|
/// A single item in a path to describe the relative location of a consensus system.
|
||||||
///
|
///
|
||||||
/// Each item assumes a pre-existing location as its context and is defined in terms of it.
|
/// Each item assumes a pre-existing location as its context and is defined in terms of it.
|
||||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo)]
|
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||||
pub enum Junction {
|
pub enum Junction {
|
||||||
/// The consensus system of which the context is a member and state-wise super-set.
|
/// The consensus system of which the context is a member and state-wise super-set.
|
||||||
///
|
///
|
||||||
@@ -147,7 +147,7 @@ pub enum Junction {
|
|||||||
/// Usage will vary widely owing to its generality.
|
/// Usage will vary widely owing to its generality.
|
||||||
///
|
///
|
||||||
/// NOTE: Try to avoid using this and instead use a more specific item.
|
/// NOTE: Try to avoid using this and instead use a more specific item.
|
||||||
GeneralKey(Vec<u8>),
|
GeneralKey(WeakBoundedVec<u8, ConstU32<32>>),
|
||||||
/// The unambiguous child.
|
/// The unambiguous child.
|
||||||
///
|
///
|
||||||
/// Not currently used except as a fallback when deriving ancestry.
|
/// Not currently used except as a fallback when deriving ancestry.
|
||||||
|
|||||||
@@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
use super::{BodyId, BodyPart, Junctions, MultiLocation, NetworkId};
|
use super::{BodyId, BodyPart, Junctions, MultiLocation, NetworkId};
|
||||||
use crate::v0::Junction as Junction0;
|
use crate::v0::Junction as Junction0;
|
||||||
use alloc::vec::Vec;
|
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||||
use parity_scale_codec::{self, Decode, Encode};
|
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
|
use sp_runtime::{traits::ConstU32, WeakBoundedVec};
|
||||||
|
|
||||||
/// A single item in a path to describe the relative location of a consensus system.
|
/// A single item in a path to describe the relative location of a consensus system.
|
||||||
///
|
///
|
||||||
/// Each item assumes a pre-existing location as its context and is defined in terms of it.
|
/// Each item assumes a pre-existing location as its context and is defined in terms of it.
|
||||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo)]
|
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||||
pub enum Junction {
|
pub enum Junction {
|
||||||
/// An indexed parachain belonging to and operated by the context.
|
/// An indexed parachain belonging to and operated by the context.
|
||||||
///
|
///
|
||||||
@@ -65,7 +65,7 @@ pub enum Junction {
|
|||||||
/// Usage will vary widely owing to its generality.
|
/// Usage will vary widely owing to its generality.
|
||||||
///
|
///
|
||||||
/// NOTE: Try to avoid using this and instead use a more specific item.
|
/// NOTE: Try to avoid using this and instead use a more specific item.
|
||||||
GeneralKey(Vec<u8>),
|
GeneralKey(WeakBoundedVec<u8, ConstU32<32>>),
|
||||||
/// The unambiguous child.
|
/// The unambiguous child.
|
||||||
///
|
///
|
||||||
/// Not currently used except as a fallback when deriving ancestry.
|
/// Not currently used except as a fallback when deriving ancestry.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
use super::Junction;
|
use super::Junction;
|
||||||
use core::{mem, result};
|
use core::{mem, result};
|
||||||
use parity_scale_codec::{Decode, Encode};
|
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
|
|
||||||
/// A relative path between state-bearing consensus systems.
|
/// A relative path between state-bearing consensus systems.
|
||||||
@@ -47,7 +47,7 @@ use scale_info::TypeInfo;
|
|||||||
/// that a value is strictly an interior location, in those cases, `Junctions` may be used.
|
/// that a value is strictly an interior location, in those cases, `Junctions` may be used.
|
||||||
///
|
///
|
||||||
/// The `MultiLocation` value of `Null` simply refers to the interpreting consensus system.
|
/// The `MultiLocation` value of `Null` simply refers to the interpreting consensus system.
|
||||||
#[derive(Clone, Decode, Encode, Eq, PartialEq, Ord, PartialOrd, Debug, TypeInfo)]
|
#[derive(Clone, Decode, Encode, Eq, PartialEq, Ord, PartialOrd, Debug, TypeInfo, MaxEncodedLen)]
|
||||||
pub struct MultiLocation {
|
pub struct MultiLocation {
|
||||||
/// The number of parent junctions at the beginning of this `MultiLocation`.
|
/// The number of parent junctions at the beginning of this `MultiLocation`.
|
||||||
pub parents: u8,
|
pub parents: u8,
|
||||||
@@ -425,7 +425,7 @@ const MAX_JUNCTIONS: usize = 8;
|
|||||||
///
|
///
|
||||||
/// Parent junctions cannot be constructed with this type. Refer to `MultiLocation` for
|
/// Parent junctions cannot be constructed with this type. Refer to `MultiLocation` for
|
||||||
/// instructions on constructing parent junctions.
|
/// instructions on constructing parent junctions.
|
||||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo)]
|
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||||
pub enum Junctions {
|
pub enum Junctions {
|
||||||
/// The interpreting consensus system.
|
/// The interpreting consensus system.
|
||||||
Here,
|
Here,
|
||||||
@@ -1011,7 +1011,6 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn conversion_from_other_types_works() {
|
fn conversion_from_other_types_works() {
|
||||||
use crate::v0;
|
use crate::v0;
|
||||||
|
|
||||||
fn takes_multilocation<Arg: Into<MultiLocation>>(_arg: Arg) {}
|
fn takes_multilocation<Arg: Into<MultiLocation>>(_arg: Arg) {}
|
||||||
|
|
||||||
takes_multilocation(Parent);
|
takes_multilocation(Parent);
|
||||||
@@ -1042,10 +1041,13 @@ mod tests {
|
|||||||
v0::MultiLocation::X3(
|
v0::MultiLocation::X3(
|
||||||
v0::Junction::Parent,
|
v0::Junction::Parent,
|
||||||
v0::Junction::Parent,
|
v0::Junction::Parent,
|
||||||
v0::Junction::GeneralKey(b"foo".to_vec()),
|
v0::Junction::GeneralKey(b"foo".to_vec().try_into().unwrap()),
|
||||||
)
|
)
|
||||||
.try_into(),
|
.try_into(),
|
||||||
Ok(MultiLocation { parents: 2, interior: X1(GeneralKey(b"foo".to_vec())) }),
|
Ok(MultiLocation {
|
||||||
|
parents: 2,
|
||||||
|
interior: X1(GeneralKey(b"foo".to_vec().try_into().unwrap()))
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user