-
Notifications
You must be signed in to change notification settings - Fork 2.1k
pass along plot format version from ProverProtocol
into ProofOfSpace
#19930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
622b772
to
fe41662
Compare
1575403
to
3284a57
Compare
most of the missing coverage also have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aok
there was a merge conflict and I had to rebase. The conflict was in the This is the diff of the diff: --- original.diff 2025-08-14 06:58:06
+++ new.diff 2025-08-14 06:59:15
@@ -1,10 +1,3 @@
-diff --git a/chia-blockchain-gui b/chia-blockchain-gui
-index 1c6fb425c5..5d57f5dc60 160000
---- a/chia-blockchain-gui
-+++ b/chia-blockchain-gui
-@@ -1 +1 @@
--Subproject commit 1c6fb425c5b5f03e7c10cd11d0ff6003866a6e0c
-+Subproject commit 5d57f5dc60945dda2c94dcbde1ec80fb2d59c2d7
diff --git a/chia/_tests/core/consensus/test_pot_iterations.py b/chia/_tests/core/consensus/test_pot_iterations.py
index 2d2ddaeba1..187213263b 100644
--- a/chia/_tests/core/consensus/test_pot_iterations.py
@@ -60,7 +53,7 @@
+ assert plot_size > last_size
+ last_size = plot_size
diff --git a/chia/_tests/core/custom_types/test_proof_of_space.py b/chia/_tests/core/custom_types/test_proof_of_space.py
-index ed8520f360..d51b194654 100644
+index 8d99a94254..8f78fb9a93 100644
--- a/chia/_tests/core/custom_types/test_proof_of_space.py
+++ b/chia/_tests/core/custom_types/test_proof_of_space.py
@@ -5,7 +5,7 @@ from dataclasses import dataclass
@@ -72,15 +65,15 @@
from chia_rs.sized_bytes import bytes32, bytes48
from chia_rs.sized_ints import uint8, uint32
-@@ -14,6 +14,7 @@ from chia.consensus.default_constants import DEFAULT_CONSTANTS
- from chia.types.blockchain_format.proof_of_space import (
+@@ -15,6 +15,7 @@ from chia.types.blockchain_format.proof_of_space import (
calculate_plot_difficulty,
calculate_prefix_bits,
+ check_plot_size,
+ make_pos,
passes_plot_filter,
verify_and_get_quality_string,
)
-@@ -23,7 +24,7 @@ from chia.types.blockchain_format.proof_of_space import (
+@@ -24,7 +25,7 @@ from chia.types.blockchain_format.proof_of_space import (
class ProofOfSpaceCase:
id: str
pos_challenge: bytes32
@@ -89,7 +82,7 @@
plot_public_key: G1Element
pool_public_key: Optional[G1Element] = None
pool_contract_puzzle_hash: Optional[bytes32] = None
-@@ -45,14 +46,14 @@ def b32(key: str) -> bytes32:
+@@ -46,14 +47,14 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="Neither pool public key nor pool contract puzzle hash",
pos_challenge=bytes32(b"1" * 32),
@@ -106,7 +99,7 @@
plot_public_key=G1Element(),
pool_public_key=G1Element(),
pool_contract_puzzle_hash=bytes32(b"1" * 32),
-@@ -61,7 +62,7 @@ def b32(key: str) -> bytes32:
+@@ -62,7 +63,7 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="Lower than minimum plot size",
pos_challenge=bytes32(b"1" * 32),
@@ -115,7 +108,7 @@
plot_public_key=G1Element(),
pool_public_key=G1Element(),
expected_error="Plot size is lower than the minimum",
-@@ -69,7 +70,7 @@ def b32(key: str) -> bytes32:
+@@ -70,7 +71,7 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="Higher than maximum plot size",
pos_challenge=bytes32(b"1" * 32),
@@ -124,7 +117,7 @@
plot_public_key=G1Element(),
pool_public_key=G1Element(),
expected_error="Plot size is higher than the maximum",
-@@ -77,7 +78,7 @@ def b32(key: str) -> bytes32:
+@@ -78,7 +79,7 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="Different challenge",
pos_challenge=bytes32(b"1" * 32),
@@ -133,7 +126,7 @@
pool_public_key=G1Element(),
plot_public_key=G1Element(),
expected_error="Calculated pos challenge doesn't match the provided one",
-@@ -85,7 +86,7 @@ def b32(key: str) -> bytes32:
+@@ -86,7 +87,7 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="Not passing the plot filter with size 9",
pos_challenge=b32("08b23cc2844dfb92d2eedaa705a1ce665d571ee753bd81cbb67b92caa6d34722"),
@@ -142,7 +135,7 @@
pool_public_key=g1(
"b6449c2c68df97c19e884427e42ee7350982d4020571ead08732615ff39bd216bfd630b6460784982bec98b49fea79d0"
),
-@@ -98,7 +99,7 @@ def b32(key: str) -> bytes32:
+@@ -99,7 +100,7 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="Passing the plot filter with size 8",
pos_challenge=b32("08b23cc2844dfb92d2eedaa705a1ce665d571ee753bd81cbb67b92caa6d34722"),
@@ -151,7 +144,7 @@
pool_public_key=g1(
"b6449c2c68df97c19e884427e42ee7350982d4020571ead08732615ff39bd216bfd630b6460784982bec98b49fea79d0"
),
-@@ -110,7 +111,7 @@ def b32(key: str) -> bytes32:
+@@ -111,7 +112,7 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="v2 plot size 0",
pos_challenge=bytes32(b"1" * 32),
@@ -160,7 +153,7 @@
plot_public_key=G1Element(),
pool_public_key=G1Element(),
expected_error="Plot size is lower than the minimum",
-@@ -118,7 +119,7 @@ def b32(key: str) -> bytes32:
+@@ -119,7 +120,7 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="v2 plot size 34",
pos_challenge=bytes32(b"1" * 32),
@@ -169,7 +162,7 @@
plot_public_key=G1Element(),
pool_public_key=G1Element(),
expected_error="Plot size is higher than the maximum",
-@@ -126,7 +127,7 @@ def b32(key: str) -> bytes32:
+@@ -127,7 +128,7 @@ def b32(key: str) -> bytes32:
ProofOfSpaceCase(
id="Not passing the plot filter v2",
pos_challenge=b32("3d29ea79d19b3f7e99ebf764ae53697cbe143603909873946af6ab1ece606861"),
@@ -178,7 +171,7 @@
pool_public_key=g1(
"b6449c2c68df97c19e884427e42ee7350982d4020571ead08732615ff39bd216bfd630b6460784982bec98b49fea79d0"
),
-@@ -137,7 +138,7 @@ def b32(key: str) -> bytes32:
+@@ -138,7 +139,7 @@ def b32(key: str) -> bytes32:
),
)
def test_verify_and_get_quality_string(caplog: pytest.LogCaptureFixture, case: ProofOfSpaceCase) -> None:
@@ -187,7 +180,7 @@
challenge=case.pos_challenge,
pool_public_key=case.pool_public_key,
pool_contract_puzzle_hash=case.pool_contract_puzzle_hash,
-@@ -159,7 +160,7 @@ def test_verify_and_get_quality_string(caplog: pytest.LogCaptureFixture, case: P
+@@ -160,7 +161,7 @@ def test_verify_and_get_quality_string(caplog: pytest.LogCaptureFixture, case: P
@datacases(
ProofOfSpaceCase(
id="v2 plot are not implemented",
@@ -196,7 +189,7 @@
pos_challenge=b32("47deb938e145d25d7b3b3c85ca9e3972b76c01aeeb78a02fe5d3b040d282317e"),
plot_public_key=g1(
"afa3aaf09c03885154be49216ee7fb2e4581b9c4a4d7e9cc402e27280bf0cfdbdf1b9ba674e301fd1d1450234b3b1868"
-@@ -171,7 +172,7 @@ def test_verify_and_get_quality_string(caplog: pytest.LogCaptureFixture, case: P
+@@ -172,7 +173,7 @@ def test_verify_and_get_quality_string(caplog: pytest.LogCaptureFixture, case: P
),
)
def test_verify_and_get_quality_string_v2(caplog: pytest.LogCaptureFixture, case: ProofOfSpaceCase) -> None:
@@ -341,10 +334,10 @@
assert plot_sync_dict_3["last_sync_time"] > 0
assert plot_sync_dict_3["syncing"] is None
diff --git a/chia/_tests/plotting/test_plot_manager.py b/chia/_tests/plotting/test_plot_manager.py
-index 3108da7569..1dd5e10b9a 100644
+index 15ea5c2e38..d326da25e4 100644
--- a/chia/_tests/plotting/test_plot_manager.py
+++ b/chia/_tests/plotting/test_plot_manager.py
-@@ -509,7 +509,8 @@ async def test_plot_info_caching(environment, bt):
+@@ -508,7 +508,8 @@ async def test_plot_info_caching(environment, bt):
assert plot_manager.plots[path].prover.get_filename() == plot_info.prover.get_filename()
assert plot_manager.plots[path].prover.get_id() == plot_info.prover.get_id()
assert plot_manager.plots[path].prover.get_memo() == plot_info.prover.get_memo()
@@ -632,7 +625,7 @@
log.info(f"Parsed {len(self._data)} cache entries in {time.time() - start:.2f}s")
diff --git a/chia/plotting/check_plots.py b/chia/plotting/check_plots.py
-index 0fe7c2567f..75165c4c4e 100644
+index f4d2a7ab61..9bbe427351 100644
--- a/chia/plotting/check_plots.py
+++ b/chia/plotting/check_plots.py
@@ -133,14 +133,16 @@ def check_plots(
@@ -768,7 +761,7 @@
def get_memo(self) -> bytes:
return bytes(self._disk_prover.get_memo())
diff --git a/chia/simulator/block_tools.py b/chia/simulator/block_tools.py
-index e51143c08e..323cc25bf4 100644
+index 79678a4924..500fc69a58 100644
--- a/chia/simulator/block_tools.py
+++ b/chia/simulator/block_tools.py
@@ -28,7 +28,6 @@ from chia_rs import (
@@ -787,7 +780,7 @@
passes_plot_filter,
)
from chia.types.blockchain_format.serialized_program import SerializedProgram
-@@ -1506,8 +1506,7 @@ class BlockTools:
+@@ -1504,8 +1504,7 @@ class BlockTools:
plot_id: bytes32 = plot_info.prover.get_id()
if force_plot_id is not None and plot_id != force_plot_id:
continue
@@ -797,7 +790,7 @@
if passes_plot_filter(prefix_bits, plot_id, challenge_hash, signage_point):
new_challenge: bytes32 = calculate_pos_challenge(plot_id, challenge_hash, signage_point)
qualities = plot_info.prover.get_qualities_for_challenge(new_challenge)
-@@ -1516,8 +1515,7 @@ class BlockTools:
+@@ -1514,8 +1513,7 @@ class BlockTools:
required_iters = calculate_iterations_quality(
constants,
quality_str,
@@ -807,7 +800,7 @@
difficulty,
signage_point,
sub_slot_iters,
-@@ -1540,7 +1538,7 @@ class BlockTools:
+@@ -1538,7 +1536,7 @@ class BlockTools:
assert isinstance(pool_public_key_or_puzzle_hash, bytes32)
include_taproot = True
plot_pk = generate_plot_public_key(local_sk.get_g1(), farmer_public_key, include_taproot)
@@ -817,7 +810,7 @@
plot_info.pool_public_key,
plot_info.pool_contract_puzzle_hash,
diff --git a/chia/types/blockchain_format/proof_of_space.py b/chia/types/blockchain_format/proof_of_space.py
-index 3befb30fc6..47962d699b 100644
+index 6512177290..1b574d13f3 100644
--- a/chia/types/blockchain_format/proof_of_space.py
+++ b/chia/types/blockchain_format/proof_of_space.py
@@ -14,6 +14,33 @@ from chia.util.hash import std_hash |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aok
Purpose:
Prover
protocol to makeget_size()
returnPlotSize
. This allows to seamlessly pass it tocalculate_prefix_bits()
andcalculate_iterations_quality()
ProofOfSpace
is part of the protocol and can't change, but this PR adds a function,make_pos()
which makes it a bit simpler to construct aProofOfSpace
object from aPlotSize
.chia/_tests/util/test_full_block_utils.py
to cover blocks with v2 proofs_expected_plot_size()
todo_v2_plots
comments, to indicate they need to be addressed for v2 plots.