-
Notifications
You must be signed in to change notification settings - Fork 1.1k
staking-async: allow session keys handling on AssetHub #10666
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
base: master
Are you sure you want to change the base?
Conversation
|
/cmd prdoc --audience runtime_dev --bump major |
4f19e9b to
06c4e0e
Compare
…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
06c4e0e to
dc9400a
Compare
| } | ||
|
|
||
| fn set_keys(account: &Self::AccountId, keys: Self::Keys) -> DispatchResult { | ||
| pallet_session::Pallet::<T>::do_set_keys(account, keys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't we directly xcm::transact session pallet call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my understanding - which might be wrong - is that if we use xcm::transact directly to call pallet_session::set_keys, then RC has no way to know that the transaction was signed by validator X, the origin would be just the XCM origin (Parachain(1000) or something) and pallet_session::set_keys requires ensure_signed(origin) so it would need the account of X. so ensure_origin would fail because it would find AH as origin and not X.
ah-client solves the issues :
pub fn set_keys_from_ah(
origin: OriginFor<T>,
stash: T::AccountId, // ← X's account passed explicitly!!!!!!
keys: Vec<u8>,
proof: Vec<u8>,
) {
T::AssetHubOrigin::ensure_origin(origin)?; // we verify it's from AssetHub
T::SessionInterface::set_keys(&stash, keys)?; // ← Use stash of X directly calling pallet_session::Pallet::<T>::do_set_keys(account, keys)
}Note that RC relies on AH to have verified that the transaction is signed by X
pub fn set_keys(origin: OriginFor<T>, keys: T::Keys, proof: Vec<u8>) -> DispatchResult {
let stash = ensure_signed(origin)?; // ← we check it is signed by validator XDoes it make sense?
|
Main outcome of discussion with @Ank4n :
|
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
|
/cmd bench --pallet pallet_staking_async_rc_client --runtime asset-hub-westend |
|
Command "bench --pallet pallet_staking_async_rc_client --runtime asset-hub-westend" has started 🚀 See logs here |
…t_staking_async_rc_client --runtime asset-hub-westend'
|
Command "bench --pallet pallet_staking_async_rc_client --runtime asset-hub-westend" has finished ✅ See logs here DetailsSubweight results:
Command output:✅ Successful benchmarks of runtimes/pallets: |
set_keysandpurge_keyson AssetHub, which forwards the request to the RelayChain via XCM.set_keysandpurge_keyson behalf of validators. TheProxyType::Stakingfilter on runtime needs to be updated to include these calls.set_keysandpurge_keysvia relay-chain pallet-session's extrinsics. This option will be deprecated in the future.Close #8806.
TODO