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

Deprecate para_id() from CoreState in polkadot primitives #3979

Merged
merged 14 commits into from
Apr 8, 2024

Conversation

tdimitrov
Copy link
Contributor

@tdimitrov tdimitrov commented Apr 4, 2024

With Coretime enabled we can no longer assume there is a static 1:1 mapping between core index and para id. This mapping should be obtained from the scheduler/claimqueue on block by block basis.

This PR modifies para_id() (from CoreState) to return the scheduled ParaId for occupied cores and removes its usages in the code.

Closes #3948

@tdimitrov tdimitrov added the T8-polkadot This PR/Issue is related to/affects the Polkadot network. label Apr 5, 2024
@tdimitrov tdimitrov requested a review from sandreim April 5, 2024 06:43

crates:
- name: polkadot-primitives
bump: major
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about this one. We are removing a pub method so it's should be a major bump?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so, it is a breaking change

Copy link
Member

@eskimor eskimor Apr 5, 2024

Choose a reason for hiding this comment

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

Good point. Let's deprecate it first then. Like: Don't remove now, just deprecated, thus minor bump.

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 it can cause problems if it is used incorrectly? Isn't this worse than breaking other projects because of a potential bug?

Copy link
Member

Choose a reason for hiding this comment

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

And just in case people are actually using it, let's also fix it. (Returning the scheduled para_id also on an occupied core.) This should not break any code, as up until now this was the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sandreim could you please have another look at the prdoc? Does the updated description make sense?

@tdimitrov tdimitrov requested a review from eskimor April 5, 2024 06:45
Copy link
Contributor

@sandreim sandreim left a comment

Choose a reason for hiding this comment

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

LGTM, modulo the prdoc description.

prdoc/pr_3979.prdoc Outdated Show resolved Hide resolved
Co-authored-by: Andrei Sandu <[email protected]>
Copy link
Member

@eskimor eskimor left a comment

Choose a reason for hiding this comment

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

Approved. Module the breaking change. As a general rule, don't break things, if there is no real need.

(Sorry, I did not realize that this was publicly exposed and potentially used by others, when I said "remove it".) 😬

@tdimitrov tdimitrov changed the title Remove para_id() from CoreState in polkadot primitives Deprecate para_id() from CoreState in polkadot primitives Apr 5, 2024
Copy link
Contributor

@sandreim sandreim left a comment

Choose a reason for hiding this comment

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

One more nit!

polkadot/primitives/src/v7/mod.rs Outdated Show resolved Hide resolved
doc:
- audience: "Node Dev"
description: |
The motivation is that the old implementation of `para_id()` can be misused with Coretime which allows two
Copy link
Member

Choose a reason for hiding this comment

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

Given that we just fixed it, it can not actually be misused anymore. So the only reason for deprecation is that claim queue is replacing it.

@tdimitrov tdimitrov added this pull request to the merge queue Apr 8, 2024
Merged via the queue into master with commit 59f868d Apr 8, 2024
128 of 133 checks passed
@tdimitrov tdimitrov deleted the tsv-remove-paraid branch April 8, 2024 06:29
s0me0ne-unkn0wn pushed a commit that referenced this pull request Apr 8, 2024
With Coretime enabled we can no longer assume there is a static 1:1
mapping between core index and para id. This mapping should be obtained
from the scheduler/claimqueue on block by block basis.

This PR modifies `para_id()` (from `CoreState`) to return the scheduled
`ParaId` for occupied cores and removes its usages in the code.

Closes #3948

---------

Co-authored-by: Andrei Sandu <[email protected]>
Ank4n pushed a commit that referenced this pull request Apr 9, 2024
With Coretime enabled we can no longer assume there is a static 1:1
mapping between core index and para id. This mapping should be obtained
from the scheduler/claimqueue on block by block basis.

This PR modifies `para_id()` (from `CoreState`) to return the scheduled
`ParaId` for occupied cores and removes its usages in the code.

Closes #3948

---------

Co-authored-by: Andrei Sandu <[email protected]>
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this pull request Apr 9, 2024
…tech#3979)

With Coretime enabled we can no longer assume there is a static 1:1
mapping between core index and para id. This mapping should be obtained
from the scheduler/claimqueue on block by block basis.

This PR modifies `para_id()` (from `CoreState`) to return the scheduled
`ParaId` for occupied cores and removes its usages in the code.

Closes paritytech#3948

---------

Co-authored-by: Andrei Sandu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T8-polkadot This PR/Issue is related to/affects the Polkadot network.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove non-sensical para_id function
3 participants