chia-blockchain 2.5.7rc4__py3-none-any.whl → 2.5.8rc1__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/__init__.py +8 -4
- chia/_tests/blockchain/blockchain_test_utils.py +6 -8
- chia/_tests/blockchain/test_augmented_chain.py +4 -4
- chia/_tests/blockchain/test_blockchain.py +165 -190
- chia/_tests/blockchain/test_build_chains.py +2 -4
- chia/_tests/blockchain/test_get_block_generator.py +2 -3
- chia/_tests/clvm/coin_store.py +4 -7
- chia/_tests/clvm/test_clvm_step.py +4 -4
- chia/_tests/clvm/test_puzzle_compression.py +2 -1
- chia/_tests/clvm/test_puzzle_drivers.py +2 -2
- chia/_tests/clvm/test_singletons.py +2 -4
- chia/_tests/clvm/test_spend_sim.py +2 -2
- chia/_tests/cmds/cmd_test_utils.py +27 -45
- chia/_tests/cmds/test_cmd_framework.py +6 -6
- chia/_tests/cmds/test_daemon.py +3 -3
- chia/_tests/cmds/test_show.py +4 -4
- chia/_tests/cmds/test_tx_config_args.py +1 -2
- chia/_tests/cmds/testing_classes.py +4 -5
- chia/_tests/cmds/wallet/test_did.py +24 -27
- chia/_tests/cmds/wallet/test_nft.py +12 -10
- chia/_tests/cmds/wallet/test_vcs.py +11 -12
- chia/_tests/cmds/wallet/test_wallet.py +134 -89
- chia/_tests/conftest.py +59 -30
- chia/_tests/connection_utils.py +2 -2
- chia/_tests/core/cmds/test_beta.py +4 -4
- chia/_tests/core/cmds/test_keys.py +2 -3
- chia/_tests/core/cmds/test_wallet.py +15 -15
- chia/_tests/core/consensus/test_pot_iterations.py +19 -73
- chia/_tests/core/custom_types/test_proof_of_space.py +124 -98
- chia/_tests/core/daemon/test_daemon.py +11 -11
- chia/_tests/core/data_layer/conftest.py +2 -2
- chia/_tests/core/data_layer/test_data_rpc.py +28 -14
- chia/_tests/core/data_layer/test_data_store.py +10 -10
- chia/_tests/core/data_layer/util.py +11 -11
- chia/_tests/core/farmer/test_farmer_api.py +2 -4
- chia/_tests/core/full_node/full_sync/test_full_sync.py +8 -7
- chia/_tests/core/full_node/stores/test_block_store.py +5 -4
- chia/_tests/core/full_node/stores/test_coin_store.py +5 -11
- chia/_tests/core/full_node/stores/test_full_node_store.py +8 -8
- chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
- chia/_tests/core/full_node/test_block_height_map.py +3 -4
- chia/_tests/core/full_node/test_conditions.py +21 -23
- chia/_tests/core/full_node/test_full_node.py +225 -62
- chia/_tests/core/full_node/test_hint_management.py +2 -4
- chia/_tests/core/full_node/test_performance.py +0 -1
- chia/_tests/core/full_node/test_prev_tx_block.py +88 -11
- chia/_tests/core/full_node/test_transactions.py +1 -2
- chia/_tests/core/full_node/test_tx_processing_queue.py +109 -25
- chia/_tests/core/mempool/test_mempool.py +29 -37
- chia/_tests/core/mempool/test_mempool_fee_estimator.py +39 -39
- chia/_tests/core/mempool/test_mempool_fee_protocol.py +2 -6
- chia/_tests/core/mempool/test_mempool_manager.py +963 -839
- chia/_tests/core/mempool/test_singleton_fast_forward.py +6 -6
- chia/_tests/core/server/serve.py +7 -7
- chia/_tests/core/server/test_dos.py +1 -2
- chia/_tests/core/server/test_event_loop.py +12 -4
- chia/_tests/core/server/test_loop.py +7 -8
- chia/_tests/core/server/test_rate_limits.py +9 -8
- chia/_tests/core/server/test_server.py +61 -1
- chia/_tests/core/services/test_services.py +2 -2
- chia/_tests/core/ssl/test_ssl.py +2 -2
- chia/_tests/core/test_cost_calculation.py +2 -6
- chia/_tests/core/test_farmer_harvester_rpc.py +3 -5
- chia/_tests/core/test_filter.py +0 -1
- chia/_tests/core/test_full_node_rpc.py +2 -2
- chia/_tests/core/test_merkle_set.py +1 -2
- chia/_tests/core/test_seeder.py +4 -4
- chia/_tests/core/util/test_config.py +4 -4
- chia/_tests/core/util/test_jsonify.py +2 -2
- chia/_tests/core/util/test_keychain.py +3 -3
- chia/_tests/core/util/test_lockfile.py +2 -1
- chia/_tests/core/util/test_log_exceptions.py +1 -2
- chia/_tests/core/util/test_streamable.py +17 -17
- chia/_tests/db/test_db_wrapper.py +3 -2
- chia/_tests/environments/wallet.py +14 -14
- chia/_tests/ether.py +4 -3
- chia/_tests/farmer_harvester/test_farmer.py +41 -24
- chia/_tests/farmer_harvester/test_farmer_harvester.py +50 -17
- chia/_tests/farmer_harvester/test_filter_prefix_bits.py +27 -27
- chia/_tests/farmer_harvester/test_third_party_harvesters.py +21 -22
- chia/_tests/fee_estimation/test_fee_estimation_integration.py +18 -18
- chia/_tests/fee_estimation/test_fee_estimation_rpc.py +11 -9
- chia/_tests/harvester/test_harvester_api.py +11 -4
- chia/_tests/plot_sync/test_plot_sync.py +13 -11
- chia/_tests/plot_sync/test_receiver.py +11 -10
- chia/_tests/plot_sync/test_sync_simulated.py +2 -2
- chia/_tests/plot_sync/util.py +1 -2
- chia/_tests/plotting/test_plot_manager.py +7 -6
- chia/_tests/plotting/test_prover.py +30 -38
- chia/_tests/pools/test_pool_cmdline.py +4 -6
- chia/_tests/pools/test_pool_rpc.py +203 -61
- chia/_tests/pools/test_pool_wallet.py +3 -3
- chia/_tests/pools/test_wallet_pool_store.py +1 -4
- chia/_tests/process_junit.py +2 -2
- chia/_tests/rpc/test_rpc_client.py +4 -4
- chia/_tests/rpc/test_rpc_server.py +3 -3
- chia/_tests/simulation/test_simulation.py +12 -25
- chia/_tests/solver/test_solver_service.py +13 -4
- chia/_tests/testconfig.py +2 -2
- chia/_tests/timelord/test_new_peak.py +22 -11
- chia/_tests/tools/test_run_block.py +0 -2
- chia/_tests/tools/test_virtual_project.py +2 -1
- chia/_tests/util/benchmarks.py +1 -0
- chia/_tests/util/blockchain.py +38 -36
- chia/_tests/util/blockchain_mock.py +11 -11
- chia/_tests/util/build_network_protocol_files.py +2 -1
- chia/_tests/util/coin_store.py +2 -1
- chia/_tests/util/config.py +1 -1
- chia/_tests/util/db_connection.py +2 -3
- chia/_tests/util/full_sync.py +9 -11
- chia/_tests/util/gen_ssl_certs.py +4 -5
- chia/_tests/util/get_name_puzzle_conditions.py +2 -0
- chia/_tests/util/misc.py +24 -24
- chia/_tests/util/network_protocol_data.py +20 -3
- chia/_tests/util/protocol_messages_bytes-v1.0 +0 -0
- chia/_tests/util/protocol_messages_json.py +292 -3
- chia/_tests/util/setup_nodes.py +62 -47
- chia/_tests/util/spend_sim.py +57 -57
- chia/_tests/util/test_async_pool.py +2 -3
- chia/_tests/util/test_chia_version.py +1 -3
- chia/_tests/util/test_config.py +3 -3
- chia/_tests/util/test_full_block_utils.py +6 -3
- chia/_tests/util/test_limited_semaphore.py +1 -2
- chia/_tests/util/test_misc.py +2 -2
- chia/_tests/util/test_network.py +1 -2
- chia/_tests/util/test_priority_mutex.py +3 -3
- chia/_tests/util/test_recursive_replace.py +5 -6
- chia/_tests/util/test_replace_str_to_bytes.py +8 -10
- chia/_tests/util/test_testnet_overrides.py +3 -3
- chia/_tests/util/time_out_assert.py +2 -2
- chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +4 -6
- chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +2 -4
- chia/_tests/wallet/cat_wallet/test_cat_wallet.py +19 -13
- chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +13 -13
- chia/_tests/wallet/cat_wallet/test_trades.py +40 -38
- chia/_tests/wallet/clawback/test_clawback_lifecycle.py +2 -4
- chia/_tests/wallet/conftest.py +6 -6
- chia/_tests/wallet/db_wallet/test_db_graftroot.py +1 -1
- chia/_tests/wallet/db_wallet/test_dl_offers.py +34 -34
- chia/_tests/wallet/did_wallet/test_did.py +16 -6
- chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +21 -21
- chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +20 -6
- chia/_tests/wallet/nft_wallet/test_nft_offers.py +19 -21
- chia/_tests/wallet/nft_wallet/test_nft_puzzles.py +1 -2
- chia/_tests/wallet/nft_wallet/test_nft_wallet.py +121 -2
- chia/_tests/wallet/nft_wallet/test_ownership_outer_puzzle.py +6 -9
- chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +44 -1
- chia/_tests/wallet/rpc/test_wallet_rpc.py +1672 -896
- chia/_tests/wallet/sync/test_wallet_sync.py +43 -47
- chia/_tests/wallet/test_clvm_streamable.py +2 -3
- chia/_tests/wallet/test_coin_management.py +2 -2
- chia/_tests/wallet/test_conditions.py +45 -51
- chia/_tests/wallet/test_debug_spend_bundle.py +2 -2
- chia/_tests/wallet/test_new_wallet_protocol.py +4 -6
- chia/_tests/wallet/test_notifications.py +14 -14
- chia/_tests/wallet/test_signer_protocol.py +5 -5
- chia/_tests/wallet/test_singleton_lifecycle_fast.py +4 -3
- chia/_tests/wallet/test_transaction_store.py +20 -20
- chia/_tests/wallet/test_util.py +2 -2
- chia/_tests/wallet/test_wallet.py +380 -228
- chia/_tests/wallet/test_wallet_action_scope.py +4 -4
- chia/_tests/wallet/test_wallet_blockchain.py +12 -12
- chia/_tests/wallet/test_wallet_coin_store.py +3 -4
- chia/_tests/wallet/test_wallet_node.py +14 -14
- chia/_tests/wallet/test_wallet_test_framework.py +2 -1
- chia/_tests/wallet/test_wallet_utils.py +2 -3
- chia/_tests/wallet/vc_wallet/test_cr_outer_puzzle.py +3 -5
- chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +14 -15
- chia/_tests/wallet/vc_wallet/test_vc_wallet.py +29 -24
- chia/_tests/wallet/wallet_block_tools.py +12 -11
- chia/_tests/weight_proof/config.py +1 -0
- chia/_tests/weight_proof/test_weight_proof.py +5 -4
- chia/apis/__init__.py +21 -0
- chia/apis/farmer_stub.py +102 -0
- chia/apis/full_node_stub.py +372 -0
- chia/apis/harvester_stub.py +57 -0
- chia/apis/introducer_stub.py +35 -0
- chia/apis/solver_stub.py +30 -0
- chia/apis/stub_protocol_registry.py +21 -0
- chia/apis/timelord_stub.py +39 -0
- chia/apis/wallet_stub.py +161 -0
- chia/cmds/beta.py +3 -4
- chia/cmds/beta_funcs.py +4 -3
- chia/cmds/check_wallet_db.py +4 -4
- chia/cmds/chia.py +1 -2
- chia/cmds/cmd_classes.py +11 -13
- chia/cmds/cmd_helpers.py +11 -11
- chia/cmds/cmds_util.py +15 -15
- chia/cmds/coin_funcs.py +6 -7
- chia/cmds/coins.py +2 -3
- chia/cmds/configure.py +1 -2
- chia/cmds/data.py +42 -42
- chia/cmds/data_funcs.py +81 -81
- chia/cmds/db.py +4 -5
- chia/cmds/db_backup_func.py +2 -2
- chia/cmds/db_upgrade_func.py +3 -3
- chia/cmds/db_validate_func.py +2 -2
- chia/cmds/dev/data.py +4 -4
- chia/cmds/dev/gh.py +5 -5
- chia/cmds/dev/installers.py +2 -3
- chia/cmds/dev/mempool.py +3 -4
- chia/cmds/dev/mempool_funcs.py +4 -4
- chia/cmds/dev/sim.py +8 -8
- chia/cmds/dump_keyring.py +3 -3
- chia/cmds/farm.py +6 -8
- chia/cmds/farm_funcs.py +25 -24
- chia/cmds/init_funcs.py +4 -4
- chia/cmds/keys.py +16 -18
- chia/cmds/keys_funcs.py +36 -36
- chia/cmds/netspace.py +1 -3
- chia/cmds/netspace_funcs.py +1 -2
- chia/cmds/options.py +3 -2
- chia/cmds/param_types.py +17 -16
- chia/cmds/passphrase.py +6 -7
- chia/cmds/passphrase_funcs.py +11 -13
- chia/cmds/peer.py +1 -3
- chia/cmds/peer_funcs.py +3 -3
- chia/cmds/plotnft.py +6 -7
- chia/cmds/plotnft_funcs.py +37 -26
- chia/cmds/rpc.py +3 -3
- chia/cmds/show.py +3 -5
- chia/cmds/show_funcs.py +9 -9
- chia/cmds/sim_funcs.py +25 -26
- chia/cmds/solver.py +1 -3
- chia/cmds/solver_funcs.py +1 -2
- chia/cmds/start_funcs.py +2 -2
- chia/cmds/wallet.py +76 -81
- chia/cmds/wallet_funcs.py +206 -177
- chia/consensus/augmented_chain.py +6 -6
- chia/consensus/block_body_validation.py +19 -15
- chia/consensus/block_creation.py +25 -21
- chia/consensus/block_header_validation.py +27 -13
- chia/consensus/block_height_map.py +3 -6
- chia/consensus/block_height_map_protocol.py +2 -2
- chia/consensus/block_record.py +2 -4
- chia/consensus/blockchain.py +58 -40
- chia/consensus/blockchain_interface.py +7 -7
- chia/consensus/coin_store_protocol.py +5 -6
- chia/consensus/condition_tools.py +4 -4
- chia/consensus/cost_calculator.py +2 -3
- chia/consensus/default_constants.py +16 -13
- chia/consensus/deficit.py +1 -3
- chia/consensus/difficulty_adjustment.py +3 -5
- chia/consensus/find_fork_point.py +2 -4
- chia/consensus/full_block_to_block_record.py +11 -13
- chia/consensus/generator_tools.py +2 -3
- chia/consensus/get_block_challenge.py +42 -26
- chia/consensus/get_block_generator.py +2 -3
- chia/consensus/make_sub_epoch_summary.py +8 -7
- chia/consensus/multiprocess_validation.py +31 -20
- chia/consensus/pos_quality.py +6 -23
- chia/consensus/pot_iterations.py +17 -44
- chia/consensus/signage_point.py +4 -5
- chia/consensus/vdf_info_computation.py +2 -4
- chia/daemon/client.py +8 -8
- chia/daemon/keychain_proxy.py +31 -37
- chia/daemon/server.py +32 -33
- chia/daemon/windows_signal.py +4 -3
- chia/data_layer/data_layer.py +86 -77
- chia/data_layer/data_layer_rpc_api.py +9 -9
- chia/data_layer/data_layer_rpc_client.py +13 -15
- chia/data_layer/data_layer_server.py +3 -3
- chia/data_layer/data_layer_util.py +14 -14
- chia/data_layer/data_layer_wallet.py +94 -101
- chia/data_layer/data_store.py +50 -50
- chia/data_layer/dl_wallet_store.py +9 -12
- chia/data_layer/download_data.py +8 -9
- chia/data_layer/s3_plugin_service.py +5 -9
- chia/data_layer/start_data_layer.py +5 -5
- chia/farmer/farmer.py +31 -31
- chia/farmer/farmer_api.py +45 -33
- chia/farmer/farmer_rpc_api.py +5 -4
- chia/farmer/farmer_rpc_client.py +6 -6
- chia/farmer/start_farmer.py +6 -6
- chia/full_node/block_store.py +13 -16
- chia/full_node/check_fork_next_block.py +1 -2
- chia/full_node/coin_store.py +15 -16
- chia/full_node/eligible_coin_spends.py +3 -3
- chia/full_node/fee_estimate_store.py +2 -3
- chia/full_node/fee_tracker.py +1 -2
- chia/full_node/full_block_utils.py +4 -4
- chia/full_node/full_node.py +238 -224
- chia/full_node/full_node_api.py +193 -150
- chia/full_node/full_node_rpc_api.py +53 -31
- chia/full_node/full_node_rpc_client.py +18 -19
- chia/full_node/full_node_store.py +45 -43
- chia/full_node/hint_management.py +2 -2
- chia/full_node/mempool.py +17 -19
- chia/full_node/mempool_manager.py +89 -42
- chia/full_node/pending_tx_cache.py +2 -3
- chia/full_node/start_full_node.py +5 -5
- chia/full_node/sync_store.py +3 -4
- chia/full_node/tx_processing_queue.py +34 -13
- chia/full_node/weight_proof.py +61 -48
- chia/harvester/harvester.py +25 -24
- chia/harvester/harvester_api.py +61 -38
- chia/harvester/harvester_rpc_api.py +10 -10
- chia/harvester/start_harvester.py +4 -4
- chia/introducer/introducer.py +3 -3
- chia/introducer/introducer_api.py +6 -4
- chia/introducer/start_introducer.py +4 -4
- chia/legacy/keyring.py +3 -3
- chia/plot_sync/delta.py +1 -2
- chia/plot_sync/receiver.py +20 -17
- chia/plot_sync/sender.py +15 -10
- chia/plotters/bladebit.py +7 -7
- chia/plotters/chiapos.py +2 -2
- chia/plotters/madmax.py +4 -4
- chia/plotters/plotters.py +4 -4
- chia/plotters/plotters_util.py +3 -3
- chia/plotting/cache.py +20 -14
- chia/plotting/check_plots.py +26 -35
- chia/plotting/create_plots.py +22 -23
- chia/plotting/manager.py +21 -14
- chia/plotting/prover.py +59 -42
- chia/plotting/util.py +16 -16
- chia/pools/pool_config.py +2 -1
- chia/pools/pool_puzzles.py +11 -12
- chia/pools/pool_wallet.py +34 -57
- chia/pools/pool_wallet_info.py +39 -10
- chia/protocols/farmer_protocol.py +8 -9
- chia/protocols/fee_estimate.py +3 -4
- chia/protocols/full_node_protocol.py +3 -4
- chia/protocols/harvester_protocol.py +27 -15
- chia/protocols/outbound_message.py +3 -3
- chia/protocols/pool_protocol.py +8 -9
- chia/protocols/shared_protocol.py +1 -2
- chia/protocols/solver_protocol.py +9 -2
- chia/protocols/timelord_protocol.py +4 -7
- chia/protocols/wallet_protocol.py +11 -12
- chia/rpc/rpc_client.py +9 -9
- chia/rpc/rpc_server.py +17 -17
- chia/rpc/util.py +2 -2
- chia/seeder/crawler.py +8 -8
- chia/seeder/crawler_api.py +21 -27
- chia/seeder/crawler_rpc_api.py +2 -2
- chia/seeder/dns_server.py +21 -21
- chia/seeder/start_crawler.py +4 -4
- chia/server/address_manager.py +15 -16
- chia/server/api_protocol.py +11 -11
- chia/server/chia_policy.py +46 -26
- chia/server/introducer_peers.py +2 -3
- chia/server/node_discovery.py +19 -19
- chia/server/rate_limit_numbers.py +4 -5
- chia/server/rate_limits.py +4 -4
- chia/server/resolve_peer_info.py +4 -4
- chia/server/server.py +49 -52
- chia/server/signal_handlers.py +6 -6
- chia/server/start_service.py +17 -17
- chia/server/upnp.py +4 -6
- chia/server/ws_connection.py +52 -37
- chia/simulator/add_blocks_in_batches.py +1 -3
- chia/simulator/block_tools.py +312 -200
- chia/simulator/full_node_simulator.py +56 -35
- chia/simulator/keyring.py +2 -3
- chia/simulator/setup_services.py +15 -15
- chia/simulator/simulator_full_node_rpc_api.py +1 -2
- chia/simulator/simulator_full_node_rpc_client.py +1 -2
- chia/simulator/simulator_protocol.py +1 -2
- chia/simulator/simulator_test_tools.py +3 -3
- chia/simulator/start_simulator.py +7 -7
- chia/simulator/wallet_tools.py +10 -10
- chia/solver/solver.py +10 -10
- chia/solver/solver_api.py +10 -8
- chia/solver/solver_rpc_api.py +2 -2
- chia/solver/start_solver.py +4 -4
- chia/ssl/cacert.pem +148 -90
- chia/ssl/chia_ca.crt +14 -10
- chia/ssl/chia_ca_old.crt +19 -0
- chia/ssl/create_ssl.py +4 -4
- chia/ssl/renewedselfsignedca.conf +4 -0
- chia/ssl/ssl_check.py +1 -2
- chia/timelord/iters_from_block.py +1 -4
- chia/timelord/start_timelord.py +4 -4
- chia/timelord/timelord.py +44 -40
- chia/timelord/timelord_api.py +6 -4
- chia/timelord/timelord_launcher.py +2 -2
- chia/timelord/timelord_rpc_api.py +2 -2
- chia/timelord/timelord_state.py +11 -12
- chia/types/block_protocol.py +1 -3
- chia/types/blockchain_format/coin.py +1 -3
- chia/types/blockchain_format/program.py +11 -8
- chia/types/blockchain_format/proof_of_space.py +123 -76
- chia/types/blockchain_format/tree_hash.py +3 -3
- chia/types/blockchain_format/vdf.py +1 -2
- chia/types/coin_spend.py +3 -3
- chia/types/mempool_item.py +5 -5
- chia/types/mempool_submission_status.py +2 -3
- chia/types/peer_info.py +1 -2
- chia/types/unfinished_header_block.py +3 -4
- chia/types/validation_state.py +1 -2
- chia/util/action_scope.py +8 -8
- chia/util/async_pool.py +5 -5
- chia/util/bech32m.py +1 -2
- chia/util/beta_metrics.py +2 -2
- chia/util/block_cache.py +4 -4
- chia/util/chia_logging.py +2 -2
- chia/util/chia_version.py +1 -2
- chia/util/config.py +15 -16
- chia/util/db_wrapper.py +26 -27
- chia/util/default_root.py +1 -2
- chia/util/errors.py +3 -3
- chia/util/file_keyring.py +14 -14
- chia/util/files.py +2 -3
- chia/util/hash.py +4 -4
- chia/util/initial-config.yaml +3 -5
- chia/util/inline_executor.py +2 -1
- chia/util/ip_address.py +1 -2
- chia/util/keychain.py +25 -27
- chia/util/keyring_wrapper.py +18 -19
- chia/util/lock.py +3 -4
- chia/util/log_exceptions.py +1 -2
- chia/util/lru_cache.py +2 -2
- chia/util/network.py +6 -6
- chia/util/path.py +2 -3
- chia/util/priority_mutex.py +2 -2
- chia/util/profiler.py +1 -2
- chia/util/safe_cancel_task.py +1 -2
- chia/util/streamable.py +22 -8
- chia/util/task_referencer.py +1 -1
- chia/util/timing.py +3 -3
- chia/util/virtual_project_analysis.py +6 -5
- chia/util/ws_message.py +2 -2
- chia/wallet/cat_wallet/cat_info.py +3 -4
- chia/wallet/cat_wallet/cat_outer_puzzle.py +12 -11
- chia/wallet/cat_wallet/cat_utils.py +3 -4
- chia/wallet/cat_wallet/cat_wallet.py +61 -83
- chia/wallet/cat_wallet/lineage_store.py +3 -4
- chia/wallet/cat_wallet/r_cat_wallet.py +19 -22
- chia/wallet/coin_selection.py +9 -10
- chia/wallet/conditions.py +120 -105
- chia/wallet/db_wallet/db_wallet_puzzles.py +4 -5
- chia/wallet/derivation_record.py +1 -2
- chia/wallet/derive_keys.py +2 -4
- chia/wallet/did_wallet/did_info.py +10 -11
- chia/wallet/did_wallet/did_wallet.py +36 -82
- chia/wallet/did_wallet/did_wallet_puzzles.py +7 -8
- chia/wallet/driver_protocol.py +5 -7
- chia/wallet/lineage_proof.py +4 -4
- chia/wallet/nft_wallet/metadata_outer_puzzle.py +11 -11
- chia/wallet/nft_wallet/nft_info.py +8 -9
- chia/wallet/nft_wallet/nft_puzzle_utils.py +8 -8
- chia/wallet/nft_wallet/nft_wallet.py +79 -116
- chia/wallet/nft_wallet/ownership_outer_puzzle.py +14 -14
- chia/wallet/nft_wallet/singleton_outer_puzzle.py +12 -11
- chia/wallet/nft_wallet/transfer_program_puzzle.py +11 -11
- chia/wallet/nft_wallet/uncurry_nft.py +10 -11
- chia/wallet/notification_manager.py +3 -3
- chia/wallet/notification_store.py +44 -61
- chia/wallet/outer_puzzles.py +6 -7
- chia/wallet/puzzle_drivers.py +34 -6
- chia/wallet/puzzles/clawback/drivers.py +6 -6
- chia/wallet/puzzles/deployed_puzzle_hashes.json +1 -54
- chia/wallet/puzzles/load_clvm.py +1 -1
- chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +1 -2
- chia/wallet/puzzles/singleton_top_layer.py +2 -3
- chia/wallet/puzzles/singleton_top_layer_v1_1.py +3 -4
- chia/wallet/puzzles/tails.py +3 -3
- chia/wallet/singleton.py +5 -7
- chia/wallet/singleton_record.py +3 -3
- chia/wallet/start_wallet.py +5 -5
- chia/wallet/trade_manager.py +37 -58
- chia/wallet/trade_record.py +4 -4
- chia/wallet/trading/offer.py +59 -46
- chia/wallet/trading/trade_store.py +8 -9
- chia/wallet/transaction_record.py +8 -8
- chia/wallet/uncurried_puzzle.py +1 -2
- chia/wallet/util/clvm_streamable.py +12 -12
- chia/wallet/util/compute_hints.py +4 -5
- chia/wallet/util/curry_and_treehash.py +1 -2
- chia/wallet/util/merkle_tree.py +2 -3
- chia/wallet/util/peer_request_cache.py +8 -8
- chia/wallet/util/signing.py +85 -0
- chia/wallet/util/tx_config.py +15 -6
- chia/wallet/util/wallet_sync_utils.py +14 -16
- chia/wallet/util/wallet_types.py +2 -2
- chia/wallet/vc_wallet/cr_cat_drivers.py +10 -11
- chia/wallet/vc_wallet/cr_cat_wallet.py +50 -68
- chia/wallet/vc_wallet/cr_outer_puzzle.py +14 -13
- chia/wallet/vc_wallet/vc_drivers.py +27 -27
- chia/wallet/vc_wallet/vc_store.py +5 -6
- chia/wallet/vc_wallet/vc_wallet.py +33 -61
- chia/wallet/wallet.py +50 -78
- chia/wallet/wallet_action_scope.py +11 -11
- chia/wallet/wallet_blockchain.py +12 -12
- chia/wallet/wallet_coin_record.py +12 -6
- chia/wallet/wallet_coin_store.py +24 -25
- chia/wallet/wallet_interested_store.py +3 -5
- chia/wallet/wallet_nft_store.py +10 -11
- chia/wallet/wallet_node.py +53 -61
- chia/wallet/wallet_node_api.py +5 -3
- chia/wallet/wallet_protocol.py +23 -23
- chia/wallet/wallet_puzzle_store.py +15 -18
- chia/wallet/wallet_request_types.py +778 -114
- chia/wallet/wallet_retry_store.py +1 -3
- chia/wallet/wallet_rpc_api.py +572 -909
- chia/wallet/wallet_rpc_client.py +87 -279
- chia/wallet/wallet_singleton_store.py +3 -4
- chia/wallet/wallet_state_manager.py +332 -106
- chia/wallet/wallet_transaction_store.py +11 -14
- chia/wallet/wallet_user_store.py +4 -6
- chia/wallet/wallet_weight_proof_handler.py +4 -4
- {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/METADATA +6 -5
- {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/RECORD +507 -516
- chia/apis.py +0 -21
- chia/consensus/check_time_locks.py +0 -57
- chia/data_layer/puzzles/__init__.py +0 -0
- chia/data_layer/puzzles/graftroot_dl_offers.clsp +0 -100
- chia/data_layer/puzzles/graftroot_dl_offers.clsp.hex +0 -1
- chia/types/coin_record.py +0 -44
- chia/wallet/nft_wallet/puzzles/__init__.py +0 -0
- chia/wallet/nft_wallet/puzzles/create_nft_launcher_from_did.clsp +0 -6
- chia/wallet/nft_wallet/puzzles/create_nft_launcher_from_did.clsp.hex +0 -1
- chia/wallet/nft_wallet/puzzles/nft_intermediate_launcher.clsp +0 -6
- chia/wallet/nft_wallet/puzzles/nft_intermediate_launcher.clsp.hex +0 -1
- chia/wallet/nft_wallet/puzzles/nft_metadata_updater_default.clsp +0 -30
- chia/wallet/nft_wallet/puzzles/nft_metadata_updater_default.clsp.hex +0 -1
- chia/wallet/nft_wallet/puzzles/nft_metadata_updater_updateable.clsp +0 -28
- chia/wallet/nft_wallet/puzzles/nft_metadata_updater_updateable.clsp.hex +0 -1
- chia/wallet/nft_wallet/puzzles/nft_ownership_layer.clsp +0 -100
- chia/wallet/nft_wallet/puzzles/nft_ownership_layer.clsp.hex +0 -1
- chia/wallet/nft_wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp +0 -78
- chia/wallet/nft_wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clsp.hex +0 -1
- chia/wallet/nft_wallet/puzzles/nft_state_layer.clsp +0 -74
- chia/wallet/nft_wallet/puzzles/nft_state_layer.clsp.hex +0 -1
- {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/entry_points.txt +0 -0
- {chia_blockchain-2.5.7rc4.dist-info → chia_blockchain-2.5.8rc1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import cast
|
|
5
5
|
|
|
6
6
|
from bitstring import BitArray
|
|
7
|
-
from chia_rs import AugSchemeMPL, ConsensusConstants, G1Element,
|
|
7
|
+
from chia_rs import AugSchemeMPL, ConsensusConstants, G1Element, PlotParam, PrivateKey, ProofOfSpace, validate_proof_v2
|
|
8
8
|
from chia_rs.sized_bytes import bytes32
|
|
9
9
|
from chia_rs.sized_ints import uint8, uint32
|
|
10
10
|
from chiapos import Verifier
|
|
@@ -13,44 +13,23 @@ from chia.util.hash import std_hash
|
|
|
13
13
|
|
|
14
14
|
log = logging.getLogger(__name__)
|
|
15
15
|
|
|
16
|
-
# These are temporary stubs for chiapos2, that we build against until it's ready to be integrated.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
# returns quality string for v2 plot, or None if invalid
|
|
20
|
-
def validate_proof_v2(
|
|
21
|
-
plot_id: bytes32, size: uint8, required_plot_strength: uint8, challenge: bytes32, proof: bytes
|
|
22
|
-
) -> Optional[bytes32]:
|
|
23
|
-
# TODO: todo_v2_plots call into new chiapos library
|
|
24
|
-
raise NotImplementedError
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# this is compute intensive, solving a partial proof returning a full proof
|
|
28
|
-
def solve_proof(partial_proof: bytes) -> bytes:
|
|
29
|
-
# TODO: todo_v2_plots call into new chiapos library
|
|
30
|
-
raise NotImplementedError
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
# given a partial proof, computes the quality. This is used to compute required iters.
|
|
34
|
-
def quality_for_partial_proof(partial_proof: bytes, challenge: bytes32) -> bytes32:
|
|
35
|
-
# TODO: todo_v2_plots call into new chiapos library
|
|
36
|
-
return std_hash(partial_proof + challenge)
|
|
37
|
-
|
|
38
16
|
|
|
39
17
|
def make_pos(
|
|
40
18
|
challenge: bytes32,
|
|
41
|
-
pool_public_key:
|
|
42
|
-
pool_contract_puzzle_hash:
|
|
19
|
+
pool_public_key: G1Element | None,
|
|
20
|
+
pool_contract_puzzle_hash: bytes32 | None,
|
|
43
21
|
plot_public_key: G1Element,
|
|
44
|
-
version_and_size:
|
|
22
|
+
version_and_size: PlotParam,
|
|
45
23
|
proof: bytes,
|
|
46
24
|
) -> ProofOfSpace:
|
|
47
25
|
k: int
|
|
48
26
|
if version_and_size.size_v1 is not None:
|
|
49
27
|
k = version_and_size.size_v1
|
|
50
28
|
else:
|
|
51
|
-
assert version_and_size.
|
|
52
|
-
k = version_and_size.
|
|
29
|
+
assert version_and_size.strength_v2 is not None
|
|
30
|
+
k = version_and_size.strength_v2
|
|
53
31
|
assert k is not None
|
|
32
|
+
assert k <= 0x3F
|
|
54
33
|
k |= 0x80
|
|
55
34
|
|
|
56
35
|
return ProofOfSpace(
|
|
@@ -64,6 +43,11 @@ def make_pos(
|
|
|
64
43
|
|
|
65
44
|
|
|
66
45
|
def get_plot_id(pos: ProofOfSpace) -> bytes32:
|
|
46
|
+
plot_param = pos.param()
|
|
47
|
+
if plot_param.strength_v2 is not None:
|
|
48
|
+
assert pos.pool_contract_puzzle_hash is not None
|
|
49
|
+
return calculate_plot_id_v2(pos.pool_contract_puzzle_hash, pos.plot_public_key, uint8(plot_param.strength_v2))
|
|
50
|
+
|
|
67
51
|
assert pos.pool_public_key is None or pos.pool_contract_puzzle_hash is None
|
|
68
52
|
if pos.pool_public_key is None:
|
|
69
53
|
assert pos.pool_contract_puzzle_hash is not None
|
|
@@ -71,32 +55,74 @@ def get_plot_id(pos: ProofOfSpace) -> bytes32:
|
|
|
71
55
|
return calculate_plot_id_pk(pos.pool_public_key, pos.plot_public_key)
|
|
72
56
|
|
|
73
57
|
|
|
74
|
-
def
|
|
58
|
+
def check_plot_param(constants: ConsensusConstants, ps: PlotParam) -> bool:
|
|
75
59
|
size_v1 = ps.size_v1
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if
|
|
79
|
-
log.error("Plot
|
|
60
|
+
strength_v2 = ps.strength_v2
|
|
61
|
+
if strength_v2 is not None:
|
|
62
|
+
if strength_v2 < constants.MIN_PLOT_STRENGTH:
|
|
63
|
+
log.error(f"Plot strength ({strength_v2}) is lower than the minimum ({constants.MIN_PLOT_STRENGTH})")
|
|
80
64
|
return False
|
|
81
|
-
if
|
|
82
|
-
log.error("Plot
|
|
65
|
+
if strength_v2 > constants.MAX_PLOT_STRENGTH:
|
|
66
|
+
log.error(f"Plot strength ({strength_v2}) is too high (max is {constants.MAX_PLOT_STRENGTH})")
|
|
83
67
|
return False
|
|
84
68
|
return True
|
|
85
69
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
log.error("Plot size is lower than the minimum")
|
|
90
|
-
return False
|
|
91
|
-
if size_v2 > constants.MAX_PLOT_SIZE_V2:
|
|
92
|
-
log.error("Plot size is higher than the maximum")
|
|
70
|
+
assert size_v1 is not None
|
|
71
|
+
if size_v1 < constants.MIN_PLOT_SIZE_V1:
|
|
72
|
+
log.error(f"Plot size ({size_v1}) is lower than the minimum ({constants.MIN_PLOT_SIZE_V1})")
|
|
93
73
|
return False
|
|
94
|
-
if
|
|
95
|
-
log.error("Plot size is
|
|
74
|
+
if size_v1 > constants.MAX_PLOT_SIZE_V1:
|
|
75
|
+
log.error(f"Plot size ({size_v1}) is higher than the maximum ({constants.MAX_PLOT_SIZE_V1})")
|
|
96
76
|
return False
|
|
97
77
|
return True
|
|
98
78
|
|
|
99
79
|
|
|
80
|
+
def num_phase_out_epochs(constants: ConsensusConstants) -> int:
|
|
81
|
+
"""
|
|
82
|
+
The number of phase-out epochs is always a power-of-two minus 1. i.e. it
|
|
83
|
+
will also be a mask for the hash of the proof we're checking for phase-out.
|
|
84
|
+
Since the hash of the proof are random bits, the simplest check is just to
|
|
85
|
+
mask and compare the resulting value against the phase-out count down.
|
|
86
|
+
"""
|
|
87
|
+
return (1 << constants.PLOT_V1_PHASE_OUT_EPOCH_BITS) - 1
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def v1_cut_off_height(constants: ConsensusConstants) -> int:
|
|
91
|
+
"""
|
|
92
|
+
returns the height where v1 proofs-of-space are no longer valid. Blocks
|
|
93
|
+
whose previous transaction block is equal to or higher than this may not have a
|
|
94
|
+
v1 proof.
|
|
95
|
+
"""
|
|
96
|
+
return constants.HARD_FORK2_HEIGHT + num_phase_out_epochs(constants) * constants.EPOCH_BLOCKS
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def is_v1_phased_out(
|
|
100
|
+
proof: bytes,
|
|
101
|
+
prev_transaction_block_height: uint32, # this is the height of the last tx block before the current block SP
|
|
102
|
+
constants: ConsensusConstants,
|
|
103
|
+
) -> bool:
|
|
104
|
+
if prev_transaction_block_height < constants.HARD_FORK2_HEIGHT:
|
|
105
|
+
return False
|
|
106
|
+
|
|
107
|
+
# This is a v1 plot and the phase-out period has started
|
|
108
|
+
# The probability of having been phased out is proportional on the
|
|
109
|
+
# number of epochs since hard fork activation
|
|
110
|
+
phase_out_epoch_mask = num_phase_out_epochs(constants)
|
|
111
|
+
|
|
112
|
+
# we just look at one byte so the mask can't be bigger than that
|
|
113
|
+
assert phase_out_epoch_mask < 256
|
|
114
|
+
|
|
115
|
+
# this counter is counting down to zero
|
|
116
|
+
epoch_counter = (v1_cut_off_height(constants) - prev_transaction_block_height) // constants.EPOCH_BLOCKS
|
|
117
|
+
|
|
118
|
+
# if we're past the phase-out, v1 plots are unconditionally invalid
|
|
119
|
+
if epoch_counter < 0:
|
|
120
|
+
return True
|
|
121
|
+
|
|
122
|
+
proof_value = std_hash(proof + b"chia proof-of-space v1 phase-out")[0] & phase_out_epoch_mask
|
|
123
|
+
return proof_value >= epoch_counter
|
|
124
|
+
|
|
125
|
+
|
|
100
126
|
def verify_and_get_quality_string(
|
|
101
127
|
pos: ProofOfSpace,
|
|
102
128
|
constants: ConsensusConstants,
|
|
@@ -104,8 +130,25 @@ def verify_and_get_quality_string(
|
|
|
104
130
|
signage_point: bytes32,
|
|
105
131
|
*,
|
|
106
132
|
height: uint32,
|
|
107
|
-
|
|
133
|
+
prev_transaction_block_height: uint32, # this is the height of the last tx block before the current block SP
|
|
134
|
+
height_agnostic: bool = False,
|
|
135
|
+
) -> bytes32 | None:
|
|
136
|
+
plot_param = pos.param()
|
|
137
|
+
|
|
138
|
+
if not height_agnostic:
|
|
139
|
+
if plot_param.size_v1 is not None and is_v1_phased_out(pos.proof, prev_transaction_block_height, constants):
|
|
140
|
+
log.info("v1 proof has been phased-out and is no longer valid")
|
|
141
|
+
return None
|
|
142
|
+
|
|
143
|
+
if plot_param.strength_v2 is not None and prev_transaction_block_height < constants.HARD_FORK2_HEIGHT:
|
|
144
|
+
log.info("v2 proof support has not yet activated")
|
|
145
|
+
return None
|
|
146
|
+
|
|
108
147
|
# Exactly one of (pool_public_key, pool_contract_puzzle_hash) must not be None
|
|
148
|
+
# Except v2 plots, they only support pool contract puzzle hash
|
|
149
|
+
if plot_param.strength_v2 is not None and pos.pool_contract_puzzle_hash is None:
|
|
150
|
+
log.error("v2 plots require pool_contract_puzzle_hash, pool public key is not supported")
|
|
151
|
+
return None
|
|
109
152
|
if (pos.pool_public_key is None) and (pos.pool_contract_puzzle_hash is None):
|
|
110
153
|
log.error("Expected pool public key or pool contract puzzle hash but got neither")
|
|
111
154
|
return None
|
|
@@ -113,37 +156,42 @@ def verify_and_get_quality_string(
|
|
|
113
156
|
log.error("Expected pool public key or pool contract puzzle hash but got both")
|
|
114
157
|
return None
|
|
115
158
|
|
|
116
|
-
|
|
117
|
-
if not check_plot_size(constants, plot_size):
|
|
159
|
+
if not check_plot_param(constants, plot_param):
|
|
118
160
|
return None
|
|
119
161
|
|
|
120
162
|
plot_id: bytes32 = get_plot_id(pos)
|
|
121
163
|
new_challenge: bytes32 = calculate_pos_challenge(plot_id, original_challenge_hash, signage_point)
|
|
122
164
|
|
|
123
165
|
if new_challenge != pos.challenge:
|
|
124
|
-
log.error("Calculated pos challenge doesn't match the provided one")
|
|
166
|
+
log.error(f"Calculated pos challenge doesn't match the provided one {new_challenge}")
|
|
125
167
|
return None
|
|
126
168
|
|
|
127
169
|
# we use different plot filter prefix sizes depending on v1 or v2 plots
|
|
128
|
-
prefix_bits = calculate_prefix_bits(constants, height,
|
|
170
|
+
prefix_bits = calculate_prefix_bits(constants, height, plot_param)
|
|
129
171
|
if not passes_plot_filter(prefix_bits, plot_id, original_challenge_hash, signage_point):
|
|
130
|
-
log.error("Did not pass the plot filter")
|
|
172
|
+
log.error(f"Did not pass the plot filter. prefix bits: {prefix_bits} {'V1' if plot_param.size_v1 else 'V2'}")
|
|
131
173
|
return None
|
|
132
174
|
|
|
133
|
-
if
|
|
175
|
+
if plot_param.size_v1 is not None:
|
|
134
176
|
# === V1 plots ===
|
|
135
|
-
assert
|
|
177
|
+
assert plot_param.strength_v2 is None
|
|
136
178
|
|
|
137
|
-
quality_str = Verifier().validate_proof(plot_id,
|
|
179
|
+
quality_str = Verifier().validate_proof(plot_id, plot_param.size_v1, pos.challenge, bytes(pos.proof))
|
|
138
180
|
if not quality_str:
|
|
139
181
|
return None
|
|
140
182
|
return bytes32(quality_str)
|
|
141
183
|
else:
|
|
142
184
|
# === V2 plots ===
|
|
143
|
-
assert
|
|
185
|
+
assert plot_param.strength_v2 is not None
|
|
144
186
|
|
|
145
|
-
|
|
146
|
-
|
|
187
|
+
return validate_proof_v2(
|
|
188
|
+
plot_id,
|
|
189
|
+
constants.PLOT_SIZE_V2,
|
|
190
|
+
pos.challenge,
|
|
191
|
+
plot_param.strength_v2,
|
|
192
|
+
constants.QUALITY_PROOF_SCAN_FILTER,
|
|
193
|
+
pos.proof,
|
|
194
|
+
)
|
|
147
195
|
|
|
148
196
|
|
|
149
197
|
def passes_plot_filter(
|
|
@@ -163,10 +211,16 @@ def passes_plot_filter(
|
|
|
163
211
|
return cast(bool, plot_filter[:prefix_bits].uint == 0)
|
|
164
212
|
|
|
165
213
|
|
|
166
|
-
def calculate_prefix_bits(constants: ConsensusConstants, height: uint32,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
214
|
+
def calculate_prefix_bits(constants: ConsensusConstants, height: uint32, plot_param: PlotParam) -> int:
|
|
215
|
+
if plot_param.strength_v2 is not None:
|
|
216
|
+
prefix_bits = int(constants.NUMBER_ZERO_BITS_PLOT_FILTER_V2)
|
|
217
|
+
if height >= constants.PLOT_FILTER_V2_THIRD_ADJUSTMENT_HEIGHT:
|
|
218
|
+
prefix_bits -= 3
|
|
219
|
+
elif height >= constants.PLOT_FILTER_V2_SECOND_ADJUSTMENT_HEIGHT:
|
|
220
|
+
prefix_bits -= 2
|
|
221
|
+
elif height >= constants.PLOT_FILTER_V2_FIRST_ADJUSTMENT_HEIGHT:
|
|
222
|
+
prefix_bits -= 1
|
|
223
|
+
return max(0, prefix_bits)
|
|
170
224
|
|
|
171
225
|
prefix_bits = int(constants.NUMBER_ZERO_BITS_PLOT_FILTER_V1)
|
|
172
226
|
if height >= constants.PLOT_FILTER_32_HEIGHT:
|
|
@@ -181,21 +235,6 @@ def calculate_prefix_bits(constants: ConsensusConstants, height: uint32, plot_si
|
|
|
181
235
|
return max(0, prefix_bits)
|
|
182
236
|
|
|
183
237
|
|
|
184
|
-
def calculate_required_plot_strength(constants: ConsensusConstants, height: uint32) -> uint8:
|
|
185
|
-
if height < constants.PLOT_STRENGTH_4_HEIGHT:
|
|
186
|
-
return constants.PLOT_STRENGTH_INITIAL
|
|
187
|
-
if height < constants.PLOT_STRENGTH_5_HEIGHT:
|
|
188
|
-
return uint8(4)
|
|
189
|
-
if height < constants.PLOT_STRENGTH_6_HEIGHT:
|
|
190
|
-
return uint8(5)
|
|
191
|
-
if height < constants.PLOT_STRENGTH_7_HEIGHT:
|
|
192
|
-
return uint8(6)
|
|
193
|
-
if height < constants.PLOT_STRENGTH_8_HEIGHT:
|
|
194
|
-
return uint8(7)
|
|
195
|
-
else:
|
|
196
|
-
return uint8(8)
|
|
197
|
-
|
|
198
|
-
|
|
199
238
|
def calculate_plot_filter_input(plot_id: bytes32, challenge_hash: bytes32, signage_point: bytes32) -> bytes32:
|
|
200
239
|
return std_hash(plot_id + challenge_hash + signage_point)
|
|
201
240
|
|
|
@@ -204,6 +243,14 @@ def calculate_pos_challenge(plot_id: bytes32, challenge_hash: bytes32, signage_p
|
|
|
204
243
|
return std_hash(calculate_plot_filter_input(plot_id, challenge_hash, signage_point))
|
|
205
244
|
|
|
206
245
|
|
|
246
|
+
def calculate_plot_id_v2(
|
|
247
|
+
pool_contract_puzzle_hash: bytes32,
|
|
248
|
+
plot_public_key: G1Element,
|
|
249
|
+
strength: uint8,
|
|
250
|
+
) -> bytes32:
|
|
251
|
+
return std_hash(bytes(pool_contract_puzzle_hash) + bytes(plot_public_key) + bytes(strength))
|
|
252
|
+
|
|
253
|
+
|
|
207
254
|
def calculate_plot_id_pk(
|
|
208
255
|
pool_public_key: G1Element,
|
|
209
256
|
plot_public_key: G1Element,
|
|
@@ -8,7 +8,7 @@ have to worry about blowing out the python stack.
|
|
|
8
8
|
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
|
-
from
|
|
11
|
+
from collections.abc import Callable
|
|
12
12
|
|
|
13
13
|
from chia_rs.sized_bytes import bytes32
|
|
14
14
|
from clvm.CLVMObject import CLVMStorage
|
|
@@ -16,13 +16,13 @@ from clvm.SExp import SExp
|
|
|
16
16
|
|
|
17
17
|
from chia.util.hash import std_hash
|
|
18
18
|
|
|
19
|
-
ValueType =
|
|
19
|
+
ValueType = bytes | CLVMStorage
|
|
20
20
|
ValueStackType = list[ValueType]
|
|
21
21
|
Op = Callable[[ValueStackType, "OpStackType", set[bytes32]], None]
|
|
22
22
|
OpStackType = list[Op]
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def sha256_treehash(sexp: CLVMStorage, precalculated:
|
|
25
|
+
def sha256_treehash(sexp: CLVMStorage, precalculated: set[bytes32] | None = None) -> bytes32:
|
|
26
26
|
"""
|
|
27
27
|
Hash values in `precalculated` are presumed to have been hashed already.
|
|
28
28
|
"""
|
|
@@ -4,7 +4,6 @@ import logging
|
|
|
4
4
|
import traceback
|
|
5
5
|
from enum import IntEnum
|
|
6
6
|
from functools import lru_cache
|
|
7
|
-
from typing import Optional
|
|
8
7
|
|
|
9
8
|
from chia_rs import ConsensusConstants, VDFInfo, VDFProof
|
|
10
9
|
from chia_rs.sized_bytes import bytes32, bytes100
|
|
@@ -51,7 +50,7 @@ def validate_vdf(
|
|
|
51
50
|
constants: ConsensusConstants,
|
|
52
51
|
input_el: ClassgroupElement,
|
|
53
52
|
info: VDFInfo,
|
|
54
|
-
target_vdf_info:
|
|
53
|
+
target_vdf_info: VDFInfo | None = None,
|
|
55
54
|
) -> bool:
|
|
56
55
|
"""
|
|
57
56
|
If target_vdf_info is passed in, it is compared with info.
|
chia/types/coin_spend.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
from chia_rs import CoinSpend
|
|
7
7
|
|
|
@@ -14,8 +14,8 @@ from chia.types.condition_with_args import ConditionWithArgs
|
|
|
14
14
|
|
|
15
15
|
def make_spend(
|
|
16
16
|
coin: Coin,
|
|
17
|
-
puzzle_reveal:
|
|
18
|
-
solution:
|
|
17
|
+
puzzle_reveal: Program | SerializedProgram,
|
|
18
|
+
solution: Program | SerializedProgram,
|
|
19
19
|
) -> CoinSpend:
|
|
20
20
|
pr: SerializedProgram
|
|
21
21
|
sol: SerializedProgram
|
chia/types/mempool_item.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
from chia_rs import CoinSpend, G2Element, SpendBundle, SpendBundleConditions
|
|
7
7
|
from chia_rs.sized_bytes import bytes32
|
|
@@ -31,7 +31,7 @@ class BundleCoinSpend:
|
|
|
31
31
|
# current unspent lineage belonging to this singleton, that we would rebase
|
|
32
32
|
# this spend on top of if we were to make a block now
|
|
33
33
|
# When finding MempoolItems by coin ID, we use Coin ID from it if it's set
|
|
34
|
-
latest_singleton_lineage:
|
|
34
|
+
latest_singleton_lineage: UnspentLineageInfo | None
|
|
35
35
|
|
|
36
36
|
@property
|
|
37
37
|
def supports_fast_forward(self) -> bool:
|
|
@@ -47,12 +47,12 @@ class MempoolItem:
|
|
|
47
47
|
height_added_to_mempool: uint32
|
|
48
48
|
|
|
49
49
|
# If present, this SpendBundle is not valid at or before this height
|
|
50
|
-
assert_height:
|
|
50
|
+
assert_height: uint32 | None = None
|
|
51
51
|
|
|
52
52
|
# If present, this SpendBundle is not valid once the block height reaches
|
|
53
53
|
# the specified height
|
|
54
|
-
assert_before_height:
|
|
55
|
-
assert_before_seconds:
|
|
54
|
+
assert_before_height: uint32 | None = None
|
|
55
|
+
assert_before_seconds: uint64 | None = None
|
|
56
56
|
|
|
57
57
|
# Map of coin ID to coin spend data between the bundle and its
|
|
58
58
|
# SpendBundleConditions
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from typing import Optional, Union
|
|
5
4
|
|
|
6
5
|
from chia_rs.sized_ints import uint8
|
|
7
6
|
|
|
@@ -20,9 +19,9 @@ class MempoolSubmissionStatus(Streamable):
|
|
|
20
19
|
|
|
21
20
|
peer_id: str
|
|
22
21
|
inclusion_status: uint8 # MempoolInclusionStatus
|
|
23
|
-
error_msg:
|
|
22
|
+
error_msg: str | None
|
|
24
23
|
|
|
25
|
-
def to_json_dict_convenience(self) -> dict[str,
|
|
24
|
+
def to_json_dict_convenience(self) -> dict[str, str | MempoolInclusionStatus | None]:
|
|
26
25
|
formatted = self.to_json_dict()
|
|
27
26
|
formatted["inclusion_status"] = MempoolInclusionStatus(self.inclusion_status).name
|
|
28
27
|
return formatted
|
chia/types/peer_info.py
CHANGED
|
@@ -2,7 +2,6 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import ipaddress
|
|
4
4
|
from dataclasses import dataclass
|
|
5
|
-
from typing import Union
|
|
6
5
|
|
|
7
6
|
from chia_rs.sized_ints import uint16, uint64
|
|
8
7
|
|
|
@@ -23,7 +22,7 @@ class PeerInfo:
|
|
|
23
22
|
_port: uint16
|
|
24
23
|
|
|
25
24
|
# TODO, Drop this as soon as all call PeerInfo calls pass in an IPAddress
|
|
26
|
-
def __init__(self, host:
|
|
25
|
+
def __init__(self, host: IPAddress | str, port: int):
|
|
27
26
|
self._ip = host if isinstance(host, IPAddress) else IPAddress.create(host)
|
|
28
27
|
self._port = uint16(port)
|
|
29
28
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
|
-
from typing import Optional
|
|
5
4
|
|
|
6
5
|
from chia_rs import EndOfSubSlotBundle, Foliage, FoliageTransactionBlock, RewardChainBlockUnfinished
|
|
7
6
|
from chia_rs.sized_bytes import bytes32
|
|
@@ -17,10 +16,10 @@ class UnfinishedHeaderBlock(Streamable):
|
|
|
17
16
|
# Same as a FullBlock but without TransactionInfo and Generator, used by light clients
|
|
18
17
|
finished_sub_slots: list[EndOfSubSlotBundle] # If first sb
|
|
19
18
|
reward_chain_block: RewardChainBlockUnfinished # Reward chain trunk data
|
|
20
|
-
challenge_chain_sp_proof:
|
|
21
|
-
reward_chain_sp_proof:
|
|
19
|
+
challenge_chain_sp_proof: VDFProof | None # If not first sp in sub-slot
|
|
20
|
+
reward_chain_sp_proof: VDFProof | None # If not first sp in sub-slot
|
|
22
21
|
foliage: Foliage # Reward chain foliage data
|
|
23
|
-
foliage_transaction_block:
|
|
22
|
+
foliage_transaction_block: FoliageTransactionBlock | None # Reward chain foliage data (tx block)
|
|
24
23
|
transactions_filter: bytes # Filter for block transactions
|
|
25
24
|
|
|
26
25
|
@property
|
chia/types/validation_state.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import dataclasses
|
|
4
|
-
from typing import Optional
|
|
5
4
|
|
|
6
5
|
from chia_rs import BlockRecord
|
|
7
6
|
from chia_rs.sized_ints import uint64
|
|
@@ -11,4 +10,4 @@ from chia_rs.sized_ints import uint64
|
|
|
11
10
|
class ValidationState:
|
|
12
11
|
ssi: uint64
|
|
13
12
|
difficulty: uint64
|
|
14
|
-
prev_ses_block:
|
|
13
|
+
prev_ses_block: BlockRecord | None = None
|
chia/util/action_scope.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import contextlib
|
|
4
|
-
from collections.abc import AsyncIterator, Awaitable
|
|
4
|
+
from collections.abc import AsyncIterator, Awaitable, Callable
|
|
5
5
|
from dataclasses import dataclass, field
|
|
6
|
-
from typing import
|
|
6
|
+
from typing import Generic, Protocol, TypeVar
|
|
7
7
|
|
|
8
8
|
import aiosqlite
|
|
9
9
|
from typing_extensions import Self
|
|
@@ -31,7 +31,7 @@ class ResourceManager(Protocol):
|
|
|
31
31
|
@dataclass
|
|
32
32
|
class SQLiteResourceManager:
|
|
33
33
|
_db: DBWrapper2
|
|
34
|
-
_active_writer:
|
|
34
|
+
_active_writer: aiosqlite.Connection | None = field(init=False, default=None)
|
|
35
35
|
|
|
36
36
|
def get_active_writer(self) -> aiosqlite.Connection:
|
|
37
37
|
if self._active_writer is None:
|
|
@@ -102,8 +102,8 @@ class ActionScope(Generic[_T_SideEffects, _T_Config]):
|
|
|
102
102
|
_resource_manager: ResourceManager
|
|
103
103
|
_side_effects_format: type[_T_SideEffects]
|
|
104
104
|
_config: _T_Config # An object not intended to be mutated during the lifetime of the scope
|
|
105
|
-
_callback:
|
|
106
|
-
_final_side_effects:
|
|
105
|
+
_callback: Callable[[StateInterface[_T_SideEffects]], Awaitable[None]] | None = None
|
|
106
|
+
_final_side_effects: _T_SideEffects | None = field(init=False, default=None)
|
|
107
107
|
|
|
108
108
|
@property
|
|
109
109
|
def side_effects(self) -> _T_SideEffects:
|
|
@@ -155,13 +155,13 @@ class ActionScope(Generic[_T_SideEffects, _T_Config]):
|
|
|
155
155
|
class StateInterface(Generic[_T_SideEffects]):
|
|
156
156
|
side_effects: _T_SideEffects
|
|
157
157
|
_callbacks_allowed: bool
|
|
158
|
-
_callback:
|
|
158
|
+
_callback: Callable[[StateInterface[_T_SideEffects]], Awaitable[None]] | None = None
|
|
159
159
|
|
|
160
160
|
@property
|
|
161
|
-
def callback(self) ->
|
|
161
|
+
def callback(self) -> Callable[[StateInterface[_T_SideEffects]], Awaitable[None]] | None:
|
|
162
162
|
return self._callback
|
|
163
163
|
|
|
164
|
-
def set_callback(self, new_callback:
|
|
164
|
+
def set_callback(self, new_callback: Callable[[StateInterface[_T_SideEffects]], Awaitable[None]] | None) -> None:
|
|
165
165
|
if not self._callbacks_allowed:
|
|
166
166
|
raise RuntimeError("Callback cannot be edited from inside itself")
|
|
167
167
|
|
chia/util/async_pool.py
CHANGED
|
@@ -7,7 +7,7 @@ import itertools
|
|
|
7
7
|
import logging
|
|
8
8
|
import traceback
|
|
9
9
|
from collections.abc import AsyncIterator, Iterator
|
|
10
|
-
from typing import Generic,
|
|
10
|
+
from typing import Generic, Protocol, TypeVar, final
|
|
11
11
|
|
|
12
12
|
import anyio
|
|
13
13
|
|
|
@@ -49,8 +49,8 @@ class Job(Generic[T]):
|
|
|
49
49
|
input: T
|
|
50
50
|
started: asyncio.Event = dataclasses.field(default_factory=asyncio.Event)
|
|
51
51
|
done: asyncio.Event = dataclasses.field(default_factory=asyncio.Event)
|
|
52
|
-
exception:
|
|
53
|
-
task:
|
|
52
|
+
exception: BaseException | None = None
|
|
53
|
+
task: asyncio.Task[object] | None = None
|
|
54
54
|
cancelled: bool = False
|
|
55
55
|
|
|
56
56
|
|
|
@@ -59,7 +59,7 @@ class Job(Generic[T]):
|
|
|
59
59
|
class QueuedAsyncPool(Generic[J, R]):
|
|
60
60
|
name: str
|
|
61
61
|
job_queue: JobQueueProtocol[Job[J]]
|
|
62
|
-
result_queue:
|
|
62
|
+
result_queue: ResultQueueProtocol[R] | None
|
|
63
63
|
worker_async_callable: QueuedWorkerCallable[J, R]
|
|
64
64
|
|
|
65
65
|
@classmethod
|
|
@@ -70,7 +70,7 @@ class QueuedAsyncPool(Generic[J, R]):
|
|
|
70
70
|
job_queue: JobQueueProtocol[Job[J]],
|
|
71
71
|
worker_async_callable: QueuedWorkerCallable[J, R],
|
|
72
72
|
target_worker_count: int,
|
|
73
|
-
result_queue:
|
|
73
|
+
result_queue: ResultQueueProtocol[R] | None = None,
|
|
74
74
|
log: logging.Logger = logging.getLogger(__name__),
|
|
75
75
|
) -> AsyncIterator[QueuedAsyncPool[J, R]]:
|
|
76
76
|
self = cls(
|
chia/util/bech32m.py
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
from __future__ import annotations
|
|
24
24
|
|
|
25
25
|
from collections.abc import Iterable
|
|
26
|
-
from typing import Optional
|
|
27
26
|
|
|
28
27
|
from chia_rs.sized_bytes import bytes32
|
|
29
28
|
|
|
@@ -71,7 +70,7 @@ def bech32_encode(hrp: str, data: list[int]) -> str:
|
|
|
71
70
|
return hrp + "1" + "".join([CHARSET[d] for d in combined])
|
|
72
71
|
|
|
73
72
|
|
|
74
|
-
def bech32_decode(bech: str, max_length: int = 90) -> tuple[
|
|
73
|
+
def bech32_decode(bech: str, max_length: int = 90) -> tuple[str | None, list[int] | None]:
|
|
75
74
|
"""Validate a Bech32 string, and determine HRP and data."""
|
|
76
75
|
bech = bech.strip()
|
|
77
76
|
if (any(ord(x) < 33 or ord(x) > 126 for x in bech)) or (bech.lower() != bech and bech.upper() != bech):
|
chia/util/beta_metrics.py
CHANGED
|
@@ -6,7 +6,7 @@ import platform
|
|
|
6
6
|
import socket
|
|
7
7
|
from dataclasses import dataclass
|
|
8
8
|
from pathlib import Path
|
|
9
|
-
from typing import Any
|
|
9
|
+
from typing import Any
|
|
10
10
|
|
|
11
11
|
import psutil
|
|
12
12
|
|
|
@@ -76,7 +76,7 @@ def log_network_metrics() -> None:
|
|
|
76
76
|
@dataclass
|
|
77
77
|
class BetaMetricsLogger:
|
|
78
78
|
root_path: Path
|
|
79
|
-
task:
|
|
79
|
+
task: asyncio.Task[None] | None = None
|
|
80
80
|
stop_task: bool = False
|
|
81
81
|
|
|
82
82
|
def start_logging(self) -> None:
|
chia/util/block_cache.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import TYPE_CHECKING, ClassVar,
|
|
3
|
+
from typing import TYPE_CHECKING, ClassVar, cast
|
|
4
4
|
|
|
5
5
|
from chia_rs import BlockRecord
|
|
6
6
|
from chia_rs.sized_bytes import bytes32
|
|
@@ -34,11 +34,11 @@ class BlockCache:
|
|
|
34
34
|
|
|
35
35
|
def height_to_block_record(self, height: uint32) -> BlockRecord:
|
|
36
36
|
# Precondition: height is < peak height
|
|
37
|
-
header_hash:
|
|
37
|
+
header_hash: bytes32 | None = self.height_to_hash(height)
|
|
38
38
|
assert header_hash is not None
|
|
39
39
|
return self.block_record(header_hash)
|
|
40
40
|
|
|
41
|
-
def height_to_hash(self, height: uint32) ->
|
|
41
|
+
def height_to_hash(self, height: uint32) -> bytes32 | None:
|
|
42
42
|
if height not in self._height_to_hash:
|
|
43
43
|
return None
|
|
44
44
|
return self._height_to_hash[height]
|
|
@@ -52,7 +52,7 @@ class BlockCache:
|
|
|
52
52
|
def contains_height(self, height: uint32) -> bool:
|
|
53
53
|
return height in self._height_to_hash
|
|
54
54
|
|
|
55
|
-
def try_block_record(self, header_hash: bytes32) ->
|
|
55
|
+
def try_block_record(self, header_hash: bytes32) -> BlockRecord | None:
|
|
56
56
|
return self._block_records.get(header_hash)
|
|
57
57
|
|
|
58
58
|
async def prev_block_hash(self, header_hashes: list[bytes32]) -> list[bytes32]:
|
chia/util/chia_logging.py
CHANGED
|
@@ -4,7 +4,7 @@ import logging
|
|
|
4
4
|
import os
|
|
5
5
|
from logging.handlers import SysLogHandler
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import Any,
|
|
7
|
+
from typing import Any, cast
|
|
8
8
|
|
|
9
9
|
import colorlog
|
|
10
10
|
from concurrent_log_handler import ConcurrentRotatingFileHandler
|
|
@@ -46,7 +46,7 @@ def initialize_logging(
|
|
|
46
46
|
service_name: str,
|
|
47
47
|
logging_config: dict[str, Any],
|
|
48
48
|
root_path: Path,
|
|
49
|
-
beta_root_path:
|
|
49
|
+
beta_root_path: Path | None = None,
|
|
50
50
|
) -> None:
|
|
51
51
|
log_backcompat = logging_config.get("log_backcompat", False)
|
|
52
52
|
log_level = logging_config.get("log_level", default_log_level)
|
chia/util/chia_version.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from re import search
|
|
4
|
-
from typing import Union
|
|
5
4
|
|
|
6
5
|
from packaging.version import InvalidVersion, Version
|
|
7
6
|
|
|
@@ -26,7 +25,7 @@ def _chia_short_version_from_str(version: str) -> str:
|
|
|
26
25
|
return version
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
def chia_short_version(version:
|
|
28
|
+
def chia_short_version(version: str | Version = __version__) -> str:
|
|
30
29
|
if isinstance(version, Version):
|
|
31
30
|
return _chia_short_version_from_version(version)
|
|
32
31
|
|