Skip to content

staking-async: allow session keys handling on AssetHub#10666

Merged
sigurpol merged 75 commits intomasterfrom
sigurpol-session-keys-asset-hub
Jan 26, 2026
Merged

staking-async: allow session keys handling on AssetHub#10666
sigurpol merged 75 commits intomasterfrom
sigurpol-session-keys-asset-hub

Conversation

@sigurpol
Copy link
Copy Markdown
Contributor

@sigurpol sigurpol commented Dec 16, 2025

Key Points :

  1. Flow: User calls set_keys on AH → AH validates keys/proof → AH sends XCM to RC → RC calls set_keys_from_ah → RC sets keys via SessionInterface

  2. Fee model: Total fee = delivery fee + execution cost, all charged on AH upfront; RC uses UnpaidExecution

  3. Validation split:

    • AH validates keys format and ownership proof (prevents XCM queue bloating)
    • RC trusts AH's validation and just stores the keys
  4. Access control:

    • set_keys: Requires caller to be a registered validator
    • purge_keys: Anyone can call (allows chilled validators to purge keys)

Notes:

  • Staking proxies can call set_keys and purge_keys on behalf of validators. The ProxyType::Staking filter on runtime has been updated to include these calls.
  • Validators are still allowed to call set_keys and purge_keys via relay-chain pallet-session's extrinsics. This option will be deprecated in the future.
  • No key deposit is required on AssetHub.
  • Workflow Change: unlike the current flow for new validators on RC (bond -> set_keys -> validate), users on Asset Hub MUST call bond and validate BEFORE calling set_keys. Attempting to set keys before declaring intent to validate will fail with NotValidator.

Close #8806.

@sigurpol sigurpol requested a review from a team as a code owner December 16, 2025 15:49
@sigurpol sigurpol added the T2-pallets This PR/Issue is related to a particular pallet. label Dec 16, 2025
@sigurpol
Copy link
Copy Markdown
Contributor Author

/cmd prdoc --audience runtime_dev --bump major

@sigurpol sigurpol changed the title staking-async: allow session keys handling on AssetHub 🚧 staking-async: allow session keys handling on AssetHub Dec 16, 2025
@sigurpol sigurpol force-pushed the sigurpol-session-keys-asset-hub branch from 4f19e9b to 06c4e0e Compare December 17, 2025 08:21
…a AH

- Allow setting or purging keys via AH -> XCM -> RC.
-  Maintain the option to set or purge keys via RC for backward compatibility.
-  We do not yet enforce or handle deposits on AH; this will be addressed once
RC extrinsics are fully deprecated.
-  Updated Westend RC to set the deposit to 0, aligning it with the current
Polkadot/Kusama RC, and modified Westend AH to support setting or purging keys.

TODO:
-  Tests
-  Benchmarking
@sigurpol sigurpol force-pushed the sigurpol-session-keys-asset-hub branch from 06c4e0e to dc9400a Compare December 17, 2025 08:57
@sigurpol
Copy link
Copy Markdown
Contributor Author

Main outcome of discussion with @Ank4n :

  • fire and forget when setting / purging keys from AH to RC
  • raw bytes as keys
  • it's ok to have a transition period where we allows keys to be set / purged both on AH and RC to have an easy transitions for validators / tools. We will deprecated and remove RC extrinsics later on

@sigurpol sigurpol changed the title 🚧 staking-async: allow session keys handling on AssetHub staking-async: allow session keys handling on AssetHub Dec 18, 2025
@sigurpol sigurpol added the A4-backport-stable2512 Pull request must be backported to the stable2512 release branch label Jan 22, 2026
/// AssetHub validates both keys and ownership proof before sending.
/// RC trusts AH's validation and does not re-validate.
#[pallet::call_index(3)]
#[pallet::weight(T::SessionInterface::set_keys_weight())]
Copy link
Copy Markdown
Contributor

@muharem muharem Jan 26, 2026

Choose a reason for hiding this comment

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

