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

[DNM] Implementation of ah-client and rc-client staking pallets (the old one) #7357

Closed
wants to merge 212 commits into from

Conversation

tdimitrov
Copy link
Contributor

@tdimitrov tdimitrov commented Jan 28, 2025

This PR is work in progress.

Related issues: #6167 and #6166

This PR introduces the initial structure for pallet-ah-client and pallet-rc-client. These pallets will reside on the relay chain and AssetHub, respectively, and will manage the interaction between pallet-session on the relay chain and pallet-staking on AssetHub.

Both pallets are experimental and not intended for production use.

TODOs:

gpestana and others added 30 commits October 13, 2024 15:34
@tdimitrov tdimitrov added T2-pallets This PR/Issue is related to a particular pallet. T8-polkadot This PR/Issue is related to/affects the Polkadot network. R1-breaking_change This PR introduces a breaking change and should be highlighted in the upcoming release. labels Feb 14, 2025
// A session with the given index has ended. The block authors with their corresponding
// session points are provided.
#[codec(index = 1)]
RelayChainSessionEnd(SessionIndex, Vec<(AccountId32, u32)>),
Copy link
Contributor

Choose a reason for hiding this comment

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

Kusama: 32 + 4 * 1000 ~ 4K bytes
Polkadot: 32 + 4 * 500 ~ 2K bytes

pub struct Pallet<T>(_);

// TODO: should contain some initial state, otherwise starting from genesis won't work
#[pallet::storage]
Copy link
Contributor

Choose a reason for hiding this comment

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

For testing you can use #[pallet::genesis].

For AHM, I think it can remain empty and soon enough a new election result will come form AH.


/// Keeps track of the session points for each block author in the current session.
#[pallet::storage]
pub type BlockAuthors<T: Config> = StorageMap<_, Twox64Concat, AccountId32, u32, ValueQuery>;
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to call this ValidatorPoints.

Also, I just realized that other than block authorship, the parachains protocol also adds points for parachain work.

Copy link
Contributor

Choose a reason for hiding this comment

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

<pallet_staking::Pallet<C>>::reward_by_ids(rewards);

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>
Base automatically changed from kiz-multi-block-eletion to master February 15, 2025 00:17
@github-actions github-actions bot requested review from acatangiu and a team as code owners February 15, 2025 00:17
@tdimitrov tdimitrov changed the title [WIP] Implementation of ah-client and rc-client staking pallets [WIP] Implementation of ah-client and rc-client staking pallets [OLD ONE] Feb 15, 2025
@tdimitrov tdimitrov changed the title [WIP] Implementation of ah-client and rc-client staking pallets [OLD ONE] [DNM] Implementation of ah-client and rc-client staking pallets (the old one) Feb 15, 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/13342564238
Failed job name: test-linux-stable

@tdimitrov tdimitrov closed this Feb 15, 2025
@tdimitrov tdimitrov deleted the tsv-ahm-staking-pallet branch February 15, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R1-breaking_change This PR introduces a breaking change and should be highlighted in the upcoming release. T2-pallets This PR/Issue is related to a particular pallet. T8-polkadot This PR/Issue is related to/affects the Polkadot network.
Projects
Status: Done
Status: In progress
Development

Successfully merging this pull request may close these issues.

6 participants