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
+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)]