chia-blockchain 2.5.4rc2__py3-none-any.whl → 2.5.5__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 +529 -69
- chia/_tests/core/mempool/test_mempool_performance.py +3 -2
- chia/_tests/core/mempool/test_singleton_fast_forward.py +61 -132
- 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 +495 -265
- 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 +153 -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 +47 -45
- 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 +274 -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.5.dist-info}/METADATA +7 -7
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5.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.5.dist-info}/LICENSE +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5.dist-info}/entry_points.txt +0 -0
|
@@ -3,17 +3,14 @@ from __future__ import annotations
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import Optional, cast
|
|
5
5
|
|
|
6
|
-
import chia_rs
|
|
7
6
|
from bitstring import BitArray
|
|
8
|
-
from chia_rs import AugSchemeMPL, ConsensusConstants, G1Element, PrivateKey
|
|
7
|
+
from chia_rs import AugSchemeMPL, ConsensusConstants, G1Element, PlotSize, PrivateKey, ProofOfSpace
|
|
9
8
|
from chia_rs.sized_bytes import bytes32
|
|
10
|
-
from chia_rs.sized_ints import uint32
|
|
9
|
+
from chia_rs.sized_ints import uint8, uint32
|
|
11
10
|
from chiapos import Verifier
|
|
12
11
|
|
|
13
12
|
from chia.util.hash import std_hash
|
|
14
13
|
|
|
15
|
-
ProofOfSpace = chia_rs.ProofOfSpace
|
|
16
|
-
|
|
17
14
|
log = logging.getLogger(__name__)
|
|
18
15
|
|
|
19
16
|
|
|
@@ -25,6 +22,37 @@ def get_plot_id(pos: ProofOfSpace) -> bytes32:
|
|
|
25
22
|
return calculate_plot_id_pk(pos.pool_public_key, pos.plot_public_key)
|
|
26
23
|
|
|
27
24
|
|
|
25
|
+
# returns quality string for v2 plot, or None if invalid
|
|
26
|
+
def validate_proof_v2(
|
|
27
|
+
plot_id: bytes32, size: uint8, difficulty: uint8, challenge: bytes32, proof: bytes
|
|
28
|
+
) -> Optional[bytes32]:
|
|
29
|
+
# TODO: todo_v2_plots call into new chiapos library
|
|
30
|
+
raise NotImplementedError
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def check_plot_size(constants: ConsensusConstants, ps: PlotSize) -> bool:
|
|
34
|
+
size_v1 = ps.size_v1
|
|
35
|
+
if size_v1 is not None:
|
|
36
|
+
assert ps.size_v2 is None
|
|
37
|
+
if size_v1 < constants.MIN_PLOT_SIZE_V1:
|
|
38
|
+
log.error("Plot size is lower than the minimum")
|
|
39
|
+
return False
|
|
40
|
+
if size_v1 > constants.MAX_PLOT_SIZE_V1:
|
|
41
|
+
log.error("Plot size is higher than the maximum")
|
|
42
|
+
return False
|
|
43
|
+
return True
|
|
44
|
+
|
|
45
|
+
size_v2 = ps.size_v2
|
|
46
|
+
assert size_v2 is not None
|
|
47
|
+
if size_v2 < constants.MIN_PLOT_SIZE_V2:
|
|
48
|
+
log.error("Plot size is lower than the minimum")
|
|
49
|
+
return False
|
|
50
|
+
if size_v2 > constants.MAX_PLOT_SIZE_V2:
|
|
51
|
+
log.error("Plot size is higher than the maximum")
|
|
52
|
+
return False
|
|
53
|
+
return True
|
|
54
|
+
|
|
55
|
+
|
|
28
56
|
def verify_and_get_quality_string(
|
|
29
57
|
pos: ProofOfSpace,
|
|
30
58
|
constants: ConsensusConstants,
|
|
@@ -40,31 +68,38 @@ def verify_and_get_quality_string(
|
|
|
40
68
|
if (pos.pool_public_key is not None) and (pos.pool_contract_puzzle_hash is not None):
|
|
41
69
|
log.error("Expected pool public key or pool contract puzzle hash but got both")
|
|
42
70
|
return None
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if pos.size > constants.MAX_PLOT_SIZE:
|
|
47
|
-
log.error("Plot size is higher than the maximum")
|
|
71
|
+
|
|
72
|
+
plot_size = pos.size()
|
|
73
|
+
if not check_plot_size(constants, plot_size):
|
|
48
74
|
return None
|
|
75
|
+
|
|
49
76
|
plot_id: bytes32 = get_plot_id(pos)
|
|
50
77
|
new_challenge: bytes32 = calculate_pos_challenge(plot_id, original_challenge_hash, signage_point)
|
|
51
78
|
|
|
52
79
|
if new_challenge != pos.challenge:
|
|
53
80
|
log.error("Calculated pos challenge doesn't match the provided one")
|
|
54
81
|
return None
|
|
55
|
-
|
|
82
|
+
|
|
83
|
+
# we use different plot filter prefix sizes depending on v1 or v2 plots
|
|
84
|
+
prefix_bits = calculate_prefix_bits(constants, height, plot_size)
|
|
56
85
|
if not passes_plot_filter(prefix_bits, plot_id, original_challenge_hash, signage_point):
|
|
57
86
|
log.error("Did not pass the plot filter")
|
|
58
87
|
return None
|
|
59
88
|
|
|
60
|
-
|
|
89
|
+
if plot_size.size_v1 is not None:
|
|
90
|
+
# === V1 plots ===
|
|
91
|
+
assert plot_size.size_v2 is None
|
|
61
92
|
|
|
93
|
+
quality_str = Verifier().validate_proof(plot_id, plot_size.size_v1, pos.challenge, bytes(pos.proof))
|
|
94
|
+
if not quality_str:
|
|
95
|
+
return None
|
|
96
|
+
return bytes32(quality_str)
|
|
97
|
+
else:
|
|
98
|
+
# === V2 plots ===
|
|
99
|
+
assert plot_size.size_v2 is not None
|
|
62
100
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if not quality_str:
|
|
66
|
-
return None
|
|
67
|
-
return bytes32(quality_str)
|
|
101
|
+
plot_difficulty = calculate_plot_difficulty(constants, height)
|
|
102
|
+
return validate_proof_v2(plot_id, plot_size.size_v2, plot_difficulty, pos.challenge, bytes(pos.proof))
|
|
68
103
|
|
|
69
104
|
|
|
70
105
|
def passes_plot_filter(
|
|
@@ -84,8 +119,12 @@ def passes_plot_filter(
|
|
|
84
119
|
return cast(bool, plot_filter[:prefix_bits].uint == 0)
|
|
85
120
|
|
|
86
121
|
|
|
87
|
-
def calculate_prefix_bits(constants: ConsensusConstants, height: uint32) -> int:
|
|
88
|
-
|
|
122
|
+
def calculate_prefix_bits(constants: ConsensusConstants, height: uint32, plot_size: PlotSize) -> int:
|
|
123
|
+
# v2 plots have a constant plot filter size
|
|
124
|
+
if plot_size.size_v2 is not None:
|
|
125
|
+
return constants.NUMBER_ZERO_BITS_PLOT_FILTER_V2
|
|
126
|
+
|
|
127
|
+
prefix_bits = int(constants.NUMBER_ZERO_BITS_PLOT_FILTER_V1)
|
|
89
128
|
if height >= constants.PLOT_FILTER_32_HEIGHT:
|
|
90
129
|
prefix_bits -= 4
|
|
91
130
|
elif height >= constants.PLOT_FILTER_64_HEIGHT:
|
|
@@ -98,6 +137,21 @@ def calculate_prefix_bits(constants: ConsensusConstants, height: uint32) -> int:
|
|
|
98
137
|
return max(0, prefix_bits)
|
|
99
138
|
|
|
100
139
|
|
|
140
|
+
def calculate_plot_difficulty(constants: ConsensusConstants, height: uint32) -> uint8:
|
|
141
|
+
if height < constants.PLOT_DIFFICULTY_4_HEIGHT:
|
|
142
|
+
return constants.PLOT_DIFFICULTY_INITIAL
|
|
143
|
+
if height < constants.PLOT_DIFFICULTY_5_HEIGHT:
|
|
144
|
+
return uint8(4)
|
|
145
|
+
if height < constants.PLOT_DIFFICULTY_6_HEIGHT:
|
|
146
|
+
return uint8(5)
|
|
147
|
+
if height < constants.PLOT_DIFFICULTY_7_HEIGHT:
|
|
148
|
+
return uint8(6)
|
|
149
|
+
if height < constants.PLOT_DIFFICULTY_8_HEIGHT:
|
|
150
|
+
return uint8(7)
|
|
151
|
+
else:
|
|
152
|
+
return uint8(8)
|
|
153
|
+
|
|
154
|
+
|
|
101
155
|
def calculate_plot_filter_input(plot_id: bytes32, challenge_hash: bytes32, signage_point: bytes32) -> bytes32:
|
|
102
156
|
return std_hash(plot_id + challenge_hash + signage_point)
|
|
103
157
|
|
chia/types/coin_spend.py
CHANGED
|
@@ -3,21 +3,15 @@ from __future__ import annotations
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Any, Union
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
from chia_rs.sized_ints import uint64
|
|
6
|
+
from chia_rs import CoinSpend
|
|
8
7
|
|
|
9
|
-
from chia.consensus.condition_costs import ConditionCost
|
|
10
|
-
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
|
11
8
|
from chia.types.blockchain_format.coin import Coin
|
|
12
9
|
from chia.types.blockchain_format.program import Program
|
|
13
10
|
from chia.types.blockchain_format.serialized_program import SerializedProgram
|
|
14
11
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
15
12
|
from chia.types.condition_with_args import ConditionWithArgs
|
|
16
|
-
from chia.util.errors import Err, ValidationError
|
|
17
13
|
from chia.util.streamable import Streamable, streamable
|
|
18
14
|
|
|
19
|
-
CoinSpend = chia_rs.CoinSpend
|
|
20
|
-
|
|
21
15
|
|
|
22
16
|
def make_spend(
|
|
23
17
|
coin: Coin,
|
|
@@ -29,66 +23,19 @@ def make_spend(
|
|
|
29
23
|
if isinstance(puzzle_reveal, SerializedProgram):
|
|
30
24
|
pr = puzzle_reveal
|
|
31
25
|
elif isinstance(puzzle_reveal, Program):
|
|
32
|
-
pr =
|
|
26
|
+
pr = puzzle_reveal.to_serialized()
|
|
33
27
|
else:
|
|
34
28
|
raise ValueError("Only [SerializedProgram, Program] supported for puzzle reveal")
|
|
35
29
|
if isinstance(solution, SerializedProgram):
|
|
36
30
|
sol = solution
|
|
37
31
|
elif isinstance(solution, Program):
|
|
38
|
-
sol =
|
|
32
|
+
sol = solution.to_serialized()
|
|
39
33
|
else:
|
|
40
34
|
raise ValueError("Only [SerializedProgram, Program] supported for solution")
|
|
41
35
|
|
|
42
36
|
return CoinSpend(coin, pr, sol)
|
|
43
37
|
|
|
44
38
|
|
|
45
|
-
def compute_additions_with_cost(
|
|
46
|
-
cs: CoinSpend,
|
|
47
|
-
*,
|
|
48
|
-
max_cost: int = DEFAULT_CONSTANTS.MAX_BLOCK_COST_CLVM,
|
|
49
|
-
) -> tuple[list[Coin], int]:
|
|
50
|
-
"""
|
|
51
|
-
Run the puzzle in the specified CoinSpend and return the cost and list of
|
|
52
|
-
coins created by the puzzle, i.e. additions. If the cost (CLVM- and
|
|
53
|
-
condition cost) exceeds the specified max_cost, the function fails with a
|
|
54
|
-
ValidationError exception. Byte cost is not included since at this point the
|
|
55
|
-
puzzle and solution may have been decompressed, the true byte-cost can only be
|
|
56
|
-
measured at the block generator level.
|
|
57
|
-
"""
|
|
58
|
-
parent_id = cs.coin.name()
|
|
59
|
-
ret: list[Coin] = []
|
|
60
|
-
cost, r = cs.puzzle_reveal.run_with_cost(max_cost, cs.solution)
|
|
61
|
-
for cond in Program.to(r).as_iter():
|
|
62
|
-
if cost > max_cost:
|
|
63
|
-
raise ValidationError(Err.BLOCK_COST_EXCEEDS_MAX, "compute_additions() for CoinSpend")
|
|
64
|
-
atoms = cond.as_iter()
|
|
65
|
-
op = next(atoms).atom
|
|
66
|
-
if op in {
|
|
67
|
-
ConditionOpcode.AGG_SIG_PARENT,
|
|
68
|
-
ConditionOpcode.AGG_SIG_PUZZLE,
|
|
69
|
-
ConditionOpcode.AGG_SIG_AMOUNT,
|
|
70
|
-
ConditionOpcode.AGG_SIG_PUZZLE_AMOUNT,
|
|
71
|
-
ConditionOpcode.AGG_SIG_PARENT_AMOUNT,
|
|
72
|
-
ConditionOpcode.AGG_SIG_PARENT_PUZZLE,
|
|
73
|
-
ConditionOpcode.AGG_SIG_UNSAFE,
|
|
74
|
-
ConditionOpcode.AGG_SIG_ME,
|
|
75
|
-
}:
|
|
76
|
-
cost += ConditionCost.AGG_SIG.value
|
|
77
|
-
continue
|
|
78
|
-
if op != ConditionOpcode.CREATE_COIN.value:
|
|
79
|
-
continue
|
|
80
|
-
cost += ConditionCost.CREATE_COIN.value
|
|
81
|
-
puzzle_hash = next(atoms).as_atom()
|
|
82
|
-
amount = uint64(next(atoms).as_int())
|
|
83
|
-
ret.append(Coin(parent_id, puzzle_hash, uint64(amount)))
|
|
84
|
-
|
|
85
|
-
return ret, cost
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def compute_additions(cs: CoinSpend, *, max_cost: int = DEFAULT_CONSTANTS.MAX_BLOCK_COST_CLVM) -> list[Coin]:
|
|
89
|
-
return compute_additions_with_cost(cs, max_cost=max_cost)[0]
|
|
90
|
-
|
|
91
|
-
|
|
92
39
|
@streamable
|
|
93
40
|
@dataclass(frozen=True)
|
|
94
41
|
class SpendInfo(Streamable):
|
chia/types/generator_types.py
CHANGED
|
@@ -2,12 +2,40 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
4
|
|
|
5
|
+
from chia_rs import Coin, G2Element
|
|
6
|
+
from chia_rs.sized_ints import uint32, uint64
|
|
7
|
+
|
|
5
8
|
from chia.types.blockchain_format.serialized_program import SerializedProgram
|
|
6
9
|
from chia.util.streamable import Streamable, streamable
|
|
7
10
|
|
|
8
11
|
|
|
12
|
+
# This holds what we need to pre validate a block generator
|
|
9
13
|
@streamable
|
|
10
14
|
@dataclass(frozen=True)
|
|
11
15
|
class BlockGenerator(Streamable):
|
|
12
16
|
program: SerializedProgram = field(default_factory=SerializedProgram.default)
|
|
17
|
+
# to run the block generator, we need the actual bytes of the previous
|
|
18
|
+
# generators it may reference. These are parameters passed in to the block
|
|
19
|
+
# generator
|
|
13
20
|
generator_refs: list[bytes] = field(default_factory=list)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# When we create a new block, this object holds the block generator and
|
|
24
|
+
# additional information we need to create the UnfinishedBlock from it.
|
|
25
|
+
# When creating a block, we still need to be able to run it, to compute its cost
|
|
26
|
+
# and validate it. Therefore, this is a superset of the BlockGenerator class.
|
|
27
|
+
@dataclass(frozen=True)
|
|
28
|
+
class NewBlockGenerator(BlockGenerator):
|
|
29
|
+
# when creating a block, we include the block heights of the generators we
|
|
30
|
+
# reference. Tese are block heights and generator_refs contain the
|
|
31
|
+
# corresponding bytes of the generator programs
|
|
32
|
+
block_refs: list[uint32] = field(default_factory=list)
|
|
33
|
+
# the aggregate signature of all AGG_SIG_* conditions returned by the block
|
|
34
|
+
# generator.
|
|
35
|
+
signature: G2Element = G2Element()
|
|
36
|
+
# all CREATE_COIN outputs created by the block generator
|
|
37
|
+
additions: list[Coin] = field(default_factory=list)
|
|
38
|
+
# all coins being spent by the block generator
|
|
39
|
+
removals: list[Coin] = field(default_factory=list)
|
|
40
|
+
# the total cost of the block generator, CLVM + bytes + conditions
|
|
41
|
+
cost: uint64 = field(default=uint64(0))
|
|
@@ -2,12 +2,11 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
|
|
5
|
+
from chia_rs import SpendBundle, SpendBundleConditions
|
|
5
6
|
from chia_rs.sized_bytes import bytes32
|
|
6
7
|
from chia_rs.sized_ints import uint32
|
|
7
8
|
|
|
8
9
|
from chia.types.mempool_item import BundleCoinSpend
|
|
9
|
-
from chia.types.spend_bundle import SpendBundle
|
|
10
|
-
from chia.types.spend_bundle_conditions import SpendBundleConditions
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
@dataclass(frozen=True)
|
chia/types/mempool_item.py
CHANGED
|
@@ -3,16 +3,21 @@ from __future__ import annotations
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
4
|
from typing import Any, Optional
|
|
5
5
|
|
|
6
|
+
from chia_rs import CoinSpend, SpendBundle, SpendBundleConditions
|
|
6
7
|
from chia_rs.sized_bytes import bytes32
|
|
7
8
|
from chia_rs.sized_ints import uint32, uint64
|
|
8
9
|
|
|
9
10
|
from chia.types.blockchain_format.coin import Coin
|
|
10
|
-
from chia.types.coin_spend import CoinSpend
|
|
11
|
-
from chia.types.spend_bundle import SpendBundle
|
|
12
|
-
from chia.types.spend_bundle_conditions import SpendBundleConditions
|
|
13
11
|
from chia.util.streamable import recurse_jsonify
|
|
14
12
|
|
|
15
13
|
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class UnspentLineageInfo:
|
|
16
|
+
coin_id: bytes32
|
|
17
|
+
parent_id: bytes32
|
|
18
|
+
parent_parent_id: bytes32
|
|
19
|
+
|
|
20
|
+
|
|
16
21
|
@dataclass
|
|
17
22
|
class BundleCoinSpend:
|
|
18
23
|
coin_spend: CoinSpend
|
|
@@ -23,10 +28,10 @@ class BundleCoinSpend:
|
|
|
23
28
|
cost: Optional[uint64] = None
|
|
24
29
|
|
|
25
30
|
# if this spend is eligible for fast forward, this may be set to the
|
|
26
|
-
# current unspent
|
|
27
|
-
# this
|
|
28
|
-
# When finding MempoolItems by coin ID, we use
|
|
29
|
-
|
|
31
|
+
# current unspent lineage belonging to this singleton, that we would rebase
|
|
32
|
+
# this spend on top of if we were to make a block now
|
|
33
|
+
# When finding MempoolItems by coin ID, we use Coin ID from it if it's set
|
|
34
|
+
latest_singleton_lineage: Optional[UnspentLineageInfo] = None
|
|
30
35
|
|
|
31
36
|
|
|
32
37
|
@dataclass(frozen=True)
|
|
@@ -3,12 +3,11 @@ from __future__ import annotations
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
|
-
from chia_rs import Foliage, FoliageTransactionBlock, RewardChainBlockUnfinished
|
|
6
|
+
from chia_rs import EndOfSubSlotBundle, Foliage, FoliageTransactionBlock, RewardChainBlockUnfinished
|
|
7
7
|
from chia_rs.sized_bytes import bytes32
|
|
8
8
|
from chia_rs.sized_ints import uint128
|
|
9
9
|
|
|
10
10
|
from chia.types.blockchain_format.vdf import VDFProof
|
|
11
|
-
from chia.types.end_of_slot_bundle import EndOfSubSlotBundle
|
|
12
11
|
from chia.util.streamable import Streamable, streamable
|
|
13
12
|
|
|
14
13
|
|
chia/types/validation_state.py
CHANGED
|
@@ -3,10 +3,9 @@ from __future__ import annotations
|
|
|
3
3
|
import dataclasses
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
|
+
from chia_rs import BlockRecord
|
|
6
7
|
from chia_rs.sized_ints import uint64
|
|
7
8
|
|
|
8
|
-
from chia.consensus.block_record import BlockRecord
|
|
9
|
-
|
|
10
9
|
|
|
11
10
|
@dataclasses.dataclass
|
|
12
11
|
class ValidationState:
|
chia/types/weight_proof.py
CHANGED
|
@@ -2,10 +2,8 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
|
|
5
|
-
from chia_rs import RewardChainBlock, SubEpochChallengeSegment, SubEpochData
|
|
5
|
+
from chia_rs import EndOfSubSlotBundle, HeaderBlock, RewardChainBlock, SubEpochChallengeSegment, SubEpochData
|
|
6
6
|
|
|
7
|
-
from chia.types.end_of_slot_bundle import EndOfSubSlotBundle
|
|
8
|
-
from chia.types.header_block import HeaderBlock
|
|
9
7
|
from chia.util.streamable import Streamable, streamable
|
|
10
8
|
|
|
11
9
|
# number of challenge blocks
|
chia/util/action_scope.py
CHANGED
|
@@ -3,9 +3,10 @@ from __future__ import annotations
|
|
|
3
3
|
import contextlib
|
|
4
4
|
from collections.abc import AsyncIterator, Awaitable
|
|
5
5
|
from dataclasses import dataclass, field
|
|
6
|
-
from typing import Callable, Generic, Optional, Protocol, TypeVar
|
|
6
|
+
from typing import Callable, Generic, Optional, Protocol, TypeVar
|
|
7
7
|
|
|
8
8
|
import aiosqlite
|
|
9
|
+
from typing_extensions import Self
|
|
9
10
|
|
|
10
11
|
from chia.util.db_wrapper import DBWrapper2, execute_fetchone
|
|
11
12
|
|
|
@@ -80,14 +81,13 @@ class SideEffects(Protocol):
|
|
|
80
81
|
def __bytes__(self) -> bytes: ...
|
|
81
82
|
|
|
82
83
|
@classmethod
|
|
83
|
-
def from_bytes(cls
|
|
84
|
+
def from_bytes(cls, blob: bytes) -> Self: ...
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
_T_SideEffects = TypeVar("_T_SideEffects", bound=SideEffects)
|
|
87
88
|
_T_Config = TypeVar("_T_Config")
|
|
88
89
|
|
|
89
90
|
|
|
90
|
-
@final
|
|
91
91
|
@dataclass
|
|
92
92
|
class ActionScope(Generic[_T_SideEffects, _T_Config]):
|
|
93
93
|
"""
|
chia/util/block_cache.py
CHANGED
|
@@ -2,11 +2,10 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING, ClassVar, Optional, cast
|
|
4
4
|
|
|
5
|
+
from chia_rs import BlockRecord
|
|
5
6
|
from chia_rs.sized_bytes import bytes32
|
|
6
7
|
from chia_rs.sized_ints import uint32
|
|
7
8
|
|
|
8
|
-
from chia.consensus.block_record import BlockRecord
|
|
9
|
-
|
|
10
9
|
|
|
11
10
|
# implements BlockRecordsProtocol
|
|
12
11
|
class BlockCache:
|
chia/util/byte_types.py
CHANGED
|
@@ -7,6 +7,6 @@ def hexstr_to_bytes(input_str: str) -> bytes:
|
|
|
7
7
|
"""
|
|
8
8
|
Converts a hex string into bytes, removing the 0x if it's present.
|
|
9
9
|
"""
|
|
10
|
-
if input_str.startswith("0x"
|
|
10
|
+
if input_str.startswith(("0x", "0X")):
|
|
11
11
|
return bytes.fromhex(input_str[2:])
|
|
12
12
|
return bytes.fromhex(input_str)
|
chia/util/casts.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# This file converts between chialisp bytes and Python integer
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def int_from_bytes(blob: bytes) -> int:
|
|
6
|
+
size = len(blob)
|
|
7
|
+
if size == 0:
|
|
8
|
+
return 0
|
|
9
|
+
return int.from_bytes(blob, "big", signed=True)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def int_to_bytes(v: int) -> bytes:
|
|
13
|
+
byte_count = (v.bit_length() + 8) >> 3
|
|
14
|
+
if v == 0:
|
|
15
|
+
return b""
|
|
16
|
+
r = v.to_bytes(byte_count, "big", signed=True)
|
|
17
|
+
# make sure the string returned is minimal
|
|
18
|
+
# ie. no leading 00 or ff bytes that are unnecessary
|
|
19
|
+
while len(r) > 1 and r[0] == (0xFF if r[1] & 0x80 else 0):
|
|
20
|
+
r = r[1:]
|
|
21
|
+
return r
|
chia/util/config.py
CHANGED
|
@@ -18,8 +18,6 @@ import importlib_resources
|
|
|
18
18
|
import yaml
|
|
19
19
|
from typing_extensions import Literal
|
|
20
20
|
|
|
21
|
-
from chia.server.outbound_message import NodeType
|
|
22
|
-
from chia.types.peer_info import UnresolvedPeerInfo
|
|
23
21
|
from chia.util.lock import Lockfile
|
|
24
22
|
|
|
25
23
|
log = logging.getLogger(__name__)
|
|
@@ -330,38 +328,3 @@ def load_defaults_for_missing_services(config: dict[str, Any], config_name: str)
|
|
|
330
328
|
defaulted[service]["selected_network"] = "".join(to_be_referenced)
|
|
331
329
|
|
|
332
330
|
return defaulted
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
PEER_INFO_MAPPING: dict[NodeType, str] = {
|
|
336
|
-
NodeType.FULL_NODE: "full_node_peer",
|
|
337
|
-
NodeType.FARMER: "farmer_peer",
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
def get_unresolved_peer_infos(service_config: dict[str, Any], peer_type: NodeType) -> set[UnresolvedPeerInfo]:
|
|
342
|
-
peer_info_key = PEER_INFO_MAPPING[peer_type]
|
|
343
|
-
peer_infos: list[dict[str, Any]] = service_config.get(f"{peer_info_key}s", [])
|
|
344
|
-
peer_info: Optional[dict[str, Any]] = service_config.get(peer_info_key)
|
|
345
|
-
if peer_info is not None:
|
|
346
|
-
peer_infos.append(peer_info)
|
|
347
|
-
|
|
348
|
-
return {UnresolvedPeerInfo(host=peer["host"], port=peer["port"]) for peer in peer_infos}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
def set_peer_info(
|
|
352
|
-
service_config: dict[str, Any],
|
|
353
|
-
peer_type: NodeType,
|
|
354
|
-
peer_host: Optional[str] = None,
|
|
355
|
-
peer_port: Optional[int] = None,
|
|
356
|
-
) -> None:
|
|
357
|
-
peer_info_key = PEER_INFO_MAPPING[peer_type]
|
|
358
|
-
if peer_info_key in service_config:
|
|
359
|
-
if peer_host is not None:
|
|
360
|
-
service_config[peer_info_key]["host"] = peer_host
|
|
361
|
-
if peer_port is not None:
|
|
362
|
-
service_config[peer_info_key]["port"] = peer_port
|
|
363
|
-
elif f"{peer_info_key}s" in service_config and len(service_config[f"{peer_info_key}s"]) > 0:
|
|
364
|
-
if peer_host is not None:
|
|
365
|
-
service_config[f"{peer_info_key}s"][0]["host"] = peer_host
|
|
366
|
-
if peer_port is not None:
|
|
367
|
-
service_config[f"{peer_info_key}s"][0]["port"] = peer_port
|
chia/util/db_wrapper.py
CHANGED
|
@@ -54,6 +54,13 @@ class InternalError(DBWrapperError):
|
|
|
54
54
|
pass
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
class PurposefulAbort(DBWrapperError):
|
|
58
|
+
obj: object
|
|
59
|
+
|
|
60
|
+
def __init__(self, obj: object) -> None:
|
|
61
|
+
self.obj = obj
|
|
62
|
+
|
|
63
|
+
|
|
57
64
|
def generate_in_memory_db_uri() -> str:
|
|
58
65
|
# We need to use shared cache as our DB wrapper uses different types of connections
|
|
59
66
|
return f"file:db_{secrets.token_hex(16)}?mode=memory&cache=shared"
|
|
@@ -307,7 +314,7 @@ class DBWrapper2:
|
|
|
307
314
|
# probably skip the nested foreign key check when exiting since
|
|
308
315
|
# we don't have many foreign key errors and so it is likely ok
|
|
309
316
|
# to save the extra time checking twice.
|
|
310
|
-
raise NestedForeignKeyDelayedRequestError
|
|
317
|
+
raise NestedForeignKeyDelayedRequestError
|
|
311
318
|
async with self._savepoint_ctx():
|
|
312
319
|
yield self._write_connection
|
|
313
320
|
return
|
chia/util/errors.py
CHANGED
|
@@ -194,6 +194,9 @@ class Err(Enum):
|
|
|
194
194
|
INVALID_COIN_ID = 146
|
|
195
195
|
# message not sent/received
|
|
196
196
|
MESSAGE_NOT_SENT_OR_RECEIVED = 147
|
|
197
|
+
# the transactions generator uses overlong encoding of CLVM atoms in its
|
|
198
|
+
# serialization
|
|
199
|
+
INVALID_TRANSACTIONS_GENERATOR_ENCODING = 148
|
|
197
200
|
|
|
198
201
|
|
|
199
202
|
class ValidationError(Exception):
|
|
@@ -349,5 +352,3 @@ class CliRpcConnectionError(ClickException):
|
|
|
349
352
|
"""
|
|
350
353
|
This error is raised when a rpc server cant be reached by the cli async generator
|
|
351
354
|
"""
|
|
352
|
-
|
|
353
|
-
pass
|
chia/util/initial-config.yaml
CHANGED
|
@@ -19,7 +19,8 @@ network_overrides: &network_overrides
|
|
|
19
19
|
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc"
|
|
20
20
|
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af"
|
|
21
21
|
testnet0:
|
|
22
|
-
|
|
22
|
+
MIN_PLOT_SIZE_V1: 18
|
|
23
|
+
MIN_PLOT_SIZE_V2: 20
|
|
23
24
|
GENESIS_CHALLENGE: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
|
24
25
|
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc"
|
|
25
26
|
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af"
|
|
@@ -32,12 +33,12 @@ network_overrides: &network_overrides
|
|
|
32
33
|
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 08296fc227decd043aee855741444538e4cc9a31772c4d1a9e6242d1e777e42a
|
|
33
34
|
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: 3ef7c233fc0785f3c0cae5992c1d35e7c955ca37a423571c1607ba392a9d12f7
|
|
34
35
|
MEMPOOL_BLOCK_BUFFER: 10
|
|
35
|
-
|
|
36
|
+
MIN_PLOT_SIZE_V1: 18
|
|
37
|
+
MIN_PLOT_SIZE_V2: 20
|
|
36
38
|
NETWORK_TYPE: 1
|
|
37
39
|
SUB_SLOT_ITERS_STARTING: 67108864
|
|
38
40
|
# Forks activated from the beginning on this network
|
|
39
41
|
HARD_FORK_HEIGHT: 0
|
|
40
|
-
SOFT_FORK6_HEIGHT: 2000000
|
|
41
42
|
PLOT_FILTER_128_HEIGHT: 6029568
|
|
42
43
|
PLOT_FILTER_64_HEIGHT: 11075328
|
|
43
44
|
PLOT_FILTER_32_HEIGHT: 16121088
|
|
@@ -50,7 +51,8 @@ network_overrides: &network_overrides
|
|
|
50
51
|
GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 08296fc227decd043aee855741444538e4cc9a31772c4d1a9e6242d1e777e42a
|
|
51
52
|
GENESIS_PRE_FARM_POOL_PUZZLE_HASH: 08296fc227decd043aee855741444538e4cc9a31772c4d1a9e6242d1e777e42a
|
|
52
53
|
MEMPOOL_BLOCK_BUFFER: 10
|
|
53
|
-
|
|
54
|
+
MIN_PLOT_SIZE_V1: 18
|
|
55
|
+
MIN_PLOT_SIZE_V2: 20
|
|
54
56
|
NETWORK_TYPE: 1
|
|
55
57
|
SUB_SLOT_ITERS_STARTING: 67108864
|
|
56
58
|
config:
|
|
@@ -306,6 +308,21 @@ full_node:
|
|
|
306
308
|
# the particular system we're running on. Defaults to "full".
|
|
307
309
|
db_sync: "auto"
|
|
308
310
|
|
|
311
|
+
# Determine which version of block creation function to use:
|
|
312
|
+
# 0: Original function, first fill a block with transactions, then compress
|
|
313
|
+
# it, then run it to compute its cost. The final block may not use all
|
|
314
|
+
# available block cost.
|
|
315
|
+
# 1: Compressed block function. Compress transactions into the block as they
|
|
316
|
+
# are added. Use the new, optimized, compression function. This produces
|
|
317
|
+
# blocks that fill up the allowed block cost.
|
|
318
|
+
|
|
319
|
+
# block_creation: 0
|
|
320
|
+
|
|
321
|
+
# If we spend more than this many seconds forming the new transactions block
|
|
322
|
+
# generator, stop and just go with what we have so far. This is a safety
|
|
323
|
+
# measure to not spend too much time building the block generator.
|
|
324
|
+
# block_creation_timeout: 2.0
|
|
325
|
+
|
|
309
326
|
# the number of threads used to read from the blockchain database
|
|
310
327
|
# concurrently. There's always only 1 writer, but the number of readers is
|
|
311
328
|
# configurable
|
|
@@ -682,4 +699,3 @@ simulator:
|
|
|
682
699
|
|
|
683
700
|
# Fork Settings
|
|
684
701
|
HARD_FORK_HEIGHT: 0
|
|
685
|
-
SOFT_FORK6_HEIGHT: 0
|
chia/util/keychain.py
CHANGED
|
@@ -79,12 +79,11 @@ def bytes_to_mnemonic(mnemonic_bytes: bytes) -> str:
|
|
|
79
79
|
CS = len(mnemonic_bytes) // 4
|
|
80
80
|
|
|
81
81
|
checksum = BitArray(bytes(std_hash(mnemonic_bytes)))[:CS]
|
|
82
|
-
|
|
83
82
|
bitarray = BitArray(mnemonic_bytes) + checksum
|
|
84
83
|
mnemonics = []
|
|
85
84
|
assert len(bitarray) % 11 == 0
|
|
86
85
|
|
|
87
|
-
for i in range(
|
|
86
|
+
for i in range(len(bitarray) // 11):
|
|
88
87
|
start = i * 11
|
|
89
88
|
end = start + 11
|
|
90
89
|
bits = bitarray[start:end]
|
|
@@ -127,7 +126,7 @@ def bytes_from_mnemonic(mnemonic_str: str) -> bytes:
|
|
|
127
126
|
|
|
128
127
|
word_list = {word: i for i, word in enumerate(bip39_word_list().splitlines())}
|
|
129
128
|
bit_array = BitArray()
|
|
130
|
-
for i in range(
|
|
129
|
+
for i in range(len(mnemonic)):
|
|
131
130
|
word = mnemonic[i]
|
|
132
131
|
if word not in word_list:
|
|
133
132
|
raise ValueError(f"'{word}' is not in the mnemonic dictionary; may be misspelled")
|
|
@@ -264,24 +263,24 @@ class KeyData(Streamable):
|
|
|
264
263
|
@property
|
|
265
264
|
def mnemonic(self) -> list[str]:
|
|
266
265
|
if self.secrets is None:
|
|
267
|
-
raise KeychainSecretsMissing
|
|
266
|
+
raise KeychainSecretsMissing
|
|
268
267
|
return self.secrets.mnemonic
|
|
269
268
|
|
|
270
269
|
def mnemonic_str(self) -> str:
|
|
271
270
|
if self.secrets is None:
|
|
272
|
-
raise KeychainSecretsMissing
|
|
271
|
+
raise KeychainSecretsMissing
|
|
273
272
|
return self.secrets.mnemonic_str()
|
|
274
273
|
|
|
275
274
|
@property
|
|
276
275
|
def entropy(self) -> bytes:
|
|
277
276
|
if self.secrets is None:
|
|
278
|
-
raise KeychainSecretsMissing
|
|
277
|
+
raise KeychainSecretsMissing
|
|
279
278
|
return self.secrets.entropy
|
|
280
279
|
|
|
281
280
|
@property
|
|
282
281
|
def private_key(self) -> PrivateKey:
|
|
283
282
|
if self.secrets is None:
|
|
284
|
-
raise KeychainSecretsMissing
|
|
283
|
+
raise KeychainSecretsMissing
|
|
285
284
|
return self.secrets.private_key
|
|
286
285
|
|
|
287
286
|
|