8
8
from chia_rs .sized_ints import uint8
9
9
from chiapos import DiskProver
10
10
11
+ from chia .types .blockchain_format .proof_of_space import quality_for_partial_proof
12
+
11
13
if TYPE_CHECKING :
12
14
from chiapos import DiskProver
13
15
@@ -27,8 +29,14 @@ def get_compression_level(self) -> uint8: ...
27
29
def get_version (self ) -> PlotVersion : ...
28
30
def __bytes__ (self ) -> bytes : ...
29
31
def get_id (self ) -> bytes32 : ...
30
- def get_qualities_for_challenge (self , challenge : bytes32 ) -> list [bytes32 ]: ...
31
- def get_full_proof (self , challenge : bytes , index : int , parallel_read : bool = True ) -> bytes : ...
32
+ def get_qualities_for_challenge (self , challenge : bytes32 , plot_strength : uint8 ) -> list [bytes32 ]: ...
33
+
34
+ # this is only supported by v2 plots
35
+ def get_partial_proofs_for_challenge (self , challenge : bytes32 , plot_strength : uint8 ) -> list [bytes ]: ...
36
+
37
+ # this is only supported by v1 plots. v2 plots first get the partial proof
38
+ # and turn it into a full proof by calling solve_proof(), or pass it to the solver service
39
+ def get_full_proof (self , challenge : bytes32 , index : int , parallel_read : bool = True ) -> bytes : ...
32
40
33
41
@classmethod
34
42
def from_bytes (cls , data : bytes ) -> ProverProtocol : ...
@@ -55,8 +63,8 @@ def get_memo(self) -> bytes:
55
63
raise NotImplementedError ("V2 plot format is not yet implemented" )
56
64
57
65
def get_compression_level (self ) -> uint8 :
58
- # TODO: todo_v2_plots implement compression level retrieval
59
- raise NotImplementedError ( "V2 plot format is not yet implemented" )
66
+ # v2 plots do not support compression
67
+ return uint8 ( 0 )
60
68
61
69
def get_version (self ) -> PlotVersion :
62
70
return PlotVersion .V2
@@ -69,13 +77,18 @@ def get_id(self) -> bytes32:
69
77
# TODO: Extract plot ID from V2 plot file
70
78
raise NotImplementedError ("V2 plot format is not yet implemented" )
71
79
72
- def get_qualities_for_challenge (self , challenge : bytes ) -> list [bytes32 ]:
80
+ def get_partial_proofs_for_challenge (self , challenge : bytes , plot_strength : uint8 ) -> list [bytes ]:
73
81
# TODO: todo_v2_plots Implement plot quality lookup
74
82
raise NotImplementedError ("V2 plot format is not yet implemented" )
75
83
76
- def get_full_proof (self , challenge : bytes , index : int , parallel_read : bool = True ) -> bytes :
77
- # TODO: todo_v2_plots Implement plot proof generation
78
- raise NotImplementedError ("V2 plot format is not yet implemented" )
84
+ def get_qualities_for_challenge (self , challenge : bytes32 , plot_strength : uint8 ) -> list [bytes32 ]:
85
+ return [
86
+ quality_for_partial_proof (partial , challenge )
87
+ for partial in self .get_partial_proofs_for_challenge (challenge , plot_strength )
88
+ ]
89
+
90
+ def get_full_proof (self , challenge : bytes32 , index : int , parallel_read : bool = True ) -> bytes :
91
+ raise AssertionError ("V2 plots don't have full proofs" )
79
92
80
93
@classmethod
81
94
def from_bytes (cls , data : bytes ) -> V2Prover :
@@ -113,10 +126,13 @@ def __bytes__(self) -> bytes:
113
126
def get_id (self ) -> bytes32 :
114
127
return bytes32 (self ._disk_prover .get_id ())
115
128
116
- def get_qualities_for_challenge (self , challenge : bytes32 ) -> list [bytes32 ]:
129
+ def get_partial_proofs_for_challenge (self , challenge : bytes32 , plot_strength : uint8 ) -> list [bytes ]:
130
+ raise AssertionError ("V1 plot format doesn't use partial proofs" )
131
+
132
+ def get_qualities_for_challenge (self , challenge : bytes32 , plot_strength : uint8 ) -> list [bytes32 ]:
117
133
return [bytes32 (quality ) for quality in self ._disk_prover .get_qualities_for_challenge (challenge )]
118
134
119
- def get_full_proof (self , challenge : bytes , index : int , parallel_read : bool = True ) -> bytes :
135
+ def get_full_proof (self , challenge : bytes32 , index : int , parallel_read : bool = True ) -> bytes :
120
136
return bytes (self ._disk_prover .get_full_proof (challenge , index , parallel_read ))
121
137
122
138
@classmethod
0 commit comments