Skip to content
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

Merged
merged 27 commits into from
Mar 4, 2025
Merged

Conversation

aurexav
Copy link
Contributor

@aurexav aurexav commented Oct 30, 2024


Polkadot address: 156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y

@aurexav aurexav requested a review from a team as a code owner October 30, 2024 15:12
@aurexav aurexav mentioned this pull request Oct 30, 2024
43 tasks
@re-gius re-gius added T2-pallets This PR/Issue is related to a particular pallet. T12-benchmarks This PR/Issue is related to benchmarking and weights. labels Nov 14, 2024
Copy link
Contributor

@kianenigma kianenigma left a 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

@kianenigma kianenigma added the R0-silent Changes should not be mentioned in any release notes label Nov 15, 2024
@aurexav
Copy link
Contributor Author

aurexav commented Nov 15, 2024

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.

@aurexav
Copy link
Contributor Author

aurexav commented Dec 8, 2024

@kianenigma @re-gius, please review.

@aurexav
Copy link
Contributor Author

aurexav commented Dec 8, 2024

/cmd prdoc --bump patch --audience runtime_dev

I updated the PR description. Can I call this?

@re-gius
Copy link
Contributor

re-gius commented Dec 10, 2024

Please take a look at CI errors. Also comment in #6504 if you're migrating pallet-nis to the umbrella crate in this PR.

@re-gius
Copy link
Contributor

re-gius commented Dec 11, 2024

bot bench substrate-pallet --features=runtime-benchmarks --pallet=pallet_nis

@@ -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,
Copy link
Contributor

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

Copy link
Contributor Author

@aurexav aurexav Dec 11, 2024

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

pub use weights::WeightInfo;

use alloc::{vec, vec::Vec};
use frame::{
Copy link
Contributor

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.

Copy link
Contributor Author

@aurexav aurexav Dec 11, 2024

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?!

Copy link
Contributor Author

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.

Copy link
Contributor

@re-gius re-gius Dec 11, 2024

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

@aurexav aurexav Jan 18, 2025

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.

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.

  1. Only expose the mod. fungible, nofungible, ..
  2. Give them an alias, pub use fungible::Inspect as FunInspect.

Copy link
Contributor

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

Copy link
Contributor Author

@aurexav aurexav Jan 21, 2025

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". 😿

Copy link
Contributor

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

@aurexav aurexav marked this pull request as ready for review March 1, 2025 16:50
Copy link
Contributor

@re-gius re-gius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just a few small changes + I will run the cmd bench bot

aurexav and others added 3 commits March 3, 2025 22:17
Co-authored-by: Giuseppe Re <giuseppe.re@parity.io>
Co-authored-by: Giuseppe Re <giuseppe.re@parity.io>
@paritytech paritytech deleted a comment from github-actions bot Mar 3, 2025
@paritytech paritytech deleted a comment from github-actions bot Mar 3, 2025
@paritytech paritytech deleted a comment from github-actions bot Mar 3, 2025
@paritytech paritytech deleted a comment from github-actions bot Mar 3, 2025
@re-gius
Copy link
Contributor

re-gius commented Mar 3, 2025

/cmd bench --pallet pallet_nis --clean

@github-actions github-actions bot deleted a comment from re-gius Mar 3, 2025
@github-actions github-actions bot deleted a comment from re-gius Mar 3, 2025
Copy link
Contributor

github-actions bot commented Mar 3, 2025

Command "bench --pallet pallet_nis --clean" has started 🚀 See logs here

Copy link
Contributor

github-actions bot commented Mar 3, 2025

Command "bench --pallet pallet_nis --clean" has finished ✅ See logs here

Subweight results:

No changes found.

Command output:

✅ Successful benchmarks of runtimes/pallets:
-- dev: ['pallet_nis']
-- rococo: ['pallet_nis']

Copy link
Member

@ggwpez ggwpez left a 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(
Copy link
Member

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?

Copy link
Contributor Author

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.

@re-gius re-gius added this pull request to the merge queue Mar 4, 2025
@re-gius
Copy link
Contributor

re-gius commented Mar 4, 2025

/tip small

Copy link

@re-gius A referendum for a small (20 DOT) tip was successfully submitted for @aurexav (156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y on polkadot).

Referendum number: 1471.
tip

Copy link

The referendum has appeared on Polkassembly.

Merged via the queue into paritytech:master with commit c8d3339 Mar 4, 2025
248 of 254 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes T2-pallets This PR/Issue is related to a particular pallet. T12-benchmarks This PR/Issue is related to benchmarking and weights.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants