[AHM] PoC for D-Day governance rescue feature on CollectivesWestend#8141
Draft
[AHM] PoC for D-Day governance rescue feature on CollectivesWestend#8141
Conversation
Contributor
Author
|
/cmd fmt |
6 tasks
Closed
6 tasks
a1281c0 to
f3fb124
Compare
Contributor
Author
|
/cmd fmt |
c641d3f to
23eaf5c
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
May 29, 2025
…7592) Closes: #7574 Relates to: #7591 ## Motivation This feature is useful when triggering a `Paras` pallet call from a different chain than the one where the `Paras` pallet is deployed. For example, we may want to send `Paras::force_set_current_code(para, code)` from the Collectives and/or AssetHub to the relay chain (because the relaychain governance will be migrated to the AssetHub as a part of AHM). The primary reason for this approach is to avoid transferring the entire `new_code` Wasm blob between chains. Instead, we authorize the `code_hash` using `root` via `fn authorize_force_set_current_code_hash(new_authorization, expire_at)`. This authorization can later be applied by anyone using `Paras::apply_authorized_force_set_current_code(para, new_code)`. If `expire_at` is reached without the authorization being used, it is automatically removed. ## Usage This feature is intended for use in two scenarios: - The D-Day scenario, where we can restart AssetHub from Collectives — see the PoC: #8141 - Using `force_set_current_code` for any parachain from migrated governance to AssetHub (AHM) ## TODO - [x] ~cover also `add_trusted_validation_code` or `force_schedule_code_upgrade` - see comment bellow: #7592 (comment) no see other [comment](#7592 (comment)) ## Open questions - [ ] ~Do we need something like `poke_authorized_code_hash`? E.g. in case that we authorize code hash, but nobody would apply it and the parachain starts working with old/other_new code? Is this possible?~ - [ ] Do we need something similar for `frame_system` pallet and `set_code` / `set_code_without_checks`? - [ ] Can we achieve the same with `pallet-whitelist`? - [ ] Do we have other extrinsics over chains which has `code` attribute? - [x] Do we need to add `validate_unsigned` for `apply_authorized_code`? --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Adrian Catangiu <adrian@parity.io>
pgherveou
pushed a commit
that referenced
this pull request
Jun 11, 2025
…7592) Closes: #7574 Relates to: #7591 ## Motivation This feature is useful when triggering a `Paras` pallet call from a different chain than the one where the `Paras` pallet is deployed. For example, we may want to send `Paras::force_set_current_code(para, code)` from the Collectives and/or AssetHub to the relay chain (because the relaychain governance will be migrated to the AssetHub as a part of AHM). The primary reason for this approach is to avoid transferring the entire `new_code` Wasm blob between chains. Instead, we authorize the `code_hash` using `root` via `fn authorize_force_set_current_code_hash(new_authorization, expire_at)`. This authorization can later be applied by anyone using `Paras::apply_authorized_force_set_current_code(para, new_code)`. If `expire_at` is reached without the authorization being used, it is automatically removed. ## Usage This feature is intended for use in two scenarios: - The D-Day scenario, where we can restart AssetHub from Collectives — see the PoC: #8141 - Using `force_set_current_code` for any parachain from migrated governance to AssetHub (AHM) ## TODO - [x] ~cover also `add_trusted_validation_code` or `force_schedule_code_upgrade` - see comment bellow: #7592 (comment) no see other [comment](#7592 (comment)) ## Open questions - [ ] ~Do we need something like `poke_authorized_code_hash`? E.g. in case that we authorize code hash, but nobody would apply it and the parachain starts working with old/other_new code? Is this possible?~ - [ ] Do we need something similar for `frame_system` pallet and `set_code` / `set_code_without_checks`? - [ ] Can we achieve the same with `pallet-whitelist`? - [ ] Do we have other extrinsics over chains which has `code` attribute? - [x] Do we need to add `validate_unsigned` for `apply_authorized_code`? --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Adrian Catangiu <adrian@parity.io>
…ame` WIP: squash WIP: squash to primitives WIP: squash to voting
…ion extentions according to the filter
…o user does not need balance on Collectives)
…trate/frame`" (just reuse existing one from bridges to bring down PR diff noice) This reverts commit c88b0cc4e639ccb0120626e8ee3d9a06922f859b. # Conflicts: # substrate/frame/proofs/primitives/Cargo.toml # substrate/frame/proofs/primitives/src/lib.rs
23eaf5c to
01f3aff
Compare
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
|
@bkontur is there an ETA for this ? |
alvicsam
pushed a commit
that referenced
this pull request
Oct 17, 2025
…7592) Closes: #7574 Relates to: #7591 ## Motivation This feature is useful when triggering a `Paras` pallet call from a different chain than the one where the `Paras` pallet is deployed. For example, we may want to send `Paras::force_set_current_code(para, code)` from the Collectives and/or AssetHub to the relay chain (because the relaychain governance will be migrated to the AssetHub as a part of AHM). The primary reason for this approach is to avoid transferring the entire `new_code` Wasm blob between chains. Instead, we authorize the `code_hash` using `root` via `fn authorize_force_set_current_code_hash(new_authorization, expire_at)`. This authorization can later be applied by anyone using `Paras::apply_authorized_force_set_current_code(para, new_code)`. If `expire_at` is reached without the authorization being used, it is automatically removed. ## Usage This feature is intended for use in two scenarios: - The D-Day scenario, where we can restart AssetHub from Collectives — see the PoC: #8141 - Using `force_set_current_code` for any parachain from migrated governance to AssetHub (AHM) ## TODO - [x] ~cover also `add_trusted_validation_code` or `force_schedule_code_upgrade` - see comment bellow: #7592 (comment) no see other [comment](#7592 (comment)) ## Open questions - [ ] ~Do we need something like `poke_authorized_code_hash`? E.g. in case that we authorize code hash, but nobody would apply it and the parachain starts working with old/other_new code? Is this possible?~ - [ ] Do we need something similar for `frame_system` pallet and `set_code` / `set_code_without_checks`? - [ ] Can we achieve the same with `pallet-whitelist`? - [ ] Do we have other extrinsics over chains which has `code` attribute? - [x] Do we need to add `validate_unsigned` for `apply_authorized_code`? --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Adrian Catangiu <adrian@parity.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to: #5588 (comment)
Relates to: #7591
Relates to: @kianenigma's initial demo
TL;DR
This PR includes several key features:
SkipCheckIftransaction extension wrapper: Allows defining conditions under which the inner transaction extension execution can be skipped (e.g., in CollectivesWestend transaction extensions, skippingCheckNoncewhen valid proof).Motivation and Context
Currently, governance on the relay chain has the ability to trigger
Paras::force_set_current_code(Root, para_id, new_code), for example, to rescue a stalled parachain (although there may be other reasons as well).A major thing is approaching: the AssetHub migration (AHM). One key aspect of this migration is the transfer of relay chain governance to AssetHub. This means that governance will no longer exist on the relay chain but will instead be fully migrated to AssetHub.
D-Day (Doomsday) governance serves as a backup plan or a last resort in case the AssetHub parachain stalls - that is, it stops producing blocks. In such a scenario, AssetHub’s governance would be unable to trigger
Paras::force_set_current_code(..)on itself.Proposed Solution
pallet_bridge_proof_root_store:block numberandstorage_rootwithOnSystemEventpallet_referendainstance (DDayReferendaInstance):rank3+fellows can submit and start referenda with a specific call, e.g.,pallet_dday_voting: (copied fromconviction-votingand adjusted)pallet_dday_voting::Call::vote(signed_user, proof)requires a valid AssetHub proof containing:signed_userrepresents an (AssetHub) account signed with a secret key, and theaccountIdis used as part of the proof key.Tallyto calculatesupport(..)(see also Questionable / Weak Points).Questionable / Weak Points
CheckNonce(verifying an account’s providers/sufficients) andChargeTransactionPayment.SkipCheckIftransaction extension wrapper. If aDDayVoting::votecall is valid and includes valid proofs (only when AssetHub is stalled), thenCheckNonceandChargeTransactionPaymentare skipped. (In other words, if AssetHub is not stalled, nothing is skipped.)RelayChainStateProof_** (see Follow-ups).Testing
fn asset_hub_account_prover_works()/fn verify_proof_root_works()DDayReferenda/DDayVotingby proof-based voting:fn dday_referenda_and_voting_works()TODO
SkipCheckIfacceptable? (If not then what alternative approach?)pallet_dday_detection::LastKnownHeadorpallet_dday_detection::IsStalled::stalled_head()Follow-ups
Read para head from
RelayChainStateProof:RelayChainStateProoftrie withrelay_chain::well_known_keys::para_head(sibling_para_id)for relevant/configured sibling paraIDs. #7445-Support custom storage proof from the relay-chain #82
Force setting the current code from a parachain to the relay chain:
Parasauthorize_code_hash+apply_authorized_codefeature #7592codeSubstitutesafterforce_set_current_code.)