I think its better to be able to benchmark calls, even if its proxy call. But not a blocker.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

agreed - I will add as followup PR

@sigurpol sigurpol added this pull request to the merge queue Jan 26, 2026
Merged via the queue into master with commit f154a34 Jan 26, 2026
263 of 269 checks passed
@sigurpol sigurpol deleted the sigurpol-session-keys-asset-hub branch January 26, 2026 09:28
@paritytech-release-backport-bot
Copy link
Copy Markdown

Created backport PR for stable2512:

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin backport-10666-to-stable2512
git worktree add --checkout .worktree/backport-10666-to-stable2512 backport-10666-to-stable2512
cd .worktree/backport-10666-to-stable2512
git reset --hard HEAD^
git cherry-pick -x f154a3464ff17a7c3239b02f41230a0c3f3f90da
git push --force-with-lease

@rachsrl rachsrl moved this from Backlog to Scheduled in Security Audit (PRs) - SRLabs Jan 26, 2026
sigurpol added a commit that referenced this pull request Jan 27, 2026
Backport #10666 into `stable2512` from sigurpol.

**NOTE**: PR #1739 (ownership proof validation) has not been backported
to stable2512.

While backporting #10666 - which fully integrates with proof of
ownership - we need to make few changes:
- remove proof parameter from extrinsic and Config trait
- remove proof validation tests
- fix session keys generation and related tests and benchmarking
- update papi-test to remove proof from set_keys API call

We also remove poll_operations module and related cleanup from ahm-test
since APIs like NextPollWeight, PagedElectionOutOfWeight etc are not in
stable2512.


See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Paolo La Camera <paolo@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@redzsina redzsina moved this from Scheduled to In progress in Security Audit (PRs) - SRLabs Feb 12, 2026
sigurpol added a commit that referenced this pull request Mar 4, 2026
Add `proof: Vec<u8>` to the `set_keys` extrinsic for forward
compatibility with PR #1739, which introduces real ownership proof
validation.
Proof validation is a no-op until we backport PR #1739.

Note: I have added `validate:false` for pallet-staking-async-rc-client.
The `set_keys` extrinsic has never been deployed on Polkadot/Kusama AH
yet, it will be deployed just with release `2.1.0` the first time so
it's a brand new API release-wise introduced with the backport of
#10666.

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@redzsina redzsina moved this from In progress to Waiting for fix in Security Audit (PRs) - SRLabs Mar 16, 2026
arturgontijo pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Apr 1, 2026
Backport paritytech#10666 into `stable2512` from sigurpol.

**NOTE**: PR paritytech#1739 (ownership proof validation) has not been backported
to stable2512.

While backporting paritytech#10666 - which fully integrates with proof of
ownership - we need to make few changes:
- remove proof parameter from extrinsic and Config trait
- remove proof validation tests
- fix session keys generation and related tests and benchmarking
- update papi-test to remove proof from set_keys API call

We also remove poll_operations module and related cleanup from ahm-test
since APIs like NextPollWeight, PagedElectionOutOfWeight etc are not in
stable2512.


See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Paolo La Camera <paolo@parity.io>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
arturgontijo pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Apr 1, 2026
…11255)

Add `proof: Vec<u8>` to the `set_keys` extrinsic for forward
compatibility with PR paritytech#1739, which introduces real ownership proof
validation.
Proof validation is a no-op until we backport PR paritytech#1739.

Note: I have added `validate:false` for pallet-staking-async-rc-client.
The `set_keys` extrinsic has never been deployed on Polkadot/Kusama AH
yet, it will be deployed just with release `2.1.0` the first time so
it's a brand new API release-wise introduced with the backport of
paritytech#10666.

---------

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

A4-backport-stable2512 Pull request must be backported to the stable2512 release branch T2-pallets This PR/Issue is related to a particular pallet.

Projects

Status: Waiting for fix
Status: Done

Development

Successfully merging this pull request may close these issues.

[AHM-Polkadot] Sessions Keys stored in AH

7 participants