Skip to content

ParaInherent create: update apply_weight_limit wrt elastic scaling#3573

Merged
eskimor merged 6 commits intomasterfrom
sandreim/apply_weight_limit
Mar 7, 2024
Merged

ParaInherent create: update apply_weight_limit wrt elastic scaling#3573
eskimor merged 6 commits intomasterfrom
sandreim/apply_weight_limit

Conversation

@sandreim
Copy link
Contributor

@sandreim sandreim commented Mar 5, 2024

Changes the way we perform the random selection of backed candidates when there isn't enough room for all of them. Instead of picking individual backed candidates apply_weight now operates on chains of candidates. This is fully backwards compatible and relies on the node side (provisioner/prospective parachains) doing the heavy lifting and providing the candidates in the order they form a chain.

The same approach can be implemented for bitfields random selection once #3479 is merged.

The approach taken in this PR aims for reduced additional complexity at the cost of being less fair wrt how many backed candidates from each chain are picked. It favors elastic scaling parachains vs parachains not using elastic scaling, but from my perspective it should be fine as this should happen under exceptional circumstances like dispute storms.

Note: to make things more fair we can consider specializing random_sel such that it will try to pick candidates one by one in the order provided by the provisioner such that non elastic scaling parachains have the same chance of getting a candidate backed.

@sandreim sandreim added R0-no-crate-publish-required The change does not require any crates to be re-published. T8-polkadot This PR/Issue is related to/affects the Polkadot network. labels Mar 5, 2024
Signed-off-by: Andrei Sandu <[email protected]>
@sandreim sandreim changed the title ParaInherent create: update apply_weight wrt elastic scaling ParaInherent create: update apply_weight_limit wrt elastic scaling Mar 5, 2024
Copy link
Contributor

@ordian ordian left a comment

Choose a reason for hiding this comment

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

The impl looks to be matching the description. But it remains to be seen whether we want a more fair selection logic in the future.

@sandreim sandreim marked this pull request as ready for review March 6, 2024 09:52
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.

Nice!

@eskimor eskimor added this pull request to the merge queue Mar 7, 2024
Merged via the queue into master with commit c16fcc4 Mar 7, 2024
@eskimor eskimor deleted the sandreim/apply_weight_limit branch March 7, 2024 09:46
@sandreim sandreim mentioned this pull request Mar 11, 2024
github-merge-queue bot pushed a commit that referenced this pull request Mar 21, 2024
Changes needed to implement the runtime part of elastic scaling:
#3131,
#3132,
#3202

Also fixes #3675

TODOs:

- [x] storage migration
- [x] optimise process_candidates from O(N^2)
- [x] drop backable candidates which form cycles
- [x] fix unit tests
- [x] add more unit tests
- [x] check the runtime APIs which use the pending availability storage.
We need to expose all of them, see
#3576
- [x] optimise the candidate selection. we're currently picking randomly
until we satisfy the weight limit. we need to be smart about not
breaking candidate chains while being fair to all paras -
#3573

Relies on the changes made in
#3233 in terms of the
inclusion policy and the candidate ordering

---------

Signed-off-by: alindima <[email protected]>
Co-authored-by: command-bot <>
Co-authored-by: eskimor <[email protected]>
dharjeezy pushed a commit to dharjeezy/polkadot-sdk that referenced this pull request Mar 24, 2024
…h#3479)

Changes needed to implement the runtime part of elastic scaling:
paritytech#3131,
paritytech#3132,
paritytech#3202

Also fixes paritytech#3675

TODOs:

- [x] storage migration
- [x] optimise process_candidates from O(N^2)
- [x] drop backable candidates which form cycles
- [x] fix unit tests
- [x] add more unit tests
- [x] check the runtime APIs which use the pending availability storage.
We need to expose all of them, see
paritytech#3576
- [x] optimise the candidate selection. we're currently picking randomly
until we satisfy the weight limit. we need to be smart about not
breaking candidate chains while being fair to all paras -
paritytech#3573

Relies on the changes made in
paritytech#3233 in terms of the
inclusion policy and the candidate ordering

---------

Signed-off-by: alindima <[email protected]>
Co-authored-by: command-bot <>
Co-authored-by: eskimor <[email protected]>
@uzeyirdestan uzeyirdestan self-assigned this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

R0-no-crate-publish-required The change does not require any crates to be re-published. T8-polkadot This PR/Issue is related to/affects the Polkadot network.

Projects

Development

Successfully merging this pull request may close these issues.

4 participants