diff --git a/validator/weight_setting/deduplication.py b/validator/weight_setting/deduplication.py index 8623897b..5486f968 100644 --- a/validator/weight_setting/deduplication.py +++ b/validator/weight_setting/deduplication.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +from collections.abc import Iterator from imagehash import ImageHash @@ -12,7 +13,7 @@ class PotentiallyDuplicateSubmissionInfo: block: int -def find_duplicates(benchmark_info: list[PotentiallyDuplicateSubmissionInfo | None]): +def find_duplicates(benchmark_info: list[PotentiallyDuplicateSubmissionInfo | None]) -> Iterator[tuple[int, int]]: duplicate_buckets: list[set[int]] = [] for uid_a, benchmark_a in enumerate(benchmark_info): @@ -43,4 +44,4 @@ def find_duplicates(benchmark_info: list[PotentiallyDuplicateSubmissionInfo | No for uid in bucket: if uid != oldest: - yield uid + yield uid, oldest diff --git a/validator/weight_setting/validator.py b/validator/weight_setting/validator.py index 09126c1a..d4c4411b 100644 --- a/validator/weight_setting/validator.py +++ b/validator/weight_setting/validator.py @@ -846,9 +846,9 @@ async def do_step(self, block: int): for uid, benchmark in enumerate(self.benchmarks) ] - for duplicate_uid in find_duplicates(benchmark_duplicate_info): + for duplicate_uid, original_uid in find_duplicates(benchmark_duplicate_info): self.benchmarks[duplicate_uid] = None - self.invalid[duplicate_uid] = "Duplicate submission" + self.invalid[duplicate_uid] = f"Duplicate submission of UID '{original_uid}'" self.benchmarking = False self.step += 1