Commit 5bbcfa2
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>
1 parent d13e2c2 commit 5bbcfa2
16 files changed
Lines changed: 688 additions & 124 deletions
File tree
- polkadot/runtime
- common/src
- assigned_slots
- paras_registrar
- parachains/src
- paras
- rococo/src
- weights
- test-runtime/src
- westend/src
- weights
- prdoc
- substrate/frame/staking-async/runtimes/rc/src
- weights
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
| 737 | + | |
737 | 738 | | |
738 | 739 | | |
739 | 740 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
219 | 220 | | |
220 | 221 | | |
221 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| 252 | + | |
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
285 | 323 | | |
286 | 324 | | |
287 | 325 | | |
| |||
0 commit comments