Fix Rust features#11976
Conversation
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
|
@ggwpez you made a tool? share the link! |
|
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
std features to Cargo filesstd features to Cargo files
|
fyi there is progress being made on cargo fmt Cargo.toml. Very much still top of my xmas list this year: rust-lang/rustfmt#5240 |
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
|
The CI pipeline was cancelled due to failure one of the required jobs. |
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
kianenigma
left a comment
There was a problem hiding this comment.
Didn't look closely, but based on the description it all looks very good.
I have a similar request as well. If I create a new pallet now, and it has try-runtime feature, if I add it to a runtime and forgot to enable try-runtime, no normal compilation will work, but the try-runtime build will fail. Can you check for this as well? You can see a few instances of it in the diff of this PR: https://github.com/paritytech/substrate/pull/10174/files
| default = ["std"] | ||
| with-tracing = ["frame-executive/with-tracing"] | ||
| std = [ | ||
| "sp-sandbox/std", |
There was a problem hiding this comment.
You can just remove the unused depedency, then we don't need to add it here :P
There was a problem hiding this comment.
There also is cargo udeps which claims to find unused crates.
I will give it a try later.
Something makes the bench regression guard fail, maybe this? Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This reverts commit f2cddfe. Was already fixed, only needed a CI retry. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
|
bot merge |
* 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 f2cddfe. 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>
Problems & Fixes
Some crates do not compile on their own
Try
cargo c -p pallet-alliance --features runtime-benchmarks, which does not work on Substrate master.The fix is to always enable the std features of all non-optional dependencies that have a std feature.
There is no regression script provided by me but it could be done. Currently I am using scripts
to compile each crate on its own to see that they work with different feature sets.
runtime-benchmarksis enabled per defaultTry
cargo tree -e features | grep runtime-benchmarksto see which crates have the feature enabledalthough
--features runtime-benchmarkswas never provided.This comes from crates either: carelessly enabling it, or crates enabling it per default.
Fixed by checking the deps tree ensuring that it is never enabled per default.
I wrote a regression script which wraps that
cargo treecommand and can be in-cooperated into theCI in a future MR.
pallet-bags-list-fuzzer requires
runtime-benchmarksFixed by creating a dedicated
fuzzfeature which gates the required functions.Polkadot companion: paritytech/polkadot#5983
Cumulus companion: paritytech/cumulus#1607