Skip to content

[AHM] Adds multi-block election types and refactors current pallets to support new interfaces and types#6034

Closed
gpestana wants to merge 120 commits intomasterfrom
gpestana/epm-mb
Closed

[AHM] Adds multi-block election types and refactors current pallets to support new interfaces and types#6034
gpestana wants to merge 120 commits intomasterfrom
gpestana/epm-mb

Conversation

@gpestana
Copy link
Copy Markdown
Contributor

@gpestana gpestana commented Oct 13, 2024

This PR refactors the types and structs required to run a mulit-block election and updates the EPM, staking-pallet and all dependent pallets to use the multi-block types. The Westend runtime is configured to run a 1 paged election, which is a noop refactor compared to the current single-block election.

Notable changes since last reviews:

Tasks based on feedback that can be closed after merging this PR: Umbrella ticket for multi-block election tasks to improve after PR#6034.


The multi-block election provider pallet is wip and it's added in a separate PR (#6213).

To-do before merging:

  • test with chopsticks/follow-chain
  • add benchmarks for on_intialize in pallet staking

@gpestana gpestana self-assigned this Oct 13, 2024
@gpestana gpestana requested a review from a team as a code owner October 13, 2024 23:49
@gpestana gpestana requested a review from Ank4n October 13, 2024 23:49
@gpestana gpestana marked this pull request as draft October 13, 2024 23:49
@gpestana gpestana added the T2-pallets This PR/Issue is related to a particular pallet. label Oct 13, 2024
Copy link
Copy Markdown
Contributor

@Ank4n Ank4n left a comment

Choose a reason for hiding this comment

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

Only looked at traits. Will do another pass.

@gpestana gpestana marked this pull request as ready for review October 18, 2024 16:42
@github-actions
Copy link
Copy Markdown
Contributor

Command "bench --pallet pallet_staking" has failed ❌! See logs here

Details

Command output:

❌ Failed benchmarks of runtimes/pallets:
-- dev: ['pallet_staking']
✅ Successful benchmarks of runtimes/pallets:
-- westend: ['pallet_staking']

@kianenigma
Copy link
Copy Markdown
Contributor

/cmd fmt

@github-actions
Copy link
Copy Markdown
Contributor

Command "fmt" has started 🚀 See logs here

@github-actions
Copy link
Copy Markdown
Contributor

Command "fmt" has finished ✅ See logs here

@kianenigma
Copy link
Copy Markdown
Contributor

/cmd bench --pallet pallet_staking

@github-actions
Copy link
Copy Markdown
Contributor

Command "bench --pallet pallet_staking" has started 🚀 See logs here

@kianenigma kianenigma changed the title Adds multi-block election types and refactors current pallets to support new interfaces and types [AHM] Adds multi-block election types and refactors current pallets to support new interfaces and types Jan 23, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Command "bench --pallet pallet_staking" has failed ❌! See logs here

Details

Command output:

❌ Failed benchmarks of runtimes/pallets:
-- dev: ['pallet_staking']
✅ Successful benchmarks of runtimes/pallets:
-- westend: ['pallet_staking']

@paritytech-workflow-stopper
Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/12931586313
Failed job name: run-frame-omni-bencher

@kianenigma
Copy link
Copy Markdown
Contributor

This PR is in more or less good shape, but fixing its benchmarks would lead to an amount of work that I don't see useful because #7282 will alter more things, and fixing them there would be more fruitful.

@Ank4n @tdimitrov if you agree, I will close this, and we will make #7282 the main feature branch of all things staking related?

This PR can still be used as a checkpoint to audit part of the code @seadanda.

@tdimitrov
Copy link
Copy Markdown
Contributor

This PR is in more or less good shape, but fixing its benchmarks would lead to an amount of work that I don't see useful because #7282 will alter more things, and fixing them there would be more fruitful.

@Ank4n @tdimitrov if you agree, I will close this, and we will make #7282 the main feature branch of all things staking related?

This PR can still be used as a checkpoint to audit part of the code @seadanda.

If I understand correctly both PRs add multi-block election to staking. I have no preference which one we will use as a feature branch.

Out of curiosity - why they both exist?

