Fix Rust features (#11976)

* Add std feature

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Cleanup

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Impl function also in tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make compile

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix sp-trie feature

Something makes the bench regression guard fail, maybe this?

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add runtime-benchmarks feature to sc-service

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Revert "Fix sp-trie feature"

This reverts commit f2cddfe41bc72e6f2f8133795ec9408ba0c3ec63.
Was already fixed, only needed a CI retry.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-09-14 18:31:58 +02:00
committed by GitHub
parent b1bbdf1192
commit 45966d509e
84 changed files with 250 additions and 110 deletions
+29
View File
@@ -427,6 +427,12 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
name = "base64ct"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bdca834647821e0b13d9539a8634eb62d3501b6b6c2cec1722786ee6671b851"
[[package]]
name = "beef"
version = "0.5.1"
@@ -5968,6 +5974,7 @@ dependencies = [
"sp-core",
"sp-io",
"sp-runtime",
"sp-runtime-interface",
"sp-staking",
"sp-std",
]
@@ -6842,6 +6849,17 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkcs8"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0"
dependencies = [
"der",
"spki",
"zeroize",
]
[[package]]
name = "pkg-config"
version = "0.3.19"
@@ -9127,6 +9145,7 @@ checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1"
dependencies = [
"der",
"generic-array 0.14.4",
"pkcs8",
"subtle",
"zeroize",
]
@@ -10339,6 +10358,16 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spki"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27"
dependencies = [
"base64ct",
"der",
]
[[package]]
name = "ss58-registry"
version = "1.29.0"
+6 -1
View File
@@ -67,7 +67,12 @@ substrate-build-script-utils = { version = "3.0.0", path = "../../../utils/build
[features]
default = []
runtime-benchmarks = ["node-template-runtime/runtime-benchmarks"]
# Dependencies that are only required if runtime benchmarking should be build.
runtime-benchmarks = [
"node-template-runtime/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
]
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
# in the near future.
try-runtime = ["node-template-runtime/try-runtime", "try-runtime-cli"]
@@ -127,6 +127,12 @@ pub fn run() -> sc_cli::Result<()> {
let PartialComponents { client, .. } = service::new_partial(&config)?;
cmd.run(client)
},
#[cfg(not(feature = "runtime-benchmarks"))]
BenchmarkCmd::Storage(_) => Err(
"Storage benchmarking can be enabled with `--features runtime-benchmarks`."
.into(),
),
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => {
let PartialComponents { client, backend, .. } =
service::new_partial(&config)?;
@@ -30,7 +30,7 @@ sp-runtime = { version = "6.0.0", default-features = false, path = "../../../../
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
@@ -57,6 +57,9 @@ substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-bu
[features]
default = ["std"]
std = [
"frame-try-runtime?/std",
"frame-system-benchmarking?/std",
"frame-benchmarking?/std",
"codec/std",
"scale-info/std",
"frame-executive/std",
@@ -88,7 +91,7 @@ std = [
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking",
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"hex-literal",
"pallet-balances/runtime-benchmarks",
+4 -1
View File
@@ -159,7 +159,10 @@ cli = [
"substrate-build-script-utils",
"try-runtime-cli",
]
runtime-benchmarks = ["kitchensink-runtime/runtime-benchmarks", "frame-benchmarking-cli"]
runtime-benchmarks = [
"kitchensink-runtime/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks"
]
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
# in the near future.
try-runtime = ["kitchensink-runtime/try-runtime", "try-runtime-cli"]
+6
View File
@@ -119,6 +119,12 @@ pub fn run() -> Result<()> {
let partial = new_partial(&config)?;
cmd.run(partial.client)
},
#[cfg(not(feature = "runtime-benchmarks"))]
BenchmarkCmd::Storage(_) => Err(
"Storage benchmarking can be enabled with `--features runtime-benchmarks`."
.into(),
),
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => {
// ensure that we keep the task manager alive
let partial = new_partial(&config)?;
+15 -6
View File
@@ -117,6 +117,13 @@ substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-bu
default = ["std"]
with-tracing = ["frame-executive/with-tracing"]
std = [
"sp-sandbox/std",
"pallet-whitelist/std",
"pallet-offences-benchmarking?/std",
"pallet-election-provider-support-benchmarking?/std",
"pallet-asset-tx-payment/std",
"frame-system-benchmarking?/std",
"frame-election-provider-support/std",
"sp-authority-discovery/std",
"pallet-assets/std",
"pallet-authority-discovery/std",
@@ -148,6 +155,7 @@ std = [
"pallet-multisig/std",
"pallet-nomination-pools/std",
"pallet-nomination-pools-runtime-api/std",
"pallet-nomination-pools-benchmarking?/std",
"pallet-identity/std",
"pallet-scheduler/std",
"node-primitives/std",
@@ -159,6 +167,7 @@ std = [
"pallet-randomness-collective-flip/std",
"sp-std/std",
"pallet-session/std",
"pallet-session-benchmarking?/std",
"sp-api/std",
"sp-runtime/std",
"sp-staking/std",
@@ -167,7 +176,7 @@ std = [
"sp-session/std",
"pallet-sudo/std",
"frame-support/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"pallet-election-provider-multi-phase/std",
@@ -188,7 +197,7 @@ std = [
"pallet-uniques/std",
"pallet-vesting/std",
"log/std",
"frame-try-runtime/std",
"frame-try-runtime?/std",
"sp-io/std",
"pallet-child-bounties/std",
"pallet-alliance/std",
@@ -221,8 +230,8 @@ runtime-benchmarks = [
"pallet-membership/runtime-benchmarks",
"pallet-mmr/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-nomination-pools-benchmarking",
"pallet-offences-benchmarking",
"pallet-nomination-pools-benchmarking/runtime-benchmarks",
"pallet-offences-benchmarking/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
@@ -230,7 +239,7 @@ runtime-benchmarks = [
"pallet-referenda/runtime-benchmarks",
"pallet-recovery/runtime-benchmarks",
"pallet-remark/runtime-benchmarks",
"pallet-session-benchmarking",
"pallet-session-benchmarking/runtime-benchmarks",
"pallet-society/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"pallet-state-trie-migration/runtime-benchmarks",
@@ -242,7 +251,7 @@ runtime-benchmarks = [
"pallet-uniques/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-whitelist/runtime-benchmarks",
"frame-system-benchmarking",
"frame-system-benchmarking/runtime-benchmarks",
"hex-literal",
]
try-runtime = [
+1
View File
@@ -20,6 +20,7 @@ rocksdb = ["sc-client-db/rocksdb"]
wasmtime = ["sc-executor/wasmtime"]
# exposes the client type
test-helpers = []
runtime-benchmarks = ["sc-client-db/runtime-benchmarks"]
[dependencies]
jsonrpsee = { version = "0.15.1", features = ["server"] }
+3 -1
View File
@@ -41,6 +41,8 @@ pallet-collective = { version = "4.0.0-dev", path = "../collective" }
[features]
default = ["std"]
std = [
"pallet-collective?/std",
"frame-benchmarking?/std",
"log/std",
"codec/std",
"scale-info/std",
@@ -55,7 +57,7 @@ std = [
runtime-benchmarks = [
"hex",
"sha2",
"frame-benchmarking",
"frame-benchmarking/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
+1 -1
View File
@@ -39,7 +39,7 @@ std = [
"sp-runtime/std",
"frame-support/std",
"frame-system/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
+1 -1
View File
@@ -43,7 +43,7 @@ sp-core = { version = "6.0.0", path = "../../primitives/core" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+2 -27
View File
@@ -17,6 +17,8 @@
//! Benchmarks for the BABE Pallet.
#![cfg(feature = "runtime-benchmarks")]
use super::*;
use frame_benchmarking::benchmarks;
@@ -70,30 +72,3 @@ benchmarks! {
crate::mock::Test,
)
}
#[cfg(test)]
mod tests {
use super::*;
use crate::mock::*;
#[test]
fn test_generate_equivocation_report_blob() {
let (pairs, mut ext) = new_test_ext_with_pairs(3);
let offending_authority_index = 0;
let offending_authority_pair = &pairs[0];
ext.execute_with(|| {
start_era(1);
let equivocation_proof = generate_equivocation_proof(
offending_authority_index,
offending_authority_pair,
CurrentSlot::<Test>::get() + 1,
);
println!("equivocation_proof: {:?}", equivocation_proof);
println!("equivocation_proof.encode(): {:?}", equivocation_proof.encode());
});
}
}
+21
View File
@@ -926,3 +926,24 @@ fn add_epoch_configurations_migration_works() {
assert_eq!(PendingEpochConfigChange::<Test>::get(), Some(next_config_descriptor));
});
}
#[test]
fn generate_equivocation_report_blob() {
let (pairs, mut ext) = new_test_ext_with_pairs(3);
let offending_authority_index = 0;
let offending_authority_pair = &pairs[0];
ext.execute_with(|| {
start_era(1);
let equivocation_proof = generate_equivocation_proof(
offending_authority_index,
offending_authority_pair,
CurrentSlot::<Test>::get() + 1,
);
println!("equivocation_proof: {:?}", equivocation_proof);
println!("equivocation_proof.encode(): {:?}", equivocation_proof.encode());
});
}
+8 -1
View File
@@ -41,12 +41,18 @@ sp-core = { version = "6.0.0", path = "../../primitives/core"}
sp-io = { version = "6.0.0", path = "../../primitives/io"}
sp-tracing = { version = "5.0.0", path = "../../primitives/tracing" }
pallet-balances = { version = "4.0.0-dev", path = "../balances" }
frame-election-provider-support = { version = "4.0.0-dev", path = "../election-provider-support", features = ["runtime-benchmarks"] }
frame-election-provider-support = { version = "4.0.0-dev", path = "../election-provider-support" }
frame-benchmarking = { version = "4.0.0-dev", path = "../benchmarking" }
[features]
default = ["std"]
std = [
"sp-tracing?/std",
"sp-io?/std",
"sp-core?/std",
"pallet-balances?/std",
"frame-benchmarking?/std",
"scale-info/std",
"codec/std",
"sp-runtime/std",
"sp-std/std",
@@ -68,5 +74,6 @@ fuzz = [
"sp-io",
"pallet-balances",
"sp-tracing",
"frame-election-provider-support/fuzz",
]
try-runtime = [ "frame-support/try-runtime" ]
+1 -1
View File
@@ -13,7 +13,7 @@ publish = false
[dependencies]
honggfuzz = "0.5"
rand = { version = "0.8", features = ["std", "small_rng"] }
frame-election-provider-support = { version = "4.0.0-dev", features = ["runtime-benchmarks"], path = "../../election-provider-support" }
frame-election-provider-support = { version = "4.0.0-dev", features = ["fuzz"], path = "../../election-provider-support" }
pallet-bags-list = { version = "4.0.0-dev", features = ["fuzz"], path = ".." }
[[bin]]
+1 -1
View File
@@ -387,7 +387,7 @@ impl<T: Config<I>, I: 'static> ScoreProvider<T::AccountId> for Pallet<T, I> {
Node::<T, I>::get(id).map(|node| node.score()).unwrap_or_default()
}
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(any(feature = "runtime-benchmarks", feature = "fuzz", test))]
fn set_score_of(id: &T::AccountId, new_score: T::Score) {
ListNodes::<T, I>::mutate(id, |maybe_node| {
if let Some(node) = maybe_node.as_mut() {
+1 -1
View File
@@ -882,7 +882,7 @@ impl<T: Config<I>, I: 'static> Node<T, I> {
&self.id
}
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(any(feature = "runtime-benchmarks", feature = "fuzz", test))]
pub fn set_score(&mut self, s: T::Score) {
self.score = s
}
+2 -1
View File
@@ -40,7 +40,7 @@ impl frame_election_provider_support::ScoreProvider<AccountId> for StakingMock {
*NextVoteWeightMap::get().get(id).unwrap_or(&NextVoteWeight::get())
}
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(any(feature = "runtime-benchmarks", feature = "fuzz", test))]
fn set_score_of(id: &AccountId, weight: Self::Score) {
NEXT_VOTE_WEIGHT_MAP.with(|m| m.borrow_mut().insert(*id, weight));
}
@@ -108,6 +108,7 @@ pub struct ExtBuilder {
skip_genesis_ids: bool,
}
#[cfg(any(feature = "runtime-benchmarks", feature = "fuzz", test))]
impl ExtBuilder {
/// Skip adding the default genesis ids to the list.
#[cfg(test)]
+1 -1
View File
@@ -31,7 +31,7 @@ sp-io = { version = "6.0.0", path = "../../primitives/io" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+3 -1
View File
@@ -54,4 +54,6 @@ std = [
"sp-std/std",
"sp-storage/std",
]
runtime-benchmarks = []
runtime-benchmarks = [
"frame-system/runtime-benchmarks",
]
+2
View File
@@ -975,6 +975,8 @@ macro_rules! impl_benchmark {
( $( $name_extra:ident ),* )
( $( $name_skip_meta:ident ),* )
) => {
// We only need to implement benchmarks for the runtime-benchmarks feature or testing.
#[cfg(any(feature = "runtime-benchmarks", test))]
impl<T: Config $(<$instance>, $instance: $instance_bound )? >
$crate::Benchmarking for Pallet<T $(, $instance)? >
where T: frame_system::Config, $( $where_clause )*
+1
View File
@@ -33,6 +33,7 @@ pallet-balances = { version = "4.0.0-dev", path = "../balances" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
@@ -34,6 +34,7 @@ pallet-balances = { version = "4.0.0-dev", path = "../balances" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1 -1
View File
@@ -28,7 +28,7 @@ sp-std = { version = "4.0.0", default-features = false, path = "../../primitives
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+1 -1
View File
@@ -69,7 +69,7 @@ std = [
"sp-io/std",
"sp-std/std",
"sp-sandbox/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"wasm-instrument/std",
+3 -2
View File
@@ -36,7 +36,7 @@ sp-core = { version = "6.0.0", path = "../../primitives/core" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
@@ -46,7 +46,8 @@ std = [
"sp-std/std",
]
runtime-benchmarks = [
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
+1 -1
View File
@@ -34,7 +34,7 @@ sp-core = { version = "6.0.0", path = "../../primitives/core" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
@@ -52,6 +52,7 @@ frame-benchmarking = { version = "4.0.0-dev", path = "../benchmarking" }
[features]
default = ["std"]
std = [
"pallet-election-provider-support-benchmarking?/std",
"codec/std",
"scale-info/std",
"log/std",
@@ -68,7 +69,7 @@ std = [
"frame-election-provider-support/std",
"log/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"rand/std",
"strum/std",
]
@@ -31,6 +31,7 @@ sp-npos-elections = { version = "4.0.0-dev", path = "../../primitives/npos-elect
[features]
default = ["std"]
fuzz = ["default"]
std = [
"codec/std",
"frame-support/std",
@@ -25,7 +25,7 @@ sp-runtime = { version = "6.0.0", default-features = false, path = "../../../pri
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-election-provider-support/std",
"frame-system/std",
"sp-npos-elections/std",
@@ -519,9 +519,7 @@ pub trait SortedListProvider<AccountId> {
/// If `who` changes by the returned amount they are guaranteed to have a worst case change
/// in their list position.
#[cfg(feature = "runtime-benchmarks")]
fn score_update_worst_case(_who: &AccountId, _is_increase: bool) -> Self::Score {
Self::Score::max_value()
}
fn score_update_worst_case(_who: &AccountId, _is_increase: bool) -> Self::Score;
}
/// Something that can provide the `Score` of an account. Similar to [`ElectionProvider`] and
@@ -533,8 +531,8 @@ pub trait ScoreProvider<AccountId> {
/// Get the current `Score` of `who`.
fn score(who: &AccountId) -> Self::Score;
/// For tests and benchmarks, set the `score`.
#[cfg(any(feature = "runtime-benchmarks", test))]
/// For tests, benchmarks and fuzzing, set the `score`.
#[cfg(any(feature = "runtime-benchmarks", feature = "fuzz", test))]
fn set_score_of(_: &AccountId, _: Self::Score) {}
}
@@ -36,6 +36,7 @@ substrate-test-utils = { version = "4.0.0-dev", path = "../../test-utils" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1 -1
View File
@@ -31,7 +31,7 @@ sp-core = { version = "6.0.0", default-features = false, path = "../../../primit
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+1 -1
View File
@@ -31,7 +31,7 @@ sp-io = { version = "6.0.0", path = "../../primitives/io" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
+1 -1
View File
@@ -45,7 +45,7 @@ sp-keyring = { version = "6.0.0", path = "../../primitives/keyring" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+1 -1
View File
@@ -31,7 +31,7 @@ sp-core = { version = "6.0.0", path = "../../primitives/core" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
+1
View File
@@ -33,6 +33,7 @@ pallet-session = { version = "4.0.0-dev", path = "../session" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1
View File
@@ -30,6 +30,7 @@ pallet-balances = { version = "4.0.0-dev", path = "../balances" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1
View File
@@ -32,6 +32,7 @@ sp-io = { version = "6.0.0", path = "../../primitives/io" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1 -1
View File
@@ -28,7 +28,7 @@ sp-std = { version = "4.0.0", default-features = false, path = "../../primitives
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
@@ -33,7 +33,7 @@ itertools = "0.10.3"
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"mmr-lib/std",
@@ -17,6 +17,8 @@
//! Benchmarks for the MMR pallet.
#![cfg(feature = "runtime-benchmarks")]
use crate::*;
use frame_benchmarking::benchmarks_instance_pallet;
use frame_support::traits::OnInitialize;
@@ -63,7 +63,7 @@ use sp_runtime::{
SaturatedConversion,
};
#[cfg(any(feature = "runtime-benchmarks", test))]
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
mod default_weights;
mod mmr;
+1
View File
@@ -29,6 +29,7 @@ sp-core = { version = "6.0.0", path = "../../primitives/core" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+7 -3
View File
@@ -32,9 +32,6 @@ sp-tracing = { version = "5.0.0", path = "../../primitives/tracing" }
rand = { version = "0.8.5", features = ["small_rng"] }
[features]
runtime-benchmarks = []
try-runtime = [ "frame-support/try-runtime" ]
fuzz-test = []
default = ["std"]
std = [
"codec/std",
@@ -48,3 +45,10 @@ std = [
"sp-core/std",
"log/std",
]
runtime-benchmarks = [
"sp-staking/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime"
]
fuzz-test = []
@@ -22,12 +22,13 @@ frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "
frame-election-provider-support = { version = "4.0.0-dev", default-features = false, path = "../../election-provider-support" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" }
pallet-bags-list = { version = "4.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../bags-list" }
pallet-staking = { version = "4.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" }
pallet-nomination-pools = { version = "1.0.0", default-features = false, path = "../", features = ["runtime-benchmarks"] }
pallet-bags-list = { version = "4.0.0-dev", default-features = false, path = "../../bags-list" }
pallet-staking = { version = "4.0.0-dev", default-features = false, path = "../../staking" }
pallet-nomination-pools = { version = "1.0.0", default-features = false, path = "../" }
# Substrate Primitives
sp-runtime = { version = "6.0.0", default-features = false, path = "../../../primitives/runtime" }
sp-runtime-interface = { version = "6.0.0", default-features = false, path = "../../../primitives/runtime-interface" }
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/staking" }
sp-std = { version = "4.0.0", default-features = false, path = "../../../primitives/std" }
@@ -40,6 +41,7 @@ sp-io = { version = "6.0.0", path = "../../../primitives/io" }
[features]
default = ["std"]
std = [
"frame-benchmarking/std",
"frame-election-provider-support/std",
@@ -49,7 +51,20 @@ std = [
"pallet-staking/std",
"pallet-nomination-pools/std",
"sp-runtime/std",
"sp-runtime-interface/std",
"sp-io/std",
"sp-staking/std",
"sp-std/std",
"pallet-balances/std",
"sp-std/std",
]
runtime-benchmarks = [
"frame-election-provider-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"pallet-nomination-pools/runtime-benchmarks",
"pallet-bags-list/runtime-benchmarks",
]
@@ -17,6 +17,7 @@
//! Benchmarks for the nomination pools coupled with the staking and bags list pallets.
#![cfg(feature = "runtime-benchmarks")]
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(test)]
@@ -23,13 +23,9 @@ pallet-babe = { version = "4.0.0-dev", default-features = false, path = "../../b
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../balances" }
pallet-grandpa = { version = "4.0.0-dev", default-features = false, path = "../../grandpa" }
pallet-im-online = { version = "4.0.0-dev", default-features = false, path = "../../im-online" }
pallet-offences = { version = "4.0.0-dev", default-features = false, features = [
"runtime-benchmarks",
], path = "../../offences" }
pallet-offences = { version = "4.0.0-dev", default-features = false, path = "../../offences" }
pallet-session = { version = "4.0.0-dev", default-features = false, path = "../../session" }
pallet-staking = { version = "4.0.0-dev", default-features = false, features = [
"runtime-benchmarks",
], path = "../../staking" }
pallet-staking = { version = "4.0.0-dev", default-features = false, path = "../../staking" }
sp-runtime = { version = "6.0.0", default-features = false, path = "../../../primitives/runtime" }
sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/staking" }
sp-std = { version = "4.0.0", default-features = false, path = "../../../primitives/std" }
@@ -60,3 +56,7 @@ std = [
"sp-staking/std",
"sp-std/std",
]
runtime-benchmarks = [
"pallet-staking/runtime-benchmarks",
]
@@ -17,6 +17,7 @@
//! Offences pallet benchmarking.
#![cfg(feature = "runtime-benchmarks")]
#![cfg_attr(not(feature = "std"), no_std)]
mod mock;
+1 -1
View File
@@ -33,7 +33,7 @@ runtime-benchmarks = [
]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
+1
View File
@@ -30,6 +30,7 @@ sp-core = { version = "6.0.0", path = "../../primitives/core" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1 -1
View File
@@ -29,7 +29,7 @@ sp-std = { version = "4.0.0", default-features = false, path = "../../primitives
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+1 -1
View File
@@ -36,7 +36,7 @@ runtime-benchmarks = [
]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
+1 -1
View File
@@ -38,7 +38,7 @@ sp-core = { version = "6.0.0", path = "../../primitives/core" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"sp-runtime/std",
"sp-arithmetic/std",
+1
View File
@@ -31,6 +31,7 @@ sp-core = { version = "6.0.0", default-features = false, path = "../../primitive
default = ["std"]
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1 -1
View File
@@ -34,7 +34,7 @@ runtime-benchmarks = [
]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
@@ -18,7 +18,7 @@ frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" }
pallet-session = { version = "4.0.0-dev", default-features = false, path = "../../session" }
pallet-staking = { version = "4.0.0-dev", default-features = false, features = ["runtime-benchmarks"], path = "../../staking" }
pallet-staking = { version = "4.0.0-dev", default-features = false, path = "../../staking" }
sp-runtime = { version = "6.0.0", default-features = false, path = "../../../primitives/runtime" }
sp-session = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/session" }
sp-std = { version = "4.0.0", default-features = false, path = "../../../primitives/std" }
@@ -46,3 +46,7 @@ std = [
"sp-session/std",
"sp-std/std",
]
runtime-benchmarks = [
"pallet-staking/runtime-benchmarks",
]
@@ -18,6 +18,7 @@
//! Benchmarks for the Session Pallet.
// This is separated into its own crate due to cyclic dependency issues.
#![cfg(feature = "runtime-benchmarks")]
#![cfg_attr(not(feature = "std"), no_std)]
mod mock;
+7 -1
View File
@@ -43,7 +43,7 @@ sp-npos-elections = { version = "4.0.0-dev", path = "../../primitives/npos-elect
pallet-balances = { version = "4.0.0-dev", path = "../balances" }
pallet-timestamp = { version = "4.0.0-dev", path = "../timestamp" }
pallet-staking-reward-curve = { version = "4.0.0-dev", path = "../staking/reward-curve" }
pallet-bags-list = { version = "4.0.0-dev", features = ["runtime-benchmarks"], path = "../bags-list" }
pallet-bags-list = { version = "4.0.0-dev", path = "../bags-list" }
substrate-test-utils = { version = "4.0.0-dev", path = "../../test-utils" }
frame-benchmarking = { version = "4.0.0-dev", path = "../benchmarking" }
frame-election-provider-support = { version = "4.0.0-dev", path = "../election-provider-support" }
@@ -52,6 +52,7 @@ rand_chacha = { version = "0.2" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"serde",
"codec/std",
"scale-info/std",
@@ -61,6 +62,7 @@ std = [
"sp-runtime/std",
"sp-staking/std",
"pallet-session/std",
"pallet-bags-list/std",
"frame-system/std",
"pallet-authorship/std",
"sp-application-crypto/std",
@@ -74,3 +76,7 @@ runtime-benchmarks = [
"sp-staking/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
fuzz = [
"pallet-bags-list/fuzz",
"frame-election-provider-support/fuzz",
]
+6 -1
View File
@@ -1282,7 +1282,7 @@ impl<T: Config> ScoreProvider<T::AccountId> for Pallet<T> {
Self::weight_of(who)
}
#[cfg(feature = "runtime-benchmarks")]
#[cfg(any(feature = "runtime-benchmarks", feature = "fuzz"))]
fn set_score_of(who: &T::AccountId, weight: Self::Score) {
// this will clearly results in an inconsistent state, but it should not matter for a
// benchmark.
@@ -1378,6 +1378,11 @@ impl<T: Config> SortedListProvider<T::AccountId> for UseNominatorsAndValidatorsM
#[allow(deprecated)]
Validators::<T>::remove_all();
}
#[cfg(feature = "runtime-benchmarks")]
fn score_update_worst_case(_who: &T::AccountId, _is_increase: bool) -> Self::Score {
unimplemented!()
}
}
impl<T: Config> StakingInterface for Pallet<T> {
@@ -39,7 +39,7 @@ sp-tracing = { path = "../../primitives/tracing" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+4 -2
View File
@@ -31,7 +31,7 @@ tt-call = "1.0.8"
frame-support-procedural = { version = "4.0.0-dev", default-features = false, path = "./procedural" }
paste = "1.0"
once_cell = { version = "1", default-features = false, optional = true }
sp-state-machine = { version = "0.12.0", optional = true, path = "../../primitives/state-machine" }
sp-state-machine = { version = "0.12.0", default-features = false, optional = true, path = "../../primitives/state-machine" }
bitflags = "1.3"
impl-trait-for-tuples = "0.2.2"
smallvec = "1.8.0"
@@ -49,6 +49,8 @@ parity-util-mem = { version = "0.11.0", default-features = false, features = ["p
[features]
default = ["std"]
std = [
"sp-core/std",
"k256/std",
"once_cell",
"serde",
"sp-api/std",
@@ -62,7 +64,7 @@ std = [
"frame-metadata/std",
"sp-inherents/std",
"sp-staking/std",
"sp-state-machine",
"sp-state-machine/std",
"sp-weights/std",
"frame-support-procedural/std",
"log/std",
@@ -37,3 +37,9 @@ std = [
"sp-runtime/std",
"sp-std/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
]
+2 -1
View File
@@ -33,8 +33,9 @@ sp-io = { version = "6.0.0", path = "../../primitives/io" }
[features]
default = ["std"]
std = [
"sp-io?/std",
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+1
View File
@@ -33,6 +33,7 @@ sp-storage = { version = "6.0.0", path = "../../primitives/storage" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
@@ -41,6 +41,7 @@ pallet-balances = { version = "4.0.0-dev", path = "../../balances" }
[features]
default = ["std"]
std = [
"scale-info/std",
"serde",
"codec/std",
"sp-std/std",
@@ -36,6 +36,8 @@ sp-transaction-storage-proof = { version = "4.0.0-dev", default-features = true,
default = ["std"]
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks", "hex-literal"]
std = [
"log/std",
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1
View File
@@ -34,6 +34,7 @@ sp-io = { version = "6.0.0", path = "../../primitives/io" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1 -1
View File
@@ -32,7 +32,7 @@ sp-std = { version = "4.0.0", path = "../../primitives/std" }
default = ["std"]
std = [
"codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
+1
View File
@@ -30,6 +30,7 @@ sp-core = { version = "6.0.0", path = "../../primitives/core" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1
View File
@@ -32,6 +32,7 @@ sp-io = { version = "6.0.0", default-features = false, path = "../../primitives/
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+1
View File
@@ -31,6 +31,7 @@ sp-io = { version = "6.0.0", path = "../../primitives/io" }
[features]
default = ["std"]
std = [
"frame-benchmarking?/std",
"codec/std",
"frame-support/std",
"frame-system/std",
+4 -4
View File
@@ -19,8 +19,8 @@ sp-core = { version = "6.0.0", default-features = false, path = "../core" }
sp-std = { version = "4.0.0", default-features = false, path = "../std" }
sp-runtime = { version = "6.0.0", default-features = false, path = "../runtime" }
sp-version = { version = "5.0.0", default-features = false, path = "../version" }
sp-state-machine = { version = "0.12.0", optional = true, path = "../state-machine" }
sp-trie = { version = "6.0.0", optional = true, path = "../trie" }
sp-state-machine = { version = "0.12.0", default-features = false, optional = true, path = "../state-machine" }
sp-trie = { version = "6.0.0", default-features = false, optional = true, path = "../trie" }
hash-db = { version = "0.15.2", optional = true }
thiserror = { version = "1.0.30", optional = true }
@@ -36,8 +36,8 @@ std = [
"sp-core/std",
"sp-std/std",
"sp-runtime/std",
"sp-state-machine",
"sp-trie",
"sp-state-machine/std",
"sp-trie/std",
"sp-version/std",
"hash-db",
"thiserror",
+2
View File
@@ -79,6 +79,8 @@ bench = false
[features]
default = ["std"]
std = [
"parity-util-mem/std",
"merlin?/std",
"full_crypto",
"log/std",
"thiserror",
@@ -24,6 +24,7 @@ sp-std = { version = "4.0.0", default-features = false, path = "../../std" }
[features]
default = ["std"]
std = [
"digest/std",
"blake2/std",
"byteorder/std",
"sha2/std",
+2 -2
View File
@@ -19,7 +19,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
impl-trait-for-tuples = "0.2.2"
thiserror = { version = "1.0.30", optional = true }
sp-core = { version = "6.0.0", default-features = false, path = "../core" }
sp-runtime = { version = "6.0.0", optional = true, path = "../runtime" }
sp-runtime = { version = "6.0.0", optional = true, default-features = false, path = "../runtime" }
sp-std = { version = "4.0.0", default-features = false, path = "../std" }
[dev-dependencies]
@@ -31,7 +31,7 @@ std = [
"async-trait",
"codec/std",
"sp-core/std",
"sp-runtime",
"sp-runtime/std",
"sp-std/std",
"thiserror",
]
+5 -4
View File
@@ -22,10 +22,10 @@ sp-core = { version = "6.0.0", default-features = false, path = "../core" }
sp-keystore = { version = "0.12.0", default-features = false, optional = true, path = "../keystore" }
sp-std = { version = "4.0.0", default-features = false, path = "../std" }
libsecp256k1 = { version = "0.7", optional = true }
sp-state-machine = { version = "0.12.0", optional = true, path = "../state-machine" }
sp-state-machine = { version = "0.12.0", default-features = false, optional = true, path = "../state-machine" }
sp-wasm-interface = { version = "6.0.0", path = "../wasm-interface", default-features = false }
sp-runtime-interface = { version = "6.0.0", default-features = false, path = "../runtime-interface" }
sp-trie = { version = "6.0.0", optional = true, path = "../trie" }
sp-trie = { version = "6.0.0", default-features = false, optional = true, path = "../trie" }
sp-externalities = { version = "0.12.0", default-features = false, path = "../externalities" }
sp-tracing = { version = "5.0.0", default-features = false, path = "../tracing" }
log = { version = "0.4.17", optional = true }
@@ -38,14 +38,15 @@ tracing-core = { version = "0.1.28", default-features = false}
[features]
default = ["std"]
std = [
"bytes/std",
"sp-externalities/std",
"sp-core/std",
"sp-keystore",
"codec/std",
"sp-std/std",
"hash-db/std",
"sp-trie",
"sp-state-machine",
"sp-trie/std",
"sp-state-machine/std",
"libsecp256k1",
"secp256k1",
"sp-runtime-interface/std",
@@ -37,6 +37,8 @@ trybuild = "1.0.60"
[features]
default = [ "std" ]
std = [
"sp-storage/std",
"bytes/std",
"sp-wasm-interface/std",
"sp-std/std",
"sp-tracing/std",
-1
View File
@@ -41,7 +41,6 @@ sp-tracing = { version = "5.0.0", path = "../../primitives/tracing" }
substrate-test-runtime-client = { version = "2.0.0", path = "../../test-utils/runtime/client" }
[features]
bench = []
runtime-benchmarks = []
default = ["std"]
std = [
-4
View File
@@ -19,10 +19,6 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
// to allow benchmarking
#![cfg_attr(feature = "bench", feature(test))]
#[cfg(feature = "bench")]
extern crate test;
#[doc(hidden)]
pub use codec;
+1
View File
@@ -67,6 +67,7 @@ default = [
"std",
]
std = [
"parity-util-mem/std",
"beefy-primitives/std",
"beefy-merkle-tree/std",
"sp-application-crypto/std",
@@ -59,6 +59,6 @@ sp-trie = { version = "6.0.0", path = "../../../primitives/trie" }
gethostname = "0.2.3"
[features]
default = ["rocksdb", "runtime-benchmarks"]
default = ["rocksdb"]
runtime-benchmarks = ["sc-client-db/runtime-benchmarks"]
rocksdb = ["sc-cli/rocksdb", "sc-client-db/rocksdb"]
@@ -12,7 +12,7 @@ readme = "README.md"
[dependencies]
# FRAME
frame-support = { version = "4.0.0-dev", path = "../../../frame/support" }
frame-election-provider-support = { version = "4.0.0-dev", path = "../../../frame/election-provider-support", features = ["runtime-benchmarks"] }
frame-election-provider-support = { version = "4.0.0-dev", path = "../../../frame/election-provider-support" }
frame-system = { version = "4.0.0-dev", path = "../../../frame/system" }
pallet-staking = { version = "4.0.0-dev", path = "../../../frame/staking" }