mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 10:05:29 -05:00
use anyio for tests (#16738)
Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
This commit is contained in:
co-authored by
Amine Khaldi
parent
975af7494b
commit
b1bdbc40ab
@@ -5,7 +5,6 @@ addopts = --verbose --tb=short -n auto -p no:monitor
|
||||
log_level = WARNING
|
||||
console_output_style = count
|
||||
log_format = %(asctime)s %(name)s: %(levelname)s %(message)s
|
||||
asyncio_mode = strict
|
||||
markers =
|
||||
limit_consensus_modes
|
||||
data_layer: Mark as a data layer related test.
|
||||
|
||||
@@ -51,7 +51,6 @@ dev_dependencies = [
|
||||
"py3createtorrent==1.1.0",
|
||||
"pylint==3.0.2",
|
||||
"pytest==7.4.3",
|
||||
"pytest-asyncio==0.21.1",
|
||||
"pytest-cov==4.1.0",
|
||||
"pytest-mock==3.12.0",
|
||||
"pytest-xdist==3.3.1",
|
||||
|
||||
+107
-107
@@ -77,7 +77,7 @@ async def make_empty_blockchain(constants: ConsensusConstants):
|
||||
|
||||
|
||||
class TestGenesisBlock:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_tools_proofs_400(self, default_400_blocks, blockchain_constants):
|
||||
vdf, proof = get_vdf_info_and_proof(
|
||||
blockchain_constants,
|
||||
@@ -88,7 +88,7 @@ class TestGenesisBlock:
|
||||
if validate_vdf(proof, blockchain_constants, ClassgroupElement.get_default_element(), vdf) is False:
|
||||
raise Exception("invalid proof")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_tools_proofs_1000(self, default_1000_blocks, blockchain_constants):
|
||||
vdf, proof = get_vdf_info_and_proof(
|
||||
blockchain_constants,
|
||||
@@ -99,7 +99,7 @@ class TestGenesisBlock:
|
||||
if validate_vdf(proof, blockchain_constants, ClassgroupElement.get_default_element(), vdf) is False:
|
||||
raise Exception("invalid proof")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_tools_proofs(self, blockchain_constants):
|
||||
vdf, proof = get_vdf_info_and_proof(
|
||||
blockchain_constants,
|
||||
@@ -110,29 +110,29 @@ class TestGenesisBlock:
|
||||
if validate_vdf(proof, blockchain_constants, ClassgroupElement.get_default_element(), vdf) is False:
|
||||
raise Exception("invalid proof")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_non_overflow_genesis(self, empty_blockchain, bt):
|
||||
assert empty_blockchain.get_peak() is None
|
||||
genesis = bt.get_consecutive_blocks(1, force_overflow=False)[0]
|
||||
await _validate_and_add_block(empty_blockchain, genesis)
|
||||
assert empty_blockchain.get_peak().height == 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_overflow_genesis(self, empty_blockchain, bt):
|
||||
genesis = bt.get_consecutive_blocks(1, force_overflow=True)[0]
|
||||
await _validate_and_add_block(empty_blockchain, genesis)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_genesis_empty_slots(self, empty_blockchain, bt):
|
||||
genesis = bt.get_consecutive_blocks(1, force_overflow=False, skip_slots=30)[0]
|
||||
await _validate_and_add_block(empty_blockchain, genesis)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_overflow_genesis_empty_slots(self, empty_blockchain, bt):
|
||||
genesis = bt.get_consecutive_blocks(1, force_overflow=True, skip_slots=3)[0]
|
||||
await _validate_and_add_block(empty_blockchain, genesis)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_genesis_validate_1(self, empty_blockchain, bt):
|
||||
genesis = bt.get_consecutive_blocks(1, force_overflow=False)[0]
|
||||
bad_prev = bytes([1] * 32)
|
||||
@@ -142,7 +142,7 @@ class TestGenesisBlock:
|
||||
|
||||
class TestBlockHeaderValidation:
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_long_chain(self, empty_blockchain, default_1000_blocks):
|
||||
blocks = default_1000_blocks
|
||||
for block in blocks:
|
||||
@@ -267,7 +267,7 @@ class TestBlockHeaderValidation:
|
||||
)
|
||||
assert empty_blockchain.get_peak().height == len(blocks) - 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unfinished_blocks(self, empty_blockchain, softfork_height, bt):
|
||||
blockchain = empty_blockchain
|
||||
blocks = bt.get_consecutive_blocks(3)
|
||||
@@ -317,12 +317,12 @@ class TestBlockHeaderValidation:
|
||||
validate_res = await blockchain.validate_unfinished_block(unf, npc_result, False)
|
||||
assert validate_res.error is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_genesis(self, empty_blockchain, bt):
|
||||
for block in bt.get_consecutive_blocks(2, skip_slots=3):
|
||||
await _validate_and_add_block(empty_blockchain, block)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_slots_non_genesis(self, empty_blockchain, bt):
|
||||
blockchain = empty_blockchain
|
||||
blocks = bt.get_consecutive_blocks(10)
|
||||
@@ -334,7 +334,7 @@ class TestBlockHeaderValidation:
|
||||
await _validate_and_add_block(empty_blockchain, block)
|
||||
assert blockchain.get_peak().height == 19
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_one_sb_per_slot(self, empty_blockchain, bt):
|
||||
blockchain = empty_blockchain
|
||||
num_blocks = 20
|
||||
@@ -344,7 +344,7 @@ class TestBlockHeaderValidation:
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
assert blockchain.get_peak().height == num_blocks - 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_all_overflow(self, empty_blockchain, bt):
|
||||
blockchain = empty_blockchain
|
||||
num_rounds = 5
|
||||
@@ -357,7 +357,7 @@ class TestBlockHeaderValidation:
|
||||
await _validate_and_add_block(empty_blockchain, block)
|
||||
assert blockchain.get_peak().height == num_blocks - 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unf_block_overflow(self, empty_blockchain, softfork_height, bt):
|
||||
blockchain = empty_blockchain
|
||||
|
||||
@@ -401,7 +401,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
await _validate_and_add_block(blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_one_sb_per_two_slots(self, empty_blockchain, bt):
|
||||
blockchain = empty_blockchain
|
||||
num_blocks = 20
|
||||
@@ -411,7 +411,7 @@ class TestBlockHeaderValidation:
|
||||
await _validate_and_add_block(blockchain, blocks[-1])
|
||||
assert blockchain.get_peak().height == num_blocks - 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_one_sb_per_five_slots(self, empty_blockchain, bt):
|
||||
blockchain = empty_blockchain
|
||||
num_blocks = 10
|
||||
@@ -421,14 +421,14 @@ class TestBlockHeaderValidation:
|
||||
await _validate_and_add_block(blockchain, blocks[-1])
|
||||
assert blockchain.get_peak().height == num_blocks - 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_chain_overflow(self, empty_blockchain, bt):
|
||||
blocks = bt.get_consecutive_blocks(5, force_overflow=True)
|
||||
for block in blocks:
|
||||
await _validate_and_add_block(empty_blockchain, block)
|
||||
assert empty_blockchain.get_peak().height == len(blocks) - 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_one_sb_per_two_slots_force_overflow(self, empty_blockchain, bt):
|
||||
blockchain = empty_blockchain
|
||||
num_blocks = 10
|
||||
@@ -438,7 +438,7 @@ class TestBlockHeaderValidation:
|
||||
await _validate_and_add_block(blockchain, blocks[-1])
|
||||
assert blockchain.get_peak().height == num_blocks - 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_prev(self, empty_blockchain, bt):
|
||||
# 1
|
||||
blocks = bt.get_consecutive_blocks(2, force_overflow=False)
|
||||
@@ -447,7 +447,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
await _validate_and_add_block(empty_blockchain, block_1_bad, expected_error=Err.INVALID_PREV_BLOCK_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_pospace(self, empty_blockchain, bt):
|
||||
# 2
|
||||
blocks = bt.get_consecutive_blocks(2, force_overflow=False)
|
||||
@@ -456,7 +456,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
await _validate_and_add_block(empty_blockchain, block_1_bad, expected_error=Err.INVALID_POSPACE)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_sub_slot_challenge_hash_genesis(self, empty_blockchain, bt):
|
||||
# 2a
|
||||
blocks = bt.get_consecutive_blocks(1, force_overflow=False, skip_slots=1)
|
||||
@@ -482,7 +482,7 @@ class TestBlockHeaderValidation:
|
||||
assert error.code == Err.INVALID_PREV_CHALLENGE_SLOT_HASH
|
||||
await _validate_and_add_block(empty_blockchain, block_0_bad, expected_result=AddBlockResult.INVALID_BLOCK)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_sub_slot_challenge_hash_non_genesis(self, empty_blockchain, bt):
|
||||
# 2b
|
||||
blocks = bt.get_consecutive_blocks(1, force_overflow=False, skip_slots=0)
|
||||
@@ -509,7 +509,7 @@ class TestBlockHeaderValidation:
|
||||
assert error.code == Err.INVALID_PREV_CHALLENGE_SLOT_HASH
|
||||
await _validate_and_add_block(empty_blockchain, block_1_bad, expected_result=AddBlockResult.INVALID_BLOCK)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_sub_slot_challenge_hash_empty_ss(self, empty_blockchain, bt):
|
||||
# 2c
|
||||
blocks = bt.get_consecutive_blocks(1, force_overflow=False, skip_slots=0)
|
||||
@@ -536,7 +536,7 @@ class TestBlockHeaderValidation:
|
||||
assert error.code == Err.INVALID_PREV_CHALLENGE_SLOT_HASH
|
||||
await _validate_and_add_block(empty_blockchain, block_1_bad, expected_result=AddBlockResult.INVALID_BLOCK)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_genesis_no_icc(self, empty_blockchain, bt):
|
||||
# 2d
|
||||
blocks = bt.get_consecutive_blocks(1, force_overflow=False, skip_slots=1)
|
||||
@@ -640,12 +640,12 @@ class TestBlockHeaderValidation:
|
||||
await db_wrapper.close()
|
||||
bc1.shut_down()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_icc_sub_slot_vdf(self, db_version, blockchain_constants):
|
||||
with TempKeyring() as keychain:
|
||||
await self.do_test_invalid_icc_sub_slot_vdf(keychain, db_version, blockchain_constants)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_icc_into_cc(self, empty_blockchain, bt):
|
||||
blockchain = empty_blockchain
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -736,7 +736,7 @@ class TestBlockHeaderValidation:
|
||||
# Finally, add the block properly
|
||||
await _validate_and_add_block(blockchain, block)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_slot_no_ses(self, empty_blockchain, bt):
|
||||
# 2l
|
||||
blockchain = empty_blockchain
|
||||
@@ -765,7 +765,7 @@ class TestBlockHeaderValidation:
|
||||
assert error.code == Err.INVALID_SUB_EPOCH_SUMMARY_HASH
|
||||
await _validate_and_add_block(blockchain, block_bad, expected_result=AddBlockResult.INVALID_BLOCK)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_sub_slots_epoch(self, empty_blockchain, default_400_blocks, bt):
|
||||
# 2m
|
||||
# Tests adding an empty sub slot after the sub-epoch / epoch.
|
||||
@@ -784,7 +784,7 @@ class TestBlockHeaderValidation:
|
||||
empty_blockchain, blocks_2[-1], expected_result=AddBlockResult.ADDED_AS_ORPHAN, skip_prevalidation=True
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_wrong_cc_hash_rc(self, empty_blockchain, bt):
|
||||
# 2o
|
||||
blockchain = empty_blockchain
|
||||
@@ -803,7 +803,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
await _validate_and_add_block(blockchain, block_1_bad, expected_error=Err.INVALID_CHALLENGE_SLOT_HASH_RC)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_cc_sub_slot_vdf(self, empty_blockchain, bt):
|
||||
# 2q
|
||||
blocks: List[FullBlock] = []
|
||||
@@ -901,7 +901,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
await _validate_and_add_block(empty_blockchain, block)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_rc_sub_slot_vdf(self, empty_blockchain, bt):
|
||||
# 2p
|
||||
blocks: List[FullBlock] = []
|
||||
@@ -974,7 +974,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
await _validate_and_add_block(empty_blockchain, block)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_genesis_bad_deficit(self, empty_blockchain, bt):
|
||||
# 2r
|
||||
block = bt.get_consecutive_blocks(1, skip_slots=2)[0]
|
||||
@@ -990,7 +990,7 @@ class TestBlockHeaderValidation:
|
||||
block_bad = recursive_replace(block, "finished_sub_slots", block.finished_sub_slots[:-1] + [new_finished_ss])
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_DEFICIT)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reset_deficit(self, empty_blockchain, bt):
|
||||
# 2s, 2t
|
||||
blockchain = empty_blockchain
|
||||
@@ -1024,7 +1024,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_genesis_has_ses(self, empty_blockchain, bt):
|
||||
# 3a
|
||||
block = bt.get_consecutive_blocks(1, skip_slots=1)[0]
|
||||
@@ -1052,7 +1052,7 @@ class TestBlockHeaderValidation:
|
||||
empty_blockchain, block_bad, expected_error=Err.INVALID_SUB_EPOCH_SUMMARY_HASH
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_no_ses_if_no_se(self, empty_blockchain, bt):
|
||||
# 3b
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1095,12 +1095,12 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_too_many_blocks(self, empty_blockchain):
|
||||
# 4: TODO
|
||||
pass
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_pos(self, empty_blockchain, bt):
|
||||
# 5
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1138,7 +1138,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
# TODO: test not passing the plot filter
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_signage_point_index(self, empty_blockchain, bt):
|
||||
# 6
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1155,7 +1155,7 @@ class TestBlockHeaderValidation:
|
||||
)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_SP_INDEX)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sp_0_no_sp(self, empty_blockchain, bt):
|
||||
# 7
|
||||
blocks = []
|
||||
@@ -1175,12 +1175,12 @@ class TestBlockHeaderValidation:
|
||||
)
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_epoch_overflows(self, empty_blockchain):
|
||||
# 9. TODO. This is hard to test because it requires modifying the block tools to make these special blocks
|
||||
pass
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_total_iters(self, empty_blockchain, bt):
|
||||
# 10
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1191,7 +1191,7 @@ class TestBlockHeaderValidation:
|
||||
)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_TOTAL_ITERS)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_rc_sp_vdf(self, empty_blockchain, bt):
|
||||
# 11
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1225,7 +1225,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_rc_sp_sig(self, empty_blockchain, bt):
|
||||
# 12
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1233,7 +1233,7 @@ class TestBlockHeaderValidation:
|
||||
block_bad = recursive_replace(blocks[-1], "reward_chain_block.reward_chain_sp_signature", G2Element.generator())
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_RC_SIGNATURE)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_cc_sp_vdf(self, empty_blockchain, bt):
|
||||
# 13. Note: does not validate fully due to proof of space being validated first
|
||||
|
||||
@@ -1268,7 +1268,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_cc_sp_sig(self, empty_blockchain, bt):
|
||||
# 14
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1278,12 +1278,12 @@ class TestBlockHeaderValidation:
|
||||
)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_CC_SIGNATURE)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_is_transaction_block(self, empty_blockchain):
|
||||
# 15: TODO
|
||||
pass
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_foliage_sb_sig(self, empty_blockchain, bt):
|
||||
# 16
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1291,7 +1291,7 @@ class TestBlockHeaderValidation:
|
||||
block_bad = recursive_replace(blocks[-1], "foliage.foliage_block_data_signature", G2Element.generator())
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_PLOT_SIGNATURE)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_foliage_transaction_block_sig(self, empty_blockchain, bt):
|
||||
# 17
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1307,7 +1307,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unfinished_reward_chain_sb_hash(self, empty_blockchain, bt):
|
||||
# 18
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1320,7 +1320,7 @@ class TestBlockHeaderValidation:
|
||||
block_bad = recursive_replace(block_bad, "foliage.foliage_block_data_signature", new_fsb_sig)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_URSB_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_pool_target_height(self, empty_blockchain, bt):
|
||||
# 19
|
||||
blocks = bt.get_consecutive_blocks(3)
|
||||
@@ -1332,7 +1332,7 @@ class TestBlockHeaderValidation:
|
||||
block_bad = recursive_replace(block_bad, "foliage.foliage_block_data_signature", new_fsb_sig)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.OLD_POOL_TARGET)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_pool_target_pre_farm(self, empty_blockchain, bt):
|
||||
# 20a
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1344,7 +1344,7 @@ class TestBlockHeaderValidation:
|
||||
block_bad = recursive_replace(block_bad, "foliage.foliage_block_data_signature", new_fsb_sig)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_PREFARM)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_pool_target_signature(self, empty_blockchain, bt):
|
||||
# 20b
|
||||
blocks_initial = bt.get_consecutive_blocks(2)
|
||||
@@ -1368,7 +1368,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
attempts += 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_pool_target_contract(self, empty_blockchain, bt, seeded_random: random.Random):
|
||||
# 20c invalid pool target with contract
|
||||
blocks_initial = bt.get_consecutive_blocks(2)
|
||||
@@ -1392,7 +1392,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
attempts += 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_foliage_data_presence(self, empty_blockchain, bt):
|
||||
# 22
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1419,7 +1419,7 @@ class TestBlockHeaderValidation:
|
||||
],
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_foliage_transaction_block_hash(self, empty_blockchain, bt):
|
||||
# 23
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1441,7 +1441,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_genesis_bad_prev_block(self, empty_blockchain, bt):
|
||||
# 24a
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1456,7 +1456,7 @@ class TestBlockHeaderValidation:
|
||||
block_bad = recursive_replace(block_bad, "foliage.foliage_transaction_block_signature", new_fbh_sig)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_PREV_BLOCK_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_prev_block_non_genesis(self, empty_blockchain, bt):
|
||||
# 24b
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1477,7 +1477,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_filter_hash(self, empty_blockchain, bt):
|
||||
# 25
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1500,7 +1500,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
await _validate_and_add_block(empty_blockchain, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_timestamp(self, bt):
|
||||
# 26
|
||||
# the test constants set MAX_FUTURE_TIME to 10 days, restore it to
|
||||
@@ -1571,7 +1571,7 @@ class TestBlockHeaderValidation:
|
||||
return None
|
||||
await _validate_and_add_block(b, blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_height(self, empty_blockchain, bt):
|
||||
# 27
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1579,14 +1579,14 @@ class TestBlockHeaderValidation:
|
||||
block_bad: FullBlock = recursive_replace(blocks[-1], "reward_chain_block.height", 2)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_HEIGHT)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_height_genesis(self, empty_blockchain, bt):
|
||||
# 27
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
block_bad: FullBlock = recursive_replace(blocks[-1], "reward_chain_block.height", 1)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_PREV_BLOCK_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_weight(self, empty_blockchain, bt):
|
||||
# 28
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1594,14 +1594,14 @@ class TestBlockHeaderValidation:
|
||||
block_bad: FullBlock = recursive_replace(blocks[-1], "reward_chain_block.weight", 22131)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_WEIGHT)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_weight_genesis(self, empty_blockchain, bt):
|
||||
# 28
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
block_bad: FullBlock = recursive_replace(blocks[-1], "reward_chain_block.weight", 0)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_WEIGHT)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_cc_ip_vdf(self, empty_blockchain, bt):
|
||||
# 29
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1629,7 +1629,7 @@ class TestBlockHeaderValidation:
|
||||
)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_CC_IP_VDF)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_rc_ip_vdf(self, empty_blockchain, bt):
|
||||
# 30
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1657,7 +1657,7 @@ class TestBlockHeaderValidation:
|
||||
)
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_RC_IP_VDF)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_icc_ip_vdf(self, empty_blockchain, bt):
|
||||
# 31
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1689,7 +1689,7 @@ class TestBlockHeaderValidation:
|
||||
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_ICC_VDF)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reward_block_hash(self, empty_blockchain, bt):
|
||||
# 32
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
@@ -1697,7 +1697,7 @@ class TestBlockHeaderValidation:
|
||||
block_bad: FullBlock = recursive_replace(blocks[-1], "foliage.reward_block_hash", std_hash(b""))
|
||||
await _validate_and_add_block(empty_blockchain, block_bad, expected_error=Err.INVALID_REWARD_BLOCK_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reward_block_hash_2(self, empty_blockchain, bt):
|
||||
# 33
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -1728,7 +1728,7 @@ rbr = AddBlockResult
|
||||
|
||||
|
||||
class TestPreValidation:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_pre_validation_fails_bad_blocks(self, empty_blockchain, bt):
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
await _validate_and_add_block(empty_blockchain, blocks[0])
|
||||
@@ -1742,7 +1742,7 @@ class TestPreValidation:
|
||||
assert res[0].error is None
|
||||
assert res[1].error is not None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_pre_validation(self, empty_blockchain, default_1000_blocks, bt):
|
||||
blocks = default_1000_blocks[:100]
|
||||
start = time.time()
|
||||
@@ -1786,7 +1786,7 @@ class TestBodyValidation:
|
||||
# CREATE_PUZZLE_ANNOUNCEMENT,
|
||||
# ASSERT_PUZZLE_ANNOUNCEMENT,
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"opcode",
|
||||
[
|
||||
@@ -1858,7 +1858,7 @@ class TestBodyValidation:
|
||||
assert err is None
|
||||
assert state_change.fork_height == 2
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"opcode,lock_value,expected",
|
||||
[
|
||||
@@ -1973,7 +1973,7 @@ class TestBodyValidation:
|
||||
c = await b.coin_store.get_coin_record(coin.name())
|
||||
assert c is not None and c.spent
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"opcode",
|
||||
[
|
||||
@@ -2065,7 +2065,7 @@ class TestBodyValidation:
|
||||
res, error, state_change = await b.add_block(blocks[-1], repl_preval_results)
|
||||
assert (res, error, state_change.fork_height if state_change else None) == expected
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("with_garbage", [True, False])
|
||||
@pytest.mark.parametrize(
|
||||
"opcode,lock_value,expected",
|
||||
@@ -2186,7 +2186,7 @@ class TestBodyValidation:
|
||||
c = await b.coin_store.get_coin_record(coin2.name())
|
||||
assert c is not None and not c.spent
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_not_tx_block_but_has_data(self, empty_blockchain, bt):
|
||||
# 1
|
||||
blocks = bt.get_consecutive_blocks(1)
|
||||
@@ -2215,7 +2215,7 @@ class TestBodyValidation:
|
||||
empty_blockchain, block, expected_error=Err.NOT_BLOCK_BUT_HAS_DATA, skip_prevalidation=True
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_tx_block_missing_data(self, empty_blockchain, bt):
|
||||
# 2
|
||||
b = empty_blockchain
|
||||
@@ -2240,7 +2240,7 @@ class TestBodyValidation:
|
||||
b, block, [Err.IS_TRANSACTION_BLOCK_BUT_NO_DATA, Err.INVALID_FOLIAGE_BLOCK_PRESENCE]
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_transactions_info_hash(self, empty_blockchain, bt):
|
||||
# 3
|
||||
b = empty_blockchain
|
||||
@@ -2261,7 +2261,7 @@ class TestBodyValidation:
|
||||
|
||||
await _validate_and_add_block(b, block, expected_error=Err.INVALID_TRANSACTIONS_INFO_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_transactions_block_hash(self, empty_blockchain, bt):
|
||||
# 4
|
||||
b = empty_blockchain
|
||||
@@ -2275,7 +2275,7 @@ class TestBodyValidation:
|
||||
|
||||
await _validate_and_add_block(b, block, expected_error=Err.INVALID_FOLIAGE_BLOCK_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_reward_claims(self, empty_blockchain, bt):
|
||||
# 5
|
||||
b = empty_blockchain
|
||||
@@ -2343,7 +2343,7 @@ class TestBodyValidation:
|
||||
|
||||
await _validate_and_add_block(b, block_2, expected_error=Err.INVALID_REWARD_COINS, skip_prevalidation=True)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_transactions_generator_hash(self, empty_blockchain, bt):
|
||||
# 7
|
||||
b = empty_blockchain
|
||||
@@ -2400,7 +2400,7 @@ class TestBodyValidation:
|
||||
block_2 = recursive_replace(block_2, "foliage.foliage_transaction_block_signature", new_fsb_sig)
|
||||
await _validate_and_add_block(b, block_2, expected_error=Err.INVALID_TRANSACTIONS_GENERATOR_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_transactions_ref_list(self, empty_blockchain, bt, consensus_mode: ConsensusMode):
|
||||
# No generator should have [1]s for the root
|
||||
b = empty_blockchain
|
||||
@@ -2513,7 +2513,7 @@ class TestBodyValidation:
|
||||
skip_prevalidation=True,
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cost_exceeds_max(self, empty_blockchain, softfork_height, bt):
|
||||
# 7
|
||||
b = empty_blockchain
|
||||
@@ -2559,12 +2559,12 @@ class TestBodyValidation:
|
||||
assert results is not None
|
||||
assert Err(results[0].error) == Err.BLOCK_COST_EXCEEDS_MAX
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_clvm_must_not_fail(self, empty_blockchain, bt):
|
||||
# 8
|
||||
pass
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_cost_in_block(self, empty_blockchain, softfork_height, bt):
|
||||
# 9
|
||||
b = empty_blockchain
|
||||
@@ -2668,7 +2668,7 @@ class TestBodyValidation:
|
||||
# when the CLVM program exceeds cost during execution, it will fail with
|
||||
# a general runtime error. The previous test tests this.
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_max_coin_amount(self, db_version, bt):
|
||||
# 10
|
||||
# TODO: fix, this is not reaching validation. Because we can't create a block with such amounts due to uint64
|
||||
@@ -2720,7 +2720,7 @@ class TestBodyValidation:
|
||||
# await db_wrapper.close()
|
||||
# b.shut_down()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_merkle_roots(self, empty_blockchain, bt):
|
||||
# 11
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
@@ -2768,7 +2768,7 @@ class TestBodyValidation:
|
||||
|
||||
await _validate_and_add_block(empty_blockchain, block_2, expected_error=Err.BAD_REMOVAL_ROOT)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_filter(self, empty_blockchain, bt):
|
||||
# 12
|
||||
b = empty_blockchain
|
||||
@@ -2802,7 +2802,7 @@ class TestBodyValidation:
|
||||
|
||||
await _validate_and_add_block(b, block_2, expected_error=Err.INVALID_TRANSACTIONS_FILTER_HASH)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_duplicate_outputs(self, empty_blockchain, bt):
|
||||
# 13
|
||||
b = empty_blockchain
|
||||
@@ -2832,7 +2832,7 @@ class TestBodyValidation:
|
||||
)
|
||||
await _validate_and_add_block(b, blocks[-1], expected_error=Err.DUPLICATE_OUTPUT)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_duplicate_removals(self, empty_blockchain, bt):
|
||||
# 14
|
||||
b = empty_blockchain
|
||||
@@ -2861,7 +2861,7 @@ class TestBodyValidation:
|
||||
)
|
||||
await _validate_and_add_block(b, blocks[-1], expected_error=Err.DOUBLE_SPEND)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_double_spent_in_coin_store(self, empty_blockchain, bt):
|
||||
# 15
|
||||
b = empty_blockchain
|
||||
@@ -2895,7 +2895,7 @@ class TestBodyValidation:
|
||||
|
||||
await _validate_and_add_block(b, blocks[-1], expected_error=Err.DOUBLE_SPEND)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_double_spent_in_reorg(self, empty_blockchain, bt):
|
||||
# 15
|
||||
b = empty_blockchain
|
||||
@@ -2987,7 +2987,7 @@ class TestBodyValidation:
|
||||
farmer_coin = await b.coin_store.get_coin_record(farmer_coin.name())
|
||||
assert first_coin is not None and farmer_coin.spent
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_minting_coin(self, empty_blockchain, bt):
|
||||
# 16 Minting coin check
|
||||
b = empty_blockchain
|
||||
@@ -3020,12 +3020,12 @@ class TestBodyValidation:
|
||||
await _validate_and_add_block(b, blocks[-1], expected_error=Err.MINTING_COIN)
|
||||
# 17 is tested in mempool tests
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_max_coin_amount_fee(self):
|
||||
# 18 TODO: we can't create a block with such amounts due to uint64
|
||||
pass
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_fees_in_block(self, empty_blockchain, bt):
|
||||
# 19
|
||||
b = empty_blockchain
|
||||
@@ -3066,7 +3066,7 @@ class TestBodyValidation:
|
||||
|
||||
await _validate_and_add_block(b, block_2, expected_error=Err.INVALID_BLOCK_FEE_AMOUNT)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_agg_sig(self, empty_blockchain, bt):
|
||||
# 22
|
||||
b = empty_blockchain
|
||||
@@ -3112,7 +3112,7 @@ class TestBodyValidation:
|
||||
|
||||
|
||||
class TestReorgs:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_reorg(self, empty_blockchain, bt):
|
||||
b = empty_blockchain
|
||||
blocks = bt.get_consecutive_blocks(15)
|
||||
@@ -3131,7 +3131,7 @@ class TestReorgs:
|
||||
await _validate_and_add_block(b, reorg_block)
|
||||
assert b.get_peak().height == 16
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_long_reorg(self, empty_blockchain, default_1500_blocks, test_long_reorg_blocks, bt):
|
||||
# Reorg longer than a difficulty adjustment
|
||||
# Also tests higher weight chain but lower height
|
||||
@@ -3175,14 +3175,14 @@ class TestReorgs:
|
||||
assert b.get_peak().weight > chain_1_weight
|
||||
assert b.get_peak().height < chain_1_height
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_long_compact_blockchain(self, empty_blockchain, default_2000_blocks_compact):
|
||||
b = empty_blockchain
|
||||
for block in default_2000_blocks_compact:
|
||||
await _validate_and_add_block(b, block, skip_prevalidation=True)
|
||||
assert b.get_peak().height == len(default_2000_blocks_compact) - 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reorg_from_genesis(self, empty_blockchain, bt):
|
||||
b = empty_blockchain
|
||||
|
||||
@@ -3213,7 +3213,7 @@ class TestReorgs:
|
||||
|
||||
assert b.get_peak().height == 17
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reorg_transaction(self, empty_blockchain, bt):
|
||||
b = empty_blockchain
|
||||
wallet_a = WalletTool(b.constants)
|
||||
@@ -3258,7 +3258,7 @@ class TestReorgs:
|
||||
for block in blocks_fork:
|
||||
await _validate_and_add_block_no_error(b, block)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_header_blocks_in_range_tx_filter(self, empty_blockchain, bt):
|
||||
b = empty_blockchain
|
||||
blocks = bt.get_consecutive_blocks(
|
||||
@@ -3291,7 +3291,7 @@ class TestReorgs:
|
||||
)
|
||||
assert blocks_with_filter[header_hash].header_hash == blocks_without_filter[header_hash].header_hash
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_blocks_at(self, empty_blockchain, default_1000_blocks):
|
||||
b = empty_blockchain
|
||||
heights = []
|
||||
@@ -3305,7 +3305,7 @@ class TestReorgs:
|
||||
assert blocks[-1].height == 199
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reorg_new_ref(empty_blockchain, bt):
|
||||
b = empty_blockchain
|
||||
wallet_a = WalletTool(b.constants)
|
||||
@@ -3384,7 +3384,7 @@ async def test_reorg_new_ref(empty_blockchain, bt):
|
||||
# this test doesn't reorg, but _reconsider_peak() is passed a stale
|
||||
# "fork_height" to make it look like it's in a reorg, but all the same blocks
|
||||
# are just added back.
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reorg_stale_fork_height(empty_blockchain, bt):
|
||||
b = empty_blockchain
|
||||
wallet_a = WalletTool(b.constants)
|
||||
@@ -3431,7 +3431,7 @@ async def test_reorg_stale_fork_height(empty_blockchain, bt):
|
||||
assert b.get_peak().height == 13
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_chain_failed_rollback(empty_blockchain, bt):
|
||||
b = empty_blockchain
|
||||
wallet_a = WalletTool(b.constants)
|
||||
@@ -3487,7 +3487,7 @@ async def test_chain_failed_rollback(empty_blockchain, bt):
|
||||
assert b.get_peak().height == 19
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reorg_flip_flop(empty_blockchain, bt):
|
||||
b = empty_blockchain
|
||||
wallet_a = WalletTool(b.constants)
|
||||
|
||||
@@ -30,7 +30,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestBlockchainTransactions:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_blockchain_tx(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -94,7 +94,7 @@ class TestBlockchainTransactions:
|
||||
assert not unspent.spent
|
||||
assert not unspent.coinbase
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_blockchain_with_double_spend(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -134,7 +134,7 @@ class TestBlockchainTransactions:
|
||||
next_block = new_blocks[-1]
|
||||
await _validate_and_add_block(full_node_1.blockchain, next_block, expected_error=Err.DOUBLE_SPEND)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_blockchain_duplicate_output(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -174,7 +174,7 @@ class TestBlockchainTransactions:
|
||||
next_block = new_blocks[-1]
|
||||
await _validate_and_add_block(full_node_1.blockchain, next_block, expected_error=Err.DUPLICATE_OUTPUT)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_blockchain_with_reorg_double_spend(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -283,7 +283,7 @@ class TestBlockchainTransactions:
|
||||
for block in new_blocks_reorg:
|
||||
await full_node_api_1.full_node.add_block(block)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_blockchain_spend_reorg_coin(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools], softfork_height: uint32
|
||||
) -> None:
|
||||
@@ -371,7 +371,7 @@ class TestBlockchainTransactions:
|
||||
|
||||
await full_node_api_1.full_node.add_block(new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_blockchain_spend_reorg_cb_coin(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -416,7 +416,7 @@ class TestBlockchainTransactions:
|
||||
|
||||
await full_node_api_1.full_node.add_block(new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_blockchain_spend_reorg_since_genesis(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -467,7 +467,7 @@ class TestBlockchainTransactions:
|
||||
|
||||
await full_node_api_1.full_node.add_block(new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_my_coin_id(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -539,7 +539,7 @@ class TestBlockchainTransactions:
|
||||
)
|
||||
await _validate_and_add_block(full_node_1.blockchain, new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_coin_announcement_consumed(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -623,7 +623,7 @@ class TestBlockchainTransactions:
|
||||
# Try to validate newly created block
|
||||
await _validate_and_add_block(full_node_1.blockchain, new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_puzzle_announcement_consumed(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -707,7 +707,7 @@ class TestBlockchainTransactions:
|
||||
# Try to validate newly created block
|
||||
await _validate_and_add_block(full_node_1.blockchain, new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_height_absolute(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -773,7 +773,7 @@ class TestBlockchainTransactions:
|
||||
)
|
||||
await _validate_and_add_block(full_node_1.blockchain, new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_height_relative(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -841,7 +841,7 @@ class TestBlockchainTransactions:
|
||||
)
|
||||
await _validate_and_add_block(full_node_1.blockchain, new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_seconds_relative(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -913,7 +913,7 @@ class TestBlockchainTransactions:
|
||||
)
|
||||
await _validate_and_add_block(full_node_1.blockchain, valid_new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_seconds_absolute(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
@@ -987,7 +987,7 @@ class TestBlockchainTransactions:
|
||||
)
|
||||
await _validate_and_add_block(full_node_1.blockchain, valid_new_blocks[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_fee_condition(
|
||||
self, two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
|
||||
@@ -80,7 +80,7 @@ async def make_and_spend_bundle(
|
||||
raise AssertionError(fail_msg)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("version", [0, 1])
|
||||
async def test_singleton_top_layer(version, cost_logger):
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
|
||||
@@ -10,7 +10,7 @@ from chia.types.coin_spend import CoinSpend
|
||||
from chia.types.spend_bundle import SpendBundle
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farming():
|
||||
async with sim_and_client(pass_prefarm=False) as (sim, _):
|
||||
for i in range(0, 5):
|
||||
@@ -21,7 +21,7 @@ async def test_farming():
|
||||
assert sim.block_records[0].reward_claims_incorporated[0].amount == 18375000000000000000
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_rewind():
|
||||
async with sim_and_client() as (sim, _):
|
||||
for i in range(0, 5):
|
||||
@@ -35,7 +35,7 @@ async def test_rewind():
|
||||
assert sim.blocks[-1].height == 5
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_all_endpoints():
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
for i in range(0, 5):
|
||||
|
||||
@@ -20,7 +20,7 @@ from chia.wallet.wallet_node import WalletNode
|
||||
from chia.wallet.wallet_node_api import WalletNodeAPI
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farm_summary_command(
|
||||
capsys: CaptureFixture[str],
|
||||
farmer_one_harvester_simulator_wallet: Tuple[
|
||||
|
||||
+61
-51
@@ -1,6 +1,7 @@
|
||||
# flake8: noqa E402 # See imports after multiprocessing.set_start_method
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import dataclasses
|
||||
import datetime
|
||||
import functools
|
||||
@@ -15,7 +16,6 @@ from typing import Any, AsyncIterator, Callable, Dict, Iterator, List, Tuple, Un
|
||||
|
||||
import aiohttp
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
# TODO: update after resolution in https://github.com/pytest-dev/pytest/issues/7469
|
||||
from _pytest.fixtures import SubRequest
|
||||
@@ -77,6 +77,16 @@ from chia.simulator.setup_nodes import setup_farmer_multi_harvester
|
||||
from chia.util.keyring_wrapper import KeyringWrapper
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
@pytest.fixture(name="event_loop")
|
||||
async def event_loop_fixture() -> asyncio.events.AbstractEventLoop:
|
||||
return asyncio.get_running_loop()
|
||||
|
||||
|
||||
@pytest.fixture(name="seeded_random")
|
||||
def seeded_random_fixture() -> random.Random:
|
||||
seeded_random = random.Random()
|
||||
@@ -173,15 +183,15 @@ def blockchain_constants(consensus_mode) -> ConsensusConstants:
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", name="bt")
|
||||
def block_tools_fixture(get_keychain, blockchain_constants) -> BlockTools:
|
||||
async def block_tools_fixture(get_keychain, blockchain_constants, anyio_backend) -> BlockTools:
|
||||
# Note that this causes a lot of CPU and disk traffic - disk, DB, ports, process creation ...
|
||||
_shared_block_tools = create_block_tools(constants=blockchain_constants, keychain=get_keychain)
|
||||
_shared_block_tools = await create_block_tools_async(constants=blockchain_constants, keychain=get_keychain)
|
||||
return _shared_block_tools
|
||||
|
||||
|
||||
# if you have a system that has an unusual hostname for localhost and you want
|
||||
# to run the tests, change the `self_hostname` fixture
|
||||
@pytest_asyncio.fixture(scope="session")
|
||||
@pytest.fixture(scope="session")
|
||||
def self_hostname():
|
||||
return "127.0.0.1"
|
||||
|
||||
@@ -195,7 +205,7 @@ def self_hostname():
|
||||
# the fixtures below. Just be aware of the filesystem modification during bt fixture creation
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def empty_blockchain(latest_db_version, blockchain_constants):
|
||||
"""
|
||||
Provides a list of 10 valid blocks, as well as a blockchain with 9 blocks added to it.
|
||||
@@ -454,7 +464,7 @@ def pytest_collection_modifyitems(session, config: pytest.Config, items: List[py
|
||||
raise Exception("\n".join(all_error_lines))
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def node_with_params(request, blockchain_constants: ConsensusConstants):
|
||||
params = {}
|
||||
if request:
|
||||
@@ -463,31 +473,31 @@ async def node_with_params(request, blockchain_constants: ConsensusConstants):
|
||||
yield sims[0]
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def two_nodes(db_version: int, self_hostname, blockchain_constants: ConsensusConstants):
|
||||
async with setup_two_nodes(blockchain_constants, db_version=db_version, self_hostname=self_hostname) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def setup_two_nodes_fixture(db_version: int, blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(2, 0, blockchain_constants, db_version=db_version) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def three_nodes(db_version: int, self_hostname, blockchain_constants):
|
||||
async with setup_n_nodes(blockchain_constants, 3, db_version=db_version, self_hostname=self_hostname) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def five_nodes(db_version: int, self_hostname, blockchain_constants):
|
||||
async with setup_n_nodes(blockchain_constants, 5, db_version=db_version, self_hostname=self_hostname) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def wallet_nodes(blockchain_constants, consensus_mode):
|
||||
constants = blockchain_constants
|
||||
async with setup_simulators_and_wallets(
|
||||
@@ -504,31 +514,31 @@ async def wallet_nodes(blockchain_constants, consensus_mode):
|
||||
yield full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def setup_four_nodes(db_version, blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(4, 0, blockchain_constants, db_version=db_version) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def two_nodes_sim_and_wallets_services(blockchain_constants, consensus_mode):
|
||||
async with setup_simulators_and_wallets_service(2, 0, blockchain_constants) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def one_wallet_and_one_simulator_services(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets_service(1, 1, blockchain_constants) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def wallet_node_100_pk(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(1, 1, blockchain_constants, initial_num_public_keys=100) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def simulator_and_wallet(
|
||||
blockchain_constants: ConsensusConstants,
|
||||
) -> AsyncIterator[Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools]]:
|
||||
@@ -536,7 +546,7 @@ async def simulator_and_wallet(
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def two_wallet_nodes(request, blockchain_constants: ConsensusConstants):
|
||||
params = {}
|
||||
if request and request.param_index > 0:
|
||||
@@ -545,7 +555,7 @@ async def two_wallet_nodes(request, blockchain_constants: ConsensusConstants):
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def two_wallet_nodes_services(
|
||||
blockchain_constants: ConsensusConstants,
|
||||
) -> AsyncIterator[
|
||||
@@ -555,7 +565,7 @@ async def two_wallet_nodes_services(
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def two_wallet_nodes_custom_spam_filtering(
|
||||
spam_filter_after_n_txs, xch_spam_amount, blockchain_constants: ConsensusConstants
|
||||
):
|
||||
@@ -563,19 +573,19 @@ async def two_wallet_nodes_custom_spam_filtering(
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def three_sim_two_wallets(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(3, 2, blockchain_constants) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def setup_two_nodes_and_wallet(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(2, 1, blockchain_constants, db_version=2) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def setup_two_nodes_and_wallet_fast_retry(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(
|
||||
1, 1, blockchain_constants, config_overrides={"wallet.tx_resend_timeout_secs": 1}, db_version=2
|
||||
@@ -583,33 +593,33 @@ async def setup_two_nodes_and_wallet_fast_retry(blockchain_constants: ConsensusC
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def three_wallet_nodes(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(1, 3, blockchain_constants) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def wallet_two_node_simulator(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(2, 1, blockchain_constants) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def wallet_nodes_mempool_perf(bt):
|
||||
key_seed = bt.farmer_master_sk_entropy
|
||||
async with setup_simulators_and_wallets(2, 1, bt.constants, key_seed=key_seed) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def two_nodes_two_wallets_with_same_keys(bt) -> AsyncIterator[SimulatorsAndWallets]:
|
||||
key_seed = bt.farmer_master_sk_entropy
|
||||
async with setup_simulators_and_wallets(2, 2, bt.constants, key_seed=key_seed) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
@pytest.fixture
|
||||
async def wallet_nodes_perf(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(
|
||||
1, 1, blockchain_constants, config_overrides={"MEMPOOL_BLOCK_BUFFER": 1, "MAX_BLOCK_COST_CLVM": 11000000000}
|
||||
@@ -625,13 +635,13 @@ async def wallet_nodes_perf(blockchain_constants: ConsensusConstants):
|
||||
yield full_node_1, server_1, wallet_a, wallet_receiver, bt
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def three_nodes_two_wallets(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(3, 2, blockchain_constants) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def one_node(
|
||||
blockchain_constants: ConsensusConstants,
|
||||
) -> AsyncIterator[Tuple[List[Service], List[FullNodeSimulator], BlockTools]]:
|
||||
@@ -639,7 +649,7 @@ async def one_node(
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def one_node_one_block(
|
||||
blockchain_constants: ConsensusConstants,
|
||||
) -> AsyncIterator[Tuple[Union[FullNodeAPI, FullNodeSimulator], ChiaServer, BlockTools]]:
|
||||
@@ -667,7 +677,7 @@ async def one_node_one_block(
|
||||
yield full_node_1, server_1, bt
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def two_nodes_one_block(blockchain_constants: ConsensusConstants):
|
||||
async with setup_simulators_and_wallets(2, 0, blockchain_constants) as (nodes, _, bt):
|
||||
full_node_1 = nodes[0]
|
||||
@@ -695,7 +705,7 @@ async def two_nodes_one_block(blockchain_constants: ConsensusConstants):
|
||||
yield full_node_1, full_node_2, server_1, server_2, bt
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def farmer_one_harvester_simulator_wallet(
|
||||
tmp_path: Path,
|
||||
blockchain_constants: ConsensusConstants,
|
||||
@@ -720,13 +730,13 @@ async def farmer_one_harvester_simulator_wallet(
|
||||
FarmerOneHarvester = Tuple[List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools]
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def farmer_one_harvester(tmp_path: Path, get_b_tools: BlockTools) -> AsyncIterator[FarmerOneHarvester]:
|
||||
async with setup_farmer_multi_harvester(get_b_tools, 1, tmp_path, get_b_tools.constants, start_services=True) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def farmer_one_harvester_not_started(
|
||||
tmp_path: Path, get_b_tools: BlockTools
|
||||
) -> AsyncIterator[Tuple[List[Service], Service]]:
|
||||
@@ -734,7 +744,7 @@ async def farmer_one_harvester_not_started(
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def farmer_two_harvester_not_started(
|
||||
tmp_path: Path, get_b_tools: BlockTools
|
||||
) -> AsyncIterator[Tuple[List[Service], Service]]:
|
||||
@@ -742,7 +752,7 @@ async def farmer_two_harvester_not_started(
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def farmer_three_harvester_not_started(
|
||||
tmp_path: Path, get_b_tools: BlockTools
|
||||
) -> AsyncIterator[Tuple[List[Service], Service]]:
|
||||
@@ -750,7 +760,7 @@ async def farmer_three_harvester_not_started(
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def get_daemon(bt):
|
||||
async with setup_daemon(btools=bt) as _:
|
||||
yield _
|
||||
@@ -763,18 +773,18 @@ def empty_keyring():
|
||||
KeyringWrapper.cleanup_shared_instance()
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def get_temp_keyring():
|
||||
with TempKeyring() as keychain:
|
||||
yield keychain
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def get_b_tools_1(get_temp_keyring):
|
||||
return await create_block_tools_async(constants=test_constants_modified, keychain=get_temp_keyring)
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def get_b_tools(get_temp_keyring):
|
||||
local_b_tools = await create_block_tools_async(constants=test_constants_modified, keychain=get_temp_keyring)
|
||||
new_config = local_b_tools._config
|
||||
@@ -782,7 +792,7 @@ async def get_b_tools(get_temp_keyring):
|
||||
return local_b_tools
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def daemon_connection_and_temp_keychain(
|
||||
get_b_tools: BlockTools,
|
||||
) -> AsyncIterator[Tuple[aiohttp.ClientWebSocketResponse, Keychain]]:
|
||||
@@ -799,7 +809,7 @@ async def daemon_connection_and_temp_keychain(
|
||||
yield ws, keychain
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def wallets_prefarm_services(two_wallet_nodes_services, self_hostname, trusted, request):
|
||||
"""
|
||||
Sets up the node with 10 blocks, and returns a payer and payee wallet.
|
||||
@@ -862,12 +872,12 @@ async def wallets_prefarm_services(two_wallet_nodes_services, self_hostname, tru
|
||||
)
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def wallets_prefarm(wallets_prefarm_services):
|
||||
return wallets_prefarm_services[0], wallets_prefarm_services[1], wallets_prefarm_services[4]
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def three_wallets_prefarm(three_wallet_nodes, self_hostname, trusted):
|
||||
"""
|
||||
Sets up the node with 10 blocks, and returns a payer and payee wallet.
|
||||
@@ -919,25 +929,25 @@ async def three_wallets_prefarm(three_wallet_nodes, self_hostname, trusted):
|
||||
)
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def introducer_service(bt):
|
||||
async with setup_introducer(bt, 0) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def timelord(bt):
|
||||
async with setup_timelord(uint16(0), False, bt.constants, bt.config, bt.root_path) as service:
|
||||
yield service._api, service._node.server
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def timelord_service(bt: BlockTools) -> AsyncIterator[Service[Timelord, TimelordAPI]]:
|
||||
async with setup_timelord(uint16(0), False, bt.constants, bt.config, bt.root_path) as _:
|
||||
yield _
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def crawler_service(
|
||||
root_path_populated_with_config: Path, database_uri: str
|
||||
) -> AsyncIterator[Service[Crawler, CrawlerAPI]]:
|
||||
@@ -945,7 +955,7 @@ async def crawler_service(
|
||||
yield service
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def seeder_service(root_path_populated_with_config: Path, database_uri: str) -> AsyncIterator[DNSServer]:
|
||||
async with setup_seeder(root_path_populated_with_config, database_uri) as seeder:
|
||||
yield seeder
|
||||
@@ -1013,7 +1023,7 @@ def cost_logger_fixture() -> Iterator[CostLogger]:
|
||||
print(cost_logger.log_cost_statistics())
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def simulation(bt, get_b_tools):
|
||||
async with setup_full_system(test_constants_modified, bt, get_b_tools, db_version=2) as full_system:
|
||||
yield full_system, get_b_tools
|
||||
@@ -1024,7 +1034,7 @@ HarvesterFarmerEnvironment = Tuple[
|
||||
]
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def harvester_farmer_environment(
|
||||
farmer_one_harvester: Tuple[List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools],
|
||||
self_hostname: str,
|
||||
|
||||
@@ -23,7 +23,7 @@ async def cat_name_resolver(asset_id: bytes32) -> Optional[Tuple[Optional[uint32
|
||||
return TEST_ASSET_ID_NAME_MAPPING.get(asset_id)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_print_offer_summary_xch(capsys: Any) -> None:
|
||||
summary_dict = {"xch": 1_000_000_000_000}
|
||||
|
||||
@@ -34,7 +34,7 @@ async def test_print_offer_summary_xch(capsys: Any) -> None:
|
||||
assert "XCH (Wallet ID: 1): 1.0 (1000000000000 mojos)" in captured.out
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_print_offer_summary_cat(capsys: Any) -> None:
|
||||
summary_dict = {
|
||||
TEST_DUCKSAUCE_ASSET_ID: 1_000,
|
||||
@@ -47,7 +47,7 @@ async def test_print_offer_summary_cat(capsys: Any) -> None:
|
||||
assert "DuckSauce (Wallet ID: 2): 1.0 (1000 mojos)" in captured.out
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_print_offer_summary_multiple_cats(capsys: Any) -> None:
|
||||
summary_dict = {
|
||||
TEST_DUCKSAUCE_ASSET_ID: 1_000,
|
||||
@@ -62,7 +62,7 @@ async def test_print_offer_summary_multiple_cats(capsys: Any) -> None:
|
||||
assert "CrunchBerries (Wallet ID: 3): 2.0 (2000 mojos)" in captured.out
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_print_offer_summary_xch_and_cats(capsys: Any) -> None:
|
||||
summary_dict = {
|
||||
"xch": 2_500_000_000_000,
|
||||
@@ -81,7 +81,7 @@ async def test_print_offer_summary_xch_and_cats(capsys: Any) -> None:
|
||||
assert "UnicornTears (Wallet ID: 4): 3.333 (3333 mojos)" in captured.out
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_print_offer_summary_xch_and_cats_with_zero_values(capsys: Any) -> None:
|
||||
summary_dict = {
|
||||
"xch": 0,
|
||||
@@ -100,7 +100,7 @@ async def test_print_offer_summary_xch_and_cats_with_zero_values(capsys: Any) ->
|
||||
assert "UnicornTears (Wallet ID: 4): 0.0 (0 mojos)" in captured.out
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_print_offer_summary_cat_with_fee_and_change(capsys: Any) -> None:
|
||||
summary_dict = {
|
||||
TEST_DUCKSAUCE_ASSET_ID: 1_000,
|
||||
@@ -115,7 +115,7 @@ async def test_print_offer_summary_cat_with_fee_and_change(capsys: Any) -> None:
|
||||
assert "Unknown: 3456 mojos [Typically represents change returned from the included fee]" in captured.out
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_print_offer_summary_xch_with_one_mojo(capsys: Any) -> None:
|
||||
summary_dict = {"xch": 1}
|
||||
|
||||
|
||||
@@ -409,7 +409,7 @@ async def daemon_client_with_config_and_keys(get_keychain_for_function, get_daem
|
||||
return client
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_daemon_passthru(get_daemon, bt):
|
||||
ws_server = get_daemon
|
||||
config = bt.config
|
||||
@@ -530,14 +530,14 @@ def test_is_service_running_with_services_and_connections(
|
||||
assert daemon.is_service_running(service) == expected_result
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_running_services_no_services(mock_lonely_daemon):
|
||||
daemon = mock_lonely_daemon
|
||||
response = await daemon.running_services()
|
||||
assert_running_services_response(response, {"success": True, "running_services": []})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_running_services_with_services(mock_daemon_with_services):
|
||||
daemon = mock_daemon_with_services
|
||||
response = await daemon.running_services()
|
||||
@@ -546,7 +546,7 @@ async def test_running_services_with_services(mock_daemon_with_services):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_running_services_with_services_and_connections(mock_daemon_with_services_and_connections):
|
||||
daemon = mock_daemon_with_services_and_connections
|
||||
response = await daemon.running_services()
|
||||
@@ -555,7 +555,7 @@ async def test_running_services_with_services_and_connections(mock_daemon_with_s
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_routes(mock_lonely_daemon):
|
||||
daemon = mock_lonely_daemon
|
||||
response = await daemon.get_routes({})
|
||||
@@ -654,7 +654,7 @@ async def test_get_routes(mock_lonely_daemon):
|
||||
pubkeys_only=True,
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_wallet_addresses(
|
||||
mock_daemon_with_config_and_keys,
|
||||
monkeypatch,
|
||||
@@ -718,7 +718,7 @@ async def test_get_wallet_addresses(
|
||||
},
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_keys_for_plotting(
|
||||
mock_daemon_with_config_and_keys,
|
||||
monkeypatch,
|
||||
@@ -735,7 +735,7 @@ async def test_get_keys_for_plotting(
|
||||
response={},
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_keys_for_plotting_error(
|
||||
mock_daemon_with_config_and_keys,
|
||||
monkeypatch,
|
||||
@@ -746,9 +746,9 @@ async def test_get_keys_for_plotting_error(
|
||||
await daemon.get_keys_for_plotting(case.request)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_keys_for_plotting_client(daemon_client_with_config_and_keys):
|
||||
client = await daemon_client_with_config_and_keys
|
||||
client = daemon_client_with_config_and_keys
|
||||
response = await client.get_keys_for_plotting()
|
||||
assert response["data"]["success"] is True
|
||||
assert len(response["data"]["keys"]) == 2
|
||||
@@ -762,7 +762,7 @@ async def test_get_keys_for_plotting_client(daemon_client_with_config_and_keys):
|
||||
await client.close()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"service_request, expected_result, expected_exception",
|
||||
[
|
||||
@@ -784,7 +784,7 @@ async def test_is_running_no_services(mock_lonely_daemon, service_request, expec
|
||||
assert response == expected_result
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"service_request, expected_result, expected_exception",
|
||||
[
|
||||
@@ -823,7 +823,7 @@ async def test_is_running_with_services(
|
||||
assert response == expected_result
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"service_request, expected_result, expected_exception",
|
||||
[
|
||||
@@ -867,7 +867,7 @@ async def test_is_running_with_services_and_connections(
|
||||
assert response == expected_result
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_keyring_passphrase_rpc(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -915,7 +915,7 @@ async def test_validate_keyring_passphrase_rpc(daemon_connection_and_temp_keycha
|
||||
assert_response(await ws.receive(), empty_passphrase_response_data)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_add_private_key(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -971,7 +971,7 @@ async def test_add_private_key(daemon_connection_and_temp_keychain):
|
||||
assert_response(await ws.receive(), invalid_mnemonic_response_data)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_add_private_key_label(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -1008,7 +1008,7 @@ async def test_add_private_key_label(daemon_connection_and_temp_keychain):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_key(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -1042,7 +1042,7 @@ async def test_get_key(daemon_connection_and_temp_keychain):
|
||||
assert_response(await ws.receive(), fingerprint_not_found_response_data(123456))
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_keys(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -1073,7 +1073,7 @@ async def test_get_keys(daemon_connection_and_temp_keychain):
|
||||
assert_response(await ws.receive(), get_keys_response_data(keys_added))
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_public_key(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -1095,7 +1095,7 @@ async def test_get_public_key(daemon_connection_and_temp_keychain):
|
||||
assert key in allowed_keys, f"Unexpected key '{key}' found in response."
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_public_keys(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -1124,7 +1124,7 @@ async def test_get_public_keys(daemon_connection_and_temp_keychain):
|
||||
assert key in allowed_keys, f"Unexpected key '{key}' found in response."
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_key_renaming(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
keychain.add_private_key(test_key_data.mnemonic_str())
|
||||
@@ -1148,7 +1148,7 @@ async def test_key_renaming(daemon_connection_and_temp_keychain):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_key_label_deletion(daemon_connection_and_temp_keychain):
|
||||
ws, keychain = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -1221,7 +1221,7 @@ async def test_key_label_deletion(daemon_connection_and_temp_keychain):
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_key_label_methods(
|
||||
daemon_connection_and_temp_keychain, method: str, parameter: Dict[str, Any], response_data_dict: Dict[str, Any]
|
||||
) -> None:
|
||||
@@ -1231,7 +1231,7 @@ async def test_key_label_methods(
|
||||
assert_response(await ws.receive(), response_data_dict)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_json(daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain]) -> None:
|
||||
ws, _ = daemon_connection_and_temp_keychain
|
||||
|
||||
@@ -1329,7 +1329,7 @@ async def test_bad_json(daemon_connection_and_temp_keychain: Tuple[aiohttp.Clien
|
||||
},
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_misc_daemon_ws(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain],
|
||||
case: RouteCase,
|
||||
@@ -1343,7 +1343,7 @@ async def test_misc_daemon_ws(
|
||||
assert_response(response, case.response)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unexpected_json(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain]
|
||||
) -> None:
|
||||
@@ -1363,7 +1363,7 @@ async def test_unexpected_json(
|
||||
"command_to_test",
|
||||
[("start_service"), ("stop_service"), ("start_plotting"), ("stop_plotting"), ("is_running"), ("register_service")],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_commands_with_no_data(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain], command_to_test: str
|
||||
) -> None:
|
||||
@@ -1407,7 +1407,7 @@ async def test_commands_with_no_data(
|
||||
response={"success": True, "error": None},
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_set_keyring_passphrase_ws(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain],
|
||||
case: RouteCase,
|
||||
@@ -1510,7 +1510,7 @@ async def test_set_keyring_passphrase_ws(
|
||||
response={"success": True, "error": None},
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_passphrase_apis(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain],
|
||||
case: RouteCase,
|
||||
@@ -1547,7 +1547,7 @@ async def test_passphrase_apis(
|
||||
response={"success": False, "error": "validation exception"},
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_keyring_file_deleted(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain],
|
||||
case: RouteCase,
|
||||
@@ -1605,7 +1605,7 @@ async def test_keyring_file_deleted(
|
||||
},
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_plotter_errors(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain], case: RouteCase
|
||||
) -> None:
|
||||
@@ -1718,7 +1718,7 @@ async def test_plotter_errors(
|
||||
},
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_plotter_options(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain],
|
||||
get_b_tools: BlockTools,
|
||||
@@ -1784,7 +1784,7 @@ def check_plot_queue_log(
|
||||
return plot_info["log_new"].startswith(expected_log_entry)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_plotter_roundtrip(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain], get_b_tools: BlockTools
|
||||
) -> None:
|
||||
@@ -1856,7 +1856,7 @@ async def test_plotter_roundtrip(
|
||||
assert_plot_queue_response(response, "state_changed", "state_changed", plot_id, "FINISHED")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_plotter_stop_plotting(
|
||||
daemon_connection_and_temp_keychain: Tuple[aiohttp.ClientWebSocketResponse, Keychain], get_b_tools: BlockTools
|
||||
) -> None:
|
||||
|
||||
@@ -8,7 +8,7 @@ from chia.simulator.block_tools import BlockTools
|
||||
from chia.util.ws_message import create_payload
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_multiple_register_same(get_daemon: WebSocketServer, bt: BlockTools) -> None:
|
||||
ws_server = get_daemon
|
||||
config = bt.config
|
||||
@@ -35,7 +35,7 @@ async def test_multiple_register_same(get_daemon: WebSocketServer, bt: BlockTool
|
||||
assert len(connections) == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_multiple_register_different(get_daemon: WebSocketServer, bt: BlockTools) -> None:
|
||||
ws_server = get_daemon
|
||||
config = bt.config
|
||||
@@ -71,7 +71,7 @@ async def test_multiple_register_different(get_daemon: WebSocketServer, bt: Bloc
|
||||
assert connections == set()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_remove_connection(get_daemon: WebSocketServer, bt: BlockTools) -> None:
|
||||
ws_server = get_daemon
|
||||
config = bt.config
|
||||
|
||||
@@ -5,7 +5,6 @@ from dataclasses import replace
|
||||
from typing import AsyncGenerator
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate
|
||||
from chia.simulator.block_tools import BlockTools
|
||||
@@ -17,7 +16,7 @@ TEST_KEY_2 = KeyData.generate(label="👨✈️🥦")
|
||||
TEST_KEY_3 = KeyData.generate(label="☕️🍬")
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def keychain_proxy(get_b_tools: BlockTools) -> AsyncGenerator[KeychainProxy, None]:
|
||||
async with setup_daemon(btools=get_b_tools) as daemon:
|
||||
log = logging.getLogger("keychain_proxy_fixture")
|
||||
@@ -27,14 +26,14 @@ async def keychain_proxy(get_b_tools: BlockTools) -> AsyncGenerator[KeychainProx
|
||||
await keychain_proxy.close()
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def keychain_proxy_with_keys(keychain_proxy: KeychainProxy) -> KeychainProxy:
|
||||
await keychain_proxy.add_private_key(TEST_KEY_1.mnemonic_str(), TEST_KEY_1.label)
|
||||
await keychain_proxy.add_private_key(TEST_KEY_2.mnemonic_str(), TEST_KEY_2.label)
|
||||
return keychain_proxy
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_add_private_key(keychain_proxy: KeychainProxy) -> None:
|
||||
keychain = keychain_proxy
|
||||
await keychain.add_private_key(TEST_KEY_3.mnemonic_str(), TEST_KEY_3.label)
|
||||
@@ -43,7 +42,7 @@ async def test_add_private_key(keychain_proxy: KeychainProxy) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("include_secrets", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_key(keychain_proxy_with_keys: KeychainProxy, include_secrets: bool) -> None:
|
||||
keychain = keychain_proxy_with_keys
|
||||
key = await keychain.get_key(TEST_KEY_1.fingerprint, include_secrets=include_secrets)
|
||||
@@ -52,7 +51,7 @@ async def test_get_key(keychain_proxy_with_keys: KeychainProxy, include_secrets:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("include_secrets", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_keys(keychain_proxy_with_keys: KeychainProxy, include_secrets: bool) -> None:
|
||||
keychain = keychain_proxy_with_keys
|
||||
keys = await keychain.get_keys(include_secrets=include_secrets)
|
||||
|
||||
@@ -7,7 +7,6 @@ import time
|
||||
from typing import Any, AsyncIterable, Awaitable, Callable, Dict, Iterator
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
# https://github.com/pytest-dev/pytest/issues/7469
|
||||
from _pytest.fixtures import SubRequest
|
||||
@@ -60,14 +59,14 @@ def tree_id_fixture() -> bytes32:
|
||||
return bytes32(pad + base)
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(name="raw_data_store", scope="function")
|
||||
@pytest.fixture(name="raw_data_store", scope="function")
|
||||
async def raw_data_store_fixture(database_uri: str) -> AsyncIterable[DataStore]:
|
||||
store = await DataStore.create(database=database_uri, uri=True)
|
||||
yield store
|
||||
await store.close()
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(name="data_store", scope="function")
|
||||
@pytest.fixture(name="data_store", scope="function")
|
||||
async def data_store_fixture(raw_data_store: DataStore, tree_id: bytes32) -> AsyncIterable[DataStore]:
|
||||
await raw_data_store.create_tree(tree_id=tree_id, status=Status.COMMITTED)
|
||||
|
||||
@@ -81,7 +80,7 @@ def node_type_fixture(request: SubRequest) -> NodeType:
|
||||
return request.param # type: ignore[no-any-return]
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(name="valid_node_values")
|
||||
@pytest.fixture(name="valid_node_values")
|
||||
async def valid_node_values_fixture(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
|
||||
@@ -10,7 +10,7 @@ from tests.core.data_layer.util import ChiaRoot
|
||||
pytestmark = pytest.mark.data_layer
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_help(chia_root: ChiaRoot) -> None:
|
||||
"""Just a trivial test to make sure the subprocessing is at least working and the
|
||||
data executable does run.
|
||||
@@ -20,7 +20,7 @@ async def test_help(chia_root: ChiaRoot) -> None:
|
||||
|
||||
|
||||
@pytest.mark.skip
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
def test_round_trip(chia_root: ChiaRoot, chia_daemon: None, chia_data: None) -> None:
|
||||
"""Create a table, insert a row, get the row by its hash."""
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ from typing import Any, AsyncIterator, Awaitable, Callable, Dict, List, Optional
|
||||
|
||||
import aiohttp
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from aiohttp import web
|
||||
|
||||
from chia.data_layer.data_layer import DataLayer
|
||||
@@ -31,7 +30,7 @@ class SufficientWalletRpcClient:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="enable", argvalues=[True, False], ids=["log", "do not log"])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sql_logs(enable: bool, config: Dict[str, Any], tmp_chia_root: Path) -> None:
|
||||
config["data_layer"]["log_sqlite_cmds"] = enable
|
||||
|
||||
@@ -99,7 +98,7 @@ class RecordingWebServer:
|
||||
await self.web_server.await_closed()
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(name="recording_web_server")
|
||||
@pytest.fixture(name="recording_web_server")
|
||||
async def recording_web_server_fixture(self_hostname: str) -> AsyncIterator[RecordingWebServer]:
|
||||
server = await RecordingWebServer.create(
|
||||
hostname=self_hostname,
|
||||
@@ -111,7 +110,7 @@ async def recording_web_server_fixture(self_hostname: str) -> AsyncIterator[Reco
|
||||
await server.await_closed()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_plugin_requests_use_custom_headers(
|
||||
recording_web_server: RecordingWebServer,
|
||||
config: Dict[str, Any],
|
||||
|
||||
@@ -15,7 +15,6 @@ from typing import Any, AsyncIterator, Dict, List, Optional, Tuple, cast
|
||||
|
||||
import anyio
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from chia.cmds.data_funcs import clear_pending_roots, wallet_log_in_cmd
|
||||
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
||||
@@ -109,7 +108,7 @@ async def init_data_layer(
|
||||
yield data_layer_service._api.data_layer
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(name="bare_data_layer_api")
|
||||
@pytest.fixture(name="bare_data_layer_api")
|
||||
async def bare_data_layer_api_fixture(tmp_path: Path, bt: BlockTools) -> AsyncIterator[DataLayerRpcApi]:
|
||||
# we won't use this port, this fixture is for _just_ a data layer rpc
|
||||
port = uint16(1)
|
||||
@@ -215,7 +214,7 @@ def create_mnemonic(seed: bytes = b"ab") -> str:
|
||||
return bytes_to_mnemonic(mnemonic_bytes=bytes(random_.randrange(256) for _ in range(32)))
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_insert_get(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -265,7 +264,7 @@ async def test_create_insert_get(
|
||||
await data_rpc_api.batch_update({"id": store_id.hex(), "changelist": changelist})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_upsert(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -295,7 +294,7 @@ async def test_upsert(
|
||||
assert hexstr_to_bytes(res["value"]) == value
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_double_insert(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -332,7 +331,7 @@ async def test_create_double_insert(
|
||||
await data_rpc_api.get_value({"id": store_id.hex(), "key": key1.hex()})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_keys_values_ancestors(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -403,7 +402,7 @@ async def test_keys_values_ancestors(
|
||||
assert len(pairs_after["keys_values"]) == len(keys_after["keys"]) == 7
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_roots(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -456,7 +455,7 @@ async def test_get_roots(
|
||||
assert roots["root_hashes"][1]["timestamp"] > 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_root_history(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -510,7 +509,7 @@ async def test_get_root_history(
|
||||
assert history2["root_history"][2]["timestamp"] > history2["root_history"][1]["timestamp"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_kv_diff(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -577,7 +576,7 @@ async def test_get_kv_diff(
|
||||
assert diff1 in diff_res["diff"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_batch_update_matches_single_operations(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -649,7 +648,7 @@ async def test_batch_update_matches_single_operations(
|
||||
assert batch_hash == expected_res_hash
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_owned_stores(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -689,7 +688,7 @@ async def test_get_owned_stores(
|
||||
assert store_ids == sorted(expected_store_ids)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_subscriptions(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -736,7 +735,7 @@ class OfferSetup:
|
||||
full_node_api: FullNodeSimulator
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(name="offer_setup")
|
||||
@pytest.fixture(name="offer_setup")
|
||||
async def offer_setup_fixture(
|
||||
self_hostname: str,
|
||||
two_wallet_nodes_services: SimulatorsAndWalletsServices,
|
||||
@@ -1482,7 +1481,7 @@ make_one_take_one_unpopulated_reference = MakeAndTakeReference(
|
||||
pytest.param(make_one_take_one_unpopulated_reference, id="one for one unpopulated"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_make_and_take_offer(offer_setup: OfferSetup, reference: MakeAndTakeReference) -> None:
|
||||
offer_setup = await populate_offer_setup(offer_setup=offer_setup, count=reference.entries_to_insert)
|
||||
|
||||
@@ -1569,7 +1568,7 @@ async def test_make_and_take_offer(offer_setup: OfferSetup, reference: MakeAndTa
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize(argnames="maker_or_taker", argvalues=["maker", "taker"])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_make_and_then_take_offer_invalid_inclusion_key(
|
||||
reference: MakeAndTakeReference,
|
||||
maker_or_taker: str,
|
||||
@@ -1594,7 +1593,7 @@ async def test_make_and_then_take_offer_invalid_inclusion_key(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_verify_offer_rpc_valid(bare_data_layer_api: DataLayerRpcApi) -> None:
|
||||
reference = make_one_take_one_reference
|
||||
|
||||
@@ -1612,7 +1611,7 @@ async def test_verify_offer_rpc_valid(bare_data_layer_api: DataLayerRpcApi) -> N
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_verify_offer_rpc_invalid(bare_data_layer_api: DataLayerRpcApi) -> None:
|
||||
reference = make_one_take_one_reference
|
||||
broken_taker_offer = copy.deepcopy(reference.make_offer_response)
|
||||
@@ -1632,7 +1631,7 @@ async def test_verify_offer_rpc_invalid(bare_data_layer_api: DataLayerRpcApi) ->
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_make_offer_failure_rolls_back_db(offer_setup: OfferSetup) -> None:
|
||||
# TODO: only needs the maker and db? wallet?
|
||||
reference = make_one_take_one_reference
|
||||
@@ -1674,7 +1673,7 @@ async def test_make_offer_failure_rolls_back_db(offer_setup: OfferSetup) -> None
|
||||
pytest.param(make_one_take_one_unpopulated_reference, id="one for one unpopulated"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_make_and_cancel_offer(offer_setup: OfferSetup, reference: MakeAndTakeReference) -> None:
|
||||
offer_setup = await populate_offer_setup(offer_setup=offer_setup, count=reference.entries_to_insert)
|
||||
|
||||
@@ -1750,7 +1749,7 @@ async def test_make_and_cancel_offer(offer_setup: OfferSetup, reference: MakeAnd
|
||||
pytest.param(False, id="insecure"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_make_and_cancel_offer_then_update(
|
||||
offer_setup: OfferSetup, reference: MakeAndTakeReference, secure: bool
|
||||
) -> None:
|
||||
@@ -1839,7 +1838,7 @@ async def test_make_and_cancel_offer_then_update(
|
||||
pytest.param(make_one_take_one_unpopulated_reference, id="one for one unpopulated"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_make_and_cancel_offer_not_secure_clears_pending_roots(
|
||||
offer_setup: OfferSetup,
|
||||
reference: MakeAndTakeReference,
|
||||
@@ -1881,7 +1880,7 @@ async def test_make_and_cancel_offer_not_secure_clears_pending_roots(
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="does not depend on consensus rules")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_sync_status(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -1938,7 +1937,7 @@ async def test_get_sync_status(
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="does not depend on consensus rules")
|
||||
@pytest.mark.parametrize(argnames="layer", argvalues=list(InterfaceLayer))
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_clear_pending_roots(
|
||||
self_hostname: str,
|
||||
one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices,
|
||||
@@ -2035,7 +2034,7 @@ async def test_clear_pending_roots(
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="does not depend on consensus rules")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_issue_15955_deadlock(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, tmp_path: Path
|
||||
) -> None:
|
||||
@@ -2091,7 +2090,7 @@ async def test_issue_15955_deadlock(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="maximum_full_file_count", argvalues=[1, 5, 100])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_maximum_full_file_count(
|
||||
self_hostname: str,
|
||||
one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices,
|
||||
@@ -2144,7 +2143,7 @@ async def test_maximum_full_file_count(
|
||||
|
||||
@pytest.mark.parametrize("retain", [True, False])
|
||||
@pytest.mark.limit_consensus_modes(reason="does not depend on consensus rules")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unsubscribe_removes_files(
|
||||
self_hostname: str,
|
||||
one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices,
|
||||
@@ -2194,7 +2193,7 @@ async def test_unsubscribe_removes_files(
|
||||
|
||||
@pytest.mark.parametrize(argnames="layer", argvalues=list(InterfaceLayer))
|
||||
@pytest.mark.limit_consensus_modes(reason="does not depend on consensus rules")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_wallet_log_in_changes_active_fingerprint(
|
||||
self_hostname: str,
|
||||
one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices,
|
||||
|
||||
@@ -62,7 +62,7 @@ table_columns: Dict[str, List[str]] = {
|
||||
# and with good error messages.
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_valid_node_values_fixture_are_valid(data_store: DataStore, valid_node_values: Dict[str, Any]) -> None:
|
||||
async with data_store.db_wrapper.writer() as writer:
|
||||
await writer.execute(
|
||||
@@ -75,7 +75,7 @@ async def test_valid_node_values_fixture_are_valid(data_store: DataStore, valid_
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames=["table_name", "expected_columns"], argvalues=table_columns.items())
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_creates_tables_and_columns(
|
||||
database_uri: str, table_name: str, expected_columns: List[str]
|
||||
) -> None:
|
||||
@@ -102,7 +102,7 @@ async def test_create_creates_tables_and_columns(
|
||||
await db_wrapper.close()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_tree_accepts_bytes32(raw_data_store: DataStore) -> None:
|
||||
tree_id = bytes32(b"\0" * 32)
|
||||
|
||||
@@ -110,7 +110,7 @@ async def test_create_tree_accepts_bytes32(raw_data_store: DataStore) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames=["length"], argvalues=[[length] for length in [*range(0, 32), *range(33, 48)]])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_tree_fails_for_not_bytes32(raw_data_store: DataStore, length: int) -> None:
|
||||
bad_tree_id = b"\0" * length
|
||||
|
||||
@@ -120,7 +120,7 @@ async def test_create_tree_fails_for_not_bytes32(raw_data_store: DataStore, leng
|
||||
await raw_data_store.create_tree(tree_id=bad_tree_id) # type: ignore[arg-type]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_trees(raw_data_store: DataStore) -> None:
|
||||
expected_tree_ids = set()
|
||||
|
||||
@@ -134,13 +134,13 @@ async def test_get_trees(raw_data_store: DataStore) -> None:
|
||||
assert tree_ids == expected_tree_ids
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_table_is_empty(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
is_empty = await data_store.table_is_empty(tree_id=tree_id)
|
||||
assert is_empty
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_table_is_not_empty(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
key = b"\x01\x02"
|
||||
value = b"abc"
|
||||
@@ -158,7 +158,7 @@ async def test_table_is_not_empty(data_store: DataStore, tree_id: bytes32) -> No
|
||||
assert not is_empty
|
||||
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# @pytest.mark.anyio
|
||||
# async def test_create_root_provides_bytes32(raw_data_store: DataStore, tree_id: bytes32) -> None:
|
||||
# await raw_data_store.create_tree(tree_id=tree_id)
|
||||
# # TODO: catchup with the node_hash=
|
||||
@@ -167,7 +167,7 @@ async def test_table_is_not_empty(data_store: DataStore, tree_id: bytes32) -> No
|
||||
# assert isinstance(root_hash, bytes32)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_insert_over_empty(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
key = b"\x01\x02"
|
||||
value = b"abc"
|
||||
@@ -176,7 +176,7 @@ async def test_insert_over_empty(data_store: DataStore, tree_id: bytes32) -> Non
|
||||
assert insert_result.node_hash == leaf_hash(key=key, value=value)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_insert_increments_generation(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
keys = [b"a", b"b", b"c", b"d"] # efghijklmnopqrstuvwxyz")
|
||||
value = b"\x01\x02\x03"
|
||||
@@ -202,7 +202,7 @@ async def test_insert_increments_generation(data_store: DataStore, tree_id: byte
|
||||
assert generations == expected
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_tree_generation_returns_none_when_none_available(
|
||||
raw_data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -211,7 +211,7 @@ async def test_get_tree_generation_returns_none_when_none_available(
|
||||
await raw_data_store.get_tree_generation(tree_id=tree_id)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_insert_internal_node_does_nothing_if_matching(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -232,7 +232,7 @@ async def test_insert_internal_node_does_nothing_if_matching(data_store: DataSto
|
||||
assert after == before
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_insert_terminal_node_does_nothing_if_matching(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -251,7 +251,7 @@ async def test_insert_terminal_node_does_nothing_if_matching(data_store: DataSto
|
||||
assert after == before
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_build_a_tree(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -266,7 +266,7 @@ async def test_build_a_tree(
|
||||
assert actual == example.expected
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_node_by_key(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
example = await add_0123_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -278,7 +278,7 @@ async def test_get_node_by_key(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
assert actual.hash == key_node_hash
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_ancestors(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
example = await add_0123_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -297,7 +297,7 @@ async def test_get_ancestors(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
assert ancestors == ancestors_2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_ancestors_optimized(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
ancestors: List[Tuple[int, bytes32, List[InternalNode]]] = []
|
||||
random = Random()
|
||||
@@ -371,7 +371,7 @@ async def test_get_ancestors_optimized(data_store: DataStore, tree_id: bytes32)
|
||||
assert current_ancestors == expected_ancestors
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"use_optimized",
|
||||
[True, False],
|
||||
@@ -457,7 +457,7 @@ async def test_batch_update(data_store: DataStore, tree_id: bytes32, use_optimiz
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="side", argvalues=list(Side))
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_insert_batch_reference_and_side(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -496,7 +496,7 @@ async def test_insert_batch_reference_and_side(
|
||||
raise Exception("invalid side for test")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_ancestor_table_unique_inserts(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
await add_0123_example(data_store=data_store, tree_id=tree_id)
|
||||
hash_1 = bytes32.from_hexstr("0763561814685fbf92f6ca71fbb1cb11821951450d996375c239979bd63e9535")
|
||||
@@ -508,7 +508,7 @@ async def test_ancestor_table_unique_inserts(data_store: DataStore, tree_id: byt
|
||||
await data_store._insert_ancestor_table(hash_1, hash_2, tree_id, 2)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_pairs(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -521,7 +521,7 @@ async def test_get_pairs(
|
||||
assert [node.hash for node in pairs] == example.terminal_nodes
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_pairs_when_empty(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
pairs = await data_store.get_keys_values(tree_id=tree_id)
|
||||
|
||||
@@ -533,7 +533,7 @@ async def test_get_pairs_when_empty(data_store: DataStore, tree_id: bytes32) ->
|
||||
argvalues=[[b"\x06", b"\x06"], [b"\x06", b"\x07"]],
|
||||
ids=["same values", "different values"],
|
||||
)
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_inserting_duplicate_key_fails(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -573,7 +573,7 @@ async def test_inserting_duplicate_key_fails(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_inserting_invalid_length_hash_raises_original_exception(
|
||||
data_store: DataStore,
|
||||
) -> None:
|
||||
@@ -589,7 +589,7 @@ async def test_inserting_invalid_length_hash_raises_original_exception(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_inserting_invalid_length_ancestor_hash_raises_original_exception(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -604,7 +604,7 @@ async def test_inserting_invalid_length_ancestor_hash_raises_original_exception(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_autoinsert_balances_from_scratch(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
random = Random()
|
||||
random.seed(100, version=2)
|
||||
@@ -623,7 +623,7 @@ async def test_autoinsert_balances_from_scratch(data_store: DataStore, tree_id:
|
||||
assert 11 <= statistics.mean(heights.values()) <= 12
|
||||
|
||||
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_autoinsert_balances_gaps(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
random = Random()
|
||||
random.seed(101, version=2)
|
||||
@@ -660,7 +660,7 @@ async def test_autoinsert_balances_gaps(data_store: DataStore, tree_id: bytes32)
|
||||
"use_hint",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_delete_from_left_both_terminal(data_store: DataStore, tree_id: bytes32, use_hint: bool) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -702,7 +702,7 @@ async def test_delete_from_left_both_terminal(data_store: DataStore, tree_id: by
|
||||
"use_hint",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_delete_from_left_other_not_terminal(data_store: DataStore, tree_id: bytes32, use_hint: bool) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -744,7 +744,7 @@ async def test_delete_from_left_other_not_terminal(data_store: DataStore, tree_i
|
||||
"use_hint",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_delete_from_right_both_terminal(data_store: DataStore, tree_id: bytes32, use_hint: bool) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -786,7 +786,7 @@ async def test_delete_from_right_both_terminal(data_store: DataStore, tree_id: b
|
||||
"use_hint",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_delete_from_right_other_not_terminal(data_store: DataStore, tree_id: bytes32, use_hint: bool) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -824,7 +824,7 @@ async def test_delete_from_right_other_not_terminal(data_store: DataStore, tree_
|
||||
assert result == expected
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_proof_of_inclusion_by_hash(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
"""A proof of inclusion contains the expected sibling side, sibling hash, combined
|
||||
hash, key, value, and root hash values.
|
||||
@@ -860,7 +860,7 @@ async def test_proof_of_inclusion_by_hash(data_store: DataStore, tree_id: bytes3
|
||||
assert proof == ProofOfInclusion(node_hash=node.hash, layers=expected_layers)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_proof_of_inclusion_by_hash_no_ancestors(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
"""Check proper proof of inclusion creation when the node being proved is the root."""
|
||||
await data_store.autoinsert(key=b"\x04", value=b"\x03", tree_id=tree_id, status=Status.COMMITTED)
|
||||
@@ -873,7 +873,7 @@ async def test_proof_of_inclusion_by_hash_no_ancestors(data_store: DataStore, tr
|
||||
assert proof == ProofOfInclusion(node_hash=node.hash, layers=[])
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_proof_of_inclusion_by_hash_program(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
"""The proof of inclusion program has the expected Python equivalence."""
|
||||
|
||||
@@ -892,7 +892,7 @@ async def test_proof_of_inclusion_by_hash_program(data_store: DataStore, tree_id
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_proof_of_inclusion_by_hash_equals_by_key(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
"""The proof of inclusion is equal between hash and key requests."""
|
||||
|
||||
@@ -905,7 +905,7 @@ async def test_proof_of_inclusion_by_hash_equals_by_key(data_store: DataStore, t
|
||||
assert proof_by_hash == proof_by_key
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_proof_of_inclusion_by_hash_bytes(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
"""The proof of inclusion provided by the data store is able to be converted to a
|
||||
program and subsequently to bytes.
|
||||
@@ -926,7 +926,7 @@ async def test_proof_of_inclusion_by_hash_bytes(data_store: DataStore, tree_id:
|
||||
assert bytes(proof.as_program()) == expected
|
||||
|
||||
|
||||
# @pytest.mark.asyncio
|
||||
# @pytest.mark.anyio
|
||||
# async def test_create_first_pair(data_store: DataStore, tree_id: bytes) -> None:
|
||||
# key = SExp.to([1, 2])
|
||||
# value = SExp.to(b'abc')
|
||||
@@ -950,7 +950,7 @@ valid_program_hex = Program.to((b"abc", 2)).as_bin().hex()
|
||||
invalid_program_hex = b"\xab\xcd".hex()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_check_roots_are_incrementing_missing_zero(raw_data_store: DataStore) -> None:
|
||||
tree_id = hexstr_to_bytes("c954ab71ffaf5b0f129b04b35fdc7c84541f4375167e730e2646bfcfdb7cf2cd")
|
||||
|
||||
@@ -976,7 +976,7 @@ async def test_check_roots_are_incrementing_missing_zero(raw_data_store: DataSto
|
||||
await raw_data_store._check_roots_are_incrementing()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_check_roots_are_incrementing_gap(raw_data_store: DataStore) -> None:
|
||||
tree_id = hexstr_to_bytes("c954ab71ffaf5b0f129b04b35fdc7c84541f4375167e730e2646bfcfdb7cf2cd")
|
||||
|
||||
@@ -1002,7 +1002,7 @@ async def test_check_roots_are_incrementing_gap(raw_data_store: DataStore) -> No
|
||||
await raw_data_store._check_roots_are_incrementing()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_check_hashes_internal(raw_data_store: DataStore) -> None:
|
||||
async with raw_data_store.db_wrapper.writer() as writer:
|
||||
await writer.execute(
|
||||
@@ -1022,7 +1022,7 @@ async def test_check_hashes_internal(raw_data_store: DataStore) -> None:
|
||||
await raw_data_store._check_hashes()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_check_hashes_terminal(raw_data_store: DataStore) -> None:
|
||||
async with raw_data_store.db_wrapper.writer() as writer:
|
||||
await writer.execute(
|
||||
@@ -1042,7 +1042,7 @@ async def test_check_hashes_terminal(raw_data_store: DataStore) -> None:
|
||||
await raw_data_store._check_hashes()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_state(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
key = b"\x01\x02"
|
||||
value = b"abc"
|
||||
@@ -1053,7 +1053,7 @@ async def test_root_state(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
assert is_empty
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_change_root_state(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
key = b"\x01\x02"
|
||||
value = b"abc"
|
||||
@@ -1073,7 +1073,7 @@ async def test_change_root_state(data_store: DataStore, tree_id: bytes32) -> Non
|
||||
assert root.node_hash is not None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_kv_diff(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
random = Random()
|
||||
random.seed(100, version=2)
|
||||
@@ -1118,7 +1118,7 @@ async def test_kv_diff(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
assert diffs == expected_diff
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_kv_diff_2(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
insert_result = await data_store.insert(
|
||||
key=b"000",
|
||||
@@ -1137,7 +1137,7 @@ async def test_kv_diff_2(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
assert diff_3 == set()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_rollback_to_generation(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
await add_0123_example(data_store, tree_id)
|
||||
expected_hashes = []
|
||||
@@ -1150,7 +1150,7 @@ async def test_rollback_to_generation(data_store: DataStore, tree_id: bytes32) -
|
||||
assert root.node_hash == expected_hash
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_subscribe_unsubscribe(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
await data_store.subscribe(Subscription(tree_id, [ServerInfo("http://127:0:0:1/8000", 1, 1)]))
|
||||
subscriptions = await data_store.get_subscriptions()
|
||||
@@ -1197,7 +1197,7 @@ async def test_subscribe_unsubscribe(data_store: DataStore, tree_id: bytes32) ->
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_server_selection(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
start_timestamp = 1000
|
||||
await data_store.subscribe(
|
||||
@@ -1262,7 +1262,7 @@ async def test_server_selection(data_store: DataStore, tree_id: bytes32) -> None
|
||||
"test_delta",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_data_server_files(data_store: DataStore, tree_id: bytes32, test_delta: bool, tmp_path: Path) -> None:
|
||||
roots: List[Root] = []
|
||||
num_batches = 10
|
||||
@@ -1313,7 +1313,7 @@ async def test_data_server_files(data_store: DataStore, tree_id: bytes32, test_d
|
||||
generation += 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_pending_roots(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
key = b"\x01\x02"
|
||||
value = b"abc"
|
||||
@@ -1345,7 +1345,7 @@ async def test_pending_roots(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
assert pending_root is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_clear_pending_roots_returns_root(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
key = b"\x01\x02"
|
||||
value = b"abc"
|
||||
@@ -1398,7 +1398,7 @@ class BatchInsertBenchmarkCase:
|
||||
limit=36,
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_benchmark_batch_insert_speed(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
|
||||
@@ -13,7 +13,7 @@ from tests.core.data_layer.util import add_01234567_example, create_valid_node_v
|
||||
pytestmark = pytest.mark.data_layer
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_node_update_fails(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
node = await data_store.get_node_by_key(key=b"\x04", tree_id=tree_id)
|
||||
@@ -30,7 +30,7 @@ async def test_node_update_fails(data_store: DataStore, tree_id: bytes32) -> Non
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="length", argvalues=sorted(set(range(50)) - {32}))
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_node_hash_must_be_32(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -50,7 +50,7 @@ async def test_node_hash_must_be_32(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_node_hash_must_not_be_null(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -69,7 +69,7 @@ async def test_node_hash_must_not_be_null(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_node_type_must_be_valid(
|
||||
data_store: DataStore,
|
||||
node_type: NodeType,
|
||||
@@ -90,7 +90,7 @@ async def test_node_type_must_be_valid(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="side", argvalues=Side)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_node_internal_child_not_null(data_store: DataStore, tree_id: bytes32, side: Side) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
node_a = await data_store.get_node_by_key(key=b"\x02", tree_id=tree_id)
|
||||
@@ -116,7 +116,7 @@ async def test_node_internal_child_not_null(data_store: DataStore, tree_id: byte
|
||||
|
||||
@pytest.mark.parametrize(argnames="bad_child_hash", argvalues=[b"\x01" * 32, b"\0" * 31, b""])
|
||||
@pytest.mark.parametrize(argnames="side", argvalues=Side)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_node_internal_must_be_valid_reference(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -148,7 +148,7 @@ async def test_node_internal_must_be_valid_reference(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="key_or_value", argvalues=["key", "value"])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_node_terminal_key_value_not_null(data_store: DataStore, tree_id: bytes32, key_or_value: str) -> None:
|
||||
await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
|
||||
@@ -167,7 +167,7 @@ async def test_node_terminal_key_value_not_null(data_store: DataStore, tree_id:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="length", argvalues=sorted(set(range(50)) - {32}))
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_tree_id_must_be_32(data_store: DataStore, tree_id: bytes32, length: int) -> None:
|
||||
example = await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
bad_tree_id = bytes([0] * length)
|
||||
@@ -184,7 +184,7 @@ async def test_root_tree_id_must_be_32(data_store: DataStore, tree_id: bytes32,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_tree_id_must_not_be_null(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
example = await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
values = {"tree_id": None, "generation": 0, "node_hash": example.terminal_nodes[0], "status": Status.PENDING}
|
||||
@@ -201,7 +201,7 @@ async def test_root_tree_id_must_not_be_null(data_store: DataStore, tree_id: byt
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="generation", argvalues=[-200, -2, -1])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_generation_must_not_be_less_than_zero(
|
||||
data_store: DataStore, tree_id: bytes32, generation: int
|
||||
) -> None:
|
||||
@@ -224,7 +224,7 @@ async def test_root_generation_must_not_be_less_than_zero(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_generation_must_not_be_null(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
example = await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
values = {
|
||||
@@ -245,7 +245,7 @@ async def test_root_generation_must_not_be_null(data_store: DataStore, tree_id:
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_node_hash_must_reference(data_store: DataStore) -> None:
|
||||
values = {"tree_id": bytes32([0] * 32), "generation": 0, "node_hash": bytes32([0] * 32), "status": Status.PENDING}
|
||||
|
||||
@@ -261,7 +261,7 @@ async def test_root_node_hash_must_reference(data_store: DataStore) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="bad_status", argvalues=sorted(set(range(-20, 20)) - {*Status}))
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_status_must_be_valid(data_store: DataStore, tree_id: bytes32, bad_status: int) -> None:
|
||||
example = await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
values = {
|
||||
@@ -282,7 +282,7 @@ async def test_root_status_must_be_valid(data_store: DataStore, tree_id: bytes32
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_status_must_not_be_null(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
example = await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
values = {"tree_id": bytes32([0] * 32), "generation": 0, "node_hash": example.terminal_nodes[0], "status": None}
|
||||
@@ -298,7 +298,7 @@ async def test_root_status_must_not_be_null(data_store: DataStore, tree_id: byte
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_root_tree_id_generation_must_be_unique(data_store: DataStore, tree_id: bytes32) -> None:
|
||||
example = await add_01234567_example(data_store=data_store, tree_id=tree_id)
|
||||
values = {"tree_id": tree_id, "generation": 0, "node_hash": example.terminal_nodes[0], "status": Status.COMMITTED}
|
||||
@@ -315,7 +315,7 @@ async def test_root_tree_id_generation_must_be_unique(data_store: DataStore, tre
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="length", argvalues=sorted(set(range(50)) - {32}))
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_ancestors_ancestor_must_be_32(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -334,7 +334,7 @@ async def test_ancestors_ancestor_must_be_32(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="length", argvalues=sorted(set(range(50)) - {32}))
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_ancestors_tree_id_must_be_32(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
@@ -353,7 +353,7 @@ async def test_ancestors_tree_id_must_be_32(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="length", argvalues=sorted(set(range(50)) - {32}))
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_subscriptions_tree_id_must_be_32(
|
||||
data_store: DataStore,
|
||||
tree_id: bytes32,
|
||||
|
||||
@@ -26,7 +26,7 @@ async def begin_task(coro: Coroutine[Any, Any, T]) -> Task[T]:
|
||||
return task
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_ignores_concurrent_duplicate_signage_points(
|
||||
farmer_one_harvester: FarmerOneHarvester, self_hostname: str
|
||||
) -> None:
|
||||
@@ -54,7 +54,7 @@ async def test_farmer_ignores_concurrent_duplicate_signage_points(
|
||||
assert ProtocolMessageTypes(response).name == "new_signage_point_harvester"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_responds_with_signed_values(farmer_one_harvester: FarmerOneHarvester, self_hostname: str) -> None:
|
||||
_, farmer_service, _ = farmer_one_harvester
|
||||
farmer_api: FarmerAPI = farmer_service._api
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Iterator
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
# This is an optimization to reduce runtime by reducing setup and teardown on the
|
||||
# wallet nodes fixture below.
|
||||
# https://github.com/pytest-dev/pytest-asyncio/blob/v0.18.1/pytest_asyncio/plugin.py#L479-L484
|
||||
@pytest.fixture(scope="module")
|
||||
def event_loop(request: pytest.FixtureRequest) -> Iterator[asyncio.AbstractEventLoop]:
|
||||
"""Create an instance of the default event loop for each test case."""
|
||||
loop = asyncio.get_event_loop_policy().new_event_loop()
|
||||
yield loop
|
||||
loop.close()
|
||||
@@ -27,7 +27,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestFullSync:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_long_sync_from_zero(self, five_nodes, default_400_blocks, bt, self_hostname):
|
||||
# Must be larger than "sync_block_behind_threshold" in the config
|
||||
num_blocks = len(default_400_blocks)
|
||||
@@ -113,7 +113,7 @@ class TestFullSync:
|
||||
await time_out_assert(timeout_seconds, node_height_exactly, True, full_node_5, 409)
|
||||
await time_out_assert(timeout_seconds, node_height_exactly, True, full_node_1, 409)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_from_fork_point_and_weight_proof(
|
||||
self, three_nodes, default_1000_blocks, default_400_blocks, self_hostname
|
||||
):
|
||||
@@ -186,7 +186,7 @@ class TestFullSync:
|
||||
await time_out_assert(180, node_height_exactly, True, full_node_1, 999)
|
||||
await time_out_assert(180, node_height_exactly, True, full_node_2, 999)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_batch_sync(self, two_nodes, self_hostname):
|
||||
# Must be below "sync_block_behind_threshold" in the config
|
||||
num_blocks = 20
|
||||
@@ -209,7 +209,7 @@ class TestFullSync:
|
||||
)
|
||||
await time_out_assert(60, node_height_exactly, True, full_node_2, num_blocks - 1)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_backtrack_sync_1(self, two_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, bt = two_nodes
|
||||
blocks = bt.get_consecutive_blocks(1, skip_slots=1)
|
||||
@@ -226,7 +226,7 @@ class TestFullSync:
|
||||
)
|
||||
await time_out_assert(60, node_height_exactly, True, full_node_2, 2)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_backtrack_sync_2(self, two_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, bt = two_nodes
|
||||
blocks = bt.get_consecutive_blocks(1, skip_slots=3)
|
||||
@@ -242,7 +242,7 @@ class TestFullSync:
|
||||
)
|
||||
await time_out_assert(60, node_height_exactly, True, full_node_2, 8)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_close_height_but_big_reorg(self, three_nodes, bt, self_hostname):
|
||||
blocks_a = bt.get_consecutive_blocks(50)
|
||||
blocks_b = bt.get_consecutive_blocks(51, seed=b"B")
|
||||
@@ -280,7 +280,7 @@ class TestFullSync:
|
||||
await time_out_assert(80, node_height_exactly, True, full_node_2, 89)
|
||||
await time_out_assert(80, node_height_exactly, True, full_node_3, 89)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_bad_peak_while_synced(
|
||||
self, three_nodes, default_1000_blocks, default_1500_blocks, self_hostname
|
||||
):
|
||||
@@ -326,7 +326,7 @@ class TestFullSync:
|
||||
|
||||
assert node_height_exactly(full_node_2, 999)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_ses_mismatch(self, two_nodes, default_1000_blocks, self_hostname, monkeypatch):
|
||||
full_node_1, full_node_2, server_1, server_2, _ = two_nodes
|
||||
blocks = default_1000_blocks
|
||||
@@ -372,7 +372,7 @@ class TestFullSync:
|
||||
# assert we failed somewhere between sub epoch 0 to sub epoch 1
|
||||
assert node_height_between(full_node_2, summary_heights[0], summary_heights[1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.skip("skipping until we re-enable the capability in chia.protocols.shared_protocol")
|
||||
async def test_sync_none_wp_response_backward_comp(self, three_nodes, default_1000_blocks, self_hostname):
|
||||
num_blocks_initial = len(default_1000_blocks) - 50
|
||||
@@ -418,7 +418,7 @@ class TestFullSync:
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.skip("This feature depends on (now removed) CHIP-13")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_peak_in_cache(
|
||||
self, two_nodes, default_400_blocks, blockchain_constants, self_hostname, consensus_mode
|
||||
):
|
||||
@@ -445,7 +445,7 @@ class TestFullSync:
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.skip("This feature depends on (now removed) CHIP-13")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_skip_bad_peak_validation(
|
||||
self, two_nodes, default_400_blocks, blockchain_constants, self_hostname, consensus_mode
|
||||
):
|
||||
@@ -470,7 +470,7 @@ class TestFullSync:
|
||||
with pytest.raises(ValueError, match="Weight proof failed bad peak cache validation"):
|
||||
await full_node_1.full_node.request_validate_wp(peak.header_hash, peak.height, peak.weight)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_peak_cache_invalidation(
|
||||
self, two_nodes, default_1000_blocks, blockchain_constants, consensus_mode
|
||||
):
|
||||
|
||||
@@ -41,7 +41,7 @@ def use_cache(request: SubRequest) -> bool:
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_store(tmp_dir: Path, db_version: int, bt: BlockTools, use_cache: bool) -> None:
|
||||
assert sqlite3.threadsafety >= 1
|
||||
|
||||
@@ -129,7 +129,7 @@ async def test_block_store(tmp_dir: Path, db_version: int, bt: BlockTools, use_c
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_deadlock(tmp_dir: Path, db_version: int, bt: BlockTools, use_cache: bool) -> None:
|
||||
"""
|
||||
This test was added because the store was deadlocking in certain situations, when fetching and
|
||||
@@ -162,7 +162,7 @@ async def test_deadlock(tmp_dir: Path, db_version: int, bt: BlockTools, use_cach
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_rollback(bt: BlockTools, tmp_dir: Path, use_cache: bool) -> None:
|
||||
blocks = bt.get_consecutive_blocks(10)
|
||||
|
||||
@@ -208,7 +208,7 @@ async def test_rollback(bt: BlockTools, tmp_dir: Path, use_cache: bool) -> None:
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_count_compactified_blocks(bt: BlockTools, tmp_dir: Path, db_version: int, use_cache: bool) -> None:
|
||||
blocks = bt.get_consecutive_blocks(10)
|
||||
|
||||
@@ -228,7 +228,7 @@ async def test_count_compactified_blocks(bt: BlockTools, tmp_dir: Path, db_versi
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_count_uncompactified_blocks(bt: BlockTools, tmp_dir: Path, db_version: int, use_cache: bool) -> None:
|
||||
blocks = bt.get_consecutive_blocks(10)
|
||||
|
||||
@@ -248,7 +248,7 @@ async def test_count_uncompactified_blocks(bt: BlockTools, tmp_dir: Path, db_ver
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_replace_proof(bt: BlockTools, tmp_dir: Path, db_version: int, use_cache: bool) -> None:
|
||||
blocks = bt.get_consecutive_blocks(10)
|
||||
|
||||
@@ -295,7 +295,7 @@ async def test_replace_proof(bt: BlockTools, tmp_dir: Path, db_version: int, use
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_generator(bt: BlockTools, db_version: int, use_cache: bool) -> None:
|
||||
blocks = bt.get_consecutive_blocks(10)
|
||||
|
||||
@@ -335,7 +335,7 @@ async def test_get_generator(bt: BlockTools, db_version: int, use_cache: bool) -
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_blocks_by_hash(tmp_dir: Path, bt: BlockTools, db_version: int, use_cache: bool) -> None:
|
||||
assert sqlite3.threadsafety >= 1
|
||||
blocks = bt.get_consecutive_blocks(10)
|
||||
@@ -374,7 +374,7 @@ async def test_get_blocks_by_hash(tmp_dir: Path, bt: BlockTools, db_version: int
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_block_bytes_in_range(tmp_dir: Path, bt: BlockTools, db_version: int, use_cache: bool) -> None:
|
||||
assert sqlite3.threadsafety >= 1
|
||||
blocks = bt.get_consecutive_blocks(10)
|
||||
@@ -402,14 +402,14 @@ async def test_get_block_bytes_in_range(tmp_dir: Path, bt: BlockTools, db_versio
|
||||
await store_2.get_block_bytes_in_range(0, 10)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unsupported_version(tmp_dir: Path, use_cache: bool) -> None:
|
||||
with pytest.raises(RuntimeError, match="BlockStore does not support database schema v1"):
|
||||
async with DBConnection(1) as db_wrapper:
|
||||
await BlockStore.create(db_wrapper, use_cache=use_cache)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_peak(tmp_dir: Path, db_version: int, use_cache: bool) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
store = await BlockStore.create(db_wrapper, use_cache=use_cache)
|
||||
|
||||
@@ -51,7 +51,7 @@ def get_future_reward_coins(block: FullBlock) -> Tuple[Coin, Coin]:
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_coin_store(db_version: int, softfork_height: uint32, bt: BlockTools) -> None:
|
||||
wallet_a = WALLET_A
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
@@ -162,7 +162,7 @@ async def test_basic_coin_store(db_version: int, softfork_height: uint32, bt: Bl
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_set_spent(db_version: int, bt: BlockTools) -> None:
|
||||
blocks = bt.get_consecutive_blocks(9, [])
|
||||
|
||||
@@ -207,7 +207,7 @@ async def test_set_spent(db_version: int, bt: BlockTools) -> None:
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_num_unspent(bt: BlockTools, db_version: int) -> None:
|
||||
blocks = bt.get_consecutive_blocks(37, [])
|
||||
|
||||
@@ -241,7 +241,7 @@ async def test_num_unspent(bt: BlockTools, db_version: int) -> None:
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_rollback(db_version: int, bt: BlockTools) -> None:
|
||||
blocks = bt.get_consecutive_blocks(20)
|
||||
|
||||
@@ -327,7 +327,7 @@ async def test_rollback(db_version: int, bt: BlockTools) -> None:
|
||||
assert record is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_reorg(tmp_dir: Path, db_version: int, bt: BlockTools) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
initial_block_count = 30
|
||||
@@ -380,7 +380,7 @@ async def test_basic_reorg(tmp_dir: Path, db_version: int, bt: BlockTools) -> No
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_puzzle_hash(tmp_dir: Path, db_version: int, bt: BlockTools) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
num_blocks = 20
|
||||
@@ -410,7 +410,7 @@ async def test_get_puzzle_hash(tmp_dir: Path, db_version: int, bt: BlockTools) -
|
||||
b.shut_down()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_coin_states(db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
crs = [
|
||||
@@ -493,7 +493,7 @@ async def test_get_coin_states(db_version: int) -> None:
|
||||
assert len(await coin_store.get_coin_states_by_ids(True, coins, uint32(0), max_items=10000)) == 600
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unsupported_version() -> None:
|
||||
with pytest.raises(RuntimeError, match="CoinStore does not support database schema v1"):
|
||||
async with DBConnection(1) as db_wrapper:
|
||||
|
||||
@@ -6,7 +6,6 @@ import random
|
||||
from typing import AsyncIterator, List, Optional
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from chia.consensus.blockchain import AddBlockResult, Blockchain
|
||||
from chia.consensus.constants import ConsensusConstants
|
||||
@@ -32,7 +31,7 @@ from tests.util.blockchain import create_blockchain
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def custom_block_tools(blockchain_constants: ConsensusConstants) -> AsyncIterator[BlockTools]:
|
||||
with TempKeyring() as keychain:
|
||||
patched_constants = dataclasses.replace(
|
||||
@@ -43,7 +42,7 @@ async def custom_block_tools(blockchain_constants: ConsensusConstants) -> AsyncI
|
||||
yield await create_block_tools_async(constants=patched_constants, keychain=keychain)
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def empty_blockchain(db_version: int, blockchain_constants: ConsensusConstants) -> AsyncIterator[Blockchain]:
|
||||
patched_constants = dataclasses.replace(
|
||||
blockchain_constants,
|
||||
@@ -56,7 +55,7 @@ async def empty_blockchain(db_version: int, blockchain_constants: ConsensusConst
|
||||
bc1.shut_down()
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def empty_blockchain_with_original_constants(
|
||||
db_version: int, blockchain_constants: ConsensusConstants
|
||||
) -> AsyncIterator[Blockchain]:
|
||||
@@ -67,7 +66,7 @@ async def empty_blockchain_with_original_constants(
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("normalized_to_identity", [False, True])
|
||||
async def test_basic_store(
|
||||
empty_blockchain: Blockchain,
|
||||
@@ -927,7 +926,7 @@ async def test_basic_store(
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_long_chain_slots(
|
||||
empty_blockchain_with_original_constants: Blockchain,
|
||||
default_1000_blocks: List[FullBlock],
|
||||
|
||||
@@ -22,7 +22,7 @@ from tests.util.db_connection import DBConnection
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_store(db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
hint_store = await HintStore.create(db_wrapper)
|
||||
@@ -48,7 +48,7 @@ async def test_basic_store(db_version: int) -> None:
|
||||
assert coins_for_non_hint == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_duplicate_coins(db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
hint_store = await HintStore.create(db_wrapper)
|
||||
@@ -66,7 +66,7 @@ async def test_duplicate_coins(db_version: int) -> None:
|
||||
assert coin_id_0 in coins_for_hint_1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_duplicate_hints(db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
hint_store = await HintStore.create(db_wrapper)
|
||||
@@ -86,7 +86,7 @@ async def test_duplicate_hints(db_version: int) -> None:
|
||||
assert coins_for_hint_1 == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_duplicates(db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
hint_store = await HintStore.create(db_wrapper)
|
||||
@@ -108,7 +108,7 @@ async def test_duplicates(db_version: int) -> None:
|
||||
assert rows[0][0] == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_hints_in_blockchain(
|
||||
wallet_nodes: Tuple[
|
||||
FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
|
||||
@@ -153,7 +153,7 @@ async def test_hints_in_blockchain(
|
||||
assert get_hint[0] == Coin(coin_spent.name(), puzzle_hash, uint64(1)).name()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_counts(db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
hint_store = await HintStore.create(db_wrapper)
|
||||
@@ -172,7 +172,7 @@ async def test_counts(db_version: int) -> None:
|
||||
assert count == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_limits(db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
hint_store = await HintStore.create(db_wrapper)
|
||||
@@ -192,7 +192,7 @@ async def test_limits(db_version: int) -> None:
|
||||
assert len(await hint_store.get_coin_ids(hint, max_items=10000)) == 200
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unsupported_version() -> None:
|
||||
with pytest.raises(RuntimeError, match="HintStore does not support database schema v1"):
|
||||
async with DBConnection(1) as db_wrapper:
|
||||
|
||||
@@ -41,7 +41,7 @@ class AddressManagerTest(AddressManager):
|
||||
|
||||
|
||||
class TestPeerManager:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addr_manager(self):
|
||||
addrman = AddressManagerTest()
|
||||
# Test: Does Addrman respond correctly when empty.
|
||||
@@ -76,7 +76,7 @@ class TestPeerManager:
|
||||
assert await addrman2.add_peer_info(peers)
|
||||
assert await addrman2.size() >= 1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addr_manager_ports(self):
|
||||
addrman = AddressManagerTest()
|
||||
assert await addrman.size() == 0
|
||||
@@ -102,7 +102,7 @@ class TestPeerManager:
|
||||
|
||||
# This is a fleaky test, since it uses randomness.
|
||||
# TODO: Make sure it always succeeds.
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_select(self):
|
||||
addrman = AddressManagerTest()
|
||||
source = PeerInfo("252.2.2.2", 8444)
|
||||
@@ -158,7 +158,7 @@ class TestPeerManager:
|
||||
break
|
||||
assert len(ports) == 3
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_collisions_new(self):
|
||||
addrman = AddressManagerTest()
|
||||
assert await addrman.size() == 0
|
||||
@@ -178,7 +178,7 @@ class TestPeerManager:
|
||||
assert await addrman.add_peer_info([peer2], source)
|
||||
assert await addrman.size() == 8
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_collisions_tried(self):
|
||||
addrman = AddressManagerTest()
|
||||
assert await addrman.size() == 0
|
||||
@@ -200,7 +200,7 @@ class TestPeerManager:
|
||||
assert await addrman.add_peer_info([peer2], source)
|
||||
assert await addrman.size() == 77
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_find(self):
|
||||
addrman = AddressManagerTest()
|
||||
assert await addrman.size() == 0
|
||||
@@ -231,7 +231,7 @@ class TestPeerManager:
|
||||
assert info3[0] is not None and info3[1] is not None
|
||||
assert info3[0].peer_info == peer3
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_create(self):
|
||||
addrman = AddressManagerTest()
|
||||
assert await addrman.size() == 0
|
||||
@@ -243,7 +243,7 @@ class TestPeerManager:
|
||||
info, _ = addrman.find_(peer1)
|
||||
assert info.peer_info == peer1
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_delete(self):
|
||||
addrman = AddressManagerTest()
|
||||
assert await addrman.size() == 0
|
||||
@@ -259,7 +259,7 @@ class TestPeerManager:
|
||||
info2, _ = addrman.find_(peer1)
|
||||
assert info2 is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_get_peers(self):
|
||||
addrman = AddressManagerTest()
|
||||
assert await addrman.size() == 0
|
||||
@@ -305,7 +305,7 @@ class TestPeerManager:
|
||||
percent = math.ceil(percent * 23 / 100)
|
||||
assert len(peers4) == percent
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_tried_bucket(self):
|
||||
peer1 = PeerInfo("250.1.1.1", 8444)
|
||||
t_peer1 = TimestampedPeerInfo("250.1.1.1", 8444, 0)
|
||||
@@ -352,7 +352,7 @@ class TestPeerManager:
|
||||
buckets.append(bucket)
|
||||
assert len(buckets) > 8
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_new_bucket(self):
|
||||
t_peer1 = TimestampedPeerInfo("250.1.2.1", 8444, 0)
|
||||
source1 = PeerInfo("250.1.2.1", 8444)
|
||||
@@ -407,7 +407,7 @@ class TestPeerManager:
|
||||
|
||||
assert len(buckets) > 64
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_select_collision_no_collision(self):
|
||||
addrman = AddressManagerTest()
|
||||
collision = await addrman.select_tried_collision()
|
||||
@@ -433,7 +433,7 @@ class TestPeerManager:
|
||||
collision = await addrman.select_tried_collision()
|
||||
assert collision is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_no_evict(self):
|
||||
addrman = AddressManagerTest()
|
||||
|
||||
@@ -483,7 +483,7 @@ class TestPeerManager:
|
||||
collision = await addrman.select_tried_collision()
|
||||
assert collision is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_addrman_eviction_works(self):
|
||||
addrman = AddressManagerTest()
|
||||
assert await addrman.size() == 0
|
||||
@@ -526,7 +526,7 @@ class TestPeerManager:
|
||||
await addrman.resolve_tried_collisions()
|
||||
assert await addrman.select_tried_collision() is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_serialization(self, tmp_path: Path):
|
||||
addrman = AddressManagerTest()
|
||||
@@ -572,7 +572,7 @@ class TestPeerManager:
|
||||
assert recovered == 3
|
||||
peers_dat_filename.unlink()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cleanup(self):
|
||||
addrman = AddressManagerTest()
|
||||
peer1 = TimestampedPeerInfo("250.250.2.1", 8444, 100000)
|
||||
|
||||
@@ -89,7 +89,7 @@ async def setup_chain(
|
||||
|
||||
|
||||
class TestBlockHeightMap:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_height_to_hash(self, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -104,7 +104,7 @@ class TestBlockHeightMap:
|
||||
for height in reversed(range(10)):
|
||||
assert height_map.get_hash(uint32(height)) == gen_block_hash(height)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_height_to_hash_long_chain(self, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -119,7 +119,7 @@ class TestBlockHeightMap:
|
||||
assert height_map.get_hash(uint32(height)) == gen_block_hash(height)
|
||||
|
||||
@pytest.mark.parametrize("ses_every", [20, 1])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_save_restore(self, ses_every: int, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -160,7 +160,7 @@ class TestBlockHeightMap:
|
||||
with pytest.raises(KeyError) as _:
|
||||
height_map.get_ses(uint32(height))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_restore_entire_chain(self, tmp_dir: Path, db_version: int) -> None:
|
||||
# this is a test where the height-to-hash and height-to-ses caches are
|
||||
# entirely unrelated to the database. Make sure they can both be fully
|
||||
@@ -193,7 +193,7 @@ class TestBlockHeightMap:
|
||||
with pytest.raises(KeyError) as _:
|
||||
height_map.get_ses(uint32(height))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_restore_ses_only(self, tmp_dir: Path, db_version: int) -> None:
|
||||
# this is a test where the height-to-hash is complete and correct but
|
||||
# sub epoch summaries are missing. We need to be able to restore them in
|
||||
@@ -225,7 +225,7 @@ class TestBlockHeightMap:
|
||||
with pytest.raises(KeyError) as _:
|
||||
height_map.get_ses(uint32(height))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_restore_extend(self, tmp_dir: Path, db_version: int) -> None:
|
||||
# test the case where the cache has fewer blocks than the DB, and that
|
||||
# we correctly load all the missing blocks from the DB to update the
|
||||
@@ -265,7 +265,7 @@ class TestBlockHeightMap:
|
||||
with pytest.raises(KeyError) as _:
|
||||
height_map.get_ses(uint32(height))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_height_to_hash_with_orphans(self, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -280,7 +280,7 @@ class TestBlockHeightMap:
|
||||
for height in range(10):
|
||||
assert height_map.get_hash(uint32(height)) == gen_block_hash(height)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_height_to_hash_update(self, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -301,7 +301,7 @@ class TestBlockHeightMap:
|
||||
|
||||
assert height_map.get_hash(uint32(10)) == gen_block_hash(100)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_update_ses(self, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -320,7 +320,7 @@ class TestBlockHeightMap:
|
||||
assert height_map.get_ses(uint32(10)) == gen_ses(10)
|
||||
assert height_map.get_hash(uint32(10)) == gen_block_hash(10)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_height_to_ses(self, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -345,7 +345,7 @@ class TestBlockHeightMap:
|
||||
with pytest.raises(KeyError) as _:
|
||||
height_map.get_ses(uint32(9))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_rollback(self, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -381,7 +381,7 @@ class TestBlockHeightMap:
|
||||
with pytest.raises(KeyError) as _:
|
||||
height_map.get_ses(uint32(8))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_rollback2(self, tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -412,7 +412,7 @@ class TestBlockHeightMap:
|
||||
with pytest.raises(KeyError) as _:
|
||||
height_map.get_ses(uint32(8))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cache_file_nothing_to_write(self, tmp_dir: Path, db_version: int) -> None:
|
||||
# This is a test where the height-to-hash data is entirely used from
|
||||
# the cache file and there is nothing to write in that file as a result.
|
||||
@@ -439,7 +439,7 @@ class TestBlockHeightMap:
|
||||
for idx in range(0, len(heights), 32):
|
||||
assert new_heights[idx : idx + 32] == heights[idx : idx + 32]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cache_file_replace_everything(self, tmp_dir: Path, db_version: int) -> None:
|
||||
# This is a test where the height-to-hash is entirely unrelated to the
|
||||
# database. Make sure it can be fully replaced
|
||||
@@ -461,7 +461,7 @@ class TestBlockHeightMap:
|
||||
for i in range(0, len(heights), 32):
|
||||
assert new_heights[i : i + 32] != heights[i : i + 32]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cache_file_extend(self, tmp_dir: Path, db_version: int) -> None:
|
||||
# Test the case where the cache has fewer blocks than the DB, and that
|
||||
# we correctly load all the missing blocks from the DB to update the
|
||||
@@ -488,7 +488,7 @@ class TestBlockHeightMap:
|
||||
for idx in range(0, len(heights), 32):
|
||||
assert new_heights[idx : idx + 32] == heights[idx : idx + 32]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cache_file_truncate(self, tmp_dir: Path, db_version: int) -> None:
|
||||
# Test the case where the cache has more blocks than the DB, the cache
|
||||
# file will be truncated
|
||||
@@ -515,14 +515,14 @@ class TestBlockHeightMap:
|
||||
assert new_heights[idx * 32 : idx * 32 + 32] == gen_block_hash(idx)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unsupported_version(tmp_dir: Path) -> None:
|
||||
with pytest.raises(RuntimeError, match="BlockHeightMap does not support database schema v1"):
|
||||
async with DBConnection(1) as db_wrapper:
|
||||
await BlockHeightMap.create(tmp_dir, db_wrapper)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_chain(tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
@@ -536,7 +536,7 @@ async def test_empty_chain(tmp_dir: Path, db_version: int) -> None:
|
||||
height_map.get_hash(uint32(0))
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_peak_only_chain(tmp_dir: Path, db_version: int) -> None:
|
||||
async with DBConnection(db_version) as db_wrapper:
|
||||
await setup_db(db_wrapper)
|
||||
|
||||
@@ -122,7 +122,7 @@ co = ConditionOpcode
|
||||
|
||||
|
||||
class TestConditions:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"opcode, expected_cost",
|
||||
[
|
||||
@@ -160,7 +160,7 @@ class TestConditions:
|
||||
assert new_block.transactions_info is not None
|
||||
assert new_block.transactions_info.cost - block_base_cost == expected_cost
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"condition, expected_cost",
|
||||
[
|
||||
@@ -187,7 +187,7 @@ class TestConditions:
|
||||
assert new_block.transactions_info is not None
|
||||
assert new_block.transactions_info.cost - block_base_cost == expected_cost
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"opcode,value,expected",
|
||||
[
|
||||
@@ -275,7 +275,7 @@ class TestConditions:
|
||||
conditions = Program.to(assemble(f"(({opcode[0]} {value}))"))
|
||||
await check_conditions(bt, conditions, expected_err=expected)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_my_id(self, bt):
|
||||
blocks = await initial_blocks(bt)
|
||||
coin = list(blocks[-2].get_included_reward_coins())[0]
|
||||
@@ -284,14 +284,14 @@ class TestConditions:
|
||||
conditions = Program.to(assemble(f"(({ConditionOpcode.ASSERT_MY_COIN_ID[0]} 0x{wrong_name.hex()}))"))
|
||||
await check_conditions(bt, conditions, expected_err=Err.ASSERT_MY_COIN_ID_FAILED)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_valid_my_id(self, bt):
|
||||
blocks = await initial_blocks(bt)
|
||||
coin = list(blocks[-2].get_included_reward_coins())[0]
|
||||
conditions = Program.to(assemble(f"(({ConditionOpcode.ASSERT_MY_COIN_ID[0]} 0x{coin.name().hex()}))"))
|
||||
await check_conditions(bt, conditions)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_coin_announcement(self, bt):
|
||||
blocks = await initial_blocks(bt)
|
||||
coin = list(blocks[-2].get_included_reward_coins())[0]
|
||||
@@ -304,7 +304,7 @@ class TestConditions:
|
||||
)
|
||||
await check_conditions(bt, conditions, expected_err=Err.ASSERT_ANNOUNCE_CONSUMED_FAILED)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_valid_coin_announcement(self, bt):
|
||||
blocks = await initial_blocks(bt)
|
||||
coin = list(blocks[-2].get_included_reward_coins())[0]
|
||||
@@ -317,7 +317,7 @@ class TestConditions:
|
||||
)
|
||||
await check_conditions(bt, conditions)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_puzzle_announcement(self, bt):
|
||||
announce = Announcement(EASY_PUZZLE_HASH, b"test_bad")
|
||||
conditions = Program.to(
|
||||
@@ -328,7 +328,7 @@ class TestConditions:
|
||||
)
|
||||
await check_conditions(bt, conditions, expected_err=Err.ASSERT_ANNOUNCE_CONSUMED_FAILED)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_valid_puzzle_announcement(self, bt):
|
||||
announce = Announcement(EASY_PUZZLE_HASH, b"test")
|
||||
conditions = Program.to(
|
||||
@@ -339,7 +339,7 @@ class TestConditions:
|
||||
)
|
||||
await check_conditions(bt, conditions)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"prefix, condition, num, expect_err",
|
||||
[
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import dataclasses
|
||||
import logging
|
||||
import random
|
||||
import time
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
from typing import Coroutine, Dict, List, Optional, Tuple
|
||||
|
||||
import pytest
|
||||
from blspy import AugSchemeMPL, G2Element, PrivateKey
|
||||
@@ -107,7 +108,7 @@ async def get_block_path(full_node: FullNodeAPI):
|
||||
return blocks_list
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_no_farmer(
|
||||
setup_two_nodes_and_wallet,
|
||||
default_1000_blocks: List[FullBlock],
|
||||
@@ -147,7 +148,7 @@ async def test_sync_no_farmer(
|
||||
|
||||
|
||||
class TestFullNodeBlockCompression:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("tx_size", [3000000000000])
|
||||
async def test_block_compression(
|
||||
self, setup_two_nodes_and_wallet, empty_blockchain, tx_size, self_hostname, consensus_mode
|
||||
@@ -473,13 +474,13 @@ class TestFullNodeBlockCompression:
|
||||
|
||||
|
||||
class TestFullNodeProtocol:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_spendbundle_serialization(self):
|
||||
sb: SpendBundle = make_spend_bundle(1)
|
||||
protocol_message = RespondTransaction(sb)
|
||||
assert bytes(sb) == bytes(protocol_message)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_inbound_connection_limit(self, setup_four_nodes, self_hostname):
|
||||
nodes, _, _ = setup_four_nodes
|
||||
server_1 = nodes[0].full_node.server
|
||||
@@ -491,7 +492,7 @@ class TestFullNodeProtocol:
|
||||
await server_i.start_client(PeerInfo(self_hostname, server_1.get_port()))
|
||||
assert len(server_1.get_connections(NodeType.FULL_NODE)) == 2
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_request_peers(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, _ = wallet_nodes
|
||||
full_node_2.full_node.full_node_peers.address_manager.make_private_subnets_valid()
|
||||
@@ -512,7 +513,7 @@ class TestFullNodeProtocol:
|
||||
await time_out_assert_custom_interval(10, 1, have_msgs, True)
|
||||
full_node_1.full_node.full_node_peers.address_manager = AddressManager()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_chain(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
|
||||
@@ -535,7 +536,7 @@ class TestFullNodeProtocol:
|
||||
|
||||
assert full_node_1.full_node.blockchain.get_peak().height == 29
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_respond_end_of_sub_slot(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
|
||||
@@ -593,7 +594,7 @@ class TestFullNodeProtocol:
|
||||
),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_respond_end_of_sub_slot_no_reorg(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
|
||||
@@ -630,7 +631,7 @@ class TestFullNodeProtocol:
|
||||
|
||||
assert full_node_1.full_node.full_node_store.finished_sub_slots == original_ss
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_respond_end_of_sub_slot_race(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
|
||||
@@ -660,7 +661,7 @@ class TestFullNodeProtocol:
|
||||
for slot in blocks[-1].finished_sub_slots:
|
||||
await full_node_1.respond_end_of_sub_slot(fnp.RespondEndOfSubSlot(slot), peer)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_respond_unfinished(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
|
||||
@@ -808,7 +809,7 @@ class TestFullNodeProtocol:
|
||||
await full_node_1.full_node.add_block(block_no_transactions)
|
||||
assert full_node_1.full_node.blockchain.contains_block(block.header_hash)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_new_peak(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
|
||||
@@ -842,6 +843,10 @@ class TestFullNodeProtocol:
|
||||
await time_out_assert(10, time_out_messages(incoming_queue, "request_block", 0))
|
||||
task_2.cancel()
|
||||
|
||||
async def suppress_value_error(coro: Coroutine) -> None:
|
||||
with contextlib.suppress(ValueError):
|
||||
await coro
|
||||
|
||||
# Ignores low weight
|
||||
new_peak = fnp.NewPeak(
|
||||
blocks_reorg[-2].header_hash,
|
||||
@@ -850,7 +855,7 @@ class TestFullNodeProtocol:
|
||||
uint32(0),
|
||||
blocks_reorg[-2].reward_chain_block.get_unfinished().get_hash(),
|
||||
)
|
||||
asyncio.create_task(full_node_1.new_peak(new_peak, dummy_peer))
|
||||
asyncio.create_task(suppress_value_error(full_node_1.new_peak(new_peak, dummy_peer)))
|
||||
await time_out_assert(10, time_out_messages(incoming_queue, "request_block", 0))
|
||||
|
||||
# Does not ignore equal weight
|
||||
@@ -861,10 +866,10 @@ class TestFullNodeProtocol:
|
||||
uint32(0),
|
||||
blocks_reorg[-1].reward_chain_block.get_unfinished().get_hash(),
|
||||
)
|
||||
asyncio.create_task(full_node_1.new_peak(new_peak, dummy_peer))
|
||||
asyncio.create_task(suppress_value_error(full_node_1.new_peak(new_peak, dummy_peer)))
|
||||
await time_out_assert(10, time_out_messages(incoming_queue, "request_block", 1))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_new_transaction_and_mempool(self, wallet_nodes, self_hostname, seeded_random: random.Random):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
wallet_ph = wallet_a.get_new_puzzlehash()
|
||||
@@ -1046,7 +1051,7 @@ class TestFullNodeProtocol:
|
||||
assert err is None
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_request_respond_transaction(self, wallet_nodes, self_hostname, seeded_random: random.Random):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
wallet_ph = wallet_a.get_new_puzzlehash()
|
||||
@@ -1094,7 +1099,7 @@ class TestFullNodeProtocol:
|
||||
assert msg is not None
|
||||
assert msg.data == bytes(fnp.RespondTransaction(spend_bundle))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_respond_transaction_fail(self, wallet_nodes, self_hostname, seeded_random: random.Random):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@@ -1141,7 +1146,7 @@ class TestFullNodeProtocol:
|
||||
await asyncio.sleep(1)
|
||||
assert incoming_queue.qsize() == 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_request_block(self, wallet_nodes):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@@ -1183,7 +1188,7 @@ class TestFullNodeProtocol:
|
||||
res = await full_node_1.request_block(fnp.RequestBlock(blocks[-1].height - 1, True))
|
||||
assert res.type != ProtocolMessageTypes.reject_block.value
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_request_blocks(self, wallet_nodes):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@@ -1244,7 +1249,7 @@ class TestFullNodeProtocol:
|
||||
assert fetched_blocks[-1].transactions_generator is not None
|
||||
assert std_hash(fetched_blocks[-1]) == std_hash(blocks_t[-1])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_new_unfinished_block(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@@ -1275,7 +1280,7 @@ class TestFullNodeProtocol:
|
||||
res = await full_node_1.new_unfinished_block(fnp.NewUnfinishedBlock(unf.partial_hash))
|
||||
assert res is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"committment,expected",
|
||||
[
|
||||
@@ -1427,7 +1432,7 @@ class TestFullNodeProtocol:
|
||||
with pytest.raises(ConsensusError, match=f"{str(expected).split('.')[1]}"):
|
||||
await full_node_1.full_node.add_unfinished_block(unf, peer)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_double_blocks_same_pospace(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
|
||||
@@ -1477,7 +1482,7 @@ class TestFullNodeProtocol:
|
||||
await time_out_assert(10, time_out_messages(incoming_queue, "request_block", 1))
|
||||
rb_task.cancel()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_request_unfinished_block(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@@ -1507,7 +1512,7 @@ class TestFullNodeProtocol:
|
||||
res = await full_node_1.request_unfinished_block(fnp.RequestUnfinishedBlock(unf.partial_hash))
|
||||
assert res is not None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_new_signage_point_or_end_of_sub_slot(self, wallet_nodes, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@@ -1562,7 +1567,7 @@ class TestFullNodeProtocol:
|
||||
|
||||
await time_out_assert(20, caught_up_slots)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_new_signage_point_caching(self, wallet_nodes, empty_blockchain, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@@ -1621,7 +1626,7 @@ class TestFullNodeProtocol:
|
||||
sp = full_node_1.full_node.full_node_store.get_signage_point(sp.cc_vdf.output.get_hash())
|
||||
assert sp is not None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_slot_catch_up_genesis(self, setup_two_nodes_fixture, self_hostname):
|
||||
nodes, _, bt = setup_two_nodes_fixture
|
||||
server_1 = nodes[0].full_node.server
|
||||
@@ -1652,7 +1657,7 @@ class TestFullNodeProtocol:
|
||||
|
||||
await time_out_assert(20, caught_up_slots)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_compact_protocol(self, setup_two_nodes_fixture):
|
||||
nodes, _, bt = setup_two_nodes_fixture
|
||||
full_node_1 = nodes[0]
|
||||
@@ -1770,7 +1775,7 @@ class TestFullNodeProtocol:
|
||||
await full_node_2.full_node.add_block(block)
|
||||
assert full_node_2.full_node.blockchain.get_peak().height == height
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_compact_protocol_invalid_messages(self, setup_two_nodes_fixture, self_hostname):
|
||||
nodes, _, bt = setup_two_nodes_fixture
|
||||
full_node_1 = nodes[0]
|
||||
@@ -1997,7 +2002,7 @@ class TestFullNodeProtocol:
|
||||
assert not block.challenge_chain_sp_proof.normalized_to_identity
|
||||
assert not block.challenge_chain_ip_proof.normalized_to_identity
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_respond_compact_proof_message_limit(self, setup_two_nodes_fixture):
|
||||
nodes, _, bt = setup_two_nodes_fixture
|
||||
full_node_1 = nodes[0]
|
||||
@@ -2067,7 +2072,7 @@ class TestFullNodeProtocol:
|
||||
[[(uint16(max(Capability) + 1), "1")], True],
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_capability_can_connect(
|
||||
self,
|
||||
two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools],
|
||||
@@ -2091,7 +2096,7 @@ class TestFullNodeProtocol:
|
||||
assert connected == expect_success, custom_capabilities
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_node_start_with_existing_blocks(db_version: int) -> None:
|
||||
with TempKeyring(populate=True) as keychain:
|
||||
block_tools = await create_block_tools_async(keychain=keychain)
|
||||
@@ -2121,7 +2126,7 @@ async def test_node_start_with_existing_blocks(db_version: int) -> None:
|
||||
assert block_record.height == expected_height, f"wrong height on cycle {cycle + 1}"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_wallet_sync_task_failure(
|
||||
one_node: SimulatorsAndWalletsServices, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
|
||||
@@ -100,7 +100,7 @@ def no_sub(c: bytes32) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_hints_to_add(bt: BlockTools, empty_blockchain: Blockchain) -> None:
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
await _validate_and_add_block(empty_blockchain, blocks[0])
|
||||
@@ -122,7 +122,7 @@ async def test_hints_to_add(bt: BlockTools, empty_blockchain: Blockchain) -> Non
|
||||
assert set(hints_to_add) == {(first_coin_id, b"1" * 32), (second_coin_id, b"1" * 3), (third_coin_id, b"1" * 32)}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_lookup_coin_ids(bt: BlockTools, empty_blockchain: Blockchain) -> None:
|
||||
blocks = bt.get_consecutive_blocks(2)
|
||||
await _validate_and_add_block(empty_blockchain, blocks[0])
|
||||
|
||||
@@ -9,7 +9,7 @@ from tests.util.misc import BenchmarkRunner
|
||||
|
||||
|
||||
class TestNodeLoad:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_blocks_load(self, two_nodes, self_hostname, benchmark_runner: BenchmarkRunner):
|
||||
num_blocks = 50
|
||||
full_node_1, full_node_2, server_1, server_2, bt = two_nodes
|
||||
|
||||
@@ -37,7 +37,7 @@ async def get_block_path(full_node: FullNodeAPI):
|
||||
|
||||
|
||||
class TestPerformance:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_full_block_performance(
|
||||
self, request: pytest.FixtureRequest, wallet_nodes_perf, self_hostname, benchmark_runner: BenchmarkRunner
|
||||
):
|
||||
|
||||
@@ -18,7 +18,7 @@ from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG
|
||||
|
||||
|
||||
class TestTransactions:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_wallet_coinbase(self, simulator_and_wallet, self_hostname):
|
||||
num_blocks = 5
|
||||
full_nodes, wallets, _ = simulator_and_wallet
|
||||
@@ -40,7 +40,7 @@ class TestTransactions:
|
||||
print(await wallet.get_confirmed_balance(), funds)
|
||||
await time_out_assert(20, wallet.get_confirmed_balance, funds)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_tx_propagation(self, three_nodes_two_wallets, self_hostname, seeded_random: random.Random):
|
||||
num_blocks = 5
|
||||
full_nodes, wallets, _ = three_nodes_two_wallets
|
||||
@@ -124,7 +124,7 @@ class TestTransactions:
|
||||
)
|
||||
await time_out_assert(20, wallet_1.wallet_state_manager.main_wallet.get_confirmed_balance, 10)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_mempool_tx_sync(self, three_nodes_two_wallets, self_hostname, seeded_random: random.Random):
|
||||
num_blocks = 5
|
||||
full_nodes, wallets, _ = three_nodes_two_wallets
|
||||
|
||||
@@ -25,7 +25,7 @@ def get_transaction_queue_entry(peer_id: Optional[bytes32], tx_index: int) -> Tr
|
||||
return cast(TransactionQueueEntry, FakeTransactionQueueEntry(index=tx_index, peer_id=peer_id))
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_local_txs(seeded_random: random.Random) -> None:
|
||||
transaction_queue = TransactionQueue(1000, log)
|
||||
# test 1 tx
|
||||
@@ -50,7 +50,7 @@ async def test_local_txs(seeded_random: random.Random) -> None:
|
||||
assert list_txs[i] == resulting_txs[i]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_one_peer_and_await(seeded_random: random.Random) -> None:
|
||||
transaction_queue = TransactionQueue(1000, log)
|
||||
num_txs = 100
|
||||
@@ -84,7 +84,7 @@ async def test_one_peer_and_await(seeded_random: random.Random) -> None:
|
||||
await asyncio.wait_for(task, 1) # we should never time out here
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_lots_of_peers(seeded_random: random.Random) -> None:
|
||||
transaction_queue = TransactionQueue(1000, log)
|
||||
num_peers = 1000
|
||||
@@ -106,7 +106,7 @@ async def test_lots_of_peers(seeded_random: random.Random) -> None:
|
||||
assert list_txs[i] == resulting_txs[i * 1000]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_full_queue(seeded_random: random.Random) -> None:
|
||||
transaction_queue = TransactionQueue(1000, log)
|
||||
num_peers = 100
|
||||
@@ -128,7 +128,7 @@ async def test_full_queue(seeded_random: random.Random) -> None:
|
||||
resulting_txs.append(await transaction_queue.pop())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_queue_cleanup_and_fairness(seeded_random: random.Random) -> None:
|
||||
transaction_queue = TransactionQueue(1000, log)
|
||||
peer_a = bytes32.random(seeded_random)
|
||||
|
||||
@@ -296,7 +296,7 @@ class TestPendingTxCache:
|
||||
|
||||
|
||||
class TestMempool:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_mempool(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -367,7 +367,7 @@ mis = MempoolInclusionStatus
|
||||
|
||||
|
||||
class TestMempoolManager:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_mempool_manager(self, two_nodes_one_block, wallet_a, self_hostname):
|
||||
full_node_1, full_node_2, server_1, server_2, bt = two_nodes_one_block
|
||||
|
||||
@@ -387,7 +387,7 @@ class TestMempoolManager:
|
||||
spend_bundle.name(),
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"opcode,lock_value,expected",
|
||||
[
|
||||
@@ -457,7 +457,7 @@ class TestMempoolManager:
|
||||
|
||||
# this test makes sure that one spend successfully asserts the announce from
|
||||
# another spend, even though the assert condition is duplicated 100 times
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_coin_announcement_duplicate_consumed(self, one_node_one_block, wallet_a):
|
||||
def test_fun(coin_1: Coin, coin_2: Coin) -> SpendBundle:
|
||||
announce = Announcement(coin_2.name(), b"test")
|
||||
@@ -481,7 +481,7 @@ class TestMempoolManager:
|
||||
|
||||
# this test makes sure that one spend successfully asserts the announce from
|
||||
# another spend, even though the create announcement is duplicated 100 times
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_coin_duplicate_announcement_consumed(self, one_node_one_block, wallet_a):
|
||||
def test_fun(coin_1: Coin, coin_2: Coin) -> SpendBundle:
|
||||
announce = Announcement(coin_2.name(), b"test")
|
||||
@@ -503,7 +503,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle == bundle
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_double_spend(self, two_nodes_one_block, wallet_a, self_hostname):
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2, bt = two_nodes_one_block
|
||||
@@ -564,7 +564,7 @@ class TestMempoolManager:
|
||||
def assert_sb_not_in_pool(self, node, sb):
|
||||
assert node.full_node.mempool_manager.get_spendbundle(sb.name()) is None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_double_spend_with_higher_fee(self, two_nodes_one_block, wallet_a, self_hostname):
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
|
||||
@@ -639,7 +639,7 @@ class TestMempoolManager:
|
||||
self.assert_sb_not_in_pool(full_node_1, sb12)
|
||||
self.assert_sb_not_in_pool(full_node_1, sb3)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_signature(self, one_node_one_block, wallet_a):
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
|
||||
@@ -714,7 +714,7 @@ class TestMempoolManager:
|
||||
status, err = await respond_transaction(full_node_1, tx1, dummy_peer, test=True)
|
||||
return blocks, spend_bundle1, dummy_peer, status, err
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def condition_tester2(self, node_server_bt, wallet_a, test_fun: Callable[[Coin, Coin], SpendBundle]):
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
full_node_1, server_1, bt = node_server_bt
|
||||
@@ -751,7 +751,7 @@ class TestMempoolManager:
|
||||
|
||||
return blocks, bundle, status, err
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_block_index(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
blocks = await full_node_1.get_all_full_blocks()
|
||||
@@ -768,7 +768,7 @@ class TestMempoolManager:
|
||||
assert err == Err.ASSERT_HEIGHT_ABSOLUTE_FAILED
|
||||
assert status == MempoolInclusionStatus.PENDING
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_index_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE, [])
|
||||
@@ -780,7 +780,7 @@ class TestMempoolManager:
|
||||
assert err == Err.INVALID_CONDITION
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_correct_block_index(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE, [int_to_bytes(1)])
|
||||
@@ -791,7 +791,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_index_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
# garbage at the end of the argument list is ignored in consensus mode,
|
||||
@@ -804,7 +804,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_negative_block_index(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_ABSOLUTE, [int_to_bytes(-1)])
|
||||
@@ -815,7 +815,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_block_age(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [int_to_bytes(5)])
|
||||
@@ -827,7 +827,7 @@ class TestMempoolManager:
|
||||
# the transaction may become valid later
|
||||
assert status == MempoolInclusionStatus.PENDING
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_age_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [])
|
||||
@@ -839,7 +839,7 @@ class TestMempoolManager:
|
||||
# the transaction may become valid later
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_correct_block_age(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [int_to_bytes(1)])
|
||||
@@ -853,7 +853,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_age_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
# garbage at the end of the argument list is ignored in consensus mode,
|
||||
@@ -869,7 +869,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_negative_block_age(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_HEIGHT_RELATIVE, [int_to_bytes(-1)])
|
||||
@@ -883,7 +883,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_correct_my_id(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -901,7 +901,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_id_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -921,7 +921,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_my_id(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -940,7 +940,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_id_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_COIN_ID, [])
|
||||
@@ -952,7 +952,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_exceeds(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
# 5 seconds should be before the next block
|
||||
@@ -966,7 +966,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_fail(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
time_now = full_node_1.full_node.blockchain.get_peak().timestamp + 1000
|
||||
@@ -979,7 +979,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_height_pending(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
print(full_node_1.full_node.blockchain.get_peak())
|
||||
@@ -993,7 +993,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.PENDING
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_negative(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
time_now = -1
|
||||
@@ -1006,7 +1006,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1018,7 +1018,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
time_now = full_node_1.full_node.blockchain.get_peak().timestamp + 5
|
||||
@@ -1033,7 +1033,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_relative_exceeds(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
time_relative = 3
|
||||
@@ -1059,7 +1059,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_relative_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
time_relative = 0
|
||||
@@ -1075,7 +1075,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_relative_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1088,7 +1088,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_time_relative_negative(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
time_relative = -3
|
||||
@@ -1103,7 +1103,7 @@ class TestMempoolManager:
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
# ensure one spend can assert a coin announcement from another spend
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_correct_coin_announcement_consumed(self, one_node_one_block, wallet_a):
|
||||
def test_fun(coin_1: Coin, coin_2: Coin) -> SpendBundle:
|
||||
announce = Announcement(coin_2.name(), b"test")
|
||||
@@ -1127,7 +1127,7 @@ class TestMempoolManager:
|
||||
|
||||
# ensure one spend can assert a coin announcement from another spend, even
|
||||
# though the conditions have garbage at the end
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"assert_garbage,announce_garbage,expected,expected_included",
|
||||
[
|
||||
@@ -1169,7 +1169,7 @@ class TestMempoolManager:
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name())
|
||||
assert mempool_bundle == bundle
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_coin_announcement_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1190,7 +1190,7 @@ class TestMempoolManager:
|
||||
assert full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name()) is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_coin_announcement_missing_arg2(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1212,7 +1212,7 @@ class TestMempoolManager:
|
||||
assert full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name()) is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_coin_announcement_too_big(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1247,7 +1247,7 @@ class TestMempoolManager:
|
||||
|
||||
# ensure an assert coin announcement is rejected if it doesn't match the
|
||||
# create announcement
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_coin_announcement_rejected(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1276,7 +1276,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_coin_announcement_rejected_two(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1302,7 +1302,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_correct_puzzle_announcement(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1328,7 +1328,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle == bundle
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"assert_garbage,announce_garbage,expected,expected_included",
|
||||
[
|
||||
@@ -1371,7 +1371,7 @@ class TestMempoolManager:
|
||||
mempool_bundle = full_node_1.full_node.mempool_manager.get_spendbundle(bundle.name())
|
||||
assert mempool_bundle == bundle
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_puzzle_announcement_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1397,7 +1397,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_puzzle_announcement_missing_arg2(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1425,7 +1425,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_puzzle_announcement_rejected(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1454,7 +1454,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_puzzle_announcement_rejected_two(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1483,7 +1483,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_fee_condition(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.RESERVE_FEE, [int_to_bytes(10)])
|
||||
@@ -1497,7 +1497,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is not None
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_fee_condition_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
# garbage at the end of the arguments is ignored in consensus mode, but
|
||||
@@ -1513,7 +1513,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_fee_condition_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.RESERVE_FEE, [])
|
||||
@@ -1527,7 +1527,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_fee_condition_negative_fee(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.RESERVE_FEE, [int_to_bytes(-1)])
|
||||
@@ -1545,7 +1545,7 @@ class TestMempoolManager:
|
||||
full_node_1.full_node.blockchain, blocks[-1], expected_error=Err.RESERVE_FEE_CONDITION_FAILED
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_fee_condition_fee_too_large(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.RESERVE_FEE, [int_to_bytes(2**64)])
|
||||
@@ -1563,7 +1563,7 @@ class TestMempoolManager:
|
||||
full_node_1.full_node.blockchain, blocks[-1], expected_error=Err.RESERVE_FEE_CONDITION_FAILED
|
||||
)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_fee_condition_wrong_fee(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1576,7 +1576,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_stealing_fee(self, two_nodes_one_block, wallet_a):
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2, bt = two_nodes_one_block
|
||||
@@ -1632,7 +1632,7 @@ class TestMempoolManager:
|
||||
assert mempool_bundle is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_double_spend_same_bundle(self, two_nodes_one_block, wallet_a):
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
full_node_1, full_node_2, server_1, server_2, bt = two_nodes_one_block
|
||||
@@ -1677,7 +1677,7 @@ class TestMempoolManager:
|
||||
assert sb is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_agg_sig_condition(self, one_node_one_block, wallet_a):
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
@@ -1722,7 +1722,7 @@ class TestMempoolManager:
|
||||
# sb = full_node_1.full_node.mempool_manager.get_spendbundle(spend_bundle.name())
|
||||
# assert sb is spend_bundle
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_correct_my_parent(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1741,7 +1741,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_parent_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1762,7 +1762,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_parent_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_PARENT_ID, [])
|
||||
@@ -1775,7 +1775,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_my_parent(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1795,7 +1795,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_correct_my_puzhash(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1814,7 +1814,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_puzhash_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1834,7 +1834,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_puzhash_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_PUZZLEHASH, [])
|
||||
@@ -1847,7 +1847,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_my_puzhash(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1866,7 +1866,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_correct_my_amount(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1885,7 +1885,7 @@ class TestMempoolManager:
|
||||
assert sb1 == spend_bundle1
|
||||
assert status == MempoolInclusionStatus.SUCCESS
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_amount_garbage(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
|
||||
@@ -1906,7 +1906,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_amount_missing_arg(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [])
|
||||
@@ -1919,7 +1919,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_my_amount(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [int_to_bytes(1000)])
|
||||
@@ -1932,7 +1932,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_negative_my_amount(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [int_to_bytes(-1)])
|
||||
@@ -1945,7 +1945,7 @@ class TestMempoolManager:
|
||||
assert sb1 is None
|
||||
assert status == MempoolInclusionStatus.FAILED
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_my_amount_too_large(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
cvp = ConditionWithArgs(ConditionOpcode.ASSERT_MY_AMOUNT, [int_to_bytes(2**64)])
|
||||
@@ -2636,7 +2636,7 @@ class TestMaliciousGenerators:
|
||||
spend = npc_result.conds.spends[0]
|
||||
assert len(spend.create_coin) == 6094
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_coin_spend_coin(self, one_node_one_block, wallet_a):
|
||||
full_node_1, server_1, bt = one_node_one_block
|
||||
reward_ph = wallet_a.get_new_puzzlehash()
|
||||
|
||||
@@ -16,7 +16,7 @@ from tests.core.consensus.test_pot_iterations import test_constants
|
||||
from tests.util.db_connection import DBConnection
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basics() -> None:
|
||||
fee_store = FeeStore()
|
||||
fee_tracker = FeeTracker(fee_store)
|
||||
@@ -59,7 +59,7 @@ async def test_basics() -> None:
|
||||
assert long.median != -1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_fee_increase() -> None:
|
||||
async with DBConnection(db_version=2) as db_wrapper:
|
||||
coin_store = await CoinStore.create(db_wrapper)
|
||||
|
||||
@@ -18,7 +18,7 @@ from chia.wallet.wallet import Wallet
|
||||
from tests.core.node_height import node_height_at_least
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_protocol_messages(
|
||||
simulator_and_wallet: Tuple[
|
||||
List[Union[FullNodeAPI, FullNodeSimulator]], List[Tuple[Wallet, ChiaServer]], BlockTools
|
||||
|
||||
@@ -388,7 +388,7 @@ def mempool_item_from_spendbundle(spend_bundle: SpendBundle) -> MempoolItem:
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_spend_bundle() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
sb = SpendBundle([], G2Element())
|
||||
@@ -396,7 +396,7 @@ async def test_empty_spend_bundle() -> None:
|
||||
await mempool_manager.pre_validate_spendbundle(sb, None, sb.name())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_negative_addition_amount() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
conditions = [[ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, -1]]
|
||||
@@ -405,7 +405,7 @@ async def test_negative_addition_amount() -> None:
|
||||
await mempool_manager.pre_validate_spendbundle(sb, None, sb.name())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_valid_addition_amount() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
max_amount = mempool_manager.constants.MAX_COIN_AMOUNT
|
||||
@@ -416,7 +416,7 @@ async def test_valid_addition_amount() -> None:
|
||||
assert npc_result.error is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_too_big_addition_amount() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
max_amount = mempool_manager.constants.MAX_COIN_AMOUNT
|
||||
@@ -426,7 +426,7 @@ async def test_too_big_addition_amount() -> None:
|
||||
await mempool_manager.pre_validate_spendbundle(sb, None, sb.name())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_duplicate_output() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
conditions = [
|
||||
@@ -438,7 +438,7 @@ async def test_duplicate_output() -> None:
|
||||
await mempool_manager.pre_validate_spendbundle(sb, None, sb.name())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_block_cost_exceeds_max() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
conditions = []
|
||||
@@ -449,7 +449,7 @@ async def test_block_cost_exceeds_max() -> None:
|
||||
await mempool_manager.pre_validate_spendbundle(sb, None, sb.name())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_double_spend_prevalidation() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
conditions = [[ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, 1]]
|
||||
@@ -459,7 +459,7 @@ async def test_double_spend_prevalidation() -> None:
|
||||
await mempool_manager.pre_validate_spendbundle(sb_twice, None, sb_twice.name())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_minting_coin() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
conditions = [[ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, TEST_COIN_AMOUNT]]
|
||||
@@ -472,7 +472,7 @@ async def test_minting_coin() -> None:
|
||||
await mempool_manager.pre_validate_spendbundle(sb, None, sb.name())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reserve_fee_condition() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
conditions = [[ConditionOpcode.RESERVE_FEE, TEST_COIN_AMOUNT]]
|
||||
@@ -485,7 +485,7 @@ async def test_reserve_fee_condition() -> None:
|
||||
await mempool_manager.pre_validate_spendbundle(sb, None, sb.name())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unknown_unspent() -> None:
|
||||
async def get_coin_record(_: bytes32) -> Optional[CoinRecord]:
|
||||
return None
|
||||
@@ -496,7 +496,7 @@ async def test_unknown_unspent() -> None:
|
||||
assert result == (None, MempoolInclusionStatus.FAILED, Err.UNKNOWN_UNSPENT)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_same_sb_twice_with_eligible_coin() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(get_coin_record_for_test_coins)
|
||||
sb1_conditions = [
|
||||
@@ -520,7 +520,7 @@ async def test_same_sb_twice_with_eligible_coin() -> None:
|
||||
assert mempool_manager.get_spendbundle(sb_name) == sb
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sb_twice_with_eligible_coin_and_different_spends_order() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(get_coin_record_for_test_coins)
|
||||
sb1_conditions = [
|
||||
@@ -558,7 +558,7 @@ co = ConditionOpcode
|
||||
mis = MempoolInclusionStatus
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"opcode,lock_value,expected_status,expected_error",
|
||||
[
|
||||
@@ -828,7 +828,7 @@ def test_can_replace(existing_items: List[MempoolItem], new_item: MempoolItem, e
|
||||
assert can_replace(existing_items, removals, new_item) == expected
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_items_not_in_filter() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(get_coin_record_for_test_coins)
|
||||
conditions = [[ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, 1]]
|
||||
@@ -873,7 +873,7 @@ async def test_get_items_not_in_filter() -> None:
|
||||
assert result == [sb1]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_total_mempool_fees() -> None:
|
||||
coin_records: Dict[bytes32, CoinRecord] = {}
|
||||
|
||||
@@ -906,7 +906,7 @@ async def test_total_mempool_fees() -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("reverse_tx_order", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_bundle_from_mempool(reverse_tx_order: bool) -> None:
|
||||
async def make_coin_spends(coins: List[Coin], *, high_fees: bool = True) -> List[CoinSpend]:
|
||||
spends_list = []
|
||||
@@ -941,7 +941,7 @@ async def test_create_bundle_from_mempool(reverse_tx_order: bool) -> None:
|
||||
assert len([s for s in low_rate_spends if s in result[0].coin_spends]) == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_bundle_from_mempool_on_max_cost() -> None:
|
||||
# This test exercises the path where an item's inclusion would exceed the
|
||||
# maximum cumulative cost, so it gets skipped as a result
|
||||
@@ -991,7 +991,7 @@ async def test_create_bundle_from_mempool_on_max_cost() -> None:
|
||||
(co.ASSERT_BEFORE_SECONDS_RELATIVE, 120, False, 9900 + 120),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_assert_before_expiration(
|
||||
opcode: ConditionOpcode, arg: int, expect_eviction: bool, expect_limit: Optional[int]
|
||||
) -> None:
|
||||
@@ -1070,7 +1070,7 @@ def assert_sb_not_in_pool(mempool_manager: MempoolManager, sb: SpendBundle) -> N
|
||||
assert mempool_manager.get_spendbundle(sb.name()) is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_insufficient_fee_increase() -> None:
|
||||
mempool_manager, coins = await setup_mempool_with_coins(coin_amounts=list(range(1000000000, 1000000010)))
|
||||
sb1_1 = await make_and_send_spendbundle(mempool_manager, coins[0])
|
||||
@@ -1082,7 +1082,7 @@ async def test_insufficient_fee_increase() -> None:
|
||||
assert_sb_not_in_pool(mempool_manager, sb1_2)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sufficient_fee_increase() -> None:
|
||||
mempool_manager, coins = await setup_mempool_with_coins(coin_amounts=list(range(1000000000, 1000000010)))
|
||||
sb1_1 = await make_and_send_spendbundle(mempool_manager, coins[0])
|
||||
@@ -1092,7 +1092,7 @@ async def test_sufficient_fee_increase() -> None:
|
||||
assert_sb_in_pool(mempool_manager, sb1_2)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_superset() -> None:
|
||||
# Aggregated spendbundle sb12 replaces sb1 since it spends a superset
|
||||
# of coins spent in sb1
|
||||
@@ -1105,7 +1105,7 @@ async def test_superset() -> None:
|
||||
assert_sb_not_in_pool(mempool_manager, sb1)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_superset_violation() -> None:
|
||||
mempool_manager, coins = await setup_mempool_with_coins(coin_amounts=list(range(1000000000, 1000000010)))
|
||||
sb1 = make_test_spendbundle(coins[0])
|
||||
@@ -1124,7 +1124,7 @@ async def test_superset_violation() -> None:
|
||||
assert_sb_not_in_pool(mempool_manager, sb23)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_total_fpc_decrease() -> None:
|
||||
mempool_manager, coins = await setup_mempool_with_coins(coin_amounts=list(range(1000000000, 1000000010)))
|
||||
sb1 = make_test_spendbundle(coins[0])
|
||||
@@ -1143,7 +1143,7 @@ async def test_total_fpc_decrease() -> None:
|
||||
assert_sb_not_in_pool(mempool_manager, sb1234)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sufficient_total_fpc_increase() -> None:
|
||||
mempool_manager, coins = await setup_mempool_with_coins(coin_amounts=list(range(1000000000, 1000000010)))
|
||||
sb1 = make_test_spendbundle(coins[0])
|
||||
@@ -1163,7 +1163,7 @@ async def test_sufficient_total_fpc_increase() -> None:
|
||||
assert_sb_not_in_pool(mempool_manager, sb3)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_replace_with_extra_eligible_coin() -> None:
|
||||
mempool_manager, coins = await setup_mempool_with_coins(coin_amounts=list(range(1000000000, 1000000010)))
|
||||
sb1234 = SpendBundle.aggregate([make_test_spendbundle(coins[i]) for i in range(4)])
|
||||
@@ -1177,7 +1177,7 @@ async def test_replace_with_extra_eligible_coin() -> None:
|
||||
assert_sb_in_pool(mempool_manager, sb1234_2)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_replacing_one_with_an_eligible_coin() -> None:
|
||||
mempool_manager, coins = await setup_mempool_with_coins(coin_amounts=list(range(1000000000, 1000000010)))
|
||||
sb123 = SpendBundle.aggregate([make_test_spendbundle(coins[i]) for i in range(3)])
|
||||
@@ -1339,7 +1339,7 @@ def test_dedup_info_eligible_3rd_time_another_2nd_time_and_one_non_eligible() ->
|
||||
assert eligible_coin_spends == expected_eligible_spends
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("new_height_step", [1, 2, -1])
|
||||
async def test_coin_spending_different_ways_then_finding_it_spent_in_new_peak(new_height_step: int) -> None:
|
||||
# This test makes sure all mempool items that spend a coin (in different ways)
|
||||
@@ -1376,7 +1376,7 @@ async def test_coin_spending_different_ways_then_finding_it_spent_in_new_peak(ne
|
||||
assert len(list(mempool_manager.mempool.items_by_feerate())) == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bundle_coin_spends() -> None:
|
||||
# This tests the construction of bundle_coin_spends map for mempool items
|
||||
# We're creating sb123e with 4 coins, one of them being eligible
|
||||
@@ -1400,7 +1400,7 @@ async def test_bundle_coin_spends() -> None:
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_identical_spend_aggregation_e2e(simulator_and_wallet: SimulatorsAndWallets, self_hostname: str) -> None:
|
||||
def get_sb_names_by_coin_id(
|
||||
full_node_api: FullNodeSimulator,
|
||||
|
||||
@@ -27,7 +27,7 @@ async def wallet_balance_at_least(wallet_node: WalletNode, balance: uint128) ->
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="benchmark")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_mempool_update_performance(
|
||||
wallet_nodes_mempool_perf: SimulatorsAndWallets,
|
||||
default_400_blocks: List[FullBlock],
|
||||
|
||||
@@ -38,7 +38,7 @@ class FakeRateLimiter:
|
||||
|
||||
|
||||
class TestDos:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_large_message_disconnect_and_ban(self, setup_two_nodes_fixture, self_hostname):
|
||||
nodes, _, _ = setup_two_nodes_fixture
|
||||
server_1 = nodes[0].full_node.server
|
||||
@@ -84,7 +84,7 @@ class TestDos:
|
||||
pass
|
||||
await session.close()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_bad_handshake_and_ban(self, setup_two_nodes_fixture, self_hostname):
|
||||
nodes, _, _ = setup_two_nodes_fixture
|
||||
server_1 = nodes[0].full_node.server
|
||||
@@ -126,7 +126,7 @@ class TestDos:
|
||||
|
||||
await session.close()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_protocol_handshake(self, setup_two_nodes_fixture, self_hostname):
|
||||
nodes, _, _ = setup_two_nodes_fixture
|
||||
server_1 = nodes[0].full_node.server
|
||||
@@ -157,7 +157,7 @@ class TestDos:
|
||||
await session.close()
|
||||
await asyncio.sleep(1) # give some time for cleanup to work
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_spam_tx(self, setup_two_nodes_fixture, self_hostname):
|
||||
nodes, _, _ = setup_two_nodes_fixture
|
||||
full_node_1, full_node_2 = nodes
|
||||
@@ -212,7 +212,7 @@ class TestDos:
|
||||
|
||||
await time_out_assert(15, is_banned)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_spam_message_non_tx(self, setup_two_nodes_fixture, self_hostname):
|
||||
nodes, _, _ = setup_two_nodes_fixture
|
||||
full_node_1, full_node_2 = nodes
|
||||
@@ -261,7 +261,7 @@ class TestDos:
|
||||
|
||||
await time_out_assert(15, is_banned)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_spam_message_too_large(self, setup_two_nodes_fixture, self_hostname):
|
||||
nodes, _, _ = setup_two_nodes_fixture
|
||||
full_node_1, full_node_2 = nodes
|
||||
|
||||
@@ -149,7 +149,7 @@ class ServeInThread:
|
||||
chia_policy.global_max_concurrent_connections = self.original_connection_limit
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_loop(tmp_path: pathlib.Path) -> None:
|
||||
logger = create_logger()
|
||||
|
||||
@@ -260,7 +260,7 @@ async def test_loop(tmp_path: pathlib.Path) -> None:
|
||||
argvalues=[1, 3],
|
||||
ids=lambda cycles: f"{cycles} cycle{'s' if cycles != 1 else ''}",
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_limits_connections(repetition: int, cycles: int, tmp_path: pathlib.Path) -> None:
|
||||
ip = "127.0.0.1"
|
||||
connection_limit = 10
|
||||
|
||||
@@ -13,7 +13,7 @@ from chia.simulator.block_tools import BlockTools
|
||||
from chia.util.default_root import SIMULATOR_ROOT_PATH
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_enable_private_networks(
|
||||
two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools],
|
||||
) -> None:
|
||||
|
||||
@@ -23,13 +23,13 @@ test_different_versions_results: List[int] = []
|
||||
|
||||
|
||||
class TestRateLimits:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_rate_limits_to_use(self):
|
||||
assert get_rate_limits_to_use(rl_v2, rl_v2) != get_rate_limits_to_use(rl_v2, rl_v1)
|
||||
assert get_rate_limits_to_use(rl_v1, rl_v1) == get_rate_limits_to_use(rl_v2, rl_v1)
|
||||
assert get_rate_limits_to_use(rl_v1, rl_v1) == get_rate_limits_to_use(rl_v1, rl_v2)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_too_many_messages(self):
|
||||
# Too many messages
|
||||
r = RateLimiter(incoming=True)
|
||||
@@ -57,7 +57,7 @@ class TestRateLimits:
|
||||
saw_disconnect = True
|
||||
assert saw_disconnect
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_large_message(self):
|
||||
# Large tx
|
||||
small_tx_message = make_msg(ProtocolMessageTypes.respond_transaction, bytes([1] * 500 * 1024))
|
||||
@@ -74,7 +74,7 @@ class TestRateLimits:
|
||||
assert r.process_msg_and_check(small_vdf_message, rl_v2, rl_v2)
|
||||
assert not r.process_msg_and_check(large_vdf_message, rl_v2, rl_v2)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_too_much_data(self):
|
||||
# Too much data
|
||||
r = RateLimiter(incoming=True)
|
||||
@@ -101,7 +101,7 @@ class TestRateLimits:
|
||||
saw_disconnect = True
|
||||
assert saw_disconnect
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_non_tx_aggregate_limits(self):
|
||||
# Frequency limits
|
||||
r = RateLimiter(incoming=True)
|
||||
@@ -137,7 +137,7 @@ class TestRateLimits:
|
||||
saw_disconnect = True
|
||||
assert saw_disconnect
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_periodic_reset(self):
|
||||
r = RateLimiter(True, 5)
|
||||
tx_message = make_msg(ProtocolMessageTypes.respond_transaction, bytes([1] * 500 * 1024))
|
||||
@@ -169,7 +169,7 @@ class TestRateLimits:
|
||||
await asyncio.sleep(6)
|
||||
assert r.process_msg_and_check(new_tx_message, rl_v2, rl_v2)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_percentage_limits(self):
|
||||
r = RateLimiter(True, 60, 40)
|
||||
new_peak_message = make_msg(ProtocolMessageTypes.new_peak, bytes([1] * 40))
|
||||
@@ -228,7 +228,7 @@ class TestRateLimits:
|
||||
saw_disconnect = True
|
||||
assert saw_disconnect
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_too_many_outgoing_messages(self):
|
||||
# Too many messages
|
||||
r = RateLimiter(incoming=False)
|
||||
@@ -251,7 +251,7 @@ class TestRateLimits:
|
||||
new_signatures_message = make_msg(ProtocolMessageTypes.respond_signatures, bytes([1]))
|
||||
assert r.process_msg_and_check(new_signatures_message, rl_v2, rl_v2)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_too_many_incoming_messages(self):
|
||||
# Too many messages
|
||||
r = RateLimiter(incoming=True)
|
||||
@@ -298,7 +298,7 @@ class TestRateLimits:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_different_versions(self, node_with_params, node_with_params_b, self_hostname):
|
||||
node_a = node_with_params
|
||||
node_b = node_with_params_b
|
||||
@@ -332,7 +332,7 @@ class TestRateLimits:
|
||||
if len(test_different_versions_results) >= 4:
|
||||
assert len(set(test_different_versions_results)) >= 2
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_compose(self):
|
||||
rl_1 = rl_numbers[1]
|
||||
rl_2 = rl_numbers[2]
|
||||
|
||||
@@ -40,7 +40,7 @@ class TestAPI:
|
||||
raise ApiError(Err.NO_TRANSACTIONS_WHILE_SYNCING, f"Some error message: {request.transaction_id}", b"ab")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_duplicate_client_connection(
|
||||
two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools], self_hostname: str
|
||||
) -> None:
|
||||
@@ -49,7 +49,7 @@ async def test_duplicate_client_connection(
|
||||
assert not await server_2.start_client(PeerInfo(self_hostname, server_1.get_port()), None)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("method", [repr, str])
|
||||
async def test_connection_string_conversion(
|
||||
two_nodes_one_block: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools],
|
||||
@@ -65,7 +65,7 @@ async def test_connection_string_conversion(
|
||||
assert len(converted) < 1000
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_connection_versions(
|
||||
self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices
|
||||
) -> None:
|
||||
@@ -83,7 +83,7 @@ async def test_connection_versions(
|
||||
assert connection.get_version() == chia_full_version_str()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_api_not_ready(
|
||||
self_hostname: str,
|
||||
one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices,
|
||||
@@ -110,7 +110,7 @@ async def test_api_not_ready(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("version", ["0.0.34", "0.0.35", "0.0.36"])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_error_response(
|
||||
one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices,
|
||||
self_hostname: str,
|
||||
@@ -147,7 +147,7 @@ async def test_error_response(
|
||||
@pytest.mark.parametrize(
|
||||
"error", [Error(int16(Err.UNKNOWN.value), "1", bytes([1, 2, 3])), Error(int16(Err.UNKNOWN.value), "2", None)]
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_error_receive(
|
||||
one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices,
|
||||
self_hostname: str,
|
||||
@@ -174,7 +174,7 @@ async def test_error_receive(
|
||||
await time_out_assert(10, error_log_found, True, wallet_connection)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_call_api_of_specific(
|
||||
two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools], self_hostname: str
|
||||
) -> None:
|
||||
@@ -189,7 +189,7 @@ async def test_call_api_of_specific(
|
||||
assert isinstance(message, RejectBlock)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_call_api_of_specific_for_missing_peer(
|
||||
two_nodes: Tuple[FullNodeAPI, FullNodeAPI, ChiaServer, ChiaServer, BlockTools]
|
||||
) -> None:
|
||||
|
||||
@@ -53,7 +53,7 @@ async def wait_for_daemon_connection(root_path: Path, config: Dict[str, Any], ti
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames="signal_number", argvalues=sendable_termination_signals)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_daemon_terminates(signal_number: signal.Signals, chia_root: ChiaRoot) -> None:
|
||||
port = find_available_listen_port()
|
||||
with lock_and_load_config(root_path=chia_root.path, filename="config.yaml") as config:
|
||||
@@ -91,7 +91,7 @@ async def test_daemon_terminates(signal_number: signal.Signals, chia_root: ChiaR
|
||||
# [, "chia.data_layer.data_layer_server", "data_layer"],
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_services_terminate(
|
||||
signal_number: signal.Signals,
|
||||
chia_root: ChiaRoot,
|
||||
|
||||
@@ -38,7 +38,7 @@ async def establish_connection(server: ChiaServer, self_hostname: str, ssl_conte
|
||||
|
||||
|
||||
class TestSSL:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_public_connections(self, simulator_and_wallet, self_hostname):
|
||||
full_nodes, wallets, _ = simulator_and_wallet
|
||||
full_node_api = full_nodes[0]
|
||||
@@ -48,7 +48,7 @@ class TestSSL:
|
||||
success = await server_2.start_client(PeerInfo(self_hostname, server_1.get_port()), None)
|
||||
assert success is True
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer(self, farmer_one_harvester, self_hostname):
|
||||
_, farmer_service, bt = farmer_one_harvester
|
||||
farmer_api = farmer_service._api
|
||||
@@ -79,7 +79,7 @@ class TestSSL:
|
||||
with pytest.raises(aiohttp.ServerDisconnectedError):
|
||||
await establish_connection(farmer_server, self_hostname, ssl_context)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_full_node(self, simulator_and_wallet, self_hostname):
|
||||
full_nodes, wallets, bt = simulator_and_wallet
|
||||
full_node_api = full_nodes[0]
|
||||
@@ -98,7 +98,7 @@ class TestSSL:
|
||||
ssl_context = ssl_context_for_client(chia_ca_crt_path, chia_ca_key_path, pub_crt, pub_key)
|
||||
await establish_connection(full_node_server, self_hostname, ssl_context)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_introducer(self, introducer_service, self_hostname):
|
||||
introducer_server = introducer_service._node.server
|
||||
chia_ca_crt_path, chia_ca_key_path = chia_ssl_ca_paths(introducer_service.root_path, introducer_service.config)
|
||||
|
||||
@@ -53,7 +53,7 @@ def large_block_generator(size):
|
||||
return blob
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basics(softfork_height, bt):
|
||||
wallet_tool = bt.get_pool_wallet_tool()
|
||||
ph = wallet_tool.get_new_puzzlehash()
|
||||
@@ -111,7 +111,7 @@ async def test_basics(softfork_height, bt):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_mempool_mode(softfork_height, bt):
|
||||
wallet_tool = bt.get_pool_wallet_tool()
|
||||
ph = wallet_tool.get_new_puzzlehash()
|
||||
@@ -173,7 +173,7 @@ async def test_mempool_mode(softfork_height, bt):
|
||||
assert spend_info.puzzle.to_program() == puzzle
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_clvm_mempool_mode(softfork_height):
|
||||
block = Program.from_bytes(bytes(SMALL_BLOCK_GENERATOR.program))
|
||||
disassembly = binutils.disassemble(block)
|
||||
@@ -201,7 +201,7 @@ async def test_clvm_mempool_mode(softfork_height):
|
||||
assert npc_result.error is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_tx_generator_speed(softfork_height, benchmark_runner: BenchmarkRunner):
|
||||
LARGE_BLOCK_COIN_CONSUMED_COUNT = 687
|
||||
generator_bytes = large_block_generator(LARGE_BLOCK_COIN_CONSUMED_COUNT)
|
||||
@@ -222,7 +222,7 @@ async def test_tx_generator_speed(softfork_height, benchmark_runner: BenchmarkRu
|
||||
assert len(npc_result.conds.spends) == LARGE_BLOCK_COIN_CONSUMED_COUNT
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_clvm_max_cost(softfork_height):
|
||||
block = Program.from_bytes(bytes(SMALL_BLOCK_GENERATOR.program))
|
||||
disassembly = binutils.disassemble(block)
|
||||
@@ -254,7 +254,7 @@ async def test_clvm_max_cost(softfork_height):
|
||||
assert npc_result.cost > 10000000
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_standard_tx(benchmark_runner: BenchmarkRunner):
|
||||
# this isn't a real public key, but we don't care
|
||||
public_key = bytes.fromhex(
|
||||
@@ -278,7 +278,7 @@ async def test_standard_tx(benchmark_runner: BenchmarkRunner):
|
||||
total_cost += cost
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_puzzle_and_solution_for_coin_performance(benchmark_runner: BenchmarkRunner):
|
||||
from clvm.casts import int_from_bytes
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ from chia.types.peer_info import PeerInfo
|
||||
from chia.util.ints import uint32, uint64, uint128
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unknown_messages(
|
||||
self_hostname: str,
|
||||
one_node: SimulatorsAndWalletsServices,
|
||||
@@ -46,7 +46,7 @@ async def test_unknown_messages(
|
||||
await time_out_assert(10, receiving_failed)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_valid_message(
|
||||
self_hostname: str,
|
||||
one_node: SimulatorsAndWalletsServices,
|
||||
@@ -72,7 +72,7 @@ async def test_valid_message(
|
||||
await time_out_assert(10, peer_added)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_crawler_to_db(
|
||||
crawler_service: Service[Crawler, CrawlerAPI], one_node: SimulatorsAndWalletsServices
|
||||
) -> None:
|
||||
|
||||
@@ -6,7 +6,7 @@ from chia.rpc.crawler_rpc_api import CrawlerRpcApi
|
||||
from chia.seeder.crawler import Crawler
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_ips_after_timestamp(bt):
|
||||
crawler = Crawler(bt.config.get("seeder", {}), bt.root_path, constants=bt.constants)
|
||||
crawler_rpc_api = CrawlerRpcApi(crawler)
|
||||
|
||||
@@ -6,7 +6,7 @@ from chia import __version__
|
||||
from chia.daemon.client import connect_to_daemon
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_version_rpc(get_daemon, bt):
|
||||
ws_server = get_daemon
|
||||
config = bt.config
|
||||
|
||||
@@ -26,7 +26,7 @@ def rand_bytes(num) -> bytes:
|
||||
return bytes(ret)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("with_hints", [True, False])
|
||||
@pytest.mark.skip("we no longer support DB v1")
|
||||
async def test_blocks(default_1000_blocks, with_hints: bool):
|
||||
|
||||
@@ -149,7 +149,7 @@ async def make_db(db_file: Path, blocks: List[FullBlock]) -> None:
|
||||
await db_wrapper.close()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_db_validate_default_1000_blocks(default_1000_blocks: List[FullBlock]) -> None:
|
||||
with TempFile() as db_file:
|
||||
await make_db(db_file, default_1000_blocks)
|
||||
|
||||
@@ -61,7 +61,7 @@ async def wait_for_synced_receiver(farmer: Farmer, harvester_id: bytes32) -> Non
|
||||
await time_out_assert(30, wait)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_routes(harvester_farmer_environment: HarvesterFarmerEnvironment) -> None:
|
||||
farmer_service, farmer_rpc_client, harvester_service, harvester_rpc_client, _ = harvester_farmer_environment
|
||||
assert farmer_service.rpc_server is not None
|
||||
@@ -71,7 +71,7 @@ async def test_get_routes(harvester_farmer_environment: HarvesterFarmerEnvironme
|
||||
|
||||
|
||||
@pytest.mark.parametrize("endpoint", ["get_harvesters", "get_harvesters_summary"])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_get_harvesters_and_summary(
|
||||
harvester_farmer_environment: HarvesterFarmerEnvironment, endpoint: str
|
||||
) -> None:
|
||||
@@ -119,7 +119,7 @@ async def test_farmer_get_harvesters_and_summary(
|
||||
await time_out_assert_custom_interval(30, 1, test_get_harvesters)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_signage_point_endpoints(harvester_farmer_environment: HarvesterFarmerEnvironment) -> None:
|
||||
farmer_service, farmer_rpc_client, _, _, _ = harvester_farmer_environment
|
||||
farmer_api = farmer_service._api
|
||||
@@ -139,7 +139,7 @@ async def test_farmer_signage_point_endpoints(harvester_farmer_environment: Harv
|
||||
assert (await farmer_rpc_client.get_signage_point(std_hash(b"2"))) is not None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_reward_target_endpoints(harvester_farmer_environment: HarvesterFarmerEnvironment) -> None:
|
||||
farmer_service, farmer_rpc_client, _, _, bt = harvester_farmer_environment
|
||||
farmer_api = farmer_service._api
|
||||
@@ -193,7 +193,7 @@ async def test_farmer_reward_target_endpoints(harvester_farmer_environment: Harv
|
||||
await farmer_rpc_client.set_reward_targets(None, replaced_char)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_get_pool_state(
|
||||
harvester_farmer_environment: HarvesterFarmerEnvironment, self_hostname: str
|
||||
) -> None:
|
||||
@@ -250,7 +250,7 @@ async def test_farmer_get_pool_state(
|
||||
assert pool_dict[key][0] == list(since_24h)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_get_pool_state_plot_count(
|
||||
harvester_farmer_environment: HarvesterFarmerEnvironment, self_hostname: str
|
||||
) -> None:
|
||||
@@ -355,7 +355,7 @@ def test_plot_matches_filter(filter_item: FilterItem, match: bool) -> None:
|
||||
(FarmerRpcClient.get_harvester_plots_duplicates, ["duplicates_0"], None, False, 3),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="avoiding crashes on windows until we fix this (crashing workers)")
|
||||
async def test_farmer_get_harvester_plots_endpoints(
|
||||
harvester_farmer_environment: HarvesterFarmerEnvironment,
|
||||
@@ -466,7 +466,7 @@ async def test_farmer_get_harvester_plots_endpoints(
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.skip("This test causes hangs occasionally. TODO: fix this.")
|
||||
async def test_harvester_add_plot_directory(harvester_farmer_environment: HarvesterFarmerEnvironment) -> None:
|
||||
_, _, harvester_service, harvester_rpc_client, _ = harvester_farmer_environment
|
||||
|
||||
@@ -6,7 +6,7 @@ import pytest
|
||||
from chiabip158 import PyBIP158
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basic_filter_test(simulator_and_wallet):
|
||||
full_nodes, wallets, bt = simulator_and_wallet
|
||||
wallet_node, server_2 = wallets[0]
|
||||
|
||||
@@ -36,7 +36,7 @@ from tests.connection_utils import connect_and_get_peer
|
||||
from tests.util.rpc import validate_get_routes
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test1(two_nodes_sim_and_wallets_services, self_hostname, consensus_mode):
|
||||
num_blocks = 5
|
||||
nodes, _, bt = two_nodes_sim_and_wallets_services
|
||||
@@ -426,7 +426,7 @@ async def test1(two_nodes_sim_and_wallets_services, self_hostname, consensus_mod
|
||||
await client.await_closed()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_signage_points(two_nodes_sim_and_wallets_services, empty_blockchain):
|
||||
nodes, _, bt = two_nodes_sim_and_wallets_services
|
||||
full_node_service_1, full_node_service_2 = nodes
|
||||
@@ -557,7 +557,7 @@ async def test_signage_points(two_nodes_sim_and_wallets_services, empty_blockcha
|
||||
await client.await_closed()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_blockchain_state(one_wallet_and_one_simulator_services, self_hostname):
|
||||
num_blocks = 5
|
||||
nodes, _, bt = one_wallet_and_one_simulator_services
|
||||
@@ -638,7 +638,7 @@ async def test_get_blockchain_state(one_wallet_and_one_simulator_services, self_
|
||||
await client.await_closed()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_coin_name_not_in_request(one_node, self_hostname):
|
||||
[full_node_service], _, _ = one_node
|
||||
|
||||
@@ -657,7 +657,7 @@ async def test_coin_name_not_in_request(one_node, self_hostname):
|
||||
await client.await_closed()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_coin_name_not_found_in_mempool(one_node, self_hostname):
|
||||
[full_node_service], _, _ = one_node
|
||||
|
||||
@@ -679,7 +679,7 @@ async def test_coin_name_not_found_in_mempool(one_node, self_hostname):
|
||||
await client.await_closed()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_coin_name_found_in_mempool(one_node, self_hostname):
|
||||
[full_node_service], _, bt = one_node
|
||||
full_node_api = full_node_service._api
|
||||
|
||||
@@ -13,7 +13,7 @@ from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
from chia.util.merkle_set import MerkleSet, confirm_included_already_hashed
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_basics(bt):
|
||||
num_blocks = 20
|
||||
blocks = bt.get_consecutive_blocks(num_blocks)
|
||||
@@ -49,7 +49,7 @@ def hashdown(buf: bytes) -> bytes32:
|
||||
return bytes32(sha256(bytes([0] * 30) + buf).digest())
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_invalid_hash_size():
|
||||
merkle_set = MerkleSet()
|
||||
|
||||
@@ -75,7 +75,7 @@ async def test_merkle_set_invalid_hash_size():
|
||||
compute_merkle_set_root([b""])
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_1():
|
||||
a = bytes32([0x80] + [0] * 31)
|
||||
merkle_set = MerkleSet()
|
||||
@@ -84,7 +84,7 @@ async def test_merkle_set_1():
|
||||
assert merkle_set.get_root() == sha256(b"\1" + a).digest()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_duplicate():
|
||||
a = bytes32([0x80] + [0] * 31)
|
||||
merkle_set = MerkleSet()
|
||||
@@ -94,14 +94,14 @@ async def test_merkle_set_duplicate():
|
||||
assert merkle_set.get_root() == sha256(b"\1" + a).digest()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_0():
|
||||
merkle_set = MerkleSet()
|
||||
assert merkle_set.get_root() == bytes32(compute_merkle_set_root([]))
|
||||
assert merkle_set.get_root() == bytes32([0] * 32)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_2():
|
||||
a = bytes32([0x80] + [0] * 31)
|
||||
b = bytes32([0x70] + [0] * 31)
|
||||
@@ -112,7 +112,7 @@ async def test_merkle_set_2():
|
||||
assert merkle_set.get_root() == hashdown(b"\1\1" + b + a)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_2_reverse():
|
||||
a = bytes32([0x80] + [0] * 31)
|
||||
b = bytes32([0x70] + [0] * 31)
|
||||
@@ -123,7 +123,7 @@ async def test_merkle_set_2_reverse():
|
||||
assert merkle_set.get_root() == hashdown(b"\1\1" + b + a)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_3():
|
||||
a = bytes32([0x80] + [0] * 31)
|
||||
b = bytes32([0x70] + [0] * 31)
|
||||
@@ -144,7 +144,7 @@ async def test_merkle_set_3():
|
||||
# b c
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_4():
|
||||
a = bytes32([0x80] + [0] * 31)
|
||||
b = bytes32([0x70] + [0] * 31)
|
||||
@@ -166,7 +166,7 @@ async def test_merkle_set_4():
|
||||
# b c a d
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_set_5():
|
||||
BLANK = bytes32([0] * 32)
|
||||
|
||||
@@ -215,7 +215,7 @@ async def test_merkle_set_5():
|
||||
# e c
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_left_edge():
|
||||
BLANK = bytes32([0] * 32)
|
||||
a = bytes32([0x80] + [0] * 31)
|
||||
@@ -256,7 +256,7 @@ async def test_merkle_left_edge():
|
||||
# c d
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_merkle_right_edge():
|
||||
BLANK = bytes32([0] * 32)
|
||||
a = bytes32([0x40] + [0] * 31)
|
||||
@@ -304,7 +304,7 @@ def rand_hash(rng: random.Random) -> bytes32:
|
||||
return bytes32(ret)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.skip("This test is expensive and has already convinced us there are no discrepancies")
|
||||
async def test_merkle_set_random_regression():
|
||||
rng = random.Random()
|
||||
|
||||
@@ -146,7 +146,7 @@ def assert_standard_results(
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Flaky test with fixes in progress")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("use_tcp, target_address, request_type", all_test_combinations)
|
||||
async def test_error_conditions(
|
||||
seeder_service: DNSServer, use_tcp: bool, target_address: str, request_type: dns.rdatatype.RdataType
|
||||
@@ -237,7 +237,7 @@ async def test_error_conditions(
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Flaky test with fixes in progress")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("use_tcp, target_address, request_type", all_test_combinations)
|
||||
async def test_dns_queries(
|
||||
seeder_service: DNSServer, use_tcp: bool, target_address: str, request_type: dns.rdatatype.RdataType
|
||||
@@ -274,7 +274,7 @@ async def test_dns_queries(
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Flaky test with fixes in progress")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize("use_tcp, target_address, request_type", all_test_combinations)
|
||||
async def test_db_processing(
|
||||
seeder_service: DNSServer,
|
||||
|
||||
@@ -281,7 +281,7 @@ class TestConfig:
|
||||
except TimeoutError:
|
||||
pytest.skip("Timed out waiting for reader/writer processes to complete")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_non_atomic_writes(self, root_path_populated_with_config, default_config_dict):
|
||||
"""
|
||||
Test whether one continuous writer (writing constantly, but not atomically) will interfere with many
|
||||
|
||||
@@ -173,7 +173,7 @@ class TestMoveFile:
|
||||
|
||||
|
||||
class TestMoveFileAsync:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_move_file_async(self, tmp_path: Path):
|
||||
"""
|
||||
@@ -188,7 +188,7 @@ class TestMoveFileAsync:
|
||||
assert dst_path.exists() is True
|
||||
assert dst_path.read_text() == "source"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_move_file_async_failure_no_reattempts(self, tmp_path: Path, monkeypatch):
|
||||
"""
|
||||
@@ -213,7 +213,7 @@ class TestMoveFileAsync:
|
||||
assert src_path.exists() is True
|
||||
assert dst_path.exists() is False
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_move_file_async_success_on_reattempt(self, tmp_path: Path, monkeypatch):
|
||||
"""
|
||||
@@ -249,7 +249,7 @@ class TestMoveFileAsync:
|
||||
assert dst_path.exists() is True
|
||||
assert dst_path.read_text() == "source"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_move_file_async_failure_on_reattempt(self, tmp_path: Path, monkeypatch):
|
||||
"""
|
||||
@@ -282,7 +282,7 @@ class TestMoveFileAsync:
|
||||
|
||||
|
||||
class TestWriteFile:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_write_file(self, tmp_path: Path):
|
||||
"""
|
||||
@@ -293,7 +293,7 @@ class TestWriteFile:
|
||||
await write_file_async(dest_path, "test")
|
||||
assert dest_path.read_text() == "test"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_write_file_overwrite(self, tmp_path: Path):
|
||||
"""
|
||||
@@ -305,7 +305,7 @@ class TestWriteFile:
|
||||
await write_file_async(dest_path, "test2")
|
||||
assert dest_path.read_text() == "test2"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_write_file_create_intermediate_dirs(self, tmp_path: Path):
|
||||
"""
|
||||
@@ -316,7 +316,7 @@ class TestWriteFile:
|
||||
await write_file_async(dest_path, "test")
|
||||
assert dest_path.read_text() == "test"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_write_file_existing_intermediate_dirs(self, tmp_path: Path):
|
||||
"""
|
||||
@@ -329,7 +329,7 @@ class TestWriteFile:
|
||||
await write_file_async(dest_path, "test")
|
||||
assert dest_path.read_text() == "test"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_write_file_default_permissions(self, tmp_path: Path):
|
||||
"""
|
||||
@@ -348,7 +348,7 @@ class TestWriteFile:
|
||||
# Expect: file has default permissions of 0o600
|
||||
assert oct(dest_path.stat().st_mode)[-3:] == oct(0o600)[-3:]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_write_file_custom_permissions(self, tmp_path: Path):
|
||||
"""
|
||||
@@ -364,7 +364,7 @@ class TestWriteFile:
|
||||
# Expect: file has custom permissions of 0o642
|
||||
assert oct(dest_path.stat().st_mode)[-3:] == oct(0o642)[-3:]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
# use tmp_path pytest fixture to create a temporary directory
|
||||
async def test_write_file_os_replace_raising_permissionerror(self, tmp_path: Path, monkeypatch):
|
||||
"""
|
||||
|
||||
@@ -293,7 +293,8 @@ def test_key_data_post_init(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("include_secrets", [True, False])
|
||||
def test_get_key(include_secrets: bool, get_temp_keyring: Keychain):
|
||||
@pytest.mark.anyio
|
||||
async def test_get_key(include_secrets: bool, get_temp_keyring: Keychain):
|
||||
keychain: Keychain = get_temp_keyring
|
||||
expected_keys = []
|
||||
# Add 10 keys and validate the result `get_key` for each of them after each addition
|
||||
@@ -320,7 +321,8 @@ def test_get_key(include_secrets: bool, get_temp_keyring: Keychain):
|
||||
|
||||
|
||||
@pytest.mark.parametrize("include_secrets", [True, False])
|
||||
def test_get_keys(include_secrets: bool, get_temp_keyring: Keychain):
|
||||
@pytest.mark.anyio
|
||||
async def test_get_keys(include_secrets: bool, get_temp_keyring: Keychain):
|
||||
keychain: Keychain = get_temp_keyring
|
||||
# Should be empty on start
|
||||
assert keychain.get_keys(include_secrets) == []
|
||||
@@ -343,7 +345,8 @@ def test_get_keys(include_secrets: bool, get_temp_keyring: Keychain):
|
||||
assert keychain.get_keys(include_secrets) == []
|
||||
|
||||
|
||||
def test_set_label(get_temp_keyring: Keychain) -> None:
|
||||
@pytest.mark.anyio
|
||||
async def test_set_label(get_temp_keyring: Keychain) -> None:
|
||||
keychain: Keychain = get_temp_keyring
|
||||
# Generate a key and add it without label
|
||||
key_data_0 = KeyData.generate(label=None)
|
||||
@@ -385,7 +388,8 @@ def test_set_label(get_temp_keyring: Keychain) -> None:
|
||||
("a" * 70, "label exceeds max length: 70/65"),
|
||||
],
|
||||
)
|
||||
def test_set_label_invalid_labels(label: str, message: str, get_temp_keyring: Keychain) -> None:
|
||||
@pytest.mark.anyio
|
||||
async def test_set_label_invalid_labels(label: str, message: str, get_temp_keyring: Keychain) -> None:
|
||||
keychain: Keychain = get_temp_keyring
|
||||
key_data = KeyData.generate()
|
||||
keychain.add_private_key(key_data.mnemonic_str())
|
||||
@@ -394,7 +398,8 @@ def test_set_label_invalid_labels(label: str, message: str, get_temp_keyring: Ke
|
||||
assert e.value.label == label
|
||||
|
||||
|
||||
def test_delete_label(get_temp_keyring: Keychain) -> None:
|
||||
@pytest.mark.anyio
|
||||
async def test_delete_label(get_temp_keyring: Keychain) -> None:
|
||||
keychain: Keychain = get_temp_keyring
|
||||
# Generate two keys and add them to the keychain
|
||||
key_data_0 = KeyData.generate(label="key_0")
|
||||
@@ -433,7 +438,8 @@ def test_delete_label(get_temp_keyring: Keychain) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("delete_all", [True, False])
|
||||
def test_delete_drops_labels(get_temp_keyring: Keychain, delete_all: bool) -> None:
|
||||
@pytest.mark.anyio
|
||||
async def test_delete_drops_labels(get_temp_keyring: Keychain, delete_all: bool) -> None:
|
||||
keychain: Keychain = get_temp_keyring
|
||||
# Generate some keys and add them to the keychain
|
||||
labels = [f"key_{i}" for i in range(5)]
|
||||
|
||||
@@ -12,6 +12,7 @@ from chia.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# TODO: might need to use the anyio_backend fixture per https://anyio.readthedocs.io/en/stable/testing.html
|
||||
@pytest.fixture(autouse=True, scope="function")
|
||||
def setup_keyring_wrapper():
|
||||
yield
|
||||
|
||||
+15
-15
@@ -100,7 +100,7 @@ def get_reader_method_fixture(request: SubRequest) -> Callable[[], ConnectionCon
|
||||
return request.param # type: ignore[no-any-return]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
argnames="acquire_outside",
|
||||
argvalues=[pytest.param(False, id="not acquired outside"), pytest.param(True, id="acquired outside")],
|
||||
@@ -132,7 +132,7 @@ async def test_concurrent_writers(acquire_outside: bool, get_reader_method: GetR
|
||||
assert value == concurrent_task_count
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_writers_nests() -> None:
|
||||
async with DBConnection(2) as db_wrapper:
|
||||
await setup_table(db_wrapper)
|
||||
@@ -151,7 +151,7 @@ async def test_writers_nests() -> None:
|
||||
assert value == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_writer_journal_mode_wal() -> None:
|
||||
async with PathDBConnection(2) as db_wrapper:
|
||||
async with db_wrapper.writer() as connection:
|
||||
@@ -160,7 +160,7 @@ async def test_writer_journal_mode_wal() -> None:
|
||||
assert result == ("wal",)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reader_journal_mode_wal() -> None:
|
||||
async with PathDBConnection(2) as db_wrapper:
|
||||
async with db_wrapper.reader_no_transaction() as connection:
|
||||
@@ -169,7 +169,7 @@ async def test_reader_journal_mode_wal() -> None:
|
||||
assert result == ("wal",)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_partial_failure() -> None:
|
||||
values = []
|
||||
async with DBConnection(2) as db_wrapper:
|
||||
@@ -196,7 +196,7 @@ async def test_partial_failure() -> None:
|
||||
assert values == [42, 1337, 1, 42]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_readers_nests(get_reader_method: GetReaderMethod) -> None:
|
||||
async with DBConnection(2) as db_wrapper:
|
||||
await setup_table(db_wrapper)
|
||||
@@ -212,7 +212,7 @@ async def test_readers_nests(get_reader_method: GetReaderMethod) -> None:
|
||||
assert value == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_readers_nests_writer(get_reader_method: GetReaderMethod) -> None:
|
||||
async with DBConnection(2) as db_wrapper:
|
||||
await setup_table(db_wrapper)
|
||||
@@ -235,7 +235,7 @@ async def test_readers_nests_writer(get_reader_method: GetReaderMethod) -> None:
|
||||
pytest.param(False, id="no transaction"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_only_transactioned_reader_ignores_writer(transactioned: bool) -> None:
|
||||
writer_committed = asyncio.Event()
|
||||
reader_read = asyncio.Event()
|
||||
@@ -273,7 +273,7 @@ async def test_only_transactioned_reader_ignores_writer(transactioned: bool) ->
|
||||
assert await query_value(connection=reader) == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reader_nests_and_ends_transaction() -> None:
|
||||
async with DBConnection(2) as db_wrapper:
|
||||
async with db_wrapper.reader() as reader:
|
||||
@@ -288,7 +288,7 @@ async def test_reader_nests_and_ends_transaction() -> None:
|
||||
assert not reader.in_transaction
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_writer_in_reader_works() -> None:
|
||||
async with PathDBConnection(2) as db_wrapper:
|
||||
await setup_table(db_wrapper)
|
||||
@@ -303,7 +303,7 @@ async def test_writer_in_reader_works() -> None:
|
||||
assert await query_value(connection=reader) == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reader_transaction_is_deferred() -> None:
|
||||
async with DBConnection(2) as db_wrapper:
|
||||
await setup_table(db_wrapper)
|
||||
@@ -319,7 +319,7 @@ async def test_reader_transaction_is_deferred() -> None:
|
||||
assert await query_value(connection=reader) == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
argnames="acquire_outside",
|
||||
argvalues=[pytest.param(False, id="not acquired outside"), pytest.param(True, id="acquired outside")],
|
||||
@@ -348,7 +348,7 @@ async def test_concurrent_readers(acquire_outside: bool, get_reader_method: GetR
|
||||
assert values == [1] * concurrent_task_count
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
argnames="acquire_outside",
|
||||
argvalues=[pytest.param(False, id="not acquired outside"), pytest.param(True, id="acquired outside")],
|
||||
@@ -402,7 +402,7 @@ async def test_mixed_readers_writers(acquire_outside: bool, get_reader_method: G
|
||||
[DBWrapper2.reader_no_transaction, False],
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_in_transaction_as_expected(
|
||||
manager_method: Callable[[DBWrapper2], ConnectionContextManager],
|
||||
expected: bool,
|
||||
@@ -414,7 +414,7 @@ async def test_in_transaction_as_expected(
|
||||
assert connection.in_transaction == expected
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cancelled_reader_does_not_cancel_writer() -> None:
|
||||
async with DBConnection(2) as db_wrapper:
|
||||
await setup_table(db_wrapper)
|
||||
|
||||
@@ -548,7 +548,7 @@ def test_increment_pool_stats(case: IncrementPoolStatsCase) -> None:
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_new_proof_of_space_for_pool_stats(
|
||||
harvester_farmer_environment: HarvesterFarmerEnvironment,
|
||||
case: NewProofOfSpaceCase,
|
||||
@@ -850,7 +850,7 @@ class PoolStateCase:
|
||||
),
|
||||
),
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_pool_response(
|
||||
mocker: MockerFixture,
|
||||
farmer_one_harvester: Tuple[List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools],
|
||||
|
||||
@@ -44,7 +44,7 @@ async def update_harvester_config(harvester_rpc_port: Optional[int], root_path:
|
||||
return await harvester_client.update_harvester_config(config)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_start_with_empty_keychain(
|
||||
farmer_one_harvester_not_started: Tuple[
|
||||
List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools
|
||||
@@ -71,7 +71,7 @@ async def test_start_with_empty_keychain(
|
||||
assert not farmer.started
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_harvester_handshake(
|
||||
farmer_one_harvester_not_started: Tuple[
|
||||
List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools
|
||||
@@ -137,7 +137,7 @@ async def test_harvester_handshake(
|
||||
await time_out_assert(5, handshake_done, True)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_respond_signatures(
|
||||
caplog: pytest.LogCaptureFixture, harvester_farmer_environment: HarvesterFarmerEnvironment
|
||||
) -> None:
|
||||
@@ -170,7 +170,7 @@ async def test_farmer_respond_signatures(
|
||||
assert expected_error in caplog.text
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_harvester_config(
|
||||
farmer_one_harvester: Tuple[List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools]
|
||||
) -> None:
|
||||
@@ -214,7 +214,7 @@ async def test_harvester_config(
|
||||
check_config_match(new_config, harvester_config)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_missing_signage_point(
|
||||
farmer_one_harvester: Tuple[List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools]
|
||||
) -> None:
|
||||
@@ -286,7 +286,7 @@ async def test_missing_signage_point(
|
||||
assert number_of_missing_sps == uint32(1)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_harvester_has_no_server(
|
||||
farmer_one_harvester: Tuple[List[Service[Farmer, FarmerAPI]], Service[Harvester, HarvesterAPI], BlockTools],
|
||||
) -> None:
|
||||
|
||||
@@ -5,7 +5,6 @@ from pathlib import Path
|
||||
from typing import Any, AsyncIterator, Dict, List, Optional, Tuple
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from chia.farmer.farmer_api import FarmerAPI
|
||||
from chia.harvester.harvester import Harvester
|
||||
@@ -51,7 +50,7 @@ def test_filter_prefix_bits_on_blocks(
|
||||
assert passed == should_pass
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def farmer_harvester_with_filter_size_9(
|
||||
get_temp_keyring: Keychain, tmp_path: Path, self_hostname: str
|
||||
) -> AsyncIterator[Tuple[Service[Harvester, HarvesterAPI], FarmerAPI]]:
|
||||
@@ -88,7 +87,7 @@ async def farmer_harvester_with_filter_size_9(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(argnames=["peak_height", "eligible_plots"], argvalues=[(5495999, 0), (5496000, 1)])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_filter_prefix_bits_with_farmer_harvester(
|
||||
farmer_harvester_with_filter_size_9: Tuple[Service[Harvester, HarvesterAPI], FarmerAPI],
|
||||
peak_height: uint32,
|
||||
|
||||
@@ -215,7 +215,7 @@ def test_current_block_height_new_block_then_new_height() -> None:
|
||||
assert mempool.fee_estimator.current_block_height == height + 1 # type: ignore[attr-defined]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_mm_new_peak_changes_fee_estimator_block_height() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
block2 = create_test_block_record(height=uint32(2))
|
||||
@@ -223,7 +223,7 @@ async def test_mm_new_peak_changes_fee_estimator_block_height() -> None:
|
||||
assert mempool_manager.mempool.fee_estimator.block_height == uint32(2) # type: ignore[attr-defined]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_mm_calls_new_block_height() -> None:
|
||||
mempool_manager = await instantiate_mempool_manager(zero_calls_get_coin_record)
|
||||
new_block_height_called = False
|
||||
|
||||
@@ -4,7 +4,6 @@ import re
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from chia.full_node.full_node import FullNode
|
||||
from chia.rpc.full_node_rpc_api import FullNodeRpcApi
|
||||
@@ -22,7 +21,7 @@ from chia.wallet.wallet_node import WalletNode
|
||||
from chia.wallet.wallet_node_api import WalletNodeAPI
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def setup_node_and_rpc(
|
||||
two_wallet_nodes_services: Tuple[
|
||||
List[Service[FullNode, FullNodeSimulator]], List[Service[WalletNode, WalletNodeAPI]], BlockTools
|
||||
@@ -50,7 +49,7 @@ async def setup_node_and_rpc(
|
||||
return client, full_node_rpc_api
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def one_node_no_blocks(
|
||||
one_node: Tuple[List[Service[FullNode, FullNodeSimulator]], List[Service[WalletNode, WalletNodeAPI]], BlockTools]
|
||||
) -> Tuple[FullNodeRpcClient, FullNodeRpcApi]:
|
||||
@@ -70,7 +69,7 @@ async def one_node_no_blocks(
|
||||
return client, full_node_rpc_api
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_blockchain_state(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
# Confirm full node setup correctly
|
||||
client, _ = setup_node_and_rpc
|
||||
@@ -78,7 +77,7 @@ async def test_get_blockchain_state(setup_node_and_rpc: Tuple[FullNodeRpcClient,
|
||||
assert response["genesis_challenge_initialized"] is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_request(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
|
||||
@@ -86,7 +85,7 @@ async def test_empty_request(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNo
|
||||
await full_node_rpc_api.get_fee_estimate({})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_peak(one_node_no_blocks: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = one_node_no_blocks
|
||||
response = await full_node_rpc_api.get_fee_estimate({"target_times": [], "cost": 1})
|
||||
@@ -109,56 +108,56 @@ async def test_empty_peak(one_node_no_blocks: Tuple[FullNodeRpcClient, FullNodeR
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_no_target_times(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
with pytest.raises(ValueError):
|
||||
await full_node_rpc_api.get_fee_estimate({"cost": 1})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_negative_time(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
with pytest.raises(ValueError):
|
||||
await full_node_rpc_api.get_fee_estimate({"cost": 1, "target_times": [-1]})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_negative_cost(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
with pytest.raises(ValueError):
|
||||
await full_node_rpc_api.get_fee_estimate({"cost": -1, "target_times": [1]})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_no_cost_or_tx(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
with pytest.raises(ValueError):
|
||||
await full_node_rpc_api.get_fee_estimate({"target_times": []})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_both_cost_and_tx(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
with pytest.raises(ValueError):
|
||||
await full_node_rpc_api.get_fee_estimate({"target_times": [], "cost": 1, "spend_bundle": "80"})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_target_times_invalid_type(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
with pytest.raises(TypeError):
|
||||
await full_node_rpc_api.get_fee_estimate({"target_times": 1, "cost": 1})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cost_invalid_type(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
with pytest.raises(ValueError):
|
||||
await full_node_rpc_api.get_fee_estimate({"target_times": [], "cost": "a lot"})
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_tx_invalid_type(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
with pytest.raises(TypeError):
|
||||
@@ -168,7 +167,7 @@ async def test_tx_invalid_type(setup_node_and_rpc: Tuple[FullNodeRpcClient, Full
|
||||
#####################
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_empty_target_times(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
response = await full_node_rpc_api.get_fee_estimate({"target_times": [], "cost": 1})
|
||||
@@ -176,7 +175,7 @@ async def test_empty_target_times(setup_node_and_rpc: Tuple[FullNodeRpcClient, F
|
||||
assert response["target_times"] == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cost(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
response = await full_node_rpc_api.get_fee_estimate({"target_times": [1], "cost": 1})
|
||||
@@ -184,7 +183,7 @@ async def test_cost(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]
|
||||
assert response["target_times"] == [1]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_tx(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi], bt: BlockTools) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
wallet_a: WalletTool = bt.get_pool_wallet_tool()
|
||||
@@ -201,7 +200,7 @@ async def test_tx(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi],
|
||||
assert response["target_times"] == [1]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_multiple(setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi]) -> None:
|
||||
client, full_node_rpc_api = setup_node_and_rpc
|
||||
response = await full_node_rpc_api.get_fee_estimate({"target_times": [1, 5, 10, 15, 60, 120, 180, 240], "cost": 1})
|
||||
@@ -217,7 +216,7 @@ def get_test_spendbundle(bt: BlockTools) -> SpendBundle:
|
||||
return wallet_a.generate_signed_transaction(uint64(coin_to_spend.amount), recevier_puzzle_hash, coin_to_spend)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_fee_estimate_cost_err(
|
||||
setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi], bt: BlockTools
|
||||
) -> None:
|
||||
@@ -242,7 +241,7 @@ async def test_validate_fee_estimate_cost_err(
|
||||
_ = await full_node_rpc_api.get_fee_estimate(request)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_validate_fee_estimate_cost_ok(
|
||||
setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi], bt: BlockTools
|
||||
) -> None:
|
||||
@@ -260,7 +259,7 @@ async def test_validate_fee_estimate_cost_ok(
|
||||
_ = await full_node_rpc_api.get_fee_estimate(request)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_spendbundle_type_cost_missing(
|
||||
setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi], bt: BlockTools
|
||||
) -> None:
|
||||
@@ -270,7 +269,7 @@ async def test_get_spendbundle_type_cost_missing(
|
||||
_ = await full_node_rpc_api.get_fee_estimate(request)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_spendbundle_type_cost_spend_count_ok(
|
||||
setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi], bt: BlockTools
|
||||
) -> None:
|
||||
@@ -282,7 +281,7 @@ async def test_get_spendbundle_type_cost_spend_count_ok(
|
||||
print(spend_count, ret)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_spendbundle_type_cost_spend_count_bad(
|
||||
setup_node_and_rpc: Tuple[FullNodeRpcClient, FullNodeRpcApi], bt: BlockTools
|
||||
) -> None:
|
||||
|
||||
@@ -78,7 +78,7 @@ async def init_test(
|
||||
return estimator, spend_coins, fee_coins # new_reward_coins
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_mempool_inclusion_filter_basic() -> None:
|
||||
async with sim_and_client(defaults=NEW_DEFAULT_CONSTANTS, pass_prefarm=False) as (sim, cli):
|
||||
estimator, spend_coins, fee_coins = await init_test(sim, cli, the_puzzle_hash, 1)
|
||||
@@ -108,7 +108,7 @@ async def test_mempool_inclusion_filter_basic() -> None:
|
||||
assert mempool_item.name not in removal_ids
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_mempoolitem_height_added(db_version: int) -> None:
|
||||
async with sim_and_client(defaults=NEW_DEFAULT_CONSTANTS, pass_prefarm=False) as (sim, cli):
|
||||
estimator, spend_coins, fee_coins = await init_test(sim, cli, the_puzzle_hash, 1)
|
||||
|
||||
@@ -8,7 +8,6 @@ from shutil import copy
|
||||
from typing import Any, Callable, List, Optional, Tuple
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from blspy import G1Element
|
||||
|
||||
from chia.farmer.farmer import Farmer
|
||||
@@ -275,7 +274,7 @@ class Environment:
|
||||
)
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def environment(
|
||||
tmp_path: Path,
|
||||
farmer_two_harvester_not_started: Tuple[
|
||||
@@ -341,7 +340,7 @@ async def environment(
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_valid(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
env.add_directory(0, env.dir_1)
|
||||
@@ -370,7 +369,7 @@ async def test_sync_valid(environment: Environment) -> None:
|
||||
await env.run_sync_test()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_invalid(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
assert len(env.farmer.plot_sync_receivers) == 2
|
||||
@@ -412,7 +411,7 @@ async def test_sync_invalid(environment: Environment) -> None:
|
||||
await env.run_sync_test()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_keys_missing(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
env.add_directory(0, env.dir_1)
|
||||
@@ -448,7 +447,7 @@ async def test_sync_keys_missing(environment: Environment) -> None:
|
||||
await env.run_sync_test()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_duplicates(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
# dir_4 and then dir_duplicates contain the same plots. Load dir_4 first to make sure the plots seen as duplicates
|
||||
@@ -494,13 +493,13 @@ async def remove_and_validate_all_directories(env: Environment) -> None:
|
||||
await env.run_sync_test()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_add_and_remove_all_directories(environment: Environment) -> None:
|
||||
await add_and_validate_all_directories(environment)
|
||||
await remove_and_validate_all_directories(environment)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_harvester_restart(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
# Load all directories for both harvesters
|
||||
@@ -526,7 +525,7 @@ async def test_harvester_restart(environment: Environment) -> None:
|
||||
await env.run_sync_test()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_restart(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
# Load all directories for both harvesters
|
||||
@@ -564,7 +563,7 @@ async def test_farmer_restart(environment: Environment) -> None:
|
||||
assert len(plot_manager.get_duplicates()) == len(receiver.duplicates()) == expected.duplicates_count
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_start_and_disconnect_while_sync_is_active(
|
||||
farmer_one_harvester: Tuple[List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools]
|
||||
) -> None:
|
||||
|
||||
@@ -128,7 +128,7 @@ def post_function_validate(receiver: Receiver, data: Union[List[Plot], List[str]
|
||||
assert path in receiver._current_sync.delta.duplicates.additions
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def run_sync_step(receiver: Receiver, sync_step: SyncStepData) -> None:
|
||||
assert receiver.current_sync().state == sync_step.state
|
||||
last_sync_time_before = receiver._last_sync.time_done
|
||||
@@ -222,7 +222,7 @@ def test_default_values(seeded_random: random.Random) -> None:
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reset(seeded_random: random.Random) -> None:
|
||||
receiver, sync_steps = plot_sync_setup(seeded_random=seeded_random)
|
||||
connection_before = receiver.connection()
|
||||
@@ -256,7 +256,7 @@ async def test_reset(seeded_random: random.Random) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("counts_only", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_to_dict(counts_only: bool, seeded_random: random.Random) -> None:
|
||||
receiver, sync_steps = plot_sync_setup(seeded_random=seeded_random)
|
||||
plot_sync_dict_1 = receiver.to_dict(counts_only)
|
||||
@@ -337,7 +337,7 @@ async def test_to_dict(counts_only: bool, seeded_random: random.Random) -> None:
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_flow(seeded_random: random.Random) -> None:
|
||||
receiver, sync_steps = plot_sync_setup(seeded_random=seeded_random)
|
||||
|
||||
@@ -379,7 +379,7 @@ async def test_sync_flow(seeded_random: random.Random) -> None:
|
||||
assert receiver.current_sync().state == State.idle
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_ids(seeded_random: random.Random) -> None:
|
||||
receiver, sync_steps = plot_sync_setup(seeded_random=seeded_random)
|
||||
for state in State:
|
||||
@@ -430,7 +430,7 @@ async def test_invalid_ids(seeded_random: random.Random) -> None:
|
||||
pytest.param(State.removed, ErrorCodes.plot_not_available, id="not available"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_plot_errors(state_to_fail: State, expected_error_code: ErrorCodes, seeded_random: random.Random) -> None:
|
||||
receiver, sync_steps = plot_sync_setup(seeded_random=seeded_random)
|
||||
for state in State:
|
||||
|
||||
@@ -48,7 +48,7 @@ def test_set_connection_values(bt: BlockTools, seeded_random: random.Random) ->
|
||||
assert sender._connection == farmer_connection # type: ignore[comparison-overlap]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_start_stop_send_task(bt: BlockTools) -> None:
|
||||
sender = Sender(bt.plot_manager, HarvestingMode.CPU)
|
||||
# Make sure starting/restarting works
|
||||
|
||||
@@ -291,7 +291,7 @@ def create_example_plots(count: int, seeded_random: random.Random) -> List[PlotI
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_simulated(
|
||||
farmer_three_harvester_not_started: Tuple[
|
||||
List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools
|
||||
@@ -373,7 +373,7 @@ async def test_sync_simulated(
|
||||
ErrorSimulation.RespondTwice,
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_farmer_error_simulation(
|
||||
farmer_one_harvester_not_started: Tuple[
|
||||
List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools
|
||||
@@ -401,7 +401,7 @@ async def test_farmer_error_simulation(
|
||||
|
||||
|
||||
@pytest.mark.parametrize("simulate_error", [ErrorSimulation.NonRecoverableError, ErrorSimulation.NotConnected])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sync_reset_cases(
|
||||
farmer_one_harvester_not_started: Tuple[
|
||||
List[Service[Harvester, HarvesterAPI]], Service[Farmer, FarmerAPI], BlockTools
|
||||
|
||||
@@ -170,7 +170,7 @@ def trigger_remove_plot(_: Path, plot_path: str):
|
||||
|
||||
|
||||
@pytest.mark.limit_consensus_modes(reason="not dependent on consensus, does not support parallel execution")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_plot_refreshing(environment):
|
||||
env: Environment = environment
|
||||
expected_result = PlotRefreshResult()
|
||||
@@ -365,7 +365,7 @@ async def test_plot_refreshing(environment):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_initial_refresh_flag(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
assert env.refresh_tester.plot_manager.initial_refresh()
|
||||
@@ -376,7 +376,7 @@ async def test_initial_refresh_flag(environment: Environment) -> None:
|
||||
assert env.refresh_tester.plot_manager.initial_refresh()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_invalid_plots(environment):
|
||||
env: Environment = environment
|
||||
expected_result = PlotRefreshResult()
|
||||
@@ -429,7 +429,7 @@ async def test_invalid_plots(environment):
|
||||
assert retry_test_plot not in env.refresh_tester.plot_manager.failed_to_open_filenames
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_keys_missing(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
not_in_keychain_plots: List[Path] = get_test_plots("not_in_keychain")
|
||||
@@ -465,7 +465,7 @@ async def test_keys_missing(environment: Environment) -> None:
|
||||
assert len(env.refresh_tester.plot_manager.no_key_filenames) == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_plot_info_caching(environment, bt):
|
||||
env: Environment = environment
|
||||
expected_result = PlotRefreshResult()
|
||||
@@ -527,7 +527,7 @@ async def test_plot_info_caching(environment, bt):
|
||||
plot_manager.stop_refreshing()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_drop_too_large_cache_entries(environment, bt):
|
||||
env: Environment = environment
|
||||
expected_result = PlotRefreshResult(loaded=env.dir_1.plot_info_list(), processed=len(env.dir_1))
|
||||
@@ -612,7 +612,7 @@ async def test_drop_too_large_cache_entries(environment, bt):
|
||||
assert_cache([plot_info for plot_info in plot_infos if plot_info.prover.get_filename() not in invalid_entries])
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cache_lifetime(environment: Environment) -> None:
|
||||
# Load a directory to produce a cache file
|
||||
env: Environment = environment
|
||||
@@ -654,7 +654,7 @@ async def test_cache_lifetime(environment: Environment) -> None:
|
||||
pytest.param(PlotRefreshEvents.done, id="done"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_callback_event_raises(environment, event_to_raise: PlotRefreshEvents):
|
||||
last_event_fired: Optional[PlotRefreshEvents] = None
|
||||
|
||||
@@ -702,7 +702,7 @@ async def test_callback_event_raises(environment, event_to_raise: PlotRefreshEve
|
||||
await env.refresh_tester.run(expected_result)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_recursive_plot_scan(environment: Environment) -> None:
|
||||
env: Environment = environment
|
||||
# Create a directory tree with some subdirectories containing plots, others not.
|
||||
|
||||
@@ -10,7 +10,6 @@ from shutil import rmtree
|
||||
from typing import Any, AsyncIterator, Dict, List, Tuple
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
# TODO: update after resolution in https://github.com/pytest-dev/pytest/issues/7469
|
||||
from _pytest.fixtures import SubRequest
|
||||
@@ -96,7 +95,7 @@ def fee(trusted: bool) -> uint64:
|
||||
OneWalletNodeAndRpc = Tuple[WalletRpcClient, Any, FullNodeSimulator, int, BlockTools]
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def one_wallet_node_and_rpc(
|
||||
trusted: bool, self_hostname: str, blockchain_constants: ConsensusConstants
|
||||
) -> AsyncIterator[OneWalletNodeAndRpc]:
|
||||
@@ -134,7 +133,7 @@ async def one_wallet_node_and_rpc(
|
||||
Setup = Tuple[FullNodeSimulator, WalletNode, bytes32, int, WalletRpcClient]
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def setup(
|
||||
one_wallet_and_one_simulator_services: Tuple[
|
||||
List[Service[FullNode, FullNodeSimulator]], List[Service[WalletNode, WalletNodeAPI]], BlockTools
|
||||
@@ -185,7 +184,7 @@ async def setup(
|
||||
|
||||
|
||||
class TestPoolWalletRpc:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_new_pool_wallet_self_farm(
|
||||
self,
|
||||
one_wallet_node_and_rpc: OneWalletNodeAndRpc,
|
||||
@@ -237,7 +236,7 @@ class TestPoolWalletRpc:
|
||||
assert hexstr_to_bytes(pool_config["launcher_id"]) == launcher_id
|
||||
assert pool_config["pool_url"] == ""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_new_pool_wallet_farm_to_pool(
|
||||
self,
|
||||
one_wallet_node_and_rpc: OneWalletNodeAndRpc,
|
||||
@@ -290,7 +289,7 @@ class TestPoolWalletRpc:
|
||||
assert hexstr_to_bytes(pool_config["launcher_id"]) == launcher_id
|
||||
assert pool_config["pool_url"] == "http://pool.example.com"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_multiple_pool_wallets(
|
||||
self,
|
||||
one_wallet_node_and_rpc: OneWalletNodeAndRpc,
|
||||
@@ -403,7 +402,7 @@ class TestPoolWalletRpc:
|
||||
assert owner_sk is not None
|
||||
assert owner_sk[0] != auth_sk
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_absorb_self(
|
||||
self, one_wallet_node_and_rpc: OneWalletNodeAndRpc, fee: uint64, self_hostname: str
|
||||
) -> None:
|
||||
@@ -481,7 +480,7 @@ class TestPoolWalletRpc:
|
||||
tx1 = await client.get_transactions(1)
|
||||
assert (250_000_000_000 + fee) in [tx.amount for tx in tx1]
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_absorb_self_multiple_coins(
|
||||
self, one_wallet_node_and_rpc: OneWalletNodeAndRpc, fee: uint64, self_hostname: str
|
||||
) -> None:
|
||||
@@ -550,7 +549,7 @@ class TestPoolWalletRpc:
|
||||
assert pool_bal["confirmed_wallet_balance"] == pool_expected_confirmed_balance
|
||||
assert main_bal["confirmed_wallet_balance"] == main_expected_confirmed_balance # 10499999999999
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_absorb_pooling(
|
||||
self, one_wallet_node_and_rpc: OneWalletNodeAndRpc, fee: uint64, self_hostname: str
|
||||
) -> None:
|
||||
@@ -669,7 +668,7 @@ class TestPoolWalletRpc:
|
||||
bal2 = await client.get_wallet_balance(2)
|
||||
assert bal2["confirmed_wallet_balance"] == 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_self_pooling_to_pooling(self, setup: Setup, fee: uint64, self_hostname: str) -> None:
|
||||
"""
|
||||
This tests self-pooling -> pooling
|
||||
@@ -757,7 +756,7 @@ class TestPoolWalletRpc:
|
||||
await time_out_assert(20, status_is_farming_to_pool, True, wallet_id_2)
|
||||
assert len(await wallet_node.wallet_state_manager.tx_store.get_unconfirmed_for_wallet(2)) == 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_leave_pool(self, setup: Setup, fee: uint64, self_hostname: str) -> None:
|
||||
"""This tests self-pooling -> pooling -> escaping -> self pooling"""
|
||||
full_node_api, wallet_node, our_ph, total_block_rewards, client = setup
|
||||
@@ -856,7 +855,7 @@ class TestPoolWalletRpc:
|
||||
await time_out_assert(timeout=MAX_WAIT_SECS, function=status_is_self_pooling)
|
||||
assert len(await wallet_node.wallet_state_manager.tx_store.get_unconfirmed_for_wallet(2)) == 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_change_pools(self, setup: Setup, fee: uint64, self_hostname: str) -> None:
|
||||
"""This tests Pool A -> escaping -> Pool B"""
|
||||
full_node_api, wallet_node, our_ph, total_block_rewards, client = setup
|
||||
@@ -923,7 +922,7 @@ class TestPoolWalletRpc:
|
||||
assert pw_info.current.relative_lock_height == 10
|
||||
assert len(await wallet_node.wallet_state_manager.tx_store.get_unconfirmed_for_wallet(2)) == 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_change_pools_reorg(self, setup: Setup, fee: uint64, self_hostname: str) -> None:
|
||||
"""This tests Pool A -> escaping -> reorg -> escaping -> Pool B"""
|
||||
full_node_api, wallet_node, our_ph, total_block_rewards, client = setup
|
||||
|
||||
@@ -50,7 +50,7 @@ class MockPoolWalletInfo:
|
||||
current: MockPoolState
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_update_pool_config_new_config(monkeypatch: Any) -> None:
|
||||
"""
|
||||
Test that PoolWallet can create a new pool config
|
||||
@@ -115,7 +115,7 @@ async def test_update_pool_config_new_config(monkeypatch: Any) -> None:
|
||||
assert updated_configs[0].owner_public_key == owner_pubkey
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_update_pool_config_existing_payout_instructions(monkeypatch: Any) -> None:
|
||||
"""
|
||||
Test that PoolWallet will retain existing payout_instructions when updating the pool config.
|
||||
|
||||
@@ -59,7 +59,7 @@ class DummySpends:
|
||||
|
||||
|
||||
class TestWalletPoolStore:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_store(self, seeded_random: random.Random):
|
||||
async with DBConnection(1) as db_wrapper:
|
||||
store = await WalletPoolStore.create(db_wrapper)
|
||||
@@ -141,7 +141,7 @@ class TestWalletPoolStore:
|
||||
assert await store.get_spends_for_wallet(1) == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_delete_wallet(seeded_random: random.Random) -> None:
|
||||
dummy_spends = DummySpends(seeded_random=seeded_random)
|
||||
for i in range(5):
|
||||
|
||||
@@ -7,7 +7,6 @@ from typing import AsyncIterator, List, Tuple
|
||||
import aiohttp
|
||||
import pkg_resources
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from chia.cmds.units import units
|
||||
from chia.consensus.block_record import BlockRecord
|
||||
@@ -53,7 +52,7 @@ test_constants_modified = dataclasses.replace(
|
||||
# fixture, to test all versions of the database schema. This doesn't work
|
||||
# because of a hack in shutting down the full node, which means you cannot run
|
||||
# more than one simulations per process.
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def extra_node(self_hostname) -> AsyncIterator[FullNodeAPI | FullNodeSimulator]:
|
||||
with TempKeyring() as keychain:
|
||||
b_tools = await create_block_tools_async(constants=test_constants_modified, keychain=keychain)
|
||||
@@ -69,7 +68,7 @@ async def extra_node(self_hostname) -> AsyncIterator[FullNodeAPI | FullNodeSimul
|
||||
|
||||
class TestSimulation:
|
||||
@pytest.mark.limit_consensus_modes(reason="This test only supports one running at a time.")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_full_system(self, simulation, extra_node, self_hostname):
|
||||
full_system: FullSystem
|
||||
bt: BlockTools
|
||||
@@ -186,7 +185,7 @@ class TestSimulation:
|
||||
|
||||
assert blockchain_state_found, "Could not get blockchain state from daemon and node"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_simulator_auto_farm_and_get_coins(
|
||||
self,
|
||||
two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools],
|
||||
@@ -250,7 +249,7 @@ class TestSimulation:
|
||||
assert len(reorg_non_spent_coins) == 12 and len(reorg_spent_and_non_spent_coins) == 12
|
||||
assert tx.additions not in spent_and_non_spent_coins # just double check that those got reverted.
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(argnames="count", argvalues=[0, 1, 2, 5, 10])
|
||||
async def test_simulation_farm_blocks_to_puzzlehash(
|
||||
self,
|
||||
@@ -268,7 +267,7 @@ class TestSimulation:
|
||||
expected_height = None if count == 0 else count
|
||||
assert full_node_api.full_node.blockchain.get_peak_height() == expected_height
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(argnames="count", argvalues=[0, 1, 2, 5, 10])
|
||||
async def test_simulation_farm_blocks(
|
||||
self,
|
||||
@@ -322,7 +321,7 @@ class TestSimulation:
|
||||
assert isinstance(end_time, uint64)
|
||||
assert end_time - start_time >= new_time_per_block
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
argnames=["amount", "coin_count"],
|
||||
argvalues=[
|
||||
@@ -365,7 +364,7 @@ class TestSimulation:
|
||||
spendable_coins = await wallet.wallet_state_manager.get_spendable_coins_for_wallet(wallet.id())
|
||||
assert len(spendable_coins) == coin_count
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_wait_transaction_records_entered_mempool(
|
||||
self,
|
||||
self_hostname: str,
|
||||
@@ -404,7 +403,7 @@ class TestSimulation:
|
||||
# assert tx.is_in_mempool()
|
||||
|
||||
@pytest.mark.parametrize(argnames="records_or_bundles_or_coins", argvalues=["records", "bundles", "coins"])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_process_transactions(
|
||||
self,
|
||||
self_hostname: str,
|
||||
@@ -470,7 +469,7 @@ class TestSimulation:
|
||||
coin_record = await full_node_api.full_node.coin_store.get_coin_record(coin.name())
|
||||
assert coin_record is not None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
argnames="amounts",
|
||||
argvalues=[
|
||||
|
||||
@@ -47,7 +47,7 @@ def test_backoff_saturates_at_final() -> None:
|
||||
assert next(backoff) == 3
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(argnames="count", argvalues=[0, 1, 2, 5, 10])
|
||||
@pytest.mark.parametrize(argnames="guarantee_transaction_blocks", argvalues=[False, True])
|
||||
async def test_simulation_farm_blocks_to_puzzlehash(
|
||||
@@ -69,7 +69,7 @@ async def test_simulation_farm_blocks_to_puzzlehash(
|
||||
assert full_node_api.full_node.blockchain.get_peak_height() == expected_height
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(argnames="count", argvalues=[0, 1, 2, 5, 10])
|
||||
async def test_simulation_farm_blocks_to_wallet(
|
||||
count: int,
|
||||
@@ -95,7 +95,7 @@ async def test_simulation_farm_blocks_to_wallet(
|
||||
assert [unconfirmed_balance, confirmed_balance] == [rewards, rewards]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
argnames=["amount", "coin_count"],
|
||||
argvalues=[
|
||||
@@ -137,7 +137,7 @@ async def test_simulation_farm_rewards_to_wallet(
|
||||
assert len(all_coin_records) == coin_count
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_wait_transaction_records_entered_mempool(
|
||||
simulator_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools],
|
||||
) -> None:
|
||||
@@ -172,7 +172,7 @@ async def test_wait_transaction_records_entered_mempool(
|
||||
assert full_node_api.full_node.mempool_manager.get_spendbundle(tx.spend_bundle.name()) is not None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_process_transaction_records(
|
||||
simulator_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools],
|
||||
) -> None:
|
||||
@@ -206,7 +206,7 @@ async def test_process_transaction_records(
|
||||
assert full_node_api.full_node.coin_store.get_coin_record(coin.name()) is not None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
argnames="amounts",
|
||||
argvalues=[
|
||||
@@ -233,7 +233,7 @@ async def test_create_coins_with_amounts(
|
||||
assert sorted(coin.amount for coin in coins) == sorted(amounts)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
argnames="amounts",
|
||||
argvalues=[
|
||||
|
||||
@@ -5,7 +5,6 @@ from pathlib import Path
|
||||
from typing import Any, AsyncGenerator, Dict, Tuple
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from chia.simulator.full_node_simulator import FullNodeSimulator
|
||||
from chia.simulator.simulator_full_node_rpc_client import SimulatorFullNodeRpcClient
|
||||
@@ -26,14 +25,14 @@ class TestStartSimulator:
|
||||
These tests are designed to test the user facing functionality of the simulator.
|
||||
"""
|
||||
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def get_chia_simulator(
|
||||
self, tmp_path: Path, empty_keyring: Keychain
|
||||
) -> AsyncGenerator[Tuple[FullNodeSimulator, Path, Dict[str, Any], str, int, Keychain], None]:
|
||||
async for simulator_args in get_full_chia_simulator(chia_root=tmp_path, keychain=empty_keyring):
|
||||
yield simulator_args
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_start_simulator(
|
||||
self, get_chia_simulator: Tuple[FullNodeSimulator, Path, Dict[str, Any], str, int, Keychain]
|
||||
) -> None:
|
||||
|
||||
@@ -22,7 +22,7 @@ from tests.util.blockchain import create_blockchain
|
||||
|
||||
|
||||
class TestNewPeak:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_timelord_new_peak_basic(
|
||||
self, bt: BlockTools, timelord: Tuple[TimelordAPI, ChiaServer], default_1000_blocks: List[FullBlock]
|
||||
) -> None:
|
||||
@@ -67,7 +67,7 @@ class TestNewPeak:
|
||||
|
||||
return None
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_timelord_new_peak_heavier_unfinished(
|
||||
self, bt: BlockTools, timelord: Tuple[TimelordAPI, ChiaServer], default_1000_blocks: List[FullBlock]
|
||||
) -> None:
|
||||
|
||||
@@ -7,7 +7,7 @@ from chia.timelord.timelord import Timelord
|
||||
from chia.timelord.timelord_api import TimelordAPI
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_timelord_has_no_server(timelord_service: Service[Timelord, TimelordAPI]) -> None:
|
||||
timelord_server = timelord_service._node.server
|
||||
assert timelord_server.webserver is None
|
||||
|
||||
@@ -243,7 +243,7 @@ def get_full_blocks() -> Iterator[FullBlock]:
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.skip("This test is expensive and has already convinced us the parser works")
|
||||
async def test_parser():
|
||||
# loop over every combination of Optionals being set and not set
|
||||
@@ -262,7 +262,7 @@ async def test_parser():
|
||||
# assert gen == FullBlock.from_bytes(block_bytes).transactions_generator
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.skip("This test is expensive and has already convinced us the parser works")
|
||||
async def test_header_block():
|
||||
for block in get_full_blocks():
|
||||
|
||||
@@ -8,7 +8,7 @@ import pytest
|
||||
from chia.util.limited_semaphore import LimitedSemaphore, LimitedSemaphoreFullError
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_stuff() -> None:
|
||||
active_limit = 2
|
||||
waiting_limit = 4
|
||||
|
||||
@@ -9,7 +9,7 @@ from chia.util.misc import format_bytes, format_minutes, to_batches, validate_di
|
||||
|
||||
|
||||
class TestMisc:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_format_bytes(self):
|
||||
assert format_bytes(None) == "Invalid"
|
||||
assert format_bytes(dict()) == "Invalid"
|
||||
@@ -29,7 +29,7 @@ class TestMisc:
|
||||
assert format_bytes(1024**10) == "1048576.000 YiB"
|
||||
assert format_bytes(1024**20).endswith("YiB")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_format_minutes(self):
|
||||
assert format_minutes(None) == "Invalid"
|
||||
assert format_minutes(dict()) == "Invalid"
|
||||
|
||||
@@ -11,7 +11,7 @@ from chia.util.network import IPAddress, resolve
|
||||
|
||||
|
||||
class TestNetwork:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_resolve4(self):
|
||||
# Run these tests forcing IPv4 resolution
|
||||
prefer_ipv6 = False
|
||||
@@ -20,7 +20,7 @@ class TestNetwork:
|
||||
assert await resolve("localhost", prefer_ipv6=prefer_ipv6) == IPAddress.create("127.0.0.1")
|
||||
assert await resolve("example.net", prefer_ipv6=prefer_ipv6) == IPAddress.create("93.184.216.34")
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.skipif(
|
||||
condition=("GITHUB_ACTIONS" in os.environ) and (sys.platform in {"darwin", "win32"}),
|
||||
reason="macOS and Windows runners in GitHub Actions do not seem to support IPv6",
|
||||
|
||||
@@ -37,7 +37,7 @@ class RequestNotCompleteError(Exception):
|
||||
|
||||
|
||||
class TestPriorityMutex:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_priority_mutex(self) -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -194,7 +194,7 @@ def test_comparisons_fail_for_incomplete_requests(
|
||||
method(case.self, case.other)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_reacquisition_fails() -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
request = Request(id="again!", priority=MutexPriority.low)
|
||||
@@ -251,7 +251,7 @@ async def test_reacquisition_fails() -> None:
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_order(case: OrderCase) -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -275,7 +275,7 @@ def expected_acquisition_order(requests: List[Request]) -> List[Request]:
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_sequential_acquisitions() -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -290,7 +290,7 @@ async def test_sequential_acquisitions() -> None:
|
||||
# just testing that we can get through a bunch of miscellaneous acquisitions
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_nested_acquisition_raises() -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -306,7 +306,7 @@ async def to_be_cancelled(mutex: PriorityMutex[MutexPriority]) -> None:
|
||||
assert False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_to_be_cancelled_fails_if_not_cancelled() -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -314,7 +314,7 @@ async def test_to_be_cancelled_fails_if_not_cancelled() -> None:
|
||||
await to_be_cancelled(mutex=mutex)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cancellation_while_waiting() -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -356,7 +356,7 @@ async def test_cancellation_while_waiting() -> None:
|
||||
|
||||
# testing many repeatable randomization cases
|
||||
@pytest.mark.parametrize(argnames="seed", argvalues=range(100), ids=lambda seed: f"random seed {seed}")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_retains_request_order_for_matching_priority(seed: int) -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -449,7 +449,7 @@ async def create_acquire_tasks_in_controlled_order(
|
||||
return tasks
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_multiple_tasks_track_active_task_accurately() -> None:
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -474,7 +474,7 @@ async def test_multiple_tasks_track_active_task_accurately() -> None:
|
||||
await other_task
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_no_task_fails_as_expected(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Note that this case is not expected to be possible in reality"""
|
||||
mutex = PriorityMutex.create(priority_type=MutexPriority)
|
||||
|
||||
@@ -93,7 +93,7 @@ async def do_spend(
|
||||
|
||||
class TestCATLifecycle:
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_mod(self, cost_logger, consensus_mode):
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
tail = Program.to([])
|
||||
@@ -263,7 +263,7 @@ class TestCATLifecycle:
|
||||
)
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_complex_spend(self, cost_logger, consensus_mode):
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
tail = Program.to([])
|
||||
@@ -358,7 +358,7 @@ class TestCATLifecycle:
|
||||
)
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_genesis_by_id(self, cost_logger, consensus_mode):
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
standard_acs = Program.to(1)
|
||||
@@ -400,7 +400,7 @@ class TestCATLifecycle:
|
||||
)
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_genesis_by_puzhash(self, cost_logger, consensus_mode):
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
standard_acs = Program.to(1)
|
||||
@@ -442,7 +442,7 @@ class TestCATLifecycle:
|
||||
)
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_everything_with_signature(self, cost_logger, consensus_mode):
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
sk = PrivateKey.from_bytes(secret_exponent_for_index(1).to_bytes(32, "big"))
|
||||
@@ -554,7 +554,7 @@ class TestCATLifecycle:
|
||||
)
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_delegated_tail(self, cost_logger, consensus_mode):
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
standard_acs = Program.to(1)
|
||||
|
||||
@@ -44,7 +44,7 @@ class TestCATWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_creation(self, self_hostname, two_wallet_nodes, trusted):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -118,7 +118,7 @@ class TestCATWallet:
|
||||
)
|
||||
await time_out_assert(20, cat_wallet.get_confirmed_balance, 0)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_creation_unique_lineage_store(self, self_hostname, two_wallet_nodes):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -170,7 +170,7 @@ class TestCATWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_spend(self, self_hostname, two_wallet_nodes, trusted):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -284,7 +284,7 @@ class TestCATWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_reuse_address(self, self_hostname, two_wallet_nodes, trusted):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -392,7 +392,7 @@ class TestCATWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_wallet_for_asset_id(self, self_hostname, two_wallet_nodes, trusted):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -449,7 +449,7 @@ class TestCATWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_doesnt_see_eve(self, self_hostname, two_wallet_nodes, trusted):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -546,7 +546,7 @@ class TestCATWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_spend_multiple(self, self_hostname, three_wallet_nodes, trusted):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = three_wallet_nodes
|
||||
@@ -673,7 +673,7 @@ class TestCATWallet:
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_max_amount_send(self, self_hostname, two_wallet_nodes, trusted):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -786,7 +786,7 @@ class TestCATWallet:
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.parametrize("autodiscovery", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_hint(self, self_hostname, two_wallet_nodes, trusted, autodiscovery):
|
||||
num_blocks = 3
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -904,7 +904,7 @@ class TestCATWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_cat_change_detection(
|
||||
self, self_hostname: str, one_wallet_and_one_simulator_services: SimulatorsAndWalletsServices, trusted: bool
|
||||
) -> None:
|
||||
@@ -1062,7 +1062,7 @@ class TestCATWallet:
|
||||
assert not full_node_api.full_node.subscriptions.has_ph_subscription(puzzlehash_unhardened)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unacknowledged_cat_table() -> None:
|
||||
db_name = Path(tempfile.TemporaryDirectory().name).joinpath("test.sqlite")
|
||||
db_name.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -167,7 +167,7 @@ def generate_secure_bundle(
|
||||
|
||||
|
||||
class TestOfferLifecycle:
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio()
|
||||
async def test_complex_offer(self, cost_logger):
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
coins_needed: Dict[Optional[str], List[int]] = {
|
||||
|
||||
@@ -65,7 +65,7 @@ async def claim_pending_approval_balance(
|
||||
# So to avoid the overhead of start up for identical tests, we only change the softfork param for the tests that use it.
|
||||
# To pin down the behavior that we intend to eventually deprecate, it only gets one test case.
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
@pytest.mark.parametrize(
|
||||
"wallets_prefarm_services,trusted,reuse_puzhash,credential_restricted,active_softfork_height",
|
||||
[
|
||||
@@ -739,7 +739,7 @@ async def test_cat_trades(
|
||||
[True, False],
|
||||
)
|
||||
class TestCATTrades:
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_trade_cancellation(self, wallets_prefarm):
|
||||
(
|
||||
[wallet_node_maker, maker_funds],
|
||||
@@ -864,7 +864,7 @@ class TestCATTrades:
|
||||
|
||||
await time_out_assert(15, get_trade_and_status, TradeStatus.CANCELLED, trade_manager_maker, trade_make)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_trade_cancellation_balance_check(self, wallets_prefarm):
|
||||
(
|
||||
[wallet_node_maker, maker_funds],
|
||||
@@ -918,7 +918,7 @@ class TestCATTrades:
|
||||
await time_out_assert(15, get_trade_and_status, TradeStatus.CANCELLED, trade_manager_maker, trade_make)
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_trade_conflict(self, three_wallets_prefarm):
|
||||
(
|
||||
[wallet_node_maker, maker_funds],
|
||||
@@ -981,7 +981,7 @@ class TestCATTrades:
|
||||
await full_node.process_transaction_records(records=offer_tx_records)
|
||||
await time_out_assert(15, get_trade_and_status, TradeStatus.FAILED, trade_manager_trader, tr2)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_trade_bad_spend(self, wallets_prefarm):
|
||||
(
|
||||
[wallet_node_maker, maker_funds],
|
||||
@@ -1045,7 +1045,7 @@ class TestCATTrades:
|
||||
await full_node.process_transaction_records(records=offer_tx_records)
|
||||
await time_out_assert(30, get_trade_and_status, TradeStatus.FAILED, trade_manager_taker, tr1)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_trade_high_fee(self, wallets_prefarm):
|
||||
(
|
||||
[wallet_node_maker, maker_funds],
|
||||
@@ -1100,7 +1100,7 @@ class TestCATTrades:
|
||||
await full_node.process_transaction_records(records=txs1)
|
||||
await time_out_assert(15, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_taker, tr1)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_aggregated_trade_state(self, wallets_prefarm):
|
||||
(
|
||||
[wallet_node_maker, maker_funds],
|
||||
|
||||
@@ -17,7 +17,7 @@ from chia.wallet.wallet_node import WalletNode
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_missing_decorator(
|
||||
simulator_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools],
|
||||
trusted: bool,
|
||||
@@ -37,7 +37,7 @@ async def test_missing_decorator(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_unknown_decorator(
|
||||
simulator_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools],
|
||||
trusted: bool,
|
||||
@@ -57,7 +57,7 @@ async def test_unknown_decorator(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_decorator(
|
||||
simulator_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools],
|
||||
trusted: bool,
|
||||
|
||||
@@ -84,7 +84,7 @@ class TestClawbackLifecycle:
|
||||
signatures.append(signature)
|
||||
return AugSchemeMPL.aggregate(signatures)
|
||||
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio
|
||||
async def test_clawback_spends(self, cost_logger: CostLogger) -> None:
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
key_lookup = KeyTool()
|
||||
|
||||
@@ -19,7 +19,7 @@ from chia.wallet.wallet_node import WalletNode
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_is_recipient(
|
||||
simulator_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools],
|
||||
trusted: bool,
|
||||
|
||||
@@ -7,7 +7,6 @@ from dataclasses import asdict, dataclass, field, replace
|
||||
from typing import Any, AsyncIterator, Dict, List, Optional, Union
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from chia.consensus.constants import ConsensusConstants
|
||||
from chia.rpc.wallet_rpc_client import WalletRpcClient
|
||||
@@ -303,7 +302,7 @@ def tx_config(request: Any) -> TXConfig:
|
||||
|
||||
# This fixture automatically creates 4 parametrized tests trusted/untrusted x reuse/new derivations
|
||||
# These parameterizations can be skipped by manually specifying "trusted" or "reuse puzhash" to the fixture
|
||||
@pytest_asyncio.fixture(scope="function")
|
||||
@pytest.fixture(scope="function")
|
||||
async def wallet_environments(
|
||||
trusted_full_node: bool,
|
||||
tx_config: TXConfig,
|
||||
|
||||
@@ -1226,7 +1226,7 @@ async def do_spend(
|
||||
return result
|
||||
|
||||
|
||||
@pytest.mark.asyncio()
|
||||
@pytest.mark.anyio
|
||||
async def test_singleton_aggregator() -> None:
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
aggregator = P2_SINGLETON_AGGREGATOR_MOD
|
||||
|
||||
@@ -81,7 +81,7 @@ puzzle_hash_0 = bytes32(32 * b"0")
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_creation(
|
||||
self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode
|
||||
) -> None:
|
||||
@@ -270,7 +270,7 @@ async def test_dao_creation(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_funding(
|
||||
self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode
|
||||
) -> None:
|
||||
@@ -453,7 +453,7 @@ async def test_dao_funding(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_proposals(
|
||||
self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode
|
||||
) -> None:
|
||||
@@ -1021,7 +1021,7 @@ async def test_dao_proposals(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_proposal_partial_vote(
|
||||
self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode
|
||||
) -> None:
|
||||
@@ -1271,7 +1271,7 @@ async def test_dao_proposal_partial_vote(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_rpc_api(
|
||||
self_hostname: str, two_wallet_nodes: Any, trusted: Any, consensus_mode: ConsensusMode
|
||||
) -> None:
|
||||
@@ -1800,7 +1800,7 @@ async def test_dao_rpc_api(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_rpc_client(
|
||||
two_wallet_nodes_services: SimulatorsAndWalletsServices,
|
||||
trusted: bool,
|
||||
@@ -2215,7 +2215,7 @@ async def test_dao_rpc_client(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_complex_spends(
|
||||
two_wallet_nodes_services: SimulatorsAndWalletsServices,
|
||||
trusted: bool,
|
||||
@@ -2588,7 +2588,7 @@ async def test_dao_complex_spends(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_concurrency(
|
||||
self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode
|
||||
) -> None:
|
||||
@@ -2861,7 +2861,7 @@ async def test_dao_concurrency(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_cat_exits(
|
||||
two_wallet_nodes_services: SimulatorsAndWalletsServices,
|
||||
trusted: bool,
|
||||
@@ -3077,7 +3077,7 @@ async def test_dao_cat_exits(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_reorgs(
|
||||
self_hostname: str, two_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode
|
||||
) -> None:
|
||||
@@ -3376,7 +3376,7 @@ async def test_dao_reorgs(
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dao_votes(
|
||||
self_hostname: str, three_wallet_nodes: SimulatorsAndWallets, trusted: bool, consensus_mode: ConsensusMode
|
||||
) -> None:
|
||||
|
||||
@@ -38,7 +38,7 @@ ACS_PH = ACS.get_tree_hash()
|
||||
NIL_PH = Program.to(None).get_tree_hash()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_graftroot(cost_logger: CostLogger) -> None:
|
||||
async with sim_and_client() as (sim, sim_client):
|
||||
# Create the coin we're testing
|
||||
|
||||
@@ -40,7 +40,7 @@ def get_parent_branch(value: bytes32, proof: Tuple[int, List[bytes32]]) -> Tuple
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dl_offers(wallets_prefarm: Any, trusted: bool) -> None:
|
||||
(
|
||||
[wallet_node_maker, maker_funds],
|
||||
@@ -241,7 +241,7 @@ async def test_dl_offers(wallets_prefarm: Any, trusted: bool) -> None:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_dl_offer_cancellation(wallets_prefarm: Any, trusted: bool) -> None:
|
||||
[wallet_node, _], [_, _], full_node_api = wallets_prefarm
|
||||
assert wallet_node.wallet_state_manager is not None
|
||||
@@ -303,7 +303,7 @@ async def test_dl_offer_cancellation(wallets_prefarm: Any, trusted: bool) -> Non
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_multiple_dl_offers(wallets_prefarm: Any, trusted: bool) -> None:
|
||||
(
|
||||
[wallet_node_maker, maker_funds],
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestDLWallet:
|
||||
(False, False),
|
||||
],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_initial_creation(
|
||||
self, self_hostname: str, simulator_and_wallet: SimulatorsAndWallets, trusted: bool, reuse_puzhash: bool
|
||||
) -> None:
|
||||
@@ -93,7 +93,7 @@ class TestDLWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_owned_singletons(
|
||||
self, self_hostname: str, simulator_and_wallet: SimulatorsAndWallets, trusted: bool
|
||||
) -> None:
|
||||
@@ -145,7 +145,7 @@ class TestDLWallet:
|
||||
|
||||
@pytest.mark.limit_consensus_modes(allowed=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0], reason="save time")
|
||||
@pytest.mark.parametrize("trusted", [True, False])
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_tracking_non_owned(
|
||||
self, self_hostname: str, two_wallet_nodes: SimulatorsAndWallets, trusted: bool
|
||||
) -> None:
|
||||
@@ -230,7 +230,7 @@ class TestDLWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_lifecycle(
|
||||
self, self_hostname: str, simulator_and_wallet: SimulatorsAndWallets, trusted: bool
|
||||
) -> None:
|
||||
@@ -333,7 +333,7 @@ class TestDLWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_rebase(
|
||||
self,
|
||||
self_hostname: str,
|
||||
@@ -534,7 +534,7 @@ async def is_singleton_confirmed_and_root(dl_wallet: DataLayerWallet, lid: bytes
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_mirrors(wallets_prefarm: Any, trusted: bool) -> None:
|
||||
(
|
||||
[wallet_node_1, _],
|
||||
|
||||
@@ -40,7 +40,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_creation_from_coin_spend(
|
||||
self, self_hostname, two_nodes_two_wallets_with_same_keys: SimulatorsAndWallets, trusted
|
||||
):
|
||||
@@ -121,7 +121,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_creation_from_backup_file(self, self_hostname, three_wallet_nodes, trusted):
|
||||
full_nodes, wallets, _ = three_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@@ -272,7 +272,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_did_recovery_with_multiple_backup_dids(self, self_hostname, two_wallet_nodes, trusted):
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@@ -417,7 +417,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_did_recovery_with_empty_set(self, self_hostname, two_wallet_nodes, trusted):
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@@ -473,7 +473,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_did_find_lost_did(self, self_hostname, two_wallet_nodes, trusted):
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@@ -556,7 +556,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_did_attest_after_recovery(self, self_hostname, two_wallet_nodes, trusted):
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@@ -717,7 +717,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_did_transfer(self, self_hostname, two_wallet_nodes, with_recovery, trusted):
|
||||
fee = uint64(1000)
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -803,7 +803,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_update_recovery_list(self, self_hostname, two_wallet_nodes, trusted):
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
@@ -852,7 +852,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_get_info(self, self_hostname, two_wallet_nodes, trusted):
|
||||
fee = uint64(1000)
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -942,7 +942,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_message_spend(self, self_hostname, two_wallet_nodes, trusted):
|
||||
fee = uint64(1000)
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -1001,7 +1001,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_update_metadata(self, self_hostname, two_wallet_nodes, trusted):
|
||||
fee = uint64(1000)
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -1071,7 +1071,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_did_sign_message(self, self_hostname, two_wallet_nodes, trusted):
|
||||
fee = uint64(1000)
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
@@ -1185,7 +1185,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_create_did_with_recovery_list(self, self_hostname, two_nodes_two_wallets_with_same_keys, trusted):
|
||||
"""
|
||||
A DID is created on-chain in client0, causing a DID Wallet to be created in client1, which shares the same key.
|
||||
@@ -1276,7 +1276,7 @@ class TestDIDWallet:
|
||||
"trusted",
|
||||
[True, False],
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.anyio
|
||||
async def test_did_resync(self, self_hostname, two_wallet_nodes, trusted) -> None:
|
||||
full_nodes, wallets, _ = two_wallet_nodes
|
||||
full_node_api = full_nodes[0]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user