14
14
from dataclasses import dataclass , replace
15
15
from pathlib import Path
16
16
from random import Random
17
- from typing import Any , Callable , Optional
17
+ from typing import Any , Callable , Optional , Union
18
18
19
19
import anyio
20
20
from chia_puzzles_py .programs import CHIALISP_DESERIALISATION , ROM_BOOTSTRAP_GENERATOR
64
64
from chia .full_node .bundle_tools import simple_solution_generator , simple_solution_generator_backrefs
65
65
from chia .plotting .create_plots import PlotKeys , create_plots
66
66
from chia .plotting .manager import PlotManager
67
+ from chia .plotting .prover import PlotVersion
67
68
from chia .plotting .util import (
68
69
Params ,
69
70
PlotRefreshEvents ,
91
92
from chia .types .blockchain_format .proof_of_space import (
92
93
calculate_pos_challenge ,
93
94
calculate_prefix_bits ,
95
+ calculate_required_plot_strength ,
94
96
generate_plot_public_key ,
95
97
generate_taproot_sk ,
96
98
make_pos ,
97
99
passes_plot_filter ,
100
+ quality_for_partial_proof ,
101
+ solve_proof ,
98
102
)
99
103
from chia .types .blockchain_format .serialized_program import SerializedProgram
100
104
from chia .types .blockchain_format .vdf import VDFInfo , VDFProof
@@ -1501,6 +1505,8 @@ def get_pospaces_for_challenge(
1501
1505
rng = random .Random ()
1502
1506
rng .seed (seed )
1503
1507
1508
+ required_plot_strength = calculate_required_plot_strength (constants , prev_transaction_b_height )
1509
+
1504
1510
for plot_info in self .plot_manager .plots .values ():
1505
1511
plot_id : bytes32 = plot_info .prover .get_id ()
1506
1512
if force_plot_id is not None and plot_id != force_plot_id :
@@ -1509,10 +1515,29 @@ def get_pospaces_for_challenge(
1509
1515
if not passes_plot_filter (prefix_bits , plot_id , challenge_hash , signage_point ):
1510
1516
continue
1511
1517
1518
+ # v2 plots aren't valid until after the hard fork
1519
+ if (
1520
+ prev_transaction_b_height < constants .HARD_FORK2_HEIGHT
1521
+ and plot_info .prover .get_version () == PlotVersion .V2
1522
+ ):
1523
+ continue
1524
+
1512
1525
new_challenge : bytes32 = calculate_pos_challenge (plot_id , challenge_hash , signage_point )
1513
- qualities = plot_info .prover .get_qualities_for_challenge (new_challenge )
1514
1526
1515
- for proof_index , quality_str in enumerate (qualities ):
1527
+ # these are either qualities (v1) or partial proofs (v2)
1528
+ proofs : Sequence [Union [bytes32 , bytes ]]
1529
+ v = plot_info .prover .get_version ()
1530
+ if v == PlotVersion .V1 :
1531
+ proofs = plot_info .prover .get_qualities_for_challenge (new_challenge )
1532
+ else :
1533
+ proofs = plot_info .prover .get_partial_proofs_for_challenge (new_challenge , required_plot_strength )
1534
+
1535
+ for proof_index , proof in enumerate (proofs ):
1536
+ if v == PlotVersion .V2 :
1537
+ quality_str = quality_for_partial_proof (proof , new_challenge )
1538
+ elif v == PlotVersion .V1 :
1539
+ quality_str = bytes32 (proof )
1540
+
1516
1541
required_iters = calculate_iterations_quality (
1517
1542
constants ,
1518
1543
quality_str ,
@@ -1525,7 +1550,11 @@ def get_pospaces_for_challenge(
1525
1550
if required_iters >= calculate_sp_interval_iters (constants , sub_slot_iters ):
1526
1551
continue
1527
1552
1528
- proof_xs : bytes = plot_info .prover .get_full_proof (new_challenge , proof_index )
1553
+ proof_xs : bytes
1554
+ if v == PlotVersion .V1 :
1555
+ proof_xs = plot_info .prover .get_full_proof (new_challenge , proof_index )
1556
+ else :
1557
+ proof_xs = solve_proof (proof )
1529
1558
1530
1559
# Look up local_sk from plot to save locked memory
1531
1560
(
0 commit comments