Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ordian committed Jun 3, 2024
1 parent c66c4f4 commit 1296110
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 34 deletions.
3 changes: 0 additions & 3 deletions polkadot/runtime/parachains/src/disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ impl<BlockNumber: Clone> DisputeStateImporter<BlockNumber> {
let mut undo =
ImportUndo { validator_index: validator, vote_kind: kind, new_participant: false };

log::debug!(target: LOG_TARGET, "Setting dispute bit: {}", validator.0);
bits.set(validator.0 as usize, true);
if kind.is_backing() {
let is_new = self.backers.insert(validator);
Expand Down Expand Up @@ -992,7 +991,6 @@ impl<T: Config> Pallet<T> {

let backers =
BackersOnDisputes::<T>::get(&set.session, &set.candidate_hash).unwrap_or_default();
log::debug!(target: LOG_TARGET, "Dispute import with {} backers", backers.len());

// Check and import all votes.
let summary = {
Expand All @@ -1010,7 +1008,6 @@ impl<T: Config> Pallet<T> {
};

let kind = VoteKind::from(statement);
log::debug!(target: LOG_TARGET, "Importing {:?} vote from {}", kind, validator_index.0);

let undo = match importer.import(*validator_index, kind) {
Ok(u) => u,
Expand Down
2 changes: 0 additions & 2 deletions polkadot/runtime/parachains/src/paras_inherent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,12 @@ impl<T: Config> Pallet<T> {

// Limit the disputes first, since the following statements depend on the votes include
// here.
log::debug!(target: LOG_TARGET, "Disputes before sanitization: {}", disputes.len());
let (checked_disputes_sets, checked_disputes_sets_consumed_weight) =
limit_and_sanitize_disputes::<T, _>(
disputes,
dispute_statement_set_valid,
max_block_weight,
);
log::debug!(target: LOG_TARGET, "Disputes after sanitization: {}", checked_disputes_sets.len());

let all_weight_after = if context == ProcessInherentDataContext::ProvideInherent {
// Assure the maximum block weight is adhered, by limiting bitfields and backed
Expand Down
23 changes: 0 additions & 23 deletions polkadot/runtime/parachains/src/paras_inherent/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3319,11 +3319,7 @@ mod sanitizers {
3,
10,
);
let allowed_parents = shared::AllowedRelayParents::<Test>::get();
println!("before enter: {allowed_parents:?}");
let _ = Pallet::<Test>::enter(frame_system::RawOrigin::None.into(), data).unwrap();
let allowed_parents = shared::AllowedRelayParents::<Test>::get();
println!("right after: {allowed_parents:?}");

assert_matches!(pallet::OnChainVotes::<Test>::get(), Some(ScrapedOnChainVotes {
disputes,
Expand All @@ -3341,14 +3337,6 @@ mod sanitizers {
parent_header.hash(), // `parent_hash`,
Default::default(), // digest,
);
// let data = ParachainsInherentData {
// disputes: Vec::new(),
// parent_header: parent_header.clone(),
// bitfields: Vec::new(),
// backed_candidates: Vec::new(),
// };
// let _ = Pallet::<Test>::enter(frame_system::RawOrigin::None.into(),
// data).unwrap();

frame_system::Pallet::<Test>::reset_events();
frame_system::Pallet::<Test>::initialize(
Expand All @@ -3364,17 +3352,6 @@ mod sanitizers {
backed_candidates,
};

// shared::Pallet::<Test>::clear_allowed_relay_parents();
// let header = default_header();
// shared::Pallet::<Test>::add_allowed_relay_parent(
// header.hash(),
// *header.state_root(),
// 3,
// 10,
// );
let allowed_parents = shared::AllowedRelayParents::<Test>::get();
println!("{allowed_parents:?}");

let _ = Pallet::<Test>::enter(frame_system::RawOrigin::None.into(), data).unwrap();
assert_eq!(
// The length of this vec is equal to the number of candidates, so we know
Expand Down
7 changes: 1 addition & 6 deletions polkadot/runtime/parachains/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(crate) const SESSION_DELAY: SessionIndex = 2;
mod tests;

/// Information about past relay-parents.
#[derive(Encode, Decode, Default, TypeInfo, Debug)]
#[derive(Encode, Decode, Default, TypeInfo)]
pub struct AllowedRelayParentsTracker<Hash, BlockNumber> {
// The past relay parents, paired with state roots, that are viable to build upon.
//
Expand Down Expand Up @@ -270,9 +270,4 @@ impl<T: Config> Pallet<T> {
tracker.update(relay_parent, state_root, number, max_ancestry_len)
})
}

#[cfg(test)]
pub(crate) fn clear_allowed_relay_parents() {
AllowedRelayParents::<T>::kill();
}
}

0 comments on commit 1296110

Please sign in to comment.