@@ -43,7 +43,7 @@ def b32(key: str) -> bytes32:
4343 return bytes32 .from_hexstr (key )
4444
4545
46- # TODO: todo_v2_plots more test cases
46+ # TODO: todo_v2_plots more test cases, cover plot_index and group_id
4747@datacases (
4848 ProofOfSpaceCase (
4949 id = "Neither pool public key nor pool contract puzzle hash" ,
@@ -113,23 +113,23 @@ def b32(key: str) -> bytes32:
113113 ProofOfSpaceCase (
114114 id = "v2 plot strength 0" ,
115115 pos_challenge = bytes32 (b"1" * 32 ),
116- plot_size = PlotParam .make_v2 (0 ),
116+ plot_size = PlotParam .make_v2 (0 , 0 , 0 ),
117117 pool_contract_puzzle_hash = bytes32 (b"1" * 32 ),
118118 plot_public_key = G1Element (),
119119 expected_error = "Plot strength (0) is lower than the minimum (2)" ,
120120 ),
121121 ProofOfSpaceCase (
122122 id = "v2 plot strength 33" ,
123123 pos_challenge = bytes32 (b"1" * 32 ),
124- plot_size = PlotParam .make_v2 (33 ),
124+ plot_size = PlotParam .make_v2 (0 , 0 , 33 ),
125125 pool_contract_puzzle_hash = bytes32 (b"1" * 32 ),
126126 plot_public_key = G1Element (),
127127 expected_error = "Plot strength (33) is too high (max is 32)" ,
128128 ),
129129 ProofOfSpaceCase (
130130 id = "Not passing the plot filter v2" ,
131- pos_challenge = b32 ("0cbb408989205e9a94cc012f0d2717e9336795b0853f972965ad0c75c5700ed9 " ),
132- plot_size = PlotParam .make_v2 (32 ),
131+ pos_challenge = b32 ("5862b9d5210b008c0c30e2673e327b4a6c98c34d93dd05c7a253320eb5db1712 " ),
132+ plot_size = PlotParam .make_v2 (0 , 0 , 32 ),
133133 pool_contract_puzzle_hash = bytes32 (b"1" * 32 ),
134134 plot_public_key = g1 (
135135 "879526b4e7b616cfd64984d8ad140d0798b048392a6f11e2faf09054ef467ea44dc0dab5e5edb2afdfa850c5c8b629cc"
@@ -139,7 +139,7 @@ def b32(key: str) -> bytes32:
139139 ProofOfSpaceCase (
140140 id = "v2 not activated" ,
141141 pos_challenge = bytes32 (b"1" * 32 ),
142- plot_size = PlotParam .make_v2 (2 ),
142+ plot_size = PlotParam .make_v2 (0 , 0 , 2 ),
143143 pool_contract_puzzle_hash = bytes32 (b"1" * 32 ),
144144 plot_public_key = G1Element (),
145145 height = uint32 (DEFAULT_CONSTANTS .HARD_FORK2_HEIGHT - 1 ),
@@ -153,13 +153,13 @@ def test_verify_and_get_quality_string(caplog: pytest.LogCaptureFixture, case: P
153153 pool_public_key = case .pool_public_key ,
154154 pool_contract_puzzle_hash = case .pool_contract_puzzle_hash ,
155155 plot_public_key = case .plot_public_key ,
156- version_and_size = case .plot_size ,
156+ params = case .plot_size ,
157157 proof = b"1" ,
158158 )
159159 quality_string = verify_and_get_quality_string (
160160 pos = pos ,
161161 constants = DEFAULT_CONSTANTS ,
162- original_challenge_hash = b32 ("0x73490e166d0b88347c37d921660b216c27316aae9a3450933d3ff3b854e5831a " ),
162+ original_challenge_hash = b32 ("73490e166d0b88347c37d921660b216c27316aae9a3450933d3ff3b854e5831a " ),
163163 signage_point = b32 ("0x7b3e23dbd438f9aceefa9827e2c5538898189987f49b06eceb7a43067e77b531" ),
164164 height = case .height ,
165165 prev_transaction_block_height = case .height ,
@@ -171,8 +171,8 @@ def test_verify_and_get_quality_string(caplog: pytest.LogCaptureFixture, case: P
171171@datacases (
172172 ProofOfSpaceCase (
173173 id = "not passing the plot filter v2" ,
174- plot_size = PlotParam .make_v2 (2 ),
175- pos_challenge = b32 ("389f3f2f67d37a63d81a21d0e96898ff4eaa7007e1507630bea6a2608795a418 " ),
174+ plot_size = PlotParam .make_v2 (0 , 0 , 2 ),
175+ pos_challenge = b32 ("9483df4e178307ae677d86664daaef4fc52689b2b6cd7825351f2a2ad7075adb " ),
176176 plot_public_key = g1 (
177177 "afa3aaf09c03885154be49216ee7fb2e4581b9c4a4d7e9cc402e27280bf0cfdbdf1b9ba674e301fd1d1450234b3b1868"
178178 ),
@@ -187,7 +187,7 @@ def test_verify_and_get_quality_string_v2(caplog: pytest.LogCaptureFixture, case
187187 pool_public_key = case .pool_public_key ,
188188 pool_contract_puzzle_hash = case .pool_contract_puzzle_hash ,
189189 plot_public_key = case .plot_public_key ,
190- version_and_size = case .plot_size ,
190+ params = case .plot_size ,
191191 proof = b"1" ,
192192 )
193193 plot_param = pos .param ()
@@ -197,7 +197,7 @@ def test_verify_and_get_quality_string_v2(caplog: pytest.LogCaptureFixture, case
197197 quality_string = verify_and_get_quality_string (
198198 pos = pos ,
199199 constants = DEFAULT_CONSTANTS ,
200- original_challenge_hash = b32 ("0x73490e166d0b88347c37d921660b216c27316aae9a3450933d3ff3b854e5831a " ),
200+ original_challenge_hash = b32 ("73490e166d0b88347c37d921660b216c27316aae9a3450933d3ff3b854e5831a " ),
201201 signage_point = b32 ("0xf7c1bd874da5e709d4713d60c8a70639eb1167b367a9c3787c65c1e582e2e662" ),
202202 height = case .height ,
203203 prev_transaction_block_height = case .height ,
@@ -223,11 +223,11 @@ def test_verify_and_get_quality_string_v2(caplog: pytest.LogCaptureFixture, case
223223 (PlotParam .make_v1 (49 ), True ),
224224 (PlotParam .make_v1 (50 ), True ),
225225 (PlotParam .make_v1 (51 ), False ), # too large
226- (PlotParam .make_v2 (1 ), False ), # too small
227- (PlotParam .make_v2 (2 ), True ),
228- (PlotParam .make_v2 (3 ), True ),
229- (PlotParam .make_v2 (32 ), True ),
230- (PlotParam .make_v2 (33 ), False ), # strength too high
226+ (PlotParam .make_v2 (0 , 0 , 1 ), False ), # too small
227+ (PlotParam .make_v2 (0 , 0 , 2 ), True ),
228+ (PlotParam .make_v2 (0 , 0 , 3 ), True ),
229+ (PlotParam .make_v2 (0 , 0 , 32 ), True ),
230+ (PlotParam .make_v2 (0 , 0 , 33 ), False ), # strength too high
231231 ],
232232)
233233def test_check_plot_param (plot_param : PlotParam , valid : bool ) -> None :
@@ -290,7 +290,7 @@ def test_calculate_prefix_bits_v1(height: uint32, expected: int) -> None:
290290 ],
291291)
292292def test_calculate_prefix_bits_v2 (height : uint32 , expected : int ) -> None :
293- assert calculate_prefix_bits (DEFAULT_CONSTANTS , height , PlotParam .make_v2 (28 )) == expected
293+ assert calculate_prefix_bits (DEFAULT_CONSTANTS , height , PlotParam .make_v2 (0 , 0 , 28 )) == expected
294294
295295
296296def test_v1_phase_out () -> None :
0 commit comments