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] Multi-block staking election pallet #7282

Merged
merged 187 commits into from
Feb 15, 2025
Merged

Conversation

kianenigma
Copy link
Contributor

@kianenigma kianenigma commented Jan 21, 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

Related PRs:

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

TODOs:

  • rebase to master
  • Benchmarking for staking critical path
    • snapshot
    • election result
  • Benchmarking for EPMB critical path
    • snapshot
    • verification
    • submission
    • 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
  • add try-state to all pallets
  • Staking to allow genesis dev accounts to be created internally
  • Decouple miner config so @niklasad1 can work on the miner 72841b7
  • duplicate snapshot page reported by @niklasad1
  • Implements a mechanism to lock/unlock the SortedListProvider and bags-list iter (v2) #6520 or equivalent -- during snapshot, VoterList must be locked
  • Move target snapshot to a separate block

gpestana and others added 30 commits October 13, 2024 15:34
@kianenigma kianenigma disabled auto-merge February 13, 2025 23:09
@kianenigma
Copy link
Contributor Author

/cmd prdoc

@kianenigma kianenigma enabled auto-merge February 14, 2025 08:16
@kianenigma kianenigma disabled auto-merge February 14, 2025 08:16
Copy link
Contributor

Command "prdoc" has failed ❌! See logs here


fn elect(page: PageIndex) -> Result<BoundedSupportsOf<Self>, Self::Error> {
if page == 0 && !cfg!(feature = "runtime-benchmarks") {
// TODO: later on, we can even compare the results of the multi-page and multi-block
Copy link
Member

Choose a reason for hiding this comment

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

perhaps open an issue for this, it's only on the substrate-node so I'm not that bothered by this

@kianenigma
Copy link
Contributor Author

/cmd prdoc --force

Copy link
Member

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

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

good stuff :)

I haven't reviewed all code yet but from the staking-miner's point of view I like the APIs so far.

We probably should go over the rest of the TODO's in the code and fix them in a follow-up PR or something.

@kianenigma
Copy link
Contributor Author

/cmd help

Copy link
Contributor

Command "help" has started 🚀 See logs here

@kianenigma
Copy link
Contributor Author

bot help

@command-bot
Copy link

command-bot bot commented Feb 14, 2025

Here's a link to docs

Copy link
Contributor

We have migrated the command bot to GHA

Please, see the new usage instructions here or here. Soon the old commands will be disabled.

Copy link
Contributor

Command "help" has failed ❌! See logs here

@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/13334396916
Failed job name: run-frame-omni-bencher

@kianenigma kianenigma enabled auto-merge February 14, 2025 23:21
@kianenigma kianenigma added this pull request to the merge queue Feb 14, 2025
Merged via the queue into master with commit a025562 Feb 15, 2025
214 of 232 checks passed
@kianenigma kianenigma deleted the kiz-multi-block-eletion branch February 15, 2025 00:17
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>
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
Status: Done
Status: In progress
Development

Successfully merging this pull request may close these issues.

7 participants