Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion polkadot/node/core/backing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ futures = { features = ["thread-pool"], workspace = true }
polkadot-node-subsystem-test-helpers = { workspace = true }
polkadot-primitives = { workspace = true, features = ["test"] }
polkadot-primitives-test-helpers = { workspace = true }
rstest = { workspace = true }
sc-keystore = { workspace = true, default-features = true }
sp-application-crypto = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }
Expand Down
29 changes: 4 additions & 25 deletions polkadot/node/core/backing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,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,6 @@ 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,
/// 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 @@ -616,7 +612,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 @@ -655,7 +650,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),
Comment thread
alindima marked this conversation as resolved.
))
}

Expand Down Expand Up @@ -1161,16 +1156,11 @@ async fn construct_per_relay_parent_state<Context>(
let node_features = per_session_cache.node_features(session_index, parent, ctx.sender()).await;
let node_features = try_runtime_api!(node_features);

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 @@ -1241,7 +1231,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 @@ -1676,11 +1665,7 @@ async fn post_import_statement_actions<Context>(

// `HashSet::insert` returns true if the thing wasn't in there already.
if rp_state.backed.insert(candidate_hash) {
if let Some(backed) = table_attested_to_backed(
attested,
&rp_state.table_context,
rp_state.inject_core_index,
) {
if let Some(backed) = table_attested_to_backed(attested, &rp_state.table_context) {
let para_id = backed.candidate().descriptor.para_id();
gum::debug!(
target: LOG_TARGET,
Expand Down Expand Up @@ -2157,13 +2142,7 @@ fn handle_get_backable_candidates_message(
&rp_state.table_context,
rp_state.minimum_backing_votes,
)
.and_then(|attested| {
table_attested_to_backed(
attested,
&rp_state.table_context,
rp_state.inject_core_index,
)
});
.and_then(|attested| table_attested_to_backed(attested, &rp_state.table_context));

if let Some(backed_candidate) = maybe_backed_candidate {
backed
Expand Down
45 changes: 13 additions & 32 deletions polkadot/node/core/backing/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use polkadot_node_subsystem::{
};
use polkadot_node_subsystem_test_helpers::mock::new_leaf;
use polkadot_primitives::{
node_features,
vstaging::{CoreState, MutateDescriptorV2, OccupiedCore},
BlockNumber, CandidateDescriptor, GroupRotationInfo, HeadData, Header, PersistedValidationData,
ScheduledCore, SessionIndex, LEGACY_MIN_BACKING_VOTES,
Expand All @@ -37,7 +36,6 @@ use polkadot_primitives_test_helpers::{
dummy_committed_candidate_receipt_v2, dummy_hash, validator_pubkeys,
};
use polkadot_statement_table::v2::Misbehavior;
use rstest::rstest;
use sp_application_crypto::AppCrypto;
use sp_keyring::Sr25519Keyring;
use sp_keystore::Keystore;
Expand Down Expand Up @@ -780,19 +778,9 @@ fn backing_second_works() {
}

// Test that the candidate reaches quorum successfully.
#[rstest]
#[case(true)]
#[case(false)]
fn backing_works(#[case] elastic_scaling_mvp: bool) {
#[test]
fn backing_works() {
let mut test_state = TestState::default();
if elastic_scaling_mvp {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you can remove the same bit of code from backed_candidate_preserves_order

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright, hey, @alindima. Just a heads up: I may take some time to complete this. I will get started in the next four hours, as I am tied up with interviews.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sure, that's ok. take your time

Copy link
Copy Markdown
Contributor Author

@EleisonC EleisonC Mar 24, 2025

Choose a reason for hiding this comment

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

Hey @alindima, I've completed the changes. However, even though running taplo format --config .config/taplo.toml locally produces no errors, the TOML check is still failing on CI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks to be failing on a completely unrelated toml file (cumulus/bin/pov-validator/Cargo.toml). I've no idea why

test_state
.node_features
.resize((node_features::FeatureIndex::ElasticScalingMVP as u8 + 1) as usize, false);
test_state
.node_features
.set(node_features::FeatureIndex::ElasticScalingMVP as u8 as usize, true);
}

test_harness(test_state.keystore.clone(), |mut virtual_overseer| async move {
let para_id = activate_initial_leaf(&mut virtual_overseer, &mut test_state).await;
Expand Down Expand Up @@ -917,12 +905,9 @@ fn backing_works(#[case] elastic_scaling_mvp: bool) {
assert_eq!(candidates[0].validity_votes().len(), 3);

let (validator_indices, maybe_core_index) =
candidates[0].validator_indices_and_core_index(elastic_scaling_mvp);
if elastic_scaling_mvp {
assert_eq!(maybe_core_index.unwrap(), CoreIndex(0));
} else {
assert!(maybe_core_index.is_none());
}
candidates[0].validator_indices_and_core_index(true);

assert_eq!(maybe_core_index.unwrap(), CoreIndex(0));

assert_eq!(
validator_indices,
Expand All @@ -941,13 +926,6 @@ fn backing_works(#[case] elastic_scaling_mvp: bool) {
#[test]
fn get_backed_candidate_preserves_order() {
let mut test_state = TestState::default();
test_state
.node_features
.resize((node_features::FeatureIndex::ElasticScalingMVP as u8 + 1) as usize, false);
test_state
.node_features
.set(node_features::FeatureIndex::ElasticScalingMVP as u8 as usize, true);

// Set a single validator as the first validator group. It simplifies the test.
test_state.validator_groups.0[0] = vec![ValidatorIndex(2)];
// Add another validator group for the third core.
Expand Down Expand Up @@ -1575,8 +1553,11 @@ fn backing_works_while_validation_ongoing() {
.validity_votes()
.contains(&ValidityAttestation::Explicit(signed_c.signature().clone())));
assert_eq!(
candidates[0].validator_indices_and_core_index(false),
(bitvec::bitvec![u8, bitvec::order::Lsb0; 1, 0, 1, 1].as_bitslice(), None)
candidates[0].validator_indices_and_core_index(true),
(
bitvec::bitvec![u8, bitvec::order::Lsb0; 1, 0, 1, 1].as_bitslice(),
Some(CoreIndex(0))
)
);

virtual_overseer
Expand Down Expand Up @@ -2225,7 +2206,7 @@ fn candidate_backing_reorders_votes() {
group_id: core_idx,
};

let backed = table_attested_to_backed(attested, &table_context, false).unwrap();
let backed = table_attested_to_backed(attested, &table_context).unwrap();

let expected_bitvec = {
let mut validator_indices = BitVec::<u8, bitvec::order::Lsb0>::with_capacity(6);
Expand All @@ -2243,8 +2224,8 @@ fn candidate_backing_reorders_votes() {
vec![fake_attestation(1).into(), fake_attestation(3).into(), fake_attestation(5).into()];

assert_eq!(
backed.validator_indices_and_core_index(false),
(expected_bitvec.as_bitslice(), None)
backed.validator_indices_and_core_index(true),
(expected_bitvec.as_bitslice(), Some(CoreIndex(10)))
);
assert_eq!(backed.validity_votes(), expected_attestations);
}
Expand Down
3 changes: 0 additions & 3 deletions polkadot/node/core/provisioner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ polkadot-node-primitives = { workspace = true, default-features = true }
polkadot-node-subsystem = { workspace = true, default-features = true }
polkadot-node-subsystem-util = { workspace = true, default-features = true }
polkadot-primitives = { workspace = true, default-features = true }
schnellru = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
Expand All @@ -30,5 +29,3 @@ polkadot-primitives = { workspace = true, features = ["test"] }
polkadot-primitives-test-helpers = { workspace = true }
sp-application-crypto = { workspace = true, default-features = true }
sp-keystore = { workspace = true, default-features = true }

rstest = { workspace = true }
Loading
Loading