Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Fix staking genesis build #14140

Merged
merged 1 commit into from
May 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions frame/staking/src/pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ pub mod pallet {
MaxNominatorsCount::<T>::put(x);
}

for &(ref stash, ref controller, balance, ref status) in &self.stakers {
for &(ref stash, _, balance, ref status) in &self.stakers {
Copy link
Member

Choose a reason for hiding this comment

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

Then we don't need controller as part of stakers?

Copy link
Member Author

@ggwpez ggwpez May 14, 2023

Choose a reason for hiding this comment

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

Yes, but that would require companions in Polkadot/Cumulus, and the CI checks are already red.
So @paritytech/staking-core could do this as follow-up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Or I do it and you force-merge it 😆

Copy link
Member

Choose a reason for hiding this comment

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

We need prs in Polkadot and cumulus any was to fix ci?

Copy link
Member Author

@ggwpez ggwpez May 14, 2023

Choose a reason for hiding this comment

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

I dont hope so. The checks in paritytech/cumulus#2574 should go green once this is merged, and unless Polkadot turns red in the companion check here it should be good.

Copy link
Member Author

Choose a reason for hiding this comment

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

The tests in Cumulus fail without this change, as you can see.

Copy link
Member

Choose a reason for hiding this comment

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

@rossbulat is there any follow up on this?

Choose a reason for hiding this comment

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

I amended 'stakers' here: paritytech/polkadot#7224

Are the cumulus tests working now?

Copy link
Member

Choose a reason for hiding this comment

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

No I meant to remove controllers from the Vec entirely.

Choose a reason for hiding this comment

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

Issue has been opened.

The most important thing was to put the plug on new unique pairs initially. We now have time to tidy up the code in follow ups.

crate::log!(
trace,
"inserting genesis staker: {:?} => {:?} => {:?}",
Expand All @@ -650,11 +650,11 @@ pub mod pallet {
));
frame_support::assert_ok!(match status {
crate::StakerStatus::Validator => <Pallet<T>>::validate(
T::RuntimeOrigin::from(Some(controller.clone()).into()),
T::RuntimeOrigin::from(Some(stash.clone()).into()),
Default::default(),
),
crate::StakerStatus::Nominator(votes) => <Pallet<T>>::nominate(
T::RuntimeOrigin::from(Some(controller.clone()).into()),
T::RuntimeOrigin::from(Some(stash.clone()).into()),
votes.iter().map(|l| T::Lookup::unlookup(l.clone())).collect(),
),
_ => Ok(()),
Expand Down