Skip to content

Commit f44d748

Browse files
committed
Merge commit '082f0592d879ff6e784e4ad9d4f7a9f0442206ca' into catchup/long_lived_datalayer_merkle_blob_from_main_082f0592d879ff6e784e4ad9d4f7a9f0442206ca
2 parents e8ec51a + 082f059 commit f44d748

33 files changed

+378
-258
lines changed

.github/workflows/build-windows-installer.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
build:
4646
name: Build EXE
47-
runs-on: [windows-2019]
47+
runs-on: [windows-2022]
4848
needs:
4949
- version
5050
timeout-minutes: 65
@@ -228,7 +228,7 @@ jobs:
228228
env:
229229
HAS_SIGNING_SECRET: ${{ steps.check_secrets.outputs.HAS_SIGNING_SECRET }}
230230
run: |
231-
$env:path="C:\Program` Files` (x86)\Microsoft` Visual` Studio\2019\Enterprise\SDK\ScopeCppSDK\vc15\VC\bin\;$env:path"
231+
$env:path="C:\Program` Files\Microsoft` Visual` Studio\2022\Enterprise\SDK\ScopeCppSDK\vc15\VC\bin\;$env:path"
232232
$env:path="C:\Program` Files` (x86)\Windows` Kits\10\App` Certification` Kit;$env:path"
233233
cd .\build_scripts
234234
.\build_windows-2-installer.ps1
@@ -317,14 +317,14 @@ jobs:
317317
fail-fast: false
318318
matrix:
319319
os:
320-
- name: 2019
321-
matrix: 2019
322-
runs-on:
323-
intel: windows-2019
324320
- name: 2022
325321
matrix: 2022
326322
runs-on:
327323
intel: windows-2022
324+
- name: 2025
325+
matrix: 2025
326+
runs-on:
327+
intel: windows-2025
328328
arch:
329329
- name: Intel
330330
matrix: intel

benchmarks/mempool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ async def add_spend_bundles(spend_bundles: list[SpendBundle]) -> None:
243243
with enable_profiler(True, f"create-{suffix}"):
244244
start = monotonic()
245245
for _ in range(10):
246-
mempool.create_block_generator(last_tb_header_hash=rec.header_hash)
246+
mempool.create_block_generator(rec.header_hash, 2.0)
247247
stop = monotonic()
248248
print(f" time: {stop - start:0.4f}s")
249249
print(f" per call: {(stop - start) / 10 * 1000:0.2f}ms")
@@ -252,7 +252,7 @@ async def add_spend_bundles(spend_bundles: list[SpendBundle]) -> None:
252252
with enable_profiler(True, f"create2-{suffix}"):
253253
start = monotonic()
254254
for _ in range(10):
255-
mempool.create_block_generator2(last_tb_header_hash=rec.header_hash)
255+
mempool.create_block_generator2(rec.header_hash, 2.0)
256256
stop = monotonic()
257257
print(f" time: {stop - start:0.4f}s")
258258
print(f" per call: {(stop - start) / 10 * 1000:0.2f}ms")

chia/_tests/core/full_node/stores/test_coin_store.py

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -178,39 +178,31 @@ async def test_set_spent(db_version: int, bt: BlockTools) -> None:
178178

179179
# Save/get block
180180
for block in blocks:
181-
if block.is_transaction_block():
182-
removals: list[bytes32] = []
183-
additions: list[Coin] = []
184-
async with db_wrapper.writer():
185-
if block.is_transaction_block():
186-
assert block.foliage_transaction_block is not None
187-
await coin_store.new_block(
188-
block.height,
189-
block.foliage_transaction_block.timestamp,
190-
block.get_included_reward_coins(),
191-
additions,
192-
removals,
193-
)
194-
195-
coins = block.get_included_reward_coins()
196-
records = [await coin_store.get_coin_record(coin.name()) for coin in coins]
181+
if not block.is_transaction_block():
182+
continue
183+
assert block.foliage_transaction_block is not None
184+
await coin_store.new_block(
185+
block.height, block.foliage_transaction_block.timestamp, block.get_included_reward_coins(), [], []
186+
)
187+
coins = block.get_included_reward_coins()
188+
records = [await coin_store.get_coin_record(coin.name()) for coin in coins]
197189

