Skip to content
  • Andrei Sandu's avatar
    ParaInherent create: update `apply_weight_limit` wrt elastic scaling (#3573) · c16fcc47
    Andrei Sandu authored
    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
    https://github.com/paritytech/polkadot-sdk/pull/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.
    
    ---------
    
    Signed-off-by: default avatarAndrei Sandu <[email protected]>
    c16fcc47