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

paras pallet - add new extrinsincs for authorize/apply set_current_code #7574

Open
bkontur opened this issue Feb 14, 2025 · 0 comments · May be fixed by #7592
Open

paras pallet - add new extrinsincs for authorize/apply set_current_code #7574

bkontur opened this issue Feb 14, 2025 · 0 comments · May be fixed by #7592
Assignees

Comments

@bkontur
Copy link
Contributor

bkontur commented Feb 14, 2025

Relates to: #5588 (comment)

Context

As a part of D-Day scenario, when governance systems are migrated to the AssetHub/Collectives. If a parachain (AssetHub or Collectives) stalls, recovery currently requires issuing paras::force_set_current_code(para_id, new_code) on the relay chain, e.g.:

// from Collectives to rescue AssetHub
pallet_xcm::send(relaychain, Transact(paras::force_set_current_code(1000, new_ah_code)))

// from AssetHub to rescue Collectives
pallet_xcm::send(relaychain, Transact(paras::force_set_current_code(1002, new_ah_code)))

However, there’s a major limitation:

  • paras::force_set_current_code requires sending the entire runtime binary via XCM.
  • The current max upward message size on the Collectives (parachainSystem.hostConfiguration.maxUpwardMessageSize = 65,531) is too small.
  • Example: penpal_runtime.compact.compressed.wasm = 1,299,474 bytes, which far exceeds the limit.

Solution

To avoid sending the entire runtime wasm code, we can split the process off-chain:

  1. New Extrinsic: paras::authorize_force_set_current_code_hash(para_id, code_hash)

    • Only callable by governance (Root).
    • Stores the approved code hash on the relay chain.
  2. New Extrinsic: paras::apply_authorized_force_set_current_code(para_id, code)

    • Open for anyone to call (no origin check).
    • Checks if code matches the pre-approved hash before applying the upgrade.
    • If code matches the stored code_hash, the relay chain executes force_set_current_code(para, code).

This aligns with @rphmeier’s suggestion in this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants
@bkontur and others