chia-blockchain 2.5.4rc2__py3-none-any.whl → 2.5.5rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chia/_tests/blockchain/blockchain_test_utils.py +2 -3
- chia/_tests/blockchain/test_augmented_chain.py +2 -3
- chia/_tests/blockchain/test_blockchain.py +261 -44
- chia/_tests/blockchain/test_blockchain_transactions.py +4 -3
- chia/_tests/blockchain/test_build_chains.py +197 -1
- chia/_tests/blockchain/test_get_block_generator.py +1 -1
- chia/_tests/blockchain/test_lookup_fork_chain.py +1 -1
- chia/_tests/clvm/benchmark_costs.py +1 -1
- chia/_tests/clvm/coin_store.py +3 -4
- chia/_tests/clvm/test_message_conditions.py +2 -2
- chia/_tests/clvm/test_puzzle_compression.py +2 -3
- chia/_tests/clvm/test_puzzles.py +1 -2
- chia/_tests/clvm/test_singletons.py +2 -3
- chia/_tests/clvm/test_spend_sim.py +7 -7
- chia/_tests/cmds/cmd_test_utils.py +30 -25
- chia/_tests/cmds/test_dev_gh.py +1 -1
- chia/_tests/cmds/test_farm_cmd.py +1 -1
- chia/_tests/cmds/test_show.py +1 -2
- chia/_tests/cmds/wallet/test_did.py +101 -56
- chia/_tests/cmds/wallet/test_nft.py +109 -84
- chia/_tests/cmds/wallet/test_notifications.py +1 -1
- chia/_tests/cmds/wallet/test_offer.toffer +1 -1
- chia/_tests/cmds/wallet/test_vcs.py +8 -8
- chia/_tests/cmds/wallet/test_wallet.py +100 -46
- chia/_tests/conftest.py +31 -20
- chia/_tests/connection_utils.py +1 -1
- chia/_tests/core/consensus/stores/__init__.py +0 -0
- chia/_tests/core/consensus/stores/test_coin_store_protocol.py +40 -0
- chia/_tests/core/consensus/test_block_creation.py +2 -31
- chia/_tests/core/consensus/test_pot_iterations.py +38 -3
- chia/_tests/core/custom_types/test_proof_of_space.py +154 -26
- chia/_tests/core/custom_types/test_spend_bundle.py +2 -3
- chia/_tests/core/daemon/test_daemon.py +80 -0
- chia/_tests/core/data_layer/test_data_layer.py +1 -1
- chia/_tests/core/data_layer/test_data_layer_util.py +1 -1
- chia/_tests/core/data_layer/test_data_rpc.py +14 -10
- chia/_tests/core/data_layer/test_data_store.py +5 -5
- chia/_tests/core/farmer/test_farmer_api.py +2 -2
- chia/_tests/core/full_node/full_sync/test_full_sync.py +446 -406
- chia/_tests/core/full_node/ram_db.py +3 -1
- chia/_tests/core/full_node/stores/test_block_store.py +28 -16
- chia/_tests/core/full_node/stores/test_coin_store.py +277 -185
- chia/_tests/core/full_node/stores/test_full_node_store.py +11 -4
- chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
- chia/_tests/core/full_node/test_address_manager.py +200 -27
- chia/_tests/core/full_node/test_block_height_map.py +2 -2
- chia/_tests/core/full_node/test_conditions.py +7 -6
- chia/_tests/core/full_node/test_full_node.py +456 -40
- chia/_tests/core/full_node/test_generator_tools.py +32 -2
- chia/_tests/core/full_node/test_hint_management.py +1 -1
- chia/_tests/core/full_node/test_node_load.py +20 -21
- chia/_tests/core/full_node/test_performance.py +3 -4
- chia/_tests/core/full_node/test_prev_tx_block.py +43 -0
- chia/_tests/core/full_node/test_subscriptions.py +1 -2
- chia/_tests/core/full_node/test_transactions.py +9 -5
- chia/_tests/core/full_node/test_tx_processing_queue.py +1 -2
- chia/_tests/core/large_block.py +1 -2
- chia/_tests/core/make_block_generator.py +3 -4
- chia/_tests/core/mempool/test_mempool.py +36 -86
- chia/_tests/core/mempool/test_mempool_fee_estimator.py +1 -1
- chia/_tests/core/mempool/test_mempool_item_queries.py +1 -3
- chia/_tests/core/mempool/test_mempool_manager.py +421 -69
- chia/_tests/core/mempool/test_mempool_performance.py +3 -2
- chia/_tests/core/mempool/test_singleton_fast_forward.py +60 -131
- chia/_tests/core/server/flood.py +1 -1
- chia/_tests/core/server/test_dos.py +1 -1
- chia/_tests/core/server/test_node_discovery.py +41 -27
- chia/_tests/core/server/test_rate_limits.py +1 -1
- chia/_tests/core/server/test_server.py +1 -1
- chia/_tests/core/services/test_services.py +5 -5
- chia/_tests/core/ssl/test_ssl.py +1 -1
- chia/_tests/core/test_cost_calculation.py +6 -6
- chia/_tests/core/test_crawler.py +2 -2
- chia/_tests/core/test_crawler_rpc.py +1 -1
- chia/_tests/core/test_db_conversion.py +3 -1
- chia/_tests/core/test_db_validation.py +5 -3
- chia/_tests/core/test_farmer_harvester_rpc.py +15 -15
- chia/_tests/core/test_filter.py +4 -1
- chia/_tests/core/test_full_node_rpc.py +99 -82
- chia/_tests/core/test_program.py +2 -2
- chia/_tests/core/util/test_block_cache.py +1 -1
- chia/_tests/core/util/test_keychain.py +2 -2
- chia/_tests/core/util/test_lockfile.py +1 -1
- chia/_tests/core/util/test_log_exceptions.py +5 -5
- chia/_tests/core/util/test_streamable.py +81 -22
- chia/_tests/db/test_db_wrapper.py +1 -3
- chia/_tests/environments/wallet.py +5 -5
- chia/_tests/farmer_harvester/test_farmer.py +9 -7
- chia/_tests/farmer_harvester/test_farmer_harvester.py +11 -4
- chia/_tests/farmer_harvester/test_filter_prefix_bits.py +6 -5
- chia/_tests/farmer_harvester/test_third_party_harvesters.py +15 -9
- chia/_tests/fee_estimation/test_fee_estimation_integration.py +1 -2
- chia/_tests/fee_estimation/test_fee_estimation_rpc.py +7 -5
- chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +1 -1
- chia/_tests/generator/test_compression.py +1 -2
- chia/_tests/generator/test_rom.py +8 -4
- chia/_tests/plot_sync/test_plot_sync.py +3 -3
- chia/_tests/plot_sync/test_receiver.py +3 -3
- chia/_tests/plot_sync/test_sender.py +1 -1
- chia/_tests/plot_sync/test_sync_simulated.py +3 -3
- chia/_tests/plot_sync/util.py +2 -2
- chia/_tests/pools/test_pool_cmdline.py +48 -21
- chia/_tests/pools/test_pool_puzzles_lifecycle.py +2 -3
- chia/_tests/pools/test_pool_rpc.py +237 -105
- chia/_tests/pools/test_pool_wallet.py +11 -2
- chia/_tests/pools/test_wallet_pool_store.py +5 -4
- chia/_tests/rpc/test_rpc_client.py +1 -1
- chia/_tests/simulation/test_simulation.py +13 -8
- chia/_tests/simulation/test_simulator.py +2 -2
- chia/_tests/timelord/test_new_peak.py +191 -47
- chia/_tests/timelord/test_timelord.py +1 -1
- chia/_tests/tools/test_full_sync.py +0 -2
- chia/_tests/tools/test_run_block.py +3 -1
- chia/_tests/util/benchmark_cost.py +3 -3
- chia/_tests/util/benchmarks.py +2 -2
- chia/_tests/util/blockchain.py +11 -5
- chia/_tests/util/blockchain_mock.py +1 -4
- chia/_tests/util/coin_store.py +29 -0
- chia/_tests/util/constants.py +2 -18
- chia/_tests/util/full_sync.py +3 -3
- chia/_tests/util/generator_tools_testing.py +2 -3
- chia/_tests/util/key_tool.py +2 -3
- chia/_tests/util/misc.py +33 -31
- chia/_tests/util/network_protocol_data.py +19 -17
- chia/_tests/util/protocol_messages_bytes-v1.0 +0 -0
- chia/_tests/util/protocol_messages_json.py +3 -1
- chia/_tests/util/run_block.py +2 -2
- chia/_tests/util/setup_nodes.py +7 -7
- chia/_tests/util/spend_sim.py +47 -55
- chia/_tests/util/test_condition_tools.py +5 -4
- chia/_tests/util/test_config.py +2 -2
- chia/_tests/util/test_dump_keyring.py +1 -1
- chia/_tests/util/test_full_block_utils.py +12 -14
- chia/_tests/util/test_misc.py +2 -2
- chia/_tests/util/test_paginator.py +4 -4
- chia/_tests/util/test_priority_mutex.py +2 -2
- chia/_tests/util/test_replace_str_to_bytes.py +15 -5
- chia/_tests/util/test_ssl_check.py +1 -1
- chia/_tests/util/test_testnet_overrides.py +13 -3
- chia/_tests/util/time_out_assert.py +4 -2
- chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +1 -1
- chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +1 -2
- chia/_tests/wallet/cat_wallet/test_cat_wallet.py +352 -432
- chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +3 -6
- chia/_tests/wallet/cat_wallet/test_trades.py +53 -77
- chia/_tests/wallet/clawback/test_clawback_decorator.py +3 -1
- chia/_tests/wallet/clawback/test_clawback_lifecycle.py +3 -3
- chia/_tests/wallet/clawback/test_clawback_metadata.py +4 -2
- chia/_tests/wallet/conftest.py +11 -12
- chia/_tests/wallet/db_wallet/test_db_graftroot.py +11 -4
- chia/_tests/wallet/db_wallet/test_dl_offers.py +433 -130
- chia/_tests/wallet/db_wallet/test_dl_wallet.py +3 -3
- chia/_tests/wallet/did_wallet/test_did.py +2132 -2000
- chia/_tests/wallet/nft_wallet/config.py +1 -1
- chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +1610 -742
- chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +486 -907
- chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +4 -4
- chia/_tests/wallet/nft_wallet/test_nft_wallet.py +517 -294
- chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +133 -62
- chia/_tests/wallet/rpc/test_wallet_rpc.py +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 +143 -124
- chia/{types → full_node}/eligible_coin_spends.py +39 -70
- chia/full_node/fee_estimator.py +1 -1
- chia/full_node/fee_estimator_interface.py +0 -8
- chia/full_node/fee_tracker.py +25 -25
- chia/full_node/full_node.py +70 -53
- chia/full_node/full_node_api.py +57 -40
- chia/{rpc → full_node}/full_node_rpc_api.py +87 -8
- chia/{rpc → full_node}/full_node_rpc_client.py +7 -6
- chia/full_node/full_node_store.py +23 -8
- chia/full_node/mempool.py +206 -53
- chia/full_node/mempool_check_conditions.py +20 -63
- chia/full_node/mempool_manager.py +26 -40
- chia/full_node/subscriptions.py +1 -3
- chia/full_node/tx_processing_queue.py +50 -3
- chia/full_node/weight_proof.py +46 -37
- chia/harvester/harvester.py +1 -1
- chia/harvester/harvester_api.py +22 -7
- chia/introducer/introducer.py +1 -1
- chia/introducer/introducer_api.py +1 -1
- chia/plot_sync/exceptions.py +1 -1
- chia/plot_sync/receiver.py +1 -1
- chia/plot_sync/sender.py +2 -2
- chia/pools/pool_puzzles.py +13 -18
- chia/pools/pool_wallet.py +23 -46
- chia/protocols/farmer_protocol.py +11 -3
- chia/protocols/full_node_protocol.py +1 -4
- chia/protocols/harvester_protocol.py +3 -3
- chia/protocols/pool_protocol.py +1 -2
- chia/protocols/shared_protocol.py +3 -3
- chia/protocols/timelord_protocol.py +1 -3
- chia/protocols/wallet_protocol.py +3 -3
- chia/rpc/rpc_client.py +7 -8
- chia/rpc/rpc_server.py +3 -3
- chia/rpc/util.py +3 -1
- chia/seeder/crawler.py +1 -1
- chia/seeder/crawler_api.py +1 -1
- chia/seeder/dns_server.py +2 -0
- chia/seeder/start_crawler.py +3 -3
- chia/server/address_manager.py +286 -38
- chia/server/address_manager_store.py +0 -215
- chia/{types → server}/aliases.py +7 -7
- chia/server/api_protocol.py +1 -1
- chia/server/chia_policy.py +1 -1
- chia/server/node_discovery.py +76 -113
- chia/server/rate_limits.py +1 -1
- chia/server/resolve_peer_info.py +43 -0
- chia/server/server.py +5 -5
- chia/server/start_data_layer.py +4 -4
- chia/server/start_farmer.py +5 -4
- chia/server/start_full_node.py +5 -4
- chia/server/start_harvester.py +7 -5
- chia/server/start_introducer.py +2 -2
- chia/server/start_service.py +1 -1
- chia/server/start_timelord.py +7 -5
- chia/server/start_wallet.py +7 -5
- chia/server/ws_connection.py +1 -1
- chia/simulator/add_blocks_in_batches.py +2 -2
- chia/simulator/block_tools.py +245 -201
- chia/simulator/full_node_simulator.py +38 -10
- chia/simulator/setup_services.py +12 -12
- chia/simulator/simulator_full_node_rpc_api.py +2 -2
- chia/simulator/simulator_full_node_rpc_client.py +2 -2
- chia/simulator/simulator_test_tools.py +2 -2
- chia/simulator/start_simulator.py +1 -1
- chia/simulator/wallet_tools.py +10 -18
- chia/ssl/create_ssl.py +1 -1
- chia/timelord/iters_from_block.py +14 -14
- chia/timelord/timelord.py +15 -11
- chia/timelord/timelord_api.py +14 -2
- chia/timelord/timelord_state.py +20 -14
- chia/types/blockchain_format/program.py +53 -10
- chia/types/blockchain_format/proof_of_space.py +73 -19
- chia/types/coin_spend.py +3 -56
- chia/types/generator_types.py +28 -0
- chia/types/internal_mempool_item.py +1 -2
- chia/types/mempool_item.py +12 -7
- chia/types/unfinished_header_block.py +1 -2
- chia/types/validation_state.py +1 -2
- chia/types/weight_proof.py +1 -3
- chia/util/action_scope.py +3 -3
- chia/util/block_cache.py +1 -2
- chia/util/byte_types.py +1 -1
- chia/util/casts.py +21 -0
- chia/util/config.py +0 -37
- chia/util/db_wrapper.py +8 -1
- chia/util/errors.py +3 -2
- chia/util/initial-config.yaml +21 -5
- chia/util/keychain.py +6 -7
- chia/util/keyring_wrapper.py +5 -5
- chia/util/limited_semaphore.py +1 -1
- chia/util/priority_mutex.py +1 -1
- chia/util/streamable.py +63 -5
- chia/util/task_timing.py +1 -1
- chia/util/virtual_project_analysis.py +1 -1
- chia/wallet/cat_wallet/cat_info.py +7 -3
- chia/wallet/cat_wallet/cat_outer_puzzle.py +9 -5
- chia/wallet/cat_wallet/cat_utils.py +1 -1
- chia/wallet/cat_wallet/cat_wallet.py +44 -36
- chia/wallet/cat_wallet/lineage_store.py +7 -0
- chia/wallet/cat_wallet/r_cat_wallet.py +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.5rc2.dist-info}/METADATA +7 -7
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc2.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.5rc2.dist-info}/LICENSE +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc2.dist-info}/WHEEL +0 -0
- {chia_blockchain-2.5.4rc2.dist-info → chia_blockchain-2.5.5rc2.dist-info}/entry_points.txt +0 -0
|
@@ -7,16 +7,15 @@ import re
|
|
|
7
7
|
import time
|
|
8
8
|
from typing import TYPE_CHECKING, Any, ClassVar, Optional, cast
|
|
9
9
|
|
|
10
|
-
from chia_rs import AugSchemeMPL, G1Element, G2Element
|
|
10
|
+
from chia_rs import AugSchemeMPL, CoinSpend, CoinState, G1Element, G2Element
|
|
11
11
|
from chia_rs.sized_bytes import bytes32
|
|
12
12
|
from chia_rs.sized_ints import uint16, uint32, uint64, uint128
|
|
13
13
|
from typing_extensions import Unpack
|
|
14
14
|
|
|
15
|
-
from chia.protocols.wallet_protocol import CoinState
|
|
16
15
|
from chia.server.ws_connection import WSChiaConnection
|
|
17
16
|
from chia.types.blockchain_format.coin import Coin
|
|
18
17
|
from chia.types.blockchain_format.program import Program
|
|
19
|
-
from chia.types.coin_spend import
|
|
18
|
+
from chia.types.coin_spend import make_spend
|
|
20
19
|
from chia.types.signing_mode import CHIP_0002_SIGN_MESSAGE_PREFIX, SigningMode
|
|
21
20
|
from chia.wallet.conditions import (
|
|
22
21
|
AssertCoinAnnouncement,
|
|
@@ -28,7 +27,7 @@ from chia.wallet.conditions import (
|
|
|
28
27
|
)
|
|
29
28
|
from chia.wallet.derivation_record import DerivationRecord
|
|
30
29
|
from chia.wallet.did_wallet import did_wallet_puzzles
|
|
31
|
-
from chia.wallet.did_wallet.did_info import DIDCoinData, DIDInfo
|
|
30
|
+
from chia.wallet.did_wallet.did_info import DIDCoinData, DIDInfo, did_recovery_is_nil
|
|
32
31
|
from chia.wallet.did_wallet.did_wallet_puzzles import match_did_puzzle, uncurry_innerpuz
|
|
33
32
|
from chia.wallet.lineage_proof import LineageProof
|
|
34
33
|
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import (
|
|
@@ -48,6 +47,7 @@ from chia.wallet.uncurried_puzzle import uncurry_puzzle
|
|
|
48
47
|
from chia.wallet.util.compute_memos import compute_memos
|
|
49
48
|
from chia.wallet.util.curry_and_treehash import NIL_TREEHASH, shatree_int, shatree_pair
|
|
50
49
|
from chia.wallet.util.transaction_type import TransactionType
|
|
50
|
+
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG
|
|
51
51
|
from chia.wallet.util.wallet_sync_utils import fetch_coin_spend, fetch_coin_spend_for_coin_state
|
|
52
52
|
from chia.wallet.util.wallet_types import WalletType
|
|
53
53
|
from chia.wallet.wallet import Wallet
|
|
@@ -228,7 +228,7 @@ class DIDWallet:
|
|
|
228
228
|
inner_solution: Program = full_solution.rest().rest().first()
|
|
229
229
|
recovery_list: list[bytes32] = []
|
|
230
230
|
backup_required: int = num_verification.as_int()
|
|
231
|
-
if recovery_list_hash
|
|
231
|
+
if not did_recovery_is_nil(recovery_list_hash):
|
|
232
232
|
try:
|
|
233
233
|
for did in inner_solution.rest().rest().rest().rest().rest().as_python():
|
|
234
234
|
recovery_list.append(bytes32(did[0]))
|
|
@@ -386,7 +386,9 @@ class DIDWallet:
|
|
|
386
386
|
p2_puzzle, recovery_list_hash, num_verification, singleton_struct, metadata = did_curried_args
|
|
387
387
|
did_data = DIDCoinData(
|
|
388
388
|
p2_puzzle=p2_puzzle,
|
|
389
|
-
recovery_list_hash=bytes32(recovery_list_hash.as_atom())
|
|
389
|
+
recovery_list_hash=bytes32(recovery_list_hash.as_atom())
|
|
390
|
+
if recovery_list_hash != Program.to(None)
|
|
391
|
+
else None,
|
|
390
392
|
num_verification=uint16(num_verification.as_int()),
|
|
391
393
|
singleton_struct=singleton_struct,
|
|
392
394
|
metadata=metadata,
|
|
@@ -415,8 +417,10 @@ class DIDWallet:
|
|
|
415
417
|
if not self._coin_is_first_singleton(coin):
|
|
416
418
|
full_puzzle = create_singleton_puzzle(inner_puzzle, self.did_info.origin_coin.name())
|
|
417
419
|
assert full_puzzle.get_tree_hash() == coin.puzzle_hash
|
|
420
|
+
|
|
418
421
|
if self.did_info.temp_coin is not None:
|
|
419
422
|
self.wallet_state_manager.state_changed("did_coin_added", self.wallet_info.id)
|
|
423
|
+
|
|
420
424
|
new_info = DIDInfo(
|
|
421
425
|
origin_coin=self.did_info.origin_coin,
|
|
422
426
|
backup_ids=self.did_info.backup_ids,
|
|
@@ -467,63 +471,67 @@ class DIDWallet:
|
|
|
467
471
|
# full_puz = did_wallet_puzzles.create_fullpuz(innerpuz, origin.name())
|
|
468
472
|
# All additions in this block here:
|
|
469
473
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
recovery_list=did_info.backup_ids,
|
|
478
|
-
num_of_backup_ids_needed=did_info.num_of_backup_ids_needed,
|
|
479
|
-
launcher_id=did_info.origin_coin.name(),
|
|
480
|
-
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
481
|
-
)
|
|
482
|
-
wallet_node = self.wallet_state_manager.wallet_node
|
|
483
|
-
parent_coin: Coin = did_info.origin_coin
|
|
484
|
-
while True:
|
|
485
|
-
peer = wallet_node.get_full_node_peer()
|
|
486
|
-
children = await wallet_node.fetch_children(parent_coin.name(), peer)
|
|
487
|
-
if len(children) == 0:
|
|
488
|
-
break
|
|
489
|
-
|
|
490
|
-
children_state: CoinState = children[0]
|
|
491
|
-
child_coin = children_state.coin
|
|
474
|
+
async with self.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
|
|
475
|
+
new_puzhash = await action_scope.get_puzzle_hash(
|
|
476
|
+
self.wallet_state_manager, override_reuse_puzhash_with=True
|
|
477
|
+
)
|
|
478
|
+
new_pubkey = await self.wallet_state_manager.get_public_key(new_puzhash)
|
|
479
|
+
parent_info = None
|
|
480
|
+
assert did_info.origin_coin is not None
|
|
492
481
|
assert did_info.current_inner is not None
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
482
|
+
new_did_inner_puzhash = did_wallet_puzzles.get_inner_puzhash_by_p2(
|
|
483
|
+
p2_puzhash=new_puzhash,
|
|
484
|
+
recovery_list=did_info.backup_ids,
|
|
485
|
+
num_of_backup_ids_needed=did_info.num_of_backup_ids_needed,
|
|
486
|
+
launcher_id=did_info.origin_coin.name(),
|
|
487
|
+
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
488
|
+
recovery_list_hash=self.reset_recovery_list(),
|
|
497
489
|
)
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
current_inner=did_info.current_inner,
|
|
506
|
-
temp_coin=child_coin,
|
|
507
|
-
temp_puzhash=new_did_inner_puzhash,
|
|
508
|
-
temp_pubkey=bytes(new_pubkey),
|
|
509
|
-
sent_recovery_transaction=did_info.sent_recovery_transaction,
|
|
510
|
-
metadata=did_info.metadata,
|
|
511
|
-
)
|
|
490
|
+
wallet_node = self.wallet_state_manager.wallet_node
|
|
491
|
+
parent_coin: Coin = did_info.origin_coin
|
|
492
|
+
while True:
|
|
493
|
+
peer = wallet_node.get_full_node_peer()
|
|
494
|
+
children = await wallet_node.fetch_children(parent_coin.name(), peer)
|
|
495
|
+
if len(children) == 0:
|
|
496
|
+
break
|
|
512
497
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
parent_name=parent_coin.parent_coin_info,
|
|
521
|
-
inner_puzzle_hash=parent_innerpuz.get_tree_hash(),
|
|
522
|
-
amount=uint64(parent_coin.amount),
|
|
498
|
+
children_state: CoinState = children[0]
|
|
499
|
+
child_coin = children_state.coin
|
|
500
|
+
assert did_info.current_inner is not None
|
|
501
|
+
future_parent = LineageProof(
|
|
502
|
+
parent_name=child_coin.parent_coin_info,
|
|
503
|
+
inner_puzzle_hash=did_info.current_inner.get_tree_hash(),
|
|
504
|
+
amount=uint64(child_coin.amount),
|
|
523
505
|
)
|
|
524
|
-
await self.add_parent(child_coin.
|
|
525
|
-
|
|
526
|
-
|
|
506
|
+
await self.add_parent(child_coin.name(), future_parent)
|
|
507
|
+
if children_state.spent_height != children_state.created_height:
|
|
508
|
+
did_info = DIDInfo(
|
|
509
|
+
origin_coin=did_info.origin_coin,
|
|
510
|
+
backup_ids=did_info.backup_ids,
|
|
511
|
+
num_of_backup_ids_needed=did_info.num_of_backup_ids_needed,
|
|
512
|
+
parent_info=self.did_info.parent_info,
|
|
513
|
+
current_inner=did_info.current_inner,
|
|
514
|
+
temp_coin=child_coin,
|
|
515
|
+
temp_puzhash=new_did_inner_puzhash,
|
|
516
|
+
temp_pubkey=bytes(new_pubkey),
|
|
517
|
+
sent_recovery_transaction=did_info.sent_recovery_transaction,
|
|
518
|
+
metadata=did_info.metadata,
|
|
519
|
+
)
|
|
520
|
+
|
|
521
|
+
await self.save_info(did_info)
|
|
522
|
+
assert children_state.created_height
|
|
523
|
+
parent_spend = await fetch_coin_spend(uint32(children_state.created_height), parent_coin, peer)
|
|
524
|
+
assert parent_spend is not None
|
|
525
|
+
parent_innerpuz = get_inner_puzzle_from_singleton(parent_spend.puzzle_reveal)
|
|
526
|
+
assert parent_innerpuz is not None
|
|
527
|
+
parent_info = LineageProof(
|
|
528
|
+
parent_name=parent_coin.parent_coin_info,
|
|
529
|
+
inner_puzzle_hash=parent_innerpuz.get_tree_hash(),
|
|
530
|
+
amount=uint64(parent_coin.amount),
|
|
531
|
+
)
|
|
532
|
+
await self.add_parent(child_coin.parent_coin_info, parent_info)
|
|
533
|
+
parent_coin = child_coin
|
|
534
|
+
assert parent_info is not None
|
|
527
535
|
|
|
528
536
|
def puzzle_for_pk(self, pubkey: G1Element) -> Program:
|
|
529
537
|
if self.did_info.origin_coin is not None:
|
|
@@ -533,6 +541,7 @@ class DIDWallet:
|
|
|
533
541
|
num_of_backup_ids_needed=self.did_info.num_of_backup_ids_needed,
|
|
534
542
|
launcher_id=self.did_info.origin_coin.name(),
|
|
535
543
|
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
544
|
+
recovery_list_hash=self.reset_recovery_list(),
|
|
536
545
|
)
|
|
537
546
|
return create_singleton_puzzle(innerpuz, self.did_info.origin_coin.name())
|
|
538
547
|
else:
|
|
@@ -552,6 +561,7 @@ class DIDWallet:
|
|
|
552
561
|
num_of_backup_ids_needed=self.did_info.num_of_backup_ids_needed,
|
|
553
562
|
launcher_id=origin_coin_name,
|
|
554
563
|
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
564
|
+
recovery_list_hash=self.reset_recovery_list(),
|
|
555
565
|
)
|
|
556
566
|
return create_singleton_puzzle_hash(innerpuz_hash, origin_coin_name)
|
|
557
567
|
|
|
@@ -566,7 +576,7 @@ class DIDWallet:
|
|
|
566
576
|
self.wallet_info = new_info
|
|
567
577
|
await self.wallet_state_manager.user_store.update_wallet(self.wallet_info)
|
|
568
578
|
|
|
569
|
-
def get_name(self):
|
|
579
|
+
def get_name(self) -> str:
|
|
570
580
|
return self.wallet_info.name
|
|
571
581
|
|
|
572
582
|
async def create_update_spend(
|
|
@@ -578,7 +588,7 @@ class DIDWallet:
|
|
|
578
588
|
assert self.did_info.current_inner is not None
|
|
579
589
|
assert self.did_info.origin_coin is not None
|
|
580
590
|
coin = await self.get_coin()
|
|
581
|
-
new_inner_puzzle = await self.get_did_innerpuz(
|
|
591
|
+
new_inner_puzzle = await self.get_did_innerpuz(action_scope)
|
|
582
592
|
uncurried = did_wallet_puzzles.uncurry_innerpuz(new_inner_puzzle)
|
|
583
593
|
assert uncurried is not None
|
|
584
594
|
p2_puzzle = uncurried[0]
|
|
@@ -646,7 +656,9 @@ class DIDWallet:
|
|
|
646
656
|
did_record = TransactionRecord(
|
|
647
657
|
confirmed_at_height=uint32(0),
|
|
648
658
|
created_at_time=uint64(int(time.time())),
|
|
649
|
-
to_puzzle_hash=await
|
|
659
|
+
to_puzzle_hash=await action_scope.get_puzzle_hash(
|
|
660
|
+
self.wallet_state_manager, override_reuse_puzhash_with=True
|
|
661
|
+
),
|
|
650
662
|
amount=uint64(coin.amount),
|
|
651
663
|
fee_amount=uint64(0),
|
|
652
664
|
confirmed=False,
|
|
@@ -695,6 +707,7 @@ class DIDWallet:
|
|
|
695
707
|
num_of_backup_ids_needed=backup_required,
|
|
696
708
|
launcher_id=self.did_info.origin_coin.name(),
|
|
697
709
|
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
710
|
+
recovery_list_hash=self.reset_recovery_list(),
|
|
698
711
|
)
|
|
699
712
|
p2_solution = self.standard_wallet.make_solution(
|
|
700
713
|
primaries=[CreateCoin(new_did_puzhash, uint64(coin.amount), [new_puzhash])],
|
|
@@ -737,7 +750,9 @@ class DIDWallet:
|
|
|
737
750
|
did_record = TransactionRecord(
|
|
738
751
|
confirmed_at_height=uint32(0),
|
|
739
752
|
created_at_time=uint64(int(time.time())),
|
|
740
|
-
to_puzzle_hash=await
|
|
753
|
+
to_puzzle_hash=await action_scope.get_puzzle_hash(
|
|
754
|
+
self.wallet_state_manager, override_reuse_puzhash_with=True
|
|
755
|
+
),
|
|
741
756
|
amount=uint64(coin.amount),
|
|
742
757
|
fee_amount=fee,
|
|
743
758
|
confirmed=False,
|
|
@@ -776,20 +791,16 @@ class DIDWallet:
|
|
|
776
791
|
)
|
|
777
792
|
uncurried = did_wallet_puzzles.uncurry_innerpuz(innerpuz)
|
|
778
793
|
assert uncurried is not None
|
|
779
|
-
|
|
794
|
+
_p2_puzzle, id_list_hash, num_of_backup_ids_needed, _, metadata = uncurried
|
|
780
795
|
# Quote message puzzle & solution
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
p2_ph
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
num_of_backup_ids_needed=uint64(num_of_backup_ids_needed.as_int()),
|
|
790
|
-
launcher_id=self.did_info.origin_coin.name(),
|
|
791
|
-
metadata=metadata,
|
|
792
|
-
)
|
|
796
|
+
p2_ph = await action_scope.get_puzzle_hash(self.wallet_state_manager)
|
|
797
|
+
new_innerpuzzle_hash = did_wallet_puzzles.get_inner_puzhash_by_p2(
|
|
798
|
+
p2_puzhash=p2_ph,
|
|
799
|
+
recovery_list_hash=id_list_hash,
|
|
800
|
+
num_of_backup_ids_needed=uint64(num_of_backup_ids_needed.as_int()),
|
|
801
|
+
launcher_id=self.did_info.origin_coin.name(),
|
|
802
|
+
metadata=metadata,
|
|
803
|
+
)
|
|
793
804
|
p2_solution = self.standard_wallet.make_solution(
|
|
794
805
|
primaries=[CreateCoin(puzzle_hash=new_innerpuzzle_hash, amount=uint64(coin.amount), memos=[p2_ph])],
|
|
795
806
|
conditions=extra_conditions,
|
|
@@ -876,7 +887,9 @@ class DIDWallet:
|
|
|
876
887
|
TransactionRecord(
|
|
877
888
|
confirmed_at_height=uint32(0),
|
|
878
889
|
created_at_time=uint64(int(time.time())),
|
|
879
|
-
to_puzzle_hash=await
|
|
890
|
+
to_puzzle_hash=await action_scope.get_puzzle_hash(
|
|
891
|
+
self.wallet_state_manager, override_reuse_puzhash_with=True
|
|
892
|
+
),
|
|
880
893
|
amount=uint64(coin.amount),
|
|
881
894
|
fee_amount=uint64(0),
|
|
882
895
|
confirmed=False,
|
|
@@ -959,7 +972,9 @@ class DIDWallet:
|
|
|
959
972
|
did_record = TransactionRecord(
|
|
960
973
|
confirmed_at_height=uint32(0),
|
|
961
974
|
created_at_time=uint64(int(time.time())),
|
|
962
|
-
to_puzzle_hash=await
|
|
975
|
+
to_puzzle_hash=await action_scope.get_puzzle_hash(
|
|
976
|
+
self.wallet_state_manager, override_reuse_puzhash_with=True
|
|
977
|
+
),
|
|
963
978
|
amount=uint64(coin.amount),
|
|
964
979
|
fee_amount=uint64(0),
|
|
965
980
|
confirmed=False,
|
|
@@ -1076,7 +1091,9 @@ class DIDWallet:
|
|
|
1076
1091
|
TransactionRecord(
|
|
1077
1092
|
confirmed_at_height=uint32(0),
|
|
1078
1093
|
created_at_time=uint64(int(time.time())),
|
|
1079
|
-
to_puzzle_hash=await
|
|
1094
|
+
to_puzzle_hash=await action_scope.get_puzzle_hash(
|
|
1095
|
+
self.wallet_state_manager, override_reuse_puzhash_with=True
|
|
1096
|
+
),
|
|
1080
1097
|
amount=uint64(coin.amount),
|
|
1081
1098
|
fee_amount=uint64(0),
|
|
1082
1099
|
confirmed=False,
|
|
@@ -1107,31 +1124,30 @@ class DIDWallet:
|
|
|
1107
1124
|
)
|
|
1108
1125
|
await self.save_info(new_did_info)
|
|
1109
1126
|
|
|
1110
|
-
async def
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
async def get_did_innerpuz(self, new: bool, origin_id: Optional[bytes32] = None) -> Program:
|
|
1127
|
+
async def get_did_innerpuz(
|
|
1128
|
+
self,
|
|
1129
|
+
action_scope: WalletActionScope,
|
|
1130
|
+
origin_id: Optional[bytes32] = None,
|
|
1131
|
+
override_reuse_puzhash_with: Optional[bool] = None,
|
|
1132
|
+
) -> Program:
|
|
1117
1133
|
if self.did_info.origin_coin is not None:
|
|
1118
1134
|
launcher_id = self.did_info.origin_coin.name()
|
|
1119
1135
|
elif origin_id is not None:
|
|
1120
1136
|
launcher_id = origin_id
|
|
1121
1137
|
else:
|
|
1122
1138
|
raise ValueError("must have origin coin")
|
|
1139
|
+
|
|
1123
1140
|
return did_wallet_puzzles.create_innerpuz(
|
|
1124
|
-
p2_puzzle_or_hash=await
|
|
1141
|
+
p2_puzzle_or_hash=await action_scope.get_puzzle(
|
|
1142
|
+
self.wallet_state_manager, override_reuse_puzhash_with=override_reuse_puzhash_with
|
|
1143
|
+
),
|
|
1125
1144
|
recovery_list=self.did_info.backup_ids,
|
|
1126
1145
|
num_of_backup_ids_needed=self.did_info.num_of_backup_ids_needed,
|
|
1127
1146
|
launcher_id=launcher_id,
|
|
1128
1147
|
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
1148
|
+
recovery_list_hash=self.reset_recovery_list(),
|
|
1129
1149
|
)
|
|
1130
1150
|
|
|
1131
|
-
async def get_did_inner_hash(self, new: bool) -> bytes32:
|
|
1132
|
-
innerpuz = await self.get_did_innerpuz(new=new)
|
|
1133
|
-
return innerpuz.get_tree_hash()
|
|
1134
|
-
|
|
1135
1151
|
async def get_innerpuz_for_new_innerhash(self, pubkey: G1Element):
|
|
1136
1152
|
"""
|
|
1137
1153
|
Get the inner puzzle for a new owner
|
|
@@ -1147,6 +1163,7 @@ class DIDWallet:
|
|
|
1147
1163
|
num_of_backup_ids_needed=uint64(self.did_info.num_of_backup_ids_needed),
|
|
1148
1164
|
launcher_id=self.did_info.origin_coin.name(),
|
|
1149
1165
|
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
1166
|
+
recovery_list_hash=self.reset_recovery_list(),
|
|
1150
1167
|
)
|
|
1151
1168
|
|
|
1152
1169
|
async def inner_puzzle_for_did_puzzle(self, did_hash: bytes32) -> Program:
|
|
@@ -1157,15 +1174,11 @@ class DIDWallet:
|
|
|
1157
1174
|
assert self.did_info.current_inner is not None
|
|
1158
1175
|
uncurried_args = uncurry_innerpuz(self.did_info.current_inner)
|
|
1159
1176
|
assert uncurried_args is not None
|
|
1160
|
-
|
|
1161
|
-
p2_puzzle, old_recovery_list_hash, _, _, _ = uncurried_args
|
|
1177
|
+
p2_puzzle, _, _, _, _ = uncurried_args
|
|
1162
1178
|
if record is None:
|
|
1163
1179
|
record = await self.wallet_state_manager.puzzle_store.get_derivation_record_for_puzzle_hash(
|
|
1164
1180
|
p2_puzzle.get_tree_hash()
|
|
1165
1181
|
)
|
|
1166
|
-
if not (self.did_info.num_of_backup_ids_needed > 0 and len(self.did_info.backup_ids) == 0):
|
|
1167
|
-
# We have the recovery list, don't reset it
|
|
1168
|
-
old_recovery_list_hash = None
|
|
1169
1182
|
|
|
1170
1183
|
inner_puzzle: Program = did_wallet_puzzles.create_innerpuz(
|
|
1171
1184
|
p2_puzzle_or_hash=puzzle_for_pk(record.pubkey),
|
|
@@ -1173,10 +1186,27 @@ class DIDWallet:
|
|
|
1173
1186
|
num_of_backup_ids_needed=self.did_info.num_of_backup_ids_needed,
|
|
1174
1187
|
launcher_id=self.did_info.origin_coin.name(),
|
|
1175
1188
|
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
1176
|
-
recovery_list_hash=
|
|
1189
|
+
recovery_list_hash=self.reset_recovery_list(),
|
|
1177
1190
|
)
|
|
1178
1191
|
return inner_puzzle
|
|
1179
1192
|
|
|
1193
|
+
def reset_recovery_list(self) -> Optional[Program]:
|
|
1194
|
+
if self.did_info.current_inner is None:
|
|
1195
|
+
return None
|
|
1196
|
+
|
|
1197
|
+
uncurried_args = uncurry_innerpuz(self.did_info.current_inner)
|
|
1198
|
+
if uncurried_args is None:
|
|
1199
|
+
return None
|
|
1200
|
+
|
|
1201
|
+
_, og_recovery_list_hash, _, _, _ = uncurried_args
|
|
1202
|
+
if self.did_info.num_of_backup_ids_needed == 0 and not did_recovery_is_nil(og_recovery_list_hash):
|
|
1203
|
+
return None
|
|
1204
|
+
|
|
1205
|
+
if len(self.did_info.backup_ids) > 0:
|
|
1206
|
+
return None
|
|
1207
|
+
|
|
1208
|
+
return og_recovery_list_hash
|
|
1209
|
+
|
|
1180
1210
|
def get_parent_for_coin(self, coin) -> Optional[LineageProof]:
|
|
1181
1211
|
parent_info = None
|
|
1182
1212
|
for name, ccparent in self.did_info.parent_info:
|
|
@@ -1224,9 +1254,7 @@ class DIDWallet:
|
|
|
1224
1254
|
genesis_launcher_puz = SINGLETON_LAUNCHER_PUZZLE
|
|
1225
1255
|
launcher_coin = Coin(origin.name(), genesis_launcher_puz.get_tree_hash(), amount)
|
|
1226
1256
|
|
|
1227
|
-
did_inner: Program = await self.get_did_innerpuz(
|
|
1228
|
-
new=not action_scope.config.tx_config.reuse_puzhash, origin_id=launcher_coin.name()
|
|
1229
|
-
)
|
|
1257
|
+
did_inner: Program = await self.get_did_innerpuz(action_scope, origin_id=launcher_coin.name())
|
|
1230
1258
|
did_inner_hash = did_inner.get_tree_hash()
|
|
1231
1259
|
did_full_puz = create_singleton_puzzle(did_inner, launcher_coin.name())
|
|
1232
1260
|
did_puzzle_hash = did_full_puz.get_tree_hash()
|
|
@@ -1287,7 +1315,9 @@ class DIDWallet:
|
|
|
1287
1315
|
confirmed_at_height=uint32(0),
|
|
1288
1316
|
created_at_time=uint64(int(time.time())),
|
|
1289
1317
|
amount=uint64(amount),
|
|
1290
|
-
to_puzzle_hash=await
|
|
1318
|
+
to_puzzle_hash=await action_scope.get_puzzle_hash(
|
|
1319
|
+
self.wallet_state_manager, override_reuse_puzhash_with=True
|
|
1320
|
+
),
|
|
1291
1321
|
fee_amount=fee,
|
|
1292
1322
|
confirmed=False,
|
|
1293
1323
|
sent=uint32(0),
|
|
@@ -1496,6 +1526,7 @@ class DIDWallet:
|
|
|
1496
1526
|
num_of_backup_ids_needed=uint64(self.did_info.num_of_backup_ids_needed),
|
|
1497
1527
|
launcher_id=self.did_info.origin_coin.name(),
|
|
1498
1528
|
metadata=did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)),
|
|
1529
|
+
recovery_list_hash=self.reset_recovery_list(),
|
|
1499
1530
|
),
|
|
1500
1531
|
self.did_info.origin_coin.name(),
|
|
1501
1532
|
).get_tree_hash_precalc(hint)
|
|
@@ -4,13 +4,13 @@ from collections.abc import Iterator
|
|
|
4
4
|
from typing import Optional, Union
|
|
5
5
|
|
|
6
6
|
from chia_puzzles_py.programs import DID_INNERPUZ, DID_INNERPUZ_HASH, NFT_INTERMEDIATE_LAUNCHER
|
|
7
|
-
from chia_rs import G1Element
|
|
7
|
+
from chia_rs import CoinSpend, G1Element
|
|
8
8
|
from chia_rs.sized_bytes import bytes32
|
|
9
9
|
from chia_rs.sized_ints import uint64
|
|
10
10
|
|
|
11
11
|
from chia.types.blockchain_format.coin import Coin
|
|
12
12
|
from chia.types.blockchain_format.program import Program
|
|
13
|
-
from chia.types.coin_spend import
|
|
13
|
+
from chia.types.coin_spend import make_spend
|
|
14
14
|
from chia.types.condition_opcodes import ConditionOpcode
|
|
15
15
|
from chia.wallet.singleton import (
|
|
16
16
|
SINGLETON_LAUNCHER_PUZZLE_HASH,
|
|
@@ -70,7 +70,7 @@ def get_inner_puzhash_by_p2(
|
|
|
70
70
|
launcher_id: bytes32,
|
|
71
71
|
metadata: Program = Program.to([]),
|
|
72
72
|
recovery_list: Optional[list[bytes32]] = None,
|
|
73
|
-
recovery_list_hash: Optional[
|
|
73
|
+
recovery_list_hash: Optional[Program] = None,
|
|
74
74
|
) -> bytes32:
|
|
75
75
|
"""
|
|
76
76
|
Calculate DID inner puzzle hash based on a P2 puzzle hash
|
|
@@ -84,14 +84,14 @@ def get_inner_puzhash_by_p2(
|
|
|
84
84
|
|
|
85
85
|
if recovery_list is None and recovery_list_hash is None:
|
|
86
86
|
raise ValueError("Cannot construct DID inner puzzle without information about recovery list")
|
|
87
|
-
if recovery_list is not None and recovery_list_hash is not None:
|
|
88
|
-
raise ValueError("Must only specify recovery information a single way to construct DID inner puzzle")
|
|
89
87
|
|
|
90
|
-
|
|
88
|
+
# Allow both recovery_list and recovery_list_hash to be provided but
|
|
89
|
+
# in that case the list is ignored and the hash is used
|
|
90
|
+
# this matches the behaviour of create_innerpuz
|
|
91
|
+
if recovery_list_hash is not None:
|
|
92
|
+
backup_ids_hash = recovery_list_hash.as_atom()
|
|
93
|
+
elif recovery_list is not None:
|
|
91
94
|
backup_ids_hash = shatree_atom_list(recovery_list)
|
|
92
|
-
else:
|
|
93
|
-
assert recovery_list_hash is not None
|
|
94
|
-
backup_ids_hash = recovery_list_hash
|
|
95
95
|
|
|
96
96
|
# singleton_struct = (MOD_HASH . (LAUNCHER_ID . LAUNCHER_PUZZLE_HASH))
|
|
97
97
|
singleton_struct = shatree_pair(
|
chia/wallet/driver_protocol.py
CHANGED
|
@@ -13,7 +13,9 @@ from chia.wallet.uncurried_puzzle import UncurriedPuzzle
|
|
|
13
13
|
class DriverProtocol(Protocol):
|
|
14
14
|
def match(self, puzzle: UncurriedPuzzle) -> Optional[PuzzleInfo]: ...
|
|
15
15
|
|
|
16
|
-
def get_inner_puzzle(
|
|
16
|
+
def get_inner_puzzle(
|
|
17
|
+
self, constructor: PuzzleInfo, puzzle_reveal: UncurriedPuzzle, solution: Optional[Program] = ...
|
|
18
|
+
) -> Optional[Program]: ...
|
|
17
19
|
|
|
18
20
|
def get_inner_solution(self, constructor: PuzzleInfo, solution: Program) -> Optional[Program]: ...
|
|
19
21
|
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
|
|
5
|
-
import chia_rs
|
|
3
|
+
from chia_rs import SpendBundle
|
|
6
4
|
|
|
7
5
|
from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
|
8
|
-
from chia.types.coin_spend import compute_additions_with_cost
|
|
9
6
|
from chia.util.errors import Err, ValidationError
|
|
10
|
-
|
|
11
|
-
SpendBundle = chia_rs.SpendBundle
|
|
12
|
-
T_SpendBundle = TypeVar("T_SpendBundle", bound="SpendBundle")
|
|
7
|
+
from chia.wallet.util.compute_additions import compute_additions_with_cost
|
|
13
8
|
|
|
14
9
|
|
|
15
10
|
# This function executes all the puzzles to compute the difference between
|
|
@@ -33,7 +33,7 @@ class MetadataOuterPuzzle:
|
|
|
33
33
|
_match: Callable[[UncurriedPuzzle], Optional[PuzzleInfo]]
|
|
34
34
|
_construct: Callable[[PuzzleInfo, Program], Program]
|
|
35
35
|
_solve: Callable[[PuzzleInfo, Solver, Program, Program], Program]
|
|
36
|
-
_get_inner_puzzle: Callable[[PuzzleInfo, UncurriedPuzzle], Optional[Program]]
|
|
36
|
+
_get_inner_puzzle: Callable[[PuzzleInfo, UncurriedPuzzle, Optional[Program]], Optional[Program]]
|
|
37
37
|
_get_inner_solution: Callable[[PuzzleInfo, Program], Optional[Program]]
|
|
38
38
|
|
|
39
39
|
def match(self, puzzle: UncurriedPuzzle) -> Optional[PuzzleInfo]:
|
|
@@ -62,13 +62,15 @@ class MetadataOuterPuzzle:
|
|
|
62
62
|
inner_puzzle = self._construct(also, inner_puzzle)
|
|
63
63
|
return puzzle_for_metadata_layer(constructor["metadata"], constructor["updater_hash"], inner_puzzle)
|
|
64
64
|
|
|
65
|
-
def get_inner_puzzle(
|
|
65
|
+
def get_inner_puzzle(
|
|
66
|
+
self, constructor: PuzzleInfo, puzzle_reveal: UncurriedPuzzle, solution: Optional[Program] = None
|
|
67
|
+
) -> Optional[Program]:
|
|
66
68
|
matched, curried_args = match_metadata_layer_puzzle(puzzle_reveal)
|
|
67
69
|
if matched:
|
|
68
70
|
_, _, _, inner_puzzle = curried_args
|
|
69
71
|
also = constructor.also()
|
|
70
72
|
if also is not None:
|
|
71
|
-
deep_inner_puzzle: Optional[Program] = self._get_inner_puzzle(also, uncurry_puzzle(inner_puzzle))
|
|
73
|
+
deep_inner_puzzle: Optional[Program] = self._get_inner_puzzle(also, uncurry_puzzle(inner_puzzle), None)
|
|
72
74
|
return deep_inner_puzzle
|
|
73
75
|
else:
|
|
74
76
|
return inner_puzzle
|
|
@@ -228,7 +228,7 @@ def create_ownership_layer_transfer_solution(
|
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
def get_metadata_and_phs(unft: UncurriedNFT, solution: SerializedProgram) -> tuple[Program, bytes32]:
|
|
231
|
-
conditions = unft.p2_puzzle.run(unft.get_innermost_solution(
|
|
231
|
+
conditions = unft.p2_puzzle.run(unft.get_innermost_solution(Program.from_serialized(solution)))
|
|
232
232
|
metadata = unft.metadata
|
|
233
233
|
puzhash_for_derivation: Optional[bytes32] = None
|
|
234
234
|
for condition in conditions.as_iter():
|