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-nomination-pools and pallet-nomination-pools-runtime-api to use umbrella crate #7218

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Nathy-bajo
Copy link

Part of #6504

Polkadot Address: 121HJWZtD13GJQPD82oEj3gSeHqsRYm1mFgRALu4L96kfPD1

@Nathy-bajo Nathy-bajo requested a review from a team as a code owner January 17, 2025 10:08
@Nathy-bajo
Copy link
Author

Please review @re-gius @bkchr

@re-gius re-gius added R0-silent Changes should not be mentioned in any release notes T2-pallets This PR/Issue is related to a particular pallet. labels Jan 28, 2025
@re-gius
Copy link
Contributor

re-gius commented Jan 28, 2025

Clean up files like rustc-ice-2025-01-17T09_35_31-12385.txt, solve merging conflicts and fix CI

@Nathy-bajo
Copy link
Author

Please review @re-gius @bkchr

"sp-tracing?/std",
]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances?/runtime-benchmarks",
Copy link
Contributor

Choose a reason for hiding this comment

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

there is no frame/runtime-benchmarks?

DefaultNoBound, PalletError,
};
use frame_system::pallet_prelude::BlockNumberFor;

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

FixedPointNumber, Perbill,
};
use sp_staking::{EraIndex, StakingInterface};

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

@@ -2667,7 +2648,7 @@ pub mod pallet {
) -> DispatchResult {
let mut bonded_pool = match ensure_root(origin.clone()) {
Ok(()) => BondedPool::<T>::get(pool_id).ok_or(Error::<T>::PoolNotFound)?,
Err(sp_runtime::traits::BadOrigin) => {
Err(_bad_origin) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not keep the exact match here?

Suggested change
Err(_bad_origin) => {
Err(BadOrigin) => {

use frame_system::{EnsureSignedBy, RawOrigin};
use sp_runtime::{BuildStorage, DispatchResult, FixedU128};
use sp_staking::{

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

FixedU128,
};
use sp_staking::{Agent, DelegationInterface};

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

pub use frame_support::{
defensive, defensive_assert, ensure,
traits::{
fungible::{Inspect, InspectFreeze, Mutate, MutateFreeze},
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should import the fungible trait like this. they will collide with fungibles one.

};

pub use frame_support::traits::tokens::{Fortitude::Polite, Preservation::Expendable, Balance};
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO importing enum variant is too much, we should import only Fortitude and Preservation.

OneSessionHandler, RankedMembers, RankedMembersSwapHandler, StorageVersion,
UncheckedOnRuntimeUpgrade, VariantCountOf,
},
PalletError, PalletId, PartialEqNoBound
Copy link
Contributor

Choose a reason for hiding this comment

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

As a note, I think PartialEqNoBound is already imported in derive.

@@ -326,9 +339,11 @@ pub mod testing_prelude {
/// Other helper macros from `frame_support` that help with asserting in tests.
pub use frame_support::{
assert_err, assert_err_ignore_postinfo, assert_error_encoded_size, assert_noop, assert_ok,
assert_storage_noop, ensure, hypothetically, storage_alias,
assert_storage_noop, hypothetically, storage_alias, DefaultNoBound,
Copy link
Contributor

Choose a reason for hiding this comment

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

why is ensure removed? DefaultNoBound should already be in prelude through derive IIRC

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants