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

approval-voting: remove redundant validation check #6266

Merged
merged 2 commits into from
Nov 12, 2022
Merged
Changes from 1 commit
Commits
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
Next Next commit
approval-voting: remove a redundant check
  • Loading branch information
ordian committed Nov 10, 2022
commit 69b1f674fa10d5c460e2734bf605ff15e13cc94a
20 changes: 3 additions & 17 deletions node/core/approval-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2404,28 +2404,14 @@ async fn launch_approval<Context>(

match val_rx.await {
Err(_) => return ApprovalState::failed(validator_index, candidate_hash),
Ok(Ok(ValidationResult::Valid(commitments, _))) => {
Ok(Ok(ValidationResult::Valid(_, _))) => {
// Validation checked out. Issue an approval command. If the underlying service is unreachable,
// then there isn't anything we can do.

gum::trace!(target: LOG_TARGET, ?candidate_hash, ?para_id, "Candidate Valid");

let expected_commitments_hash = candidate.commitments_hash;
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, this make sense, we also check for this in validate_candidate_exhaustive

if commitments.hash() == expected_commitments_hash {
let _ = metrics_guard.take();
return ApprovalState::approved(validator_index, candidate_hash)
} else {
// Commitments mismatch - issue a dispute.
issue_local_invalid_statement(
&mut sender,
session_index,
candidate_hash,
candidate.clone(),
);

metrics_guard.take().on_approval_invalid();
return ApprovalState::failed(validator_index, candidate_hash)
}
let _ = metrics_guard.take();
return ApprovalState::approved(validator_index, candidate_hash)
},
Ok(Ok(ValidationResult::Invalid(reason))) => {
gum::warn!(
Expand Down