Skip to content
Merged
Changes from all commits
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
82 changes: 42 additions & 40 deletions chia/plotting/check_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import Counter
from pathlib import Path
from threading import Lock
from time import sleep, time
from time import monotonic, sleep
from typing import Optional

from chia_rs import G1Element
Expand Down Expand Up @@ -172,45 +172,16 @@ def process_plot(plot_path: Path, plot_info: PlotInfo, num_start: int, num_end:
challenge = std_hash(i.to_bytes(32, "big"))
# Some plot errors cause get_qualities_for_challenge to throw a RuntimeError
try:
quality_start_time = round(time() * 1000)
for index, quality_str in enumerate(pr.get_qualities_for_challenge(challenge)):
quality_spent_time = round(time() * 1000) - quality_start_time
if quality_spent_time > 8000:
log.warning(
f"\tLooking up qualities took: {quality_spent_time} ms. This should be below 8 seconds "
f"to minimize risk of losing rewards. Filepath: {plot_path}"
)
else:
log.info(f"\tLooking up qualities took: {quality_spent_time} ms. Filepath: {plot_path}")

# Other plot errors cause get_full_proof or validate_proof to throw an AssertionError
try:
proof_start_time = round(time() * 1000)
# TODO : todo_v2_plots handle v2 plots
proof = pr.get_full_proof(challenge, index, parallel_read)
proof_spent_time = round(time() * 1000) - proof_start_time
if proof_spent_time > 15000:
log.warning(
f"\tFinding proof took: {proof_spent_time} ms. This should be below 15 seconds "
f"to minimize risk of losing rewards. Filepath: {plot_path}"
)
else:
log.info(f"\tFinding proof took: {proof_spent_time} ms. Filepath: {plot_path}")

ver_quality_str = v.validate_proof(pr.get_id(), pr.get_size(), challenge, proof)
if quality_str == ver_quality_str:
total_proofs += 1
else:
log.warning(
f"\tQuality doesn't match with proof. Filepath: {plot_path} "
"This can occasionally happen with a compressed plot."
)
except AssertionError as e:
log.error(
f"{type(e)}: {e} error in proving/verifying for plot {plot_path}. Filepath: {plot_path}"
)
caught_exception = True
quality_start_time = round(time() * 1000)
quality_start_time = round(monotonic() * 1000)
qualities = pr.get_qualities_for_challenge(challenge)
quality_spent_time = round(monotonic() * 1000) - quality_start_time
if quality_spent_time > 8000:
log.warning(
f"\tLooking up qualities took: {quality_spent_time} ms. This should be below 8 seconds "
f"to minimize risk of losing rewards. Filepath: {plot_path}"
)
else:
log.info(f"\tLooking up qualities took: {quality_spent_time} ms. Filepath: {plot_path}")
except KeyboardInterrupt:
log.warning("Interrupted, closing")
return
Expand All @@ -224,9 +195,40 @@ def process_plot(plot_path: Path, plot_info: PlotInfo, num_start: int, num_end:
else:
log.error(f"{type(e)}: {e} error in getting challenge qualities for plot {plot_path}")
caught_exception = True
continue
except Exception as e:
log.error(f"{type(e)}: {e} error in getting challenge qualities for plot {plot_path}")
caught_exception = True
break

for index, quality_str in enumerate(qualities):
# Other plot errors cause get_full_proof or validate_proof to throw an AssertionError
try:
proof_start_time = round(monotonic() * 1000)
# TODO : todo_v2_plots handle v2 plots
proof = pr.get_full_proof(challenge, index, parallel_read)
proof_spent_time = round(monotonic() * 1000) - proof_start_time
if proof_spent_time > 15000:
log.warning(
f"\tFinding proof took: {proof_spent_time} ms. This should be below 15 seconds "
f"to minimize risk of losing rewards. Filepath: {plot_path}"
)
else:
log.info(f"\tFinding proof took: {proof_spent_time} ms. Filepath: {plot_path}")

ver_quality_str = v.validate_proof(pr.get_id(), pr.get_size().size_v1, challenge, proof)
if quality_str == ver_quality_str:
total_proofs += 1
else:
log.warning(
f"\tQuality doesn't match with proof. Filepath: {plot_path} "
"This can occasionally happen with a compressed plot."
)
except AssertionError as e:
log.error(
f"{type(e)}: {e} error in proving/verifying for plot {plot_path}. Filepath: {plot_path}"
)
caught_exception = True
if caught_exception is True:
break

Expand Down
Loading