198-
await coin_store._set_spent([r.name for r in records if r is not None], block.height)
190+
await coin_store._set_spent([r.name for r in records if r is not None], block.height)
199191

200-
if len(records) > 0:
201-
for r in records:
202-
assert r is not None
203-
assert (await coin_store.get_coin_record(r.name)) is not None
192+
if len(records) > 0:
193+
for r in records:
194+
assert r is not None
195+
assert (await coin_store.get_coin_record(r.name)) is not None
204196

205-
# Check that we can't spend a coin twice in DB
206-
with pytest.raises(ValueError, match="Invalid operation to set spent"):
207-
await coin_store._set_spent([r.name for r in records if r is not None], block.height)
197+
# Check that we can't spend a coin twice in DB
198+
with pytest.raises(ValueError, match="Invalid operation to set spent"):
199+
await coin_store._set_spent([r.name for r in records if r is not None], block.height)
208200

209-
records = [await coin_store.get_coin_record(coin.name()) for coin in coins]
210-
for record in records:
211-
assert record is not None
212-
assert record.spent
213-
assert record.spent_block_index == block.height
201+
records = [await coin_store.get_coin_record(coin.name()) for coin in coins]
202+
for record in records:
203+
assert record is not None
204+
assert record.spent
205+
assert record.spent_block_index == block.height
214206

215207

216208
@pytest.mark.limit_consensus_modes(reason="save time")

chia/_tests/core/full_node/test_full_node.py

