Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
96e3958
refactor
EleisonC Jan 21, 2025
e70f289
Merge branch 'master' into enable-elastic-scaling
EleisonC Jan 21, 2025
d06e7eb
Merge branch 'master' into enable-elastic-scaling
EleisonC Jan 22, 2025
9a71dcd
Merge branch 'master' into enable-elastic-scaling
EleisonC Jan 22, 2025
bb909f5
refactor remove inject core index flag
EleisonC Feb 3, 2025
95ab02d
refactor removal elastic scaling MVP
EleisonC Feb 3, 2025
5a3e4a3
add prdoc
EleisonC Feb 3, 2025
f1d8c32
refactor
EleisonC Feb 3, 2025
10a2f5f
Merge branch 'master' into enable-elastic-scaling
EleisonC Feb 3, 2025
e0414c5
Merge branch 'master' into enable-elastic-scaling
EleisonC Feb 25, 2025
5a6bf60
clean up runtime tests
EleisonC Mar 18, 2025
17ddcc5
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 18, 2025
ee1ad6b
update prdoc
EleisonC Mar 18, 2025
ab9ac31
Update pr_7286.prdoc
EleisonC Mar 18, 2025
6113661
Update pr_7286.prdoc
EleisonC Mar 18, 2025
78acbc8
Update lib.rs
EleisonC Mar 18, 2025
7ae4c73
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 18, 2025
cc6bc04
update with master
EleisonC Mar 18, 2025
4619ada
update
EleisonC Mar 18, 2025
5628011
update
EleisonC Mar 18, 2025
7906fad
update
EleisonC Mar 18, 2025
1a394a7
fix syntax
EleisonC Mar 18, 2025
0cd23d7
fix syntax
EleisonC Mar 18, 2025
0d5a2a9
fix lint issues
EleisonC Mar 18, 2025
cbf0f27
fix clippy nightly issues
EleisonC Mar 19, 2025
3d17827
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 19, 2025
ffa4373
refactor backing tests
EleisonC Mar 19, 2025
3af93ad
refactor tests & remove one test
EleisonC Mar 19, 2025
f13c67b
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 19, 2025
b7ec29c
fix
EleisonC Mar 20, 2025
199c1e9
runtime fixes
EleisonC Mar 20, 2025
6008e8f
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 20, 2025
aef66af
fix provisioner
EleisonC Mar 20, 2025
5f48a70
merge master
EleisonC Mar 20, 2025
5242e47
Fix fmt issues in backing
EleisonC Mar 20, 2025
2f36dbf
fix dep issue
EleisonC Mar 20, 2025
eaf9ea1
reverse changes cargo lock
EleisonC Mar 20, 2025
568545b
revert runtime changes
EleisonC Mar 21, 2025
8e4aa95
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 21, 2025
4220f91
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 24, 2025
4cae3d5
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 24, 2025
6fe0d82
update get_backed_candidate_preserves_order tests
EleisonC Mar 24, 2025
f22e322
prdoc update
EleisonC Mar 24, 2025
4dc36e0
taplo fmt
EleisonC Mar 24, 2025
b2cc899
fix
EleisonC Mar 24, 2025
537c98f
set elastic scaling node side test
EleisonC Mar 25, 2025
59663a4
revert cumulus toml fmt
EleisonC Mar 25, 2025
6c30c2b
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 25, 2025
4048ac3
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 26, 2025
b9ec3b9
Merge branch 'master' into enable-elastic-scaling
EleisonC Mar 26, 2025
27d2e83
resize fix
EleisonC Mar 26, 2025
a2bae77
Merge branch 'enable-elastic-scaling' of https://github.com/EleisonC/…
EleisonC Mar 26, 2025
3f91fb0
Merge branch 'master' into enable-elastic-scaling
alindima Mar 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions polkadot/node/core/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ use polkadot_node_subsystem_util::{
};
use polkadot_parachain_primitives::primitives::IsSystem;
use polkadot_primitives::{
node_features::FeatureIndex,
vstaging::{
BackedCandidate, CandidateReceiptV2 as CandidateReceipt,
CommittedCandidateReceiptV2 as CommittedCandidateReceipt,
Expand Down Expand Up @@ -234,9 +233,7 @@ struct PerRelayParentState {
fallbacks: HashMap<CandidateHash, AttestingData>,
/// The minimum backing votes threshold.
minimum_backing_votes: u32,
/// If true, we're appending extra bits in the BackedCandidate validator indices bitfield,
/// which represent the assigned core index. True if ElasticScalingMVP is enabled.
inject_core_index: bool,
/// ElasticScalingMVP is enabled.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment can be removed.

/// The number of cores.
n_cores: u32,
/// Claim queue state. If the runtime API is not available, it'll be populated with info from
Expand Down Expand Up @@ -610,7 +607,6 @@ fn table_attested_to_backed(
ValidatorSignature,
>,
table_context: &TableContext,
inject_core_index: bool,
) -> Option<BackedCandidate> {
let TableAttestedCandidate { candidate, validity_votes, group_id: core_index } = attested;

Expand Down Expand Up @@ -649,7 +645,7 @@ fn table_attested_to_backed(
.map(|(pos_in_votes, _pos_in_group)| validity_votes[pos_in_votes].clone())
.collect(),
validator_indices,
inject_core_index.then_some(core_index),
Some(core_index),
))
}

Expand Down Expand Up @@ -1157,16 +1153,11 @@ async fn construct_per_relay_parent_state<Context>(
.await?
.unwrap_or(NodeFeatures::EMPTY);

let inject_core_index = node_features
.get(FeatureIndex::ElasticScalingMVP as usize)
.map(|b| *b)
.unwrap_or(false);

let executor_params =
per_session_cache.executor_params(session_index, parent, ctx.sender()).await;
let executor_params = try_runtime_api!(executor_params);

gum::debug!(target: LOG_TARGET, inject_core_index, ?parent, "New state");
gum::debug!(target: LOG_TARGET, ?parent, "New state");

let (validator_groups, group_rotation_info) = try_runtime_api!(groups);

Expand Down Expand Up @@ -1237,7 +1228,6 @@ async fn construct_per_relay_parent_state<Context>(
awaiting_validation: HashSet::new(),
fallbacks: HashMap::new(),
minimum_backing_votes,
inject_core_index,
n_cores: validator_groups.len() as u32,
claim_queue: ClaimQueueSnapshot::from(claim_queue),
validator_to_group,
Expand Down Expand Up @@ -1675,7 +1665,6 @@ async fn post_import_statement_actions<Context>(
if let Some(backed) = table_attested_to_backed(
attested,
&rp_state.table_context,
rp_state.inject_core_index,
) {
let para_id = backed.candidate().descriptor.para_id();
gum::debug!(
Expand Down Expand Up @@ -2157,7 +2146,6 @@ fn handle_get_backable_candidates_message(
table_attested_to_backed(
attested,
&rp_state.table_context,
rp_state.inject_core_index,
)
});

Expand Down
28 changes: 3 additions & 25 deletions polkadot/node/core/provisioner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ use polkadot_node_subsystem::{
use polkadot_node_subsystem_util::{
has_required_runtime, request_availability_cores, request_persisted_validation_data,
request_session_index_for_child,
runtime::{prospective_parachains_mode, request_node_features, ProspectiveParachainsMode},
runtime::{prospective_parachains_mode, ProspectiveParachainsMode},
TimeoutExt,
};
use polkadot_primitives::{
node_features::FeatureIndex,
vstaging::{BackedCandidate, CandidateReceiptV2 as CandidateReceipt, CoreState},
BlockNumber, CandidateHash, CoreIndex, Hash, Id as ParaId, NodeFeatures,
BlockNumber, CandidateHash, CoreIndex, Hash, Id as ParaId,
OccupiedCoreAssumption, SessionIndex, SignedAvailabilityBitfield, ValidatorIndex,
};
use std::collections::{BTreeMap, HashMap};
Expand Down Expand Up @@ -83,15 +82,13 @@ impl ProvisionerSubsystem {
/// Per-session info we need for the provisioner subsystem.
pub struct PerSession {
prospective_parachains_mode: ProspectiveParachainsMode,
elastic_scaling_mvp: bool,
}

/// A per-relay-parent state for the provisioning subsystem.
pub struct PerRelayParent {
leaf: ActivatedLeaf,
backed_candidates: Vec<CandidateReceipt>,
prospective_parachains_mode: ProspectiveParachainsMode,
elastic_scaling_mvp: bool,
signed_bitfields: Vec<SignedAvailabilityBitfield>,
is_inherent_ready: bool,
awaiting_inherent: Vec<oneshot::Sender<ProvisionerInherentData>>,
Expand All @@ -103,7 +100,6 @@ impl PerRelayParent {
leaf,
backed_candidates: Vec::new(),
prospective_parachains_mode: per_session.prospective_parachains_mode,
elastic_scaling_mvp: per_session.elastic_scaling_mvp,
signed_bitfields: Vec::new(),
is_inherent_ready: false,
awaiting_inherent: Vec::new(),
Expand Down Expand Up @@ -214,16 +210,10 @@ async fn handle_active_leaves_update(
if per_session.get(&session_index).is_none() {
let prospective_parachains_mode =
prospective_parachains_mode(sender, leaf.hash).await?;
let elastic_scaling_mvp = request_node_features(leaf.hash, session_index, sender)
.await?
.unwrap_or(NodeFeatures::EMPTY)
.get(FeatureIndex::ElasticScalingMVP as usize)
.map(|b| *b)
.unwrap_or(false);

per_session.insert(
session_index,
PerSession { prospective_parachains_mode, elastic_scaling_mvp },
PerSession { prospective_parachains_mode },
);
}

Expand Down Expand Up @@ -289,7 +279,6 @@ async fn send_inherent_data_bg<Context>(
let signed_bitfields = per_relay_parent.signed_bitfields.clone();
let backed_candidates = per_relay_parent.backed_candidates.clone();
let mode = per_relay_parent.prospective_parachains_mode;
let elastic_scaling_mvp = per_relay_parent.elastic_scaling_mvp;

let mut sender = ctx.sender().clone();

Expand All @@ -307,7 +296,6 @@ async fn send_inherent_data_bg<Context>(
&signed_bitfields,
&backed_candidates,
mode,
elastic_scaling_mvp,
return_senders,
&mut sender,
&metrics,
Expand Down Expand Up @@ -414,7 +402,6 @@ async fn send_inherent_data(
bitfields: &[SignedAvailabilityBitfield],
candidates: &[CandidateReceipt],
prospective_parachains_mode: ProspectiveParachainsMode,
elastic_scaling_mvp: bool,
return_senders: Vec<oneshot::Sender<ProvisionerInherentData>>,
from_job: &mut impl overseer::ProvisionerSenderTrait,
metrics: &Metrics,
Expand Down Expand Up @@ -466,7 +453,6 @@ async fn send_inherent_data(
&bitfields,
candidates,
prospective_parachains_mode,
elastic_scaling_mvp,
leaf.hash,
from_job,
)
Expand Down Expand Up @@ -679,7 +665,6 @@ async fn select_candidate_hashes_from_tracked(
/// Should be called when prospective parachains are enabled.
async fn request_backable_candidates(
availability_cores: &[CoreState],
elastic_scaling_mvp: bool,
bitfields: &[SignedAvailabilityBitfield],
relay_parent: Hash,
sender: &mut impl overseer::ProvisionerSenderTrait,
Expand Down Expand Up @@ -741,11 +726,6 @@ async fn request_backable_candidates(
for (para_id, core_count) in scheduled_cores_per_para {
let para_ancestors = ancestors.remove(&para_id).unwrap_or_default();

// If elastic scaling MVP is disabled, only allow one candidate per parachain.
if !elastic_scaling_mvp && core_count > 1 {
continue
}

let response = get_backable_candidates(
relay_parent,
para_id,
Expand Down Expand Up @@ -778,7 +758,6 @@ async fn select_candidates(
bitfields: &[SignedAvailabilityBitfield],
candidates: &[CandidateReceipt],
prospective_parachains_mode: ProspectiveParachainsMode,
elastic_scaling_mvp: bool,
relay_parent: Hash,
sender: &mut impl overseer::ProvisionerSenderTrait,
) -> Result<Vec<BackedCandidate>, Error> {
Expand All @@ -792,7 +771,6 @@ async fn select_candidates(
ProspectiveParachainsMode::Enabled { .. } =>
request_backable_candidates(
availability_cores,
elastic_scaling_mvp,
bitfields,
relay_parent,
sender,
Expand Down
20 changes: 20 additions & 0 deletions prdoc/pr_7286.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
title: Remove feature flag checks for Elastic Scaling MVP
doc:
- audience: Runtime Dev
Copy link
Contributor

Choose a reason for hiding this comment

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

All of these changes I can see in this PR are on the node side, but as @alindima pointed out, let's also cleanup the runtime.

description: |
## Description
This PR addresses [issue #6352](https://github.com/paritytech/polkadot-sdk/issues/6352), which proposes cleaning up the codebase by assuming that the FeatureIndex::ElasticScalingMVP feature is always enabled.

## Integration
- Removed the traces of the `elastic_scaling_mvp` scaling limitation (provisioner)
- Removed the traces of `inject_core_index` scaling limitation (backing)

## Review Notes
- The inject_core_index flag is used to support elastic scaling. When true, the core index is injected into the BackedCandidate, enabling dynamic core allocation and deallocation.
- I removed this check in the backing file since we assume elastic scaling is enabled.
Copy link
Contributor

Choose a reason for hiding this comment

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

The changes done here can be briefly summarised, not sure what you mean by "review notes"


crates:
- name: polkadot-node-core-backing
bump: patch
- name: polkadot-node-core-provisioner
bump: patch
Loading