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

[AHM] Revert multi-block election, slashing and staking client pallets #7939

Merged
merged 43 commits into from
Mar 24, 2025

Conversation

Ank4n
Copy link
Contributor

@Ank4n Ank4n commented Mar 16, 2025

Revert the following PRs which we are pulling from release stable2503:

and leave pallet-staking in its pre-AHM state.

Context

We are forking pallet-staking into pallet-staking (also referred as staking-classic, this is the version that will stay on RC) and pallet-staking-next which will live on AH post AHM.

Additional context: #7858 (comment)

These changes in crate pallet-staking will become the staking classic. The staking next version is worked in the PR #7601.

For AHM migration

The UnappliedSlashes storage will need to be translated from rc::staking-classic to ah::staking-next. Bookmarking [1, 2] the code that can be referred for this.

Follow ups

(cc: @tdimitrov and @seadanda )

  1. Revert pallet-staking v17 migration in westend.
  • Update in code storage version of pallet-staking storage from 17 to 16 (separate PR).
  • Update on chain storage version of pallet-staking storage from 17 to 16. The storage key for pallet-staking on chain version is 0x5f3e4907f716ac89b6347d15ececedca4e7b9012096b41c4eb3aaf947f6ea429 which should be set currently to 0x1100, and needs to be updated to 0x1000.
  • After the runtime upgrade with the code from this PR is deployed on Westend, kill the following storage prefixes under the Pallet prefix Staking:
    • OffenceQueue
    • OffenceQueueEras
    • ProcessingOffence
    • UnappliedSlashes: This also exists in staking-classic as a storage map (one key) and in pre-revert code as double storage map (two keys). Killing with prefix UnappliedSlashes may kill the ones created post upgrade (but that's okay for westend).
    • VoterSnapshotStatus
    • NextElectionPage
    • ElectableStashes
  1. Remove exposure dependency
    Worked in the PR: [AHM] Replace Validator FullIdentification from Exposure to Existence #7936.

@@ -1874,7 +1863,6 @@ pub mod migrations {
parachains_shared::migration::MigrateToV1<Runtime>,
parachains_scheduler::migration::MigrateV2ToV3<Runtime>,
pallet_staking::migrations::v16::MigrateV15ToV16<Runtime>,
pallet_staking::migrations::v17::MigrateV16ToV17<Runtime>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In westend this has already been applied, but we can just sudo kill any storage keys created (if any). If there are any slashes it will be dropped, but for the testnet that's okay.

@Ank4n Ank4n added I4-refactor Code needs refactoring. T2-pallets This PR/Issue is related to a particular pallet. labels Mar 17, 2025
@Ank4n Ank4n marked this pull request as ready for review March 17, 2025 06:42
@Ank4n Ank4n requested review from acatangiu and a team as code owners March 17, 2025 06:42
@seadanda seadanda changed the title [AHM] Revert multi-block election and slashing from staking-classic [AHM] Revert multi-block election, slashing and staking client pallets Mar 21, 2025
@Ank4n
Copy link
Contributor Author

Ank4n commented Mar 21, 2025

There are a few follow-up tasks I’ve mentioned in the PR description that we’ll need to address separately.
Kian also suggested keeping some changes in master, which we can handle in a separate PR.

@seadanda
Copy link
Contributor

seadanda commented Mar 21, 2025

Great, sounds good. happy to merge. Edit: when the semver check is happy

@seadanda seadanda enabled auto-merge March 21, 2025 16:13
Copy link
Contributor

@Overkillus Overkillus left a comment

Choose a reason for hiding this comment

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

Had a look at the changes today and have questions and things I want to confirm.

  1. There was supposed to be a clear distinction between pallet-staking-classic and pallet-staking-next. Will there be a rename for pallet-staking-classic? Or is out of scope of this PR? From Kian's comment:

Backport this to stable 2503. This means in stable2503 there should(n't) be pallet-staking, there should be only pallet-staking-classic and pallet-staking-next.

I'm just trying to understand what changes are within the scope of this PR.

  1. Just a triple check confirmation but we are "backporting" ONLY to 2503? Or will changes propagate to 2412 as well in form of patch releases?

  2. I understand that we are doing an on master revert and for the sake of history preservation the now reverted prdocs will still show up in the next release but they should be edited to clearly link to this PR/prdoc otherwise audiences might mistakenly think they were actually shipped and never reverted.

Thanks Tsveto for taking over 🙏

@seadanda
Copy link
Contributor

  1. There was supposed to be a clear distinction between pallet-staking-classic and pallet-staking-next. Will there be a rename for pallet-staking-classic?

I'm opposed to renaming 'pallet-staking', and actually don't think 'staking-next' will age well. I just think 'pallet-staking' vs 'pallet-staking-parachain'/'cumulus-pallet-staking' or 'pallet-staking-multi-block' or something along those lines is a good distinction that will stay relevant through the years.

  1. Just a triple check confirmation but we are "backporting" ONLY to 2503? Or will changes propagate to 2412 as well in form of patch releases?

Yea the changes didn't exist in master when 2412 was branched off so there's nothing to revert there.

  1. I understand that we are doing an on master revert and for the sake of history preservation the now reverted prdocs will still show up in the next release but they should be edited to clearly link to this PR/prdoc otherwise audiences might mistakenly think they were actually shipped and never reverted.

Yea I agree, I think the old prdocs should be removed as their key purpose is to alert users to changes, and with a reversion there are none except those small ones introduced by this PR (#7939 (comment)). There's still some tidying to do to satisfy the semver bot.

Co-authored-by: Maciej <maciej.zyszkiewicz@parity.io>
@seadanda seadanda added this pull request to the merge queue Mar 24, 2025
@Ank4n Ank4n removed this pull request from the merge queue due to a manual request Mar 24, 2025
@Ank4n Ank4n enabled auto-merge March 24, 2025 09:41
@Ank4n Ank4n added this pull request to the merge queue Mar 24, 2025
@Ank4n Ank4n removed this pull request from the merge queue due to a manual request Mar 24, 2025
@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/14034262148
Failed job name: check-try-runtime

@Ank4n Ank4n enabled auto-merge March 24, 2025 13:15
@Ank4n Ank4n added this pull request to the merge queue Mar 24, 2025
Merged via the queue into master with commit b82ef54 Mar 24, 2025
247 of 259 checks passed
@Ank4n Ank4n deleted the ankn/staking-classic branch March 24, 2025 13:59
@paritytech-release-backport-bot

Git push to origin failed for stable2503 with exitcode 1

Ank4n added a commit that referenced this pull request Mar 25, 2025
#7939)

Revert the following PRs which we are pulling from release stable2503:
- #7582
- #7424
- #7282

and leave pallet-staking in its pre-AHM state.

We are forking pallet-staking into `pallet-staking` (also referred as
staking-classic, this is the version that will stay on RC) and
`pallet-staking-next` which will live on AH post AHM.

Additional context:
#7858 (comment)

These changes in crate `pallet-staking` will become the staking classic.
The staking next version is worked in the PR #7601.

The `UnappliedSlashes` storage will need to be translated from
`rc::staking-classic` to `ah::staking-next`.
[Bookmarking](https://github.com/paritytech/polkadot-sdk/blob/master/substrate/frame/staking/src/migrations.rs#L91)
the code that can be referred for this.

(cc: @tdimitrov and @seadanda )
1) Revert pallet-staking v17 migration in westend.
- Update `in code storage version` of pallet-staking storage from 17 to
16 (separate PR).
- Update `on chain storage version` of pallet-staking storage from 17 to
16. The storage key for pallet-staking on chain version is
`0x5f3e4907f716ac89b6347d15ececedca4e7b9012096b41c4eb3aaf947f6ea429`
which should be set currently to `0x1100`, and needs to be updated to
`0x1000`.
- After the runtime upgrade with the code from this PR is deployed on
Westend, kill the following storage prefixes under the Pallet prefix
`Staking`:
  - OffenceQueue
  - OffenceQueueEras
  - ProcessingOffence
- UnappliedSlashes: This also exists in staking-classic as a storage map
(one key) and in pre-revert code as double storage map (two keys).
Killing with prefix `UnappliedSlashes` may kill the ones created post
upgrade (but that's okay for westend).
  - VoterSnapshotStatus
  - NextElectionPage
  - ElectableStashes

2) Remove exposure dependency
Worked in the PR: #7936.

---------

Co-authored-by: Tsvetomir Dimitrov <tsvetomir@parity.io>
Co-authored-by: Maciej <maciej.zyszkiewicz@parity.io>
EgorPopelyaev pushed a commit that referenced this pull request Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A4-backport-stable2503 Pull request must be backported to the stable2503 release branch I4-refactor Code needs refactoring. T2-pallets This PR/Issue is related to a particular pallet.
Projects
Status: Scheduled
Development

Successfully merging this pull request may close these issues.

7 participants