@kianenigma kianenigma closed this Jan 28, 2025
github-merge-queue bot pushed a commit that referenced this pull request Feb 15, 2025
## Multi Block Election Pallet

This PR adds the first iteration of the multi-block staking pallet. 

From this point onwards, the staking and its election provider pallets
are being customized to work in AssetHub. While usage in solo-chains is
still possible, it is not longer the main focus of this pallet. For a
safer usage, please fork and user an older version of this pallet.

---

## Replaces

- [x] #6034 
- [x] #5272

## Related PRs: 

- [x] #7483
- [ ] #7357
- [ ] #7424
- [ ] paritytech/polkadot-staking-miner#955

This branch can be periodically merged into
#7358 ->
#6996

## TODOs: 

- [x] rebase to master 
- Benchmarking for staking critical path
  - [x] snapshot
  - [x] election result
- Benchmarking for EPMB critical path
  - [x] snapshot
  - [x] verification
  - [x] submission
  - [x] unsigned submission
  - [ ] election results fetching
- [ ] Fix deletion weights. Either of
  - [ ] Garbage collector + lazy removal of all paged storage items
  - [ ] Confirm that deletion is small PoV footprint.
- [ ] Move election prediction to be push based. @tdimitrov 
- [ ] integrity checks for bounds 
- [ ] Properly benchmark this as a part of CI -- for now I will remove
them as they are too slow
- [x] add try-state to all pallets
- [x] Staking to allow genesis dev accounts to be created internally
- [x] Decouple miner config so @niklasad1 can work on the miner
72841b7
- [x] duplicate snapshot page reported by @niklasad1 
- [ ] #6520 or equivalent
-- during snapshot, `VoterList` must be locked
- [ ] Move target snapshot to a separate block

---------

Co-authored-by: Gonçalo Pestana <[email protected]>
Co-authored-by: Ankan <[email protected]>
Co-authored-by: command-bot <>
Co-authored-by: Guillaume Thiolliere <[email protected]>
Co-authored-by: Giuseppe Re <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
clangenb pushed a commit to clangenb/polkadot-sdk that referenced this pull request Feb 19, 2025
## Multi Block Election Pallet

This PR adds the first iteration of the multi-block staking pallet. 

From this point onwards, the staking and its election provider pallets
are being customized to work in AssetHub. While usage in solo-chains is
still possible, it is not longer the main focus of this pallet. For a
safer usage, please fork and user an older version of this pallet.

---

## Replaces

- [x] paritytech#6034 
- [x] paritytech#5272

## Related PRs: 

- [x] paritytech#7483
- [ ] paritytech#7357
- [ ] paritytech#7424
- [ ] paritytech/polkadot-staking-miner#955

This branch can be periodically merged into
paritytech#7358 ->
paritytech#6996

## TODOs: 

- [x] rebase to master 
- Benchmarking for staking critical path
  - [x] snapshot
  - [x] election result
- Benchmarking for EPMB critical path
  - [x] snapshot
  - [x] verification
  - [x] submission
  - [x] unsigned submission
  - [ ] election results fetching
- [ ] Fix deletion weights. Either of
  - [ ] Garbage collector + lazy removal of all paged storage items
  - [ ] Confirm that deletion is small PoV footprint.
- [ ] Move election prediction to be push based. @tdimitrov 
- [ ] integrity checks for bounds 
- [ ] Properly benchmark this as a part of CI -- for now I will remove
them as they are too slow
- [x] add try-state to all pallets
- [x] Staking to allow genesis dev accounts to be created internally
- [x] Decouple miner config so @niklasad1 can work on the miner
72841b7
- [x] duplicate snapshot page reported by @niklasad1 
- [ ] paritytech#6520 or equivalent
-- during snapshot, `VoterList` must be locked
- [ ] Move target snapshot to a separate block

---------

Co-authored-by: Gonçalo Pestana <[email protected]>
Co-authored-by: Ankan <[email protected]>
Co-authored-by: command-bot <>
Co-authored-by: Guillaume Thiolliere <[email protected]>
Co-authored-by: Giuseppe Re <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@Ank4n Ank4n deleted the gpestana/epm-mb branch April 18, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T2-pallets This PR/Issue is related to a particular pallet.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

10 participants