Lines changed: 77 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import pytest
1313
from chia_rs import (
1414
AugSchemeMPL,
15+
ConsensusConstants,
1516
Foliage,
1617
FoliageTransactionBlock,
1718
FullBlock,
@@ -38,7 +39,11 @@
3839
from chia._tests.core.make_block_generator import make_spend_bundle
3940
from chia._tests.core.node_height import node_height_at_least
4041
from chia._tests.util.misc import wallet_height_at_least
41-
from chia._tests.util.setup_nodes import OldSimulatorsAndWallets, SimulatorsAndWalletsServices
42+
from chia._tests.util.setup_nodes import (
43+
OldSimulatorsAndWallets,
44+
SimulatorsAndWalletsServices,
45+
setup_simulators_and_wallets,
46+
)
4247
from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval, time_out_messages
4348
from chia.consensus.augmented_chain import AugmentedBlockchain
4449
from chia.consensus.block_body_validation import ForkInfo
@@ -2912,87 +2917,97 @@ async def test_eviction_from_bls_cache(one_node_one_block: tuple[FullNodeSimulat
29122917

29132918

29142919
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.HARD_FORK_2_0], reason="irrelevant")
2920+
@pytest.mark.parametrize("block_creation", [0, 1, 2])
29152921
@pytest.mark.anyio
29162922
async def test_declare_proof_of_space_no_overflow(
2917-
wallet_nodes: tuple[
2918-
FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
2919-
],
2923+
blockchain_constants: ConsensusConstants,
29202924
self_hostname: str,
2921-
bt: BlockTools,
2925+
block_creation: int,
29222926
) -> None:
2923-
full_node_api, _, server_1, _, _, _, _ = wallet_nodes
2924-
wallet = WalletTool(test_constants)
2925-
coinbase_puzzlehash = wallet.get_new_puzzlehash()
2926-
blocks = bt.get_consecutive_blocks(
2927-
num_blocks=10,
2928-
skip_overflow=True,
2929-
force_overflow=False,
2930-
farmer_reward_puzzle_hash=coinbase_puzzlehash,
2931-
guarantee_transaction_block=True,
2932-
)
2933-
await add_blocks_in_batches(blocks, full_node_api.full_node)
2934-
_, dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
2935-
dummy_peer = server_1.all_connections[dummy_node_id]
2936-
assert full_node_api.full_node.blockchain.get_peak_height() == blocks[-1].height
2937-
for i in range(10, 100):
2938-
sb = await add_tx_to_mempool(
2939-
full_node_api, wallet, blocks[-8], coinbase_puzzlehash, bytes32(i.to_bytes(32, "big")), uint64(i)
2940-
)
2927+
async with setup_simulators_and_wallets(
2928+
1, 1, blockchain_constants, config_overrides={"full_node.block_creation": block_creation}
2929+
) as new:
2930+
full_node_api = new.simulators[0].peer_api
2931+
server_1 = full_node_api.full_node.server
2932+
bt = new.bt
2933+
2934+
wallet = WalletTool(test_constants)
2935+
coinbase_puzzlehash = wallet.get_new_puzzlehash()
29412936
blocks = bt.get_consecutive_blocks(
2942-
block_list_input=blocks,
2943-
num_blocks=1,
2937+
num_blocks=10,
2938+
skip_overflow=True,
2939+
force_overflow=False,
29442940
farmer_reward_puzzle_hash=coinbase_puzzlehash,
29452941
guarantee_transaction_block=True,
2946-
transaction_data=sb,
29472942
)
2948-
block = blocks[-1]
2949-
unfinised_block = await declare_pos_unfinished_block(full_node_api, dummy_peer, block)
2950-
compare_unfinished_blocks(unfinished_from_full_block(block), unfinised_block)
2951-
await full_node_api.full_node.add_block(block)
2952-
assert full_node_api.full_node.blockchain.get_peak_height() == block.height
2943+
await add_blocks_in_batches(blocks, full_node_api.full_node)
2944+
_, dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
2945+
dummy_peer = server_1.all_connections[dummy_node_id]
2946+
assert full_node_api.full_node.blockchain.get_peak_height() == blocks[-1].height
2947+
for i in range(10, 100):
2948+
sb = await add_tx_to_mempool(
2949+
full_node_api, wallet, blocks[-8], coinbase_puzzlehash, bytes32(i.to_bytes(32, "big")), uint64(i)
2950+
)
2951+
blocks = bt.get_consecutive_blocks(
2952+
block_list_input=blocks,
2953+
num_blocks=1,
2954+
farmer_reward_puzzle_hash=coinbase_puzzlehash,
2955+
guarantee_transaction_block=True,
2956+
transaction_data=sb,
2957+
)
2958+
block = blocks[-1]
2959+
unfinised_block = await declare_pos_unfinished_block(full_node_api, dummy_peer, block)
2960+
compare_unfinished_blocks(unfinished_from_full_block(block), unfinised_block)
2961+
await full_node_api.full_node.add_block(block)
2962+
assert full_node_api.full_node.blockchain.get_peak_height() == block.height
29532963

29542964

29552965
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.HARD_FORK_2_0], reason="irrelevant")
2966+
@pytest.mark.parametrize("block_creation", [0, 1, 2])
29562967
@pytest.mark.anyio
29572968
async def test_declare_proof_of_space_overflow(
2958-
wallet_nodes: tuple[
2959-
FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
2960-
],
2969+
blockchain_constants: ConsensusConstants,
29612970
self_hostname: str,
2962-
bt: BlockTools,
2971+
block_creation: int,
29632972
) -> None:
2964-
full_node_api, _, server_1, _, _, _, _ = wallet_nodes
2965-
wallet = WalletTool(test_constants)
2966-
coinbase_puzzlehash = wallet.get_new_puzzlehash()
2967-
blocks = bt.get_consecutive_blocks(
2968-
num_blocks=10,
2969-
farmer_reward_puzzle_hash=coinbase_puzzlehash,
2970-
guarantee_transaction_block=True,
2971-
)
2972-
await add_blocks_in_batches(blocks, full_node_api.full_node)
2973-
_, dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
2974-
dummy_peer = server_1.all_connections[dummy_node_id]
2975-
assert full_node_api.full_node.blockchain.get_peak_height() == blocks[-1].height
2976-
for i in range(10, 100):
2977-
sb = await add_tx_to_mempool(
2978-
full_node_api, wallet, blocks[-8], coinbase_puzzlehash, bytes32(i.to_bytes(32, "big")), uint64(i)
2979-
)
2980-
2973+
async with setup_simulators_and_wallets(
2974+
1, 1, blockchain_constants, config_overrides={"full_node.block_creation": block_creation}
2975+
) as new:
2976+
full_node_api = new.simulators[0].peer_api
2977+
server_1 = full_node_api.full_node.server
2978+
bt = new.bt
2979+
2980+
wallet = WalletTool(test_constants)
2981+
coinbase_puzzlehash = wallet.get_new_puzzlehash()
29812982
blocks = bt.get_consecutive_blocks(
2982-
block_list_input=blocks,
2983-
num_blocks=1,
2984-
skip_overflow=False,
2985-
force_overflow=(i % 10 == 0),
2983+
num_blocks=10,
29862984
farmer_reward_puzzle_hash=coinbase_puzzlehash,
29872985
guarantee_transaction_block=True,
2988-
transaction_data=sb,
29892986
)
2987+
await add_blocks_in_batches(blocks, full_node_api.full_node)
2988+
_, dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
2989+
dummy_peer = server_1.all_connections[dummy_node_id]
2990+
assert full_node_api.full_node.blockchain.get_peak_height() == blocks[-1].height
2991+
for i in range(10, 100):
2992+
sb = await add_tx_to_mempool(
2993+
full_node_api, wallet, blocks[-8], coinbase_puzzlehash, bytes32(i.to_bytes(32, "big")), uint64(i)
2994+
)
2995+
2996+
blocks = bt.get_consecutive_blocks(
2997+
block_list_input=blocks,
2998+
num_blocks=1,
2999+
skip_overflow=False,
3000+
force_overflow=(i % 10 == 0),
3001+
farmer_reward_puzzle_hash=coinbase_puzzlehash,
3002+
guarantee_transaction_block=True,
3003+
transaction_data=sb,
3004+
)
29903005

