13
13
14
14
15
15
class ProverProtocol (ABC ):
16
- """Abstract protocol for all prover implementations (V1 and V2)"""
17
-
18
16
@abstractmethod
19
17
def get_filename (self ) -> Path :
20
- """Returns the filename of the plot"""
18
+ """Returns the filename for the plot"""
21
19
22
20
@abstractmethod
23
21
def get_filename_str (self ) -> str :
24
- """Returns the filename of the plot"""
22
+ """Returns the filename string for the plot"""
25
23
26
24
@abstractmethod
27
25
def get_size (self ) -> uint8 :
28
26
"""Returns the k size of the plot"""
29
27
30
28
@abstractmethod
31
29
def get_memo (self ) -> bytes :
32
- """Returns the memo containing keys and other metadata """
30
+ """Returns the memo"""
33
31
34
32
@abstractmethod
35
33
def get_compression_level (self ) -> uint8 :
36
- """Returns the compression level (0 for uncompressed) """
34
+ """Returns the compression level"""
37
35
38
36
@abstractmethod
39
37
def get_version (self ) -> int :
40
- """Returns the plot version (1 for V1, 2 for V2) """
38
+ """Returns the plot version"""
41
39
42
40
@abstractmethod
43
41
def __bytes__ (self ) -> bytes :
44
- """Returns the prover serialized as bytes for caching """
42
+ """Returns the prover bytes"""
45
43
46
44
@abstractmethod
47
45
def get_id (self ) -> bytes32 :
@@ -62,11 +60,11 @@ def from_bytes(cls, data: bytes) -> ProverProtocol:
62
60
63
61
64
62
class V2Prover (ProverProtocol ):
65
- """V2 Plot Prover implementation - currently stubbed """
63
+ """V2 Plot Prover stubb """
66
64
67
65
def __init__ (self , filename : str ):
68
66
self ._filename = filename
69
- # TODO: Implement V2 plot file parsing and validation
67
+ # TODO: todo_v2_plots Implement plot file parsing and validation
70
68
71
69
def get_filename (self ) -> Path :
72
70
return Path (self ._filename )
@@ -75,11 +73,11 @@ def get_filename_str(self) -> str:
75
73
return str (self ._filename )
76
74
77
75
def get_size (self ) -> uint8 :
78
- # TODO: Extract k size from V2 plot file
76
+ # TODO: todo_v2_plots get k size from plot
79
77
return uint8 (32 ) # Stub value
80
78
81
79
def get_memo (self ) -> bytes :
82
- # TODO: Extract memo from V2 plot file
80
+ # TODO: todo_v2_plots
83
81
return b"" # Stub value
84
82
85
83
def get_compression_level (self ) -> uint8 :
@@ -90,7 +88,7 @@ def get_version(self) -> int:
90
88
return 2
91
89
92
90
def __bytes__ (self ) -> bytes :
93
- # TODO: Implement proper V2 prover serialization for caching
91
+ # TODO: todo_v2_plots Implement prover serialization for caching
94
92
# For now, just serialize the filename as a placeholder
95
93
return self ._filename .encode ("utf-8" )
96
94
@@ -99,17 +97,15 @@ def get_id(self) -> bytes32:
99
97
return bytes32 (b"" ) # Stub value
100
98
101
99
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
103
101
return [] # Stub value
104
102
105
103
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""
108
106
109
107
@classmethod
110
108
def from_bytes (cls , data : bytes ) -> V2Prover :
111
- # TODO: Implement proper V2 prover deserialization from cache
112
- # For now, just deserialize the filename
113
109
filename = data .decode ("utf-8" )
114
110
return cls (filename )
115
111
@@ -152,20 +148,17 @@ def get_full_proof(self, challenge: bytes, index: int, parallel_read: bool = Tru
152
148
153
149
@classmethod
154
150
def from_bytes (cls , data : bytes ) -> V1Prover :
155
- """Create V1ProverWrapper from serialized bytes"""
156
151
from chiapos import DiskProver
157
152
158
153
disk_prover = DiskProver .from_bytes (data )
159
154
return cls (disk_prover )
160
155
161
156
@property
162
157
def disk_prover (self ) -> DiskProver :
163
- """Access to underlying DiskProver for backwards compatibility"""
164
158
return self ._disk_prover
165
159
166
160
167
161
def get_prover_from_bytes (filename : str , prover_data : bytes ) -> ProverProtocol :
168
- """Factory function to create appropriate prover based on plot version"""
169
162
if filename .endswith (".plot_v2" ):
170
163
return V2Prover .from_bytes (prover_data )
171
164
elif filename .endswith (".plot" ):
@@ -175,7 +168,6 @@ def get_prover_from_bytes(filename: str, prover_data: bytes) -> ProverProtocol:
175
168
176
169
177
170
def get_prover_from_file (filename : str ) -> ProverProtocol :
178
- """Factory function to create appropriate prover based on plot version"""
179
171
if filename .endswith (".plot_v2" ):
180
172
return V2Prover (filename )
181
173
elif filename .endswith (".plot" ):
0 commit comments