referrerpolicy=no-referrer-when-downgrade

set_keys

Function set_keys 

Source
pub fn set_keys<T: Config>(
    keys: Vec<u8>,
    proof: Vec<u8>,
    max_delivery_and_remote_execution_fee: Option<BalanceOf<T>>,
)
Expand description

Set session keys for a validator. Keys are validated on AssetHub and forwarded to RC.

On the first call, a deposit of KeyDeposit is held from the stash. Subsequent calls do not charge again. The deposit is released on purge_keys.

Validation on AssetHub:

  • Keys are decoded as T::RelayChainSessionKeys to ensure they match RC’s expected format.
  • Ownership proof is validated using OpaqueKeys::ownership_proof_is_valid.

If validation passes, only the validated keys are sent to RC (with empty proof), since RC trusts AH’s validation.

Fees: The actual cost of this call is higher than what the weight-based fee estimate shows. In addition to the local transaction weight fee, the stash account is charged an XCM fee (delivery + RC execution cost) via XcmExecutor::charge_fees. The relay chain uses UnpaidExecution, so the full remote cost is charged upfront on AssetHub.

When called via a staking proxy, the proxy pays the transaction weight fee, while the stash (delegating account) pays the XCM fee.

Max Fee Limit: Users can optionally specify max_delivery_and_remote_execution_fee to limit the delivery + RC execution fee. This does not include the local transaction weight fee. If the fee exceeds this limit, the operation fails with FeesExceededMax. Pass None for unlimited (no cap).

NOTE: 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.

§Warning: Doc-Only

This function is an automatically generated, and is doc-only, uncallable stub. See the real version in Pallet::set_keys.