-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Migrate pallet-nis benchmark to v2 #6293
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
Conversation
kianenigma
left a 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.
Can you also migrate this pallet to the umbrella crate, as a part of this migration?
Here's an example PR: #5995
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
| }, | ||
| 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.
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.
In principle, I completely agree with you. The problem here is many parachains depend on frame_support, so a major bump in frame_support could cause breaking changes for external teams. This is why we decided to never touch the frame_support prelude for umbrella crate migrations. If you still strongly feel that the frame support prelude needs an update, then it's probably better to group all the changes in a single PR and have a broad discussion about that.
substrate/frame/nis/src/lib.rs
Outdated
| 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.
Sorry for the delay, will resolve them today later.
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,nonfungibleandtokensshould belong to currency? I didn't expose them to prelude.
There is still a problem. There are a lot of same name traits in those scope.
For example, fungible::Inspect, nofungible::Inspect.
There are 2 ways to resolve this.
- Only expose the mod.
fungible,nofungible, .. - Give them an alias,
pub use fungible::Inspect as FunInspect.
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.
ok, right, then it's maybe better to revert the changes for conflicting names and keep it as it was before
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 can't continue the work if the conclusion is "maybe". 😿
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.
That's my advice, revert those changes, it's better at this point so that we can merge this
7a8e7a5 to
fa89f0c
Compare
Co-authored-by: Giuseppe Re <[email protected]>
|
/cmd bench --pallet pallet_nis --clean |
|
Command "bench --pallet pallet_nis --clean" has started 🚀 See logs here |
|
Command "bench --pallet pallet_nis --clean" has finished ✅ See logs here DetailsSubweight results:No changes found. Command output:✅ Successful benchmarks of runtimes/pallets: |
ggwpez
left a 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.
Thanks!
|
|
||
| #[block] | ||
| { | ||
| Pallet::<T>::process_bid( |
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 we use an extrinsic_call here instead of block?
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.
process_bid is an internal fn.
|
/tip small |
|
The referendum has appeared on Polkassembly. |
c8d3339

framecrate.construct_runtimein mock.PalletIdtoframe::pallet_prelude.Polkadot address: 156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y