Skip to content

Commit

Permalink
clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
ordian committed Jun 4, 2024
1 parent cc8e9ef commit cd583f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
1 change: 1 addition & 0 deletions polkadot/runtime/parachains/src/paras_inherent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ impl<T: Config> Pallet<T> {
inclusion::Pallet::<T>::free_disputed(&current_concluded_invalid_disputes)
.into_iter()
.unzip();
// Also include descendants of the concluded invalid candidates.
current_concluded_invalid_disputes.extend(concluded_invalid_hashes);

// Create a bit index from the set of core indices where each index corresponds to
Expand Down
21 changes: 3 additions & 18 deletions polkadot/runtime/parachains/src/paras_inherent/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ mod sanitizers {

use crate::{
mock::{set_disabled_validators, RuntimeOrigin},
scheduler::{common::Assignment, CoreOccupiedType, ParasEntry},
scheduler::{common::Assignment, ParasEntry},
util::{make_persisted_validation_data, make_persisted_validation_data_with_parent},
};
use primitives::ValidationCode;
Expand All @@ -1758,7 +1758,6 @@ mod sanitizers {
expected_backed_candidates_with_core:
BTreeMap<ParaId, Vec<(BackedCandidate, CoreIndex)>>,
scheduled_paras: BTreeMap<primitives::Id, BTreeSet<CoreIndex>>,
validators: Vec<Sr25519Keyring>,
}

// Generate test data for the candidates and assert that the environment is set as expected
Expand Down Expand Up @@ -1821,12 +1820,6 @@ mod sanitizers {
vec![ValidatorIndex(2), ValidatorIndex(3)],
]);

// Set the availability of the cores
scheduler::Pallet::<Test>::set_availability_cores(vec![
CoreOccupiedType::<Test>::Free,
CoreOccupiedType::<Test>::Free,
]);

// Update scheduler's claimqueue with the parachains
scheduler::Pallet::<Test>::set_claimqueue(BTreeMap::from([
(
Expand Down Expand Up @@ -1941,7 +1934,6 @@ mod sanitizers {
backed_candidates,
scheduled_paras: scheduled,
expected_backed_candidates_with_core,
validators,
}
}

Expand Down Expand Up @@ -2485,7 +2477,6 @@ mod sanitizers {
backed_candidates,
scheduled_paras: scheduled,
expected_backed_candidates_with_core,
validators,
}
}

Expand Down Expand Up @@ -2989,7 +2980,6 @@ mod sanitizers {
backed_candidates,
scheduled_paras: scheduled,
expected_backed_candidates_with_core,
validators,
}
}

Expand Down Expand Up @@ -3227,16 +3217,11 @@ mod sanitizers {
const RELAY_PARENT_NUMBER: u32 = 1;

let mut hc = configuration::ActiveConfig::<Test>::get();
hc.minimum_backing_votes = 1;
hc.scheduler_params.group_rotation_frequency = 20;
hc.async_backing_params.allowed_ancestry_len = 10;
hc.async_backing_params.max_candidate_depth = 10;
configuration::Pallet::<Test>::force_set_active_config(hc);

let header = default_header();
let relay_parent = header.hash();
// let TestData { backed_candidates, validators, .. } =
// get_test_data_one_core_per_para(false);

let session = SessionIndex::from(0_u32);
let keystore = LocalKeystore::in_memory();
Expand Down Expand Up @@ -3286,6 +3271,7 @@ mod sanitizers {
.map(|(i, g)| (ParaId::from(i as u32 + 1), g))
.collect();
let shuffled_indices = shared::ActiveValidatorIndices::<Test>::get();
// shuffle the keyrings in the same way as the validators
let validators_keyrings =
crate::util::take_active_subset(&shuffled_indices, &validators_keyrings);

Expand Down Expand Up @@ -3336,13 +3322,12 @@ mod sanitizers {
let group = para_id_to_group[&para_id].as_ref();
let backed = back_candidate(
candidate,
&validators_keyrings, // TODO: shuffle
&validators_keyrings,
group,
&keystore,
&signing_context,
BackingKind::Threshold,
None,
// Some(CoreIndex(idx0 as u32)),
);
backed
})
Expand Down
5 changes: 0 additions & 5 deletions polkadot/runtime/parachains/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,4 @@ impl<T: Config> Pallet<T> {
pub(crate) fn set_claimqueue(claimqueue: BTreeMap<CoreIndex, VecDeque<ParasEntryType<T>>>) {
ClaimQueue::<T>::set(claimqueue);
}

#[cfg(test)]
pub(crate) fn set_availability_cores(cores: Vec<CoreOccupiedType<T>>) {
AvailabilityCores::<T>::set(cores);
}
}

0 comments on commit cd583f7

Please sign in to comment.