2991-
block = blocks[-1]
2992-
unfinised_block = await declare_pos_unfinished_block(full_node_api, dummy_peer, block)
2993-
compare_unfinished_blocks(unfinished_from_full_block(block), unfinised_block)
2994-
await full_node_api.full_node.add_block(block)
2995-
assert full_node_api.full_node.blockchain.get_peak_height() == block.height
3006+
block = blocks[-1]
3007+
unfinised_block = await declare_pos_unfinished_block(full_node_api, dummy_peer, block)
3008+
compare_unfinished_blocks(unfinished_from_full_block(block), unfinised_block)
3009+
await full_node_api.full_node.add_block(block)
3010+
assert full_node_api.full_node.blockchain.get_peak_height() == block.height
29963011

29973012

29983013
@pytest.mark.anyio

chia/_tests/core/mempool/test_mempool_fee_estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
from chia._tests.util.db_connection import DBConnection
1010
from chia.full_node.bitcoin_fee_estimator import BitcoinFeeEstimator
1111
from chia.full_node.coin_store import CoinStore
12-
from chia.full_node.fee_estimate_store import FeeStore
1312
from chia.full_node.fee_estimation import MempoolItemInfo
1413
from chia.full_node.fee_estimator import SmartFeeEstimator
1514
from chia.full_node.fee_tracker import FeeTracker
1615
from chia.full_node.mempool_manager import MempoolManager
16+
from chia.protocols.fee_estimate_store import FeeStore
1717

1818

1919
@pytest.mark.anyio

chia/_tests/core/mempool/test_mempool_manager.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ def mk_coin_spend(coin: Coin, solution: Optional[str] = None) -> CoinSpend:
878878
return make_spend(
879879
coin,
880880
SerializedProgram.to(None),
881-
SerializedProgram.to(bytes.fromhex(solution) if solution is not None else None),
881+
SerializedProgram.fromhex(solution if solution is not None else "80"),
882882
)
883883

884884

