-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix nostd build of several crates #4060
Conversation
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Can be tried with v1.4 `zepter lint no-std default-features-of-nostd-dependencies-disabled --fix` Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
I dont know why this is needed, but otherwise it will not build with the error of the pallet being unknown. Maybe the construct_runtime! syntax does not actually support feature gates. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@@ -36,7 +36,7 @@ pallet-nfts = { path = "../../../../../substrate/frame/nfts", default-features = | |||
pallet-nfts-runtime-api = { path = "../../../../../substrate/frame/nfts/runtime-api", default-features = false } | |||
pallet-proxy = { path = "../../../../../substrate/frame/proxy", default-features = false } | |||
pallet-session = { path = "../../../../../substrate/frame/session", default-features = false } | |||
pallet-state-trie-migration = { path = "../../../../../substrate/frame/state-trie-migration", default-features = false, optional = true } | |||
pallet-state-trie-migration = { path = "../../../../../substrate/frame/state-trie-migration", default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still be gated by the construct_runtime! feature gate. But i think that is not actually working, otherwise this change would not be needed 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What?
Generally we don't need this anymore and the state migration should already have been finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still deployed though, will double-check and remove it then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhf, did we really genesis the asset-hub-rococo with state_version 0?
I just queried Core::version
of the 1.1 runtime and it returns state_version=0...
Looks like it was copy&pasted from AHK. @cheme can you double-check please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch https://github.com/polkadot-fellows/runtimes/blob/31ba26287ec752574244f0d690167f7ae8430c8b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs#L153 . (kusuma is fine).
Statemint on rococo (I guess it is now assethub, not sure) was migrated IIRC or was it only on westend cc @PierreBesson ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant it here for the Asset-hub-rococo:
#[cfg(feature = "state-trie-version-1")] |
Not sure, since when i queried the runtime api it returned version 0. Maybe we can check with the RPC but the public node does not support it.
PS: Can you maybe create an issue to track the migration of the different runtimes? Or it already exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@@ -36,7 +36,7 @@ pallet-nfts = { path = "../../../../../substrate/frame/nfts", default-features = | |||
pallet-nfts-runtime-api = { path = "../../../../../substrate/frame/nfts/runtime-api", default-features = false } | |||
pallet-proxy = { path = "../../../../../substrate/frame/proxy", default-features = false } | |||
pallet-session = { path = "../../../../../substrate/frame/session", default-features = false } | |||
pallet-state-trie-migration = { path = "../../../../../substrate/frame/state-trie-migration", default-features = false, optional = true } | |||
pallet-state-trie-migration = { path = "../../../../../substrate/frame/state-trie-migration", default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What?
Generally we don't need this anymore and the state migration should already have been finished.
@@ -18,36 +18,9 @@ | |||
//! Supporting types for try-runtime, testing and dry-running commands. | |||
|
|||
#![cfg_attr(not(feature = "std"), no_std)] | |||
#![cfg(feature = "try-runtime")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes no sense that this crate has a try-runtime
feature.. This crate should only be activated if you use try-runtime
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it would enable the try-runtime
feature of all dependencies by default?
I dont remember if this can cause issues with feature unification, but maybe it works since the crate would disabled otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay actually this will make --workspace
not compile anymore, since it enables all crates. You can check it with cargo tree --workspace
and see that frame-system-benchmarking
is enabled at the top-level @bkchr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah okay... 🦭
Maybe having the try_runtime
types in frame-support
not behind a feature would be a better solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some traits with feature gated functions. Maybe that is an anti-pattern in itself... should probably be an extension trait that is only selectively required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean the functions is fine, I would probably just not hide the traits etc in try_runtime.rs
. But in the end this is all discussable and we can keep it like it is done right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally just don't like these inner.rs
files.
|
||
#![cfg_attr(not(feature = "std"), no_std)] | ||
#![cfg(feature = "runtime-benchmarks")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same. This crate should only be activated when you are compiling runtime benchmarks.
substrate/frame/src/lib.rs
Outdated
// NOTE that we put the actual code into another module to keep the no-std capability of this create | ||
// even when the `experimental` feature is disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this comment. Also generally it doesn't make sense that the experimental
feature disables everything of this crate.
What is the purpose of this feature then? Just don't use the crate if you don't want to use experimental stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay i reverted the changes to the FRAME crate. Apparently it is not published anyway - so should not be needed for the umbrella crate until then.
Also increased the warning in the docs. I could not rename it since the name is used in some crate-access generation macros and repeated often in docs... can fix in the future once we start publishing.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
# This pallet will migrate the entire state, controlled through some account. | ||
# | ||
# This feature should be removed when the main-net will be migrated. | ||
state-trie-version-1 = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh now I remembre, this is used for multiple network so the feature was needed to have one running V0 while another one was already migrated (likely westend/rococo a long time ago).
Sounds ok to remove it so migration got started everywhere. One point I am not sure is related to the account use as controller: currently it is hardcoded to :
pub const MigController: AccountId = AccountId::from(hex_literal::hex!("8458ed39dc4b6f6c7255f7bc42be50c2967db126357c999d44e12ca7ac80dc52"));
pub const RootMigController: AccountId = AccountId::from(hex_literal::hex!("8458ed39dc4b6f6c7255f7bc42be50c2967db126357c999d44e12ca7ac80dc52"));
probably would need a different one per network, this is not really convenient.
Worst case, what can happen with this chain is some parachain moving to hybrid mode (both v0 and v1 in tree, if warpsync is not use by the parachain this should not be an issue) and not being able to migrate because no account to process the typescript driven migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay thanks for the context. For Rococo it is probably fine, as it will be decommissioned soon anyway.
Just going to leave it as is, and hope that DevOps has the keys. Otherwise we do another upgrade or root call etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm we have the key to 0x8458ed39dc4b6f6c7255f7bc42be50c2967db126357c999d44e12ca7ac80dc52
to be able to process the migration.
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Preparation for #3935 Changes: - Add some `default-features = false` for the case that a crate and that dependency both support nostd builds. - Shuffle files around of some benchmarking-only crates. These conditionally disabled the `cfg_attr` for nostd and pulled in libstd. Example [here](ggwpez/zepter#95). The actual logic is moved into a `inner.rs` to preserve nostd capability of the crate in case the benchmarking feature is disabled. - Add some `use sp_std::vec` where needed. - Remove some `optional = true` in cases where it was not optional. - Removed one superfluous `cfg_attr(not(feature = "std"), no_std..`. All in all this should be logical no-op. --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Preparation for #3935
Changes:
default-features = false
for the case that a crate and that dependency both support nostd builds.cfg_attr
for nostd and pulled in libstd. Example here. The actual logic is moved into ainner.rs
to preserve nostd capability of the crate in case the benchmarking feature is disabled.use sp_std::vec
where needed.optional = true
in cases where it was not optional.cfg_attr(not(feature = "std"), no_std..
.All in all this should be logical no-op.