Skip to content

Commit e10d9ae

Browse files
authored
bump chia_rs dependency to 0.40.0 (#20666)
1 parent 9584ec5 commit e10d9ae

File tree

14 files changed

+85
-49
lines changed

14 files changed

+85
-49
lines changed

.github/workflows/benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
python-version: ["3.12"]
6060
env:
6161
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet
62-
BLOCKS_AND_PLOTS_VERSION: 0.45.6
62+
BLOCKS_AND_PLOTS_VERSION: 0.45.7
6363

6464
steps:
6565
- name: Clean workspace

.github/workflows/test-single.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet
131131
CHIA_SIMULATOR_ROOT: ${{ github.workspace }}/.chia/simulator
132132
JOB_FILE_NAME: tests_${{ matrix.os.file_name }}_python-${{ matrix.python.file_name }}_${{ matrix.configuration.module_import_path }}${{ matrix.configuration.file_name_index }}
133-
BLOCKS_AND_PLOTS_VERSION: 0.45.6
133+
BLOCKS_AND_PLOTS_VERSION: 0.45.7
134134

135135
steps:
136136
- name: Checkout code

chia/_tests/blockchain/test_blockchain.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,7 +2617,7 @@ async def test_invalid_transactions_ref_list(
26172617
# No generator should have no refs list
26182618
block_2 = recursive_replace(block, "transactions_generator_ref_list", [uint32(0)])
26192619

2620-
if consensus_mode < ConsensusMode.HARD_FORK_3_0:
2620+
if consensus_mode < ConsensusMode.SOFT_FORK_2_7:
26212621
expected_error = Err.INVALID_TRANSACTIONS_GENERATOR_REFS_ROOT
26222622
else:
26232623
# after the hard fork activation, we no longer allow block references
@@ -2640,9 +2640,9 @@ async def test_invalid_transactions_ref_list(
26402640
await _validate_and_add_block(b, blocks[-1])
26412641
assert blocks[-1].transactions_generator is not None
26422642

2643-
# after the 3.0 hard fork, we no longer allowe block references, so the
2643+
# after the 3.0 hard fork, we no longer allow block references, so the
26442644
# block_refs parameter is no longer valid, nor this test
2645-
if consensus_mode < ConsensusMode.HARD_FORK_3_0:
2645+
if consensus_mode < ConsensusMode.SOFT_FORK_2_7:
26462646
blocks = bt.get_consecutive_blocks(
26472647
1,
26482648
block_list_input=blocks,
@@ -3359,7 +3359,11 @@ async def test_get_tx_peak_reorg(
33593359
) -> None:
33603360
b = empty_blockchain
33613361

3362-
if consensus_mode not in [ConsensusMode.HARD_FORK_2_0, ConsensusMode.SOFT_FORK_2_6]: # noqa: PLR6201
3362+
if consensus_mode not in {
3363+
ConsensusMode.HARD_FORK_2_0,
3364+
ConsensusMode.SOFT_FORK_2_6,
3365+
ConsensusMode.SOFT_FORK_2_7,
3366+
}:
33633367
reorg_point = 13
33643368
else:
33653369
reorg_point = 12
@@ -3823,8 +3827,8 @@ async def test_overlong_generator_encoding(
38233827
block, "foliage.foliage_transaction_block_hash", std_hash(bytes(block.foliage_transaction_block))
38243828
)
38253829

3826-
# overlong encoding became invalid in the 3.0 hard fork
3827-
if consensus_mode >= ConsensusMode.HARD_FORK_3_0:
3830+
# overlong encoding became invalid in the 2.7 soft fork
3831+
if consensus_mode >= ConsensusMode.SOFT_FORK_2_7:
38283832
expected_error = Err.INVALID_TRANSACTIONS_GENERATOR_ENCODING
38293833
else:
38303834
expected_error = None

chia/_tests/conftest.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,13 @@ class ConsensusMode(ComparableEnum):
211211
HARD_FORK_2_0 = 1
212212
# the soft fork introduced in Chia 2.6
213213
SOFT_FORK_2_6 = 2
214+
# the soft fork introduced in Chia 2.7
215+
SOFT_FORK_2_7 = 3
214216
# the hard fork introduced in Chia 3.0
215-
HARD_FORK_3_0 = 3
217+
HARD_FORK_3_0 = 4
216218
# the hard fork introduced in Chia 3.0 but after v1 plots have been
217219
# phased-out, and no longer valid
218-
HARD_FORK_3_0_AFTER_PHASE_OUT = 4
220+
HARD_FORK_3_0_AFTER_PHASE_OUT = 5
219221

220222

221223
@pytest.fixture(
@@ -224,6 +226,7 @@ class ConsensusMode(ComparableEnum):
224226
ConsensusMode.PLAIN,
225227
ConsensusMode.HARD_FORK_2_0,
226228
ConsensusMode.SOFT_FORK_2_6,
229+
ConsensusMode.SOFT_FORK_2_7,
227230
ConsensusMode.HARD_FORK_3_0,
228231
ConsensusMode.HARD_FORK_3_0_AFTER_PHASE_OUT,
229232
],
@@ -236,14 +239,25 @@ def consensus_mode(request):
236239
def blockchain_constants(consensus_mode: ConsensusMode) -> ConsensusConstants:
237240
ret: ConsensusConstants = test_constants
238241

242+
if consensus_mode >= ConsensusMode.HARD_FORK_2_0:
243+
ret = ret.replace(
244+
HARD_FORK_HEIGHT=uint32(2),
245+
)
246+
239247
if consensus_mode >= ConsensusMode.SOFT_FORK_2_6:
240248
ret = ret.replace(
241249
SOFT_FORK8_HEIGHT=uint32(2),
242250
)
243251

244-
if consensus_mode >= ConsensusMode.HARD_FORK_3_0_AFTER_PHASE_OUT:
252+
if consensus_mode >= ConsensusMode.SOFT_FORK_2_7:
245253
ret = ret.replace(
246254
HARD_FORK_HEIGHT=uint32(0),
255+
SOFT_FORK8_HEIGHT=uint32(0),
256+
SOFT_FORK9_HEIGHT=uint32(0),
257+
)
258+
259+
if consensus_mode >= ConsensusMode.HARD_FORK_3_0_AFTER_PHASE_OUT:
260+
ret = ret.replace(
247261
HARD_FORK2_HEIGHT=uint32(0),
248262
PLOT_V1_PHASE_OUT_EPOCH_BITS=uint8(0),
249263
# we don't have very much v2 space, and no phase-out means the
@@ -257,15 +271,13 @@ def blockchain_constants(consensus_mode: ConsensusMode) -> ConsensusConstants:
257271
# activate the hard fork at some height > 0 (e.g. 5)
258272
# and have a shorter phase-out period (e.g. 2 bits). We would have
259273
# to regenerate the test chains and tweak some tests for this
260-
HARD_FORK_HEIGHT=uint32(0),
261274
HARD_FORK2_HEIGHT=uint32(0),
262275
# we don't have very much v2 space. We need a lower difficulty
263276
# level to start with
264277
DIFFICULTY_STARTING=uint64(7),
265278
)
266279
elif consensus_mode >= ConsensusMode.HARD_FORK_2_0:
267280
ret = ret.replace(
268-
HARD_FORK_HEIGHT=uint32(2),
269281
PLOT_FILTER_128_HEIGHT=uint32(10),
270282
PLOT_FILTER_64_HEIGHT=uint32(15),
271283
PLOT_FILTER_32_HEIGHT=uint32(20),
@@ -335,6 +347,8 @@ def test_chain_suffix(consensus_mode: ConsensusMode) -> str:
335347
return "3.0"
336348
elif consensus_mode >= ConsensusMode.HARD_FORK_3_0:
337349
return "3.0_mixed"
350+
elif consensus_mode >= ConsensusMode.SOFT_FORK_2_7:
351+
return "2.7"
338352
elif consensus_mode >= ConsensusMode.HARD_FORK_2_0:
339353
return "2.0_hardfork"
340354
else:

chia/_tests/util/misc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,9 @@ def __eq__(self, other: object) -> bool:
632632

633633
return cast(bool, self.value.__eq__(cast(Self, other).value))
634634

635+
def __hash__(self) -> int:
636+
return hash(self.value)
637+
635638
def __ne__(self, other: object) -> bool:
636639
if self.__class__ is not other.__class__:
637640
return True

chia/_tests/util/test_replace_str_to_bytes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
HARD_FORK_HEIGHT=uint32(5496000),
6161
HARD_FORK2_HEIGHT=uint32(0xFFFFFFFF),
6262
SOFT_FORK8_HEIGHT=uint32(8655000),
63+
SOFT_FORK9_HEIGHT=uint32(8655000),
6364
PLOT_V1_PHASE_OUT_EPOCH_BITS=uint8(8),
6465
PLOT_FILTER_128_HEIGHT=uint32(10542000),
6566
PLOT_FILTER_64_HEIGHT=uint32(15592000),

chia/_tests/util/test_testnet_overrides.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,29 @@
88
def test_testnet11() -> None:
99
overrides: dict[str, Any] = {}
1010
update_testnet_overrides("testnet11", overrides)
11-
assert overrides == {"PLOT_SIZE_V2": 28, "SOFT_FORK8_HEIGHT": 3755000}
11+
assert overrides == {"PLOT_SIZE_V2": 28, "SOFT_FORK8_HEIGHT": 3755000, "SOFT_FORK9_HEIGHT": 3924000}
1212

1313

1414
def test_min_plot_size() -> None:
1515
overrides: dict[str, Any] = {"MIN_PLOT_SIZE": 18}
1616
update_testnet_overrides("testnet11", overrides)
17-
assert overrides == {"MIN_PLOT_SIZE_V1": 18, "PLOT_SIZE_V2": 28, "SOFT_FORK8_HEIGHT": 3755000}
17+
assert overrides == {
18+
"MIN_PLOT_SIZE_V1": 18,
19+
"PLOT_SIZE_V2": 28,
20+
"SOFT_FORK8_HEIGHT": 3755000,
21+
"SOFT_FORK9_HEIGHT": 3924000,
22+
}
1823

1924

2025
def test_max_plot_size() -> None:
2126
overrides: dict[str, Any] = {"MAX_PLOT_SIZE": 32}
2227
update_testnet_overrides("testnet11", overrides)
23-
assert overrides == {"MAX_PLOT_SIZE_V1": 32, "PLOT_SIZE_V2": 28, "SOFT_FORK8_HEIGHT": 3755000}
28+
assert overrides == {
29+
"MAX_PLOT_SIZE_V1": 32,
30+
"PLOT_SIZE_V2": 28,
31+
"SOFT_FORK8_HEIGHT": 3755000,
32+
"SOFT_FORK9_HEIGHT": 3924000,
33+
}
2434

2535

2636
def test_mainnet() -> None:

chia/consensus/block_body_validation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ async def validate_block_body(
345345
return Err.INVALID_TRANSACTIONS_GENERATOR_REFS_ROOT
346346
else:
347347
# With hard fork 2 we ban transactions_generator_ref_list.
348-
if prev_transaction_block_height >= constants.HARD_FORK2_HEIGHT:
348+
if prev_transaction_block_height >= constants.SOFT_FORK9_HEIGHT:
349349
return Err.TOO_MANY_GENERATOR_REFS
350350

351351
# If we have a generator reference list, we must have a generator
@@ -378,7 +378,7 @@ async def validate_block_body(
378378
assert conds is not None
379379
assert conds.validated_signature
380380

381-
if prev_transaction_block_height >= constants.HARD_FORK2_HEIGHT:
381+
if prev_transaction_block_height >= constants.SOFT_FORK9_HEIGHT:
382382
if not is_canonical_serialization(bytes(block.transactions_generator)):
383383
return Err.INVALID_TRANSACTIONS_GENERATOR_ENCODING
384384

chia/consensus/blockchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ async def validate_unfinished_block_header(
719719
)
720720

721721
# With hard fork 2 we ban transactions_generator_ref_list.
722-
if prev_tx_height >= self.constants.HARD_FORK2_HEIGHT and block.transactions_generator_ref_list != []:
722+
if prev_tx_height >= self.constants.SOFT_FORK9_HEIGHT and block.transactions_generator_ref_list != []:
723723
return None, Err.TOO_MANY_GENERATOR_REFS
724724

725725
if block.transactions_info is not None:

chia/consensus/default_constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
# TODO: todo_v2_plots finalize fork height
8383
HARD_FORK2_HEIGHT=uint32(0xFFFFFFFA),
8484
SOFT_FORK8_HEIGHT=uint32(8655000),
85+
SOFT_FORK9_HEIGHT=uint32(8655000),
8586
# starting at the hard fork 2 height, v1 plots will gradually be phased out,
8687
# and stop working entirely after (1 << this) many epochs
8788
PLOT_V1_PHASE_OUT_EPOCH_BITS=uint8(8),
@@ -113,6 +114,8 @@ def update_testnet_overrides(network_id: str, overrides: dict[str, Any]) -> None
113114
overrides["PLOT_SIZE_V2"] = 28
114115
if "SOFT_FORK8_HEIGHT" not in overrides:
115116
overrides["SOFT_FORK8_HEIGHT"] = 3755000
117+
if "SOFT_FORK9_HEIGHT" not in overrides:
118+
overrides["SOFT_FORK9_HEIGHT"] = 3924000
116119
if network_id == "testneta":
117120
if "HARD_FORK_HEIGHT" not in overrides:
118121
overrides["HARD_FORK_HEIGHT"] = 3693395

0 commit comments

Comments
 (0)