@@ -2979,7 +2979,7 @@ async def test_check_removals_with_block_creation(flags: int, old: bool) -> None
29792979
assert bundle_add_info2.status == MempoolInclusionStatus.SUCCESS
29802980
assert mempool_manager.peak is not None
29812981
create_block = mempool_manager.create_block_generator if old else mempool_manager.create_block_generator2
2982-
new_block_gen = create_block(mempool_manager.peak.header_hash)
2982+
new_block_gen = create_block(mempool_manager.peak.header_hash, 10.0)
29832983
assert new_block_gen is not None
29842984
assert len(new_block_gen.additions) == 1
29852985
assert set(new_block_gen.additions) == {
@@ -2991,14 +2991,15 @@ async def test_check_removals_with_block_creation(flags: int, old: bool) -> None
29912991

29922992
@pytest.mark.anyio
29932993
async def test_dedup_not_canonical() -> None:
2994-
# this is 1, but with a non-canonical encoding
2995-
coin_spend = mk_coin_spend(TEST_COIN, solution="c00101")
2996-
coins = TestCoins(coins=[], lineage={})
2994+
# this is ((1)), but with a non-canonical encoding
2995+
coin_spend = mk_coin_spend(TEST_COIN, solution="ffffc001018080")
2996+
coins = TestCoins([TEST_COIN], lineage={})
29972997
mempool_manager = await setup_mempool(coins)
29982998
sb = SpendBundle([coin_spend], G2Element())
29992999
sb_conds = make_test_conds(spend_ids=[(TEST_COIN, ELIGIBLE_FOR_DEDUP)])
30003000
bundle_add_info = await mempool_manager.add_spend_bundle(sb, sb_conds, sb.name(), uint32(1))
30013001
assert bundle_add_info.status == MempoolInclusionStatus.FAILED
3002+
assert bundle_add_info.error == Err.INVALID_COIN_SOLUTION
30023003

30033004

30043005
def make_coin_record(coin: Coin, spent_block_index: int = 0) -> CoinRecord:

chia/_tests/core/test_farmer_harvester_rpc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from chia._tests.util.misc import assert_rpc_error
2222
from chia._tests.util.rpc import validate_get_routes
2323
from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval
24-
from chia.consensus.coinbase import create_puzzlehash_for_pk
2524
from chia.farmer.farmer import Farmer
2625
from chia.plot_sync.receiver import Receiver, get_list_or_len
2726
from chia.plotting.util import add_plot_directory
@@ -40,6 +39,7 @@
4039
from chia.util.config import load_config, lock_and_load_config, save_config
4140
from chia.util.hash import std_hash
4241
from chia.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened
42+
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_hash_for_pk
4343

4444
log = logging.getLogger(__name__)
4545

@@ -150,8 +150,8 @@ async def test_farmer_reward_target_endpoints(harvester_farmer_environment: Harv
150150
targets_2 = await farmer_rpc_client.get_reward_targets(True, 2)
151151
assert targets_2["have_pool_sk"] and targets_2["have_farmer_sk"]
152152

153-
new_ph: bytes32 = create_puzzlehash_for_pk(master_sk_to_wallet_sk(bt.farmer_master_sk, uint32(2)).get_g1())
154-
new_ph_2: bytes32 = create_puzzlehash_for_pk(master_sk_to_wallet_sk(bt.pool_master_sk, uint32(7)).get_g1())
153+
new_ph: bytes32 = puzzle_hash_for_pk(master_sk_to_wallet_sk(bt.farmer_master_sk, uint32(2)).get_g1())
154+
new_ph_2: bytes32 = puzzle_hash_for_pk(master_sk_to_wallet_sk(bt.pool_master_sk, uint32(7)).get_g1())
155155

156156
await farmer_rpc_client.set_reward_targets(encode_puzzle_hash(new_ph, "xch"), encode_puzzle_hash(new_ph_2, "xch"))
157157
targets_3 = await farmer_rpc_client.get_reward_targets(True, 10)
@@ -164,10 +164,10 @@ async def test_farmer_reward_target_endpoints(harvester_farmer_environment: Harv
164164
assert not targets_4["have_pool_sk"] and targets_4["have_farmer_sk"]
165165

166166
# check observer addresses
167-
observer_farmer: bytes32 = create_puzzlehash_for_pk(
167+
observer_farmer: bytes32 = puzzle_hash_for_pk(
168168
master_sk_to_wallet_sk_unhardened(bt.farmer_master_sk, uint32(2)).get_g1()
169169
)
170-
observer_pool: bytes32 = create_puzzlehash_for_pk(
170+
observer_pool: bytes32 = puzzle_hash_for_pk(
171171
master_sk_to_wallet_sk_unhardened(bt.pool_master_sk, uint32(7)).get_g1()
172172
)
173173
await farmer_rpc_client.set_reward_targets(

0 commit comments

Comments
 (0)