-
Notifications
You must be signed in to change notification settings - Fork 721
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
Migrate pallet-nis benchmark to v2 #6293
base: master
Are you sure you want to change the base?
Conversation
/cmd prdoc --bump patch --audience runtime_dev |
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.
Can you also migrate this pallet to the umbrella crate, as a part of this migration?
Here's an example PR: #5995
@@ -0,0 +1,10 @@ | |||
title: Migrate pallet-nis benchmark to v2 |
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 PR should have the label silent and need not have a PRdoc.
Adding this label is something that only our contributors can do atm.
Sure, will check that. |
@kianenigma @re-gius, please review. |
I updated the PR description. Can I call this? |
Please take a look at CI errors. Also comment in #6504 if you're migrating |
bot bench substrate-pallet --features=runtime-benchmarks --pallet=pallet_nis |
substrate/frame/support/src/lib.rs
Outdated
@@ -909,7 +909,7 @@ pub mod pallet_prelude { | |||
Task, TypedGet, | |||
}, | |||
Blake2_128, Blake2_128Concat, Blake2_256, CloneNoBound, DebugNoBound, EqNoBound, Identity, | |||
PartialEqNoBound, RuntimeDebugNoBound, Twox128, Twox256, Twox64Concat, | |||
PalletId, PartialEqNoBound, RuntimeDebugNoBound, Twox128, Twox256, Twox64Concat, |
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.
You're not supposed to change this pallet in the context of migration to the umbrella crate
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.
Otherwise, I have to depend on frame-support and use frame_support::PalletId
. I think this is a part of migration to the umbrella crate.
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.
You should add frame_support::PalletId
in a prelude in the umbrella crate (file mentioned in the other comment) and avoid changing this pallet.
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.
Make sense.
But after some thoughts, I think it's also good to place the PalletId
here.
I added PalletId
to frame-support's root 3 years ago paritytech/substrate#8477. At that time, there wasn't a really good place for it. I think it's a good time to move it into frame_support::pallet_prelude
, it is being used frequently.
pub use weights::WeightInfo; | ||
|
||
use alloc::{vec, vec::Vec}; | ||
use frame::{ |
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.
while this is Rust-correct, it does not follow the guidelines for migrations to the umbrella crate (see here). For instance, DefensiveSaturating
is used across several pallets, so it should go into the main prelude. You should edit this and add new imports into the main preludes according to the guidelines. Ideally, we'd like to have just a use frame::prelude::*
statement here. While this won't be probably the case because of ad-hoc imports for this pallet, having these many ad-hoc imports kind of defeats the whole purpose of having the umbrella crate.
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.
Conflicts with your previous comment?!
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 think we should proceed with this once "migrate to umbrella" is completed? I'm uncertain about which one is being utilized most often. Additionally, I've noticed many crates are still referencing use frame::traits::Currency
. Isn't Currency
a common used trait? Shouldn't it be included in the prelude? There are many aspects that remain quite unclear to me at this moment.
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.
You're part of this migration process (if you want to), meaning that as we migrate new pallets to the umbrella crate, we notice that we need to add new imports to the preludes and we do that if those imports affect more than one pallet (see guidelines). The guidelines I mentioned also say why currency-related traits are kept out of this, please take a look.
Adding new imports to the umbrella crate is the main part of this task.
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.
Well.. That currency guidelines has been collapsed. So I missed that one.
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.
fungible
, nonfungible
and tokens
should belong to currency? I didn't expose them to prelude.
7a8e7a5
to
fa89f0c
Compare
frame
crate.construct_runtime
in mock.PalletId
toframe::pallet_prelude
.