Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
366 changes: 183 additions & 183 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
47 changes: 33 additions & 14 deletions parachain/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down
18 changes: 9 additions & 9 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions primitives/src/v4/executor_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 2 additions & 5 deletions primitives/src/v4/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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,
Expand Down
13 changes: 11 additions & 2 deletions primitives/src/vstaging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions runtime/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -70,7 +70,6 @@ std = [
"scale-info/std",
"log/std",
"rustc-hex/std",
"serde_derive",
"serde/std",
"primitives/std",
"inherents/std",
Expand Down
10 changes: 5 additions & 5 deletions runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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<
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions runtime/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,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", features = [ "derive" ], optional = true }
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }
derive_more = "0.99.17"
bitflags = "1.3.2"

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-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 }

Expand Down Expand Up @@ -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",
Expand Down
12 changes: 10 additions & 2 deletions runtime/parachains/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 2 additions & 6 deletions runtime/parachains/src/paras/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
}

Expand All @@ -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
Expand All @@ -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
Expand Down
Loading