Serialize/Deserialize trait implemented in no-std for numerous types (#7312)

* ParaId: Serialize/Deserialize trait implemented in no-std

* Serialize/Deserialize trait implemented in no-std for more types

* serde in deps enabled

* fix

* missing types added

* update lockfile for {"substrate"}

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

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2023-06-01 17:17:49 +01:00
committed by GitHub
parent 306270b889
commit a767358122
16 changed files with 359 additions and 265 deletions
+183 -183
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -10,17 +10,17 @@ version.workspace = true
# this crate for WASM. This is critical to avoid forcing all parachain WASM into implementing
# various unnecessary Substrate-specific endpoints.
parity-scale-codec = { version = "3.4.0", default-features = false, features = [ "derive" ] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde"] }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
polkadot-core-primitives = { path = "../core-primitives", default-features = false }
derive_more = "0.99.11"
bounded-collections = { version = "0.1.7", default-features = false }
bounded-collections = { version = "0.1.7", default-features = false, features = ["serde"] }
# all optional crates.
serde = { version = "1.0.163", default-features = false, features = [ "derive" ], optional = true }
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }
[features]
default = ["std"]
+33 -14
View File
@@ -23,14 +23,9 @@ use bounded_collections::{BoundedVec, ConstU32};
use frame_support::weights::Weight;
use parity_scale_codec::{CompactAs, Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_core::{RuntimeDebug, TypeId};
use sp_runtime::traits::Hash as _;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
#[cfg(feature = "std")]
use sp_core::bytes;
use sp_core::{bytes, RuntimeDebug, TypeId};
use sp_runtime::traits::Hash as _;
use polkadot_core_primitives::{Hash, OutboundHrmpMessage};
@@ -39,10 +34,21 @@ pub use polkadot_core_primitives::BlockNumber as RelayChainBlockNumber;
/// Parachain head data included in the chain.
#[derive(
PartialEq, Eq, Clone, PartialOrd, Ord, Encode, Decode, RuntimeDebug, derive_more::From, TypeInfo,
PartialEq,
Eq,
Clone,
PartialOrd,
Ord,
Encode,
Decode,
RuntimeDebug,
derive_more::From,
TypeInfo,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash, Default))]
pub struct HeadData(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec<u8>);
#[cfg_attr(feature = "std", derive(Hash, Default))]
pub struct HeadData(#[serde(with = "bytes")] pub Vec<u8>);
impl HeadData {
/// Returns the hash of this head data.
@@ -52,9 +58,20 @@ impl HeadData {
}
/// Parachain validation code.
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, derive_more::From, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash))]
pub struct ValidationCode(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec<u8>);
#[derive(
PartialEq,
Eq,
Clone,
Encode,
Decode,
RuntimeDebug,
derive_more::From,
TypeInfo,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "std", derive(Hash))]
pub struct ValidationCode(#[serde(with = "bytes")] pub Vec<u8>);
impl ValidationCode {
/// Get the blake2-256 hash of the validation code bytes.
@@ -129,9 +146,11 @@ pub struct BlockData(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec
PartialEq,
PartialOrd,
RuntimeDebug,
serde::Serialize,
serde::Deserialize,
TypeInfo,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize, derive_more::Display))]
#[cfg_attr(feature = "std", derive(derive_more::Display))]
pub struct Id(u32);
impl TypeId for Id {
+9 -9
View File
@@ -8,20 +8,20 @@ edition.workspace = true
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
hex-literal = "0.4.1"
parity-scale-codec = { version = "3.4.0", default-features = false, features = ["bit-vec", "derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["bit-vec", "derive"] }
serde = { version = "1.0.163", optional = true, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["bit-vec", "derive", "serde"] }
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }
application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
primitives = { package = "sp-core", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
runtime_primitives = { package = "sp-runtime", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
sp-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true , features = ["serde"]}
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
polkadot-core-primitives = { path = "../core-primitives", default-features = false }
@@ -44,7 +44,7 @@ std = [
"sp-staking/std",
"sp-arithmetic/std",
"runtime_primitives/std",
"serde",
"serde/std",
"polkadot-parachain/std",
"polkadot-core-primitives/std",
"bitvec/std",
@@ -25,11 +25,11 @@ use crate::{BlakeTwo256, HashT as _, PvfExecTimeoutKind, PvfPrepTimeoutKind};
use parity_scale_codec::{Decode, Encode};
use polkadot_core_primitives::Hash;
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
use sp_std::{ops::Deref, time::Duration, vec, vec::Vec};
/// The different executor parameters for changing the execution environment semantics.
#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq, TypeInfo, Serialize, Deserialize)]
pub enum ExecutorParam {
/// Maximum number of memory pages (64KiB bytes per page) the executor can allocate.
#[codec(index = 1)]
@@ -93,8 +93,7 @@ impl sp_std::fmt::LowerHex for ExecutorParamsHash {
// into individual fields of the structure. Thus, complex migrations shall be avoided when adding
// new entries and removing old ones. At the moment, there's no mandatory parameters defined. If
// they show up, they must be clearly documented as mandatory ones.
#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, Encode, Decode, PartialEq, Eq, TypeInfo, Serialize, Deserialize)]
pub struct ExecutorParams(Vec<ExecutorParam>);
impl ExecutorParams {
+2 -5
View File
@@ -47,7 +47,6 @@ pub use polkadot_parachain::primitives::{
ValidationCodeHash, LOWEST_PUBLIC_ID, LOWEST_USER_ID,
};
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
pub use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
@@ -1762,8 +1761,7 @@ impl<T: Encode> WellKnownKey<T> {
}
/// Type discriminator for PVF preparation timeouts
#[derive(Encode, Decode, TypeInfo, Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(Encode, Decode, TypeInfo, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum PvfPrepTimeoutKind {
/// For prechecking requests, the time period after which the preparation worker is considered
/// unresponsive and will be killed.
@@ -1776,8 +1774,7 @@ pub enum PvfPrepTimeoutKind {
}
/// Type discriminator for PVF execution timeouts
#[derive(Encode, Decode, TypeInfo, Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(Encode, Decode, TypeInfo, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum PvfExecTimeoutKind {
/// The amount of time to spend on execution during backing.
Backing,
+11 -2
View File
@@ -26,8 +26,17 @@ use primitives::RuntimeDebug;
use scale_info::TypeInfo;
/// Candidate's acceptance limitations for asynchronous backing per relay parent.
#[derive(RuntimeDebug, Copy, Clone, PartialEq, Encode, Decode, TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(
RuntimeDebug,
Copy,
Clone,
PartialEq,
Encode,
Decode,
TypeInfo,
serde::Serialize,
serde::Deserialize,
)]
pub struct AsyncBackingParams {
/// The maximum number of para blocks between the para head in a relay parent
/// and a new candidate. Restricts nodes from building arbitrary long chains
+6 -7
View File
@@ -11,19 +11,19 @@ parity-scale-codec = { version = "3.4.0", default-features = false, features = [
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.163", default-features = false }
serde_derive = { version = "1.0.117", optional = true }
serde = { version = "1.0.163", default-features = false, features = ["alloc"] }
serde_derive = { version = "1.0.117" }
static_assertions = "1.1.0"
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false , features=["serde"]}
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-npos-elections = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features=["serde"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false , features=["serde"]}
sp-npos-elections = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features=["serde"] }
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -70,7 +70,6 @@ std = [
"scale-info/std",
"log/std",
"rustc-hex/std",
"serde_derive",
"serde/std",
"primitives/std",
"inherents/std",
+5 -5
View File
@@ -26,7 +26,6 @@ pub use pallet::*;
use parity_scale_codec::{Decode, Encode};
use primitives::ValidityError;
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
use sp_io::{crypto::secp256k1_ecdsa_recover, hashing::keccak_256};
use sp_runtime::{
@@ -36,6 +35,8 @@ use sp_runtime::{
},
RuntimeDebug,
};
#[cfg(not(feature = "std"))]
use sp_std::alloc::{format, string::String};
use sp_std::{fmt::Debug, prelude::*};
type CurrencyOf<T> = <<T as Config>::VestingSchedule as VestingSchedule<
@@ -71,8 +72,9 @@ impl WeightInfo for TestWeightInfo {
}
/// The kind of statement an account needs to make for a claim to be valid.
#[derive(Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(
Encode, Decode, Clone, Copy, Eq, PartialEq, RuntimeDebug, TypeInfo, Serialize, Deserialize,
)]
pub enum StatementKind {
/// Statement required to be made by non-SAFT holders.
Regular,
@@ -108,7 +110,6 @@ impl Default for StatementKind {
#[derive(Clone, Copy, PartialEq, Eq, Encode, Decode, Default, RuntimeDebug, TypeInfo)]
pub struct EthereumAddress([u8; 20]);
#[cfg(feature = "std")]
impl Serialize for EthereumAddress {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@@ -119,7 +120,6 @@ impl Serialize for EthereumAddress {
}
}
#[cfg(feature = "std")]
impl<'de> Deserialize<'de> for EthereumAddress {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
+6 -6
View File
@@ -10,7 +10,7 @@ parity-scale-codec = { version = "3.4.0", default-features = false, features = [
log = { version = "0.4.17", default-features = false }
rustc-hex = { version = "2.1.0", default-features = false }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.163", features = [ "derive" ], optional = true }
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }
derive_more = "0.99.17"
bitflags = "1.3.2"
@@ -18,11 +18,11 @@ sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", d
inherents = { package = "sp-inherents", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { package = "sp-std", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features=["serde"] }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features=["serde"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features=["serde"] }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true, features=["serde"] }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
@@ -69,7 +69,7 @@ std = [
"parity-scale-codec/std",
"rustc-hex/std",
"scale-info/std",
"serde",
"serde/std",
"primitives/std",
"inherents/std",
"sp-core/std",
@@ -44,8 +44,16 @@ pub use pallet::*;
const LOG_TARGET: &str = "runtime::configuration";
/// All configuration of the runtime with respect to parachains and parathreads.
#[derive(Clone, Encode, Decode, PartialEq, sp_core::RuntimeDebug, scale_info::TypeInfo)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
#[derive(
Clone,
Encode,
Decode,
PartialEq,
sp_core::RuntimeDebug,
scale_info::TypeInfo,
serde::Serialize,
serde::Deserialize,
)]
pub struct HostConfiguration<BlockNumber> {
// NOTE: This structure is used by parachains via merkle proofs. Therefore, this struct requires
// special treatment.
+2 -6
View File
@@ -129,7 +129,6 @@ use sp_runtime::{
};
use sp_std::{cmp, collections::btree_set::BTreeSet, mem, prelude::*};
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
pub use crate::Origin as ParachainOrigin;
@@ -290,15 +289,14 @@ impl<N: Ord + Copy + PartialEq> ParaPastCodeMeta<N> {
}
/// Arguments for initializing a para.
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, Serialize, Deserialize)]
pub struct ParaGenesisArgs {
/// The initial head data to use.
pub genesis_head: HeadData,
/// The initial validation code to use.
pub validation_code: ValidationCode,
/// Parachain or Parathread.
#[cfg_attr(feature = "std", serde(rename = "parachain"))]
#[serde(rename = "parachain")]
pub para_kind: ParaKind,
}
@@ -309,7 +307,6 @@ pub enum ParaKind {
Parachain,
}
#[cfg(feature = "std")]
impl Serialize for ParaKind {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
@@ -322,7 +319,6 @@ impl Serialize for ParaKind {
}
}
#[cfg(feature = "std")]
impl<'de> Deserialize<'de> for ParaKind {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
+5 -5
View File
@@ -6,14 +6,14 @@ authors.workspace = true
edition.workspace = true
[dependencies]
bounded-collections = { version = "0.1.7", default-features = false }
bounded-collections = { version = "0.1.7", default-features = false, features = ["serde"] }
derivative = { version = "2.2.0", default-features = false, features = [ "use_core" ] }
impl-trait-for-tuples = "0.2.2"
log = { version = "0.4.17", default-features = false }
parity-scale-codec = { version = "3.4.0", default-features = false, features = [ "derive", "max-encoded-len" ] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
sp-weights = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
serde = { version = "1.0.163", optional = true, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde"] }
sp-weights = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, feature = ["serde "] }
serde = { version = "1.0.163", default-features = false, features = ["alloc", "derive"] }
xcm-procedural = { path = "procedural" }
[dev-dependencies]
@@ -28,6 +28,6 @@ std = [
"bounded-collections/std",
"parity-scale-codec/std",
"scale-info/std",
"serde",
"serde/std",
"sp-weights/std",
]
+53 -8
View File
@@ -28,15 +28,27 @@ use bounded_collections::{BoundedSlice, BoundedVec, ConstU32};
use core::convert::{TryFrom, TryInto};
use parity_scale_codec::{self, Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};
/// A global identifier of a data structure existing within consensus.
///
/// Maintenance note: Networks with global consensus and which are practically bridgeable within the
/// Polkadot ecosystem are given preference over explicit naming in this enumeration.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen,
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
Debug,
TypeInfo,
MaxEncodedLen,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum NetworkId {
/// Network specified by the first 32 bytes of its genesis block.
ByGenesis([u8; 32]),
@@ -78,9 +90,20 @@ impl From<OldNetworkId> for Option<NetworkId> {
/// An identifier of a pluralistic body.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen,
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
Debug,
TypeInfo,
MaxEncodedLen,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum BodyId {
/// The only body in its context.
Unit,
@@ -137,9 +160,20 @@ impl TryFrom<OldBodyId> for BodyId {
/// A part of a pluralistic body.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen,
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
Debug,
TypeInfo,
MaxEncodedLen,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum BodyPart {
/// The body's declaration, under whatever means it decides.
Voice,
@@ -201,9 +235,20 @@ impl TryFrom<OldBodyPart> for BodyPart {
///
/// Each item assumes a pre-existing location as its context and is defined in terms of it.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen,
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
Debug,
TypeInfo,
MaxEncodedLen,
Serialize,
Deserialize,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum Junction {
/// An indexed parachain belonging to and operated by the context.
///
+13 -2
View File
@@ -30,9 +30,20 @@ pub(crate) const MAX_JUNCTIONS: usize = 8;
/// Parent junctions cannot be constructed with this type. Refer to `MultiLocation` for
/// instructions on constructing parent junctions.
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen,
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
Debug,
TypeInfo,
MaxEncodedLen,
serde::Serialize,
serde::Deserialize,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum Junctions {
/// The interpreting consensus system.
Here,
+13 -2
View File
@@ -52,9 +52,20 @@ use scale_info::TypeInfo;
///
/// The `MultiLocation` value of `Null` simply refers to the interpreting consensus system.
#[derive(
Copy, Clone, Decode, Encode, Eq, PartialEq, Ord, PartialOrd, Debug, TypeInfo, MaxEncodedLen,
Copy,
Clone,
Decode,
Encode,
Eq,
PartialEq,
Ord,
PartialOrd,
Debug,
TypeInfo,
MaxEncodedLen,
serde::Serialize,
serde::Deserialize,
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct MultiLocation {
/// The number of parent junctions at the beginning of this `MultiLocation`.
pub parents: u8,