Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
wrong if-case (#4798)
Browse files Browse the repository at this point in the history
* fixup

* fmt

* fix tests
  • Loading branch information
drahnr authored Jan 28, 2022
1 parent e3985d4 commit 1c2a0e2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 37 deletions.
41 changes: 19 additions & 22 deletions runtime/parachains/src/inclusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ impl<T: Config> Pallet<T> {
candidates: Vec<BackedCandidate<T::Hash>>,
scheduled: Vec<CoreAssignment>,
group_validators: GV,
full_check: FullCheck,
) -> Result<ProcessedCandidates<T::Hash>, DispatchError>
where
GV: Fn(GroupIndex) -> Option<Vec<ValidatorIndex>>,
Expand Down Expand Up @@ -523,27 +522,25 @@ impl<T: Config> Pallet<T> {
'next_backed_candidate: for (candidate_idx, backed_candidate) in
candidates.iter().enumerate()
{
if let FullCheck::Yes = full_check {
match check_ctx.verify_backed_candidate(
parent_hash,
parent_storage_root,
candidate_idx,
backed_candidate,
)? {
Err(FailedToCreatePVD) => {
log::debug!(
target: LOG_TARGET,
"Failed to create PVD for candidate {} on relay parent {:?}",
candidate_idx,
parent_hash,
);
// We don't want to error out here because it will
// brick the relay-chain. So we return early without
// doing anything.
return Ok(ProcessedCandidates::default())
},
Ok(rpn) => rpn,
}
match check_ctx.verify_backed_candidate(
parent_hash,
parent_storage_root,
candidate_idx,
backed_candidate,
)? {
Err(FailedToCreatePVD) => {
log::debug!(
target: LOG_TARGET,
"Failed to create PVD for candidate {} on relay parent {:?}",
candidate_idx,
parent_hash,
);
// We don't want to error out here because it will
// brick the relay-chain. So we return early without
// doing anything.
return Ok(ProcessedCandidates::default())
},
Ok(rpn) => rpn,
}

let para_id = backed_candidate.descriptor().para_id;
Expand Down
14 changes: 0 additions & 14 deletions runtime/parachains/src/inclusion/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_b_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::UnscheduledCandidate
);
Expand Down Expand Up @@ -1044,7 +1043,6 @@ fn candidate_checks() {
vec![backed_b, backed_a],
vec![chain_a_assignment.clone(), chain_b_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::UnscheduledCandidate
);
Expand Down Expand Up @@ -1078,7 +1076,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::InsufficientBacking
);
Expand Down Expand Up @@ -1114,7 +1111,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::CandidateNotInParentContext
);
Expand Down Expand Up @@ -1154,7 +1150,6 @@ fn candidate_checks() {
thread_a_assignment.clone(),
],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::WrongCollator,
);
Expand Down Expand Up @@ -1193,7 +1188,6 @@ fn candidate_checks() {
vec![backed],
vec![thread_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::NotCollatorSigned
);
Expand Down Expand Up @@ -1244,7 +1238,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::CandidateScheduledBeforeParaFree
);
Expand Down Expand Up @@ -1285,7 +1278,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::CandidateScheduledBeforeParaFree
);
Expand Down Expand Up @@ -1330,7 +1322,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::PrematureCodeUpgrade
);
Expand Down Expand Up @@ -1365,7 +1356,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Err(Error::<Test>::ValidationDataHashMismatch.into()),
);
Expand Down Expand Up @@ -1401,7 +1391,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::InvalidValidationCodeHash
);
Expand Down Expand Up @@ -1437,7 +1426,6 @@ fn candidate_checks() {
vec![backed],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
),
Error::<Test>::ParaHeadMismatch
);
Expand Down Expand Up @@ -1607,7 +1595,6 @@ fn backing_works() {
thread_a_assignment.clone(),
],
&group_validators,
FullCheck::Yes,
)
.expect("candidates scheduled, in order, and backed");

Expand Down Expand Up @@ -1805,7 +1792,6 @@ fn can_include_candidate_with_ok_code_upgrade() {
vec![backed_a],
vec![chain_a_assignment.clone()],
&group_validators,
FullCheck::Yes,
)
.expect("candidates scheduled, in order, and backed");

Expand Down
1 change: 0 additions & 1 deletion runtime/parachains/src/paras_inherent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ impl<T: Config> Pallet<T> {
backed_candidates,
scheduled,
<scheduler::Pallet<T>>::group_validators,
full_check,
)?;

METRICS.on_disputes_included(checked_disputes.len() as u64);
Expand Down

0 comments on commit 1c2a0e2

Please sign in to comment.