chia-blockchain 2.5.4rc2__py3-none-any.whl → 2.5.5rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chia/_tests/blockchain/blockchain_test_utils.py +2 -3
- chia/_tests/blockchain/test_augmented_chain.py +2 -3
- chia/_tests/blockchain/test_blockchain.py +261 -44
- chia/_tests/blockchain/test_blockchain_transactions.py +4 -3
- chia/_tests/blockchain/test_build_chains.py +197 -1
- chia/_tests/blockchain/test_get_block_generator.py +1 -1
- chia/_tests/blockchain/test_lookup_fork_chain.py +1 -1
- chia/_tests/clvm/benchmark_costs.py +1 -1
- chia/_tests/clvm/coin_store.py +3 -4
- chia/_tests/clvm/test_message_conditions.py +2 -2
- chia/_tests/clvm/test_puzzle_compression.py +2 -3
- chia/_tests/clvm/test_puzzles.py +1 -2
- chia/_tests/clvm/test_singletons.py +2 -3
- chia/_tests/clvm/test_spend_sim.py +7 -7
- chia/_tests/cmds/cmd_test_utils.py +30 -25
- chia/_tests/cmds/test_dev_gh.py +1 -1
- chia/_tests/cmds/test_farm_cmd.py +1 -1
- chia/_tests/cmds/test_show.py +1 -2
- chia/_tests/cmds/wallet/test_did.py +101 -56
- chia/_tests/cmds/wallet/test_nft.py +109 -84
- chia/_tests/cmds/wallet/test_notifications.py +1 -1
- chia/_tests/cmds/wallet/test_offer.toffer +1 -1
- chia/_tests/cmds/wallet/test_vcs.py +8 -8
- chia/_tests/cmds/wallet/test_wallet.py +100 -46
- chia/_tests/conftest.py +31 -20
- chia/_tests/connection_utils.py +1 -1
- chia/_tests/core/consensus/stores/__init__.py +0 -0
- chia/_tests/core/consensus/stores/test_coin_store_protocol.py +40 -0
- chia/_tests/core/consensus/test_block_creation.py +2 -31
- chia/_tests/core/consensus/test_pot_iterations.py +38 -3
- chia/_tests/core/custom_types/test_proof_of_space.py +154 -26
- chia/_tests/core/custom_types/test_spend_bundle.py +2 -3
- chia/_tests/core/daemon/test_daemon.py +80 -0
- chia/_tests/core/data_layer/test_data_layer.py +1 -1
- chia/_tests/core/data_layer/test_data_layer_util.py +1 -1
- chia/_tests/core/data_layer/test_data_rpc.py +14 -10
- chia/_tests/core/data_layer/test_data_store.py +5 -5
- chia/_tests/core/farmer/test_farmer_api.py +2 -2
- chia/_tests/core/full_node/full_sync/test_full_sync.py +446 -406
- chia/_tests/core/full_node/ram_db.py +3 -1
- chia/_tests/core/full_node/stores/test_block_store.py +28 -16
- chia/_tests/core/full_node/stores/test_coin_store.py +277 -185
- chia/_tests/core/full_node/stores/test_full_node_store.py +11 -4
- chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
- chia/_tests/core/full_node/test_address_manager.py +200 -27
- chia/_tests/core/full_node/test_block_height_map.py +2 -2
- chia/_tests/core/full_node/test_conditions.py +7 -6
- chia/_tests/core/full_node/test_full_node.py +456 -40
- chia/_tests/core/full_node/test_generator_tools.py +32 -2
- chia/_tests/core/full_node/test_hint_management.py +1 -1
- chia/_tests/core/full_node/test_node_load.py +20 -21
- chia/_tests/core/full_node/test_performance.py +3 -4
- chia/_tests/core/full_node/test_prev_tx_block.py +43 -0
- chia/_tests/core/full_node/test_subscriptions.py +1 -2
- chia/_tests/core/full_node/test_transactions.py +9 -5
- chia/_tests/core/full_node/test_tx_processing_queue.py +1 -2
- chia/_tests/core/large_block.py +1 -2
- chia/_tests/core/make_block_generator.py +3 -4
- chia/_tests/core/mempool/test_mempool.py +36 -86
- chia/_tests/core/mempool/test_mempool_fee_estimator.py +1 -1
- chia/_tests/core/mempool/test_mempool_item_queries.py +1 -3
- chia/_tests/core/mempool/test_mempool_manager.py +421 -69
- chia/_tests/core/mempool/test_mempool_performance.py +3 -2
- chia/_tests/core/mempool/test_singleton_fast_forward.py +60 -131
- chia/_tests/core/server/flood.py +1 -1
- chia/_tests/core/server/test_dos.py +1 -1
- chia/_tests/core/server/test_node_discovery.py +41 -27
- chia/_tests/core/server/test_rate_limits.py +1 -1
- chia/_tests/core/server/test_server.py +1 -1
- chia/_tests/core/services/test_services.py +5 -5
- chia/_tests/core/ssl/test_ssl.py +1 -1
- chia/_tests/core/test_cost_calculation.py +6 -6
- chia/_tests/core/test_crawler.py +2 -2
- chia/_tests/core/test_crawler_rpc.py +1 -1
- chia/_tests/core/test_db_conversion.py +3 -1
- chia/_tests/core/test_db_validation.py +5 -3
- chia/_tests/core/test_farmer_harvester_rpc.py +15 -15
- chia/_tests/core/test_filter.py +4 -1
- chia/_tests/core/test_full_node_rpc.py +99 -82
- chia/_tests/core/test_program.py +2 -2
- chia/_tests/core/util/test_block_cache.py +1 -1
- chia/_tests/core/util/test_keychain.py +2 -2
- chia/_tests/core/util/test_lockfile.py +1 -1
- chia/_tests/core/util/test_log_exceptions.py +5 -5
- chia/_tests/core/util/test_streamable.py +81 -22
- chia/_tests/db/test_db_wrapper.py +1 -3
- chia/_tests/environments/wallet.py +5 -5
- chia/_tests/farmer_harvester/test_farmer.py +9 -7
- chia/_tests/farmer_harvester/test_farmer_harvester.py +11 -4
- chia/_tests/farmer_harvester/test_filter_prefix_bits.py +6 -5
- chia/_tests/farmer_harvester/test_third_party_harvesters.py +15 -9
- chia/_tests/fee_estimation/test_fee_estimation_integration.py +1 -2
- chia/_tests/fee_estimation/test_fee_estimation_rpc.py +7 -5
- chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +1 -1
- chia/_tests/generator/test_compression.py +1 -2
- chia/_tests/generator/test_rom.py +8 -4
- chia/_tests/plot_sync/test_plot_sync.py +3 -3
- chia/_tests/plot_sync/test_receiver.py +3 -3
- chia/_tests/plot_sync/test_sender.py +1 -1
- chia/_tests/plot_sync/test_sync_simulated.py +3 -3
- chia/_tests/plot_sync/util.py +2 -2
- chia/_tests/pools/test_pool_cmdline.py +48 -21
- chia/_tests/pools/test_pool_puzzles_lifecycle.py +2 -3
- chia/_tests/pools/test_pool_rpc.py +237 -105
- chia/_tests/pools/test_pool_wallet.py +11 -2
- chia/_tests/pools/test_wallet_pool_store.py +5 -4
- chia/_tests/rpc/test_rpc_client.py +1 -1
- chia/_tests/simulation/test_simulation.py +13 -8
- chia/_tests/simulation/test_simulator.py +2 -2
- chia/_tests/timelord/test_new_peak.py +191 -47
- chia/_tests/timelord/test_timelord.py +1 -1
- chia/_tests/tools/test_full_sync.py +0 -2
- chia/_tests/tools/test_run_block.py +3 -1
- chia/_tests/util/benchmark_cost.py +3 -3
- chia/_tests/util/benchmarks.py +2 -2
- chia/_tests/util/blockchain.py +11 -5
- chia/_tests/util/blockchain_mock.py +1 -4
- chia/_tests/util/coin_store.py +29 -0
- chia/_tests/util/constants.py +2 -18
- chia/_tests/util/full_sync.py +3 -3
- chia/_tests/util/generator_tools_testing.py +2 -3
- chia/_tests/util/key_tool.py +2 -3
- chia/_tests/util/misc.py +33 -31
- chia/_tests/util/network_protocol_data.py +19 -17
- chia/_tests/util/protocol_messages_bytes-v1.0 +0 -0
- chia/_tests/util/protocol_messages_json.py +3 -1
- chia/_tests/util/run_block.py +2 -2
- chia/_tests/util/setup_nodes.py +7 -7
- chia/_tests/util/spend_sim.py +47 -55
- chia/_tests/util/test_condition_tools.py +5 -4
- chia/_tests/util/test_config.py +2 -2
- chia/_tests/util/test_dump_keyring.py +1 -1
- chia/_tests/util/test_full_block_utils.py +12 -14
- chia/_tests/util/test_misc.py +2 -2
- chia/_tests/util/test_paginator.py +4 -4
- chia/_tests/util/test_priority_mutex.py +2 -2
- chia/_tests/util/test_replace_str_to_bytes.py +15 -5
- chia/_tests/util/test_ssl_check.py +1 -1
- chia/_tests/util/test_testnet_overrides.py +13 -3
- chia/_tests/util/time_out_assert.py +4 -2
- chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +1 -1
- chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +1 -2
- chia/_tests/wallet/cat_wallet/test_cat_wallet.py +352 -432
- chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +3 -6
- chia/_tests/wallet/cat_wallet/test_trades.py +53 -77
- chia/_tests/wallet/clawback/test_clawback_decorator.py +3 -1
- chia/_tests/wallet/clawback/test_clawback_lifecycle.py +3 -3
- chia/_tests/wallet/clawback/test_clawback_metadata.py +4 -2
- chia/_tests/wallet/conftest.py +11 -12
- chia/_tests/wallet/db_wallet/test_db_graftroot.py +11 -4
- chia/_tests/wallet/db_wallet/test_dl_offers.py +433 -130
- chia/_tests/wallet/db_wallet/test_dl_wallet.py +3 -3
- chia/_tests/wallet/did_wallet/test_did.py +2132 -2000
- chia/_tests/wallet/nft_wallet/config.py +1 -1
- chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +1610 -742
- chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +486 -907
- chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +4 -4
- chia/_tests/wallet/nft_wallet/test_nft_wallet.py +517 -294
- chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +133 -62
- chia/_tests/wallet/rpc/test_wallet_rpc.py +305 -184
- chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py +10 -6
- chia/_tests/wallet/sync/test_wallet_sync.py +89 -60
- chia/_tests/wallet/test_clvm_casts.py +88 -0
- chia/_tests/wallet/test_coin_management.py +1 -1
- chia/_tests/wallet/test_coin_selection.py +1 -1
- chia/_tests/wallet/test_conditions.py +1 -1
- chia/_tests/wallet/test_new_wallet_protocol.py +13 -11
- chia/_tests/wallet/test_notifications.py +5 -3
- chia/_tests/wallet/test_sign_coin_spends.py +6 -6
- chia/_tests/wallet/test_signer_protocol.py +13 -12
- chia/_tests/wallet/test_singleton.py +1 -1
- chia/_tests/wallet/test_singleton_lifecycle_fast.py +5 -7
- chia/_tests/wallet/test_util.py +2 -2
- chia/_tests/wallet/test_wallet.py +108 -29
- chia/_tests/wallet/test_wallet_action_scope.py +9 -2
- chia/_tests/wallet/test_wallet_blockchain.py +2 -3
- chia/_tests/wallet/test_wallet_key_val_store.py +1 -2
- chia/_tests/wallet/test_wallet_node.py +2 -4
- chia/_tests/wallet/test_wallet_retry.py +4 -2
- chia/_tests/wallet/test_wallet_state_manager.py +191 -5
- chia/_tests/wallet/test_wallet_test_framework.py +1 -1
- chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +8 -8
- chia/_tests/wallet/vc_wallet/test_vc_wallet.py +29 -12
- chia/_tests/wallet/wallet_block_tools.py +6 -6
- chia/_tests/weight_proof/test_weight_proof.py +10 -48
- chia/apis.py +1 -1
- chia/cmds/beta.py +1 -1
- chia/cmds/chia.py +9 -9
- chia/cmds/cmd_classes.py +12 -11
- chia/cmds/cmd_helpers.py +1 -1
- chia/cmds/cmds_util.py +12 -9
- chia/cmds/coin_funcs.py +2 -2
- chia/cmds/configure.py +2 -2
- chia/cmds/data.py +0 -2
- chia/cmds/data_funcs.py +1 -1
- chia/cmds/db_validate_func.py +1 -2
- chia/cmds/dev/__init__.py +0 -0
- chia/cmds/dev/data.py +273 -0
- chia/cmds/{gh.py → dev/gh.py} +5 -5
- chia/cmds/dev/main.py +22 -0
- chia/cmds/dev/mempool.py +78 -0
- chia/cmds/dev/mempool_funcs.py +63 -0
- chia/cmds/farm_funcs.py +5 -4
- chia/cmds/init_funcs.py +11 -11
- chia/cmds/keys.py +2 -2
- chia/cmds/keys_funcs.py +4 -4
- chia/cmds/netspace_funcs.py +1 -1
- chia/cmds/peer_funcs.py +2 -2
- chia/cmds/plotnft_funcs.py +72 -26
- chia/cmds/rpc.py +1 -1
- chia/cmds/show_funcs.py +5 -5
- chia/cmds/signer.py +8 -7
- chia/cmds/sim_funcs.py +8 -9
- chia/cmds/wallet.py +2 -2
- chia/cmds/wallet_funcs.py +165 -131
- chia/{util → consensus}/augmented_chain.py +1 -2
- chia/consensus/block_body_validation.py +54 -40
- chia/consensus/block_creation.py +42 -76
- chia/consensus/block_header_validation.py +32 -26
- chia/consensus/block_record.py +0 -3
- chia/consensus/blockchain.py +23 -32
- chia/consensus/blockchain_interface.py +1 -5
- chia/consensus/check_time_locks.py +57 -0
- chia/consensus/coin_store_protocol.py +151 -0
- chia/consensus/coinbase.py +0 -6
- chia/consensus/condition_costs.py +4 -0
- chia/{util → consensus}/condition_tools.py +4 -5
- chia/consensus/cost_calculator.py +1 -1
- chia/consensus/default_constants.py +32 -9
- chia/consensus/deficit.py +1 -3
- chia/consensus/difficulty_adjustment.py +1 -2
- chia/consensus/find_fork_point.py +1 -3
- chia/consensus/full_block_to_block_record.py +1 -6
- chia/{util → consensus}/generator_tools.py +1 -3
- chia/consensus/get_block_challenge.py +30 -7
- chia/consensus/make_sub_epoch_summary.py +1 -5
- chia/consensus/multiprocess_validation.py +21 -20
- chia/consensus/pot_iterations.py +74 -13
- chia/{util → consensus}/prev_transaction_block.py +1 -1
- chia/consensus/vdf_info_computation.py +1 -3
- chia/daemon/keychain_proxy.py +5 -5
- chia/daemon/server.py +22 -5
- chia/data_layer/data_layer.py +92 -51
- chia/{rpc → data_layer}/data_layer_rpc_api.py +1 -1
- chia/{rpc → data_layer}/data_layer_rpc_util.py +3 -6
- chia/data_layer/data_layer_util.py +4 -6
- chia/data_layer/data_layer_wallet.py +42 -69
- chia/data_layer/dl_wallet_store.py +12 -6
- chia/data_layer/download_data.py +3 -3
- chia/data_layer/s3_plugin_service.py +0 -1
- chia/farmer/farmer.py +3 -4
- chia/farmer/farmer_api.py +11 -7
- chia/{rpc → farmer}/farmer_rpc_client.py +1 -1
- chia/full_node/block_height_map.py +7 -6
- chia/full_node/block_store.py +5 -7
- chia/full_node/bundle_tools.py +1 -2
- chia/full_node/coin_store.py +143 -124
- chia/{types → full_node}/eligible_coin_spends.py +39 -70
- chia/full_node/fee_estimator.py +1 -1
- chia/full_node/fee_estimator_interface.py +0 -8
- chia/full_node/fee_tracker.py +25 -25
- chia/full_node/full_node.py +70 -53
- chia/full_node/full_node_api.py +57 -40
- chia/{rpc → full_node}/full_node_rpc_api.py +87 -8
- chia/{rpc → full_node}/full_node_rpc_client.py +7 -6
- chia/full_node/full_node_store.py +23 -8
- chia/full_node/mempool.py +206 -53
- chia/full_node/mempool_check_conditions.py +20 -63
- chia/full_node/mempool_manager.py +26 -40
- chia/full_node/subscriptions.py +1 -3
- chia/full_node/tx_processing_queue.py +50 -3
- chia/full_node/weight_proof.py +46 -37
- chia/harvester/harvester.py +1 -1
- chia/harvester/harvester_api.py +22 -7
- chia/introducer/introducer.py +1 -1
- chia/introducer/introducer_api.py +1 -1
- chia/plot_sync/exceptions.py +1 -1
- chia/plot_sync/receiver.py +1 -1
- chia/plot_sync/sender.py +2 -2
- chia/pools/pool_puzzles.py +13 -18
- chia/pools/pool_wallet.py +23 -46
- chia/protocols/farmer_protocol.py +11 -3
- chia/protocols/full_node_protocol.py +1 -4
- chia/protocols/harvester_protocol.py +3 -3
- chia/protocols/pool_protocol.py +1 -2
- chia/protocols/shared_protocol.py +3 -3
- chia/protocols/timelord_protocol.py +1 -3
- chia/protocols/wallet_protocol.py +3 -3
- chia/rpc/rpc_client.py +7 -8
- chia/rpc/rpc_server.py +3 -3
- chia/rpc/util.py +3 -1
- chia/seeder/crawler.py +1 -1
- chia/seeder/crawler_api.py +1 -1
- chia/seeder/dns_server.py +2 -0
- chia/seeder/start_crawler.py +3 -3
- chia/server/address_manager.py +286 -38
- chia/server/address_manager_store.py +0 -215
- chia/{types → server}/aliases.py +7 -7
- chia/server/api_protocol.py +1 -1
- chia/server/chia_policy.py +1 -1
- chia/server/node_discovery.py +76 -113
- chia/server/rate_limits.py +1 -1
- chia/server/resolve_peer_info.py +43 -0
- chia/server/server.py +5 -5
- chia/server/start_data_layer.py +4 -4
- chia/server/start_farmer.py +5 -4
- chia/server/start_full_node.py +5 -4
- chia/server/start_harvester.py +7 -5
- chia/server/start_introducer.py +2 -2
- chia/server/start_service.py +1 -1
- chia/server/start_timelord.py +7 -5
- chia/server/start_wallet.py +7 -5
- chia/server/ws_connection.py +1 -1
- chia/simulator/add_blocks_in_batches.py +2 -2
- chia/simulator/block_tools.py +245 -201
- chia/simulator/full_node_simulator.py +38 -10
- chia/simulator/setup_services.py +12 -12
- chia/simulator/simulator_full_node_rpc_api.py +2 -2
- chia/simulator/simulator_full_node_rpc_client.py +2 -2
- chia/simulator/simulator_test_tools.py +2 -2
- chia/simulator/start_simulator.py +1 -1
- chia/simulator/wallet_tools.py +10 -18
- chia/ssl/create_ssl.py +1 -1
- chia/timelord/iters_from_block.py +14 -14
- chia/timelord/timelord.py +15 -11
- chia/timelord/timelord_api.py +14 -2
- chia/timelord/timelord_state.py +20 -14
- chia/types/blockchain_format/program.py +53 -10
- chia/types/blockchain_format/proof_of_space.py +73 -19
- chia/types/coin_spend.py +3 -56
- chia/types/generator_types.py +28 -0
- chia/types/internal_mempool_item.py +1 -2
- chia/types/mempool_item.py +12 -7
- chia/types/unfinished_header_block.py +1 -2
- chia/types/validation_state.py +1 -2
- chia/types/weight_proof.py +1 -3
- chia/util/action_scope.py +3 -3
- chia/util/block_cache.py +1 -2
- chia/util/byte_types.py +1 -1
- chia/util/casts.py +21 -0
- chia/util/config.py +0 -37
- chia/util/db_wrapper.py +8 -1
- chia/util/errors.py +3 -2
- chia/util/initial-config.yaml +21 -5
- chia/util/keychain.py +6 -7
- chia/util/keyring_wrapper.py +5 -5
- chia/util/limited_semaphore.py +1 -1
- chia/util/priority_mutex.py +1 -1
- chia/util/streamable.py +63 -5
- chia/util/task_timing.py +1 -1
- chia/util/virtual_project_analysis.py +1 -1
- chia/wallet/cat_wallet/cat_info.py +7 -3
- chia/wallet/cat_wallet/cat_outer_puzzle.py +9 -5
- chia/wallet/cat_wallet/cat_utils.py +1 -1
- chia/wallet/cat_wallet/cat_wallet.py +44 -36
- chia/wallet/cat_wallet/lineage_store.py +7 -0
- chia/wallet/cat_wallet/r_cat_wallet.py +273 -0
- chia/wallet/conditions.py +5 -10
- chia/wallet/db_wallet/db_wallet_puzzles.py +4 -4
- chia/wallet/derivation_record.py +33 -0
- chia/wallet/derive_keys.py +3 -3
- chia/wallet/did_wallet/did_info.py +12 -3
- chia/wallet/did_wallet/did_wallet.py +132 -101
- chia/wallet/did_wallet/did_wallet_puzzles.py +9 -9
- chia/wallet/driver_protocol.py +3 -1
- chia/{types/spend_bundle.py → wallet/estimate_fees.py} +2 -7
- chia/wallet/nft_wallet/metadata_outer_puzzle.py +5 -3
- chia/wallet/nft_wallet/nft_puzzle_utils.py +1 -1
- chia/wallet/nft_wallet/nft_wallet.py +69 -112
- chia/wallet/nft_wallet/ownership_outer_puzzle.py +5 -3
- chia/wallet/nft_wallet/singleton_outer_puzzle.py +6 -4
- chia/wallet/nft_wallet/transfer_program_puzzle.py +4 -2
- chia/wallet/nft_wallet/uncurry_nft.py +4 -6
- chia/wallet/notification_manager.py +2 -3
- chia/wallet/outer_puzzles.py +7 -2
- chia/wallet/puzzle_drivers.py +1 -1
- chia/wallet/puzzles/clawback/drivers.py +5 -4
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +1 -1
- chia/wallet/puzzles/singleton_top_layer.py +2 -1
- chia/wallet/puzzles/singleton_top_layer_v1_1.py +2 -1
- chia/wallet/puzzles/tails.py +1 -3
- chia/wallet/signer_protocol.py +5 -6
- chia/wallet/singleton.py +5 -4
- chia/wallet/singleton_record.py +1 -1
- chia/wallet/trade_manager.py +18 -20
- chia/wallet/trade_record.py +3 -6
- chia/wallet/trading/offer.py +12 -13
- chia/wallet/uncurried_puzzle.py +2 -2
- chia/wallet/util/compute_additions.py +58 -0
- chia/wallet/util/compute_hints.py +3 -3
- chia/wallet/util/compute_memos.py +4 -4
- chia/wallet/util/curry_and_treehash.py +2 -1
- chia/wallet/util/debug_spend_bundle.py +1 -1
- chia/wallet/util/merkle_tree.py +1 -1
- chia/wallet/util/peer_request_cache.py +1 -2
- chia/wallet/util/tx_config.py +3 -8
- chia/wallet/util/wallet_sync_utils.py +10 -5
- chia/wallet/util/wallet_types.py +1 -0
- chia/wallet/vc_wallet/cr_cat_drivers.py +17 -18
- chia/wallet/vc_wallet/cr_cat_wallet.py +30 -28
- chia/wallet/vc_wallet/cr_outer_puzzle.py +5 -3
- chia/wallet/vc_wallet/vc_drivers.py +50 -8
- chia/wallet/vc_wallet/vc_store.py +3 -5
- chia/wallet/vc_wallet/vc_wallet.py +15 -22
- chia/wallet/wallet.py +36 -46
- chia/wallet/wallet_action_scope.py +73 -4
- chia/wallet/wallet_blockchain.py +1 -3
- chia/wallet/wallet_interested_store.py +1 -1
- chia/wallet/wallet_nft_store.py +3 -3
- chia/wallet/wallet_node.py +17 -16
- chia/wallet/wallet_node_api.py +4 -5
- chia/wallet/wallet_pool_store.py +1 -1
- chia/wallet/wallet_protocol.py +2 -0
- chia/wallet/wallet_puzzle_store.py +1 -1
- chia/{rpc → wallet}/wallet_request_types.py +670 -81
- chia/{rpc → wallet}/wallet_rpc_api.py +735 -766
- chia/{rpc → wallet}/wallet_rpc_client.py +268 -420
- chia/wallet/wallet_singleton_store.py +8 -7
- chia/wallet/wallet_spend_bundle.py +4 -3
- chia/wallet/wallet_state_manager.py +320 -191
- chia/wallet/wallet_weight_proof_handler.py +1 -2
- chia/wallet/wsm_apis.py +98 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/METADATA +7 -7
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/RECORD +443 -436
- mozilla-ca/cacert.pem +3 -165
- chia/_tests/fee_estimation/test_mempoolitem_height_added.py +0 -145
- chia/cmds/dev.py +0 -18
- chia/types/blockchain_format/slots.py +0 -9
- chia/types/blockchain_format/sub_epoch_summary.py +0 -5
- chia/types/end_of_slot_bundle.py +0 -5
- chia/types/full_block.py +0 -5
- chia/types/header_block.py +0 -5
- chia/types/spend_bundle_conditions.py +0 -7
- chia/types/transaction_queue_entry.py +0 -56
- chia/types/unfinished_block.py +0 -5
- /chia/cmds/{installers.py → dev/installers.py} +0 -0
- /chia/cmds/{sim.py → dev/sim.py} +0 -0
- /chia/{util → cmds}/dump_keyring.py +0 -0
- /chia/{full_node → consensus}/signage_point.py +0 -0
- /chia/{rpc → data_layer}/data_layer_rpc_client.py +0 -0
- /chia/{rpc → farmer}/farmer_rpc_api.py +0 -0
- /chia/{util → full_node}/full_block_utils.py +0 -0
- /chia/{rpc → harvester}/harvester_rpc_api.py +0 -0
- /chia/{rpc → harvester}/harvester_rpc_client.py +0 -0
- /chia/{full_node → protocols}/fee_estimate.py +0 -0
- /chia/{server → protocols}/outbound_message.py +0 -0
- /chia/{rpc → seeder}/crawler_rpc_api.py +0 -0
- /chia/{util → simulator}/vdf_prover.py +0 -0
- /chia/{util → ssl}/ssl_check.py +0 -0
- /chia/{rpc → timelord}/timelord_rpc_api.py +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/LICENSE +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc1.dist-info}/entry_points.txt +0 -0
|
@@ -5,7 +5,6 @@ import asyncio
|
|
|
5
5
|
import pytest
|
|
6
6
|
from chia_rs.sized_bytes import bytes32
|
|
7
7
|
from chia_rs.sized_ints import uint32, uint64
|
|
8
|
-
from clvm.casts import int_to_bytes
|
|
9
8
|
from colorlog import getLogger
|
|
10
9
|
|
|
11
10
|
from chia._tests.connection_utils import add_dummy_connection
|
|
@@ -14,14 +13,15 @@ from chia._tests.util.time_out_assert import time_out_assert
|
|
|
14
13
|
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
|
15
14
|
from chia.protocols import wallet_protocol
|
|
16
15
|
from chia.protocols.full_node_protocol import RespondTransaction
|
|
16
|
+
from chia.protocols.outbound_message import Message, NodeType
|
|
17
17
|
from chia.protocols.protocol_message_types import ProtocolMessageTypes
|
|
18
18
|
from chia.protocols.wallet_protocol import CoinStateUpdate, RespondToCoinUpdates
|
|
19
|
-
from chia.server.outbound_message import Message, NodeType
|
|
20
19
|
from chia.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol
|
|
21
20
|
from chia.types.blockchain_format.coin import Coin
|
|
22
21
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
23
22
|
from chia.types.condition_with_args import ConditionWithArgs
|
|
24
23
|
from chia.types.peer_info import PeerInfo
|
|
24
|
+
from chia.util.casts import int_to_bytes
|
|
25
25
|
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG
|
|
26
26
|
from chia.wallet.wallet import Wallet
|
|
27
27
|
|
|
@@ -142,7 +142,8 @@ async def test_subscribe_for_ph(simulator_and_wallet: OldSimulatorsAndWallets, s
|
|
|
142
142
|
|
|
143
143
|
wallet = wallet_node.wallet_state_manager.wallets[uint32(1)]
|
|
144
144
|
assert isinstance(wallet, Wallet)
|
|
145
|
-
|
|
145
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
146
|
+
puzzle_hash = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
146
147
|
|
|
147
148
|
for i in range(num_blocks):
|
|
148
149
|
if i == num_blocks - 1:
|
|
@@ -223,7 +224,8 @@ async def test_subscribe_for_coin_id(simulator_and_wallet: OldSimulatorsAndWalle
|
|
|
223
224
|
fn_server = full_node_api.full_node.server
|
|
224
225
|
standard_wallet = wallet_node.wallet_state_manager.wallets[uint32(1)]
|
|
225
226
|
assert isinstance(standard_wallet, Wallet)
|
|
226
|
-
|
|
227
|
+
async with standard_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
228
|
+
puzzle_hash = await action_scope.get_puzzle_hash(standard_wallet.wallet_state_manager)
|
|
227
229
|
|
|
228
230
|
await server_2.start_client(PeerInfo(self_hostname, fn_server.get_port()), None)
|
|
229
231
|
incoming_queue, peer_id = await add_dummy_connection(fn_server, self_hostname, 12312, NodeType.WALLET)
|
|
@@ -325,7 +327,8 @@ async def test_subscribe_for_ph_reorg(simulator_and_wallet: OldSimulatorsAndWall
|
|
|
325
327
|
fn_server = full_node_api.full_node.server
|
|
326
328
|
standard_wallet = wallet_node.wallet_state_manager.wallets[uint32(1)]
|
|
327
329
|
assert isinstance(standard_wallet, Wallet)
|
|
328
|
-
|
|
330
|
+
async with standard_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
331
|
+
puzzle_hash = await action_scope.get_puzzle_hash(standard_wallet.wallet_state_manager)
|
|
329
332
|
|
|
330
333
|
await server_2.start_client(PeerInfo(self_hostname, fn_server.get_port()), None)
|
|
331
334
|
incoming_queue, peer_id = await add_dummy_connection(fn_server, self_hostname, 12312, NodeType.WALLET)
|
|
@@ -400,7 +403,8 @@ async def test_subscribe_for_coin_id_reorg(simulator_and_wallet: OldSimulatorsAn
|
|
|
400
403
|
fn_server = full_node_api.full_node.server
|
|
401
404
|
standard_wallet = wallet_node.wallet_state_manager.wallets[uint32(1)]
|
|
402
405
|
assert isinstance(standard_wallet, Wallet)
|
|
403
|
-
|
|
406
|
+
async with standard_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
407
|
+
puzzle_hash = await action_scope.get_puzzle_hash(standard_wallet.wallet_state_manager)
|
|
404
408
|
|
|
405
409
|
await server_2.start_client(PeerInfo(self_hostname, fn_server.get_port()), None)
|
|
406
410
|
incoming_queue, peer_id = await add_dummy_connection(fn_server, self_hostname, 12312, NodeType.WALLET)
|
|
@@ -11,7 +11,15 @@ from unittest.mock import MagicMock
|
|
|
11
11
|
|
|
12
12
|
import pytest
|
|
13
13
|
from aiosqlite import Error as AIOSqliteError
|
|
14
|
-
from chia_rs import
|
|
14
|
+
from chia_rs import (
|
|
15
|
+
BlockRecord,
|
|
16
|
+
CoinState,
|
|
17
|
+
ConsensusConstants,
|
|
18
|
+
FullBlock,
|
|
19
|
+
G2Element,
|
|
20
|
+
SpendBundle,
|
|
21
|
+
confirm_not_included_already_hashed,
|
|
22
|
+
)
|
|
15
23
|
from chia_rs.sized_bytes import bytes32
|
|
16
24
|
from chia_rs.sized_ints import uint32, uint64, uint128
|
|
17
25
|
from chiabip158 import PyBIP158
|
|
@@ -23,24 +31,23 @@ from chia._tests.util.misc import patch_request_handler, wallet_height_at_least
|
|
|
23
31
|
from chia._tests.util.setup_nodes import OldSimulatorsAndWallets
|
|
24
32
|
from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_not_none
|
|
25
33
|
from chia._tests.weight_proof.test_weight_proof import load_blocks_dont_validate
|
|
34
|
+
from chia.consensus.augmented_chain import AugmentedBlockchain
|
|
26
35
|
from chia.consensus.block_body_validation import ForkInfo
|
|
27
|
-
from chia.consensus.block_record import BlockRecord
|
|
28
36
|
from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
|
29
37
|
from chia.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty
|
|
30
38
|
from chia.full_node.full_node_api import FullNodeAPI
|
|
31
39
|
from chia.full_node.weight_proof import WeightProofHandler
|
|
32
40
|
from chia.protocols import full_node_protocol, wallet_protocol
|
|
41
|
+
from chia.protocols.outbound_message import Message, make_msg
|
|
33
42
|
from chia.protocols.protocol_message_types import ProtocolMessageTypes
|
|
34
43
|
from chia.protocols.shared_protocol import Capability
|
|
35
44
|
from chia.protocols.wallet_protocol import (
|
|
36
|
-
CoinState,
|
|
37
45
|
RequestAdditions,
|
|
38
46
|
RespondAdditions,
|
|
39
47
|
RespondBlockHeader,
|
|
40
48
|
RespondBlockHeaders,
|
|
41
49
|
SendTransaction,
|
|
42
50
|
)
|
|
43
|
-
from chia.server.outbound_message import Message, make_msg
|
|
44
51
|
from chia.server.server import ChiaServer
|
|
45
52
|
from chia.server.ws_connection import WSChiaConnection
|
|
46
53
|
from chia.simulator.add_blocks_in_batches import add_blocks_in_batches
|
|
@@ -51,11 +58,8 @@ from chia.types.blockchain_format.program import Program
|
|
|
51
58
|
from chia.types.blockchain_format.serialized_program import SerializedProgram
|
|
52
59
|
from chia.types.coin_spend import make_spend
|
|
53
60
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
54
|
-
from chia.types.full_block import FullBlock
|
|
55
61
|
from chia.types.peer_info import PeerInfo
|
|
56
|
-
from chia.types.spend_bundle import SpendBundle
|
|
57
62
|
from chia.types.validation_state import ValidationState
|
|
58
|
-
from chia.util.augmented_chain import AugmentedBlockchain
|
|
59
63
|
from chia.util.hash import std_hash
|
|
60
64
|
from chia.wallet.conditions import CreateCoin
|
|
61
65
|
from chia.wallet.nft_wallet.nft_wallet import NFTWallet
|
|
@@ -91,7 +95,8 @@ async def test_request_block_headers(
|
|
|
91
95
|
[full_node_api], [(wallet_node, _)], bt = simulator_and_wallet
|
|
92
96
|
|
|
93
97
|
wallet = wallet_node.wallet_state_manager.main_wallet
|
|
94
|
-
|
|
98
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
99
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
95
100
|
await add_blocks_in_batches(default_400_blocks[:100], full_node_api.full_node)
|
|
96
101
|
|
|
97
102
|
msg = await full_node_api.request_block_headers(wallet_protocol.RequestBlockHeaders(uint32(10), uint32(15), False))
|
|
@@ -320,7 +325,9 @@ async def test_almost_recent(
|
|
|
320
325
|
both_phs = []
|
|
321
326
|
for wallet_node, wallet_server in wallets:
|
|
322
327
|
wallet = wallet_node.wallet_state_manager.main_wallet
|
|
323
|
-
|
|
328
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
329
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
330
|
+
both_phs.append(ph)
|
|
324
331
|
|
|
325
332
|
for i in range(20):
|
|
326
333
|
# Tests a reorg with the wallet
|
|
@@ -484,7 +491,9 @@ async def test_wallet_reorg_sync(
|
|
|
484
491
|
phs = []
|
|
485
492
|
for wallet_node, wallet_server in wallets:
|
|
486
493
|
wallet = wallet_node.wallet_state_manager.main_wallet
|
|
487
|
-
|
|
494
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
495
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
496
|
+
phs.append(ph)
|
|
488
497
|
await wallet_server.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
|
489
498
|
|
|
490
499
|
# Insert 400 blocks
|
|
@@ -565,7 +574,8 @@ async def test_wallet_reorg_get_coinbase(
|
|
|
565
574
|
all_blocks_reorg_2 = blocks_reorg[:-30]
|
|
566
575
|
for wallet_node, wallet_server in wallets:
|
|
567
576
|
wallet = wallet_node.wallet_state_manager.main_wallet
|
|
568
|
-
|
|
577
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
578
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
569
579
|
all_blocks_reorg_2 = bt.get_consecutive_blocks(
|
|
570
580
|
1, pool_reward_puzzle_hash=ph, farmer_reward_puzzle_hash=ph, block_list_input=all_blocks_reorg_2
|
|
571
581
|
)
|
|
@@ -604,7 +614,8 @@ async def test_request_additions_errors(simulator_and_wallet: OldSimulatorsAndWa
|
|
|
604
614
|
full_nodes, wallets, _ = simulator_and_wallet
|
|
605
615
|
wallet_node, wallet_server = wallets[0]
|
|
606
616
|
wallet = wallet_node.wallet_state_manager.main_wallet
|
|
607
|
-
|
|
617
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
618
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
608
619
|
|
|
609
620
|
full_node_api = full_nodes[0]
|
|
610
621
|
await wallet_server.start_client(PeerInfo(self_hostname, full_node_api.full_node.server.get_port()), None)
|
|
@@ -659,7 +670,8 @@ async def test_request_additions_success(simulator_and_wallet: OldSimulatorsAndW
|
|
|
659
670
|
full_nodes, wallets, _ = simulator_and_wallet
|
|
660
671
|
wallet_node, wallet_server = wallets[0]
|
|
661
672
|
wallet = wallet_node.wallet_state_manager.main_wallet
|
|
662
|
-
|
|
673
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
674
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
663
675
|
|
|
664
676
|
full_node_api = full_nodes[0]
|
|
665
677
|
await wallet_server.start_client(PeerInfo(self_hostname, full_node_api.full_node.server.get_port()), None)
|
|
@@ -669,13 +681,14 @@ async def test_request_additions_success(simulator_and_wallet: OldSimulatorsAndW
|
|
|
669
681
|
|
|
670
682
|
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
|
671
683
|
|
|
672
|
-
payees: list[CreateCoin] = []
|
|
673
|
-
for i in range(10):
|
|
674
|
-
payee_ph = await wallet.get_new_puzzlehash()
|
|
675
|
-
payees.append(CreateCoin(payee_ph, uint64(i + 100)))
|
|
676
|
-
payees.append(CreateCoin(payee_ph, uint64(i + 200)))
|
|
677
|
-
|
|
678
684
|
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
685
|
+
payees: list[CreateCoin] = []
|
|
686
|
+
for i in range(10):
|
|
687
|
+
payee_ph = await action_scope.get_puzzle_hash(
|
|
688
|
+
wallet.wallet_state_manager, override_reuse_puzhash_with=False
|
|
689
|
+
)
|
|
690
|
+
payees.append(CreateCoin(payee_ph, uint64(i + 100)))
|
|
691
|
+
payees.append(CreateCoin(payee_ph, uint64(i + 200)))
|
|
679
692
|
await wallet.generate_signed_transaction(
|
|
680
693
|
[uint64(0), *(payee.amount for payee in payees)],
|
|
681
694
|
[ph, *(payee.puzzle_hash for payee in payees)],
|
|
@@ -855,7 +868,8 @@ async def test_dusted_wallet(
|
|
|
855
868
|
# Create two wallets, one for farming (not used for testing), and one for testing dust.
|
|
856
869
|
farm_wallet = farm_wallet_node.wallet_state_manager.main_wallet
|
|
857
870
|
dust_wallet = dust_wallet_node.wallet_state_manager.main_wallet
|
|
858
|
-
|
|
871
|
+
async with farm_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
872
|
+
ph = await action_scope.get_puzzle_hash(farm_wallet.wallet_state_manager)
|
|
859
873
|
|
|
860
874
|
full_node_api = full_nodes[0]
|
|
861
875
|
|
|
@@ -888,9 +902,10 @@ async def test_dusted_wallet(
|
|
|
888
902
|
await full_node_api.wait_for_wallets_synced(wallet_nodes=[farm_wallet_node, dust_wallet_node], timeout=20)
|
|
889
903
|
|
|
890
904
|
# Part 1: create a single dust coin
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
905
|
+
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
906
|
+
payees: list[CreateCoin] = []
|
|
907
|
+
payee_ph = await action_scope.get_puzzle_hash(dust_wallet.wallet_state_manager)
|
|
908
|
+
payees.append(CreateCoin(payee_ph, uint64(dust_value)))
|
|
894
909
|
|
|
895
910
|
# construct and send tx
|
|
896
911
|
async with farm_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
@@ -950,8 +965,11 @@ async def test_dusted_wallet(
|
|
|
950
965
|
dust_remaining = new_dust
|
|
951
966
|
|
|
952
967
|
while dust_remaining > 0:
|
|
953
|
-
|
|
954
|
-
|
|
968
|
+
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
969
|
+
payee_ph = await action_scope.get_puzzle_hash(
|
|
970
|
+
dust_wallet.wallet_state_manager, override_reuse_puzhash_with=False
|
|
971
|
+
)
|
|
972
|
+
payees.append(CreateCoin(payee_ph, uint64(dust_value)))
|
|
955
973
|
|
|
956
974
|
# After every 100 (at most) coins added, push the tx and advance the chain
|
|
957
975
|
# This greatly speeds up the overall process
|
|
@@ -1025,9 +1043,12 @@ async def test_dusted_wallet(
|
|
|
1025
1043
|
|
|
1026
1044
|
payees = []
|
|
1027
1045
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1046
|
+
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1047
|
+
for _ in range(large_coins):
|
|
1048
|
+
payee_ph = await action_scope.get_puzzle_hash(
|
|
1049
|
+
dust_wallet.wallet_state_manager, override_reuse_puzhash_with=False
|
|
1050
|
+
)
|
|
1051
|
+
payees.append(CreateCoin(payee_ph, uint64(xch_spam_amount)))
|
|
1031
1052
|
|
|
1032
1053
|
# construct and send tx
|
|
1033
1054
|
async with farm_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
@@ -1069,8 +1090,9 @@ async def test_dusted_wallet(
|
|
|
1069
1090
|
# Part 4: Create one more dust coin to test the threshold
|
|
1070
1091
|
payees = []
|
|
1071
1092
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1093
|
+
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1094
|
+
payee_ph = await action_scope.get_puzzle_hash(dust_wallet.wallet_state_manager)
|
|
1095
|
+
payees.append(CreateCoin(payee_ph, uint64(dust_value)))
|
|
1074
1096
|
|
|
1075
1097
|
# construct and send tx
|
|
1076
1098
|
async with farm_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
@@ -1114,26 +1136,27 @@ async def test_dusted_wallet(
|
|
|
1114
1136
|
# Those below the threshold should get filtered, and those above should not.
|
|
1115
1137
|
payees = []
|
|
1116
1138
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1139
|
+
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1140
|
+
for i in range(5):
|
|
1141
|
+
payee_ph = await action_scope.get_puzzle_hash(dust_wallet.wallet_state_manager)
|
|
1119
1142
|
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1143
|
+
# Create a large coin and add on the appropriate balance.
|
|
1144
|
+
payees.append(CreateCoin(payee_ph, uint64(xch_spam_amount + i)))
|
|
1145
|
+
large_coins += 1
|
|
1146
|
+
large_coin_balance += xch_spam_amount + i
|
|
1124
1147
|
|
|
1125
|
-
|
|
1148
|
+
payee_ph = await action_scope.get_puzzle_hash(dust_wallet.wallet_state_manager)
|
|
1126
1149
|
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1150
|
+
# Make sure we are always creating coins with a positive value.
|
|
1151
|
+
if xch_spam_amount - dust_value - i > 0:
|
|
1152
|
+
payees.append(CreateCoin(payee_ph, uint64(xch_spam_amount - dust_value - i)))
|
|
1153
|
+
else:
|
|
1154
|
+
payees.append(CreateCoin(payee_ph, uint64(dust_value)))
|
|
1155
|
+
# In cases where xch_spam_amount is sufficiently low,
|
|
1156
|
+
# the new dust should be considered a large coina and not be filtered.
|
|
1157
|
+
if xch_spam_amount <= dust_value:
|
|
1158
|
+
large_dust_coins += 1
|
|
1159
|
+
large_dust_balance += dust_value
|
|
1137
1160
|
|
|
1138
1161
|
# construct and send tx
|
|
1139
1162
|
async with farm_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
@@ -1172,8 +1195,9 @@ async def test_dusted_wallet(
|
|
|
1172
1195
|
# Send to the dust wallet "spam_filter_after_n_txs" coins that are equal in value to "xch_spam_amount".
|
|
1173
1196
|
# Send 1 mojo from the dust wallet. The dust wallet should receive a change coin valued at "xch_spam_amount-1".
|
|
1174
1197
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1198
|
+
async with farm_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1199
|
+
payee_ph = await action_scope.get_puzzle_hash(farm_wallet.wallet_state_manager)
|
|
1200
|
+
payees = [CreateCoin(payee_ph, uint64(balance))]
|
|
1177
1201
|
|
|
1178
1202
|
# construct and send tx
|
|
1179
1203
|
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
@@ -1217,8 +1241,9 @@ async def test_dusted_wallet(
|
|
|
1217
1241
|
coin_value = 2
|
|
1218
1242
|
|
|
1219
1243
|
while coins_remaining > 0:
|
|
1220
|
-
|
|
1221
|
-
|
|
1244
|
+
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1245
|
+
payee_ph = await action_scope.get_puzzle_hash(dust_wallet.wallet_state_manager)
|
|
1246
|
+
payees.append(CreateCoin(payee_ph, uint64(coin_value)))
|
|
1222
1247
|
|
|
1223
1248
|
# After every 100 (at most) coins added, push the tx and advance the chain
|
|
1224
1249
|
# This greatly speeds up the overall process
|
|
@@ -1273,8 +1298,9 @@ async def test_dusted_wallet(
|
|
|
1273
1298
|
assert balance == unspent_count * coin_value
|
|
1274
1299
|
|
|
1275
1300
|
# Send a 1 mojo coin from the dust wallet to the farm wallet
|
|
1276
|
-
|
|
1277
|
-
|
|
1301
|
+
async with farm_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1302
|
+
payee_ph = await action_scope.get_puzzle_hash(farm_wallet.wallet_state_manager)
|
|
1303
|
+
payees = [CreateCoin(payee_ph, uint64(1))]
|
|
1278
1304
|
|
|
1279
1305
|
# construct and send tx
|
|
1280
1306
|
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
@@ -1312,8 +1338,10 @@ async def test_dusted_wallet(
|
|
|
1312
1338
|
# The NFT should not be filtered.
|
|
1313
1339
|
|
|
1314
1340
|
# Start with new puzzlehashes for each wallet
|
|
1315
|
-
|
|
1316
|
-
|
|
1341
|
+
async with farm_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1342
|
+
farm_ph = await action_scope.get_puzzle_hash(farm_wallet.wallet_state_manager)
|
|
1343
|
+
async with dust_wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1344
|
+
dust_ph = await action_scope.get_puzzle_hash(dust_wallet.wallet_state_manager)
|
|
1317
1345
|
|
|
1318
1346
|
# Create an NFT wallet for the farmer and dust wallet
|
|
1319
1347
|
farm_nft_wallet = await NFTWallet.create_new_nft_wallet(
|
|
@@ -1409,7 +1437,7 @@ async def test_retry_store(
|
|
|
1409
1437
|
) -> list[CoinState]:
|
|
1410
1438
|
if flakiness_info.coin_state_flaky:
|
|
1411
1439
|
flakiness_info.coin_state_flaky = False
|
|
1412
|
-
raise PeerRequestException
|
|
1440
|
+
raise PeerRequestException
|
|
1413
1441
|
else:
|
|
1414
1442
|
return await func(coin_names, peer, fork_height)
|
|
1415
1443
|
|
|
@@ -1442,7 +1470,7 @@ async def test_retry_store(
|
|
|
1442
1470
|
) -> list[CoinState]:
|
|
1443
1471
|
if flakiness_info.fetch_children_flaky:
|
|
1444
1472
|
flakiness_info.fetch_children_flaky = False
|
|
1445
|
-
raise PeerRequestException
|
|
1473
|
+
raise PeerRequestException
|
|
1446
1474
|
else:
|
|
1447
1475
|
return await func(coin_name, peer, fork_height)
|
|
1448
1476
|
|
|
@@ -1454,7 +1482,7 @@ async def test_retry_store(
|
|
|
1454
1482
|
async def new_func(height: uint32) -> uint64:
|
|
1455
1483
|
if flakiness_info.get_timestamp_flaky:
|
|
1456
1484
|
flakiness_info.get_timestamp_flaky = False
|
|
1457
|
-
raise PeerRequestException
|
|
1485
|
+
raise PeerRequestException
|
|
1458
1486
|
else:
|
|
1459
1487
|
return await func(height)
|
|
1460
1488
|
|
|
@@ -1466,7 +1494,7 @@ async def test_retry_store(
|
|
|
1466
1494
|
async def new_func(puzzle_hash: bytes32) -> Optional[WalletIdentifier]:
|
|
1467
1495
|
if flakiness_info.db_flaky:
|
|
1468
1496
|
flakiness_info.db_flaky = False
|
|
1469
|
-
raise AIOSqliteError
|
|
1497
|
+
raise AIOSqliteError
|
|
1470
1498
|
else:
|
|
1471
1499
|
return await func(puzzle_hash)
|
|
1472
1500
|
|
|
@@ -1504,7 +1532,8 @@ async def test_retry_store(
|
|
|
1504
1532
|
await wallet_server.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
|
1505
1533
|
|
|
1506
1534
|
wallet = wallet_node.wallet_state_manager.main_wallet
|
|
1507
|
-
|
|
1535
|
+
async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
1536
|
+
ph = await action_scope.get_puzzle_hash(wallet.wallet_state_manager)
|
|
1508
1537
|
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
|
1509
1538
|
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(bytes32.zeros))
|
|
1510
1539
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import random
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from chia.types.blockchain_format.program import Program
|
|
8
|
+
from chia.util.casts import int_from_bytes, int_to_bytes
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.parametrize(
|
|
12
|
+
"value",
|
|
13
|
+
[
|
|
14
|
+
0,
|
|
15
|
+
1,
|
|
16
|
+
-1,
|
|
17
|
+
127,
|
|
18
|
+
-127,
|
|
19
|
+
128,
|
|
20
|
+
-128,
|
|
21
|
+
255,
|
|
22
|
+
-255,
|
|
23
|
+
256,
|
|
24
|
+
-256,
|
|
25
|
+
2**8 - 1,
|
|
26
|
+
-(2**8) + 1,
|
|
27
|
+
2**15,
|
|
28
|
+
-(2**15),
|
|
29
|
+
2**31 - 1,
|
|
30
|
+
-(2**31),
|
|
31
|
+
2**63 - 1,
|
|
32
|
+
-(2**63),
|
|
33
|
+
2**127 - 1,
|
|
34
|
+
-(2**127),
|
|
35
|
+
10**100,
|
|
36
|
+
-(10**100), # big ints
|
|
37
|
+
],
|
|
38
|
+
)
|
|
39
|
+
def test_round_trip(value: int) -> None:
|
|
40
|
+
t1 = Program.to(value)
|
|
41
|
+
t2 = int_to_bytes(value)
|
|
42
|
+
assert t1 == Program.to(t2)
|
|
43
|
+
assert int_from_bytes(t2) == value
|
|
44
|
+
assert t1.as_int() == value
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_zero_serialization() -> None:
|
|
48
|
+
assert int_to_bytes(0) == b""
|
|
49
|
+
assert int_from_bytes(b"") == 0
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_minimal_encoding() -> None:
|
|
53
|
+
assert int_to_bytes(0x80) == b"\x00\x80"
|
|
54
|
+
assert int_to_bytes(-129) == b"\xff\x7f" # no extra FF
|
|
55
|
+
assert int_to_bytes(-128) == b"\x80"
|
|
56
|
+
assert int_to_bytes(127) == b"\x7f"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_randomized() -> None:
|
|
60
|
+
random.seed(97)
|
|
61
|
+
for _ in range(1000):
|
|
62
|
+
v = random.randint(-(2**256), 2**256)
|
|
63
|
+
assert int_from_bytes(int_to_bytes(v)) == v
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@pytest.mark.parametrize(
|
|
67
|
+
"blob, expected",
|
|
68
|
+
[
|
|
69
|
+
(b"", 0),
|
|
70
|
+
(b"\x00", 0),
|
|
71
|
+
(b"\x7f", 127),
|
|
72
|
+
(b"\x80", -128),
|
|
73
|
+
(b"\xff", -1),
|
|
74
|
+
(b"\x00\x80", 128),
|
|
75
|
+
(b"\xff\x7f", -129),
|
|
76
|
+
],
|
|
77
|
+
)
|
|
78
|
+
def test_int_from_bytes_explicit(blob: bytes, expected: int) -> None:
|
|
79
|
+
assert int_from_bytes(blob) == expected
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def test_invertibility_on_large_values() -> None:
|
|
83
|
+
for e in range(1, 1025, 64):
|
|
84
|
+
v = 2**e
|
|
85
|
+
for sign in [1, -1]:
|
|
86
|
+
val = v * sign
|
|
87
|
+
b = int_to_bytes(val)
|
|
88
|
+
assert int_from_bytes(b) == val
|
|
@@ -16,8 +16,8 @@ from chia._tests.environments.wallet import STANDARD_TX_ENDPOINT_ARGS, WalletSta
|
|
|
16
16
|
from chia.cmds.cmd_helpers import NeedsCoinSelectionConfig, NeedsWalletRPC, WalletClientInfo
|
|
17
17
|
from chia.cmds.coins import CombineCMD, ListCMD, SplitCMD
|
|
18
18
|
from chia.cmds.param_types import CliAmount, cli_amount_none
|
|
19
|
-
from chia.rpc.wallet_request_types import GetSyncStatusResponse
|
|
20
19
|
from chia.wallet.cat_wallet.cat_wallet import CATWallet
|
|
20
|
+
from chia.wallet.wallet_request_types import GetSyncStatusResponse
|
|
21
21
|
|
|
22
22
|
ONE_TRILLION = 1_000_000_000_000
|
|
23
23
|
|
|
@@ -101,7 +101,7 @@ class TestCoinSelection:
|
|
|
101
101
|
async def test_coin_selection_zero_coins(self, a_hash: bytes32) -> None:
|
|
102
102
|
coin_list: list[WalletCoinRecord] = [
|
|
103
103
|
WalletCoinRecord(Coin(a_hash, a_hash, uint64(0)), uint32(1), uint32(1), False, True, WalletType(0), 1)
|
|
104
|
-
for _ in range(
|
|
104
|
+
for _ in range(100)
|
|
105
105
|
]
|
|
106
106
|
|
|
107
107
|
result: set[Coin] = await select_coins(
|
|
@@ -6,11 +6,11 @@ from typing import Any, Optional, Union
|
|
|
6
6
|
import pytest
|
|
7
7
|
from chia_rs.sized_bytes import bytes32
|
|
8
8
|
from chia_rs.sized_ints import uint32, uint64
|
|
9
|
-
from clvm.casts import int_from_bytes
|
|
10
9
|
from clvm.EvalError import EvalError
|
|
11
10
|
|
|
12
11
|
from chia.types.blockchain_format.program import Program
|
|
13
12
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
13
|
+
from chia.util.casts import int_from_bytes
|
|
14
14
|
from chia.wallet.conditions import (
|
|
15
15
|
CONDITION_DRIVERS,
|
|
16
16
|
CONDITION_DRIVERS_W_ABSTRACTIONS,
|
|
@@ -8,27 +8,27 @@ from random import Random
|
|
|
8
8
|
from typing import Optional
|
|
9
9
|
|
|
10
10
|
import pytest
|
|
11
|
-
from chia_rs import AugSchemeMPL, Coin, CoinSpend, CoinState, Program
|
|
11
|
+
from chia_rs import AugSchemeMPL, Coin, CoinSpend, CoinState, Program, SpendBundle
|
|
12
12
|
from chia_rs.sized_bytes import bytes32
|
|
13
13
|
from chia_rs.sized_ints import uint8, uint16, uint32, uint64
|
|
14
14
|
|
|
15
15
|
from chia._tests.connection_utils import add_dummy_connection
|
|
16
|
+
from chia._tests.util.coin_store import add_coin_records_to_db
|
|
16
17
|
from chia.full_node.coin_store import CoinStore
|
|
17
18
|
from chia.full_node.full_node import FullNode
|
|
18
19
|
from chia.full_node.mempool import MempoolRemoveReason
|
|
19
20
|
from chia.protocols import wallet_protocol
|
|
21
|
+
from chia.protocols.outbound_message import Message, NodeType
|
|
20
22
|
from chia.protocols.protocol_message_types import ProtocolMessageTypes
|
|
21
23
|
from chia.protocols.shared_protocol import Capability
|
|
22
|
-
from chia.server.
|
|
24
|
+
from chia.server.aliases import WalletService
|
|
23
25
|
from chia.server.ws_connection import WSChiaConnection
|
|
24
26
|
from chia.simulator import simulator_protocol
|
|
25
27
|
from chia.simulator.block_tools import BlockTools
|
|
26
28
|
from chia.simulator.full_node_simulator import FullNodeSimulator
|
|
27
29
|
from chia.simulator.start_simulator import SimulatorFullNodeService
|
|
28
|
-
from chia.types.aliases import WalletService
|
|
29
30
|
from chia.types.coin_record import CoinRecord
|
|
30
31
|
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
|
|
31
|
-
from chia.types.spend_bundle import SpendBundle
|
|
32
32
|
from chia.util.hash import std_hash
|
|
33
33
|
|
|
34
34
|
IDENTITY_PUZZLE = Program.to(1)
|
|
@@ -278,7 +278,7 @@ async def test_request_coin_state(one_node: OneNode, self_hostname: str) -> None
|
|
|
278
278
|
coinbase=False,
|
|
279
279
|
timestamp=uint64(1),
|
|
280
280
|
)
|
|
281
|
-
await simulator.full_node.coin_store
|
|
281
|
+
await add_coin_records_to_db(simulator.full_node.coin_store, [*coin_records, ignored_coin])
|
|
282
282
|
|
|
283
283
|
# Request no coin states
|
|
284
284
|
resp = await simulator.request_coin_state(wallet_protocol.RequestCoinState([], None, genesis, False), peer)
|
|
@@ -378,7 +378,7 @@ async def test_request_coin_state_limit(one_node: OneNode, self_hostname: str) -
|
|
|
378
378
|
)
|
|
379
379
|
coin_records[coin_record.coin.name()] = coin_record
|
|
380
380
|
|
|
381
|
-
await simulator.full_node.coin_store
|
|
381
|
+
await add_coin_records_to_db(simulator.full_node.coin_store, list(coin_records.values()))
|
|
382
382
|
|
|
383
383
|
# Fetch the coin records using the wallet protocol,
|
|
384
384
|
# with more coin ids than the limit of 100,000, but only after height 10000.
|
|
@@ -441,7 +441,7 @@ async def test_request_puzzle_state(one_node: OneNode, self_hostname: str) -> No
|
|
|
441
441
|
timestamp=uint64(1),
|
|
442
442
|
)
|
|
443
443
|
|
|
444
|
-
await simulator.full_node.coin_store
|
|
444
|
+
await add_coin_records_to_db(simulator.full_node.coin_store, [*coin_records, ignored_coin])
|
|
445
445
|
|
|
446
446
|
# We already test permutations of CoinStateFilters in the CoinStore tests
|
|
447
447
|
# So it's redundant to do so here
|
|
@@ -570,7 +570,7 @@ async def test_request_puzzle_state_limit(one_node: OneNode, self_hostname: str)
|
|
|
570
570
|
)
|
|
571
571
|
coin_records[coin_record.coin.name()] = coin_record
|
|
572
572
|
|
|
573
|
-
await simulator.full_node.coin_store
|
|
573
|
+
await add_coin_records_to_db(simulator.full_node.coin_store, list(coin_records.values()))
|
|
574
574
|
|
|
575
575
|
# Fetch the coin records using the wallet protocol,
|
|
576
576
|
# only after height 10000, so that the limit of 100000 isn't exceeded
|
|
@@ -724,7 +724,7 @@ async def test_sync_puzzle_state(
|
|
|
724
724
|
if coin_ph != puzzle_hash:
|
|
725
725
|
hints.append((coin.name(), puzzle_hash))
|
|
726
726
|
|
|
727
|
-
await simulator.full_node.coin_store
|
|
727
|
+
await add_coin_records_to_db(simulator.full_node.coin_store, list(coin_records.values()))
|
|
728
728
|
await simulator.full_node.hint_store.add_hints(hints)
|
|
729
729
|
|
|
730
730
|
# Farm peak
|
|
@@ -828,7 +828,7 @@ async def raw_mpu_setup(one_node: OneNode, self_hostname: str, no_capability: bo
|
|
|
828
828
|
reward_1 = Coin(std_hash(b"reward 1"), std_hash(b"reward puzzle hash"), uint64(1000))
|
|
829
829
|
reward_2 = Coin(std_hash(b"reward 2"), std_hash(b"reward puzzle hash"), uint64(2000))
|
|
830
830
|
await simulator.full_node.coin_store.new_block(
|
|
831
|
-
uint32(2), uint64(10000), [reward_1, reward_2], [coin for coin, _ in new_coins], []
|
|
831
|
+
uint32(2), uint64(10000), [reward_1, reward_2], [(coin.name(), coin, False) for coin, _ in new_coins], []
|
|
832
832
|
)
|
|
833
833
|
await simulator.full_node.hint_store.add_hints([(coin.name(), hint) for coin, hint in new_coins])
|
|
834
834
|
|
|
@@ -855,7 +855,9 @@ async def make_coin(full_node: FullNode) -> tuple[Coin, bytes32]:
|
|
|
855
855
|
|
|
856
856
|
reward_1 = Coin(std_hash(b"reward 1"), std_hash(b"reward puzzle hash"), uint64(3000))
|
|
857
857
|
reward_2 = Coin(std_hash(b"reward 2"), std_hash(b"reward puzzle hash"), uint64(4000))
|
|
858
|
-
await full_node.coin_store.new_block(
|
|
858
|
+
await full_node.coin_store.new_block(
|
|
859
|
+
uint32(height + 1), uint64(200000), [reward_1, reward_2], [(coin.name(), coin, False)], []
|
|
860
|
+
)
|
|
859
861
|
await full_node.hint_store.add_hints([(coin.name(), hint)])
|
|
860
862
|
|
|
861
863
|
return coin, hint
|
|
@@ -65,8 +65,10 @@ async def test_notifications(
|
|
|
65
65
|
wallet_1 = wsm_1.main_wallet
|
|
66
66
|
wallet_2 = wsm_2.main_wallet
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
async with wallet_1.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
69
|
+
ph_1 = await action_scope.get_puzzle_hash(wallet_1.wallet_state_manager)
|
|
70
|
+
async with wallet_2.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
71
|
+
ph_2 = await action_scope.get_puzzle_hash(wallet_2.wallet_state_manager)
|
|
70
72
|
ph_token = bytes32.random(seeded_random)
|
|
71
73
|
|
|
72
74
|
if trusted:
|
|
@@ -83,7 +85,7 @@ async def test_notifications(
|
|
|
83
85
|
await server_0.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
|
84
86
|
await server_1.start_client(PeerInfo(self_hostname, full_node_server.get_port()), None)
|
|
85
87
|
|
|
86
|
-
for i in range(
|
|
88
|
+
for i in range(2):
|
|
87
89
|
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_1))
|
|
88
90
|
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph_token))
|
|
89
91
|
await full_node_api.wait_for_wallets_synced(wallet_nodes=[wallet_node_1, wallet_node_2], timeout=30)
|