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

Implementation of ah-client and rc-client staking pallets #7582

Merged
merged 34 commits into from
Feb 18, 2025

Conversation

tdimitrov
Copy link
Contributor

Recreation of #7357 on top of master. The old PR messes up the git history too much so I am recreating it from scratch.

This PR is work in progress. It's purpose is to commit initial structure of pallet-staking-ah-client and pallet-staking-rc-client to master. The changes will be polished by a follow up PRs which will be backported.

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:

@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 15, 2025
@tdimitrov tdimitrov requested a review from a team as a code owner February 15, 2025 07:06
#[pallet::storage]
pub type ValidatorSet<T: Config> = StorageValue<
_,
Option<Vec<(T::AccountId, Exposure<T::AccountId, BalanceOf<T>>)>>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A comment from @kianenigma

Also exposures will not be stored anywhere in RC anymore, so they should not be in this storage?
RC will only know the list of validators.

@Ank4n rasied the same point. He removed Exposure in his PR but since we are working in parallel I can't use its work here.

I'm leaving this as is for now and will remove it in the next PRs.

}
}

fn start_session(session_index: u32) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

From @Ank4n (old comment)

What we do need to send is the block timestamp (unless @kianenigma thought of a better approach) when this pallet provides a new validator set to the session—essentially the timestamp marking an era change. This will help AH calculate staking rewards for validators in that era.


/// 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 Author

Choose a reason for hiding this comment

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

TODO:

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

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

@tdimitrov tdimitrov changed the title [WIP] Implementation of ah-client and rc-client staking pallets Implementation of ah-client and rc-client staking pallets 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/13343410856
Failed job name: test-linux-stable

@kianenigma kianenigma enabled auto-merge February 17, 2025 15:25
@kianenigma kianenigma added this pull request to the merge queue Feb 18, 2025
Merged via the queue into master with commit 669b889 Feb 18, 2025
222 of 232 checks passed
@kianenigma kianenigma deleted the tsv-ahm-staking-pallets branch February 18, 2025 03:46
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: Scheduled
Development

Successfully merging this pull request may close these issues.

3 participants