Skip to content

Commit 8c529fe

Browse files
committed
Get rid of v2 node feature handling.
v2 is enabled everywhere already.
1 parent 67b892d commit 8c529fe

File tree

3 files changed

+6
-36
lines changed
  • polkadot
    • node/network/collator-protocol/src/validator_side
    • runtime/parachains/src/paras_inherent

3 files changed

+6
-36
lines changed

polkadot/node/network/collator-protocol/src/validator_side/mod.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ impl RelayParentHoldOffState {
421421
struct PerRelayParent {
422422
assignment: GroupAssignments,
423423
collations: Collations,
424-
v2_receipts: bool,
425424
v3_enabled: bool,
426425
current_core: CoreIndex,
427426
session_index: SessionIndex,
@@ -588,7 +587,6 @@ async fn construct_per_relay_parent<Sender>(
588587
current_assignments: &mut HashMap<ParaId, usize>,
589588
keystore: &KeystorePtr,
590589
relay_parent: Hash,
591-
v2_receipts: bool,
592590
v3_enabled: bool,
593591
session_index: SessionIndex,
594592
) -> Result<Option<PerRelayParent>>
@@ -642,7 +640,6 @@ where
642640
Ok(Some(PerRelayParent {
643641
assignment,
644642
collations,
645-
v2_receipts,
646643
v3_enabled,
647644
session_index,
648645
current_core: core_now,
@@ -1524,15 +1521,13 @@ where
15241521
.await
15251522
.map_err(Error::CancelledNodeFeatures)??;
15261523

1527-
let v2_receipts = node_features::FeatureIndex::CandidateReceiptV2.is_set(&node_features);
15281524
let v3_enabled = node_features::FeatureIndex::CandidateReceiptV3.is_set(&node_features);
15291525

15301526
let Some(per_relay_parent) = construct_per_relay_parent(
15311527
sender,
15321528
&mut state.current_assignments,
15331529
keystore,
15341530
*leaf,
1535-
v2_receipts,
15361531
v3_enabled,
15371532
session_index,
15381533
)
@@ -1557,14 +1552,14 @@ where
15571552
.unwrap_or_default();
15581553
for block_hash in allowed_ancestry {
15591554
if let Entry::Vacant(entry) = state.per_relay_parent.entry(*block_hash) {
1560-
// Safe to use the same v2 receipts config for the allowed relay parents as well
1555+
// Safe to use the same v3_enabled config for the allowed relay parents as well
15611556
// as the same session index since they must be in the same session.
15621557
if let Some(per_relay_parent) = construct_per_relay_parent(
15631558
sender,
15641559
&mut state.current_assignments,
15651560
keystore,
15661561
*block_hash,
1567-
v2_receipts,
1562+
v3_enabled,
15681563
session_index,
15691564
)
15701565
.await?
@@ -2577,7 +2572,7 @@ fn descriptor_version_sanity_check(
25772572
) -> std::result::Result<(), SecondingError> {
25782573
match descriptor.version(per_relay_parent.v3_enabled) {
25792574
CandidateDescriptorVersion::V1 => Ok(()),
2580-
CandidateDescriptorVersion::V2 if per_relay_parent.v2_receipts => {
2575+
CandidateDescriptorVersion::V2 | CandidateDescriptorVersion::V3 => {
25812576
if let Some(core_index) = descriptor.core_index(per_relay_parent.v3_enabled) {
25822577
if core_index != per_relay_parent.current_core {
25832578
return Err(SecondingError::InvalidCoreIndex(

polkadot/runtime/parachains/src/paras_inherent/mod.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -608,16 +608,13 @@ impl<T: Config> Pallet<T> {
608608
}
609609

610610
let node_features = configuration::ActiveConfig::<T>::get().node_features;
611-
612-
let allow_v2_receipts = FeatureIndex::CandidateReceiptV2.is_set(&node_features);
613611
let v3_enabled = FeatureIndex::CandidateReceiptV3.is_set(&node_features);
614612

615613
let backed_candidates_with_core = sanitize_backed_candidates::<T>(
616614
backed_candidates,
617615
&allowed_relay_parents,
618616
concluded_invalid_hashes,
619617
eligible,
620-
allow_v2_receipts,
621618
v3_enabled,
622619
);
623620
let count = count_backed_candidates(&backed_candidates_with_core);
@@ -974,7 +971,6 @@ pub(crate) fn sanitize_bitfields<T: crate::inclusion::Config>(
974971
fn sanitize_backed_candidate_v2<T: crate::inclusion::Config>(
975972
candidate: &BackedCandidate<T::Hash>,
976973
allowed_relay_parents: &AllowedRelayParentsTracker<T::Hash, BlockNumberFor<T>>,
977-
allow_v2_receipts: bool,
978974
v3_enabled: bool,
979975
) -> bool {
980976
let descriptor_version = candidate.descriptor().version(v3_enabled);
@@ -993,18 +989,6 @@ fn sanitize_backed_candidate_v2<T: crate::inclusion::Config>(
993989
_ => {},
994990
}
995991

996-
// It is mandatory to filter these before calling `filter_unchained_candidates` to ensure
997-
// any we drop any descendants of the dropped v2 candidates.
998-
if descriptor_version == CandidateDescriptorVersion::V2 && !allow_v2_receipts {
999-
log::debug!(
1000-
target: LOG_TARGET,
1001-
"V2 candidate descriptors not allowed. Dropping candidate {:?} for paraid {:?}.",
1002-
candidate.candidate().hash(),
1003-
candidate.descriptor().para_id()
1004-
);
1005-
return false
1006-
}
1007-
1008992
// Get the claim queue snapshot at the candidate relay parent.
1009993
let Some((rp_info, _)) =
1010994
allowed_relay_parents.acquire_info(candidate.descriptor().relay_parent(), None)
@@ -1083,20 +1067,14 @@ fn sanitize_backed_candidates<T: crate::inclusion::Config>(
10831067
allowed_relay_parents: &AllowedRelayParentsTracker<T::Hash, BlockNumberFor<T>>,
10841068
concluded_invalid_with_descendants: BTreeSet<CandidateHash>,
10851069
scheduled: BTreeMap<ParaId, BTreeSet<CoreIndex>>,
1086-
allow_v2_receipts: bool,
10871070
v3_enabled: bool,
10881071
) -> BTreeMap<ParaId, Vec<(BackedCandidate<T::Hash>, CoreIndex)>> {
10891072
// Map the candidates to the right paraids, while making sure that the order between candidates
10901073
// of the same para is preserved.
10911074
let mut candidates_per_para: BTreeMap<ParaId, Vec<_>> = BTreeMap::new();
10921075

10931076
for candidate in backed_candidates {
1094-
if !sanitize_backed_candidate_v2::<T>(
1095-
&candidate,
1096-
allowed_relay_parents,
1097-
allow_v2_receipts,
1098-
v3_enabled,
1099-
) {
1077+
if !sanitize_backed_candidate_v2::<T>(&candidate, allowed_relay_parents, v3_enabled) {
11001078
continue
11011079
}
11021080

polkadot/runtime/parachains/src/paras_inherent/tests.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,6 @@ mod enter {
15491549
len: usize,
15501550
start_core_index: usize,
15511551
code_upgrade_index: Option<usize>,
1552-
v2_receipts: bool,
15531552
) -> Vec<BackedCandidate> {
15541553
if let Some(code_upgrade_index) = code_upgrade_index {
15551554
assert!(code_upgrade_index < len, "Code upgrade index out of bounds");
@@ -1565,10 +1564,8 @@ mod enter {
15651564
if Some(idx) == code_upgrade_index {
15661565
builder.new_validation_code = Some(vec![1, 2, 3, 4].into());
15671566
}
1568-
if v2_receipts {
1569-
builder.core_index = Some(core_index);
1570-
builder.core_selector = Some(idx as u8);
1571-
}
1567+
builder.core_index = Some(core_index);
1568+
builder.core_selector = Some(idx as u8);
15721569
let ccr = builder.build();
15731570

15741571
BackedCandidate::new(ccr.into(), Default::default(), Default::default(), core_index)

0 commit comments

Comments
 (0)