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

Migrate parachain swaps to Coretime + cancel auctions #3552

Open
4 of 5 tasks
eskimor opened this issue Mar 2, 2024 · 5 comments · Fixed by #3714
Open
4 of 5 tasks

Migrate parachain swaps to Coretime + cancel auctions #3552

eskimor opened this issue Mar 2, 2024 · 5 comments · Fixed by #3714
Assignees

Comments

@eskimor
Copy link
Member

eskimor commented Mar 2, 2024

Teams bid for one para id, only to swap it later on for another one. This is not supported by Coretime, thus they will have a lease on Coretime for the "wrong" para and can not use it. To fix this, I am suggesting the following:

  • Register an OnSwap handler, which will send an XCM to the coretime chain informing it about the swap.
  • Implement a swap extrinsic on the Coretime chain to do the swap, as requested by the relay chain.
  • Cancel auctions on runtime upgrade, should be this call.
  • Test on Zombienet
  • Register functionality on Polkadot
@eskimor eskimor changed the title Migrade parachain swaps to Coretime Migrate parachain swaps to Coretime Mar 2, 2024
@eskimor eskimor changed the title Migrate parachain swaps to Coretime Migrate parachain swaps to Coretime + cancel auctions Mar 2, 2024
@eskimor eskimor mentioned this issue Mar 4, 2024
10 tasks
@tdimitrov tdimitrov self-assigned this Mar 13, 2024
@bkchr
Copy link
Member

bkchr commented Mar 17, 2024

And then for how long will we keep this functionality around?

If we inform teams early that they need to swap before the upgrade, what would be the issue? I mean if the lease would not have started, we already refund it. This means that we only speak about leases that are already started, so teams could directly switch. Thus, I don't see any reason why we should implement this OnSwap stuff.

@eskimor
Copy link
Member Author

eskimor commented Mar 19, 2024

And then for how long will we keep this functionality around?

Worst case as long as there are leases.

If we inform teams early that they need to swap before the upgrade, what would be the issue? I mean if the lease would not have started, we already refund it. This means that we only speak about leases that are already started, so teams could directly switch. Thus, I don't see any reason why we should implement this OnSwap stuff.

The leases might have started already ... although this means, if they perfectly time it they could do the swap before the migration. 😬 For swaps that only become relevant later, you are right the to be swapped para will be refunded.

So in total, people have to fear the migration less: It can not happen that you missed the coretime launch and suddenly your planned swap no longer works. Given the simplicity of making this friction free, I don't see why we would not want to do this. Developer Experience is priority.

@bkchr
Copy link
Member

bkchr commented Mar 19, 2024

Because we add useless code that at some point we need to remove again. We are adding code that increases the likelihood of adding bugs etc. While we could just inform the less than 10 teams to do the swap before the upgrade. Coordinating this takes for sure less time than writing all this code etc.

@eskimor
Copy link
Member Author

eskimor commented Mar 20, 2024

The code is already written and is trivial and we have to remove quite a lot of code anyways once leases expired. If automation is that easy, I would always go for automation - it is less error prone. Coordinating those teams is definitely more likely to fail, then this simple piece of code - also it is just a better experience, if things just work.

I really want to provide as smooth of an experience as possible. Don't break things, if there is no need. The Coretime upgrade in itself is disruptive enough. Teams are already worried a lot.

github-merge-queue bot pushed a commit that referenced this issue Mar 26, 2024
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/4987d7982461e2e5ffe219cdf71ec697284cea7c/substrate/frame/broker/src/lib.rs#L120)
in `broker` pallet and
[`Leases`](https://github.com/paritytech/polkadot-sdk/blob/4987d7982461e2e5ffe219cdf71ec697284cea7c/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 #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>
@tdimitrov tdimitrov reopened this Mar 27, 2024
@tdimitrov
Copy link
Contributor

Reopening because it's still not enabled on Polkadot

dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this issue Apr 9, 2024
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/4987d7982461e2e5ffe219cdf71ec697284cea7c/substrate/frame/broker/src/lib.rs#L120)
in `broker` pallet and
[`Leases`](https://github.com/paritytech/polkadot-sdk/blob/4987d7982461e2e5ffe219cdf71ec697284cea7c/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 paritytech#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants