Skip to content

Commit 85e935e

Browse files
authored
BlockTools issue (#20185)
fix issue in BlockTools where transaction_generator was (incorrectly) used as a proxy for whether the block was a TX block or not. Also improve error messages for plot sizes as well as the minimum plot size for v2 plots on testnet (which also affects our simulations in CI)
1 parent 3a549ad commit 85e935e

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

chia/_tests/core/custom_types/test_proof_of_space.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ def b32(key: str) -> bytes32:
6666
plot_size=PlotSize.make_v1(31),
6767
plot_public_key=G1Element(),
6868
pool_public_key=G1Element(),
69-
expected_error="Plot size is lower than the minimum",
69+
expected_error="Plot size (31) is lower than the minimum (32)",
7070
),
7171
ProofOfSpaceCase(
7272
id="Higher than maximum plot size",
7373
pos_challenge=bytes32(b"1" * 32),
7474
plot_size=PlotSize.make_v1(51),
7575
plot_public_key=G1Element(),
7676
pool_public_key=G1Element(),
77-
expected_error="Plot size is higher than the maximum",
77+
expected_error="Plot size (51) is higher than the maximum (50)",
7878
),
7979
ProofOfSpaceCase(
8080
id="Different challenge",
@@ -115,15 +115,15 @@ def b32(key: str) -> bytes32:
115115
plot_size=PlotSize.make_v2(0),
116116
plot_public_key=G1Element(),
117117
pool_public_key=G1Element(),
118-
expected_error="Plot size is lower than the minimum",
118+
expected_error="Plot size (0) is lower than the minimum (28)",
119119
),
120120
ProofOfSpaceCase(
121121
id="v2 plot size 34",
122122
pos_challenge=bytes32(b"1" * 32),
123123
plot_size=PlotSize.make_v2(34),
124124
plot_public_key=G1Element(),
125125
pool_public_key=G1Element(),
126-
expected_error="Plot size is higher than the maximum",
126+
expected_error="Plot size (34) is higher than the maximum (32)",
127127
),
128128
ProofOfSpaceCase(
129129
id="Not passing the plot filter v2",

chia/simulator/block_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ def get_consecutive_blocks(
980980
available_coins.remove(rem)
981981
available_coins.extend(new_gen.additions)
982982

983-
if full_block.transactions_generator is not None:
983+
if full_block.is_transaction_block():
984984
tx_block_heights.append(full_block.height)
985985
prev_tx_height = full_block.height
986986

@@ -1274,7 +1274,7 @@ def get_consecutive_blocks(
12741274
available_coins.remove(rem)
12751275
available_coins.extend(new_gen.additions)
12761276

1277-
if full_block.transactions_generator is not None:
1277+
if full_block.is_transaction_block():
12781278
tx_block_heights.append(full_block.height)
12791279
prev_tx_height = full_block.height
12801280

chia/types/blockchain_format/proof_of_space.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ def check_plot_size(constants: ConsensusConstants, ps: PlotSize) -> bool:
7676
if size_v1 is not None:
7777
assert ps.size_v2 is None
7878
if size_v1 < constants.MIN_PLOT_SIZE_V1:
79-
log.error("Plot size is lower than the minimum")
79+
log.error(f"Plot size ({size_v1}) is lower than the minimum ({constants.MIN_PLOT_SIZE_V1})")
8080
return False
8181
if size_v1 > constants.MAX_PLOT_SIZE_V1:
82-
log.error("Plot size is higher than the maximum")
82+
log.error(f"Plot size ({size_v1}) is higher than the maximum ({constants.MAX_PLOT_SIZE_V1})")
8383
return False
8484
return True
8585

8686
size_v2 = ps.size_v2
8787
assert size_v2 is not None
8888
if size_v2 < constants.MIN_PLOT_SIZE_V2:
89-
log.error("Plot size is lower than the minimum")
89+
log.error(f"Plot size ({size_v2}) is lower than the minimum ({constants.MIN_PLOT_SIZE_V2})")
9090
return False
9191
if size_v2 > constants.MAX_PLOT_SIZE_V2:
92-
log.error("Plot size is higher than the maximum")
92+
log.error(f"Plot size ({size_v2}) is higher than the maximum ({constants.MAX_PLOT_SIZE_V2})")
9393
return False
9494
if (size_v2 & 1) == 1:
9595
log.error("Plot size is odd")

chia/util/initial-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ network_overrides: &network_overrides
2020
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af"
2121
testnet0:
2222
MIN_PLOT_SIZE_V1: 18
23-
MIN_PLOT_SIZE_V2: 20
23+
MIN_PLOT_SIZE_V2: 18
2424
GENESIS_CHALLENGE: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
2525
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc"
2626
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af"
@@ -34,7 +34,7 @@ network_overrides: &network_overrides
3434
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: 3ef7c233fc0785f3c0cae5992c1d35e7c955ca37a423571c1607ba392a9d12f7
3535
MEMPOOL_BLOCK_BUFFER: 10
3636
MIN_PLOT_SIZE_V1: 18
37-
MIN_PLOT_SIZE_V2: 20
37+
MIN_PLOT_SIZE_V2: 18
3838
NETWORK_TYPE: 1
3939
SUB_SLOT_ITERS_STARTING: 67108864
4040
# Forks activated from the beginning on this network
@@ -52,7 +52,7 @@ network_overrides: &network_overrides
5252
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: 08296fc227decd043aee855741444538e4cc9a31772c4d1a9e6242d1e777e42a
5353
MEMPOOL_BLOCK_BUFFER: 10
5454
MIN_PLOT_SIZE_V1: 18
55-
MIN_PLOT_SIZE_V2: 20
55+
MIN_PLOT_SIZE_V2: 18
5656
NETWORK_TYPE: 1
5757
SUB_SLOT_ITERS_STARTING: 67108864
5858
HARD_FORK_HEIGHT: 3693395

0 commit comments

Comments
 (0)