diff --git a/Cargo.lock b/Cargo.lock index 1c2211ca5ff7..ca21d2f3bdc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2558,9 +2558,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-literal" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21e4590e13640f19f249fe3e4eca5113bc4289f2497710378190e7f4bd96f45b" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "hex_fmt" @@ -6683,7 +6683,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" -version = "0.9.12" +version = "0.9.13" dependencies = [ "bitvec 0.20.1", "frame-system", @@ -6875,7 +6875,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.12" +version = "0.9.13" dependencies = [ "bitflags", "bitvec 0.20.1", @@ -6904,7 +6904,6 @@ dependencies = [ "scale-info", "serde", "sp-api", - "sp-application-crypto", "sp-core", "sp-inherents", "sp-io", diff --git a/parachain/src/primitives.rs b/parachain/src/primitives.rs index c766ca357cb6..39d59dcfe7a4 100644 --- a/parachain/src/primitives.rs +++ b/parachain/src/primitives.rs @@ -41,10 +41,19 @@ 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, + Default, )] #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash, MallocSizeOf))] -#[cfg_attr(any(feature = "std", feature = "runtime-benchmarks"), derive(Default))] pub struct HeadData(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec); impl HeadData { diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 6614f6d17e65..86cf62fffa14 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-primitives" -version = "0.9.12" +version = "0.9.13" authors = ["Parity Technologies "] edition = "2018" @@ -26,9 +26,10 @@ polkadot-core-primitives = { path = "../core-primitives", default-features = fal trie = { package = "sp-trie", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } bitvec = { version = "0.20.1", default-features = false, features = ["alloc"] } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } -hex-literal = "0.3.3" +hex-literal = "0.3.4" parity-util-mem = { version = "0.10.0", default-features = false, optional = true } + [features] default = ["std"] std = [ @@ -54,7 +55,4 @@ std = [ "polkadot-core-primitives/std", "bitvec/std", "frame-system/std", -] -runtime-benchmarks = [ - "polkadot-parachain/runtime-benchmarks", -] +] \ No newline at end of file diff --git a/primitives/src/v1/mod.rs b/primitives/src/v1/mod.rs index 5de50aa2d4d3..b1acf7c11750 100644 --- a/primitives/src/v1/mod.rs +++ b/primitives/src/v1/mod.rs @@ -327,9 +327,8 @@ fn check_collator_signature>( } /// A unique descriptor of the candidate receipt. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, Default)] #[cfg_attr(feature = "std", derive(Debug, Hash, MallocSizeOf))] -#[cfg_attr(any(feature = "std", feature = "runtime-benchmarks"), derive(Default))] pub struct CandidateDescriptor { /// The ID of the para this is a candidate for. pub para_id: Id, @@ -408,9 +407,8 @@ pub struct FullCandidateReceipt { } /// A candidate-receipt with commitments directly included. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, Default)] #[cfg_attr(feature = "std", derive(Debug, Hash, MallocSizeOf))] -#[cfg_attr(any(feature = "std", feature = "runtime-benchmarks"), derive(Default))] pub struct CommittedCandidateReceipt { /// The descriptor of the candidate. pub descriptor: CandidateDescriptor, @@ -511,9 +509,8 @@ impl PersistedValidationData { } /// Commitments made in a `CandidateReceipt`. Many of these are outputs of validation. -#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Encode, Decode, TypeInfo, Default)] #[cfg_attr(feature = "std", derive(Debug, Hash, MallocSizeOf))] -#[cfg_attr(any(feature = "std", feature = "runtime-benchmarks"), derive(Default))] pub struct CandidateCommitments { /// Messages destined to be interpreted by the Relay chain itself. pub upward_messages: Vec, diff --git a/primitives/src/v1/signed.rs b/primitives/src/v1/signed.rs index cc84448f88f8..d2515b4873aa 100644 --- a/primitives/src/v1/signed.rs +++ b/primitives/src/v1/signed.rs @@ -262,7 +262,9 @@ impl, RealPayload: Encode> UncheckedSigned( public: &crate::v0::ValidatorId, payload: Payload, @@ -277,7 +279,9 @@ impl, RealPayload: Encode> UncheckedSigned ValidatorSignature { self.signature.clone() } diff --git a/runtime/parachains/Cargo.toml b/runtime/parachains/Cargo.toml index 8c89508ff8d7..705141192093 100644 --- a/runtime/parachains/Cargo.toml +++ b/runtime/parachains/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polkadot-runtime-parachains" -version = "0.9.12" +version = "0.9.13" authors = ["Parity Technologies "] edition = "2018" @@ -32,6 +32,7 @@ pallet-session = { git = "https://github.com/paritytech/substrate", branch = "ma pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } @@ -42,16 +43,14 @@ primitives = { package = "polkadot-primitives", path = "../../primitives", defau rand = { version = "0.8.3", default-features = false } rand_chacha = { version = "0.3.1", default-features = false } -application-crypto = { package = "sp-application-crypto", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } - [dev-dependencies] futures = "0.3.17" -hex-literal = "0.3.3" +hex-literal = "0.3.4" keyring = { package = "sp-keyring", git = "https://github.com/paritytech/substrate", branch = "master" } frame-support-test = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } + [features] default = ["std"] no_std = [] @@ -87,8 +86,6 @@ runtime-benchmarks = [ "frame-benchmarking", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", - "primitives/runtime-benchmarks", - "application-crypto/full_crypto", ] try-runtime = [ "frame-support/try-runtime", @@ -98,4 +95,4 @@ try-runtime = [ "pallet-staking/try-runtime", "pallet-timestamp/try-runtime", "pallet-vesting/try-runtime", -] +] \ No newline at end of file diff --git a/runtime/parachains/src/builder.rs b/runtime/parachains/src/builder.rs index e38b4ba889da..362d97ecc259 100644 --- a/runtime/parachains/src/builder.rs +++ b/runtime/parachains/src/builder.rs @@ -26,7 +26,7 @@ use sp_std::{collections::btree_map::BTreeMap, convert::TryInto, prelude::Vec, v /// This is directly from frame-benchmarking. Copy/pasted so we can use it when not compiling with /// "features = runtime-benchmarks". fn account(name: &'static str, index: u32, seed: u32) -> AccountId { - let entropy = (name, index, seed).using_encoded(sp_core::blake2_256); + let entropy = (name, index, seed).using_encoded(sp_io::hashing::blake2_256); AccountId::decode(&mut &entropy[..]).unwrap_or_default() } @@ -54,7 +54,7 @@ pub(crate) struct BenchBuilder { } /// Paras inherent `enter` benchmark scenario. -#[cfg(any(feature = "runtime-benchmarks", test))] +#[allow(dead_code)] pub(crate) struct Bench { pub(crate) data: ParachainsInherentData, pub(crate) _session: u32, @@ -113,7 +113,7 @@ impl BenchBuilder { self.max_validators.unwrap_or(Self::fallback_max_validators()) } - #[cfg(not(feature = "runtime-benchmarks"))] + #[allow(dead_code)] pub(crate) fn set_max_validators(mut self, n: u32) -> Self { self.max_validators = Some(n); self @@ -129,7 +129,7 @@ impl BenchBuilder { /// corresponding dispute statement set. Note that if the number of disputes is not specified it fallbacks /// to having a dispute per every validator. Additionally, an entry is not guaranteed to have a dispute - it /// must line up with the cores marked as disputed as defined in `Self::Build`. - #[cfg(not(feature = "runtime-benchmarks"))] + #[allow(dead_code)] pub(crate) fn set_dispute_statements(mut self, m: BTreeMap) -> Self { self.dispute_statements = m; self @@ -140,7 +140,7 @@ impl BenchBuilder { } /// Set maximum number of validators per core. - #[cfg(not(feature = "runtime-benchmarks"))] + #[allow(dead_code)] pub(crate) fn set_max_validators_per_core(mut self, n: u32) -> Self { self.max_validators_per_core = Some(n); self @@ -152,7 +152,7 @@ impl BenchBuilder { } /// Minimum number of validity votes in order for a backed candidate to be included. - #[cfg(feature = "runtime-benchmarks")] + #[allow(dead_code)] pub(crate) fn fallback_min_validity_votes() -> u32 { (Self::fallback_max_validators() / 2) + 1 } @@ -298,7 +298,7 @@ impl BenchBuilder { frame_system::Pallet::::initialize( &header.number(), &header.hash(), - &Digest:: { logs: Vec::new() }, + &Digest { logs: Vec::new() }, Default::default(), );