mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 19:01:08 +00:00
approval-voting: remove redundant validation check (#6266)
* approval-voting: remove a redundant check * candidate-validation: remove unreachable check
This commit is contained in:
@@ -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;
|
||||
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!(
|
||||
|
||||
@@ -467,11 +467,6 @@ where
|
||||
.await;
|
||||
|
||||
if let Ok(ValidationResult::Valid(ref outputs, _)) = validation_result {
|
||||
// If validation produces new commitments we consider the candidate invalid.
|
||||
if candidate_receipt.commitments_hash != outputs.hash() {
|
||||
return Ok(ValidationResult::Invalid(InvalidCandidate::CommitmentsHashMismatch))
|
||||
}
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
match runtime_api_request(
|
||||
sender,
|
||||
|
||||
Reference in New Issue
Block a user