Skip to content

Commit

Permalink
tmp change approach
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Nov 26, 2024
1 parent 36ef653 commit 0cfe5bb
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ public SafeFuture<BlobSidecarsAndValidationResult> getAvailabilityCheckResult()
if (blobsAndProofs == null) {
return SafeFuture.completedFuture(BlobSidecarsAndValidationResult.NOT_REQUIRED);
}
try {
return SafeFuture.completedFuture(validateImmediately(block, blobsAndProofs));
} catch (RuntimeException e) {
return SafeFuture.completedFuture(BlobSidecarsAndValidationResult.notAvailable(e));
}
return SafeFuture.completedFuture(validateImmediately(block, blobsAndProofs));
}

private BlobSidecarsAndValidationResult validateImmediately(
Expand All @@ -111,8 +107,12 @@ private BlobSidecarsAndValidationResult validateImmediately(
.map(SszKZGCommitment::getKZGCommitment)
.toList();
final List<Bytes> blobs = blobsAndProofs.blobs.stream().map(Blob::getBytes).toList();
if (!kzg.verifyBlobKzgProofBatch(blobs, kzgCommitments, blobsAndProofs.proofs)) {
throw new RuntimeException("Invalid KZG proof");
try {
if (!kzg.verifyBlobKzgProofBatch(blobs, kzgCommitments, blobsAndProofs.proofs)) {
return BlobSidecarsAndValidationResult.invalidResult(Collections.emptyList());
}
} catch (final Exception ex) {
return BlobSidecarsAndValidationResult.invalidResult(Collections.emptyList(), ex);
}
return BlobSidecarsAndValidationResult.validResult(Collections.emptyList());
}
Expand Down

0 comments on commit 0cfe5bb

Please sign in to comment.