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

Commit 254fbc4

Browse files
author
Andronik
committed
approval-voting: remove redundant validation check (#6266)
* approval-voting: remove a redundant check * candidate-validation: remove unreachable check
1 parent adcd81e commit 254fbc4

File tree

2 files changed

+3
-22
lines changed
  • node/core

2 files changed

+3
-22
lines changed

node/core/approval-voting/src/lib.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,28 +2404,14 @@ async fn launch_approval<Context>(
24042404

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

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

2413-
let expected_commitments_hash = candidate.commitments_hash;
2414-
if commitments.hash() == expected_commitments_hash {
2415-
let _ = metrics_guard.take();
2416-
return ApprovalState::approved(validator_index, candidate_hash)
2417-
} else {
2418-
// Commitments mismatch - issue a dispute.
2419-
issue_local_invalid_statement(
2420-
&mut sender,
2421-
session_index,
2422-
candidate_hash,
2423-
candidate.clone(),
2424-
);
2425-
2426-
metrics_guard.take().on_approval_invalid();
2427-
return ApprovalState::failed(validator_index, candidate_hash)
2428-
}
2413+
let _ = metrics_guard.take();
2414+
return ApprovalState::approved(validator_index, candidate_hash)
24292415
},
24302416
Ok(Ok(ValidationResult::Invalid(reason))) => {
24312417
gum::warn!(

node/core/candidate-validation/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,6 @@ where
467467
.await;
468468

469469
if let Ok(ValidationResult::Valid(ref outputs, _)) = validation_result {
470-
// If validation produces new commitments we consider the candidate invalid.
471-
if candidate_receipt.commitments_hash != outputs.hash() {
472-
return Ok(ValidationResult::Invalid(InvalidCandidate::CommitmentsHashMismatch))
473-
}
474-
475470
let (tx, rx) = oneshot::channel();
476471
match runtime_api_request(
477472
sender,

0 commit comments

Comments
 (0)