Migrate parachain swaps to Coretime (#3714)
This PR notifies broker pallet for any parachain slot swaps performed on the relay chain. This is achieved by registering an `OnSwap` for the the `coretime` pallet. The hook sends XCM message to the broker chain and invokes a new extrinsic `swap_leases` which updates `Leases` storage item (which keeps the legacy parachain leases). I made two assumptions in this PR: 1. [`Leases`](https://github.com/paritytech/polkadot-sdk/blob/4987d798/substrate/frame/broker/src/lib.rs#L120) in `broker` pallet and [`Leases`](https://github.com/paritytech/polkadot-sdk/blob/4987d798 /polkadot/runtime/common/src/slots/mod.rs#L118) in `slots` pallet are in sync. 2. `swap_leases` extrinsic from `broker` pallet can be triggered only by root or by the XCM message from the relay chain. If not - the extrinsic will generate an error and do nothing. As a side effect from the changes `OnSwap` trait is moved from runtime/common/traits.rs to runtime/parachains. Otherwise it is not accessible from `broker` pallet. Closes https://github.com/paritytech/polkadot-sdk/issues/3552 TODOs: - [x] Weights - [x] Tests --------- Co-authored-by: command-bot <> Co-authored-by:eskimor <eskimor@users.noreply.github.com> Co-authored-by:
Bastian Köcher <git@kchr.de>
Showing
- cumulus/parachains/runtimes/coretime/coretime-rococo/src/weights/pallet_broker.rs 83 additions, 75 deletions...mes/coretime/coretime-rococo/src/weights/pallet_broker.rs
- cumulus/parachains/runtimes/coretime/coretime-westend/src/weights/pallet_broker.rs 85 additions, 75 deletions...es/coretime/coretime-westend/src/weights/pallet_broker.rs
- polkadot/runtime/parachains/src/coretime/mod.rs 20 additions, 0 deletionspolkadot/runtime/parachains/src/coretime/mod.rs
- polkadot/runtime/rococo/src/lib.rs 10 additions, 2 deletionspolkadot/runtime/rococo/src/lib.rs
- polkadot/runtime/westend/src/lib.rs 10 additions, 2 deletionspolkadot/runtime/westend/src/lib.rs
- prdoc/pr_3714.prdoc 10 additions, 0 deletionsprdoc/pr_3714.prdoc
- substrate/frame/broker/src/benchmarking.rs 17 additions, 0 deletionssubstrate/frame/broker/src/benchmarking.rs
- substrate/frame/broker/src/dispatchable_impls.rs 18 additions, 0 deletionssubstrate/frame/broker/src/dispatchable_impls.rs
- substrate/frame/broker/src/lib.rs 8 additions, 0 deletionssubstrate/frame/broker/src/lib.rs
- substrate/frame/broker/src/weights.rs 200 additions, 168 deletionssubstrate/frame/broker/src/weights.rs
Please register or sign in to comment