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

Refund leases that have not started. #206

Merged

Conversation

eskimor
Copy link
Contributor

@eskimor eskimor commented Feb 29, 2024

Needed for a smooth migration to Coretime.

@seadanda
Copy link
Contributor

seadanda commented Feb 29, 2024

If we go for this approach we should be careful to ensure that we have configured enough MaxLeasedCores in https://github.com/seadanda/runtimes/blob/donal-coretime-kusama-1.6/system-parachains/coretime/coretime-kusama/src/coretime.rs#L228 as it may push us over what we expect, depending on the auctions.

This comment no longer applies due to code changes.

@eskimor eskimor changed the title Also migrate leases that have not started. Refund leases that have not started. Feb 29, 2024
@eskimor eskimor force-pushed the rk-migrate-lazy-leases branch from cf419de to 099e179 Compare February 29, 2024 20:35
if lease.iter().any(Option::is_none) {
return None
if let Err(err) = slots::Pallet::<Runtime>::clear_all_leases(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they currently have an active lease which ends in say three months, then also won an auction which gives them a lease starting in three months, then this will kick them off their current lease as well as the one that has not yet started. Surely the intended functionality is that they are refunded for only the lease that has not yet started.
Or can they only swap at the point their current lease ends, i.e. the second lease that has not started is always under a separate para_id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your particular scenario there would be no Nones .. .you have a lease for the next three months and one an auction for the ones afterwards ... all good.

In general, what happens here is you either get your lease to coretime or not. If not, you get all your leases refunded - even an ongoing one as in fact you just lost it. So this looks correct to me.

Copy link
Contributor

@seadanda seadanda Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, bad example. Slightly different to get a None in there but keeping my question the same:
If they currently have an active lease which ends three months, then also won an auction which gives them a lease starting in four and half months, they have a None in there, they'll be refunded their future lease but also booted off their current lease three months earlier than they expected.

Maybe that's a bit contrived, but I don't think a current lease should not be migrated, even if it is refunded, just because they have a gap before the lease they have won starts.

Maybe this edge case doesn't exist in reality, in which case all good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in that case they already have a hole and thus downtime. I would assume if that edge case even exists that some more downtime won't kill them.

Not saying that this is ideal, but:

(1) I would really assume that this is an edge case that will very likely not even exist. And if so, a solution might be similar to whatever we are going to do about swaps.
(2) We could trim the leases to the first None, but then we would have another problem: The leases after the Nones would keep their token locked, despite the fact that we would have ended their lease on coretime.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this the other day, that sounds sensible to me

CHANGELOG.md Outdated Show resolved Hide resolved
@eskimor eskimor mentioned this pull request Mar 5, 2024
19 tasks
@eskimor
Copy link
Contributor Author

eskimor commented Mar 6, 2024

/merge

@fellowship-merge-bot
Copy link
Contributor

Enabled auto-merge in Pull Request

Available commands
  • /merge: Enables auto-merge for Pull Request
  • /merge cancel: Cancels auto-merge for Pull Request
  • /merge help: Shows this menu

For more information see the documentation

@fellowship-merge-bot fellowship-merge-bot bot enabled auto-merge (squash) March 6, 2024 17:41
auto-merge was automatically disabled March 8, 2024 15:34

Head branch was pushed to by a user without write access

@bkchr
Copy link
Contributor

bkchr commented Mar 8, 2024

/merge

@fellowship-merge-bot fellowship-merge-bot bot enabled auto-merge (squash) March 8, 2024 20:59
@fellowship-merge-bot
Copy link
Contributor

Enabled auto-merge in Pull Request

Available commands
  • /merge: Enables auto-merge for Pull Request
  • /merge cancel: Cancels auto-merge for Pull Request
  • /merge help: Shows this menu

For more information see the documentation

@fellowship-merge-bot
Copy link
Contributor

Failed to update PR ❌

There was an error while trying to keep this PR up-to-date

You may have conflicts ‼️ or may have to manually sync it with the target branch 👉❇️

More info in the logs 📋

@fellowship-merge-bot
Copy link
Contributor

Failed to update PR ❌

There was an error while trying to keep this PR up-to-date

You may have conflicts ‼️ or may have to manually sync it with the target branch 👉❇️

More info in the logs 📋

@fellowship-merge-bot fellowship-merge-bot bot merged commit e42821d into polkadot-fellows:main Mar 10, 2024
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants