mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
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:
committed by
GitHub
parent
b1bbdf1192
commit
45966d509e
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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" ]
|
||||
|
||||
@@ -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]]
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -54,4 +54,6 @@ std = [
|
||||
"sp-std/std",
|
||||
"sp-storage/std",
|
||||
]
|
||||
runtime-benchmarks = []
|
||||
runtime-benchmarks = [
|
||||
"frame-system/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -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 )*
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -33,7 +33,7 @@ runtime-benchmarks = [
|
||||
]
|
||||
std = [
|
||||
"codec/std",
|
||||
"frame-benchmarking/std",
|
||||
"frame-benchmarking?/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"scale-info/std",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -36,7 +36,7 @@ runtime-benchmarks = [
|
||||
]
|
||||
std = [
|
||||
"codec/std",
|
||||
"frame-benchmarking/std",
|
||||
"frame-benchmarking?/std",
|
||||
"frame-support/std",
|
||||
"frame-system/std",
|
||||
"scale-info/std",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user