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

Commit 56b8c39

Browse files
committed
candidate-validation: info logs on failure
1 parent e9c2bd2 commit 56b8c39

File tree

1 file changed

+14
-9
lines changed
  • node/core/candidate-validation/src

1 file changed

+14
-9
lines changed

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,11 @@ async fn validate_candidate_exhaustive(
501501
let _timer = metrics.time_validate_candidate_exhaustive();
502502

503503
let validation_code_hash = validation_code.hash();
504+
let para_id = candidate_receipt.descriptor.para_id.clone();
504505
gum::debug!(
505506
target: LOG_TARGET,
506507
?validation_code_hash,
507-
para_id = ?candidate_receipt.descriptor.para_id,
508+
?para_id,
508509
"About to validate a candidate.",
509510
);
510511

@@ -514,6 +515,7 @@ async fn validate_candidate_exhaustive(
514515
&*pov,
515516
&validation_code_hash,
516517
) {
518+
gum::info!(target: LOG_TARGET, ?para_id, "Invalid candidate (basic checks)");
517519
return Ok(ValidationResult::Invalid(e))
518520
}
519521

@@ -523,7 +525,7 @@ async fn validate_candidate_exhaustive(
523525
) {
524526
Ok(code) => code,
525527
Err(e) => {
526-
gum::debug!(target: LOG_TARGET, err=?e, "Invalid validation code");
528+
gum::info!(target: LOG_TARGET, ?para_id, err=?e, "Invalid candidate (validation code)");
527529

528530
// If the validation code is invalid, the candidate certainly is.
529531
return Ok(ValidationResult::Invalid(InvalidCandidate::CodeDecompressionFailure))
@@ -534,7 +536,7 @@ async fn validate_candidate_exhaustive(
534536
match sp_maybe_compressed_blob::decompress(&pov.block_data.0, POV_BOMB_LIMIT) {
535537
Ok(block_data) => BlockData(block_data.to_vec()),
536538
Err(e) => {
537-
gum::debug!(target: LOG_TARGET, err=?e, "Invalid PoV code");
539+
gum::info!(target: LOG_TARGET, ?para_id, err=?e, "Invalid candidate (PoV code)");
538540

539541
// If the PoV is invalid, the candidate certainly is.
540542
return Ok(ValidationResult::Invalid(InvalidCandidate::PoVDecompressionFailure))
@@ -552,12 +554,8 @@ async fn validate_candidate_exhaustive(
552554
.validate_candidate(raw_validation_code.to_vec(), timeout, params)
553555
.await;
554556

555-
if let Err(ref e) = result {
556-
gum::debug!(
557-
target: LOG_TARGET,
558-
error = ?e,
559-
"Failed to validate candidate",
560-
);
557+
if let Err(ref error) = result {
558+
gum::info!(target: LOG_TARGET, ?para_id, ?error, "Failed to validate candidate",);
561559
}
562560

563561
match result {
@@ -576,6 +574,7 @@ async fn validate_candidate_exhaustive(
576574

577575
Ok(res) =>
578576
if res.head_data.hash() != candidate_receipt.descriptor.para_head {
577+
gum::info!(target: LOG_TARGET, ?para_id, "Invalid candidate (para_head)");
579578
Ok(ValidationResult::Invalid(InvalidCandidate::ParaHeadHashMismatch))
580579
} else {
581580
let outputs = CandidateCommitments {
@@ -587,6 +586,12 @@ async fn validate_candidate_exhaustive(
587586
hrmp_watermark: res.hrmp_watermark,
588587
};
589588
if candidate_receipt.commitments_hash != outputs.hash() {
589+
gum::info!(
590+
target: LOG_TARGET,
591+
?para_id,
592+
"Invalid candidate (commitments hash)"
593+
);
594+
590595
// If validation produced a new set of commitments, we treat the candidate as invalid.
591596
Ok(ValidationResult::Invalid(InvalidCandidate::CommitmentsHashMismatch))
592597
} else {

0 commit comments

Comments
 (0)