|
14 | 14 | from chia.types.blockchain_format.proof_of_space import (
|
15 | 15 | calculate_plot_difficulty,
|
16 | 16 | calculate_prefix_bits,
|
| 17 | + check_plot_size, |
17 | 18 | passes_plot_filter,
|
18 | 19 | verify_and_get_quality_string,
|
19 | 20 | )
|
@@ -221,6 +222,34 @@ def test_calculate_plot_difficulty(height: uint32, difficulty: uint8) -> None:
|
221 | 222 | assert calculate_plot_difficulty(DEFAULT_CONSTANTS, height) == difficulty
|
222 | 223 |
|
223 | 224 |
|
| 225 | +@pytest.mark.parametrize( |
| 226 | + "size, valid", |
| 227 | + [ |
| 228 | + (PlotSize.make_v1(31), False), # too small |
| 229 | + (PlotSize.make_v1(32), True), |
| 230 | + (PlotSize.make_v1(33), True), |
| 231 | + (PlotSize.make_v1(34), True), |
| 232 | + (PlotSize.make_v1(35), True), |
| 233 | + (PlotSize.make_v1(36), True), |
| 234 | + (PlotSize.make_v1(37), True), |
| 235 | + (PlotSize.make_v1(49), True), |
| 236 | + (PlotSize.make_v1(50), True), |
| 237 | + (PlotSize.make_v1(51), False), # too large |
| 238 | + (PlotSize.make_v2(26), False), # too small |
| 239 | + (PlotSize.make_v2(27), False), # too small (and odd) |
| 240 | + (PlotSize.make_v2(28), True), |
| 241 | + (PlotSize.make_v2(29), False), # odd |
| 242 | + (PlotSize.make_v2(30), True), |
| 243 | + (PlotSize.make_v2(31), False), # odd |
| 244 | + (PlotSize.make_v2(32), True), |
| 245 | + (PlotSize.make_v2(33), False), # too large (and odd) |
| 246 | + (PlotSize.make_v2(34), False), # too large |
| 247 | + ], |
| 248 | +) |
| 249 | +def test_check_plot_size(size: PlotSize, valid: bool) -> None: |
| 250 | + assert check_plot_size(DEFAULT_CONSTANTS, size) == valid |
| 251 | + |
| 252 | + |
224 | 253 | class TestProofOfSpace:
|
225 | 254 | @pytest.mark.parametrize("prefix_bits", [DEFAULT_CONSTANTS.NUMBER_ZERO_BITS_PLOT_FILTER_V1, 8, 7, 6, 5, 1, 0])
|
226 | 255 | def test_can_create_proof(self, prefix_bits: int, seeded_random: random.Random) -> None:
|
|
0 commit comments