Skip to content

Commit 6aef294

Browse files
committed
format
1 parent 8c4f578 commit 6aef294

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

chia/plotting/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class CacheEntry:
5555

5656
@classmethod
5757
def from_prover(cls, prover: ProverProtocol) -> CacheEntry:
58-
"""Create CacheEntry from any prover implementation"""
58+
"""Create CacheEntry from prover"""
5959
(
6060
pool_public_key_or_puzzle_hash,
6161
farmer_public_key,

chia/plotting/prover.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,33 @@
1313

1414

1515
class ProverProtocol(ABC):
16-
"""Abstract protocol for all prover implementations (V1 and V2)"""
17-
1816
@abstractmethod
1917
def get_filename(self) -> Path:
20-
"""Returns the filename of the plot"""
18+
"""Returns the filename for the plot"""
2119

2220
@abstractmethod
2321
def get_filename_str(self) -> str:
24-
"""Returns the filename of the plot"""
22+
"""Returns the filename string for the plot"""
2523

2624
@abstractmethod
2725
def get_size(self) -> uint8:
2826
"""Returns the k size of the plot"""
2927

3028
@abstractmethod
3129
def get_memo(self) -> bytes:
32-
"""Returns the memo containing keys and other metadata"""
30+
"""Returns the memo"""
3331

3432
@abstractmethod
3533
def get_compression_level(self) -> uint8:
36-
"""Returns the compression level (0 for uncompressed)"""
34+
"""Returns the compression level"""
3735

3836
@abstractmethod
3937
def get_version(self) -> int:
40-
"""Returns the plot version (1 for V1, 2 for V2)"""
38+
"""Returns the plot version"""
4139

4240
@abstractmethod
4341
def __bytes__(self) -> bytes:
44-
"""Returns the prover serialized as bytes for caching"""
42+
"""Returns the prover bytes"""
4543

4644
@abstractmethod
4745
def get_id(self) -> bytes32:
@@ -62,11 +60,11 @@ def from_bytes(cls, data: bytes) -> ProverProtocol:
6260

6361

6462
class V2Prover(ProverProtocol):
65-
"""V2 Plot Prover implementation - currently stubbed"""
63+
"""V2 Plot Prover stubb"""
6664

6765
def __init__(self, filename: str):
6866
self._filename = filename
69-
# TODO: Implement V2 plot file parsing and validation
67+
# TODO: todo_v2_plots Implement plot file parsing and validation
7068

7169
def get_filename(self) -> Path:
7270
return Path(self._filename)
@@ -75,11 +73,11 @@ def get_filename_str(self) -> str:
7573
return str(self._filename)
7674

7775
def get_size(self) -> uint8:
78-
# TODO: Extract k size from V2 plot file
76+
# TODO: todo_v2_plots get k size from plot
7977
return uint8(32) # Stub value
8078

8179
def get_memo(self) -> bytes:
82-
# TODO: Extract memo from V2 plot file
80+
# TODO: todo_v2_plots
8381
return b"" # Stub value
8482

8583
def get_compression_level(self) -> uint8:
@@ -90,7 +88,7 @@ def get_version(self) -> int:
9088
return 2
9189

9290
def __bytes__(self) -> bytes:
93-
# TODO: Implement proper V2 prover serialization for caching
91+
# TODO: todo_v2_plots Implement prover serialization for caching
9492
# For now, just serialize the filename as a placeholder
9593
return self._filename.encode("utf-8")
9694

@@ -99,17 +97,15 @@ def get_id(self) -> bytes32:
9997
return bytes32(b"") # Stub value
10098

10199
def get_qualities_for_challenge(self, challenge: bytes) -> list[bytes32]:
102-
# TODO: Implement V2 plot quality lookup
100+
# TODO: todo_v2_plots Implement plot quality lookup
103101
return [] # Stub value
104102

105103
def get_full_proof(self, challenge: bytes, index: int, parallel_read: bool = True) -> bytes:
106-
# TODO: Implement V2 plot proof generation
107-
return b"" # Stub value
104+
# TODO: todo_v2_plots Implement plot proof generation
105+
return b""
108106

109107
@classmethod
110108
def from_bytes(cls, data: bytes) -> V2Prover:
111-
# TODO: Implement proper V2 prover deserialization from cache
112-
# For now, just deserialize the filename
113109
filename = data.decode("utf-8")
114110
return cls(filename)
115111

@@ -152,20 +148,17 @@ def get_full_proof(self, challenge: bytes, index: int, parallel_read: bool = Tru
152148

153149
@classmethod
154150
def from_bytes(cls, data: bytes) -> V1Prover:
155-
"""Create V1ProverWrapper from serialized bytes"""
156151
from chiapos import DiskProver
157152

158153
disk_prover = DiskProver.from_bytes(data)
159154
return cls(disk_prover)
160155

161156
@property
162157
def disk_prover(self) -> DiskProver:
163-
"""Access to underlying DiskProver for backwards compatibility"""
164158
return self._disk_prover
165159

166160

167161
def get_prover_from_bytes(filename: str, prover_data: bytes) -> ProverProtocol:
168-
"""Factory function to create appropriate prover based on plot version"""
169162
if filename.endswith(".plot_v2"):
170163
return V2Prover.from_bytes(prover_data)
171164
elif filename.endswith(".plot"):
@@ -175,7 +168,6 @@ def get_prover_from_bytes(filename: str, prover_data: bytes) -> ProverProtocol:
175168

176169

177170
def get_prover_from_file(filename: str) -> ProverProtocol:
178-
"""Factory function to create appropriate prover based on plot version"""
179171
if filename.endswith(".plot_v2"):
180172
return V2Prover(filename)
181173
elif filename.endswith(".plot"):

0 commit comments

Comments
 (0)