Skip to content

Implements a mechanism to lock/unlock the SortedListProvider and bags-list iter (v2)#6520

Closed
gpestana wants to merge 11 commits intomasterfrom
gpestana/bags-list_lock_relaxed
Closed

Implements a mechanism to lock/unlock the SortedListProvider and bags-list iter (v2)#6520
gpestana wants to merge 11 commits intomasterfrom
gpestana/bags-list_lock_relaxed

Conversation

@gpestana
Copy link
Copy Markdown
Contributor

@gpestana gpestana commented Nov 18, 2024

Note: to check how to use this mechanism in the context of the EPM-MB, refer to #6610 which merges this branch and refactors the multi-block snapshot creation with the sorted list preserve order logic.


This PR refactors the bags list pallet to support a mode which preserves the order of the elements in the list.

While the implementor of a new bags-list's config type Config::PreserveOrder returns true, no rebags or moves within a bag are allowed. Which in practice means that:

  • calling Pallet::rebag, Pallet::put_in_front_of and Pallet::put_in_front_of_other will return an error.
  • calling SortedListProvider::on_update is a noop (to avoid rebags).

The Staking pallet implements the preserve order getter, which should be set while a multi-block snapshot is progressing. For now, it returns always false but the implementation should map the state of the snapshot progress in the multi-block staking (#6034).

Closes #6328

@gpestana gpestana requested a review from a team as a code owner November 18, 2024 11:22
@gpestana gpestana self-assigned this Nov 18, 2024
@gpestana gpestana added the T2-pallets This PR/Issue is related to a particular pallet. label Nov 18, 2024
@gpestana gpestana marked this pull request as draft November 18, 2024 11:24
@gpestana gpestana changed the title Gpestana/bags list lock relaxed Implements a mechanism to lock/unlock the SortedListProvider and bags-list iter (v2) Nov 18, 2024
@gpestana gpestana requested review from Ank4n and kianenigma November 18, 2024 13:52
@gpestana gpestana marked this pull request as ready for review November 18, 2024 16:27
@gpestana
Copy link
Copy Markdown
Contributor Author

bot fmt

@gpestana
Copy link
Copy Markdown
Contributor Author

bot clean

@command-bot command-bot bot deleted a comment from paritytech-workflow-stopper bot Nov 18, 2024
@command-bot command-bot bot deleted a comment from paritytech-workflow-stopper bot Nov 18, 2024
@command-bot command-bot bot deleted a comment from paritytech-workflow-stopper bot Nov 18, 2024
@paritytech-review-bot paritytech-review-bot bot requested a review from a team November 21, 2024 22:18
@gpestana gpestana requested a review from Ank4n November 21, 2024 22:33
@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/11962829050
Failed job name: test-linux-stable

@kianenigma kianenigma closed this Feb 12, 2025
@kianenigma kianenigma reopened this Feb 12, 2025
@kianenigma kianenigma closed this Feb 12, 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 <g6pestana@gmail.com>
Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
Co-authored-by: command-bot <>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Giuseppe Re <giuseppe.re@parity.io>
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 <g6pestana@gmail.com>
Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
Co-authored-by: command-bot <>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Giuseppe Re <giuseppe.re@parity.io>
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

Development

Successfully merging this pull request may close these issues.

Add sort pause in bags list and trait SortedListProvider

4 participants