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
|
@@ -9,7 +9,7 @@ import importlib_resources
|
|
|
9
9
|
import pytest
|
|
10
10
|
from chia_rs import Coin, G2Element
|
|
11
11
|
from chia_rs.sized_bytes import bytes32
|
|
12
|
-
from chia_rs.sized_ints import uint8, uint32, uint64
|
|
12
|
+
from chia_rs.sized_ints import uint8, uint16, uint32, uint64
|
|
13
13
|
from click.testing import CliRunner
|
|
14
14
|
|
|
15
15
|
from chia._tests.cmds.cmd_test_utils import TestRpcClients, TestWalletRpcClient, logType, run_cli_command_and_assert
|
|
@@ -25,15 +25,7 @@ from chia._tests.cmds.wallet.test_consts import (
|
|
|
25
25
|
get_bytes32,
|
|
26
26
|
)
|
|
27
27
|
from chia.cmds.cmds_util import TransactionBundle
|
|
28
|
-
from chia.
|
|
29
|
-
CancelOfferResponse,
|
|
30
|
-
CATSpendResponse,
|
|
31
|
-
CreateOfferForIDsResponse,
|
|
32
|
-
GetHeightInfoResponse,
|
|
33
|
-
SendTransactionResponse,
|
|
34
|
-
TakeOfferResponse,
|
|
35
|
-
)
|
|
36
|
-
from chia.server.outbound_message import NodeType
|
|
28
|
+
from chia.protocols.outbound_message import NodeType
|
|
37
29
|
from chia.types.blockchain_format.program import Program
|
|
38
30
|
from chia.types.signing_mode import SigningMode
|
|
39
31
|
from chia.util.bech32m import encode_puzzle_hash
|
|
@@ -48,6 +40,19 @@ from chia.wallet.util.transaction_type import TransactionType
|
|
|
48
40
|
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG, TXConfig
|
|
49
41
|
from chia.wallet.util.wallet_types import WalletType
|
|
50
42
|
from chia.wallet.wallet_coin_store import GetCoinRecords
|
|
43
|
+
from chia.wallet.wallet_request_types import (
|
|
44
|
+
CancelOfferResponse,
|
|
45
|
+
CATSpendResponse,
|
|
46
|
+
CreateOfferForIDsResponse,
|
|
47
|
+
FungibleAsset,
|
|
48
|
+
GetHeightInfoResponse,
|
|
49
|
+
NFTCalculateRoyalties,
|
|
50
|
+
NFTGetWalletDID,
|
|
51
|
+
NFTGetWalletDIDResponse,
|
|
52
|
+
RoyaltyAsset,
|
|
53
|
+
SendTransactionResponse,
|
|
54
|
+
TakeOfferResponse,
|
|
55
|
+
)
|
|
51
56
|
from chia.wallet.wallet_spend_bundle import WalletSpendBundle
|
|
52
57
|
|
|
53
58
|
test_offer_file_path = importlib_resources.files(__name__.rpartition(".")[0]).joinpath("test_offer.toffer")
|
|
@@ -246,9 +251,9 @@ def test_show(capsys: object, get_test_cli_clients: tuple[TestRpcClients, Path])
|
|
|
246
251
|
"unconfirmed_wallet_balance": uint64(0),
|
|
247
252
|
}
|
|
248
253
|
|
|
249
|
-
async def get_nft_wallet_did(self,
|
|
250
|
-
self.add_to_log("get_nft_wallet_did", (wallet_id,))
|
|
251
|
-
return
|
|
254
|
+
async def get_nft_wallet_did(self, request: NFTGetWalletDID) -> NFTGetWalletDIDResponse:
|
|
255
|
+
self.add_to_log("get_nft_wallet_did", (request.wallet_id,))
|
|
256
|
+
return NFTGetWalletDIDResponse("did:chia:1qgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpq4msw0c")
|
|
252
257
|
|
|
253
258
|
async def get_connections(
|
|
254
259
|
self, node_type: Optional[NodeType] = None
|
|
@@ -277,7 +282,7 @@ def test_show(capsys: object, get_test_cli_clients: tuple[TestRpcClients, Path])
|
|
|
277
282
|
"test2:\n -Total Balance: 2000000.0 (2000000000 mojo)",
|
|
278
283
|
" -Asset ID: dc59bcd60ce5fc9c93a5d3b11875486b03efb53a53da61e453f5cf61a7746860",
|
|
279
284
|
"NFT Wallet:\n -Total Balance: 1.0",
|
|
280
|
-
" -DID ID:
|
|
285
|
+
" -DID ID: did:chia:1qgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpq4msw0c",
|
|
281
286
|
"FULL_NODE 127.0.0.1",
|
|
282
287
|
"47482/47482 01010101... May 12",
|
|
283
288
|
]
|
|
@@ -661,12 +666,14 @@ def test_add_token(capsys: object, get_test_cli_clients: tuple[TestRpcClients, P
|
|
|
661
666
|
assert_list = [f"Successfully renamed test1 with wallet_id 2 on key {FINGERPRINT} to examplecat"]
|
|
662
667
|
other_assert_list = [f"Successfully added examplecat with wallet id 3 on key {FINGERPRINT}"]
|
|
663
668
|
run_cli_command_and_assert(capsys, root_dir, [*command_args, "--asset-id", get_bytes32(1).hex()], assert_list)
|
|
664
|
-
run_cli_command_and_assert(
|
|
669
|
+
run_cli_command_and_assert(
|
|
670
|
+
capsys, root_dir, [*command_args, "--asset-id", bytes32([1, 2] * 16).hex()], other_assert_list
|
|
671
|
+
)
|
|
665
672
|
# these are various things that should be in the output
|
|
666
673
|
|
|
667
674
|
expected_calls: logType = {
|
|
668
|
-
"cat_asset_id_to_name": [(get_bytes32(1),), (
|
|
669
|
-
"create_wallet_for_existing_cat": [(
|
|
675
|
+
"cat_asset_id_to_name": [(get_bytes32(1),), (bytes32([1, 2] * 16),)],
|
|
676
|
+
"create_wallet_for_existing_cat": [(bytes32([1, 2] * 16),)],
|
|
670
677
|
"set_cat_name": [(2, "examplecat"), (3, "examplecat")],
|
|
671
678
|
}
|
|
672
679
|
test_rpc_clients.wallet_rpc_client.check_log(expected_calls)
|
|
@@ -765,6 +772,7 @@ def test_make_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
|
|
|
765
772
|
|
|
766
773
|
inst_rpc_client = MakeOfferRpcClient()
|
|
767
774
|
test_rpc_clients.wallet_rpc_client = inst_rpc_client
|
|
775
|
+
offer_cat_id = get_bytes32(4)
|
|
768
776
|
request_cat_id = get_bytes32(2)
|
|
769
777
|
request_nft_id = get_bytes32(2)
|
|
770
778
|
request_nft_addr = encode_puzzle_hash(request_nft_id, "nft")
|
|
@@ -780,6 +788,8 @@ def test_make_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
|
|
|
780
788
|
"1:10",
|
|
781
789
|
"--offer",
|
|
782
790
|
"3:100",
|
|
791
|
+
"--offer",
|
|
792
|
+
f"{offer_cat_id.hex()}:100",
|
|
783
793
|
"--request",
|
|
784
794
|
f"{request_cat_id.hex()}:10",
|
|
785
795
|
"--request",
|
|
@@ -790,7 +800,7 @@ def test_make_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
|
|
|
790
800
|
"150",
|
|
791
801
|
]
|
|
792
802
|
assert_list = [
|
|
793
|
-
"OFFERING:\n - 10 XCH (10000000000000 mojos)\n - 100 test3 (100000 mojos)",
|
|
803
|
+
"OFFERING:\n - 10 XCH (10000000000000 mojos)\n - 100 test3 (100000 mojos)\n - 100 test4 (100000 mojos)",
|
|
794
804
|
"REQUESTING:\n - 10 test2 (10000 mojos)\n"
|
|
795
805
|
" - 1 nft1qgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyql4ft (1 mojos)",
|
|
796
806
|
"Including Fees: 0.5 XCH, 500000000000 mojos",
|
|
@@ -799,18 +809,34 @@ def test_make_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
|
|
|
799
809
|
run_cli_command_and_assert(capsys, root_dir, command_args[:-8], ["without --override"])
|
|
800
810
|
run_cli_command_and_assert(capsys, root_dir, command_args, assert_list)
|
|
801
811
|
expected_calls: logType = {
|
|
802
|
-
"cat_asset_id_to_name": [(request_cat_id,)],
|
|
812
|
+
"cat_asset_id_to_name": [(offer_cat_id,), (request_cat_id,)],
|
|
803
813
|
"get_nft_info": [(request_nft_id.hex(), True)],
|
|
804
814
|
"get_cat_name": [(3,)],
|
|
805
815
|
"nft_calculate_royalties": [
|
|
806
816
|
(
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
817
|
+
NFTCalculateRoyalties(
|
|
818
|
+
[
|
|
819
|
+
RoyaltyAsset(
|
|
820
|
+
"nft1qgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyql4ft",
|
|
821
|
+
"xch1qvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvps82kgr2",
|
|
822
|
+
uint16(1000),
|
|
823
|
+
)
|
|
824
|
+
],
|
|
825
|
+
[
|
|
826
|
+
FungibleAsset(
|
|
827
|
+
"XCH",
|
|
828
|
+
uint64(10000000000000),
|
|
829
|
+
),
|
|
830
|
+
FungibleAsset(
|
|
831
|
+
"test3",
|
|
832
|
+
uint64(100000),
|
|
833
|
+
),
|
|
834
|
+
FungibleAsset(
|
|
835
|
+
"test4",
|
|
836
|
+
uint64(100000),
|
|
837
|
+
),
|
|
838
|
+
],
|
|
839
|
+
),
|
|
814
840
|
)
|
|
815
841
|
],
|
|
816
842
|
"create_offer_for_ids": [
|
|
@@ -818,6 +844,7 @@ def test_make_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
|
|
|
818
844
|
{
|
|
819
845
|
1: -10000000000000,
|
|
820
846
|
3: -100000,
|
|
847
|
+
"0404040404040404040404040404040404040404040404040404040404040404": -100000,
|
|
821
848
|
"0202020202020202020202020202020202020202020202020202020202020202": 10000,
|
|
822
849
|
"0101010101010101010101010101010101010101010101010101010101010101": 1,
|
|
823
850
|
},
|
|
@@ -998,17 +1025,39 @@ def test_take_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
|
|
|
998
1025
|
),
|
|
999
1026
|
)
|
|
1000
1027
|
|
|
1028
|
+
async def cat_asset_id_to_name(self, asset_id: bytes32) -> Optional[tuple[Optional[uint32], str]]:
|
|
1029
|
+
self.add_to_log("cat_asset_id_to_name", (asset_id,))
|
|
1030
|
+
if asset_id == cat_offered_id:
|
|
1031
|
+
return uint32(2), "offered cat"
|
|
1032
|
+
elif asset_id == cat_requested_id:
|
|
1033
|
+
return uint32(3), "requested cat"
|
|
1034
|
+
else:
|
|
1035
|
+
return None
|
|
1036
|
+
|
|
1001
1037
|
inst_rpc_client = TakeOfferRpcClient()
|
|
1002
1038
|
test_rpc_clients.wallet_rpc_client = inst_rpc_client
|
|
1003
1039
|
# these are various things that should be in the output
|
|
1004
|
-
|
|
1005
|
-
|
|
1040
|
+
nft_offered_id = bytes32.from_hexstr("6bc2c2a27c0f04b9e1e57933d2efe08f5b9e156652a374436b70c067b03c444c")
|
|
1041
|
+
cat_offered_id = bytes32.from_hexstr("06e4136cb7295cec5265c5e49cc32fa69aede779532f2b7542a2456589a53f2f")
|
|
1042
|
+
cat_requested_id = bytes32.from_hexstr("13a52e5efb1ee80a24c94b36bbda2b473094353614ced1c2938ba5ef6097431e")
|
|
1043
|
+
nft_requested_id_1 = bytes32.from_hexstr("7657b5f1cdee70459052c314f839bb1b76b8c3f444671da71ad7dfcb6c47f243")
|
|
1044
|
+
nft_requested_id_2 = bytes32.from_hexstr("5f03cdb94c96325f49f4abf1d4d10cabd5ea583632fbf20f251b7fad73645a14")
|
|
1006
1045
|
assert_list = [
|
|
1007
|
-
|
|
1046
|
+
" OFFERED:\n"
|
|
1047
|
+
f" - {nft_offered_id.hex()}: 0.001 (1 mojo)\n"
|
|
1048
|
+
f" - offered cat (Wallet ID: 2): 100.0 (100000 mojos)\n",
|
|
1008
1049
|
" REQUESTED:\n"
|
|
1009
|
-
|
|
1010
|
-
" -
|
|
1011
|
-
"
|
|
1050
|
+
" - XCH (Wallet ID: 1): 2.0 (2000000000000 mojos)\n"
|
|
1051
|
+
f" - {nft_requested_id_1.hex()}: 0.001 (1 mojo)\n"
|
|
1052
|
+
f" - {nft_requested_id_2.hex()}: 0.001 (1 mojo)\n",
|
|
1053
|
+
" - requested cat (Wallet ID: 3): 100.0 (100000 mojos)\n",
|
|
1054
|
+
"Royalties Summary:\n"
|
|
1055
|
+
f" - For {encode_puzzle_hash(nft_offered_id, 'nft')}:\n"
|
|
1056
|
+
" - 0.2 XCH (200000000000 mojos) to xch1qvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvps82kgr2\n"
|
|
1057
|
+
" - 10 requested cat (10000 mojos) to xch1qvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvpsxqcrqvps82kgr2\n",
|
|
1058
|
+
"Total Amounts Requested:\n",
|
|
1059
|
+
" - 2.2 XCH (2200000000000 mojos)\n - 110 requested cat (110000 mojos)\n",
|
|
1060
|
+
"Accepted offer with ID 71fd6de245d896c691b0115cdb9b47904cb60858ae87b86bfd648b23208b6cc1",
|
|
1012
1061
|
]
|
|
1013
1062
|
|
|
1014
1063
|
with importlib_resources.as_file(test_offer_file_path) as test_offer_file_name:
|
|
@@ -1028,9 +1077,12 @@ def test_take_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients,
|
|
|
1028
1077
|
|
|
1029
1078
|
expected_calls: logType = {
|
|
1030
1079
|
"cat_asset_id_to_name": [
|
|
1031
|
-
(
|
|
1032
|
-
(
|
|
1033
|
-
(
|
|
1080
|
+
(nft_offered_id,),
|
|
1081
|
+
(cat_offered_id,),
|
|
1082
|
+
(nft_requested_id_1,),
|
|
1083
|
+
(nft_requested_id_2,),
|
|
1084
|
+
(cat_requested_id,),
|
|
1085
|
+
(cat_requested_id,),
|
|
1034
1086
|
],
|
|
1035
1087
|
"take_offer": [
|
|
1036
1088
|
(
|
|
@@ -1096,14 +1148,13 @@ def test_cancel_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients
|
|
|
1096
1148
|
"150",
|
|
1097
1149
|
]
|
|
1098
1150
|
# these are various things that should be in the output
|
|
1099
|
-
|
|
1100
|
-
|
|
1151
|
+
nft_offered_id = bytes32.from_hexstr("6bc2c2a27c0f04b9e1e57933d2efe08f5b9e156652a374436b70c067b03c444c")
|
|
1152
|
+
cat_offered_id = bytes32.from_hexstr("06e4136cb7295cec5265c5e49cc32fa69aede779532f2b7542a2456589a53f2f")
|
|
1153
|
+
cat_requested_id = bytes32.from_hexstr("13a52e5efb1ee80a24c94b36bbda2b473094353614ced1c2938ba5ef6097431e")
|
|
1154
|
+
nft_requested_id_1 = bytes32.from_hexstr("7657b5f1cdee70459052c314f839bb1b76b8c3f444671da71ad7dfcb6c47f243")
|
|
1155
|
+
nft_requested_id_2 = bytes32.from_hexstr("5f03cdb94c96325f49f4abf1d4d10cabd5ea583632fbf20f251b7fad73645a14")
|
|
1101
1156
|
assert_list = [
|
|
1102
|
-
|
|
1103
|
-
" REQUESTED:\n"
|
|
1104
|
-
f" - {cat2.hex()}: 10.0 (10000 mojos)\n"
|
|
1105
|
-
" - accce8e1c71b56624f2ecaeff5af57eac41365080449904d0717bd333c04806d: 0.001 (1 mojo)",
|
|
1106
|
-
"Cancelled offer with ID dfb7e8643376820ec995b0bcdb3fc1f764c16b814df5e074631263fcf1e00839",
|
|
1157
|
+
"Cancelled offer with ID 71fd6de245d896c691b0115cdb9b47904cb60858ae87b86bfd648b23208b6cc1",
|
|
1107
1158
|
]
|
|
1108
1159
|
run_cli_command_and_assert(capsys, root_dir, command_args, assert_list)
|
|
1109
1160
|
expected_calls: logType = {
|
|
@@ -1112,10 +1163,13 @@ def test_cancel_offer(capsys: object, get_test_cli_clients: tuple[TestRpcClients
|
|
|
1112
1163
|
(test_offer_id_bytes, DEFAULT_TX_CONFIG, 500000000000, True, True, test_condition_valid_times)
|
|
1113
1164
|
],
|
|
1114
1165
|
"cat_asset_id_to_name": [
|
|
1115
|
-
(
|
|
1116
|
-
(
|
|
1117
|
-
(
|
|
1118
|
-
(
|
|
1166
|
+
(nft_offered_id,),
|
|
1167
|
+
(cat_offered_id,),
|
|
1168
|
+
(nft_requested_id_1,),
|
|
1169
|
+
(nft_requested_id_2,),
|
|
1170
|
+
(cat_requested_id,),
|
|
1171
|
+
(nft_offered_id,),
|
|
1172
|
+
(cat_offered_id,),
|
|
1119
1173
|
],
|
|
1120
1174
|
}
|
|
1121
1175
|
test_rpc_clients.wallet_rpc_client.check_log(expected_calls)
|
chia/_tests/conftest.py
CHANGED
|
@@ -49,11 +49,18 @@ from chia._tests.util.setup_nodes import (
|
|
|
49
49
|
)
|
|
50
50
|
from chia._tests.util.spend_sim import CostLogger
|
|
51
51
|
from chia._tests.util.time_out_assert import time_out_assert
|
|
52
|
+
from chia.farmer.farmer_rpc_client import FarmerRpcClient
|
|
52
53
|
from chia.full_node.full_node_api import FullNodeAPI
|
|
53
|
-
from chia.
|
|
54
|
-
from chia.rpc.harvester_rpc_client import HarvesterRpcClient
|
|
55
|
-
from chia.rpc.wallet_rpc_client import WalletRpcClient
|
|
54
|
+
from chia.harvester.harvester_rpc_client import HarvesterRpcClient
|
|
56
55
|
from chia.seeder.dns_server import DNSServer
|
|
56
|
+
from chia.server.aliases import (
|
|
57
|
+
CrawlerService,
|
|
58
|
+
FarmerService,
|
|
59
|
+
FullNodeService,
|
|
60
|
+
HarvesterService,
|
|
61
|
+
TimelordService,
|
|
62
|
+
WalletService,
|
|
63
|
+
)
|
|
57
64
|
from chia.server.server import ChiaServer
|
|
58
65
|
from chia.server.start_service import Service
|
|
59
66
|
from chia.simulator.full_node_simulator import FullNodeSimulator
|
|
@@ -67,16 +74,6 @@ from chia.simulator.setup_services import (
|
|
|
67
74
|
)
|
|
68
75
|
from chia.simulator.start_simulator import SimulatorFullNodeService
|
|
69
76
|
from chia.simulator.wallet_tools import WalletTool
|
|
70
|
-
|
|
71
|
-
# Set spawn after stdlib imports, but before other imports
|
|
72
|
-
from chia.types.aliases import (
|
|
73
|
-
CrawlerService,
|
|
74
|
-
FarmerService,
|
|
75
|
-
FullNodeService,
|
|
76
|
-
HarvesterService,
|
|
77
|
-
TimelordService,
|
|
78
|
-
WalletService,
|
|
79
|
-
)
|
|
80
77
|
from chia.types.peer_info import PeerInfo
|
|
81
78
|
from chia.util.config import create_default_chia_config, lock_and_load_config
|
|
82
79
|
from chia.util.db_wrapper import generate_in_memory_db_uri
|
|
@@ -84,7 +81,10 @@ from chia.util.keychain import Keychain
|
|
|
84
81
|
from chia.util.task_timing import main as task_instrumentation_main
|
|
85
82
|
from chia.util.task_timing import start_task_instrumentation, stop_task_instrumentation
|
|
86
83
|
from chia.wallet.wallet_node import WalletNode
|
|
84
|
+
from chia.wallet.wallet_rpc_client import WalletRpcClient
|
|
87
85
|
|
|
86
|
+
# TODO: review how this is now after other imports and before some stdlib imports... :[
|
|
87
|
+
# Set spawn after stdlib imports, but before other imports
|
|
88
88
|
multiprocessing.set_start_method("spawn")
|
|
89
89
|
|
|
90
90
|
from dataclasses import replace
|
|
@@ -94,7 +94,7 @@ from chia_rs.sized_ints import uint128
|
|
|
94
94
|
|
|
95
95
|
from chia._tests.environments.wallet import WalletEnvironment, WalletState, WalletTestFramework
|
|
96
96
|
from chia._tests.util.setup_nodes import setup_farmer_multi_harvester
|
|
97
|
-
from chia.
|
|
97
|
+
from chia.full_node.full_node_rpc_client import FullNodeRpcClient
|
|
98
98
|
from chia.simulator.block_tools import BlockTools, create_block_tools_async, test_constants
|
|
99
99
|
from chia.simulator.keyring import TempKeyring
|
|
100
100
|
from chia.util.keyring_wrapper import KeyringWrapper
|
|
@@ -196,12 +196,12 @@ def get_keychain():
|
|
|
196
196
|
class ConsensusMode(ComparableEnum):
|
|
197
197
|
PLAIN = 0
|
|
198
198
|
HARD_FORK_2_0 = 1
|
|
199
|
-
|
|
199
|
+
HARD_FORK_3_0 = 2
|
|
200
200
|
|
|
201
201
|
|
|
202
202
|
@pytest.fixture(
|
|
203
203
|
scope="session",
|
|
204
|
-
params=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0, ConsensusMode.
|
|
204
|
+
params=[ConsensusMode.PLAIN, ConsensusMode.HARD_FORK_2_0, ConsensusMode.HARD_FORK_3_0],
|
|
205
205
|
)
|
|
206
206
|
def consensus_mode(request):
|
|
207
207
|
return request.param
|
|
@@ -217,10 +217,16 @@ def blockchain_constants(consensus_mode: ConsensusMode) -> ConsensusConstants:
|
|
|
217
217
|
PLOT_FILTER_64_HEIGHT=uint32(15),
|
|
218
218
|
PLOT_FILTER_32_HEIGHT=uint32(20),
|
|
219
219
|
)
|
|
220
|
-
|
|
220
|
+
|
|
221
|
+
if consensus_mode >= ConsensusMode.HARD_FORK_3_0:
|
|
221
222
|
ret = ret.replace(
|
|
222
|
-
|
|
223
|
+
HARD_FORK_HEIGHT=uint32(2),
|
|
224
|
+
PLOT_FILTER_128_HEIGHT=uint32(10),
|
|
225
|
+
PLOT_FILTER_64_HEIGHT=uint32(15),
|
|
226
|
+
PLOT_FILTER_32_HEIGHT=uint32(20),
|
|
227
|
+
HARD_FORK2_HEIGHT=uint32(2),
|
|
223
228
|
)
|
|
229
|
+
|
|
224
230
|
return ret
|
|
225
231
|
|
|
226
232
|
|
|
@@ -468,6 +474,11 @@ def default_10000_blocks_compact(bt, consensus_mode):
|
|
|
468
474
|
)
|
|
469
475
|
|
|
470
476
|
|
|
477
|
+
# If you add another test chain, don't forget to also add a "build_test_chains"
|
|
478
|
+
# generator to chia/_tests/blockchain/test_build_chains.py as well as a test in
|
|
479
|
+
# the same file.
|
|
480
|
+
|
|
481
|
+
|
|
471
482
|
@pytest.fixture(scope="function")
|
|
472
483
|
def tmp_dir():
|
|
473
484
|
with tempfile.TemporaryDirectory() as folder:
|
|
@@ -1236,8 +1247,8 @@ async def farmer_harvester_2_simulators_zero_bits_plot_filter(
|
|
|
1236
1247
|
]
|
|
1237
1248
|
]:
|
|
1238
1249
|
zero_bit_plot_filter_consts = test_constants_modified.replace(
|
|
1239
|
-
|
|
1240
|
-
NUM_SPS_SUB_SLOT=
|
|
1250
|
+
NUMBER_ZERO_BITS_PLOT_FILTER_V1=uint8(0),
|
|
1251
|
+
NUM_SPS_SUB_SLOT=uint8(8),
|
|
1241
1252
|
)
|
|
1242
1253
|
|
|
1243
1254
|
async with AsyncExitStack() as async_exit_stack:
|
chia/_tests/connection_utils.py
CHANGED
|
@@ -13,8 +13,8 @@ from cryptography.hazmat.primitives import hashes, serialization
|
|
|
13
13
|
|
|
14
14
|
from chia._tests.util.time_out_assert import time_out_assert
|
|
15
15
|
from chia.apis import ApiProtocolRegistry
|
|
16
|
+
from chia.protocols.outbound_message import NodeType
|
|
16
17
|
from chia.protocols.shared_protocol import default_capabilities
|
|
17
|
-
from chia.server.outbound_message import NodeType
|
|
18
18
|
from chia.server.server import ChiaServer, ssl_context_for_client
|
|
19
19
|
from chia.server.ssl_context import chia_ssl_ca_paths, private_ssl_ca_paths
|
|
20
20
|
from chia.server.ws_connection import WSChiaConnection
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from chia_rs.sized_bytes import bytes32
|
|
5
|
+
from chia_rs.sized_ints import uint32, uint64
|
|
6
|
+
|
|
7
|
+
from chia._tests.util.db_connection import DBConnection
|
|
8
|
+
from chia.consensus.coinbase import create_farmer_coin, create_pool_coin
|
|
9
|
+
from chia.full_node.coin_store import CoinStore
|
|
10
|
+
|
|
11
|
+
# black box tests from `chia/_tests/core/full_node/stores/test_coin_store.py`
|
|
12
|
+
# should be moved here
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@pytest.mark.anyio
|
|
16
|
+
async def test_is_empty_when_empty(db_version: int) -> None:
|
|
17
|
+
async with DBConnection(db_version) as db_wrapper:
|
|
18
|
+
coin_store = await CoinStore.create(db_wrapper)
|
|
19
|
+
assert await coin_store.is_empty() is True
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.anyio
|
|
23
|
+
async def test_is_empty_when_not_empty(db_version: int) -> None:
|
|
24
|
+
async with DBConnection(db_version) as db_wrapper:
|
|
25
|
+
coin_store = await CoinStore.create(db_wrapper)
|
|
26
|
+
assert await coin_store.is_empty() is True
|
|
27
|
+
height = uint32(1)
|
|
28
|
+
genesis_challenge = bytes32(b"\0" * 32)
|
|
29
|
+
pool_puzzle_hash = bytes32(b"\x01" * 32)
|
|
30
|
+
farmer_puzzle_hash = bytes32(b"\x02" * 32)
|
|
31
|
+
pool_coin = create_pool_coin(height, pool_puzzle_hash, uint64(1_750_000_000_000), genesis_challenge)
|
|
32
|
+
farmer_coin = create_farmer_coin(height, farmer_puzzle_hash, uint64(1_750_000_000_000), genesis_challenge)
|
|
33
|
+
await coin_store.new_block(
|
|
34
|
+
height=height,
|
|
35
|
+
timestamp=uint64(1234567890),
|
|
36
|
+
included_reward_coins=[pool_coin, farmer_coin],
|
|
37
|
+
tx_additions=[],
|
|
38
|
+
tx_removals=[],
|
|
39
|
+
)
|
|
40
|
+
assert await coin_store.is_empty() is False
|
|
@@ -2,12 +2,9 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import pytest
|
|
4
4
|
from chia_rs.sized_bytes import bytes32
|
|
5
|
-
from chia_rs.sized_ints import
|
|
5
|
+
from chia_rs.sized_ints import uint64
|
|
6
6
|
|
|
7
|
-
from chia.
|
|
8
|
-
from chia.consensus.block_creation import compute_block_cost, compute_block_fee
|
|
9
|
-
from chia.consensus.condition_costs import ConditionCost
|
|
10
|
-
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
|
7
|
+
from chia.consensus.block_creation import compute_block_fee
|
|
11
8
|
from chia.types.blockchain_format.coin import Coin
|
|
12
9
|
|
|
13
10
|
|
|
@@ -26,29 +23,3 @@ def test_compute_block_fee(add_amount: list[int], rem_amount: list[int]) -> None
|
|
|
26
23
|
compute_block_fee(additions, removals)
|
|
27
24
|
else:
|
|
28
25
|
assert compute_block_fee(additions, removals) == expected
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def test_compute_block_cost(softfork_height: uint32) -> None:
|
|
32
|
-
num_coins = 10
|
|
33
|
-
generator = make_block_generator(num_coins)
|
|
34
|
-
cost = int(compute_block_cost(generator, DEFAULT_CONSTANTS, softfork_height))
|
|
35
|
-
|
|
36
|
-
coin_cost = ConditionCost.CREATE_COIN.value * num_coins
|
|
37
|
-
agg_sig_cost = ConditionCost.AGG_SIG.value * num_coins
|
|
38
|
-
|
|
39
|
-
cost -= coin_cost
|
|
40
|
-
cost -= agg_sig_cost
|
|
41
|
-
cost -= len(bytes(generator.program)) * DEFAULT_CONSTANTS.COST_PER_BYTE
|
|
42
|
-
|
|
43
|
-
print(f"{cost=}")
|
|
44
|
-
|
|
45
|
-
# the cost is a non-trivial combination of the CLVM cost of running the puzzles
|
|
46
|
-
# and before the hard-fork, combined with the cost of running the generator ROM
|
|
47
|
-
# Consensus requires these costs to be unchanged over time, so this test
|
|
48
|
-
# ensures compatibility
|
|
49
|
-
if softfork_height >= DEFAULT_CONSTANTS.HARD_FORK_HEIGHT:
|
|
50
|
-
expected = 180980
|
|
51
|
-
else:
|
|
52
|
-
expected = 3936699
|
|
53
|
-
|
|
54
|
-
assert cost == expected
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from chia_rs import PlotSize
|
|
3
4
|
from chia_rs.sized_ints import uint8, uint16, uint32, uint64, uint128
|
|
4
5
|
from pytest import raises
|
|
5
6
|
|
|
6
7
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
|
7
8
|
from chia.consensus.pos_quality import _expected_plot_size
|
|
8
9
|
from chia.consensus.pot_iterations import (
|
|
10
|
+
PHASE_OUT_PERIOD,
|
|
9
11
|
calculate_ip_iters,
|
|
10
12
|
calculate_iterations_quality,
|
|
13
|
+
calculate_phase_out,
|
|
14
|
+
calculate_sp_interval_iters,
|
|
11
15
|
calculate_sp_iters,
|
|
12
16
|
is_overflow_block,
|
|
13
17
|
)
|
|
14
18
|
from chia.util.hash import std_hash
|
|
15
19
|
|
|
16
|
-
test_constants = DEFAULT_CONSTANTS.replace(
|
|
20
|
+
test_constants = DEFAULT_CONSTANTS.replace(
|
|
21
|
+
NUM_SPS_SUB_SLOT=uint8(32), SUB_SLOT_TIME_TARGET=uint16(300), HARD_FORK2_HEIGHT=uint32(100000000)
|
|
22
|
+
)
|
|
17
23
|
|
|
18
24
|
|
|
19
25
|
class TestPotIterations:
|
|
@@ -98,7 +104,7 @@ class TestPotIterations:
|
|
|
98
104
|
num_sps = 16
|
|
99
105
|
sp_interval_iters = uint64(100000000 // 32)
|
|
100
106
|
difficulty = uint64(500000000000)
|
|
101
|
-
|
|
107
|
+
constants = test_constants.replace(DIFFICULTY_CONSTANT_FACTOR=uint128(2**25))
|
|
102
108
|
for slot_index in range(total_slots):
|
|
103
109
|
total_wins_in_slot = 0
|
|
104
110
|
for sp_index in range(num_sps):
|
|
@@ -106,7 +112,10 @@ class TestPotIterations:
|
|
|
106
112
|
for k, count in farmer_ks.items():
|
|
107
113
|
for farmer_index in range(count):
|
|
108
114
|
quality = std_hash(slot_index.to_bytes(4, "big") + k.to_bytes(1, "big") + bytes(farmer_index))
|
|
109
|
-
|
|
115
|
+
# TODO: todo_v2_plots
|
|
116
|
+
required_iters = calculate_iterations_quality(
|
|
117
|
+
constants, quality, PlotSize.make_v1(k), difficulty, sp_hash, uint64(100000000), uint32(0)
|
|
118
|
+
)
|
|
110
119
|
if required_iters < sp_interval_iters:
|
|
111
120
|
wins[k] += 1
|
|
112
121
|
total_wins_in_slot += 1
|
|
@@ -115,3 +124,29 @@ class TestPotIterations:
|
|
|
115
124
|
for k in farmer_ks.keys():
|
|
116
125
|
# Win rate is proportional to percentage of space
|
|
117
126
|
assert abs(win_percentage[k] - percentage_space[k]) < 0.01
|
|
127
|
+
|
|
128
|
+
def test_calculate_phase_out(self):
|
|
129
|
+
constants = test_constants
|
|
130
|
+
sub_slot_iters = uint64(100000000000)
|
|
131
|
+
sp_interval = calculate_sp_interval_iters(constants, sub_slot_iters)
|
|
132
|
+
# Before or at HARD_FORK2_HEIGHT, should return 0
|
|
133
|
+
assert calculate_phase_out(constants, sub_slot_iters, constants.HARD_FORK2_HEIGHT - 1) == 0
|
|
134
|
+
assert calculate_phase_out(constants, sub_slot_iters, constants.HARD_FORK2_HEIGHT) == 0
|
|
135
|
+
# after HARD_FORK2_HEIGHT, should return value = delta/phase_out_period * sp_interval
|
|
136
|
+
assert (
|
|
137
|
+
calculate_phase_out(constants, sub_slot_iters, constants.HARD_FORK2_HEIGHT + 1)
|
|
138
|
+
== sp_interval // PHASE_OUT_PERIOD
|
|
139
|
+
)
|
|
140
|
+
assert (
|
|
141
|
+
calculate_phase_out(constants, sub_slot_iters, constants.HARD_FORK2_HEIGHT + PHASE_OUT_PERIOD // 2)
|
|
142
|
+
== sp_interval // 2
|
|
143
|
+
)
|
|
144
|
+
assert (
|
|
145
|
+
calculate_phase_out(constants, sub_slot_iters, constants.HARD_FORK2_HEIGHT + PHASE_OUT_PERIOD)
|
|
146
|
+
== sp_interval
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# Test with maximum uint32 height to ensure no overflow
|
|
150
|
+
max_uint32_height = uint32(0xFFFFFFFF)
|
|
151
|
+
result_max_height = calculate_phase_out(constants, sub_slot_iters, max_uint32_height)
|
|
152
|
+
assert result_max_height == sp_interval # Should cap at sp_interval
|