From bb8715f3155bb8011a04cc8c05b3fa8133e4c64b Mon Sep 17 00:00:00 2001 From: Flaxseed Date: Fri, 4 Nov 2022 00:00:00 -0700 Subject: [PATCH] Version 0.1.11 --- .coveragerc | 2 +- .github/CODEOWNERS | 1 - .github/ISSUE_TEMPLATE/bug_report.md | 34 + .github/ISSUE_TEMPLATE/bug_report.yaml | 52 - .github/ISSUE_TEMPLATE/config.yml | 10 +- .github/actions/install/action.yml | 2 +- .github/dependabot.yml | 31 - .github/linters/.flake8 | 4 + .github/linters/.isort.cfg | 20 + .github/linters/.markdown-lint.yml | 38 + .github/linters/.python-black | 2 + .github/linters/.python-lint | 564 ++++ .github/workflows/benchmarks.yml | 78 - .../workflows/build-linux-arm64-installer.yml | 136 +- .../workflows/build-linux-installer-deb.yml | 137 +- .../workflows/build-linux-installer-rpm.yml | 142 +- .github/workflows/build-macos-installers.yml | 139 +- .github/workflows/build-windows-installer.yml | 200 +- .../workflows/check_wheel_availability.yaml | 73 - .github/workflows/codeql-analysis.yml | 75 - .github/workflows/conflict-check.yml | 21 - .github/workflows/dependency-review.yml | 20 - .github/workflows/mozilla-ca-cert.yml | 33 - .github/workflows/pre-commit.yml | 74 - .github/workflows/stale-issue.yml | 37 - .github/workflows/start-release.yml | 22 - .github/workflows/super-linter.yml | 85 - .github/workflows/test-install-scripts.yml | 252 -- .github/workflows/test-single.yml | 221 -- .github/workflows/test.yml | 150 - .github/workflows/trigger-docker-dev.yml | 35 - .github/workflows/trigger-docker-main.yml | 21 - .github/workflows/upload-pypi-source.yml | 85 - .gitignore | 14 +- .gitmodules | 8 +- .isort.cfg | 254 +- BUILD_TIMELORD.md | 4 +- CHANGELOG.md | 2531 ----------------- CODE_OF_CONDUCT.md | 2 +- CONTRIBUTING.md | 32 +- INSTALL.md | 4 +- Install-gui.ps1 | 10 +- Install-plotter.ps1 | 16 +- Install.ps1 | 14 +- README.md | 55 +- activated.py | 0 activated.sh | 0 benchmarks/block_ref.py | 18 +- benchmarks/block_store.py | 24 +- benchmarks/clvm_generator.bin | Bin 121543 -> 121543 bytes benchmarks/coin_store.py | 10 +- benchmarks/mempool.py | 26 +- benchmarks/streamable.py | 8 +- benchmarks/utils.py | 28 +- build_scripts/assets/deb/control.j2 | 10 +- build_scripts/assets/deb/postinst.sh | 2 +- build_scripts/assets/deb/prerm.sh | 2 +- build_scripts/assets/rpm/postinst.sh | 2 +- build_scripts/assets/rpm/prerm.sh | 2 +- build_scripts/build_linux_deb-1-gui.sh | 16 +- build_scripts/build_linux_deb-2-installer.sh | 52 +- build_scripts/build_linux_rpm-1-gui.sh | 16 +- build_scripts/build_linux_rpm-2-installer.sh | 48 +- build_scripts/build_macos-1-gui.sh | 16 +- build_scripts/build_macos-2-installer.sh | 38 +- build_scripts/build_windows-1-gui.ps1 | 18 +- build_scripts/build_windows-2-installer.ps1 | 40 +- build_scripts/clean-runner.sh | 12 +- chia-blockchain-gui | 1 - chia/ssl/chia_ca.crt | 19 - chia/ssl/chia_ca.key | 27 - chia/util/default_root.py | 8 - chia/util/service_groups.py | 39 - chia/wallet/cat_wallet/cat_constants.py | 32 - chia/wallet/util/json_clvm_utils.py | 19 - flax-blockchain-gui | 1 + {chia => flax}/__init__.py | 4 +- {chia => flax}/clvm/__init__.py | 0 {chia => flax}/clvm/singleton.py | 2 +- {chia => flax}/clvm/spend_sim.py | 48 +- {chia => flax}/cmds/__init__.py | 0 {chia => flax}/cmds/beta.py | 26 +- {chia => flax}/cmds/beta_funcs.py | 14 +- {chia => flax}/cmds/cmds_util.py | 26 +- {chia => flax}/cmds/configure.py | 20 +- {chia => flax}/cmds/data.py | 36 +- {chia => flax}/cmds/data_funcs.py | 22 +- {chia => flax}/cmds/db.py | 6 +- {chia => flax}/cmds/db_backup_func.py | 4 +- {chia => flax}/cmds/db_upgrade_func.py | 8 +- {chia => flax}/cmds/db_validate_func.py | 12 +- {chia => flax}/cmds/farm.py | 0 {chia => flax}/cmds/farm_funcs.py | 30 +- chia/cmds/chia.py => flax/cmds/flax.py | 62 +- {chia => flax}/cmds/init.py | 20 +- {chia => flax}/cmds/init_funcs.py | 102 +- {chia => flax}/cmds/keys.py | 12 +- {chia => flax}/cmds/keys_funcs.py | 46 +- {chia => flax}/cmds/netspace.py | 0 {chia => flax}/cmds/netspace_funcs.py | 8 +- {chia => flax}/cmds/passphrase.py | 2 +- {chia => flax}/cmds/passphrase_funcs.py | 20 +- {chia => flax}/cmds/peer.py | 4 +- {chia => flax}/cmds/peer_funcs.py | 10 +- {chia => flax}/cmds/plotnft.py | 12 +- {chia => flax}/cmds/plotnft_funcs.py | 46 +- {chia => flax}/cmds/plots.py | 22 +- {chia => flax}/cmds/plotters.py | 2 +- {chia => flax}/cmds/rpc.py | 8 +- {chia => flax}/cmds/show.py | 10 +- {chia => flax}/cmds/show_funcs.py | 22 +- {chia => flax}/cmds/start.py | 6 +- {chia => flax}/cmds/start_funcs.py | 16 +- {chia => flax}/cmds/stop.py | 10 +- {chia => flax}/cmds/units.py | 2 +- {chia => flax}/cmds/wallet.py | 40 +- {chia => flax}/cmds/wallet_funcs.py | 130 +- {chia => flax}/consensus/__init__.py | 0 .../consensus/block_body_validation.py | 48 +- {chia => flax}/consensus/block_creation.py | 48 +- .../consensus/block_header_validation.py | 38 +- {chia => flax}/consensus/block_record.py | 16 +- {chia => flax}/consensus/block_rewards.py | 30 +- .../consensus/block_root_validation.py | 6 +- {chia => flax}/consensus/blockchain.py | 68 +- .../consensus/blockchain_interface.py | 14 +- {chia => flax}/consensus/coinbase.py | 8 +- {chia => flax}/consensus/condition_costs.py | 0 {chia => flax}/consensus/constants.py | 10 +- {chia => flax}/consensus/cost_calculator.py | 6 +- {chia => flax}/consensus/default_constants.py | 12 +- {chia => flax}/consensus/deficit.py | 6 +- .../consensus/difficulty_adjustment.py | 12 +- {chia => flax}/consensus/find_fork_point.py | 6 +- .../consensus/full_block_to_block_record.py | 30 +- .../consensus/get_block_challenge.py | 18 +- .../consensus/make_sub_epoch_summary.py | 20 +- .../consensus/multiprocess_validation.py | 48 +- {chia => flax}/consensus/pos_quality.py | 2 +- {chia => flax}/consensus/pot_iterations.py | 10 +- .../consensus/vdf_info_computation.py | 14 +- {chia => flax}/daemon/__init__.py | 0 {chia => flax}/daemon/client.py | 6 +- {chia => flax}/daemon/keychain_proxy.py | 16 +- {chia => flax}/daemon/keychain_server.py | 10 +- {chia => flax}/daemon/server.py | 100 +- {chia => flax}/daemon/windows_signal.py | 0 {chia => flax}/data_layer/__init__.py | 0 {chia => flax}/data_layer/data_layer.py | 40 +- {chia => flax}/data_layer/data_layer_api.py | 6 +- .../data_layer/data_layer_errors.py | 2 +- .../data_layer/data_layer_server.py | 20 +- {chia => flax}/data_layer/data_layer_util.py | 28 +- .../data_layer/data_layer_wallet.py | 96 +- {chia => flax}/data_layer/data_store.py | 20 +- {chia => flax}/data_layer/dl_wallet_store.py | 12 +- {chia => flax}/data_layer/download_data.py | 6 +- {chia => flax}/data_layer/util/__init__.py | 0 {chia => flax}/data_layer/util/benchmark.py | 6 +- {chia => flax}/farmer/__init__.py | 0 {chia => flax}/farmer/farmer.py | 72 +- {chia => flax}/farmer/farmer_api.py | 50 +- {chia => flax}/full_node/__init__.py | 0 .../full_node/bitcoin_fee_estimator.py | 20 +- {chia => flax}/full_node/block_height_map.py | 12 +- {chia => flax}/full_node/block_store.py | 26 +- {chia => flax}/full_node/bundle_tools.py | 14 +- {chia => flax}/full_node/coin_store.py | 16 +- {chia => flax}/full_node/fee_estimate.py | 6 +- .../full_node/fee_estimate_store.py | 2 +- {chia => flax}/full_node/fee_estimation.py | 12 +- {chia => flax}/full_node/fee_estimator.py | 10 +- .../full_node/fee_estimator_constants.py | 0 .../full_node/fee_estimator_example.py | 14 +- .../full_node/fee_estimator_interface.py | 8 +- {chia => flax}/full_node/fee_history.py | 4 +- {chia => flax}/full_node/fee_tracker.py | 10 +- {chia => flax}/full_node/full_node.py | 192 +- {chia => flax}/full_node/full_node_api.py | 120 +- {chia => flax}/full_node/full_node_store.py | 42 +- {chia => flax}/full_node/generator.py | 18 +- {chia => flax}/full_node/hint_management.py | 8 +- {chia => flax}/full_node/hint_store.py | 4 +- {chia => flax}/full_node/lock_queue.py | 0 {chia => flax}/full_node/mempool.py | 18 +- .../full_node/mempool_check_conditions.py | 34 +- {chia => flax}/full_node/mempool_manager.py | 62 +- {chia => flax}/full_node/pending_tx_cache.py | 4 +- {chia => flax}/full_node/signage_point.py | 4 +- {chia => flax}/full_node/sync_store.py | 4 +- {chia => flax}/full_node/weight_proof.py | 44 +- {chia => flax}/harvester/__init__.py | 0 {chia => flax}/harvester/harvester.py | 26 +- {chia => flax}/harvester/harvester_api.py | 32 +- {chia => flax}/introducer/__init__.py | 0 {chia => flax}/introducer/introducer.py | 20 +- {chia => flax}/introducer/introducer_api.py | 18 +- {chia => flax}/plot_sync/__init__.py | 0 {chia => flax}/plot_sync/delta.py | 2 +- {chia => flax}/plot_sync/exceptions.py | 8 +- {chia => flax}/plot_sync/receiver.py | 22 +- {chia => flax}/plot_sync/sender.py | 20 +- {chia => flax}/plot_sync/util.py | 2 +- {chia => flax}/plotters/__init__.py | 0 {chia => flax}/plotters/bladebit.py | 10 +- {chia => flax}/plotters/chiapos.py | 12 +- {chia => flax}/plotters/madmax.py | 22 +- {chia => flax}/plotters/plotters.py | 28 +- {chia => flax}/plotters/plotters_util.py | 6 +- {chia => flax}/plotting/__init__.py | 0 {chia => flax}/plotting/cache.py | 20 +- {chia => flax}/plotting/check_plots.py | 16 +- {chia => flax}/plotting/create_plots.py | 18 +- {chia => flax}/plotting/manager.py | 8 +- {chia => flax}/plotting/util.py | 8 +- {chia => flax}/pools/__init__.py | 0 {chia => flax}/pools/pool_config.py | 8 +- {chia => flax}/pools/pool_puzzles.py | 24 +- {chia => flax}/pools/pool_wallet.py | 52 +- {chia => flax}/pools/pool_wallet_info.py | 14 +- {chia => flax}/protocols/__init__.py | 0 {chia => flax}/protocols/farmer_protocol.py | 10 +- .../protocols/full_node_protocol.py | 20 +- .../protocols/harvester_protocol.py | 8 +- .../protocols/introducer_protocol.py | 4 +- {chia => flax}/protocols/pool_protocol.py | 8 +- .../protocols/protocol_message_types.py | 0 .../protocols/protocol_state_machine.py | 4 +- {chia => flax}/protocols/protocol_timing.py | 0 {chia => flax}/protocols/shared_protocol.py | 6 +- {chia => flax}/protocols/timelord_protocol.py | 16 +- {chia => flax}/protocols/wallet_protocol.py | 16 +- {chia => flax}/py.typed | 0 {chia => flax}/pyinstaller.spec | 52 +- {chia => flax}/rpc/__init__.py | 0 {chia => flax}/rpc/crawler_rpc_api.py | 8 +- {chia => flax}/rpc/data_layer_rpc_api.py | 26 +- {chia => flax}/rpc/data_layer_rpc_client.py | 6 +- {chia => flax}/rpc/data_layer_rpc_util.py | 0 {chia => flax}/rpc/farmer_rpc_api.py | 22 +- {chia => flax}/rpc/farmer_rpc_client.py | 12 +- {chia => flax}/rpc/full_node_rpc_api.py | 48 +- {chia => flax}/rpc/full_node_rpc_client.py | 28 +- {chia => flax}/rpc/harvester_rpc_api.py | 8 +- {chia => flax}/rpc/harvester_rpc_client.py | 6 +- {chia => flax}/rpc/rpc_client.py | 14 +- {chia => flax}/rpc/rpc_server.py | 34 +- {chia => flax}/rpc/timelord_rpc_api.py | 8 +- {chia => flax}/rpc/util.py | 2 +- {chia => flax}/rpc/wallet_rpc_api.py | 148 +- {chia => flax}/rpc/wallet_rpc_client.py | 38 +- {chia => flax}/seeder/__init__.py | 0 {chia => flax}/seeder/crawl_store.py | 2 +- {chia => flax}/seeder/crawler.py | 36 +- {chia => flax}/seeder/crawler_api.py | 26 +- {chia => flax}/seeder/dns_server.py | 8 +- {chia => flax}/seeder/peer_record.py | 4 +- {chia => flax}/seeder/start_crawler.py | 20 +- {chia => flax}/server/__init__.py | 0 {chia => flax}/server/address_manager.py | 6 +- .../server/address_manager_sqlite_store.py | 4 +- .../server/address_manager_store.py | 8 +- {chia => flax}/server/connection_utils.py | 12 +- {chia => flax}/server/introducer_peers.py | 4 +- {chia => flax}/server/node_discovery.py | 38 +- {chia => flax}/server/outbound_message.py | 6 +- {chia => flax}/server/peer_store_resolver.py | 0 {chia => flax}/server/rate_limit_numbers.py | 6 +- {chia => flax}/server/rate_limits.py | 8 +- {chia => flax}/server/reconnect_task.py | 8 +- {chia => flax}/server/server.py | 74 +- {chia => flax}/server/ssl_context.py | 6 +- {chia => flax}/server/start_data_layer.py | 24 +- {chia => flax}/server/start_farmer.py | 24 +- {chia => flax}/server/start_full_node.py | 26 +- {chia => flax}/server/start_harvester.py | 22 +- {chia => flax}/server/start_introducer.py | 14 +- {chia => flax}/server/start_service.py | 34 +- {chia => flax}/server/start_timelord.py | 22 +- {chia => flax}/server/start_wallet.py | 30 +- {chia => flax}/server/upnp.py | 6 +- {chia => flax}/server/ws_connection.py | 44 +- {chia => flax}/simulator/__init__.py | 0 {chia => flax}/simulator/block_tools.py | 118 +- .../simulator/full_node_simulator.py | 40 +- .../simulator/simulator_constants.py | 4 +- .../simulator/simulator_full_node_rpc_api.py | 16 +- .../simulator_full_node_rpc_client.py | 16 +- .../simulator/simulator_protocol.py | 6 +- .../simulator/simulator_test_tools.py | 78 +- {chia => flax}/simulator/socket.py | 0 {chia => flax}/simulator/ssl_certs.py | 20 +- {chia => flax}/simulator/ssl_certs_1.py | 0 {chia => flax}/simulator/ssl_certs_10.py | 0 {chia => flax}/simulator/ssl_certs_2.py | 0 {chia => flax}/simulator/ssl_certs_3.py | 0 {chia => flax}/simulator/ssl_certs_4.py | 0 {chia => flax}/simulator/ssl_certs_5.py | 0 {chia => flax}/simulator/ssl_certs_6.py | 0 {chia => flax}/simulator/ssl_certs_7.py | 0 {chia => flax}/simulator/ssl_certs_8.py | 0 {chia => flax}/simulator/ssl_certs_9.py | 2 +- {chia => flax}/simulator/start_simulator.py | 24 +- {chia => flax}/simulator/time_out_assert.py | 2 +- {chia => flax}/simulator/wallet_tools.py | 28 +- {chia => flax}/ssl/__init__.py | 0 {chia => flax}/ssl/create_ssl.py | 20 +- {chia => flax}/ssl/dst_root_ca.pem | 0 flax/ssl/flax_ca.crt | 19 + flax/ssl/flax_ca.key | 27 + {chia => flax}/timelord/__init__.py | 0 {chia => flax}/timelord/iters_from_block.py | 8 +- {chia => flax}/timelord/timelord.py | 52 +- {chia => flax}/timelord/timelord_api.py | 8 +- {chia => flax}/timelord/timelord_launcher.py | 12 +- {chia => flax}/timelord/timelord_state.py | 20 +- {chia => flax}/timelord/types.py | 0 {chia => flax}/types/__init__.py | 0 {chia => flax}/types/announcement.py | 4 +- {chia => flax}/types/block_protocol.py | 6 +- .../types/blockchain_format/__init__.py | 0 .../types/blockchain_format/classgroup.py | 6 +- .../types/blockchain_format/coin.py | 6 +- .../types/blockchain_format/foliage.py | 10 +- .../types/blockchain_format/pool_target.py | 6 +- .../types/blockchain_format/program.py | 8 +- .../types/blockchain_format/proof_of_space.py | 10 +- .../blockchain_format/reward_chain_block.py | 10 +- .../types/blockchain_format/sized_bytes.py | 2 +- .../types/blockchain_format/slots.py | 10 +- .../blockchain_format/sub_epoch_summary.py | 6 +- .../types/blockchain_format/tree_hash.py | 4 +- {chia => flax}/types/blockchain_format/vdf.py | 10 +- {chia => flax}/types/clvm_cost.py | 2 +- {chia => flax}/types/coin_record.py | 10 +- {chia => flax}/types/coin_solution.py | 0 {chia => flax}/types/coin_spend.py | 8 +- {chia => flax}/types/condition_opcodes.py | 2 +- {chia => flax}/types/condition_with_args.py | 4 +- {chia => flax}/types/end_of_slot_bundle.py | 4 +- {chia => flax}/types/fee_rate.py | 10 +- {chia => flax}/types/full_block.py | 18 +- {chia => flax}/types/generator_types.py | 6 +- {chia => flax}/types/header_block.py | 10 +- .../types/mempool_inclusion_status.py | 0 {chia => flax}/types/mempool_item.py | 12 +- .../types/mempool_submission_status.py | 6 +- {chia => flax}/types/mojos.py | 2 +- {chia => flax}/types/peer_info.py | 4 +- {chia => flax}/types/spend_bundle.py | 10 +- .../types/spend_bundle_conditions.py | 0 .../types/transaction_queue_entry.py | 8 +- {chia => flax}/types/unfinished_block.py | 14 +- .../types/unfinished_header_block.py | 10 +- {chia => flax}/types/weight_proof.py | 16 +- {chia => flax}/util/__init__.py | 0 {chia => flax}/util/api_decorators.py | 14 +- {chia => flax}/util/bech32m.py | 2 +- {chia => flax}/util/beta_metrics.py | 2 +- {chia => flax}/util/block_cache.py | 14 +- {chia => flax}/util/byte_types.py | 0 {chia => flax}/util/cached_bls.py | 6 +- {chia => flax}/util/chain_utils.py | 10 +- {chia => flax}/util/check_fork_next_block.py | 4 +- {chia => flax}/util/chunks.py | 0 {chia => flax}/util/condition_tools.py | 20 +- {chia => flax}/util/config.py | 6 +- {chia => flax}/util/create_alert_file.py | 6 +- {chia => flax}/util/db_synchronous.py | 0 {chia => flax}/util/db_version.py | 0 {chia => flax}/util/db_wrapper.py | 0 flax/util/default_root.py | 8 + {chia => flax}/util/dump_keyring.py | 8 +- {chia => flax}/util/english.txt | 0 {chia => flax}/util/errors.py | 0 {chia => flax}/util/file_keyring.py | 16 +- {chia => flax}/util/files.py | 0 .../util/flax_logging.py | 8 +- {chia => flax}/util/full_block_utils.py | 10 +- {chia => flax}/util/generator_tools.py | 14 +- {chia => flax}/util/hash.py | 2 +- {chia => flax}/util/initial-config.yaml | 195 +- {chia => flax}/util/inline_executor.py | 0 {chia => flax}/util/ints.py | 2 +- {chia => flax}/util/json_util.py | 2 +- {chia => flax}/util/keychain.py | 14 +- {chia => flax}/util/keyring_wrapper.py | 36 +- {chia => flax}/util/lock.py | 0 {chia => flax}/util/log_exceptions.py | 0 {chia => flax}/util/lru_cache.py | 0 {chia => flax}/util/make_test_constants.py | 4 +- {chia => flax}/util/memory_profiler.py | 2 +- {chia => flax}/util/merkle_set.py | 2 +- {chia => flax}/util/misc.py | 6 +- {chia => flax}/util/network.py | 20 +- {chia => flax}/util/paginator.py | 0 {chia => flax}/util/partial_func.py | 0 {chia => flax}/util/path.py | 0 {chia => flax}/util/permissions.py | 0 {chia => flax}/util/pip_import.py | 0 {chia => flax}/util/prev_transaction_block.py | 6 +- {chia => flax}/util/profiler.py | 12 +- {chia => flax}/util/recursive_replace.py | 0 {chia => flax}/util/safe_cancel_task.py | 0 flax/util/service_groups.py | 39 + {chia => flax}/util/setproctitle.py | 0 {chia => flax}/util/significant_bits.py | 0 {chia => flax}/util/ssl_check.py | 16 +- {chia => flax}/util/streamable.py | 8 +- {chia => flax}/util/struct_stream.py | 0 {chia => flax}/util/task_timing.py | 6 +- {chia => flax}/util/validate_alert.py | 4 +- {chia => flax}/util/vdf_prover.py | 10 +- {chia => flax}/util/ws_message.py | 2 +- {chia => flax}/wallet/__init__.py | 0 {chia => flax}/wallet/block_record.py | 6 +- {chia => flax}/wallet/cat_wallet/__init__.py | 0 flax/wallet/cat_wallet/cat_constants.py | 4 + {chia => flax}/wallet/cat_wallet/cat_info.py | 8 +- .../wallet/cat_wallet/cat_outer_puzzle.py | 20 +- {chia => flax}/wallet/cat_wallet/cat_utils.py | 20 +- .../wallet/cat_wallet/cat_wallet.py | 180 +- .../wallet/cat_wallet/lineage_store.py | 6 +- {chia => flax}/wallet/coin_selection.py | 8 +- {chia => flax}/wallet/db_wallet/__init__.py | 0 .../wallet/db_wallet/db_wallet_puzzles.py | 18 +- {chia => flax}/wallet/derivation_record.py | 6 +- {chia => flax}/wallet/derive_keys.py | 8 +- {chia => flax}/wallet/did_wallet/__init__.py | 0 {chia => flax}/wallet/did_wallet/did_info.py | 12 +- .../wallet/did_wallet/did_wallet.py | 94 +- .../wallet/did_wallet/did_wallet_puzzles.py | 22 +- {chia => flax}/wallet/driver_protocol.py | 8 +- .../chialisp.py => flax/wallet/flaxlisp.py | 0 {chia => flax}/wallet/key_val_store.py | 2 +- {chia => flax}/wallet/lineage_proof.py | 8 +- {chia => flax}/wallet/nft_wallet/__init__.py | 0 .../nft_wallet/metadata_outer_puzzle.py | 14 +- {chia => flax}/wallet/nft_wallet/nft_info.py | 14 +- .../wallet/nft_wallet/nft_puzzles.py | 20 +- .../wallet/nft_wallet/nft_wallet.py | 244 +- .../nft_wallet/ownership_outer_puzzle.py | 10 +- .../nft_wallet/singleton_outer_puzzle.py | 18 +- .../nft_wallet/transfer_program_puzzle.py | 14 +- .../wallet/nft_wallet/uncurry_nft.py | 10 +- {chia => flax}/wallet/notification_manager.py | 30 +- {chia => flax}/wallet/notification_store.py | 6 +- {chia => flax}/wallet/outer_puzzles.py | 20 +- {chia => flax}/wallet/payment.py | 6 +- {chia => flax}/wallet/puzzle_drivers.py | 2 +- {chia => flax}/wallet/puzzles/__init__.py | 0 .../wallet/puzzles/block_program_zero.clvm | 0 .../puzzles/block_program_zero.clvm.hex | 0 .../block_program_zero.clvm.hex.sha256tree | 0 .../calculate_synthetic_public_key.clvm | 0 .../calculate_synthetic_public_key.clvm.hex | 0 ...e_synthetic_public_key.clvm.hex.sha256tree | 0 {chia => flax}/wallet/puzzles/cat_loader.py | 2 +- {chia => flax}/wallet/puzzles/cat_truths.clib | 0 {chia => flax}/wallet/puzzles/cat_v2.clvm | 0 {chia => flax}/wallet/puzzles/cat_v2.clvm.hex | 0 .../wallet/puzzles/cat_v2.clvm.hex.sha256tree | 0 .../wallet/puzzles/condition_codes.clvm | 2 +- .../puzzles/create-lock-puzzlehash.clvm | 0 .../puzzles/create_nft_launcher_from_did.clvm | 0 .../create_nft_launcher_from_did.clvm.hex | 0 ..._nft_launcher_from_did.clvm.hex.sha256tree | 0 .../wallet/puzzles/curry-and-treehash.clinc | 0 .../puzzles/decompress_block_spends.clvm | 2 +- .../puzzles/decompress_block_spends.clvm.hex | 0 ...ecompress_block_spends.clvm.hex.sha256tree | 0 .../wallet/puzzles/decompress_block_spends.py | 2 +- .../puzzles/decompress_coin_spend_entry.clvm | 0 .../decompress_coin_spend_entry.clvm.hex | 0 ...press_coin_spend_entry.clvm.hex.sha256tree | 0 ...compress_coin_spend_entry_with_prefix.clvm | 0 ...ress_coin_spend_entry_with_prefix.clvm.hex | 0 ...pend_entry_with_prefix.clvm.hex.sha256tree | 0 .../wallet/puzzles/decompress_puzzle.clvm | 0 .../wallet/puzzles/decompress_puzzle.clvm.hex | 0 .../decompress_puzzle.clvm.hex.sha256tree | 0 .../wallet/puzzles/delegated_tail.clvm | 0 .../wallet/puzzles/delegated_tail.clvm.hex | 0 .../delegated_tail.clvm.hex.sha256tree | 0 .../wallet/puzzles/did_innerpuz.clvm | 0 .../wallet/puzzles/did_innerpuz.clvm.hex | 0 .../puzzles/did_innerpuz.clvm.hex.sha256tree | 0 .../puzzles/everything_with_signature.clvm | 0 .../everything_with_signature.clvm.hex | 0 ...rything_with_signature.clvm.hex.sha256tree | 0 .../puzzles/flaxlisp_deserialisation.clvm | 0 .../puzzles/flaxlisp_deserialisation.clvm.hex | 0 ...axlisp_deserialisation.clvm.hex.sha256tree | 0 .../wallet/puzzles/genesis_by_coin_id.clvm | 0 .../puzzles/genesis_by_coin_id.clvm.hex | 0 .../genesis_by_coin_id.clvm.hex.sha256tree | 0 .../puzzles/genesis_by_puzzle_hash.clvm | 0 .../puzzles/genesis_by_puzzle_hash.clvm.hex | 0 ...genesis_by_puzzle_hash.clvm.hex.sha256tree | 0 .../wallet/puzzles/graftroot_dl_offers.clvm | 0 .../puzzles/graftroot_dl_offers.clvm.hex | 0 .../graftroot_dl_offers.clvm.hex.sha256tree | 0 {chia => flax}/wallet/puzzles/json.clib | 0 {chia => flax}/wallet/puzzles/load_clvm.py | 16 +- .../wallet/puzzles/lock.inner.puzzle.clvm | 0 .../wallet/puzzles/lock.inner.puzzle.clvm.hex | 0 .../lock.inner.puzzle.clvm.hex.sha256tree | 0 .../wallet/puzzles/merkle_utils.clib | 0 .../puzzles/nft_intermediate_launcher.clvm | 0 .../nft_intermediate_launcher.clvm.hex | 0 ..._intermediate_launcher.clvm.hex.sha256tree | 0 .../puzzles/nft_metadata_updater_default.clvm | 0 .../nft_metadata_updater_default.clvm.hex | 0 ...tadata_updater_default.clvm.hex.sha256tree | 0 .../nft_metadata_updater_updateable.clvm | 0 .../nft_metadata_updater_updateable.clvm.hex | 0 ...ata_updater_updateable.clvm.hex.sha256tree | 0 .../wallet/puzzles/nft_ownership_layer.clvm | 0 .../puzzles/nft_ownership_layer.clvm.hex | 0 .../nft_ownership_layer.clvm.hex.sha256tree | 0 ..._program_one_way_claim_with_royalties.clvm | 2 +- ...gram_one_way_claim_with_royalties.clvm.hex | 0 ...y_claim_with_royalties.clvm.hex.sha256tree | 0 .../wallet/puzzles/nft_state_layer.clvm | 0 .../wallet/puzzles/nft_state_layer.clvm.hex | 0 .../nft_state_layer.clvm.hex.sha256tree | 0 .../wallet/puzzles/notification.clvm | 0 .../wallet/puzzles/notification.clvm.hex | 0 .../puzzles/notification.clvm.hex.sha256tree | 0 .../wallet/puzzles/p2_conditions.clvm | 0 .../wallet/puzzles/p2_conditions.clvm.hex | 0 .../puzzles/p2_conditions.clvm.hex.sha256tree | 0 .../wallet/puzzles/p2_conditions.py | 2 +- .../puzzles/p2_delegated_conditions.clvm | 0 .../puzzles/p2_delegated_conditions.clvm.hex | 0 ...2_delegated_conditions.clvm.hex.sha256tree | 0 .../wallet/puzzles/p2_delegated_conditions.py | 2 +- .../wallet/puzzles/p2_delegated_puzzle.clvm | 0 .../puzzles/p2_delegated_puzzle.clvm.hex | 0 .../p2_delegated_puzzle.clvm.hex.sha256tree | 0 .../wallet/puzzles/p2_delegated_puzzle.py | 2 +- .../p2_delegated_puzzle_or_hidden_puzzle.clvm | 0 ...delegated_puzzle_or_hidden_puzzle.clvm.hex | 0 ...uzzle_or_hidden_puzzle.clvm.hex.sha256tree | 0 .../p2_delegated_puzzle_or_hidden_puzzle.py | 14 +- .../puzzles/p2_m_of_n_delegate_direct.clvm | 0 .../p2_m_of_n_delegate_direct.clvm.hex | 0 ...m_of_n_delegate_direct.clvm.hex.sha256tree | 0 .../puzzles/p2_m_of_n_delegate_direct.py | 2 +- {chia => flax}/wallet/puzzles/p2_parent.clvm | 0 .../wallet/puzzles/p2_parent.clvm.hex | 0 .../puzzles/p2_parent.clvm.hex.sha256tree | 0 .../wallet/puzzles/p2_puzzle_hash.clvm | 0 .../wallet/puzzles/p2_puzzle_hash.clvm.hex | 0 .../p2_puzzle_hash.clvm.hex.sha256tree | 0 .../wallet/puzzles/p2_puzzle_hash.py | 4 +- .../wallet/puzzles/p2_singleton.clvm | 0 .../wallet/puzzles/p2_singleton.clvm.hex | 0 .../puzzles/p2_singleton.clvm.hex.sha256tree | 0 .../p2_singleton_or_delayed_puzhash.clvm | 0 .../p2_singleton_or_delayed_puzhash.clvm.hex | 0 ...ton_or_delayed_puzhash.clvm.hex.sha256tree | 0 .../wallet/puzzles/pool_member_innerpuz.clvm | 0 .../puzzles/pool_member_innerpuz.clvm.hex | 0 .../pool_member_innerpuz.clvm.hex.sha256tree | 0 .../puzzles/pool_waitingroom_innerpuz.clvm | 0 .../pool_waitingroom_innerpuz.clvm.hex | 0 ...l_waitingroom_innerpuz.clvm.hex.sha256tree | 0 .../wallet/puzzles/prefarm/__init__.py | 0 .../wallet/puzzles/prefarm/make_prefarm_ph.py | 34 +- .../wallet/puzzles/prefarm/spend_prefarm.py | 26 +- {chia => flax}/wallet/puzzles/puzzle_utils.py | 2 +- .../wallet/puzzles/recompile-all.sh | 0 .../puzzles/rom_bootstrap_generator.clvm | 2 +- .../puzzles/rom_bootstrap_generator.clvm.hex | 0 ...om_bootstrap_generator.clvm.hex.sha256tree | 0 .../wallet/puzzles/rom_bootstrap_generator.py | 2 +- .../wallet/puzzles/settlement_payments.clvm | 0 .../puzzles/settlement_payments.clvm.hex | 0 .../settlement_payments.clvm.hex.sha256tree | 0 .../puzzles/settlement_payments_old.clvm | 0 .../puzzles/settlement_payments_old.clvm.hex | 0 ...ettlement_payments_old.clvm.hex.sha256tree | 0 {chia => flax}/wallet/puzzles/sha256tree.clib | 0 .../wallet/puzzles/sha256tree_module.clvm | 0 .../wallet/puzzles/sha256tree_module.clvm.hex | 0 .../sha256tree_module.clvm.hex.sha256tree | 0 .../wallet/puzzles/singleton_launcher.clvm | 0 .../puzzles/singleton_launcher.clvm.hex | 0 .../singleton_launcher.clvm.hex.sha256tree | 0 .../wallet/puzzles/singleton_top_layer.clvm | 0 .../puzzles/singleton_top_layer.clvm.hex | 0 .../singleton_top_layer.clvm.hex.sha256tree | 0 .../wallet/puzzles/singleton_top_layer.py | 18 +- .../puzzles/singleton_top_layer_v1_1.clvm | 0 .../puzzles/singleton_top_layer_v1_1.clvm.hex | 0 ...ngleton_top_layer_v1_1.clvm.hex.sha256tree | 0 .../puzzles/singleton_top_layer_v1_1.py | 20 +- .../wallet/puzzles/singleton_truths.clib | 0 {chia => flax}/wallet/puzzles/tails.py | 24 +- .../puzzles/test_generator_deserialize.clvm | 0 .../test_generator_deserialize.clvm.hex | 0 ..._generator_deserialize.clvm.hex.sha256tree | 0 ...st_multiple_generator_input_arguments.clvm | 0 ...ultiple_generator_input_arguments.clvm.hex | 0 ...erator_input_arguments.clvm.hex.sha256tree | 0 .../wallet/puzzles/utility_macros.clib | 0 {chia => flax}/wallet/secret_key_store.py | 0 {chia => flax}/wallet/settings/__init__.py | 0 .../wallet/settings/default_settings.py | 2 +- .../wallet/settings/settings_objects.py | 2 +- .../wallet/settings/user_settings.py | 6 +- {chia => flax}/wallet/sign_coin_spends.py | 6 +- {chia => flax}/wallet/trade_manager.py | 70 +- {chia => flax}/wallet/trade_record.py | 12 +- {chia => flax}/wallet/trading/__init__.py | 0 {chia => flax}/wallet/trading/offer.py | 34 +- {chia => flax}/wallet/trading/trade_status.py | 0 {chia => flax}/wallet/trading/trade_store.py | 14 +- {chia => flax}/wallet/transaction_record.py | 18 +- {chia => flax}/wallet/transaction_sorting.py | 0 {chia => flax}/wallet/uncurried_puzzle.py | 2 +- {chia => flax}/wallet/util/__init__.py | 0 {chia => flax}/wallet/util/address_type.py | 12 +- {chia => flax}/wallet/util/compute_hints.py | 8 +- {chia => flax}/wallet/util/compute_memos.py | 12 +- .../wallet/util/curry_and_treehash.py | 2 +- .../wallet/util/debug_spend_bundle.py | 12 +- flax/wallet/util/json_clvm_utils.py | 19 + {chia => flax}/wallet/util/merkle_tree.py | 4 +- {chia => flax}/wallet/util/merkle_utils.py | 2 +- {chia => flax}/wallet/util/new_peak_queue.py | 10 +- {chia => flax}/wallet/util/notifications.py | 8 +- .../wallet/util/peer_request_cache.py | 12 +- .../wallet/util/puzzle_compression.py | 10 +- .../wallet/util/transaction_type.py | 0 .../wallet/util/wallet_sync_utils.py | 40 +- {chia => flax}/wallet/util/wallet_types.py | 4 +- {chia => flax}/wallet/wallet.py | 68 +- {chia => flax}/wallet/wallet_action.py | 4 +- {chia => flax}/wallet/wallet_blockchain.py | 28 +- {chia => flax}/wallet/wallet_coin_record.py | 8 +- {chia => flax}/wallet/wallet_coin_store.py | 12 +- {chia => flax}/wallet/wallet_info.py | 4 +- .../wallet/wallet_interested_store.py | 6 +- {chia => flax}/wallet/wallet_nft_store.py | 14 +- {chia => flax}/wallet/wallet_node.py | 130 +- {chia => flax}/wallet/wallet_node_api.py | 30 +- {chia => flax}/wallet/wallet_pool_store.py | 6 +- {chia => flax}/wallet/wallet_protocol.py | 14 +- {chia => flax}/wallet/wallet_puzzle_store.py | 12 +- {chia => flax}/wallet/wallet_retry_store.py | 6 +- {chia => flax}/wallet/wallet_state_manager.py | 153 +- .../wallet/wallet_transaction_store.py | 16 +- {chia => flax}/wallet/wallet_user_store.py | 10 +- .../wallet/wallet_weight_proof_handler.py | 16 +- install-gui.sh | 24 +- install-plotter.sh | 20 +- install-timelord.sh | 20 +- install.sh | 22 +- installhelper.py | 12 +- lgtm.yml | 2 +- mypy.ini | 4 +- pyproject.toml | 2 +- run-py-tests.sh | 0 setup.py | 118 +- start-gui.sh | 6 +- tests/README.md | 6 +- tests/blockchain/blockchain_test_utils.py | 10 +- tests/blockchain/test_blockchain.py | 64 +- .../test_blockchain_transactions.py | 16 +- tests/build-init-files.py | 4 +- tests/check_pytest_monitor_output.py | 0 tests/check_sql_statements.py | 8 +- tests/clvm/benchmark_costs.py | 14 +- tests/clvm/coin_store.py | 18 +- tests/clvm/test_curry_and_treehash.py | 6 +- ...on.py => test_flaxlisp_deserialization.py} | 8 +- tests/clvm/test_program.py | 2 +- tests/clvm/test_puzzle_compression.py | 22 +- tests/clvm/test_puzzle_drivers.py | 4 +- tests/clvm/test_puzzles.py | 14 +- tests/clvm/test_serialized_program.py | 4 +- tests/clvm/test_singletons.py | 40 +- tests/clvm/test_spend_sim.py | 10 +- tests/conftest.py | 66 +- tests/connection_utils.py | 38 +- tests/core/cmds/test_beta.py | 24 +- tests/core/cmds/test_keys.py | 96 +- tests/core/cmds/test_wallet.py | 30 +- tests/core/consensus/test_pot_iterations.py | 10 +- tests/core/custom_types/test_coin.py | 8 +- .../core/custom_types/test_proof_of_space.py | 4 +- tests/core/custom_types/test_spend_bundle.py | 2 +- tests/core/daemon/test_daemon.py | 26 +- tests/core/data_layer/conftest.py | 30 +- tests/core/data_layer/test_data_cli.py | 22 +- tests/core/data_layer/test_data_layer_util.py | 4 +- tests/core/data_layer/test_data_rpc.py | 44 +- tests/core/data_layer/test_data_store.py | 16 +- .../core/data_layer/test_data_store_schema.py | 6 +- tests/core/data_layer/util.py | 16 +- .../full_node/full_sync/test_full_sync.py | 14 +- tests/core/full_node/ram_db.py | 10 +- .../core/full_node/stores/test_block_store.py | 20 +- .../core/full_node/stores/test_coin_store.py | 30 +- .../full_node/stores/test_full_node_store.py | 28 +- .../core/full_node/stores/test_hint_store.py | 18 +- .../core/full_node/stores/test_sync_store.py | 4 +- tests/core/full_node/test_address_manager.py | 8 +- tests/core/full_node/test_block_height_map.py | 12 +- tests/core/full_node/test_conditions.py | 20 +- tests/core/full_node/test_full_node.py | 70 +- tests/core/full_node/test_generator_tools.py | 12 +- tests/core/full_node/test_hint_management.py | 20 +- tests/core/full_node/test_mempool.py | 68 +- .../full_node/test_mempool_fee_protocol.py | 22 +- .../full_node/test_mempool_performance.py | 12 +- tests/core/full_node/test_node_load.py | 8 +- .../full_node/test_peer_store_resolver.py | 2 +- tests/core/full_node/test_performance.py | 18 +- tests/core/full_node/test_transactions.py | 16 +- tests/core/large_block.py | 2 +- tests/core/make_block_generator.py | 20 +- .../mempool/test_mempool_fee_estimator.py | 22 +- tests/core/server/test_dos.py | 34 +- tests/core/server/test_rate_limits.py | 26 +- tests/core/ssl/test_ssl.py | 66 +- tests/core/test_coins.py | 6 +- tests/core/test_cost_calculation.py | 24 +- tests/core/test_crawler_rpc.py | 4 +- tests/core/test_daemon_rpc.py | 4 +- tests/core/test_db_conversion.py | 18 +- tests/core/test_db_validation.py | 22 +- tests/core/test_farmer_harvester_rpc.py | 48 +- tests/core/test_full_node_rpc.py | 28 +- tests/core/test_merkle_set.py | 4 +- tests/core/test_setproctitle.py | 4 +- tests/core/util/test_cached_bls.py | 6 +- tests/core/util/test_config.py | 30 +- .../util/test_file_keyring_synchronization.py | 2 +- tests/core/util/test_files.py | 4 +- tests/core/util/test_jsonify.py | 6 +- tests/core/util/test_keychain.py | 12 +- tests/core/util/test_keyring_wrapper.py | 4 +- tests/core/util/test_lockfile.py | 2 +- tests/core/util/test_lru_cache.py | 2 +- tests/core/util/test_significant_bits.py | 2 +- tests/core/util/test_streamable.py | 18 +- tests/db/test_db_wrapper.py | 2 +- .../farmer_harvester/test_farmer_harvester.py | 8 +- tests/fee_estimation/cmdline_test.py | 16 +- .../fee_estimation/test_fee_estimation_rpc.py | 22 +- .../test_fee_estimation_unit_tests.py | 22 +- tests/{chia-start-sim => flax-start-sim} | 20 +- tests/generator/test_compression.py | 32 +- tests/generator/test_generator_types.py | 8 +- tests/generator/test_list_to_batches.py | 2 +- tests/generator/test_rom.py | 20 +- tests/generator/test_scan.py | 4 +- tests/plot_sync/test_delta.py | 8 +- tests/plot_sync/test_plot_sync.py | 36 +- tests/plot_sync/test_receiver.py | 18 +- tests/plot_sync/test_sender.py | 14 +- tests/plot_sync/test_sync_simulated.py | 34 +- tests/plot_sync/util.py | 26 +- tests/plotting/test_plot_manager.py | 18 +- tests/plotting/util.py | 2 +- tests/pools/test_pool_cmdline.py | 4 +- tests/pools/test_pool_config.py | 6 +- tests/pools/test_pool_puzzles_lifecycle.py | 30 +- tests/pools/test_pool_rpc.py | 56 +- tests/pools/test_pool_wallet.py | 12 +- tests/pools/test_wallet_pool_store.py | 12 +- tests/setup_nodes.py | 36 +- tests/setup_services.py | 46 +- tests/simulation/test_simulation.py | 32 +- tests/simulation/test_start_simulator.py | 24 +- tests/tools/test_run_block.py | 6 +- tests/util/alert_server.py | 2 +- tests/util/benchmark_cost.py | 20 +- tests/util/blockchain.py | 16 +- tests/util/build_network_protocol_files.py | 2 +- tests/util/db_connection.py | 2 +- tests/util/gen_ssl_certs.py | 10 +- tests/util/generator_tools_testing.py | 12 +- tests/util/key_tool.py | 6 +- tests/util/keyring.py | 10 +- tests/util/misc.py | 2 +- tests/util/network_protocol_data.py | 42 +- tests/util/rpc.py | 4 +- tests/util/test_chunks.py | 2 +- tests/util/test_full_block_utils.py | 28 +- tests/util/test_lock_queue.py | 2 +- tests/util/test_misc.py | 6 +- tests/util/test_network.py | 2 +- tests/util/test_network_protocol_test.py | 4 +- tests/util/test_paginator.py | 2 +- tests/util/test_struct_stream.py | 4 +- tests/util/wallet_is_synced.py | 4 +- tests/wallet/cat_wallet/test_cat_lifecycle.py | 26 +- .../cat_wallet/test_cat_outer_puzzle.py | 20 +- tests/wallet/cat_wallet/test_cat_wallet.py | 30 +- .../wallet/cat_wallet/test_offer_lifecycle.py | 60 +- tests/wallet/cat_wallet/test_trades.py | 128 +- tests/wallet/db_wallet/test_db_graftroot.py | 20 +- tests/wallet/db_wallet/test_dl_offers.py | 18 +- tests/wallet/db_wallet/test_dl_wallet.py | 20 +- tests/wallet/did_wallet/test_did.py | 28 +- tests/wallet/nft_wallet/test_nft_1_offers.py | 122 +- tests/wallet/nft_wallet/test_nft_bulk_mint.py | 154 +- tests/wallet/nft_wallet/test_nft_lifecycle.py | 28 +- tests/wallet/nft_wallet/test_nft_offers.py | 86 +- tests/wallet/nft_wallet/test_nft_puzzles.py | 20 +- tests/wallet/nft_wallet/test_nft_wallet.py | 88 +- .../nft_wallet/test_ownership_outer_puzzle.py | 16 +- tests/wallet/rpc/test_dl_wallet_rpc.py | 18 +- tests/wallet/rpc/test_wallet_rpc.py | 106 +- .../simple_sync/test_simple_sync_protocol.py | 38 +- tests/wallet/sync/test_wallet_sync.py | 118 +- tests/wallet/test_address_type.py | 70 +- tests/wallet/test_bech32m.py | 2 +- tests/wallet/test_coin_selection.py | 16 +- .../{test_chialisp.py => test_flaxlisp.py} | 4 +- tests/wallet/test_nft_store.py | 14 +- tests/wallet/test_notifications.py | 14 +- .../wallet/test_offer_parsing_performance.py | 2 +- tests/wallet/test_puzzle_store.py | 8 +- tests/wallet/test_singleton.py | 10 +- tests/wallet/test_singleton_lifecycle.py | 20 +- tests/wallet/test_singleton_lifecycle_fast.py | 18 +- tests/wallet/test_taproot.py | 2 +- tests/wallet/test_transaction_store.py | 16 +- tests/wallet/test_wallet.py | 82 +- tests/wallet/test_wallet_blockchain.py | 14 +- tests/wallet/test_wallet_coin_store.py | 10 +- tests/wallet/test_wallet_interested_store.py | 6 +- tests/wallet/test_wallet_key_val_store.py | 6 +- tests/wallet/test_wallet_node.py | 6 +- tests/wallet/test_wallet_retry.py | 18 +- tests/wallet/test_wallet_trade_store.py | 18 +- tests/wallet/test_wallet_user_store.py | 4 +- tests/weight_proof/test_weight_proof.py | 30 +- tools/analyze-chain.py | 8 +- tools/generate_chain.py | 10 +- tools/manage_clvm.py | 4 +- tools/run_benchmark.sh | 2 +- tools/run_block.py | 40 +- tools/test_constants.py | 2 +- tools/test_full_sync.py | 34 +- 850 files changed, 6818 insertions(+), 10796 deletions(-) delete mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.yaml delete mode 100644 .github/dependabot.yml create mode 100644 .github/linters/.flake8 create mode 100644 .github/linters/.isort.cfg create mode 100644 .github/linters/.markdown-lint.yml create mode 100644 .github/linters/.python-black create mode 100644 .github/linters/.python-lint delete mode 100644 .github/workflows/benchmarks.yml delete mode 100644 .github/workflows/check_wheel_availability.yaml delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/conflict-check.yml delete mode 100644 .github/workflows/dependency-review.yml delete mode 100644 .github/workflows/mozilla-ca-cert.yml delete mode 100644 .github/workflows/pre-commit.yml delete mode 100644 .github/workflows/stale-issue.yml delete mode 100644 .github/workflows/start-release.yml delete mode 100644 .github/workflows/super-linter.yml delete mode 100644 .github/workflows/test-install-scripts.yml delete mode 100644 .github/workflows/test-single.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/trigger-docker-dev.yml delete mode 100644 .github/workflows/trigger-docker-main.yml delete mode 100644 .github/workflows/upload-pypi-source.yml delete mode 100644 CHANGELOG.md mode change 100755 => 100644 activated.py mode change 100755 => 100644 activated.sh delete mode 160000 chia-blockchain-gui delete mode 100644 chia/ssl/chia_ca.crt delete mode 100644 chia/ssl/chia_ca.key delete mode 100644 chia/util/default_root.py delete mode 100644 chia/util/service_groups.py delete mode 100644 chia/wallet/cat_wallet/cat_constants.py delete mode 100644 chia/wallet/util/json_clvm_utils.py create mode 160000 flax-blockchain-gui rename {chia => flax}/__init__.py (63%) rename {chia => flax}/clvm/__init__.py (100%) rename {chia => flax}/clvm/singleton.py (80%) rename {chia => flax}/clvm/spend_sim.py (92%) rename {chia => flax}/cmds/__init__.py (100%) rename {chia => flax}/cmds/beta.py (90%) rename {chia => flax}/cmds/beta_funcs.py (90%) rename {chia => flax}/cmds/cmds_util.py (89%) rename {chia => flax}/cmds/configure.py (95%) rename {chia => flax}/cmds/data.py (90%) rename {chia => flax}/cmds/data_funcs.py (94%) rename {chia => flax}/cmds/db.py (94%) rename {chia => flax}/cmds/db_backup_func.py (97%) rename {chia => flax}/cmds/db_upgrade_func.py (98%) rename {chia => flax}/cmds/db_validate_func.py (96%) rename {chia => flax}/cmds/farm.py (100%) rename {chia => flax}/cmds/farm_funcs.py (91%) rename chia/cmds/chia.py => flax/cmds/flax.py (70%) rename {chia => flax}/cmds/init.py (70%) rename {chia => flax}/cmds/init_funcs.py (87%) rename {chia => flax}/cmds/keys.py (97%) rename {chia => flax}/cmds/keys_funcs.py (95%) rename {chia => flax}/cmds/netspace.py (100%) rename {chia => flax}/cmds/netspace_funcs.py (92%) rename {chia => flax}/cmds/passphrase.py (99%) rename {chia => flax}/cmds/passphrase_funcs.py (95%) rename {chia => flax}/cmds/peer.py (93%) rename {chia => flax}/cmds/peer_funcs.py (92%) rename {chia => flax}/cmds/plotnft.py (96%) rename {chia => flax}/cmds/plotnft_funcs.py (92%) rename {chia => flax}/cmds/plots.py (91%) rename {chia => flax}/cmds/plotters.py (86%) rename {chia => flax}/cmds/rpc.py (96%) rename {chia => flax}/cmds/show.py (87%) rename {chia => flax}/cmds/show_funcs.py (93%) rename {chia => flax}/cmds/start.py (81%) rename {chia => flax}/cmds/start_funcs.py (87%) rename {chia => flax}/cmds/stop.py (86%) rename {chia => flax}/cmds/units.py (80%) rename {chia => flax}/cmds/wallet.py (97%) rename {chia => flax}/cmds/wallet_funcs.py (92%) rename {chia => flax}/consensus/__init__.py (100%) rename {chia => flax}/consensus/block_body_validation.py (94%) rename {chia => flax}/consensus/block_creation.py (93%) rename {chia => flax}/consensus/block_header_validation.py (97%) rename {chia => flax}/consensus/block_record.py (88%) rename {chia => flax}/consensus/block_rewards.py (62%) rename {chia => flax}/consensus/block_root_validation.py (90%) rename {chia => flax}/consensus/blockchain.py (95%) rename {chia => flax}/consensus/blockchain_interface.py (85%) rename {chia => flax}/consensus/coinbase.py (81%) rename {chia => flax}/consensus/condition_costs.py (100%) rename {chia => flax}/consensus/constants.py (93%) rename {chia => flax}/consensus/cost_calculator.py (68%) rename {chia => flax}/consensus/default_constants.py (88%) rename {chia => flax}/consensus/deficit.py (93%) rename {chia => flax}/consensus/difficulty_adjustment.py (98%) rename {chia => flax}/consensus/find_fork_point.py (86%) rename {chia => flax}/consensus/full_block_to_block_record.py (87%) rename {chia => flax}/consensus/get_block_challenge.py (90%) rename {chia => flax}/consensus/make_sub_epoch_summary.py (92%) rename {chia => flax}/consensus/multiprocess_validation.py (92%) rename {chia => flax}/consensus/pos_quality.py (95%) rename {chia => flax}/consensus/pot_iterations.py (90%) rename {chia => flax}/consensus/vdf_info_computation.py (94%) rename {chia => flax}/daemon/__init__.py (100%) rename {chia => flax}/daemon/client.py (97%) rename {chia => flax}/daemon/keychain_proxy.py (97%) rename {chia => flax}/daemon/keychain_server.py (97%) rename {chia => flax}/daemon/server.py (95%) rename {chia => flax}/daemon/windows_signal.py (100%) rename {chia => flax}/data_layer/__init__.py (100%) rename {chia => flax}/data_layer/data_layer.py (96%) rename {chia => flax}/data_layer/data_layer_api.py (81%) rename {chia => flax}/data_layer/data_layer_errors.py (94%) rename {chia => flax}/data_layer/data_layer_server.py (91%) rename {chia => flax}/data_layer/data_layer_util.py (95%) rename {chia => flax}/data_layer/data_layer_wallet.py (95%) rename {chia => flax}/data_layer/data_store.py (99%) rename {chia => flax}/data_layer/dl_wallet_store.py (97%) rename {chia => flax}/data_layer/download_data.py (97%) rename {chia => flax}/data_layer/util/__init__.py (100%) rename {chia => flax}/data_layer/util/benchmark.py (96%) rename {chia => flax}/farmer/__init__.py (100%) rename {chia => flax}/farmer/farmer.py (94%) rename {chia => flax}/farmer/farmer_api.py (96%) rename {chia => flax}/full_node/__init__.py (100%) rename {chia => flax}/full_node/bitcoin_fee_estimator.py (85%) rename {chia => flax}/full_node/block_height_map.py (96%) rename {chia => flax}/full_node/block_store.py (97%) rename {chia => flax}/full_node/bundle_tools.py (94%) rename {chia => flax}/full_node/coin_store.py (98%) rename {chia => flax}/full_node/fee_estimate.py (89%) rename {chia => flax}/full_node/fee_estimate_store.py (89%) rename {chia => flax}/full_node/fee_estimation.py (84%) rename {chia => flax}/full_node/fee_estimator.py (92%) rename {chia => flax}/full_node/fee_estimator_constants.py (100%) rename {chia => flax}/full_node/fee_estimator_example.py (82%) rename {chia => flax}/full_node/fee_estimator_interface.py (84%) rename {chia => flax}/full_node/fee_history.py (84%) rename {chia => flax}/full_node/fee_tracker.py (98%) rename {chia => flax}/full_node/full_node.py (96%) rename {chia => flax}/full_node/full_node_api.py (96%) rename {chia => flax}/full_node/full_node_store.py (96%) rename {chia => flax}/full_node/generator.py (86%) rename {chia => flax}/full_node/hint_management.py (92%) rename {chia => flax}/full_node/hint_store.py (95%) rename {chia => flax}/full_node/lock_queue.py (100%) rename {chia => flax}/full_node/mempool.py (90%) rename {chia => flax}/full_node/mempool_check_conditions.py (80%) rename {chia => flax}/full_node/mempool_manager.py (94%) rename {chia => flax}/full_node/pending_tx_cache.py (90%) rename {chia => flax}/full_node/signage_point.py (71%) rename {chia => flax}/full_node/sync_store.py (98%) rename {chia => flax}/full_node/weight_proof.py (98%) rename {chia => flax}/harvester/__init__.py (100%) rename {chia => flax}/harvester/harvester.py (91%) rename {chia => flax}/harvester/harvester_api.py (94%) rename {chia => flax}/introducer/__init__.py (100%) rename {chia => flax}/introducer/introducer.py (88%) rename {chia => flax}/introducer/introducer_api.py (75%) rename {chia => flax}/plot_sync/__init__.py (100%) rename {chia => flax}/plot_sync/delta.py (97%) rename {chia => flax}/plot_sync/exceptions.py (91%) rename {chia => flax}/plot_sync/receiver.py (95%) rename {chia => flax}/plot_sync/sender.py (96%) rename {chia => flax}/plot_sync/util.py (92%) rename {chia => flax}/plotters/__init__.py (100%) rename {chia => flax}/plotters/bladebit.py (97%) rename {chia => flax}/plotters/chiapos.py (82%) rename {chia => flax}/plotters/madmax.py (92%) rename {chia => flax}/plotters/plotters.py (94%) rename {chia => flax}/plotters/plotters_util.py (95%) rename {chia => flax}/plotting/__init__.py (100%) rename {chia => flax}/plotting/cache.py (92%) rename {chia => flax}/plotting/check_plots.py (96%) rename {chia => flax}/plotting/create_plots.py (94%) rename {chia => flax}/plotting/manager.py (98%) rename {chia => flax}/plotting/util.py (97%) rename {chia => flax}/pools/__init__.py (100%) rename {chia => flax}/pools/pool_config.py (94%) rename {chia => flax}/pools/pool_puzzles.py (96%) rename {chia => flax}/pools/pool_wallet.py (97%) rename {chia => flax}/pools/pool_wallet_info.py (91%) rename {chia => flax}/protocols/__init__.py (100%) rename {chia => flax}/protocols/farmer_protocol.py (84%) rename {chia => flax}/protocols/full_node_protocol.py (87%) rename {chia => flax}/protocols/harvester_protocol.py (94%) rename {chia => flax}/protocols/introducer_protocol.py (81%) rename {chia => flax}/protocols/pool_protocol.py (94%) rename {chia => flax}/protocols/protocol_message_types.py (100%) rename {chia => flax}/protocols/protocol_state_machine.py (96%) rename {chia => flax}/protocols/protocol_timing.py (100%) rename {chia => flax}/protocols/shared_protocol.py (89%) rename {chia => flax}/protocols/timelord_protocol.py (84%) rename {chia => flax}/protocols/wallet_protocol.py (92%) rename {chia => flax}/py.typed (100%) rename {chia => flax}/pyinstaller.spec (72%) rename {chia => flax}/rpc/__init__.py (100%) rename {chia => flax}/rpc/crawler_rpc_api.py (92%) rename {chia => flax}/rpc/data_layer_rpc_api.py (96%) rename {chia => flax}/rpc/data_layer_rpc_client.py (97%) rename {chia => flax}/rpc/data_layer_rpc_util.py (100%) rename {chia => flax}/rpc/farmer_rpc_api.py (95%) rename {chia => flax}/rpc/farmer_rpc_client.py (91%) rename {chia => flax}/rpc/full_node_rpc_api.py (96%) rename {chia => flax}/rpc/full_node_rpc_client.py (94%) rename {chia => flax}/rpc/harvester_rpc_api.py (92%) rename {chia => flax}/rpc/harvester_rpc_client.py (89%) rename {chia => flax}/rpc/rpc_client.py (88%) rename {chia => flax}/rpc/rpc_server.py (94%) rename {chia => flax}/rpc/timelord_rpc_api.py (77%) rename {chia => flax}/rpc/util.py (94%) rename {chia => flax}/rpc/wallet_rpc_api.py (96%) rename {chia => flax}/rpc/wallet_rpc_client.py (97%) rename {chia => flax}/seeder/__init__.py (100%) rename {chia => flax}/seeder/crawl_store.py (99%) rename {chia => flax}/seeder/crawler.py (95%) rename {chia => flax}/seeder/crawler_api.py (85%) rename {chia => flax}/seeder/dns_server.py (98%) rename {chia => flax}/seeder/peer_record.py (98%) rename {chia => flax}/seeder/start_crawler.py (80%) rename {chia => flax}/server/__init__.py (100%) rename {chia => flax}/server/address_manager.py (99%) rename {chia => flax}/server/address_manager_sqlite_store.py (95%) rename {chia => flax}/server/address_manager_store.py (98%) rename {chia => flax}/server/connection_utils.py (80%) rename {chia => flax}/server/introducer_peers.py (96%) rename {chia => flax}/server/node_discovery.py (97%) rename {chia => flax}/server/outbound_message.py (87%) rename {chia => flax}/server/peer_store_resolver.py (100%) rename {chia => flax}/server/rate_limit_numbers.py (98%) rename {chia => flax}/server/rate_limits.py (95%) rename {chia => flax}/server/reconnect_task.py (85%) rename {chia => flax}/server/server.py (94%) rename {chia => flax}/server/ssl_context.py (80%) rename {chia => flax}/server/start_data_layer.py (82%) rename {chia => flax}/server/start_farmer.py (79%) rename {chia => flax}/server/start_full_node.py (78%) rename {chia => flax}/server/start_harvester.py (78%) rename {chia => flax}/server/start_introducer.py (81%) rename {chia => flax}/server/start_service.py (91%) rename {chia => flax}/server/start_timelord.py (77%) rename {chia => flax}/server/start_wallet.py (80%) rename {chia => flax}/server/upnp.py (93%) rename {chia => flax}/server/ws_connection.py (95%) rename {chia => flax}/simulator/__init__.py (100%) rename {chia => flax}/simulator/block_tools.py (96%) rename {chia => flax}/simulator/full_node_simulator.py (95%) rename {chia => flax}/simulator/simulator_constants.py (75%) rename {chia => flax}/simulator/simulator_full_node_rpc_api.py (92%) rename {chia => flax}/simulator/simulator_full_node_rpc_client.py (86%) rename {chia => flax}/simulator/simulator_protocol.py (75%) rename {chia => flax}/simulator/simulator_test_tools.py (68%) rename {chia => flax}/simulator/socket.py (100%) rename {chia => flax}/simulator/ssl_certs.py (86%) rename {chia => flax}/simulator/ssl_certs_1.py (100%) rename {chia => flax}/simulator/ssl_certs_10.py (100%) rename {chia => flax}/simulator/ssl_certs_2.py (100%) rename {chia => flax}/simulator/ssl_certs_3.py (100%) rename {chia => flax}/simulator/ssl_certs_4.py (100%) rename {chia => flax}/simulator/ssl_certs_5.py (100%) rename {chia => flax}/simulator/ssl_certs_6.py (100%) rename {chia => flax}/simulator/ssl_certs_7.py (100%) rename {chia => flax}/simulator/ssl_certs_8.py (100%) rename {chia => flax}/simulator/ssl_certs_9.py (99%) rename {chia => flax}/simulator/start_simulator.py (86%) rename {chia => flax}/simulator/time_out_assert.py (96%) rename {chia => flax}/simulator/wallet_tools.py (92%) rename {chia => flax}/ssl/__init__.py (100%) rename {chia => flax}/ssl/create_ssl.py (86%) rename {chia => flax}/ssl/dst_root_ca.pem (100%) create mode 100644 flax/ssl/flax_ca.crt create mode 100644 flax/ssl/flax_ca.key rename {chia => flax}/timelord/__init__.py (100%) rename {chia => flax}/timelord/iters_from_block.py (86%) rename {chia => flax}/timelord/timelord.py (97%) rename {chia => flax}/timelord/timelord_api.py (95%) rename {chia => flax}/timelord/timelord_launcher.py (92%) rename {chia => flax}/timelord/timelord_state.py (95%) rename {chia => flax}/timelord/types.py (100%) rename {chia => flax}/types/__init__.py (100%) rename {chia => flax}/types/announcement.py (86%) rename {chia => flax}/types/block_protocol.py (71%) rename {chia => flax}/types/blockchain_format/__init__.py (100%) rename {chia => flax}/types/blockchain_format/classgroup.py (84%) rename {chia => flax}/types/blockchain_format/coin.py (81%) rename {chia => flax}/types/blockchain_format/foliage.py (88%) rename {chia => flax}/types/blockchain_format/pool_target.py (60%) rename {chia => flax}/types/blockchain_format/program.py (98%) rename {chia => flax}/types/blockchain_format/proof_of_space.py (94%) rename {chia => flax}/types/blockchain_format/reward_chain_block.py (85%) rename {chia => flax}/types/blockchain_format/sized_bytes.py (88%) rename {chia => flax}/types/blockchain_format/slots.py (84%) rename {chia => flax}/types/blockchain_format/sub_epoch_summary.py (76%) rename {chia => flax}/types/blockchain_format/tree_hash.py (94%) rename {chia => flax}/types/blockchain_format/vdf.py (89%) rename {chia => flax}/types/clvm_cost.py (89%) rename {chia => flax}/types/coin_record.py (79%) rename {chia => flax}/types/coin_solution.py (100%) rename {chia => flax}/types/coin_spend.py (80%) rename {chia => flax}/types/condition_opcodes.py (96%) rename {chia => flax}/types/condition_with_args.py (77%) rename {chia => flax}/types/end_of_slot_bundle.py (81%) rename {chia => flax}/types/fee_rate.py (70%) rename {chia => flax}/types/full_block.py (85%) rename {chia => flax}/types/generator_types.py (82%) rename {chia => flax}/types/header_block.py (86%) rename {chia => flax}/types/mempool_inclusion_status.py (100%) rename {chia => flax}/types/mempool_item.py (67%) rename {chia => flax}/types/mempool_submission_status.py (85%) rename {chia => flax}/types/mojos.py (74%) rename {chia => flax}/types/peer_info.py (94%) rename {chia => flax}/types/spend_bundle.py (92%) rename {chia => flax}/types/spend_bundle_conditions.py (100%) rename {chia => flax}/types/transaction_queue_entry.py (77%) rename {chia => flax}/types/unfinished_block.py (78%) rename {chia => flax}/types/unfinished_header_block.py (78%) rename {chia => flax}/types/weight_proof.py (85%) rename {chia => flax}/util/__init__.py (100%) rename {chia => flax}/util/api_decorators.py (91%) rename {chia => flax}/util/bech32m.py (98%) rename {chia => flax}/util/beta_metrics.py (99%) rename {chia => flax}/util/block_cache.py (89%) rename {chia => flax}/util/byte_types.py (100%) rename {chia => flax}/util/cached_bls.py (95%) rename {chia => flax}/util/chain_utils.py (78%) rename {chia => flax}/util/check_fork_next_block.py (91%) rename {chia => flax}/util/chunks.py (100%) rename {chia => flax}/util/condition_tools.py (88%) rename {chia => flax}/util/config.py (98%) rename {chia => flax}/util/create_alert_file.py (96%) rename {chia => flax}/util/db_synchronous.py (100%) rename {chia => flax}/util/db_version.py (100%) rename {chia => flax}/util/db_wrapper.py (100%) create mode 100644 flax/util/default_root.py rename {chia => flax}/util/dump_keyring.py (91%) mode change 100755 => 100644 rename {chia => flax}/util/english.txt (100%) rename {chia => flax}/util/errors.py (100%) rename {chia => flax}/util/file_keyring.py (97%) rename {chia => flax}/util/files.py (100%) rename chia/util/chia_logging.py => flax/util/flax_logging.py (95%) rename {chia => flax}/util/full_block_utils.py (97%) rename {chia => flax}/util/generator_tools.py (87%) rename {chia => flax}/util/hash.py (84%) rename {chia => flax}/util/initial-config.yaml (76%) rename {chia => flax}/util/inline_executor.py (100%) rename {chia => flax}/util/ints.py (93%) rename {chia => flax}/util/json_util.py (95%) rename {chia => flax}/util/keychain.py (98%) rename {chia => flax}/util/keyring_wrapper.py (95%) rename {chia => flax}/util/lock.py (100%) rename {chia => flax}/util/log_exceptions.py (100%) rename {chia => flax}/util/lru_cache.py (100%) rename {chia => flax}/util/make_test_constants.py (63%) rename {chia => flax}/util/memory_profiler.py (99%) rename {chia => flax}/util/merkle_set.py (99%) rename {chia => flax}/util/misc.py (95%) rename {chia => flax}/util/network.py (90%) rename {chia => flax}/util/paginator.py (100%) rename {chia => flax}/util/partial_func.py (100%) rename {chia => flax}/util/path.py (100%) rename {chia => flax}/util/permissions.py (100%) rename {chia => flax}/util/pip_import.py (100%) rename {chia => flax}/util/prev_transaction_block.py (78%) rename {chia => flax}/util/profiler.py (93%) rename {chia => flax}/util/recursive_replace.py (100%) rename {chia => flax}/util/safe_cancel_task.py (100%) create mode 100644 flax/util/service_groups.py rename {chia => flax}/util/setproctitle.py (100%) rename {chia => flax}/util/significant_bits.py (100%) rename {chia => flax}/util/ssl_check.py (95%) rename {chia => flax}/util/streamable.py (99%) rename {chia => flax}/util/struct_stream.py (100%) rename {chia => flax}/util/task_timing.py (98%) rename {chia => flax}/util/validate_alert.py (95%) rename {chia => flax}/util/vdf_prover.py (72%) rename {chia => flax}/util/ws_message.py (97%) rename {chia => flax}/wallet/__init__.py (100%) rename {chia => flax}/wallet/block_record.py (84%) rename {chia => flax}/wallet/cat_wallet/__init__.py (100%) create mode 100644 flax/wallet/cat_wallet/cat_constants.py rename {chia => flax}/wallet/cat_wallet/cat_info.py (75%) rename {chia => flax}/wallet/cat_wallet/cat_outer_puzzle.py (90%) rename {chia => flax}/wallet/cat_wallet/cat_utils.py (88%) rename {chia => flax}/wallet/cat_wallet/cat_wallet.py (87%) rename {chia => flax}/wallet/cat_wallet/lineage_store.py (94%) rename {chia => flax}/wallet/coin_selection.py (95%) rename {chia => flax}/wallet/db_wallet/__init__.py (100%) rename {chia => flax}/wallet/db_wallet/db_wallet_puzzles.py (89%) rename {chia => flax}/wallet/derivation_record.py (75%) rename {chia => flax}/wallet/derive_keys.py (95%) rename {chia => flax}/wallet/did_wallet/__init__.py (100%) rename {chia => flax}/wallet/did_wallet/did_info.py (68%) rename {chia => flax}/wallet/did_wallet/did_wallet.py (95%) rename {chia => flax}/wallet/did_wallet/did_wallet_puzzles.py (93%) rename {chia => flax}/wallet/driver_protocol.py (76%) rename chia/wallet/chialisp.py => flax/wallet/flaxlisp.py (100%) rename {chia => flax}/wallet/key_val_store.py (97%) rename {chia => flax}/wallet/lineage_proof.py (78%) rename {chia => flax}/wallet/nft_wallet/__init__.py (100%) rename {chia => flax}/wallet/nft_wallet/metadata_outer_puzzle.py (91%) rename {chia => flax}/wallet/nft_wallet/nft_info.py (87%) rename {chia => flax}/wallet/nft_wallet/nft_puzzles.py (95%) rename {chia => flax}/wallet/nft_wallet/nft_wallet.py (91%) rename {chia => flax}/wallet/nft_wallet/ownership_outer_puzzle.py (93%) rename {chia => flax}/wallet/nft_wallet/singleton_outer_puzzle.py (89%) rename {chia => flax}/wallet/nft_wallet/transfer_program_puzzle.py (88%) rename {chia => flax}/wallet/nft_wallet/uncurry_nft.py (96%) rename {chia => flax}/wallet/notification_manager.py (79%) rename {chia => flax}/wallet/notification_store.py (96%) rename {chia => flax}/wallet/outer_puzzles.py (84%) rename {chia => flax}/wallet/payment.py (85%) rename {chia => flax}/wallet/puzzle_drivers.py (98%) rename {chia => flax}/wallet/puzzles/__init__.py (100%) rename {chia => flax}/wallet/puzzles/block_program_zero.clvm (100%) rename {chia => flax}/wallet/puzzles/block_program_zero.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/block_program_zero.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/calculate_synthetic_public_key.clvm (100%) rename {chia => flax}/wallet/puzzles/calculate_synthetic_public_key.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/cat_loader.py (80%) rename {chia => flax}/wallet/puzzles/cat_truths.clib (100%) rename {chia => flax}/wallet/puzzles/cat_v2.clvm (100%) rename {chia => flax}/wallet/puzzles/cat_v2.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/cat_v2.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/condition_codes.clvm (96%) rename {chia => flax}/wallet/puzzles/create-lock-puzzlehash.clvm (100%) rename {chia => flax}/wallet/puzzles/create_nft_launcher_from_did.clvm (100%) rename {chia => flax}/wallet/puzzles/create_nft_launcher_from_did.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/create_nft_launcher_from_did.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/curry-and-treehash.clinc (100%) rename {chia => flax}/wallet/puzzles/decompress_block_spends.clvm (94%) rename {chia => flax}/wallet/puzzles/decompress_block_spends.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/decompress_block_spends.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/decompress_block_spends.py (74%) rename {chia => flax}/wallet/puzzles/decompress_coin_spend_entry.clvm (100%) rename {chia => flax}/wallet/puzzles/decompress_coin_spend_entry.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/decompress_coin_spend_entry.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm (100%) rename {chia => flax}/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/decompress_puzzle.clvm (100%) rename {chia => flax}/wallet/puzzles/decompress_puzzle.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/delegated_tail.clvm (100%) rename {chia => flax}/wallet/puzzles/delegated_tail.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/delegated_tail.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/did_innerpuz.clvm (100%) rename {chia => flax}/wallet/puzzles/did_innerpuz.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/everything_with_signature.clvm (100%) rename {chia => flax}/wallet/puzzles/everything_with_signature.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/everything_with_signature.clvm.hex.sha256tree (100%) rename chia/wallet/puzzles/chialisp_deserialisation.clvm => flax/wallet/puzzles/flaxlisp_deserialisation.clvm (100%) rename chia/wallet/puzzles/chialisp_deserialisation.clvm.hex => flax/wallet/puzzles/flaxlisp_deserialisation.clvm.hex (100%) rename chia/wallet/puzzles/chialisp_deserialisation.clvm.hex.sha256tree => flax/wallet/puzzles/flaxlisp_deserialisation.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/genesis_by_coin_id.clvm (100%) rename {chia => flax}/wallet/puzzles/genesis_by_coin_id.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/genesis_by_coin_id.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/genesis_by_puzzle_hash.clvm (100%) rename {chia => flax}/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/graftroot_dl_offers.clvm (100%) rename {chia => flax}/wallet/puzzles/graftroot_dl_offers.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/graftroot_dl_offers.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/json.clib (100%) rename {chia => flax}/wallet/puzzles/load_clvm.py (92%) rename {chia => flax}/wallet/puzzles/lock.inner.puzzle.clvm (100%) rename {chia => flax}/wallet/puzzles/lock.inner.puzzle.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/merkle_utils.clib (100%) rename {chia => flax}/wallet/puzzles/nft_intermediate_launcher.clvm (100%) rename {chia => flax}/wallet/puzzles/nft_intermediate_launcher.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/nft_intermediate_launcher.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/nft_metadata_updater_default.clvm (100%) rename {chia => flax}/wallet/puzzles/nft_metadata_updater_default.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/nft_metadata_updater_default.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/nft_metadata_updater_updateable.clvm (100%) rename {chia => flax}/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/nft_ownership_layer.clvm (100%) rename {chia => flax}/wallet/puzzles/nft_ownership_layer.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/nft_ownership_layer.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm (99%) rename {chia => flax}/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/nft_state_layer.clvm (100%) rename {chia => flax}/wallet/puzzles/nft_state_layer.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/nft_state_layer.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/notification.clvm (100%) rename {chia => flax}/wallet/puzzles/notification.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/notification.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_conditions.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_conditions.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_conditions.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_conditions.py (92%) rename {chia => flax}/wallet/puzzles/p2_delegated_conditions.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_conditions.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_conditions.py (89%) rename {chia => flax}/wallet/puzzles/p2_delegated_puzzle.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_puzzle.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_puzzle.py (95%) rename {chia => flax}/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py (94%) rename {chia => flax}/wallet/puzzles/p2_m_of_n_delegate_direct.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_m_of_n_delegate_direct.py (91%) rename {chia => flax}/wallet/puzzles/p2_parent.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_parent.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_parent.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_puzzle_hash.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_puzzle_hash.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_puzzle_hash.py (86%) rename {chia => flax}/wallet/puzzles/p2_singleton.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_singleton.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_singleton.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm (100%) rename {chia => flax}/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/pool_member_innerpuz.clvm (100%) rename {chia => flax}/wallet/puzzles/pool_member_innerpuz.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/pool_waitingroom_innerpuz.clvm (100%) rename {chia => flax}/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/prefarm/__init__.py (100%) rename {chia => flax}/wallet/puzzles/prefarm/make_prefarm_ph.py (66%) rename {chia => flax}/wallet/puzzles/prefarm/spend_prefarm.py (80%) rename {chia => flax}/wallet/puzzles/puzzle_utils.py (97%) rename {chia => flax}/wallet/puzzles/recompile-all.sh (100%) mode change 100755 => 100644 rename {chia => flax}/wallet/puzzles/rom_bootstrap_generator.clvm (96%) rename {chia => flax}/wallet/puzzles/rom_bootstrap_generator.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/rom_bootstrap_generator.py (78%) rename {chia => flax}/wallet/puzzles/settlement_payments.clvm (100%) rename {chia => flax}/wallet/puzzles/settlement_payments.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/settlement_payments.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/settlement_payments_old.clvm (100%) rename {chia => flax}/wallet/puzzles/settlement_payments_old.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/settlement_payments_old.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/sha256tree.clib (100%) rename {chia => flax}/wallet/puzzles/sha256tree_module.clvm (100%) rename {chia => flax}/wallet/puzzles/sha256tree_module.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/singleton_launcher.clvm (100%) rename {chia => flax}/wallet/puzzles/singleton_launcher.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/singleton_top_layer.clvm (100%) rename {chia => flax}/wallet/puzzles/singleton_top_layer.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/singleton_top_layer.py (96%) rename {chia => flax}/wallet/puzzles/singleton_top_layer_v1_1.clvm (100%) rename {chia => flax}/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/singleton_top_layer_v1_1.py (95%) rename {chia => flax}/wallet/puzzles/singleton_truths.clib (100%) rename {chia => flax}/wallet/puzzles/tails.py (92%) rename {chia => flax}/wallet/puzzles/test_generator_deserialize.clvm (100%) rename {chia => flax}/wallet/puzzles/test_generator_deserialize.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/test_multiple_generator_input_arguments.clvm (100%) rename {chia => flax}/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex (100%) rename {chia => flax}/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree (100%) rename {chia => flax}/wallet/puzzles/utility_macros.clib (100%) rename {chia => flax}/wallet/secret_key_store.py (100%) rename {chia => flax}/wallet/settings/__init__.py (100%) rename {chia => flax}/wallet/settings/default_settings.py (75%) rename {chia => flax}/wallet/settings/settings_objects.py (90%) rename {chia => flax}/wallet/settings/user_settings.py (85%) rename {chia => flax}/wallet/sign_coin_spends.py (94%) rename {chia => flax}/wallet/trade_manager.py (95%) rename {chia => flax}/wallet/trade_record.py (83%) rename {chia => flax}/wallet/trading/__init__.py (100%) rename {chia => flax}/wallet/trading/offer.py (96%) rename {chia => flax}/wallet/trading/trade_status.py (100%) rename {chia => flax}/wallet/trading/trade_store.py (98%) rename {chia => flax}/wallet/transaction_record.py (88%) rename {chia => flax}/wallet/transaction_sorting.py (100%) rename {chia => flax}/wallet/uncurried_puzzle.py (81%) rename {chia => flax}/wallet/util/__init__.py (100%) rename {chia => flax}/wallet/util/address_type.py (87%) rename {chia => flax}/wallet/util/compute_hints.py (71%) rename {chia => flax}/wallet/util/compute_memos.py (83%) rename {chia => flax}/wallet/util/curry_and_treehash.py (97%) rename {chia => flax}/wallet/util/debug_spend_bundle.py (95%) create mode 100644 flax/wallet/util/json_clvm_utils.py rename {chia => flax}/wallet/util/merkle_tree.py (97%) rename {chia => flax}/wallet/util/merkle_utils.py (98%) rename {chia => flax}/wallet/util/new_peak_queue.py (93%) rename {chia => flax}/wallet/util/notifications.py (51%) rename {chia => flax}/wallet/util/peer_request_cache.py (96%) rename {chia => flax}/wallet/util/puzzle_compression.py (95%) rename {chia => flax}/wallet/util/transaction_type.py (100%) rename {chia => flax}/wallet/util/wallet_sync_utils.py (93%) rename {chia => flax}/wallet/util/wallet_types.py (84%) rename {chia => flax}/wallet/wallet.py (92%) rename {chia => flax}/wallet/wallet_action.py (93%) rename {chia => flax}/wallet/wallet_blockchain.py (92%) rename {chia => flax}/wallet/wallet_coin_record.py (70%) rename {chia => flax}/wallet/wallet_coin_store.py (96%) rename {chia => flax}/wallet/wallet_info.py (91%) rename {chia => flax}/wallet/wallet_interested_store.py (97%) rename {chia => flax}/wallet/wallet_nft_store.py (96%) rename {chia => flax}/wallet/wallet_node.py (95%) rename {chia => flax}/wallet/wallet_node_api.py (89%) rename {chia => flax}/wallet/wallet_pool_store.py (97%) rename {chia => flax}/wallet/wallet_protocol.py (81%) rename {chia => flax}/wallet/wallet_puzzle_store.py (97%) rename {chia => flax}/wallet/wallet_retry_store.py (93%) rename {chia => flax}/wallet/wallet_state_manager.py (95%) rename {chia => flax}/wallet/wallet_transaction_store.py (97%) rename {chia => flax}/wallet/wallet_user_store.py (93%) rename {chia => flax}/wallet/wallet_weight_proof_handler.py (92%) mode change 100644 => 100755 install-timelord.sh mode change 100755 => 100644 run-py-tests.sh mode change 100755 => 100644 tests/build-init-files.py mode change 100755 => 100644 tests/check_pytest_monitor_output.py mode change 100755 => 100644 tests/check_sql_statements.py rename tests/clvm/{test_chialisp_deserialization.py => test_flaxlisp_deserialization.py} (93%) rename tests/{chia-start-sim => flax-start-sim} (65%) mode change 100755 => 100644 rename tests/wallet/{test_chialisp.py => test_flaxlisp.py} (97%) mode change 100755 => 100644 tools/analyze-chain.py mode change 100755 => 100644 tools/run_benchmark.sh mode change 100755 => 100644 tools/test_full_sync.py diff --git a/.coveragerc b/.coveragerc index 574fbb4b7..169e31746 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,7 +2,7 @@ branch=True relative_files=True source= - chia + flax tests concurrency=multiprocessing parallel=True diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 706ba9039..000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @Chia-Network/required-reviewers diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..ecc1bbd50 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,34 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG]" +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. (If what you are experiencing is NOT a bug but instead a support issue, please open a Discussion instead!) + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + +- OS: [e.g. Linux] +- OS Version/Flavor: [e.g. CentOS 7.2] +- CPU: [e.g. Intel Xeon 8175M] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml deleted file mode 100644 index 72d803bc0..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: Bug Report -description: File a bug report -title: "[Bug] " -labels: ["bug"] -#assignees: -body: - - type: markdown - attributes: - value: | - Please fill out a clear and concise description of what the bug is. (If what you are experiencing is NOT a bug but instead a support issue, please open a Discussion instead!) - - type: textarea - id: what-happened - attributes: - label: What happened? - description: A clear and concise description of what happened, how to reproduce it, and what you expected to happen. - validations: - required: true - - type: input - id: version - attributes: - label: Version - description: What version of Chia are you running? - validations: - required: true - - type: dropdown - id: platform - attributes: - label: What platform are you using? - multiple: false - options: - - Windows - - macOS - - Linux - - Pi4 - validations: - required: true - - type: dropdown - id: ui - attributes: - label: What ui mode are you using? - multiple: false - options: - - GUI - - CLI - validations: - required: true - - type: textarea - id: logs - attributes: - label: Relevant log output - description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. - render: shell diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 7eb7dd7a2..cdaf5e08b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,11 +2,11 @@ contact_links: - about: Ask a question or request support here name: Ask for Support url: >- - https://github.com/Chia-Network/chia-blockchain/discussions/new?category=support + https://github.com/Flax-Network/flax-blockchain/discussions/new?category=support - about: Request a new feature or idea here name: Make a Request url: >- - https://github.com/Chia-Network/chia-blockchain/discussions/new?category=ideas - - about: Get support on the Chia Keybase chat channels. - name: Join the Keybase.io support chat - url: 'https://keybase.io/team/chia_network.public' + https://github.com/Flax-Network/flax-blockchain/discussions/new?category=ideas + - about: Get support on the Flax Discord chat channels. + name: Join the Discord.io support chat + url: 'https://discord.gg/TgJyxsEFFc' diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 2bd56b190..187ce14e0 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -1,4 +1,4 @@ -name: "Install chia-blockchain" +name: "Install flax-blockchain" description: "Run the platform appropriate installer script." diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 021d3cac9..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Basic dependabot.yml file with -# minimum configuration for two package managers - -version: 2 -updates: - # Enable version updates for Python - - package-ecosystem: "pip" - # Look for a `Dockerfile` in the `root` directory - directory: "/" - # Check for updates once a week - schedule: - interval: "weekly" - day: "tuesday" - target-branch: "main" - pull-request-branch-name: - # Separate sections of the branch name with a hyphen - # for example, `dependabot-npm_and_yarn-next_js-acorn-6.4.1` - separator: "-" - - # Maintain dependencies for GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" - # Check for updates once a week - schedule: - interval: "weekly" - day: "tuesday" - target-branch: "main" - pull-request-branch-name: - # Separate sections of the branch name with a hyphen - # for example, `dependabot-npm_and_yarn-next_js-acorn-6.4.1` - separator: "-" diff --git a/.github/linters/.flake8 b/.github/linters/.flake8 new file mode 100644 index 000000000..ea38e9cb9 --- /dev/null +++ b/.github/linters/.flake8 @@ -0,0 +1,4 @@ +[flake8] +max-line-length = 120 +exclude = ./typings/**/* +ignore = E203,W503 diff --git a/.github/linters/.isort.cfg b/.github/linters/.isort.cfg new file mode 100644 index 000000000..d21b9f236 --- /dev/null +++ b/.github/linters/.isort.cfg @@ -0,0 +1,20 @@ +[settings] +profile= + +; vertical hanging indent mode also used in black configuration +multi_line_output = 3 + +; necessary because black expect the trailing comma +include_trailing_comma = true + +; black compatibility +force_grid_wrap = 0 + +; black compatibility +use_parentheses = True + +; black compatibility +ensure_newline_before_comments = True + +; we chose 120 as line length +line_length = 120 diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml new file mode 100644 index 000000000..54a2067a9 --- /dev/null +++ b/.github/linters/.markdown-lint.yml @@ -0,0 +1,38 @@ +--- +########################### +########################### +## Markdown Linter rules ## +########################### +########################### + +# Linter rules doc: +# - https://github.com/DavidAnson/markdownlint +# +# Note: +# To comment out a single error: +# +# any violations you want +# +# + +############### +# Rules by id # +############### +MD004: false # Unordered list style +MD007: + indent: 2 # Unordered list indentation +MD013: + line_length: 808 # Line length +MD024: + allow_different_nesting: true +MD026: + punctuation: ".,;:!。,;:" # List of not allowed +MD029: false # Ordered list item prefix +MD033: false # Allow inline HTML +MD036: false # Emphasis used instead of a heading +MD041: false # Allow file to start without h1 + +################# +# Rules by tags # +################# +blank_lines: false # Error on blank lines diff --git a/.github/linters/.python-black b/.github/linters/.python-black new file mode 100644 index 000000000..aa709bfe0 --- /dev/null +++ b/.github/linters/.python-black @@ -0,0 +1,2 @@ +[tool.black] +line_length = 120 diff --git a/.github/linters/.python-lint b/.github/linters/.python-lint new file mode 100644 index 000000000..0e6ea29a8 --- /dev/null +++ b/.github/linters/.python-lint @@ -0,0 +1,564 @@ +[MASTER] +errors-only= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code +extension-pkg-whitelist= + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Add files or directories matching the regex patterns to the blacklist. The +# regex matches against base names, not paths. +ignore-patterns= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Use multiple processes to speed up Pylint. +jobs=1 + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Pickle collected data for later comparisons. +persistent=yes + +# Specify a configuration file. +#rcfile= + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED +confidence= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +disable=print-statement, + parameter-unpacking, + unpacking-in-except, + old-raise-syntax, + backtick, + long-suffix, + old-ne-operator, + old-octal-literal, + import-star-module-level, + non-ascii-bytes-literal, + raw-checker-failed, + bad-inline-option, + locally-disabled, + locally-enabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + apply-builtin, + basestring-builtin, + buffer-builtin, + cmp-builtin, + coerce-builtin, + execfile-builtin, + file-builtin, + long-builtin, + raw_input-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + no-absolute-import, + old-division, + dict-iter-method, + dict-view-method, + next-method-called, + metaclass-assignment, + indexing-exception, + raising-string, + reload-builtin, + oct-method, + hex-method, + nonzero-method, + cmp-method, + input-builtin, + round-builtin, + intern-builtin, + unichr-builtin, + map-builtin-not-iterating, + zip-builtin-not-iterating, + range-builtin-not-iterating, + filter-builtin-not-iterating, + using-cmp-argument, + eq-without-hash, + div-method, + idiv-method, + rdiv-method, + exception-message-attribute, + invalid-str-codec, + sys-max-int, + bad-python3-import, + deprecated-string-function, + deprecated-str-translate-call, + deprecated-itertools-function, + deprecated-types-field, + next-method-defined, + dict-items-not-iterating, + dict-keys-not-iterating, + dict-values-not-iterating, + import-error + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +enable=c-extension-no-member + + +[REPORTS] + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details +#msg-template= + +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio).You can also give a reporter class, eg +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Tells whether to display a full report or only the messages +reports=no + +# Activate the evaluation score. +score=no + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=optparse.Values,sys.exit + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins=cls + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expectedly +# not used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins + + +[LOGGING] + +# Logging modules to check that the string format arguments are in logging +# function parameter format +logging-modules=logging + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules=blspy, + chiabip158, + chiapos, + chiavdf, + cryptography, + aiohttp, + websockets, + keyring, + keyrings.cryptfile, + bitstring, + clvm_tools, + setproctitle, + clvm, + colorlog, + concurrent_log_handler, + aiosqlite, + sortedcontainers, + aiter, + miniupnpc, + pytest, + setuptools_scm + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO + + +[BASIC] + +# Naming style matching correct argument names +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style +#argument-rgx= + +# Naming style matching correct attribute names +attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style +#attr-rgx= + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo, + bar, + baz, + toto, + tutu, + tata + +# Naming style matching correct class attribute names +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style +#class-attribute-rgx= + +# Naming style matching correct class names +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming-style +#class-rgx= + +# Naming style matching correct constant names +const-naming-style=UPPER_CASE + +# Regular expression matching correct constant names. Overrides const-naming- +# style +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma +good-names=i, + j, + k, + ex, + Run, + _ + +# Include a hint for the correct naming format with invalid-name +include-naming-hint=no + +# Naming style matching correct inline iteration names +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style +#inlinevar-rgx= + +# Naming style matching correct method names +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style +#method-rgx= + +# Naming style matching correct module names +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +property-classes=abc.abstractproperty + +# Naming style matching correct variable names +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style +#variable-rgx= + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes +max-spelling-suggestions=4 + +# Spelling dictionary name. Available dictionaries: none. To make it working +# install python-enchant package. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to indicated private dictionary in +# --spelling-private-dict-file option instead of raising a message. +spelling-store-unknown-words=no + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=100 + +# Maximum number of lines in a module +max-module-lines=1000 + +# List of optional constructs for which whitespace checking is disabled. `dict- +# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. +# `trailing-comma` allows a space between comma and closing bracket: (a, ). +# `empty-line` allows space-only lines. +no-space-check=trailing-comma, + dict-separator + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[SIMILARITIES] + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[DESIGN] + +# Maximum number of arguments for function / method +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in a if statement +max-bool-expr=5 + +# Maximum number of branch for function / method body +max-branches=12 + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of statements in function / method body +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + + +[IMPORTS] + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub, + TERMIOS, + Bastion, + rexec + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict, + _fields, + _replace, + _source, + _make + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml deleted file mode 100644 index 9af5a5aee..000000000 --- a/.github/workflows/benchmarks.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: ⚡️ Benchmarks - -on: - push: - branches: - - 'long_lived/**' - - main - - 'release/**' - release: - types: [published] - pull_request: - branches: - - '**' - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - build: - name: Benchmarks - runs-on: benchmark - timeout-minutes: 30 - strategy: - fail-fast: false - max-parallel: 4 - matrix: - python-version: [ 3.9 ] - env: - CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet - BLOCKS_AND_PLOTS_VERSION: 0.29.0 - - steps: - - name: Clean workspace - uses: Chia-Network/actions/clean-workspace@main - - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Python environment - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - name: Get pip cache dir - id: pip-cache - run: | - echo "::set-output name=dir::$(pip cache dir)" - - - name: Cache pip - uses: actions/cache@v3 - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Checkout test blocks and plots - uses: actions/checkout@v3 - with: - repository: 'Chia-Network/test-cache' - path: '.chia' - ref: ${{ env.BLOCKS_AND_PLOTS_VERSION }} - fetch-depth: 1 - - - uses: ./.github/actions/install - with: - python-version: ${{ matrix.python-version }} - development: true - - - uses: chia-network/actions/activate-venv@main - - - name: pytest - run: | - pytest -n 0 --capture no -m benchmark tests diff --git a/.github/workflows/build-linux-arm64-installer.yml b/.github/workflows/build-linux-arm64-installer.yml index 2e7bbf116..a0035af05 100644 --- a/.github/workflows/build-linux-arm64-installer.yml +++ b/.github/workflows/build-linux-arm64-installer.yml @@ -6,17 +6,12 @@ on: - 'long_lived/**' - main - 'release/**' - release: - types: [published] + tags: + - '**' pull_request: branches: - '**' -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - jobs: build: name: Linux arm64 DEB Installer @@ -41,8 +36,6 @@ jobs: fetch-depth: 0 submodules: recursive - - uses: Chia-Network/actions/git-ssh-to-https@main - - name: Cleanup any leftovers that exist from previous runs run: bash build_scripts/clean-runner.sh || true @@ -67,25 +60,9 @@ jobs: python3 -m venv ../venv . ../venv/bin/activate pip3 install setuptools_scm - echo "::set-output name=CHIA_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)" + echo "::set-output name=FLAX_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)" deactivate - - name: Test for secrets access - id: check_secrets - shell: bash - run: | - unset HAS_AWS_SECRET - unset HAS_GLUE_SECRET - - if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi - echo ::set-output name=HAS_AWS_SECRET::${HAS_AWS_SECRET} - - if [ -n "$GLUE_ACCESS_TOKEN" ]; then HAS_GLUE_SECRET='true' ; fi - echo ::set-output name=HAS_GLUE_SECRET::${HAS_GLUE_SECRET} - env: - AWS_SECRET: "${{ secrets.INSTALLER_UPLOAD_KEY }}" - GLUE_ACCESS_TOKEN: "${{ secrets.GLUE_ACCESS_TOKEN }}" - # Get the most recent release from chia-plotter-madmax - uses: actions/github-script@v6 id: 'latest-madmax' @@ -102,10 +79,10 @@ jobs: - name: Get latest madmax plotter run: | mkdir "$GITHUB_WORKSPACE/madmax" - wget -O "$GITHUB_WORKSPACE/madmax/chia_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-arm64 - wget -O "$GITHUB_WORKSPACE/madmax/chia_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-arm64 - chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot" - chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot_k34" + wget -O "$GITHUB_WORKSPACE/madmax/flax_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-arm64 + wget -O "$GITHUB_WORKSPACE/madmax/flax_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-arm64 + chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot" + chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot_k34" # Get the most recent release from bladebit - uses: actions/github-script@v6 @@ -148,18 +125,18 @@ jobs: - name: Prepare GUI cache id: gui-ref run: | - gui_ref=$(git submodule status chia-blockchain-gui | sed -e 's/^ //g' -e 's/ chia-blockchain-gui.*$//g') + gui_ref=$(git submodule status flax-blockchain-gui | sed -e 's/^ //g' -e 's/ flax-blockchain-gui.*$//g') echo "${gui_ref}" echo "::set-output name=GUI_REF::${gui_ref}" - echo "rm -rf ./chia-blockchain-gui" - rm -rf ./chia-blockchain-gui + echo "rm -rf ./flax-blockchain-gui" + rm -rf ./flax-blockchain-gui - name: Cache GUI uses: actions/cache@v3 id: cache-gui with: - path: ./chia-blockchain-gui - key: ${{ runner.os }}-arm64-chia-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} + path: ./flax-blockchain-gui + key: ${{ runner.os }}-arm64-flax-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} - if: steps.cache-gui.outputs.cache-hit != 'true' name: Build GUI @@ -170,7 +147,7 @@ jobs: - name: Build arm64 .deb package env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} + FLAX_INSTALLER_VERSION: ${{ steps.version_number.outputs.FLAX_INSTALLER_VERSION }} run: | ldd --version cd ./build_scripts @@ -179,96 +156,13 @@ jobs: - name: Upload Linux artifacts uses: actions/upload-artifact@v3 with: - name: chia-installers-linux-deb-arm64 + name: flax-installers-linux-deb-arm64 path: ${{ github.workspace }}/build_scripts/final_installer/ - - name: Configure AWS Credentials - if: steps.check_secrets.outputs.HAS_AWS_SECRET - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.INSTALLER_UPLOAD_KEY }} - aws-secret-access-key: ${{ secrets.INSTALLER_UPLOAD_SECRET }} - aws-region: us-west-2 - - - name: Upload to s3 - if: steps.check_secrets.outputs.HAS_AWS_SECRET - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - GIT_SHORT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-8) - CHIA_DEV_BUILD=${CHIA_INSTALLER_VERSION}-$GIT_SHORT_HASH - echo "CHIA_DEV_BUILD=$CHIA_DEV_BUILD" >>$GITHUB_ENV - aws s3 cp "$GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb" "s3://download.chia.net/dev/chia-blockchain_${CHIA_DEV_BUILD}_arm64.deb" - aws s3 cp "$GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb" "s3://download.chia.net/dev/chia-blockchain-cli_${CHIA_DEV_BUILD}-1_arm64.deb" - - - name: Create Checksums - if: env.FULL_RELEASE == 'true' || github.ref == 'refs/heads/main' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - ls $GITHUB_WORKSPACE/build_scripts/final_installer/ - sha256sum $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb > $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb.sha256 - sha256sum $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb > $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb.sha256 - ls $GITHUB_WORKSPACE/build_scripts/final_installer/ - - - name: Create torrent - if: env.FULL_RELEASE == 'true' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb -o $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb.torrent --webseed https://download.chia.net/install/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb - py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb -o $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb.torrent --webseed https://download.chia.net/install/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb - gh release upload $RELEASE_TAG $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb.torrent - - - name: Upload Dev Installer - if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/main' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb s3://download.chia.net/latest-dev/chia-blockchain_arm64_latest_dev.deb - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb.sha256 s3://download.chia.net/latest-dev/chia-blockchain_arm64_latest_dev.deb.sha256 - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb s3://download.chia.net/latest-dev/chia-blockchain-cli_arm64_latest_dev.deb - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb.sha256 s3://download.chia.net/latest-dev/chia-blockchain-cli_arm64_latest_dev.deb.sha256 - - - name: Upload Release Files - if: steps.check_secrets.outputs.HAS_AWS_SECRET && env.FULL_RELEASE == 'true' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb.sha256 s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb.torrent s3://download.chia.net/torrents/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb.sha256 s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_arm64.deb.torrent s3://download.chia.net/torrents/ - - - name: Get tag name - if: startsWith(github.ref, 'refs/tags/') - id: tag-name - run: | - echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)" - echo "::set-output name=REPO_NAME::$(echo ${{ github.repository }} | cut -d'/' -f 2)" - - - name: Upload release artifacts - if: env.RELEASE == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - gh release upload \ - $RELEASE_TAG \ - build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_arm64.deb - - - name: Mark installer complete - if: steps.check_secrets.outputs.HAS_GLUE_SECRET && env.FULL_RELEASE == 'true' - run: | - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"chia_ref": "${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/success/build-arm - - name: Clean up on self hosted runner run: | sudo rm -rf build_scripts/final_installer - name: Remove working files to exclude from cache run: | - rm -rf ./chia-blockchain-gui/packages/gui/daemon + rm -rf ./flax-blockchain-gui/packages/gui/daemon diff --git a/.github/workflows/build-linux-installer-deb.yml b/.github/workflows/build-linux-installer-deb.yml index a103dbf5b..2b9a6c6ab 100644 --- a/.github/workflows/build-linux-installer-deb.yml +++ b/.github/workflows/build-linux-installer-deb.yml @@ -1,23 +1,17 @@ name: 📦🚀 Build Installer - Linux DEB AMD64 on: - workflow_dispatch: push: branches: - 'long_lived/**' - main - 'release/**' - release: - types: [published] + tags: + - '**' pull_request: branches: - '**' -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - jobs: build: name: Linux amd64 DEB Installer @@ -42,8 +36,6 @@ jobs: fetch-depth: 0 submodules: recursive - - uses: Chia-Network/actions/git-ssh-to-https@main - - name: Cleanup any leftovers that exist from previous runs run: bash build_scripts/clean-runner.sh || true @@ -68,25 +60,9 @@ jobs: python3 -m venv ../venv . ../venv/bin/activate pip3 install setuptools_scm - echo "::set-output name=CHIA_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)" + echo "::set-output name=FLAX_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)" deactivate - - name: Test for secrets access - id: check_secrets - shell: bash - run: | - unset HAS_AWS_SECRET - unset HAS_GLUE_SECRET - - if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi - echo ::set-output name=HAS_AWS_SECRET::${HAS_AWS_SECRET} - - if [ -n "$GLUE_ACCESS_TOKEN" ]; then HAS_GLUE_SECRET='true' ; fi - echo ::set-output name=HAS_GLUE_SECRET::${HAS_GLUE_SECRET} - env: - AWS_SECRET: "${{ secrets.INSTALLER_UPLOAD_KEY }}" - GLUE_ACCESS_TOKEN: "${{ secrets.GLUE_ACCESS_TOKEN }}" - # Get the most recent release from chia-plotter-madmax - uses: actions/github-script@v6 id: 'latest-madmax' @@ -103,10 +79,10 @@ jobs: - name: Get latest madmax plotter run: | mkdir "$GITHUB_WORKSPACE/madmax" - wget -O "$GITHUB_WORKSPACE/madmax/chia_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-x86-64 - wget -O "$GITHUB_WORKSPACE/madmax/chia_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-x86-64 - chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot" - chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot_k34" + wget -O "$GITHUB_WORKSPACE/madmax/flax_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-x86-64 + wget -O "$GITHUB_WORKSPACE/madmax/flax_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-x86-64 + chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot" + chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot_k34" # Get the most recent release from bladebit - uses: actions/github-script@v6 @@ -149,18 +125,18 @@ jobs: - name: Prepare GUI cache id: gui-ref run: | - gui_ref=$(git submodule status chia-blockchain-gui | sed -e 's/^ //g' -e 's/ chia-blockchain-gui.*$//g') + gui_ref=$(git submodule status flax-blockchain-gui | sed -e 's/^ //g' -e 's/ flax-blockchain-gui.*$//g') echo "${gui_ref}" echo "::set-output name=GUI_REF::${gui_ref}" - echo "rm -rf ./chia-blockchain-gui" - rm -rf ./chia-blockchain-gui + echo "rm -rf ./flax-blockchain-gui" + rm -rf ./flax-blockchain-gui - name: Cache GUI uses: actions/cache@v3 id: cache-gui with: - path: ./chia-blockchain-gui - key: ${{ runner.os }}-deb-chia-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} + path: ./flax-blockchain-gui + key: ${{ runner.os }}-deb-flax-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} - if: steps.cache-gui.outputs.cache-hit != 'true' name: Build GUI @@ -171,7 +147,7 @@ jobs: - name: Build .deb package env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} + FLAX_INSTALLER_VERSION: ${{ steps.version_number.outputs.FLAX_INSTALLER_VERSION }} run: | ldd --version cd ./build_scripts @@ -180,92 +156,9 @@ jobs: - name: Upload Linux artifacts uses: actions/upload-artifact@v3 with: - name: chia-installers-linux-deb-intel + name: flax-installers-linux-deb-intel path: ${{ github.workspace }}/build_scripts/final_installer/ - - name: Configure AWS Credentials - if: steps.check_secrets.outputs.HAS_AWS_SECRET - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.INSTALLER_UPLOAD_KEY }} - aws-secret-access-key: ${{ secrets.INSTALLER_UPLOAD_SECRET }} - aws-region: us-west-2 - - - name: Upload to s3 - if: steps.check_secrets.outputs.HAS_AWS_SECRET - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - GIT_SHORT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-8) - CHIA_DEV_BUILD=${CHIA_INSTALLER_VERSION}-$GIT_SHORT_HASH - echo "CHIA_DEV_BUILD=$CHIA_DEV_BUILD" >>$GITHUB_ENV - aws s3 cp "$GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb" "s3://download.chia.net/dev/chia-blockchain_${CHIA_DEV_BUILD}_amd64.deb" - aws s3 cp "$GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb" "s3://download.chia.net/dev/chia-blockchain-cli_${CHIA_DEV_BUILD}-1_amd64.deb" - - - name: Create Checksums - if: env.FULL_RELEASE == 'true' || github.ref == 'refs/heads/main' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - ls $GITHUB_WORKSPACE/build_scripts/final_installer/ - sha256sum $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb > $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb.sha256 - sha256sum $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb > $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb.sha256 - ls $GITHUB_WORKSPACE/build_scripts/final_installer/ - - - name: Create .deb torrent - if: env.FULL_RELEASE == 'true' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb -o $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb.torrent --webseed https://download.chia.net/install/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb - py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb -o $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb.torrent --webseed https://download.chia.net/install/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb - gh release upload $RELEASE_TAG $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb.torrent - - - name: Upload Dev Installer - if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/main' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb s3://download.chia.net/latest-dev/chia-blockchain_amd64_latest_dev.deb - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb.sha256 s3://download.chia.net/latest-dev/chia-blockchain_amd64_latest_dev.deb.sha256 - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb s3://download.chia.net/latest-dev/chia-blockchain-cli_amd64_latest_dev.deb - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb.sha256 s3://download.chia.net/latest-dev/chia-blockchain-cli_amd64_latest_dev.deb.sha256 - - - name: Upload Release Files - if: steps.check_secrets.outputs.HAS_AWS_SECRET && env.FULL_RELEASE == 'true' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb.sha256 s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb.torrent s3://download.chia.net/torrents/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb.sha256 s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli_${CHIA_INSTALLER_VERSION}-1_amd64.deb.torrent s3://download.chia.net/torrents/ - - - name: Get tag name - if: startsWith(github.ref, 'refs/tags/') - id: tag-name - run: | - echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)" - echo "::set-output name=REPO_NAME::$(echo ${{ github.repository }} | cut -d'/' -f 2)" - - - name: Upload release artifacts - if: env.RELEASE == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - gh release upload \ - $RELEASE_TAG \ - build_scripts/final_installer/chia-blockchain_${CHIA_INSTALLER_VERSION}_amd64.deb - - - name: Mark installer complete - if: steps.check_secrets.outputs.HAS_GLUE_SECRET && env.FULL_RELEASE == 'true' - run: | - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"chia_ref": "${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/success/build-linux-deb - - name: Remove working files to exclude from cache run: | - rm -rf ./chia-blockchain-gui/packages/gui/daemon + rm -rf ./flax-blockchain-gui/packages/gui/daemon diff --git a/.github/workflows/build-linux-installer-rpm.yml b/.github/workflows/build-linux-installer-rpm.yml index ad7be6e79..0a6eed16d 100644 --- a/.github/workflows/build-linux-installer-rpm.yml +++ b/.github/workflows/build-linux-installer-rpm.yml @@ -1,23 +1,17 @@ name: 📦🚀 Build Installer - Linux RPM AMD64 on: - workflow_dispatch: push: branches: - 'long_lived/**' - main - 'release/**' - release: - types: [published] + tags: + - '**' pull_request: branches: - '**' -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - jobs: build: name: Linux amd64 RPM Installer @@ -38,8 +32,6 @@ jobs: fetch-depth: 0 submodules: recursive - - uses: Chia-Network/actions/git-ssh-to-https@main - - name: Cleanup any leftovers that exist from previous runs run: bash build_scripts/clean-runner.sh || true @@ -57,9 +49,6 @@ jobs: echo "FULL_RELEASE=false" >>$GITHUB_ENV fi - - uses: Chia-Network/actions/enforce-semver@main - if: env.FULL_RELEASE == 'true' - # Create our own venv outside of the git directory JUST for getting the ACTUAL version so that install can't break it - name: Get version number id: version_number @@ -67,25 +56,9 @@ jobs: python3 -m venv ../venv . ../venv/bin/activate pip3 install setuptools_scm - echo "::set-output name=CHIA_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)" + echo "::set-output name=FLAX_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)" deactivate - - name: Test for secrets access - id: check_secrets - shell: bash - run: | - unset HAS_AWS_SECRET - unset HAS_GLUE_SECRET - - if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi - echo ::set-output name=HAS_AWS_SECRET::${HAS_AWS_SECRET} - - if [ -n "$GLUE_ACCESS_TOKEN" ]; then HAS_GLUE_SECRET='true' ; fi - echo ::set-output name=HAS_GLUE_SECRET::${HAS_GLUE_SECRET} - env: - AWS_SECRET: "${{ secrets.INSTALLER_UPLOAD_KEY }}" - GLUE_ACCESS_TOKEN: "${{ secrets.GLUE_ACCESS_TOKEN }}" - # Get the most recent release from chia-plotter-madmax - uses: actions/github-script@v6 id: 'latest-madmax' @@ -102,10 +75,10 @@ jobs: - name: Get latest madmax plotter run: | mkdir "$GITHUB_WORKSPACE/madmax" - wget -O "$GITHUB_WORKSPACE/madmax/chia_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-x86-64 - wget -O "$GITHUB_WORKSPACE/madmax/chia_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-x86-64 - chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot" - chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot_k34" + wget -O "$GITHUB_WORKSPACE/madmax/flax_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-x86-64 + wget -O "$GITHUB_WORKSPACE/madmax/flax_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-x86-64 + chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot" + chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot_k34" # Get the most recent release from bladebit - uses: actions/github-script@v6 @@ -148,18 +121,18 @@ jobs: - name: Prepare GUI cache id: gui-ref run: | - gui_ref=$(git submodule status chia-blockchain-gui | sed -e 's/^ //g' -e 's/ chia-blockchain-gui.*$//g') + gui_ref=$(git submodule status flax-blockchain-gui | sed -e 's/^ //g' -e 's/ flax-blockchain-gui.*$//g') echo "${gui_ref}" echo "::set-output name=GUI_REF::${gui_ref}" - echo "rm -rf ./chia-blockchain-gui" - rm -rf ./chia-blockchain-gui + echo "rm -rf ./flax-blockchain-gui" + rm -rf ./flax-blockchain-gui - name: Cache GUI uses: actions/cache@v3 id: cache-gui with: - path: ./chia-blockchain-gui - key: ${{ runner.os }}-rpm-chia-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} + path: ./flax-blockchain-gui + key: ${{ runner.os }}-rpm-flax-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} - if: steps.cache-gui.outputs.cache-hit != 'true' name: Build GUI @@ -170,7 +143,7 @@ jobs: - name: Build .rpm package env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} + FLAX_INSTALLER_VERSION: ${{ steps.version_number.outputs.FLAX_INSTALLER_VERSION }} run: | ldd --version cd ./build_scripts @@ -179,94 +152,9 @@ jobs: - name: Upload Linux artifacts uses: actions/upload-artifact@v3 with: - name: chia-installers-linux-rpm-intel + name: flax-installers-linux-rpm-intel path: ${{ github.workspace }}/build_scripts/final_installer/ - - name: Configure AWS Credentials - if: steps.check_secrets.outputs.HAS_AWS_SECRET - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.INSTALLER_UPLOAD_KEY }} - aws-secret-access-key: ${{ secrets.INSTALLER_UPLOAD_SECRET }} - aws-region: us-west-2 - - - name: Upload to s3 - if: steps.check_secrets.outputs.HAS_AWS_SECRET - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - GIT_SHORT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-8) - CHIA_DEV_BUILD=${CHIA_INSTALLER_VERSION}-$GIT_SHORT_HASH - echo "CHIA_DEV_BUILD=$CHIA_DEV_BUILD" >>$GITHUB_ENV - ls $GITHUB_WORKSPACE/build_scripts/final_installer/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/dev/chia-blockchain-${CHIA_DEV_BUILD}-1.x86_64.rpm - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/dev/chia-blockchain-cli-${CHIA_DEV_BUILD}-1.x86_64.rpm - - - name: Create Checksums - if: env.FULL_RELEASE == 'true' || github.ref == 'refs/heads/main' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - ls $GITHUB_WORKSPACE/build_scripts/final_installer/ - sha256sum $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm > $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 - sha256sum $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm > $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 - ls $GITHUB_WORKSPACE/build_scripts/final_installer/ - - - name: Create .rpm torrent - if: env.FULL_RELEASE == 'true' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm -o $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent --webseed https://download.chia.net/install/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm - py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm -o $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent --webseed https://download.chia.net/install/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm - gh release upload $RELEASE_TAG $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent - - - name: Upload Dev Installer - if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/main' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/latest-dev/chia-blockchain-1.x86_64_latest_dev.rpm - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 s3://download.chia.net/latest-dev/chia-blockchain-1.x86_64_latest_dev.rpm.sha256 - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/latest-dev/chia-blockchain-cli-1.x86_64_latest_dev.rpm - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 s3://download.chia.net/latest-dev/chia-blockchain-cli-1.x86_64_latest_dev.rpm.sha256 - - - name: Upload Release Files - if: steps.check_secrets.outputs.HAS_AWS_SECRET && env.FULL_RELEASE == 'true' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent s3://download.chia.net/torrents/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.sha256 s3://download.chia.net/install/ - aws s3 cp $GITHUB_WORKSPACE/build_scripts/final_installer/chia-blockchain-cli-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm.torrent s3://download.chia.net/torrents/ - - - name: Get tag name - if: startsWith(github.ref, 'refs/tags/') - id: tag-name - run: | - echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)" - echo "::set-output name=REPO_NAME::$(echo ${{ github.repository }} | cut -d'/' -f 2)" - - - name: Upload release artifacts - if: env.RELEASE == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - gh release upload \ - $RELEASE_TAG \ - build_scripts/final_installer/chia-blockchain-${CHIA_INSTALLER_VERSION}-1.x86_64.rpm - - - - name: Mark installer complete - if: steps.check_secrets.outputs.HAS_GLUE_SECRET && env.FULL_RELEASE == 'true' - run: | - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"chia_ref": "${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/success/build-linux-rpm - - name: Remove working files to exclude from cache run: | - rm -rf ./chia-blockchain-gui/packages/gui/daemon + rm -rf ./flax-blockchain-gui/packages/gui/daemon diff --git a/.github/workflows/build-macos-installers.yml b/.github/workflows/build-macos-installers.yml index 7c80e11f9..cbd477ee5 100644 --- a/.github/workflows/build-macos-installers.yml +++ b/.github/workflows/build-macos-installers.yml @@ -6,40 +6,23 @@ on: - 'long_lived/**' - main - 'release/**' - release: - types: [published] + tags: + - '**' pull_request: branches: - '**' -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - jobs: build: - name: MacOS ${{ matrix.os.name }} Installer - runs-on: ${{ matrix.os.runs-on }} + name: MacOS intel Installer + runs-on: ${{ matrix.os }} timeout-minutes: 90 strategy: fail-fast: false max-parallel: 4 matrix: python-version: [3.9] - os: - - runs-on: macos-10.14 - name: intel - file-suffix: "" - mac-package-name: "Chia-darwin-x64" - glue-name: "build-macos" - bladebit-suffix: macos-x86-64.tar.gz - - runs-on: [MacOS, ARM64] - name: m1 - file-suffix: "-arm64" - mac-package-name: "Chia-darwin-arm64" - glue-name: "build-mac-m1" - bladebit-suffix: macos-arm64.tar.gz + os: [macos-10.15] steps: - uses: Chia-Network/actions/clean-workspace@main @@ -96,7 +79,7 @@ jobs: python3 -m venv ../venv . ../venv/bin/activate pip install setuptools_scm - echo "::set-output name=CHIA_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)" + echo "::set-output name=FLAX_INSTALLER_VERSION::$(python3 ./build_scripts/installer-version.py)" deactivate - name: Setup Python environment @@ -134,10 +117,10 @@ jobs: - name: Get latest madmax plotter run: | mkdir "$GITHUB_WORKSPACE/madmax" - wget -O "$GITHUB_WORKSPACE/madmax/chia_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-macos-${{ matrix.os.name }} - wget -O "$GITHUB_WORKSPACE/madmax/chia_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-macos-${{ matrix.os.name }} - chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot" - chmod +x "$GITHUB_WORKSPACE/madmax/chia_plot_k34" + wget -O "$GITHUB_WORKSPACE/madmax/flax_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}-macos-intel + wget -O "$GITHUB_WORKSPACE/madmax/flax_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}-macos-intel + chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot" + chmod +x "$GITHUB_WORKSPACE/madmax/flax_plot_k34" - name: Get latest prerelease bladebit plotter if: env.PRE_RELEASE == 'true' @@ -153,7 +136,7 @@ jobs: python-version: ${{ matrix.python-version }} development: true - - uses: chia-network/actions/activate-venv@main + - uses: Chia-network/actions/activate-venv@main - name: Setup Node 16.x uses: actions/setup-node@v3 @@ -163,18 +146,18 @@ jobs: - name: Prepare GUI cache id: gui-ref run: | - gui_ref=$(git submodule status chia-blockchain-gui | sed -e 's/^ //g' -e 's/ chia-blockchain-gui.*$//g') + gui_ref=$(git submodule status flax-blockchain-gui | sed -e 's/^ //g' -e 's/ flax-blockchain-gui.*$//g') echo "${gui_ref}" echo "::set-output name=GUI_REF::${gui_ref}" - echo "rm -rf ./chia-blockchain-gui" - rm -rf ./chia-blockchain-gui + echo "rm -rf ./flax-blockchain-gui" + rm -rf ./flax-blockchain-gui - name: Cache GUI uses: actions/cache@v3 id: cache-gui with: - path: ./chia-blockchain-gui - key: ${{ runner.os }}-${{ matrix.os.name }}-chia-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} + path: ./flax-blockchain-gui + key: ${{ runner.os }}-intel-flax-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} - if: steps.cache-gui.outputs.cache-hit != 'true' name: Build GUI @@ -185,7 +168,7 @@ jobs: - name: Build MacOS DMG env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} + FLAX_INSTALLER_VERSION: ${{ steps.version_number.outputs.FLAX_INSTALLER_VERSION }} NOTARIZE: ${{ steps.check_secrets.outputs.HAS_APPLE_SECRET }} APPLE_NOTARIZE_USERNAME: "${{ secrets.APPLE_NOTARIZE_USERNAME }}" APPLE_NOTARIZE_PASSWORD: "${{ secrets.APPLE_NOTARIZE_PASSWORD }}" @@ -198,93 +181,9 @@ jobs: - name: Upload MacOS artifacts uses: actions/upload-artifact@v3 with: - name: chia-installers-macos-dmg-${{ matrix.os.name }} + name: flax-installers-macos-dmg-intel path: ${{ github.workspace }}/build_scripts/final_installer/ - - name: Install AWS CLI - if: steps.check_secrets.outputs.HAS_AWS_SECRET - run: | - command -v aws || brew install awscli - - - name: Install GH CLI - run: | - command -v gh || brew install gh - - - name: Create Checksums - run: | - ls - shasum -a 256 ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg > ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg.sha256 - - - name: Upload to s3 - if: steps.check_secrets.outputs.HAS_AWS_SECRET - env: - AWS_ACCESS_KEY_ID: ${{ secrets.INSTALLER_UPLOAD_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.INSTALLER_UPLOAD_SECRET }} - AWS_REGION: us-west-2 - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - GIT_SHORT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-8) - CHIA_DEV_BUILD=${CHIA_INSTALLER_VERSION}-$GIT_SHORT_HASH - echo "CHIA_DEV_BUILD=$CHIA_DEV_BUILD" >>$GITHUB_ENV - aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg s3://download.chia.net/dev/Chia-${CHIA_DEV_BUILD}${{ matrix.os.file-suffix }}.dmg - - - name: Create torrent - if: env.FULL_RELEASE == 'true' - run: | - py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg -o ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg.torrent --webseed https://download.chia.net/install/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg - ls ${{ github.workspace }}/build_scripts/final_installer/ - gh release upload $RELEASE_TAG ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg.torrent - - - name: Upload Dev Installer - if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/main' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - AWS_ACCESS_KEY_ID: ${{ secrets.INSTALLER_UPLOAD_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.INSTALLER_UPLOAD_SECRET }} - AWS_REGION: us-west-2 - run: | - aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg s3://download.chia.net/latest-dev/Chia${{ matrix.os.file-suffix }}_latest_dev.dmg - aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg.sha256 s3://download.chia.net/latest-dev/Chia${{ matrix.os.file-suffix }}_latest_dev.dmg.sha256 - - - name: Upload Release Files - if: steps.check_secrets.outputs.HAS_AWS_SECRET && env.FULL_RELEASE == 'true' - env: - AWS_ACCESS_KEY_ID: ${{ secrets.INSTALLER_UPLOAD_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.INSTALLER_UPLOAD_SECRET }} - AWS_REGION: us-west-2 - run: | - aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg s3://download.chia.net/install/ - aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg.sha256 s3://download.chia.net/install/ - aws s3 cp ${{ github.workspace }}/build_scripts/final_installer/Chia-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}${{ matrix.os.file-suffix }}.dmg.torrent s3://download.chia.net/torrents/ - - - name: Get tag name - if: startsWith(github.ref, 'refs/tags/') - id: tag-name - run: | - echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)" - echo "::set-output name=REPO_NAME::$(echo ${{ github.repository }} | cut -d'/' -f 2)" - - - name: Upload release artifacts - if: env.RELEASE == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - gh release upload \ - $RELEASE_TAG \ - build_scripts/final_installer/*.dmg - - - name: Mark installer complete - if: steps.check_secrets.outputs.HAS_GLUE_SECRET && env.FULL_RELEASE == 'true' - run: | - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"chia_ref": "${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/success/${{ matrix.os.glue-name }} - - # We want to delete this no matter what happened in the previous steps (failures, success, etc) - - name: Delete signing keychain - if: always() - run: - security delete-keychain signing_temp.keychain || true - - name: Remove working files to exclude from cache run: | - rm -rf ./chia-blockchain-gui/packages/gui/daemon + rm -rf ./flax-blockchain-gui/packages/gui/daemon diff --git a/.github/workflows/build-windows-installer.yml b/.github/workflows/build-windows-installer.yml index 1f044e56c..84744ac62 100644 --- a/.github/workflows/build-windows-installer.yml +++ b/.github/workflows/build-windows-installer.yml @@ -1,23 +1,17 @@ name: 📦🚀 Build Installer - Windows 10 on: - workflow_dispatch: push: branches: - 'long_lived/**' - main - 'release/**' - release: - types: [published] + tags: + - '**' pull_request: branches: - '**' -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - jobs: build: name: Windows 10 Installer @@ -54,32 +48,6 @@ jobs: run: | git config --global url."https://github.com/".insteadOf ssh://git@github.com/ - - name: Get npm cache directory - id: npm-cache - run: | - echo "::set-output name=dir::$(npm config get cache)" - - - name: Cache npm - uses: actions/cache@v3 - with: - path: ${{ steps.npm-cache.outputs.dir }} - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - name: Get pip cache dir - id: pip-cache - run: | - echo "::set-output name=dir::$(pip cache dir)" - - - name: Cache pip - uses: actions/cache@v3 - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - uses: actions/setup-python@v3 name: Install Python ${{ matrix.python-version }} with: @@ -90,34 +58,6 @@ jobs: with: node-version: '16.x' - - name: Test for secrets access - id: check_secrets - shell: bash - run: | - unset HAS_SIGNING_SECRET - unset HAS_AWS_SECRET - unset HAS_GLUE_SECRET - - if [ -n "$SIGNING_SECRET" ]; then HAS_SIGNING_SECRET='true' ; fi - echo "::set-output name=HAS_SIGNING_SECRET::${HAS_SIGNING_SECRET}" - - if [ -n "$AWS_SECRET" ]; then HAS_AWS_SECRET='true' ; fi - echo ::set-output name=HAS_AWS_SECRET::${HAS_AWS_SECRET} - - if [ -n "$GLUE_ACCESS_TOKEN" ]; then HAS_GLUE_SECRET='true' ; fi - echo ::set-output name=HAS_GLUE_SECRET::${HAS_GLUE_SECRET} - env: - SIGNING_SECRET: "${{ secrets.WIN_CODE_SIGN_CERT }}" - AWS_SECRET: "${{ secrets.INSTALLER_UPLOAD_KEY }}" - GLUE_ACCESS_TOKEN: "${{ secrets.GLUE_ACCESS_TOKEN }}" - - - name: Decode code signing cert into an encrypted file - if: steps.check_secrets.outputs.HAS_SIGNING_SECRET - uses: kitek/decode-base64-into-file-action@1.0 - with: - encoded-value: ${{ secrets.WIN_CODE_SIGN_CERT }} - destination-file: .\win_code_sign_cert.p12 - # Create our own venv outside of the git directory JUST for getting the ACTUAL version so that install can't break it - name: Get version number id: version_number @@ -125,9 +65,9 @@ jobs: python -m venv ..\venv . ..\venv\Scripts\Activate.ps1 pip3 install setuptools_scm - $env:CHIA_INSTALLER_VERSION = python .\build_scripts\installer-version.py -win - echo "$env:CHIA_INSTALLER_VERSION" - echo "::set-output name=CHIA_INSTALLER_VERSION::$env:CHIA_INSTALLER_VERSION" + $env:FLAX_INSTALLER_VERSION = python .\build_scripts\installer-version.py -win + echo "$env:FLAX_INSTALLER_VERSION" + echo "::set-output name=FLAX_INSTALLER_VERSION::$env:FLAX_INSTALLER_VERSION" deactivate # Get the most recent release from chia-plotter-madmax @@ -146,8 +86,8 @@ jobs: - name: Get latest madmax plotter run: | mkdir "$env:GITHUB_WORKSPACE\madmax" - Invoke-WebRequest https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}.exe -OutFile "$env:GITHUB_WORKSPACE\madmax\chia_plot.exe" - Invoke-WebRequest https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}.exe -OutFile "$env:GITHUB_WORKSPACE\madmax\chia_plot_k34.exe" + Invoke-WebRequest https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot-${{ steps.latest-madmax.outputs.result }}.exe -OutFile "$env:GITHUB_WORKSPACE\madmax\flax_plot.exe" + Invoke-WebRequest https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${{ steps.latest-madmax.outputs.result }}/chia_plot_k34-${{ steps.latest-madmax.outputs.result }}.exe -OutFile "$env:GITHUB_WORKSPACE\madmax\flax_plot_k34.exe" # Get the most recent release from bladebit - uses: actions/github-script@v6 @@ -189,25 +129,7 @@ jobs: run: | .\Install.ps1 -d - - name: Prepare GUI cache - id: gui-ref - run: | - $gui_ref = git submodule status chia-blockchain-gui - $gui_ref = $gui_ref -replace "^ | chia-blockchain-gui.*$","" - echo $gui_ref - echo "::set-output name=GUI_REF::$gui_ref" - echo "Remove-Item -Recurse -Force .\chia-blockchain-gui" - Remove-Item -Recurse -Force .\chia-blockchain-gui - - - name: Cache GUI - uses: actions/cache@v3 - id: cache-gui - with: - path: .\chia-blockchain-gui - key: ${{ runner.os }}-chia-blockchain-gui-${{ steps.gui-ref.outputs.GUI_REF }} - - - if: steps.cache-gui.outputs.cache-hit != 'true' - name: Build GUI + - name: Build GUI continue-on-error: false run: | cd .\build_scripts @@ -215,7 +137,7 @@ jobs: - name: Build Windows installer env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} + FLAX_INSTALLER_VERSION: ${{ steps.version_number.outputs.FLAX_INSTALLER_VERSION }} HAS_SECRET: ${{ steps.check_secrets.outputs.HAS_SIGNING_SECRET }} CSC_KEY_PASSWORD: ${{ secrets.WIN_CODE_SIGN_PASS }} run: | @@ -228,104 +150,12 @@ jobs: - name: Upload Installer to artifacts uses: actions/upload-artifact@v3 with: - name: chia-installers-windows-exe-intel - path: ${{ github.workspace }}\chia-blockchain-gui\release-builds\ - - - name: Install AWS CLI - if: steps.check_secrets.outputs.HAS_AWS_SECRET - run: | - msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi - - - name: Configure AWS Credentials - if: steps.check_secrets.outputs.HAS_AWS_SECRET - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.INSTALLER_UPLOAD_KEY }} - aws-secret-access-key: ${{ secrets.INSTALLER_UPLOAD_SECRET }} - aws-region: us-west-2 - - - name: Upload to s3 - if: steps.check_secrets.outputs.HAS_AWS_SECRET - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - shell: bash - run: | - GIT_SHORT_HASH=$(echo "${GITHUB_SHA}" | cut -c1-8) - CHIA_DEV_BUILD=${CHIA_INSTALLER_VERSION}-$GIT_SHORT_HASH - echo ::set-output name=CHIA_DEV_BUILD::${CHIA_DEV_BUILD} - echo ${CHIA_DEV_BUILD} - pwd - aws s3 cp chia-blockchain-gui/release-builds/windows-installer/ChiaSetup-${CHIA_INSTALLER_VERSION}.exe s3://download.chia.net/dev/ChiaSetup-${CHIA_DEV_BUILD}.exe - - - name: Create Checksums - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - certutil.exe -hashfile ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe SHA256 > ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.sha256 - ls ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ - - - name: Install py3createtorrent - if: env.FULL_RELEASE == 'true' - run: | - pip3 install py3createtorrent - - - name: Create torrent - if: env.FULL_RELEASE == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe -o ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.torrent --webseed https://download.chia.net/install/ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe - ls - gh release upload $env:RELEASE_TAG ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.torrent - - - name: Upload Dev Installer - if: steps.check_secrets.outputs.HAS_AWS_SECRET && github.ref == 'refs/heads/main' - env: - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - aws s3 cp ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe s3://download.chia.net/latest-dev/ChiaSetup-latest-dev.exe - aws s3 cp ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.sha256 s3://download.chia.net/latest-dev/ChiaSetup-latest-dev.exe.sha256 - - - name: Upload Release Files - if: steps.check_secrets.outputs.HAS_AWS_SECRET && env.FULL_RELEASE == 'true' - env: - AWS_ACCESS_KEY_ID: ${{ secrets.INSTALLER_UPLOAD_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.INSTALLER_UPLOAD_SECRET }} - run: | - aws s3 cp ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe s3://download.chia.net/install/ - aws s3 cp ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.sha256 s3://download.chia.net/install/ - aws s3 cp ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe.torrent s3://download.chia.net/torrents/ - - - name: Get tag name - if: startsWith(github.ref, 'refs/tags/') - id: tag-name - run: | - echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)" - echo "::set-output name=REPO_NAME::$(echo ${{ github.repository }} | cut -d'/' -f 2)" - - - name: Upload release artifacts - if: env.RELEASE == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CHIA_INSTALLER_VERSION: ${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }} - run: | - gh release upload $env:RELEASE_TAG ${{ github.workspace }}\chia-blockchain-gui\release-builds\windows-installer\ChiaSetup-${{ steps.version_number.outputs.CHIA_INSTALLER_VERSION }}.exe - - - name: Mark installer complete - if: steps.check_secrets.outputs.HAS_GLUE_SECRET && env.FULL_RELEASE == 'true' - run: | - $headers = @{ - Authorization="Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" - } - $data = @{ - chia_ref='${{ steps.tag-name.outputs.TAG_NAME }}' - } - $json = $data | ConvertTo-Json - $response = Invoke-RestMethod '${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/success/build-windows' -Method Post -Body $json -ContentType 'application/json' -Headers $headers + name: flax-installers-windows-exe-intel + path: ${{ github.workspace }}\flax-blockchain-gui\release-builds\ - name: Remove Windows exe and installer to exclude from cache run: | - Remove-Item .\chia-blockchain-gui\packages\gui\dist -Recurse -Force - Remove-Item .\chia-blockchain-gui\packages\gui\daemon -Recurse -Force - Remove-Item .\chia-blockchain-gui\Chia-win32-x64 -Recurse -Force - Remove-Item .\chia-blockchain-gui\release-builds -Recurse -Force + Remove-Item .\flax-blockchain-gui\packages\gui\dist -Recurse -Force + Remove-Item .\flax-blockchain-gui\packages\gui\daemon -Recurse -Force + Remove-Item .\flax-blockchain-gui\Flax-win32-x64 -Recurse -Force + Remove-Item .\flax-blockchain-gui\release-builds -Recurse -Force \ No newline at end of file diff --git a/.github/workflows/check_wheel_availability.yaml b/.github/workflows/check_wheel_availability.yaml deleted file mode 100644 index 54f7eff22..000000000 --- a/.github/workflows/check_wheel_availability.yaml +++ /dev/null @@ -1,73 +0,0 @@ -name: 🚨 Check Dependency Artifacts - -on: - push: - branches: - - 'long_lived/**' - - main - - 'release/**' - release: - types: [published] - pull_request: - branches: - - '**' - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - check_dependency_artifacts: - name: ${{ matrix.os.name }} ${{ matrix.arch.name }} ${{ matrix.python-version }} - runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} - strategy: - fail-fast: false - matrix: - os: - - name: Linux - matrix: linux - runs-on: - intel: ubuntu-latest - arm: [linux, arm64] - - name: macOS - matrix: macos - runs-on: - intel: macos-latest - arm: [macos, arm64] - - name: Windows - matrix: windows - runs-on: - intel: windows-latest - arch: - - name: ARM64 - matrix: arm - - name: Intel - matrix: intel - python-version: ['3.7', '3.8', '3.9', '3.10'] - exclude: - - os: - matrix: macos - python-version: '3.7' - - os: - matrix: macos - arch: - matrix: arm - python-version: '3.8' - - os: - matrix: windows - arch: - matrix: arm - - steps: - - uses: Chia-Network/actions/clean-workspace@main - - - name: Checkout Code - uses: actions/checkout@v3 - - - uses: Chia-Network/actions/setup-python@main - with: - python-version: ${{ matrix.python-version }} - - - name: Check Wheel Availability - run: python build_scripts/check_dependency_artifacts.py diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 3463f6d7c..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,75 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: 🚨 CodeQL - -on: - push: - branches: - - 'long_lived/**' - - main - - 'release/**' - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: '34 14 * * 3' - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/conflict-check.yml b/.github/workflows/conflict-check.yml deleted file mode 100644 index 4e1f5bb06..000000000 --- a/.github/workflows/conflict-check.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: 🩹 Conflict Check -on: - # So that PRs touching the same files as the push are updated - push: - # So that the `dirtyLabel` is removed if conflicts are resolve - # We recommend `pull_request_target` so that github secrets are available. - # In `pull_request` we wouldn't be able to change labels of fork PRs - pull_request_target: - types: [synchronize] - -jobs: - main: - runs-on: ubuntu-latest - steps: - - name: check if prs are behind main - uses: eps1lon/actions-label-merge-conflict@v2.0.1 - with: - dirtyLabel: "merge_conflict" - repoToken: "${{ secrets.GITHUB_TOKEN }}" - commentOnDirty: "This pull request has conflicts, please resolve those before we can evaluate the pull request." - commentOnClean: "Conflicts have been resolved. A maintainer will review the pull request shortly." diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml deleted file mode 100644 index fe461b424..000000000 --- a/.github/workflows/dependency-review.yml +++ /dev/null @@ -1,20 +0,0 @@ -# Dependency Review Action -# -# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. -# -# Source repository: https://github.com/actions/dependency-review-action -# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement -name: 'Dependency Review' -on: [pull_request] - -permissions: - contents: read - -jobs: - dependency-review: - runs-on: ubuntu-latest - steps: - - name: 'Checkout Repository' - uses: actions/checkout@v3 - - name: 'Dependency Review' - uses: actions/dependency-review-action@v2 diff --git a/.github/workflows/mozilla-ca-cert.yml b/.github/workflows/mozilla-ca-cert.yml deleted file mode 100644 index c616df40f..000000000 --- a/.github/workflows/mozilla-ca-cert.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "Update Mozilla CA sub module" -on: - workflow_dispatch: - branches: - - $default-branch - -jobs: - update_ca_module: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: "${{ github.event.inputs.chia_ref }}" - repository: chia-network/chia-blockchain - submodules: recursive - token: "${{ secrets.GITHUB_TOKEN }}" - - name: "Add changes to new branch" - run: | - cd ./mozilla-ca - git pull origin main - - name: "Create Pull Request" - uses: peter-evans/create-pull-request@v4 - with: - base: main - body: "Newest Mozilla CA cert" - branch: mozilla-ca-updates - commit-message: "adding ca updates" - delete-branch: true - reviewers: "wjblanke,emlowe" - assignees: "wallentx" - title: "CA Cert updates" - token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 4515265a9..000000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: 🚨 pre-commit - -on: - pull_request: - push: - branches: - - 'long_lived/**' - - main - - 'release/**' - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - pre-commit: - name: ${{ matrix.os.name }} ${{ matrix.arch.name }} - runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} - strategy: - fail-fast: false - matrix: - os: - - name: Linux - matrix: linux - runs-on: - intel: ubuntu-latest - arm: [linux, arm64] - - name: macOS - matrix: macos - runs-on: - intel: macos-latest - arm: [macos, arm64] - - name: Windows - matrix: windows - runs-on: - intel: windows-latest - arch: - - name: ARM64 - matrix: arm - - name: Intel - matrix: intel - python: - - major_dot_minor: '3.9' - exclude: - - os: - matrix: windows - arch: - matrix: arm - - steps: - - name: Clean workspace - uses: Chia-Network/actions/clean-workspace@main - - - uses: Chia-Network/actions/git-mark-workspace-safe@main - - - name: disable git autocrlf - run: | - git config --global core.autocrlf false - - - uses: actions/checkout@v3 - - - uses: Chia-Network/actions/setup-python@main - with: - python-version: ${{ matrix.python.major_dot_minor }} - - - uses: ./.github/actions/install - with: - python-version: ${{ matrix.python.major_dot_minor }} - development: true - - - uses: chia-network/actions/activate-venv@main - - - run: pre-commit run --all-files --verbose diff --git a/.github/workflows/stale-issue.yml b/.github/workflows/stale-issue.yml deleted file mode 100644 index 76c816c4e..000000000 --- a/.github/workflows/stale-issue.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: 'Close stale issues' -on: - schedule: - - cron: '0 11 * * *' - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: chia-network/stale@main - with: - operations-per-run: 10000 - ascending: true - days-before-issue-stale: 14 - days-before-issue-close: 7 - days-before-pr-stale: 45 - days-before-pr-close: -1 - exempt-all-pr-milestones: true - exempt-all-issue-milestones: true - exempt-all-assignees: true - stale-issue-label: stale-issue - stale-pr-label: stale-pr - remove-stale-when-updated: true - stale-issue-message: >- - This issue has not been updated in 14 days and is now flagged - as stale. If this issue is still affecting you and in need - of further review, please comment on it with an update to - keep it from auto closing in 7 days. - close-issue-message: >- - This issue was automatically closed because it has been - flagged as stale, and subsequently passed 7 days with no - further activity from the submitter or watchers. - stale-pr-message: >- - This PR has been flagged as stale due to no activity for over - 60 days. It will not be automatically closed, but it has been - given a stale-pr label and should be manually reviewed by the - relevant parties. diff --git a/.github/workflows/start-release.yml b/.github/workflows/start-release.yml deleted file mode 100644 index 1009b49e4..000000000 --- a/.github/workflows/start-release.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Starts a release for the given ref on the Glue API -name: Start Release -on: - workflow_dispatch: - release: - types: [published] - -jobs: - start_release: - name: Starts release process in Glue API - runs-on: [glue-notify] - steps: - - name: Get tag name - if: "!github.event.release.prerelease" - id: tag-name - run: | - echo "::set-output name=TAG_NAME::$(echo ${{ github.ref }} | cut -d'/' -f 3)" - echo "::set-output name=REPO_NAME::$(echo ${{ github.repository }} | cut -d'/' -f 2)" - - name: Start release - if: "!github.event.release.prerelease" - run: | - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"chia_ref": "${{ steps.tag-name.outputs.TAG_NAME }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/${{ steps.tag-name.outputs.REPO_NAME }}/${{ steps.tag-name.outputs.TAG_NAME }}/start diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml deleted file mode 100644 index cd155de16..000000000 --- a/.github/workflows/super-linter.yml +++ /dev/null @@ -1,85 +0,0 @@ ---- -########################### -########################### -## Linter GitHub Actions ## -########################### -########################### -name: 🚨 GitHub Super Linter - -# -# Documentation: -# https://github.com/github/super-linter -# https://help.github.com/en/articles/workflow-syntax-for-github-actions -# - -############################# -# Start the job on all push # -############################# -on: - push: - branches: - - 'long_lived/**' - - main - - 'release/**' - release: - types: [published] - pull_request: - branches: - - '**' - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -############### -# Set the Job # -############### -jobs: - build: - # Name the Job - name: Lint Code Base - # Set the agent to run on - runs-on: ubuntu-latest - timeout-minutes: 60 - - ################## - # Load all steps # - ################## - steps: - ########################## - # Checkout the code base # - ########################## - - name: Checkout Code - uses: actions/checkout@v3 - - ################################ - # Run Linter against code base # - ################################ - - name: Lint Code Base - uses: github/super-linter@v4.9.3 -# uses: docker://github/super-linter:v3.10.2 - env: - VALIDATE_ALL_CODEBASE: true - DEFAULT_BRANCH: main - LINTER_RULES_PATH: . - MARKDOWN_CONFIG_FILE: .markdown-lint.yml - VALIDATE_BASH: true - VALIDATE_CSS: true - VALIDATE_DOCKER: true - VALIDATE_GO: true - VALIDATE_HTML: true - VALIDATE_JAVASCRIPT_ES: true - VALIDATE_JSON: true - VALIDATE_MD: true - VALIDATE_POWERSHELL: true - VALIDATE_SHELL_SHFMT: true - VALIDATE_TYPESCRIPT_ES: true - VALIDATE_YAML: true - DISABLE_ERRORS: false - PYTHONPATH: ${{ github.workspace }}:$PYTHONPATH - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FILTER_REGEX_EXCLUDE: .*github/ISSUE_TEMPLATE/config.yml -# ACTIONS_RUNNER_DEBUG: true - -... diff --git a/.github/workflows/test-install-scripts.yml b/.github/workflows/test-install-scripts.yml deleted file mode 100644 index d146f8a8d..000000000 --- a/.github/workflows/test-install-scripts.yml +++ /dev/null @@ -1,252 +0,0 @@ -name: 🏗️ Test Install Scripts - -on: - push: - branches: - - 'long_lived/**' - - main - - 'release/**' - release: - types: [published] - pull_request: - branches: - - '**' - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - test_scripts: - name: Test Install Scripts - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - max-parallel: 4 - matrix: - python-version: [3.9] - os: [macOS-latest, ubuntu-latest] - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Python environment - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - uses: ./.github/actions/install - with: - python-version: ${{ matrix.python-version }} - development: true - - - uses: chia-network/actions/activate-venv@main - - - name: Run install-gui script - run: | - sh install-gui.sh - - test_scripts_in_docker: - name: Test Install Scripts ${{ matrix.distribution.name }} - runs-on: ${{ matrix.os }} - container: ${{ matrix.distribution.url }} - strategy: - fail-fast: false - max-parallel: 4 - matrix: - os: [ubuntu-latest] - distribution: - - name: amazonlinux:2 - type: amazon - url: "docker://amazonlinux:2" - - name: arch:latest - type: arch - url: "docker://archlinux:latest" - - name: centos:7 - type: centos - url: "docker://centos:7" -# commented out until we decide what to do with this, it fails consistently -# - name: centos:8 -# type: centos -# url: "docker://centos:8" - - name: debian:buster - type: debian - # https://packages.debian.org/buster/python/python3 (3.7) - url: "docker://debian:buster" - - name: debian:bullseye - type: debian - # https://packages.debian.org/bullseye/python/python3 (3.9) - url: "docker://debian:bullseye" - - name: debian:bookworm - type: debian - # https://packages.debian.org/bookworm/python/python3 (3.10) - url: "docker://debian:bookworm" - - name: fedora:34 - type: fedora - # (34, 3.9) https://packages.fedoraproject.org/search?query=python3&releases=Fedora+34&start=0 - url: "docker://fedora:34" - - name: fedora:35 - type: fedora - # (35, 3.10) https://packages.fedoraproject.org/search?query=python3&releases=Fedora+35&start=0 - url: "docker://fedora:35" - - name: fedora:36 - type: fedora - # (36, 3.10) https://packages.fedoraproject.org/search?query=python3&releases=Fedora+36&start=0 - url: "docker://fedora:36" - - name: rockylinux:8 - type: rocky - url: "docker://rockylinux:8" - - name: ubuntu:bionic (18.04) - type: ubuntu - # https://packages.ubuntu.com/bionic/python3.7 (18.04, 3.7) - url: "docker://ubuntu:bionic" - - name: ubuntu:focal (20.04) - type: ubuntu - # https://packages.ubuntu.com/focal/python3 (20.04, 3.8) - url: "docker://ubuntu:focal" - - name: ubuntu:jammy (22.04) - type: ubuntu - # https://packages.ubuntu.com/jammy/python3 (22.04, 3.10) - url: "docker://ubuntu:jammy" - - name: linuxmintd/mint19.1-amd64 (Tessa) - type: mint - # 3.6 default with an option for 3.7 - url: "docker://linuxmintd/mint19.1-amd64" - - name: linuxmintd/mint19.2-amd64 (Tina) - type: mint - # 3.6 default with an option for 3.7 - url: "docker://linuxmintd/mint19.2-amd64" - - name: linuxmintd/mint19.3-amd64 (Tricia) - type: mint - # 3.6 default with an option for 3.7 - url: "docker://linuxmintd/mint19.3-amd64" - - name: linuxmintd/mint20-amd64 (Ulyana) - type: mint - # 3.8 - url: "docker://linuxmintd/mint20-amd64" - - name: linuxmintd/mint20.1-amd64 (Ulyssa) - type: mint - # 3.8 - url: "docker://linuxmintd/mint20.1-amd64" - - name: linuxmintd/mint20.2-amd64 (Uma) - type: mint - # 3.8 - url: "docker://linuxmintd/mint20.2-amd64" - - name: linuxmintd/mint20.3-amd64 (Una) - type: mint - # 3.8 - url: "docker://linuxmintd/mint20.3-amd64" -# The Linux Mint 21 docker image reports as 20.3 but has different Python. -# Uncomment after adapting to handle this or upstream fixing it. -# Also, Linux Mint 21 is not released as of this change. -# - name: linuxmintd/mint21-amd64 -# type: linuxmint -# # 3.10 default with an option for 3.9 -# url: "docker://linuxmintd/mint21-amd64" - - steps: - - name: Prepare Amazon Linux - if: ${{ matrix.distribution.type == 'amazon' }} - run: | - yum install --assumeyes git sudo - - - name: Prepare Arch - if: ${{ matrix.distribution.type == 'arch' }} - run: | - pacman --noconfirm --refresh base --sync git sudo - # The behavior we follow in install.sh is unique with Arch in that - # we leave it to the user to install the appropriate version of python, - # so we need to install python here in order for the test to succeed. - pacman --noconfirm -U --needed https://archive.archlinux.org/packages/p/python/python-3.9.9-1-x86_64.pkg.tar.zst - - - name: Prepare CentOS - if: ${{ matrix.distribution.type == 'centos' }} - # Installing Git from yum brings git@1.x which doesn't work on actions/checkout. - # So install git@2.x from source - run: | - if [ "$(rpm --eval %{centos_ver})" = "8" ]; then - sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*; - fi - yum update -y - yum install -y sudo gcc autoconf make wget curl-devel expat-devel gettext-devel openssl-devel perl-devel zlib-devel - wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.29.0.tar.gz - tar zxf git-2.29.0.tar.gz - pushd git-2.29.0 - make configure - ./configure --prefix=/usr/local - make all - make install - popd - - - name: Prepare Debian - if: ${{ matrix.distribution.type == 'debian' }} - env: - DEBIAN_FRONTEND: noninteractive - run: | - apt-get --yes update - apt-get install --yes git lsb-release sudo - - - name: Prepare Fedora - if: ${{ matrix.distribution.type == 'fedora' }} - run: | - yum install --assumeyes git - - - name: Prepare Rocky - if: ${{ matrix.distribution.type == 'rocky' }} - run: | - yum install --assumeyes git sudo - - - name: Prepare Ubuntu - if: ${{ matrix.distribution.type == 'ubuntu' }} - env: - DEBIAN_FRONTEND: noninteractive - run: | - # for bionic - apt-get --yes update - apt-get install --yes software-properties-common - add-apt-repository --yes ppa:git-core/ppa - apt-get --yes update - apt-get install --yes git lsb-release sudo - - - name: Prepare Linux Mint - if: ${{ matrix.distribution.type == 'mint' }} - env: - DEBIAN_FRONTEND: noninteractive - run: | - # for 19.* - apt-get --yes update - # for 19.3 to avoid - # Setting up software-properties-common (2.0.0.2) ... - # Traceback (most recent call last): - # File "/usr/lib/linuxmint/mintSources/mintSources.py", line 11, in - # import requests - # ModuleNotFoundError: No module named 'requests' - apt-get install --yes python3-requests - apt-get install --yes software-properties-common - add-apt-repository --yes ppa:git-core/ppa - apt-get --yes update - apt-get install --yes git lsb-release sudo - - - name: Add safe git directory - run: git config --global --add safe.directory $GITHUB_WORKSPACE - - # after installing git so we use that copy - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - uses: ./.github/actions/install - with: - python-version: ${{ matrix.python-version }} - development: true - - - uses: chia-network/actions/activate-venv@main - - - name: Run chia --help - run: | - chia --help diff --git a/.github/workflows/test-single.yml b/.github/workflows/test-single.yml deleted file mode 100644 index 7ab2a8ce9..000000000 --- a/.github/workflows/test-single.yml +++ /dev/null @@ -1,221 +0,0 @@ -name: test - -# This reusable workflow structure was chosen for the sole purpose of working around -# the 256 job per matrix limit. The initial total test job count was 290. This -# approach shifts the 256 limit to be per OS rather than overall. A simpler single -# regular workflow with matrixing against the OS would be preferred. - -on: - workflow_call: - inputs: - emoji: - required: true - type: string - matrix: - required: true - type: string - name: - required: true - type: string - file_name: - required: true - type: string - concurrency_name: - required: true - type: string - configuration: - required: true - type: string - runs-on: - required: true - type: string - - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ inputs.concurrency_name }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - test: - name: ${{ matrix.os.emoji }} ${{ matrix.configuration.name }} - ${{ matrix.python.name }} - runs-on: ${{ matrix.os.runs-on }} - timeout-minutes: ${{ matrix.configuration.job_timeout }} - strategy: - fail-fast: false - matrix: - configuration: ${{ fromJson(inputs.configuration) }} - os: - - emoji: ${{ inputs.emoji }} - matrix: ${{ inputs.matrix }} - name: ${{ inputs.name }} - file_name: ${{ inputs.file_name }} - runs-on: ${{ inputs.runs-on }} - python: - - name: '3.7' - file_name: '3.7' - action: '3.7' - apt: '3.7' - install_sh: '3.7' - matrix: '3.7' - - name: '3.8' - file_name: '3.8' - action: '3.8' - apt: '3.8' - install_sh: '3.8' - matrix: '3.8' - - name: '3.9' - file_name: '3.9' - action: '3.9' - apt: '3.9' - install_sh: '3.9' - matrix: '3.9' - - name: '3.10' - file_name: '3.10' - action: '3.10' - apt: '3.10' - install_sh: '3.10' - matrix: '3.10' - exclude: - - os: - matrix: macos - python: - matrix: '3.7' - - os: - matrix: macos - python: - matrix: '3.8' - - os: - matrix: windows - configuration: - install_timelord: true - - os: - matrix: windows - configuration: - name: core.full_node - - env: - CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet - JOB_FILE_NAME: tests_${{ matrix.os.file_name }}_python-${{ matrix.python.file_name }}_${{ matrix.configuration.name }} - BLOCKS_AND_PLOTS_VERSION: 0.29.0 - - steps: - - name: Configure git - run: | - git config --global core.autocrlf false - - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup Python environment - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python.action }} - - - name: Create keychain for CI use (macOS) - if: matrix.os.matrix == 'macos' - run: | - security create-keychain -p foo chiachain - security default-keychain -s chiachain - security unlock-keychain -p foo chiachain - security set-keychain-settings -t 7200 -u chiachain - - - name: Cache npm (Ubuntu) - if: matrix.os.matrix == 'ubuntu' - uses: actions/cache@v3 - env: - SEGMENT_DOWNLOAD_TIMEOUT_MIN: 1 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - - name: Get pip cache dir - id: pip-cache - run: | - echo "::set-output name=dir::$(pip cache dir)" - - - name: Cache pip - uses: actions/cache@v3 - env: - SEGMENT_DOWNLOAD_TIMEOUT_MIN: 1 - with: - # Note that new runners may break this https://github.com/actions/cache/issues/292 - path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Cache test blocks and plots - if: matrix.configuration.checkout_blocks_and_plots - uses: actions/cache@v3 - env: - SEGMENT_DOWNLOAD_TIMEOUT_MIN: 1 - id: test-blocks-plots - with: - path: | - ${{ github.workspace }}/.chia/blocks - ${{ github.workspace }}/.chia/test-plots - key: ${{ env.BLOCKS_AND_PLOTS_VERSION }} - - - name: Checkout test blocks and plots (macOS, Ubuntu) - if: steps.test-blocks-plots.outputs.cache-hit != 'true' && (matrix.os.matrix == 'ubuntu' || matrix.os.matrix == 'macos') - run: | - wget -qO- https://github.com/Chia-Network/test-cache/archive/refs/tags/${{ env.BLOCKS_AND_PLOTS_VERSION }}.tar.gz | tar xzf - - mkdir ${{ github.workspace }}/.chia - mv ${{ github.workspace }}/test-cache-${{ env.BLOCKS_AND_PLOTS_VERSION }}/* ${{ github.workspace }}/.chia - - - name: Checkout test blocks and plots (Windows) - if: steps.test-blocks-plots.outputs.cache-hit != 'true' && matrix.os.matrix == 'windows' - run: | - Invoke-WebRequest -OutFile blocks_and_plots.zip https://github.com/Chia-Network/test-cache/archive/refs/tags/${{ env.BLOCKS_AND_PLOTS_VERSION }}.zip; Expand-Archive blocks_and_plots.zip -DestinationPath . - mkdir ${{ github.workspace }}/.chia - mv ${{ github.workspace }}/test-cache-${{ env.BLOCKS_AND_PLOTS_VERSION }}/* ${{ github.workspace }}/.chia - - - name: Install boost (macOS) - if: matrix.os.matrix == 'macos' - run: | - brew install boost - - - uses: ./.github/actions/install - with: - python-version: ${{ matrix.python.install_sh }} - development: true - - - uses: chia-network/actions/activate-venv@main - - - name: Install timelord - if: matrix.configuration.install_timelord - run: | - sh install-timelord.sh -n - ./vdf_bench square_asm 400000 - - - name: Test blockchain code with pytest - env: - ENABLE_PYTEST_MONITOR: ${{ matrix.os.matrix == 'ubuntu' && matrix.configuration.enable_pytest_monitor || '' }} - run: | - pytest --cov=chia --cov=tests --cov-config=.coveragerc --cov-report= --durations=10 ${{ matrix.configuration.pytest_parallel_args[matrix.os.matrix] }} -m "not benchmark" ${{ env.ENABLE_PYTEST_MONITOR }} ${{ matrix.configuration.test_files }} - - - name: Process coverage data - run: | - coverage xml --rcfile=.coveragerc -o coverage.xml - mkdir coverage-data - cp .coverage "coverage-data/.coverage.${{ env.JOB_FILE_NAME }}" - cp coverage.xml "coverage-data/coverage.${{ env.JOB_FILE_NAME }}.xml" - coverage report --rcfile=.coveragerc --show-missing - - - name: Publish coverage data - uses: actions/upload-artifact@v3 - with: - name: coverage-data - path: coverage-data/* - if-no-files-found: error - - - name: Check resource usage - if: matrix.os.matrix == 'ubuntu' && matrix.configuration.check_resource_usage - run: | - sqlite3 -readonly -separator " " .pymon "select item,cpu_usage,total_time,mem_usage from TEST_METRICS order by mem_usage desc;" >metrics.out - ./tests/check_pytest_monitor_output.py matrix.json - cat matrix.json - echo ::set-output name=configuration::$(cat matrix.json) - - outputs: - configuration: ${{ steps.configure.outputs.configuration }} - - macos: - uses: ./.github/workflows/test-single.yml - needs: configure - with: - emoji: 🍎 - matrix: macos - name: macOS - file_name: macos - concurrency_name: macos - configuration: ${{ needs.configure.outputs.configuration }} - runs-on: macos-latest - ubuntu: - uses: ./.github/workflows/test-single.yml - needs: configure - with: - emoji: 🐧 - matrix: ubuntu - name: Ubuntu - file_name: ubuntu - concurrency_name: ubuntu - configuration: ${{ needs.configure.outputs.configuration }} - runs-on: ubuntu-latest - windows: - uses: ./.github/workflows/test-single.yml - needs: configure - with: - emoji: 🪟 - matrix: windows - name: Windows - file_name: windows - concurrency_name: windows - configuration: ${{ needs.configure.outputs.configuration }} - runs-on: windows-latest - - coverage: - name: ${{ matrix.os.emoji }} Coverage - ${{ matrix.python.name }} - runs-on: ${{ matrix.os.runs-on }} - needs: - - macos - - ubuntu - - windows - strategy: - fail-fast: false - matrix: - os: - - emoji: 🐧 - matrix: ubuntu - name: Ubuntu - runs-on: ubuntu-latest - python: - - name: '3.9' - action: '3.9' - apt: '3.9' - install_sh: '3.9' - matrix: '3.9' - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Download Coverage - uses: actions/download-artifact@v3 - with: - name: coverage-data - path: coverage-data - - - name: Set up ${{ matrix.python.name }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python.action }} - - - uses: ./.github/actions/install - with: - python-version: ${{ matrix.python.action }} - development: true - - - uses: chia-network/actions/activate-venv@main - - - name: Coverage Processing - run: | - # skip windows until https://github.com/nedbat/coveragepy/issues/991 is resolved - rm coverage-data/*.tests_windows_* coverage-data/.*.tests_windows_* - coverage combine --rcfile=.coveragerc --data-file coverage-reports/.coverage coverage-data/ - coverage xml --rcfile=.coveragerc --data-file coverage-reports/.coverage -o coverage-reports/coverage.xml - coverage html --rcfile=.coveragerc --data-file coverage-reports/.coverage --directory coverage-reports/html/ - - - name: Coverage report (chia/) - run: | - coverage report --rcfile=.coveragerc --data-file coverage-reports/.coverage --include='chia/*' --show-missing | tee coverage-reports/coverage-chia-stdout - - - name: Coverage report (tests/) - run: | - coverage report --rcfile=.coveragerc --data-file coverage-reports/.coverage --include='tests/*' --show-missing | tee coverage-reports/coverage-tests-stdout - -# needs some debugging since it just reports no changes -# - name: Coverage report (diff) -# run: | -# diff-cover --compare-branch=${{ fromJSON(format('[{0}, {1}]', toJSON(github.event.before), toJSON(format('origin/{0}', github.base_ref))))[github.base_ref != ''] }} coverage-reports/coverage.xml | tee coverage-reports/diff-cover-stdout - - - name: Publish coverage reports - if: always() - uses: actions/upload-artifact@v3 - with: - name: coverage-reports - path: coverage-reports/* - if-no-files-found: error diff --git a/.github/workflows/trigger-docker-dev.yml b/.github/workflows/trigger-docker-dev.yml deleted file mode 100644 index 4533e1b14..000000000 --- a/.github/workflows/trigger-docker-dev.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: 📦🚀 Trigger Dev Docker Build - -on: - push: - branches: - - 'long_lived/**' - - 'release/**' - pull_request: - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - trigger: - name: Trigger building a new dev tag for the chia-docker image - runs-on: ubuntu-latest - steps: - - name: Test for secrets access - id: check_secrets - shell: bash - run: | - unset HAS_SECRET - - if [ -n "$GLUE_ACCESS_TOKEN" ]; then HAS_SECRET='true' ; fi - echo ::set-output name=HAS_SECRET::${HAS_SECRET} - env: - GLUE_ACCESS_TOKEN: "${{ secrets.GLUE_ACCESS_TOKEN }}" - - - name: Trigger docker dev workflow via github-glue - if: steps.check_secrets.outputs.HAS_SECRET - run: | - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"sha":"${{ github.sha }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/docker-build-dev/${{ github.sha }}/start - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{"sha":"${{ github.sha }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/docker-build-dev/${{ github.sha }}/success/build-dev diff --git a/.github/workflows/trigger-docker-main.yml b/.github/workflows/trigger-docker-main.yml deleted file mode 100644 index 5eacc24e2..000000000 --- a/.github/workflows/trigger-docker-main.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: 📦🚀 Trigger Main Docker Build - -on: - push: - branches: - - main - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - trigger: - name: Trigger building a new `main` tag for the chia-docker image - runs-on: ubuntu-latest - steps: - - name: Trigger docker main workflow via github-glue - run: | - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{}' ${{ secrets.GLUE_API_URL }}/api/v1/docker-build-main/${{ github.sha }}/start - curl -s -XPOST -H "Authorization: Bearer ${{ secrets.GLUE_ACCESS_TOKEN }}" --data '{}' ${{ secrets.GLUE_API_URL }}/api/v1/docker-build-main/${{ github.sha }}/success/build-main diff --git a/.github/workflows/upload-pypi-source.yml b/.github/workflows/upload-pypi-source.yml deleted file mode 100644 index c30f500aa..000000000 --- a/.github/workflows/upload-pypi-source.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: 🚨🚀 Lint and upload source distribution - -on: - push: - branches: - - 'long_lived/**' - - main - - 'release/**' - release: - types: [published] - pull_request: - branches: - - '**' - -concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} - cancel-in-progress: true - -jobs: - upload_source_dist: - name: Lint and Upload source distribution - runs-on: [ubuntu-latest] - timeout-minutes: 30 - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - submodules: recursive - - - uses: actions/setup-python@v3 - name: Install Python - with: - python-version: '3.8' - - - name: Test for secrets access - id: check_secrets - shell: bash - run: | - unset HAS_SECRET - if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi - echo ::set-output name=HAS_SECRET::${HAS_SECRET} - env: - SECRET: "${{ secrets.test_pypi_password }}" - - - name: Install lint requirements - run: | - python -m pip install --upgrade pip setuptools wheel - python -m pip install .[dev] - - - name: Lint source with black - run: | - black --check --diff . - - - name: Lint source with flake8 - run: | - flake8 benchmarks build_scripts chia tests tools *.py - - - name: Lint source with mypy - run: | - mypy - - - name: Lint source with pylint - run: | - pylint benchmarks build_scripts chia tests tools *.py - - - name: Build source distribution - run: | - python -m build --sdist --outdir dist . - - - name: Upload artifacts - uses: actions/upload-artifact@v3 - with: - name: dist - path: ./dist - - - name: Publish distribution to PyPI - if: steps.check_secrets.outputs.HAS_SECRET && startsWith(github.ref, 'refs/tags') - env: - TWINE_USERNAME: __token__ - TWINE_NON_INTERACTIVE: 1 - TWINE_PASSWORD: ${{ secrets.pypi_password }} - run: twine upload --non-interactive --skip-existing --verbose 'dist/*' diff --git a/.gitignore b/.gitignore index f70408d1f..048fd6db4 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ config/keys.yaml config/plots.yaml # Bundled code -chia-blockchain.tar.gz.tar.gz +flax-blockchain.tar.gz.tar.gz # PyInstaller # Usually these files are written by a python script from a template @@ -50,7 +50,7 @@ activate .idea # Packaging -chia-blockchain.tar.gz +flax-blockchain.tar.gz # Timelord utilities vdf_bench @@ -76,18 +76,18 @@ main.sym *.pstats # Dev config react -# chia-blockchain-gui/src/dev_config.js +# flax-blockchain-gui/src/dev_config.js # React built app -chia-blockchain-gui/.eslintcache -chia-blockchain-gui/build +flax-blockchain-gui/.eslintcache +flax-blockchain-gui/build build_scripts/dist build_scripts/*.Dmg -chia-blockchain-gui/src/locales/_build +flax-blockchain-gui/src/locales/_build build_scripts\win_build build_scripts/win_build win_code_sign_cert.p12 -# chia-blockchain wheel build folder +# flax-blockchain wheel build folder build/ # Temporal `n` (node version manager) directory diff --git a/.gitmodules b/.gitmodules index 596e3d882..98a684682 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +1,6 @@ -[submodule "chia-blockchain-gui"] - path = chia-blockchain-gui - url = https://github.com/Chia-Network/chia-blockchain-gui.git - branch = main [submodule "mozilla-ca"] path = mozilla-ca url = https://github.com/Chia-Network/mozilla-ca.git - branch = main +[submodule "flax-blockchain-gui"] + path = flax-blockchain-gui + url = https://github.com/Flax-Network/flax-blockchain-gui.git diff --git a/.isort.cfg b/.isort.cfg index d854c28ad..836c753fe 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -5,132 +5,132 @@ skip_gitignore=true add_imports=from __future__ import annotations # venv/bin/isort --check . |& sed -n "s;ERROR: ${PWD}/\(.*\) Imports are.*; \1;p" | sort | uniq extend_skip= - chia/clvm/spend_sim.py - chia/cmds/chia.py - chia/cmds/db.py - chia/cmds/db_upgrade_func.py - chia/cmds/farm_funcs.py - chia/cmds/farm.py - chia/cmds/init_funcs.py - chia/cmds/init.py - chia/cmds/keys_funcs.py - chia/cmds/keys.py - chia/cmds/netspace.py - chia/cmds/passphrase_funcs.py - chia/cmds/passphrase.py - chia/cmds/plotnft_funcs.py - chia/cmds/plotnft.py - chia/cmds/plotters.py - chia/cmds/show.py - chia/cmds/start_funcs.py - chia/cmds/start.py - chia/cmds/wallet_funcs.py - chia/cmds/wallet.py - chia/daemon/keychain_proxy.py - chia/daemon/keychain_server.py - chia/daemon/server.py - chia/full_node/block_height_map.py - chia/full_node/block_store.py - chia/full_node/bundle_tools.py - chia/full_node/coin_store.py - chia/full_node/full_node_api.py - chia/full_node/full_node.py - chia/full_node/generator.py - chia/full_node/hint_store.py - chia/full_node/lock_queue.py - chia/full_node/mempool_check_conditions.py - chia/full_node/mempool_manager.py - chia/full_node/weight_proof.py - chia/introducer/introducer.py - chia/plotters/bladebit.py - chia/plotters/chiapos.py - chia/plotters/madmax.py - chia/plotters/plotters.py - chia/pools/pool_puzzles.py - chia/pools/pool_wallet_info.py - chia/pools/pool_wallet.py - chia/protocols/pool_protocol.py - chia/protocols/protocol_state_machine.py - chia/rpc/full_node_rpc_client.py - chia/rpc/rpc_client.py - chia/rpc/wallet_rpc_api.py - chia/rpc/wallet_rpc_client.py - chia/seeder/crawler.py - chia/seeder/crawl_store.py - chia/seeder/dns_server.py - chia/server/address_manager_sqlite_store.py - chia/server/address_manager_store.py - chia/server/introducer_peers.py - chia/server/node_discovery.py - chia/server/peer_store_resolver.py - chia/server/reconnect_task.py - chia/server/start_service.py - chia/server/start_wallet.py - chia/simulator/simulator_constants.py - chia/simulator/start_simulator.py - chia/ssl/create_ssl.py - chia/timelord/timelord_launcher.py - chia/types/blockchain_format/program.py - chia/types/blockchain_format/proof_of_space.py - chia/types/blockchain_format/vdf.py - chia/types/coin_solution.py - chia/types/coin_spend.py - chia/types/full_block.py - chia/types/generator_types.py - chia/types/name_puzzle_condition.py - chia/types/spend_bundle.py - chia/util/bech32m.py - chia/util/byte_types.py - chia/util/chain_utils.py - chia/util/check_fork_next_block.py - chia/util/chia_logging.py - chia/util/condition_tools.py - chia/util/dump_keyring.py - chia/util/files.py - chia/util/generator_tools.py - chia/util/keychain.py - chia/util/keyring_wrapper.py - chia/util/log_exceptions.py - chia/util/network.py - chia/util/profiler.py - chia/util/service_groups.py - chia/util/ssl_check.py - chia/util/ws_message.py - chia/wallet/cat_wallet/cat_info.py - chia/wallet/cat_wallet/cat_utils.py - chia/wallet/cat_wallet/cat_wallet.py - chia/wallet/derive_keys.py - chia/wallet/did_wallet/did_info.py - chia/wallet/did_wallet/did_wallet_puzzles.py - chia/wallet/did_wallet/did_wallet.py - chia/wallet/lineage_proof.py - chia/wallet/payment.py - chia/wallet/puzzles/load_clvm.py - chia/wallet/puzzles/prefarm/make_prefarm_ph.py - chia/wallet/puzzles/prefarm/spend_prefarm.py - chia/wallet/puzzles/puzzle_utils.py - chia/wallet/puzzles/singleton_top_layer.py - chia/wallet/puzzles/tails.py - chia/wallet/sign_coin_spends.py - chia/wallet/trade_manager.py - chia/wallet/trade_record.py - chia/wallet/trading/offer.py - chia/wallet/trading/trade_store.py - chia/wallet/transaction_record.py - chia/wallet/util/compute_hints.py - chia/wallet/util/compute_memos.py - chia/wallet/util/debug_spend_bundle.py - chia/wallet/util/puzzle_compression.py - chia/wallet/util/wallet_sync_utils.py - chia/wallet/wallet_blockchain.py - chia/wallet/wallet_coin_store.py - chia/wallet/wallet_interested_store.py - chia/wallet/wallet_node_api.py - chia/wallet/wallet_node.py - chia/wallet/wallet_pool_store.py - chia/wallet/wallet.py - chia/wallet/wallet_state_manager.py - chia/wallet/wallet_weight_proof_handler.py + flax/clvm/spend_sim.py + flax/cmds/flax.py + flax/cmds/db.py + flax/cmds/db_upgrade_func.py + flax/cmds/farm_funcs.py + flax/cmds/farm.py + flax/cmds/init_funcs.py + flax/cmds/init.py + flax/cmds/keys_funcs.py + flax/cmds/keys.py + flax/cmds/netspace.py + flax/cmds/passphrase_funcs.py + flax/cmds/passphrase.py + flax/cmds/plotnft_funcs.py + flax/cmds/plotnft.py + flax/cmds/plotters.py + flax/cmds/show.py + flax/cmds/start_funcs.py + flax/cmds/start.py + flax/cmds/wallet_funcs.py + flax/cmds/wallet.py + flax/daemon/keychain_proxy.py + flax/daemon/keychain_server.py + flax/daemon/server.py + flax/full_node/block_height_map.py + flax/full_node/block_store.py + flax/full_node/bundle_tools.py + flax/full_node/coin_store.py + flax/full_node/full_node_api.py + flax/full_node/full_node.py + flax/full_node/generator.py + flax/full_node/hint_store.py + flax/full_node/lock_queue.py + flax/full_node/mempool_check_conditions.py + flax/full_node/mempool_manager.py + flax/full_node/weight_proof.py + flax/introducer/introducer.py + flax/plotters/bladebit.py + flax/plotters/chiapos.py + flax/plotters/madmax.py + flax/plotters/plotters.py + flax/pools/pool_puzzles.py + flax/pools/pool_wallet_info.py + flax/pools/pool_wallet.py + flax/protocols/pool_protocol.py + flax/protocols/protocol_state_machine.py + flax/rpc/full_node_rpc_client.py + flax/rpc/rpc_client.py + flax/rpc/wallet_rpc_api.py + flax/rpc/wallet_rpc_client.py + flax/seeder/crawler.py + flax/seeder/crawl_store.py + flax/seeder/dns_server.py + flax/server/address_manager_sqlite_store.py + flax/server/address_manager_store.py + flax/server/introducer_peers.py + flax/server/node_discovery.py + flax/server/peer_store_resolver.py + flax/server/reconnect_task.py + flax/server/start_service.py + flax/server/start_wallet.py + flax/simulator/simulator_constants.py + flax/simulator/start_simulator.py + flax/ssl/create_ssl.py + flax/timelord/timelord_launcher.py + flax/types/blockchain_format/program.py + flax/types/blockchain_format/proof_of_space.py + flax/types/blockchain_format/vdf.py + flax/types/coin_solution.py + flax/types/coin_spend.py + flax/types/full_block.py + flax/types/generator_types.py + flax/types/name_puzzle_condition.py + flax/types/spend_bundle.py + flax/util/bech32m.py + flax/util/byte_types.py + flax/util/chain_utils.py + flax/util/check_fork_next_block.py + flax/util/flax_logging.py + flax/util/condition_tools.py + flax/util/dump_keyring.py + flax/util/files.py + flax/util/generator_tools.py + flax/util/keychain.py + flax/util/keyring_wrapper.py + flax/util/log_exceptions.py + flax/util/network.py + flax/util/profiler.py + flax/util/service_groups.py + flax/util/ssl_check.py + flax/util/ws_message.py + flax/wallet/cat_wallet/cat_info.py + flax/wallet/cat_wallet/cat_utils.py + flax/wallet/cat_wallet/cat_wallet.py + flax/wallet/derive_keys.py + flax/wallet/did_wallet/did_info.py + flax/wallet/did_wallet/did_wallet_puzzles.py + flax/wallet/did_wallet/did_wallet.py + flax/wallet/lineage_proof.py + flax/wallet/payment.py + flax/wallet/puzzles/load_clvm.py + flax/wallet/puzzles/prefarm/make_prefarm_ph.py + flax/wallet/puzzles/prefarm/spend_prefarm.py + flax/wallet/puzzles/puzzle_utils.py + flax/wallet/puzzles/singleton_top_layer.py + flax/wallet/puzzles/tails.py + flax/wallet/sign_coin_spends.py + flax/wallet/trade_manager.py + flax/wallet/trade_record.py + flax/wallet/trading/offer.py + flax/wallet/trading/trade_store.py + flax/wallet/transaction_record.py + flax/wallet/util/compute_hints.py + flax/wallet/util/compute_memos.py + flax/wallet/util/debug_spend_bundle.py + flax/wallet/util/puzzle_compression.py + flax/wallet/util/wallet_sync_utils.py + flax/wallet/wallet_blockchain.py + flax/wallet/wallet_coin_store.py + flax/wallet/wallet_interested_store.py + flax/wallet/wallet_node_api.py + flax/wallet/wallet_node.py + flax/wallet/wallet_pool_store.py + flax/wallet/wallet.py + flax/wallet/wallet_state_manager.py + flax/wallet/wallet_weight_proof_handler.py tests/blockchain/test_blockchain.py tests/blockchain/test_blockchain_transactions.py tests/block_tools.py @@ -138,7 +138,7 @@ extend_skip= tests/build-workflows.py tests/clvm/benchmark_costs.py tests/clvm/coin_store.py - tests/clvm/test_chialisp_deserialization.py + tests/clvm/test_flaxlisp_deserialization.py tests/clvm/test_program.py tests/clvm/test_puzzle_compression.py tests/clvm/test_serialized_program.py diff --git a/BUILD_TIMELORD.md b/BUILD_TIMELORD.md index 51ba6064a..1d0f9e4ae 100644 --- a/BUILD_TIMELORD.md +++ b/BUILD_TIMELORD.md @@ -1,7 +1,7 @@ # Building timelords The Linux and MacOS chiavdf binary wheels currently exclude an executable -required to run a [Timelord](https://github.com/Chia-Network/chia-blockchain/wiki/Timelords). +required to run a [Timelord](https://github.com/Flax-Network/flax-blockchain/wiki/Timelords). If you want to run a Timelord on Linux or MacOS, you must install the wheel from source (which may require some additional development packages) while in the virtual environment. @@ -14,7 +14,7 @@ sh install-timelord.sh ``` If the compile fails, it's likely due to a missing dependency. The script -[install-timelord.sh](https://github.com/Chia-Network/chia-blockchain/blob/main/install-timelord.sh) +[install-timelord.sh](https://github.com/Flax-Network/flax-blockchain/blob/main/install-timelord.sh) attempts to install required build dependencies for Linux and MacOS before invoking pip to build from the source python distribution of chiavdf. diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 872dbd8dc..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,2531 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project does not yet adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) -for setuptools_scm/PEP 440 reasons. - -## 1.6.1 Chia blockchain 2022-11-03 - -### Added - -- New node RPC for fee estimates `/get_fee_estimate` -- Added support for labeling (naming) wallets (keys) -- Added CLI option `chia keys label` -- Added REMARK to `ConditionOpcodes` -- Prevent creation of offers with 100% royalties -- Added `chia peer` command to replace `chia show -c` -- New wallet RPC `/nft_mint_bulk` and preliminary support for bulk minting -- New wallet RPC `/nft_calculate_royalties` -- New wallet signing RPCs `/sign_message_by_address`, `/sign_message_by_id` -- New wallet CLI option `chia wallet sign_message` -- New wallet RPC `/push_transactions` (thanks @stmharry) -- New daemon command `running_services` to list all running services -- Code coverage is now generated -- Added on-chain wallet notification mechanism with CLI -- Added log warning when inserting into the mempool takes longer than 2 seconds - -### Changed - -- RPC incompatibility: `/get_routes` and `/healthz` now return a boolean for success (previously was a string) -- New Windows installer created with `electron-builder` -- Blsspy updated to 1.0.16 -- Chiavdf updated to 1.0.7 -- Chiapos updated to 1.0.11 -- Clvm_tools updated to 0.4.5 -- Chia_rs updated to 0.1.14 -- Clvm-tools-rs updated to 0.1.24 -- Aiohttp updated to 3.8.3 -- Colorlog updated to 6.7.0 -- Concurrent-log-handler updated to 0.9.20 -- Cryptography updated to 36.0.2 -- Filelock updated to 3.8.0 -- Keyring updated to 23.6.0 -- Click updated to 8.1.3 -- Dnspython updated to 2.2.1 -- Dnslib updated to 0.9.22 -- Zstd updated to 1.5.2.6 -- Updated various DataLayer CLI commands to accept root hash parameter -- Pool config is updated after the wallet is fully synced (#12631) -- Prior to adding DID coins, ensure coin is valid -- Adding submodule branch override to Install-gui.ps1 -- Reverted `change` to `change OR REPLACE -> OR FAIL` in `wallet_coin_store` -- Changed log level to `INFO` in `Receiver.reset` for plot sync -- Modified `/nft_get_info` to include `p2_address` -- Simplified `WalletStateManager.coin_added()` -- Minor change to DataLayer mirror sync -- Removed unnecessary split when starting daemon -- Removed mostly unused wallet action store (wallet_action_store.py) and rearrange code as needed -- Removed unused `all_puzzle_hashes` from `wallet_puzzle_store` -- Removed "Total iterations since start" from `chia show -s` -- Removed rate-limited wallet -- Removed the beta program link from the warning in the CLI -- Removed `--enable-data-server` from `chia configure` CLI -- Improved RPC server start/stop -- Drop partially implemented BIP39 passphrase support -- Simplify key deletion in `Keychain` -- Simplify public key getters in `Keychain` -- Cleanup and reuse of wallet code -- Return before fetching weight proof if a secondary sync task is running (Thanks @olivernyc!) -- Dropped unused `chia_minor_release_number` -- Just `raise`, not `raise e` when reraising -- Optimized `simple_solution_generator()` -- Allow developers to easily use standard Chia `clvm` puzzles and libraries -- Skipped validating `GTElement` in mempool -- Improved logging for `chia plotters version` errors -- Performance improvements in `subscribe_to_phs` using CoinState from chia_rs -- Performance improvements in wallet syncing by doing bulk coin record lookups -- Performance improvements in wallet syncing by caching the last derivation path -- Performance improvements in offer parsing by implementing a more efficient Program.uncurry() -- Performance improvements in puzzle parsing by using rust parser (`chia_rs`) for Program.from_bytes() -- Performance improvements in wallet by caching the uncurried puzzle in UncurriedPuzzle class -- Implement generator_for_single_coin() in python instead of `clvm` -- Optimize get_block_store by not parsing the full block -- Avoid creating a list and enable short circuit behavior in `bundle_suitable_for_compression()` -- Performance improvements when dealing with lots of trades (offers) by using a lookup table and not loading all trades from disk upfront -- Minimized a chance where `sudo` prompts users for password in `install.sh` -- Full_node: Dropped unused ultra priority lock -- Full_node: Set defaults in `SyncStore` -- Various performance and code cleanup in mempool handling -- Significant scalability improvements in NFT handling -- Minter DID now shown in output of `chia wallet nft get_info` and in GUI -- Treehash optimization for DID wallet -- Performance improvements by using `get_puzzle_and_solution_for_coin()` from `chia_rs` -- Adds handling for daemon not sending `initial_target_state` (thanks @bolshoytoster) (#10058) -- Reduced log noise during wallet syncing -- Run `get_puzzle_and_solution_for_coin` and `get_block_header` expensive API requests in separate thread -- Do not trigger the pending tx handler in some cases. Eliminates multiple ALREADY_INCLUDING_TRANSACTION errors for some operations, notably claiming self-pooling rewards -- Defined a shared API for all wallet via a WalletProtocol class -- Recompress CLVM generators -- Removed unnecessary logging during plot creation -- Made `IP` section in connections table 1 character wider to handle IPV6 -- Deprecated `chia plotters install` command -- Improved handling of unfinished block messages -- Stripped leading and trailing whitespace before `bech32` decoding in various places -- Fixed issues in the GUI with sending CAT transactions with a fee -- Changed `ctx.exit` -> `raise click.ClickException` in CLI -- Improved harvester logging - -### Fixed - -- Fixed a few instances of coin name logging -- Fixed chia farm summary if using a remote full node (thanks @yan74) -- Fixed comments in initial config where puzzle hash should be receive address (thanks @hugepants) -- Fixed locking of main thread in `validate_weight_proof_inner` -- Fixed several bugs with untrusted sync, and correct sync status -- Fixed performance issue in wallet with offers -- Minor fixes for related to running serialized programs -- Fixed bug in remove_plot_directory when removing a directory not currently in the plot directory list (thanks @joshpainter) -- Fixed the run_block utility to use chialisp_deserialization -- Minor comment typo, hinting, and fixture cleanup -- Fixed a crash that happens when plot directory config is empty -- Set log levels per handler / Fix the log level in beta mode -- Minimal fixup for daemon signal handling regression -- Fixed CAT offer aggregation edge case (#13464) -- Fixed memos & minter DID -- Fixed logo URL in readme.md (thanks @SametBasturkk) -- Fixed typo in wallet code `puzlle` -> `puzzle` (thanks @wizicer) -- Fixed `chia show -s` with other options as well -- Fixed issue with the wallet not syncing in untrusted mode, if connected to a trusted peer that is not synced -- Improve handling of not synced peers -- Sped up creation of puzzle hashes in the wallet -- Replaced several handled tracebacks with standard log messages -- Show Usage when running `chia plotters` (#13690) -- Fixed marking the successfully added spend bundles to the reinitialized mempool when a new peak is available -- Fixed errors output when stopping the daemon on CLI -- Fixed incompatibility with Python 3.10.8 around accessing the `_waiters` private attribute of asyncio Semaphore class (#13636) -- Fixed DataLayer issues with subscribing after unsubscribing to the same store/singleton (#13589) -- Report to GUI when DID wallet is created -- Check if offer file is present before trying to take offer -- Properly catch and handle errors during shutdown while syncing -- Fixed proof lookup and plot caching with bladebit plots that have dropped entries (#13084) -- Fixed issues with accepting Datalayer offers where the offer inclusions has matching key/value data for both maker and taker inclusions -- Fixed issues where ChiaLisp was compiled during import requiring write access to the directory (#11257) (thanks @lourkeur). To force compilation, developers can set environment variable `CHIA_DEV_COMPILE_CLVM_ON_IMPORT` -- Removed tracking of dropped transactions `dropped_tx` (thanks @roseiliend) -- Fixed a breaking change in `get_puzzle_and_solution` RPC - -## 1.6.0 Chia blockchain 2022-9-20 - -### Added - -- DataLayer -- XCH Spam Filter -- GUI Settings `Auto-Login` toggle (GUI only) -- GUI Settings section for `DataLayer` - - `Enable DataLayer` toggle - - `Enable File Propagation Server` toggle - -### Changed - -- Delayed pool config update until after sync -- Minor change to handling sync height to avoid race condition with blockchain DB -- Ignore `FileNotFoundError` when checking SSL file permissions if the file doesn’t exist - -### Fixed - -- Fixed missing wallet `state_changed` events for GUI -- Fixed several bugs related to wallet sync status -- Fixed GUI issue for CAT offers where the CAT Tail would not show in the tooltip for `Unknown CAT`s (https://github.com/Chia-Network/chia-blockchain-gui/issues/950) - -### Known Issues - -- The CLI command `chia configure --enable-data-server`, and the `config.yaml` parameter at `data_layer.run_server` have no effect, and will be removed in the future -- DataLayer offers cannot be accepted (`take_offer`) if the offer has inclusions for the exact same key/value data for both maker and taker inclusions. - -## 1.5.1 Chia blockchain 2022-8-23 - -### Added - -- Add Source and Changelog to project_urls (Thanks @strayer!) -- Add condition code constant for REMARK, an always true Chialisp condition -- Add several wallet optimizations -- Add `chia db backup --backup-file ` (Thanks @neurosis69!) -- Add debug option to log all SQL commands for wallet db (Thanks @neurosis69!) -- Additional data for `get_wallet_balance` and `get_wallets` endpoints -- Add `change_data` to `_state_changed` since the later calls expect it -- Add `Program.replace` -- Add `new_transaction()` to `DBWrapper2` -- Add RPCs for getting/extending the current derivation path index -- Add symlinks to the UI RPM to mirror the .deb UI and the CLI installers -- Add support for excluding coins in `create_signed_transaction` wallet RPC (Thanks @felixbrucker!) -- Add small coin selection improvements -- Add bulk cancel API -- Introduce `streamable.Field` -- Introduce `Streamable.__post_init__` processing cache -- Added minimum coin amount to various RPC calls -- Added new full_node RPC called `get_block_spends` - Get spends for block using transaction generator -- Support for remembering the last used wallet key -- Documented deserialization length limitations (8191 bytes) in CLVM ROM. We recommend using a local version of the chialisp code when necessary - -### Changed - -- Huge speedup in trusted wallet sync - - Previous time to sync 1000 tx: 90 seconds - - New time: 2 seconds -- Force keyring migration / Deprecate legacy keyring support -- Renaming series -> editions (full deprecation) (Thanks @DrakoPensulo!) -- Made various additions to the cache, and changes to validation to reduce CPU usage significantly -- Log full errors when `run_as_generator()` throws error -- Sort `plot_paths` before splitting it into batches -- Skip `plot_sync_callback` if `delta` is `None` -- Validate the path in `add_plot_directory` -- Cache convert functions from `dataclass_from_dict` -- Big thanks to @neurosis69 for the following: - - Allow bigger chunks of bind variables per SQL statement - - Execute SQL updates as chunks in `_set_spent function` for `tx_removals` - - Optimized column selection in various tables to use specific columns rather than all columns - - Write blockchain DB full node startup progress to debug.log -- Clean up and Refactor `chia show` command -- Increment the dirty counter when setting `height-to-hash` map entries -- `plotting.cache.DiskCache` -> `util.misc.VersionedBlob` -- Improve `chia farm summary` -- Optimize `std_hash` in `coin.py` -- Improved many tests -- Remove `big_ints` list -- Improved UX for `plotnft claim` -- Upgrade `chia-rs` to streamable support -- Allow switching keys during sync -- Optimize `get_hash` by not double converting -- Don't re-hash the same objects -- Drop redundant `PlotPathRequestData` conversion -- Make `PlotsRefreshParameter` streamable + use `from_json_dict` -- Make `Plot{Info|Path}RequestData` streamable + use `from_json_dict` -- Optimize request additions -- Stop and join watchdog observer -- Remove chia.util.path.mkdir() -- Remove the constants_json field -- Don't convert `ConsensusConstants` to/from JSON -- Move some class methods out of `Streamable` -- Request header blocks, and new rate limits -- Replaced the python implementation of `Coin` with the Rust native `Coin` from `chia_rs` -- Watchdog==2.1.9 for bad file descriptor avoidance -- Be specific about `*args` in `RpcServer` state changed methods -- Make WalletUserStore.create_wallet() raise on failure, and return non-optional -- Switch back to official dnspython for v2.2.0 -- Not optional - `WalletNode.wallet_state_manager`, `.server`, `.keychain_proxy` -- More `uint64()` for NFT coin amount -- Delay `WalletNode._new_peak_queue` instantiation to avoid errors -- Remove unused `WalletCoinStore.get_unspent_coins_at_height` -- `NFTInfo.royalty_puzzle_hash` is `Optional` but not `None` here -- Handle `KeychainProxyConnectionFailure` in `Farmer.setup_keys` -- Made simplifications to the `WalletCoinStore` class -- Removed wallet transaction store cache -- Removed double `bytes32` conversion -- Turn `dataclass_from_dict` into `streamable_from_dict` -- Replace service `running_new_process=` parameter by `.setup_process_global_state()` method -- Changed wallet peer selection to prefer nodes in the following order - 1. trusted & synced - 2. untrusted & synced - 3. trusted & unsynced - 4. untrusted & unsynced -- Simplified pool cache -- Remove unused finished_sync_up_to (Thanks @olivernyc!) -- Expand `Field` and introduce `Streamable._streamable_fields` -- Removing `logging.basicConfig()` from `ChiaServer.__init__()` -- Use coin selection algorithm for DID wallets -- Simplify service start configuration loading -- Wallet network messages now have higher priority than Node network messages -- Wallet now checks the mempool before adding new transactions to the queue -- Implemented new context manager for DB access (DBWrapper2) that supports nested transactions, improved support for concurrency, and simplified exception handling -- Upgraded `clvm-tools-rs` to `0.1.19` -- Upgraded `clvm_tools` to `0.4.5` -- Simplify wallet transaction store -- Remove unused `_clear_database()` functions -- Optimized wallet DB queries using `execute_fetchall` -- Optimize wallet `set_spent()` -- Added support for minimum coin amount and excluding coins in `select_coin` RPC -- Log `chia_full_version_str` in daemon and all services -- On failure to get keys, log and return exception -- Update certificate store as of July 19, 2022 -- Optimize puzzlehash generation (~65% faster) -- Deprecated the ability to disable the keyring passphrase feature -- Minor simplifications to derivation records -- Update protocol message checks -- Changed `initial_num_public_keys` default to 425 -- Minor optimizations for block store -- Optimize get_coins_to_check() -- Minor wallet optimizations when determining coin type -- Avoid redundant printing of puzzle program in NFT uncurry attempt -- Substantially reduced overall size of Chia packages -- Log the plot refresh parameter on start -- Log blockchain database file used along with schema version on startup -- Removed redundant request for SubEpochData - -### Fixed - -- Log error for failed service start -- Improve logging in `plot_sync.{receiver|delta}` -- Fix default value assignments for `dataclass_from_dict` for streamable -- Fix `change_payout_instructions` for invalid addresses -- Fix SQL error when only config file is deleted -- Fix issue with wallet not handling rejection from unsynced local node properly -- Fix for transfer NFT with DID -- Fix misleading argument name (Thanks @olivernyc!) -- Fix knapsack coin selection - - Old performance with 200k coins: 60 seconds - - New: 0.78 seconds. -- Fix trusted_peer example in initial-config.yaml by (Thanks @ojura!) -- Replace existing simulator config & Fix simulator -- Fix attribute error on `FullNode.simulator_transaction_callback` -- Fix passphrase hint -- Bump clvm_tools_rs for bug fix -- Fix NFT > CAT Royalty splitting bug -- Fixed `mint_nft` -- Fix no keys loaded error by making KeychainProxy automatically reconnect when a connection is lost -- Fix a migration bug of NFT table change -- NFT wallet reorg fix -- Fix NFT wallet naming issue -- Can't shadow `info` which is `NFTInfo` in the first place -- Initialize logging before Service instantiation -- Make sure chia commands output help when no args are given (#11013) (Thanks @noneus!) -- Fixed bugs in fork point calculation, and reduced number of times weight-proofs are validated -- Fixed bug in starting the crawler (set service name to `full_node`) -- NFT transfer/minting commands now validate the specified addresses -- Block summaries of CAT1 offers in the RPC and CLI - -## 1.5.0 Chia blockchain 2022-7-26 - -### Added - -- Added derivation index information to the Wallet UI to show the current derivation index height -- Added section in Settings to allow the user to manually update the derivation index height in order to ensure the wallet finds all the coins -- Added a tooltip for users to understand why their CAT balance has changed as new CAT2 tokens get re-issued -- There is now a `blockchain_wallet_v2_r1_*.sqlite` DB that will be created, which will sync from 0 to look for CAT2 tokens. This preserves a copy of your previous wallet DB so that you are able to look up previous transactions by using an older wallet client -- Extended `min_coin` to RPC calls, and CLI for coin selection -- Show DID in the offer preview for NFTs -- Added wallet RPCs (`get_derivation_index`, `update_derivation_index`) to enable the GUI, and CLI to report what the current derivation index is for scanning wallet addresses, and also allows a user to move that index forward to broaden the set of addresses to scan for coins - -### Changed - -- Changed the DID Wallet to use the new coin selection algorithm that the Standard Wallet, and the CAT Wallet already use -- Changed returning the result of send_transaction to happen after the transaction has been added to the queue, rather than it just being added to the mempool. -- Increased the priority of wallet transactions vs full node broadcasted transactions, so we don't have to wait in line as a wallet user -- Deprecated the `-st, --series-total` and `-sn, --series-number` RPC and CLI NFT minting options in favor of `-ec, --edition-count` and `-en, --edition-number` to align with NFT industry terms -- When creating a DID profile, a DID-linked NFT wallet is automatically created -- Update `chia wallet take_offer` to show NFT royalties that will be paid out when an offer is taken -- Added a parameter to indicate how many additional puzzle hashes `create_more_puzzle_hashes` should create - -### Fixed - -- Fixed [CVE-2022-36447] where in tokens previously minted on the Chia blockchain using the `CAT1` standard can be inflated in arbitrary amounts by any holder of the token. Total amount of the token can be increased as high as the malicious actor pleases. This is true for every `CAT1` on the Chia blockchain, regardless of issuance rules. This attack is auditable on-chain, so maliciously altered coins can potentially be "marked" by off-chain observers as malicious. -- Fixed issue that prevented websockets from being attempted if an earlier websocket failed -- Fixed issue where `test_smallest_coin_over_amount` did not work properly when all coins were smaller than the amount -- Fixed a performance issue with knapsack that caused it to keep searching for more coins than could actually be selected. Performance with 200k coins: - - Old: 60 seconds - - New: 0.78 seconds -- Fixed offer compression backwards compatibility -- Fixed royalty percentage check for NFT0 NFTs, and made the check for an offer containing an NFT more generalized -- Fixed timing with asyncio context switching that could prevent networking layer from responding to ping - -## 1.4.0 Chia blockchain 2022-6-29 - -### Added - -- Added support for NFTs!!! :party: -- Added `chia wallet nft` command (see ) -- Added `chia wallet did` command (see ) -- Added RPCs for DID (see ) -- Added RPCs for NFT (see ) -- Enable stricter mempool rule when dealing with multiple extra arguments -- Added a retry when loading pool info from a pool at 2 minute intervals -- Added CLI options `--sort-by-height` and –sort-by-relevance` to `chia wallet get_transactions` -- Harvester: Introduce `recursive_plot_scan` -- Add libgmp-dev to Bladebit installation - thanks to @TheLastCicada -- Add support for multiple of the same CAT in aggregate offers - Thanks to @roseiliend - -### Changed - -- New coin selection algorithm based on bitcoin knapsack. Previously chia selected the largest coin -- Updated chiapos to 1.0.10 -- Updated chiavdf to 1.0.6 -- Updated blspy to 1.0.13 -- Updated setproctitle to 1.2.3 -- Updated PyYAML to 6.0 -- Updated pyinstaller to 5.0 -- Bump clvm_tools_rs version to 0.1.9 for clvm stepper and add a test -- Modest speedup of syncing by batching coin lookups -- Cmds: Use the new `plot_count` of `get_pool_state` in `plotnft show` -- Set mempool size back to the original size at launch -- Plotting|tests|setup: Improve `PlotManager` cache -- Wallet: Drop unused `WalletStateManager.get_derivation_index` -- Harvester: Tweak `get_plots` RPC -- Remove explicit multidict version from setup.py -- Simplify install.sh ubuntu version tracking -- Optimize BLS verification when public key is repeated -- Use Install.ps1 in build_windows.ps1 -- Updated warning about `CHIA_ROOT` being set when running init -- Cmds: Adjust stop daemon output -- Remove unused functions on MerkleSet -- Optimize `hash_coin_list()` -- Update CONTRIBUTING.md -- Remove outdated 3.8 upgrade comment -- Hint refactor -- Replace MerkleSet with the rust implementation -- Simplify SizedBytes and StructStream -- Allow services to set a non-default max request body size limit -- Reduce the redundant computations of coin_ids in block_body_validation -- Uses the new `from_bytes_unchecked` method in blspy, to improve perfo… -- Remove the cache from CoinStore -- Keep daemon websocket alive during keyring unlock -- Support searching derived addresses on testnet. -- Optimize code to not perform useless subgroup checks -- Restore missing hints being stored as None (instead of 0-length bytes) -- Coin simplification -- Harvester: Use a set instead of a list to speed up availability checks -- Improved performance of debug log output -- Update plotters installation to include an `apt update` - thanks to @TheLastCicada -- Early return from `_set_spent function` - Thanks @neurosis69 -- Remove redundant condition in `get_coin_records` - Thanks @neurosis69 -- Write python version error to stderr - thanks to @LuaKT - -### Fixed - -- Fixed issues with harvesters not reconnecting properly - fixes #11466 -- Return not synced if there are no connections - fixes #12090 -- Fix issues with wallet resending transactions on various mempool and node errors - fixes #10873 -- Fix some issues with `plotnft show` (#11897) -- Handle ephemeral ports and dual stack (ipv4 & ipv6) -- Fix issues when wallet syncing and rolling back too far in the past -- Fixes issues with the Farmer Reward dialog incorrectly reporting there is no private key (#11036) -- Fix race condition, blockchain can change between two calls to get_peak -- Wallet: Fix `CATLineageStore` creation in `create_new_cat_wallet` -- Fix incorrect return in "rollback_to_block" -- Wallet: Some rollback fixes -- Fix issue with missing coins -- Fix Newer block issue -- Fix jsonify bool -- Fix wallet introducers for testnet -- Correct wallet CLI sent/received indication -- Correct "Older block not found" error message -- Print MempoolInclusionStatus as string -- Optimize Program.curry() -- Improve detection of disconnected websocket between services -- Correct install.sh usage short options list -- Make sure we set the sync to height correctly when we roll back - -## 1.3.5 Chia blockchain 2022-5-11 - -### Added - -- Added Support for Python 3.10 -- Performance improvements in harvesters during plot refresh. Large farmers likely no longer need to specify a very high plot refresh interval in config.yaml -- Added CLI only `.rpm` and `.deb` packages to official release channels -- Fixed an issue where some coins would be missing after a full sync -- Enabled paginated plot loading and improved plot state reporting -- Updated the farming GUI tab to fix several bugs -- Fix infinite loop with timelord closing -- Simplified install.sh ubuntu version tracking -- Fixed memory leak on the farm page -- Fixed list of plot files "in progress" -- Various farmer rpc improvements -- Improvements to the harvester `get_plots` RPC - -### Known Issues - -There is a known issue where harvesters will not reconnect to the farmer automatically unless you restart the harvester. This bug was introduced in 1.3.4 and we plan to patch it in a coming release. - -## 1.3.4 Chia blockchain 2022-4-19 - -### Added - -- Creating an offer now allows you to edit the exchange between two tokens that will auto calculate either the sending token amount or the receiving token amount -- When making an offer, makers can now create an offer including a fee to help get the transaction into the mempool when an offer is accepted -- Implemented `chia rpc` command -- New RPC `get_coin_records_by_hint` - Get coins for a given hint (Thanks @freddiecoleman) -- Add maker fee to remaining offer RPCs -- Add healthcheck endpoint to rpc services -- Optional wallet type parameter for `get_wallets` and `wallet show` -- Add `select_coins` RPC method by (Thanks @ftruzzi) -- Added `-n`/`--new-address` option to `chia wallet get_address` -- New DBWrapper supporting concurrent readers -- Added `config.yaml` option to run the `full_node` in single-threaded mode -- Build cli only version of debs -- Add `/get_stray_cats` API for accessing unknown CATs - -### Changed - -- Left navigation bar in the GUI has been reorganized and icons have been updated -- Settings has been moved to the new left hand nav bar -- Token selection has been changed to a permanent column in the GUI instead of the drop down list along -- Manage token option has been added at the bottom of the Token column to all users to show/hide token wallets -- Users can show/hide token wallets. If you have auto-discover cats in config.yaml turned off, new tokens will still show up there, but those wallets won’t get created until the token has been toggled on for the first time -- CATs now have a link to Taildatabase.com to look up the Asset ID -- Ongoing improvements to the internal test framework for speed and reliability. -- Significant harvester protocol update: You will need to update your farmer and all your harvesters as this is a breaking change in the harvester protocol. The new protocol solves many scaling issues. In particular, the protocol supports sending delta changes to the farmer - so for example, adding plots to a farm results in only the new plots being reported. We recommend you update your farmer first. -- Updated clvm_tools to 0.4.4 -- Updated clvm_tools_rs to 0.1.7 -- Changed code to use by default the Rust implementation of clvm_tools (clvm_tools_rs) -- Consolidated socket library to aiohttp and removed websockets dependency -- During node startup, missing blocks in the DB will throw an exception -- Updated cryptography to 36.0.2 -- The rust implementation of CLVM is now called `chia_rs` instead of `clvm_rs`. -- Updated code to use improved rust interface `run_generator2` -- Code improvements to prefer connecting to a local trusted node over untrusted nodes - -### Fixed - -- Fixed issues with claiming self-pool rewards with and without a fee -- Fixed wallet creation in edge cases around chain reorgs -- Harvester: Reuse legacy refresh interval if new params aren't available -- Fixed typos `lastest` > `latest` (Thanks @daverof) -- Fixed typo in command line argument parsing for `chia db validate` -- Improved backwards compatibility for node RPC calls `get_blockchain_state` and `get_additions_and_removals` -- Fixed issue where `--root_path` option was not honored by `chia configure` CLI command -- Fixed cases where node DB was not created initially using v2 format -- Improved error messages from `chia db upgrade` -- Capitalized display of `Rpc` -> `RPC` in `chia show -s` by (Thanks @hugepants) -- Improved handling of chain reorgs with atomic rollback for the wallet -- Handled cases where one node doesn't have the coin we are looking for -- Fixed timelord installation for Debian -- Checked for requesting items when creating an offer -- Minor output formatting/enhancements for `chia wallet show` -- Fixed typo and index issues in wallet database -- Used the rust clvm version instead of python in more places -- Fixed trailing bytes shown in CAT asset ID row when using `chia wallet show` -- Maintain all chain state during reorg until the new fork has been fully validated -- Improved performance of `get_coin_records_by_names` by using proper index (Thanks @roseiliend) -- Improved handling of unknown pending balances -- Improved plot load times - -### Known Issues - -- You cannot install and run chia blockchain using the macOS packaged DMG on macOS Mojave (10.14). -- Pending transactions are not retried correctly and so can be stuck in the pending state unless manually removed and re-submitted - -## 1.3.3 Chia blockchain 2022-4-02 - -### Fixed - -- In version 1.3.2 our patch for the OpenSSL vulnerability was not complete for the Windows installer. Thank you @xsmolasses of Core-Pool. -- MacOS would not update openssl when installing via `install.sh` -- Some debugging information remained in `install.sh` - -## 1.3.2 Chia blockchain 2022-4-01 - -### Fixed - -- Fixed OpenSSL vulnerability CVE-2022-0778 - -## 1.3.1 Chia blockchain 2022-3-16 - -### Fixed - -- Improved config.yaml update concurrency to prevent some cases of the wrong pool being used for a PlotNFT. -- Fixed `chia keys show` displaying non-observer-derived wallet address. -- Fixed `plotnft claim` returning an error. -- Fixed invalid DB commit that prevented rollback of coin store changes. -- Fixed locking issue with `PlotManager.plots` that caused high lookup times on plots. -- Fixed exception when `chia keys migrate` is run without needing migration. -- Fixed farmer rewards dialog (GUI). -- Fixed display of pool payout address (GUI). -- Fixed display of harvesters status when harvesters are restarted (GUI). -- Fixed wallet RPC `get_offers_count` returning an error when there are no trades (Thanks, @dkackman!) -- Fixed spelling of "genrated" (Thanks again, @dkackman!) -- Fixed typo "log_maxbytessrotation" in initial-config (@skweee made their first contribution!) - -### Added - -- Added checks to ensure wallet address prefixes are either `xch` or `txch`. -- Added a better TLS1.3 check to handle cases where python is using a non-openssl TLS library. - -### Changed - -- Update the database queries for the `block_count_metrics` RPC endpoint to utilize indexes effectively for V2 DBs. -- Several improvements to tests. - -## 1.3.0 Chia blockchain 2022-3-07 - -### Added - -- CAT wallet support - add wallets for your favorite CATs. -- Offers - make, take, and share your offers. -- Integrated lite wallet sync - to get you synced up faster while your full node syncs. -- Wallet mode - Access just the wallet features to make and receive transactions. -- Farmer mode - All your farming tools, and full node, while getting all the benefits of the upgraded wallet features. -- New v2 DB - improved compression for smaller footprint (the v2 DB is created alongside the v1 DB. Please be sure to have enough disk space before executing the DB upgrade command). -- Key derivation tool via CLI - lets you derive wallet addresses, child keys, and also search your keys for arbitrary wallet addresses/keys. -- Lite wallet data migration - CAT wallets you set up and your offer history will be carried over. -- The farmer will report version info in User-Agent field for pool protocol (Thanks @FazendaPool). -- Added new RPC, get_version, to the daemon to return the version of Chia (Thanks @dkackman). -- Added new config.yaml setting, reserved_cores, to specify how many cores Chia will not use when launching process pools. Using 0 will allow Chia to use all cores for process pools. Set the default to 0 to allow Chia to use all cores. This can result in faster syncing and better performance overall especially on lower-end CPUs like the Raspberry Pi4. -- Added new RPC, get_logged_in_fingerprint, to the wallet to return the currently logged in fingerprint. -- Added new CLI option, chia keys derive, to allow deriving any number of keys in various ways. This is particularly useful to do an exhaustive search for a given address using chia keys derive search. -- Div soft fork block height set to 2,300,000. -- Added the ability to add an optional fee for creating and changing plot NFTs. -- Added *multiprocessing_start_method:* entry in config.yaml that allows setting the python *start method* for multiprocessing (default is *spawn* on Windows & MacOS, *fork* on Unix). -- Added option to "Cancel transaction" accepted offers that are stuck in "pending". - -### Changed - -- Lite wallet client sync updated to only require 3 peers instead of 5. -- Only CATs from the default CAT list will be automatically added, all other unknown CATs will need to be manually added (thanks to @ojura, this behavior can be toggled in config.yaml). -- New sorting pattern for offer history - Open/pending offers sorted on top ordered by creation date > confirmation block height > trade id, and then Confirmed and Cancelled offers sorted by the same order. -- When plotting multiple plots with the GUI, new items are taken from the top of the list instead of the bottom. -- CA certificate store update. -- VDF, chiapos, and blspy workflows updated to support python 3.10 wheels. -- We now store peers and peer information in a serialized format instead of sqlite. The new files are called peers.dat and wallet_peers.dat. New settings peers_file_path and wallet_peers_file_path added to config.yaml. -- CLI option chia show will display the currently selected network (mainnet or testnet). -- CLI option chia plots check will display the Pool Contract Address for Portable (PlotNFT) plots. -- Thanks to @cross for adding the ability to resolve IPv6 from hostnames in config.yaml. Added new config option prefer_ipv6 to toggle whether to resolve to IPv6 or IPv4. Default is false (IPv4). -- The default timeout when syncing the node was increased from 10 seconds to 30 seconds to avoid timing out when syncing from slower peers. -- TLS 1.2 is now the minimum required for all communication including peer-to-peer. The TLS 1.2 allowed cipher list is set to: "ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256". -- In a future release the minimum TLS version will be set to TLS 1.3. A warning in the log will be emitted if the version of openssl in use does not support TLS 1.3. If supported, all local connections will be restricted to TLS 1.3. -- The new testnet is testnet10. -- Switch to using npm ci from npm install in the GUI install scripts. -- Improved sync performance of the full node by doing BLS validation in separate processes. -- Default log rotation was changed to 50MiB from 20MiB - added config.yaml setting log_maxbytesrotation to configure this. -- Thanks to @cross for an optimization to chiapos to use rename instead of copy if the tmp2 and final files are on the same filesystem. -- Updated to use chiapos 1.0.9. -- Updated to use blspy 1.0.8. -- Implemented a limit to the number of PlotNFTs a user can create - with the limit set to 20. This is to prevent users from incorrectly creating multiple PlotNFTs. This limit can be overridden for those users who have specific use cases that require more than 20 PlotNFTs. -- Removed the option to display "All" rows per page on the transactions page of the GUI. -- Updated the background image for the MacOS installer. -- Changed the behavior of what info is displayed if the database is still syncing. - - It should not be expected that wallet info, such as payout address, should not reflect what their desired values until everything has completed syncing. - - The payout instructions may not be editable via the GUI until syncing has completed. - -### Fixed - -- Offer history limit has been fixed to show all offers now instead of limiting to just 49 offers. -- Fixed issues with using madmax CLI options -w, -G, -2, -t and -d (Issue 9163) (thanks @randomisresistance and @lasers8oclockday1). -- Fixed issues with CLI option –passhrase-file (Issue 9032) (thanks @moonlitbugs). -- Fixed issues with displaying IPv6 address in CLI with chia show -c. -- Thanks to @chuwt for fix to looping logic during node synching. -- Fixed the chia-blockchain RPM to set the permission of chrome-sandbox properly. -- Fixed issues where the wallet code would not generate enough addresses when looking for coins, which can result in missed coins due to the address not being checked. Deprecated the config setting initial_num_public_keys_new_wallet. The config setting initial_num_public_keys is now used in all cases. -- Thanks to @risner for fixes related to using colorlog. -- Fixed issues in reading the pool_list from config if set to null. -- Fixed display info in CLI chia show -c when No Info should be displayed. -- Thanks to @madMAx43v3r for fixes in chiapos related to a possible race condition when multiple threads call Verifier::ValidateProof. -- Thanks to @PastaPastaPasta for some compiler warning fixes in bls-signatures. -- Thanks to @random-zebra for fixing a bug in the bls-signature copy assignment operator. -- Thanks to @lourkeur for fixes in blspy related to pybind11 2.8+. -- Thanks to @nioos-ledger with a fix to the python implementation of bls-signatures. -- Thanks to @yan74 for help debugging a race condition writing to config.yaml during beta. -- Fixed issue where the DB could lose the peak of the chain when receiving a compressed block. -- Fixed showing inbound transaction after an offer is cancelled. -- Fixed blockchain fee "Value seems high" message showing up when it shouldn't. -- Bugs in pool farming where auth key was being set incorrectly, leading to invalid signature bugs. -- Memory leak in the full node sync store where peak hashes were stored without being pruned. -- Fixed a timelord issue which could cause a few blocks to not be infused on chain if a certain proof of space signs conflicting blocks. - -### Known Issues - -- When you are adding plots and you choose the option to “create a Plot NFT”, you will get an error message “Initial_target_state” and the plots will not get created. - - Workaround: Create the Plot NFT first in the “Pool” tab, and then add your plots and choose the created plot NFT in the drop down. -- When you close the Chia app, regardless if you are in farmer mode or wallet, the content on the exit dialog isn’t correct. -- If you start with wallet mode and then switch to farmer mode and back to wallet mode, the full node will continue to sync in the background. To get the full node to stop syncing after switching to wallet mode, you will need to close the Chia and relaunch the Chia app. -- Wallets with large number of transactions or large number of coins will take longer to sync (more than a few minutes), but should take less time than a full node sync. It could fail in some cases. -- Huge numbers cannot be put into amount/fee input for transactions in the GUI. -- Some Linux systems experience excessive memory usage with the value *default*/*python_default*/*fork* configured for *multiprocessing_start_method:*. Setting this value to *spawn* may produce better results, but in some uncommon cases, is know to cause crashes. -- Sending a TX with too low of a fee can cause an infinite spinner in the GUI when the mempool is full. - - Workaround: Restart the GUI, or clear unconfirmed TX. -- Claiming rewards when self-pooling using CLI will show an error message, but it will actually create the transaction. - -## 1.2.11 Chia blockchain 2021-11-4 - -### Added - -- Farmers rejoice: today's release integrates two plotters in broad use in the Chia community: Bladebit, created by @harold-b, and Madmax, created by @madMAx43v3r. Both of these plotters bring significant improvements in plotting time. More plotting info [here](https://github.com/Chia-Network/chia-blockchain/wiki/Alternative--Plotters). -- This release also includes several important performance improvements as a result of last weekends "Dust Storm", with two goals in mind: make sure everyone can farm at all times, and improve how many transactions per second each node can accept, especially for low-end hardware. Please know that these optimizations are only the first wave in a series of many over the next few releases to help address this going forward. While the changes we have implemented in this update may not necessarily solve for *every* possible congestion scenario, they should go a long way towards helping low-end systems perform closer to expectations if this happens again. -- Performance improvements for nodes to support higher transaction volumes, especially for low powered devices like RaspBerry Pi. Full details at [#9050](https://github.com/Chia-Network/chia-blockchain/pull/9050). - - Improved multi-core usage through process pools. - - Prioritized block validation. - - Added transaction queues for more efficient handling of incoming transactions. - - Increased BLS pairing cache. -- Integrated the Bladebit plotter to CLI and GUI. Thanks @harold-b for all your hard work on this, and welcome again to the Chia Network team! -- Added the Madmax plotter to CLI and GUI. Thanks @madMAx43v3r for your support! -- Added option to configure your node to testnet using to `chia init --testnet`. - -### Changed - -- Improved the wallet GUI's startup loading time by loading the default private key's fingerprint. -- Upgraded from clvm_rs 0.1.14 to 0.1.15. - -### Fixed - -- Minor verbiage and syntax changes in CLI and GUI. -- Partial version to fix launcher name definition. -- Fix harvester plot loading perfomance issues. -- Fixed a packaging failure when passphrase is being used. Thanks @ForkFarmer for reporting this defect. -- Fixed launcher name definition, which resolved an issue for some users in which wallet-node couldn't sync. -- Fixed a bug in the GUI that prevented some users from switching their plotNFT. - -### Known Issues - -- PlotNFT transactions via CLI (e.g. `chia plotnft join`) now accept a fee parameter, but it is not yet operable. - -## 1.2.10 Chia blockchain 2021-10-25 - -We have some great improvements in this release: We launched our migration of keys to a common encrypted keyring.yaml file, and we secure this with an optional passphrase in both GUI and CLI. We've added a passphrase hint in case you forget your passphrase. More info on our [wiki](https://github.com/Chia-Network/chia-blockchain/wiki/Passphrase-Protected-Chia-Keys-and-Key-Storage-Migration). We also launched a new Chialisp compiler in clvm_tools_rs which substantially improves compile time for Chialisp developers. We also addressed a widely reported issue in which a system failure, such as a power outage, would require some farmers to sync their full node from zero. This release also includes several other improvements and fixes. - -### Added - -- Added support for keyring migration from keychain, and the addition of passphrase support. Learn more at our [wiki](https://github.com/Chia-Network/chia-blockchain/wiki/Passphrase-Protected-Chia-Keys-and-Key-Storage-Migration). -- Enabled experimental use of a new Chialisp compiler in clvm_tools_rs in chia-blockchain, which is off by default, and substantially improves compile time. -- Added Windows PowerShell scripts to support installation from source. -- Added a test to check that we don't reorg subslots unless there is a new peak. -- Added harvester info to farmer logging. -- Add 'points found 24h' to CLI reporting. -- Added an alternative to pkm_pairs_for_conditions_dict() which is a bit more straightforward and returns the public keys and messages in the forms we need them to validate them. -- Added ability to see unopenable plots at the end of plots check. -- Added Program.at utility function. - -### Changed - -- Truncate points_[found,acknowledged]_24h to 24 hours at each signage point. -- Improved reliability of test_farmer_harvester_rpc.py, by increasing the interval between harvester checks, which should avoid spamming logs with excessive plot refreshing and cache updates. -- Thanks @cross for change that allows using IPv6 address in config.yaml for remote harvesters and other chia services. -- Change to stop creating unused indexes in block_records and full_blocks tables. -- Removed unnecessary index in CoinStore & add additional benchmarks. -- Changed db_sync setting to default to FULL. In a prior release, this setting caused some users to have to resync their full node from zero if the node went offline, such as in a power outage. Users can change this to OFF in config.yaml. -- Updated the coin_store benchmark to enable synchronous mode when talking to the DB, since that's the default now, and improves the output a bit. -- Updated the old comment on chia/util/streamable.py with newer developer documentation. -- Minor GUI changes based on community feedback. -- Thanks @jack60612 for your help in improving our GUI code, including upgrading to electron 13, migration to electron remote, updating the latest dependencies, and more. - -### Fixed - -- Corrected a super-linter name typo to GitHub -- Thanks @sharjeelaziz for correcting our typo in your name. Our apologies for the error! -- In macOS builds, changed the export value of NOTARIZE to fix some build failures. -- Fix log output for duplicated plots. -- Removed a flaky mtime check for plots that resolved an issue where file_path.stat() shows multiple copies of plots and slows performance of the farmer. Thanks @timporter for the assist on this one. -- Thanks @jcteng for fixing a bug on the Chia DID wallet that showed 'mojo:'' instead of 'mojo'. - -## 1.2.9 Chia blockchain 2021-10-01 - -### Changed - -- Changed "About" section in client to indicate correct release version. - -## 1.2.8 Chia blockchain 2021-09-30 - -### Added - -- Added RPC updates to support keyring migration and to support adding a passphrase for wallets in an upcoming release. -- Added plot memo caching in PlotManager, speeding initial loading and cached loading, by enabling harvester to save the parsed plot memo on disk on shutdown, then load it back into memory on startup so that it can skip key parsing calculations for all already known plots. -- Added a debug option to log all SQL commands. -- Added support for DID, our decentralized identity solution, as a building block toward Chia's broader set of DID capabilities. -- Thanks @olivernyc for the addition of a query in CoinStore to special case height 0 to avoid querying all unspent coins. -- Starting logging the timing of applying additions and removals to the coin store. -- Made max message size configurable in config.yaml, as a possible workaround for very large farms where reporting plot information exceeds the maximum message size. -- Added a config option for peer_connect_timeout. -- Added support for unhardened key derivations. -- Various CoinStore benchmark and performance improvements. -- Beta builds are built on every merge to main, and are now available from . -- Thanks @Radexito for adding support for Raspberry Pi 4 64Bit to the GUI installation script. -- Added macOS keyring.yaml support, migrating keys from macOS Keychain to keyring.yaml to support an upcoming release in which we'll add an optional passphrase to wallets. -- We have made many full node changes to support our upcoming Chia Asset Token (CAT) standard and our upcoming standalone light wallet, which will use Chia's new electrum-style protocol to enable faster wallet syncing. -- We have many new translations added in this release. Thanks to the following community members for their contributions: Albanian @ATSHOOTER; Arabic @younes.huawei.test; Belarusian @LUXDAD; Catalan @Poliwhirl; Chinese Traditional @MongWu-NeiTherHwoGer-Long, @danielrangel6; Chinese, Simplified @SupperDog; Croatian @vjukopila5 @marko.anti12; Czech @HansCZ; Danish @loppefaaret; Dutch @netlob;English @sharjeelaziz @darkflare; English, Australia @nzjake; English, New Zealand @nzjake @sharjeelaziz; Finnish @f00b4r; French @burnt; Hungarian @SirGeoff; Hebrew @Arielzikri; Indonesian @lespau;Lithuanian @Mariusxz; Polish @bartlomiej.tokarzewski; Portuguese @darkflare; Portuguese, Brazilian @fsavaget; Sinhala @HelaBasa;Slovak @atomsymbol; Spanish @needNRG; Spanish, Argentina @juands1644 @gdestribats; Spanish, Mexico @danielrangel6; Swedish @MrDyngrak; Thai @3bb.pintakam.7m1 @taweesak0803650558 @taweesak.25may1993 @3bb.pintakam.7m1; Turkish @baturman @ExtremeSTRAUSSER. - -### Changed - -- Bluebox proofs are now randomized instead of looking at the oldest part of the blockchain first to find uncompacted proofs. -- Bumped sortedcontainers to version 2.4.0. -- Dropped some redundant code in plotting/manager.py -- Updated some hooks: Update `flake8` to 3.9.2, `pre-commit-hooks` to 4.0.1, `black` to 21.8b0 -- Bump clvm_rs to 0.1.14. -- Added tests for invalid list terminators in conditions. -- Updated blspy to 1.0.6. -- Made a change to allow the host to be configurable for the timelord launcher. -- Thanks @dkackman for adding the ability to collect the IDs of plots as they are queued and return them with the response. -- Made the SpendBundle.debug use the default genesis challenge by default. -- Changes in full node to execute sqlite pragmas only once, at the level where the database is opened, and changed pragma synchronous=FULL to OFF to improve disk I/O performance. Also removed redundant database pragmas in wallet. -- Made a change to remove CoinStore's dependency on FullBlock to just pass in the parts of the block necessary to add the block. -- Improved log formatting. -- A change to logging to only log warnings when more than 10 seconds has passed, to reduce the number of warning logs. -- Improved and fixed some outdated messages in CLI. Thanks @jack60612 for the assist! -- We previously added a Rust condition checker, to replace our existing Python-based condition checker. In this release, we're removing the old Python code. -- Several clvm_rs updates to support our upcoming Chia Asset Token (CAT) standard. - -### Fixed - -- Thanks @mgraczyk for the fix to keyring_path. -- Fixed an issue blocking the Ubuntu installer that required manual installation of Python 3.9 as a workaround. -- Fixed an issue where the config.yaml and keyring.yaml are only partially written out to, if another process is attempting to read the config while it's being written. -- Fixed rmtree call in create_pool_plot. -- Thanks @Knight1 for fixing an issue in which fix-ssl-permissions shows the current 'mode' not the 'updated mode'. -- Fixed Mypy issues on Python 3.9.7 that generated many errors when running mypy. -- Thanks @olivernyc for fixing an edge case with negative inputs to 'truncate_to_significant_bits'. -- Added a fix for Windows installs that were seeing exceptions when writing to the keyring. - -## 1.2.7 Chia blockchain 2021-09-16 - -### Fixed - -- Thanks to @jack60612 for fixing a bug that displayed 25 words instead of 24 words in some instances in the GUI. - -## 1.2.6 Chia blockchain 2021-09-09 - -Today we’re releasing version 1.2.6 to address a resource bug with nodes, and we want to stress the importance of updating to it at the earliest convenience. The fix prevents a node from consuming excessive memory when many Bluebox Timelords are active on the chain. - -### Changed - -- Updated to BLS 1.0.6. -- Updates to the Rust conditions parser. -- Adjusted plot refresh parameter to improve plot loading times. - -### Fixed - -- Fixed memory utilization issue related to how the node handles compact VDFs generated from blueboxes. We recommend everyone update to this version to avoid memory issues that can impact farming and harvesting. -- Fixed issues with reloading plot files detected as bad (this can happen during plot copying). - -## 1.2.5 Chia blockchain 2021-08-27 - -### Fixed - -- Fixed errors in the Linux GUI install script, which impacted only Linux users. - -## 1.2.4 Chia blockchain 2021-08-26 - -### Added - -- Enable the rust condition checker unconditionally in testnet. -- Added support for multiple wallets. -- Added a change to config.yaml to tolerate fields that replace network constants in config.yaml that don't exist, but print warning. -- Improvements to sync full nodes faster by improving the concurrency for downloading and validating blocks. -- Added new call for logging peer_host: get_peer_logging that will use the peer_host value, typically an IP address, when the peername cannot be retrieved. -- Added documentation for treehash params. -- Added a py.typed file that allows other projects that pip install chia-blockchain to type check using our functions with mypy. -- Added an RPC for coin records by multiple coin names. -- Enabled querying AAAA records for DNS Introducer. -- We now set the version for the GUI when doing a manual install using the install-gui.sh script. Uses a python helper to get the version of the chia install and then converts it into proper npm format and puts that into package.json. -- Added some new class methods to the Program objects to improve ease of use. -- Added an option to sign bytes as well as UTF-8 strings, which is particularly helpful if you're writing Chialisp puzzles that require signatures and you want to test them without necessarily writing a whole python script for signing the relevant data. -- Added a first version of .pre-commit-config.yaml and applied the changes required by the following initial hooks in separate commits. To use this you need to install pre-commit, see . -- We have added many new translations in this release based on community -submissions. Thanks to @RuiZhe for Chinese, Traditional; @HansCZ for Czech; -@LUXDAD for English, Australia; @f00b4r for Finnish; @jimkoen, @ruvado for German; @Arielzikri for Hebrew; @A-Caccese for Italian; @Hodokami for Japanese; @LUXDAD for Latvian; @vaexperience for Lithuanian; @LUXDAD for Russian; @juands1644 for Spanish, Argentina; @MrDyngrak, @ordtrogen for Swedish; @richeyphu for Thai; @Ansugo, @baturman for Turkish. - -### Changed - -- Thanks @altendky for Correct * to ** kwargs unpacking in time_out_assert(). -- Thanks @altendky for changing the default to paginate to chia wallet get_transactions to address cases such as piping and output redirection to a file where the command previously just hung while waiting for the user to press c for the next page. -- Removed commented-out debug breakpoints. -- Enabled Rust condition checker to add the ability to parse the output conditions from a generator program in Rust. It also validates some of the conditions in Rust. -- Switched IP address lookup to first use Chia's service ip.chia.net. -- Made changes so that when creating SSL certificate and private key files, we ensure that files are written with the proper file permissions. -- Define a new encrypted keyring format to be used to store keys, and which is optionally encrypted to a user-supplied passphrase. GUI for the passphrase will come in an upcoming release. -- Removed initial transaction freeze put in place at mainnet launch as it is no longer necessary. -- Separate locking and non-locking cases for get_confirmed_balance_for_wallet, which will allow calling a few wallet_state_manager methods while already under the wallet_state_manager lock, for example during DID wallet creation. -- Thanks to @Playwo for removing the index on coin_record spent column to speed up querying. -- Made a change to the conditions parser to either ignore or fail when it encounters unknown conditions. It also removes the UNKNOWN enum value from ConditionOpcodes. -- Renamed folder tests/core/types to tests/core/custom_types to address conflicts in debugger in PyCharm. -- Disabled DID wallet tests while DID wallet is under construction. -- Added pairing cache for faster aggregate signature verification. -- Added block height assertions after block farming. -- Added assertions for tx confirmation. - -### Fixed - -- Fix single coin generator. -- Fixed an issue with duplicate plotnft names. -- Fixed an issue during node shutdown in which some AttributeErrors could be thrown if the shutdown happens before the node fully started up. -- Fixed mempool TX cache cost, where the cost of the mempool TX cache (for spend bundles that can't be included in a block yet) would not be reset when the cache was emptied. -- Fixed a failure to create a keychain_proxy for local keychains. -- Thanks to @mgraczyk for fixing type annotation in sync_store. -- Thanks to @darkverbito for fixing an issue on initial creation of a coloured coin where code always falls into default else clause due to lack of type conversion. -- Fixed NPM publish in clvm_rs. -- Thanks to @skweee for his investigation work on fixing mempool TX cache cost, where the cost of the mempool TX cache (for spend bundles that can't be included in a block yet) would not be reset when the cache was emptied. - -## 1.2.3 Chia blockchain 2021-07-26 - -### Added - -- Added ability to change payout instructions in the GUI. -- Added an option to revert to sequential read. There are some systems (primarily macos+exfat) where the parallel read features results in very long lookup times. This addition makes the parallel feature the default, but adds the ability to disable it and revert back to sequential reads. -- Added backwards compatibility for Coin Solutions in push_tx since renaming it to CoinSpend. -- Added an option to set the default constants on the simulator. -- Added a warning to user to not send money to the pool contract address. -- Added capability to enable use of a backup key in future, to claim funds that were sent to p2_singleton_puzzle_hash, which today are just ignored. -- Thanks @aarcro for adding timing metrics to plot check. -- Thanks @chadwick2143 for adding the ability to set the port to use for the harvester. -- Added more friendly error reporting for peername errors. -- We have added many new translations in this release. Thanks to @L3Sota, @hodokami and @L3Sota for Japanese; @danielrangel6, @memph1x and @dvd101x for Spanish (Mexico); @fsavaget, @semnosao and @ygalvao for Portuguese (Brazilian); @juands1644 for Spanish (Argentina); @darkflare for Portuguese; @wong8888, @RuiZhe, @LM_MA, @ezio20121225, @GRIP123, @11221206 and @nicko1122 for Chinese Traditional; @atomsymbol for Slovak; @SirGeoff and @rolandfarkasCOM for Hungarian; @ordtrogen for Swedish; @HansCZ and @kafkic for Czech; @SupperDog for Chinese Simplified; @baturman and @Ansugo for Turkish; @thebacktrack for Russian; @itservicelukaswinter for German; @saeed508, @Amirr_ezA and @themehran for Persian; @hgthtung for Vietnamese; @f00b4r for Finnish; @IMIMIM for Latvian; @Rothnita and @vanntha85 for Khmer; @Rothnita and @Gammaubl for Thai; @marcin1990 for Polish; @mydienst for Bosnian; @dvd101x and @darkflare for Spanish; @ATSHOOTER for Albanian; @Munyuk81 for Indonesian; @loppefaaret for Danish; @sharjeelaziz and @nzjake for English; @nzjake for English (New Zealand). We apologize if we missed anyone and welcome corrections. - -### Changed - -- Updated blspy to 1.0.5. -- Updated chiapos to 1.0.4. -- Included all Chialisp files in source distribution. -- Removed left-over debug logging from test_wallet_pool_store. -- Made changes to allow us to use the name coin_spend everywhere in our code, without changing it in the API requests, both outgoing and incoming. Enables us to decide at a later date when to cut over completely to the coin_spend name. -- Thanks @mishan for your change to 'chia plotnft show' to display Percent Successful Points. -- Thanks @Playwo for your change to make pool payout instructions case insensitive. -- GUI sees update when plots or harvesters change. -- Increased the cache interval to help large farmers. -- Removed proof limit for mainnet, but not testnet. This helps with pools that have very low difficulties. Thanks to @AlexSSD7 for pointing out the issue. -- We now also allow hex strings prefixed with 0x which is required because we currently prefix the strings in JSON conversion. -- Thanks to @opayen for your help in updating our MacOS icon. - -### Fixed - -- Thanks to @dfaranha for helping fix a parsing error in Relic inputs for BLS signatures. -- Fixed error type in wallet_blockchain.py. -- Thanks to @seraphik for a fix on our Linux installer that required root privileges. -- Thanks @felixbrucker for helping fix invalid content-type header issues in pool API requests. -- The wallet ignores coins sent by accident to the pool contract address and allows self pooling rewards to be claimed in this case. -- Thanks @mgraczyk for fixing the use of print_exc in farmer. - -## 1.2.2 Chia blockchain 2021-07-13 - -### Fixed - -- Converted test_rom.py to use pytest and fixed test_singleton. -- Thanks to @yshklarov for help fixing [#7273](https://github.com/Chia-Network/chia-blockchain/issues/7273), which bundled CA store to support pools for some farming systems, including M1 Apple computers. This enables those machines to properly connect to pools, and fixes the issue. - -## 1.2.1 Chia blockchain 2021-07-12 - -### Added - -- Thanks @feldsam for adding support for Fedora in install-gui script - -### Fixed - -- Fix harvester cache updates. Prior to this commit the farmer called the `request_plots` every second for each harvester as long as they failed to respond properly. Since the rate limit was 10/minute this lead to hitting the rate limit if the harvester didn't responds for 10 tries in a row for whatever reason. This commit changes the behavior to always keep track of request attempts even if they end up in a timeout to really only re-try every 60s no matter what. -- Fix M1 installed torrent and installer version number -- Thanks to @x-Rune for helping find and test a lot of 1.2.0 bugs with the harvester. -- Fixed issue for Debian users where the wallet crashes on start for them since last release - -## 1.2.0 Chia blockchain 2021-07-07 - -### Added - -- Portable pooled plots are now available using our new plot NFT. These allow you to plot new plots to an NFT that can either self farm or join and leave pools. During development there were changes to the plot NFT so portable pool plots (those made with `-c` option to `chia plots create`) using code from before June 25th are invalid on mainnet. -OG plots made before this release can continue to be farmed side by side with the new portable pool plots but can not join pools using the official pooling protocol. You can learn more as a farmer by checking out the [pool user guide](https://github.com/Chia-Network/chia-blockchain/wiki/Pooling-User-Guide). Pool operators and those wanting to understand how the official pooling protocol operates should check out our [pooling implementation reference repository](https://github.com/Chia-Network/pool-reference). If you plan to use plot NFT, all your farmers and harvesters must be on 1.2.0 to function properly for portable pool plots. -- The exact commit after which Plot NFTs should be valid is the 89f7a4b3d6329493cd2b4bc5f346a819c99d3e7b commit (in which `pools.testnet9` branch was merged to main) or 5d62b3d1481c1e225d8354a012727ab263342c0a within the `pools.testnet9` branch. -- `chia farm summary` and the GUI now use a new RPC endpoint to properly show plots for local and remote harvesters. This should address issues #6563, #5881, #3875, #1461. -- `chia configure` now supports command line updates to peer count and target peer count. -- Thank you @gldecurtins for adding logging support for remote syslog. -- Thanks to @maran and @Animazing for adding farmer and pool public key display to the RPC. -- We have added translations for Hungarian, Belarusian, Catalan, and Albanian. For Hungarian thanks to @SirGeoff, @azazio @onokaxxx, @rolandfarkasCOM, @HUNDavid , @horvathpalzsolt, @stishun74, @tusdavgaming, @idotitusz, @rasocsabi, @mail.kope, @gsprblnt, @mbudahazi, @csiberius, @tomatos83, @zok42, @ocel0t, @rwtoptomi, @djxpitke, @ftamas85, @zotya0330, @fnni, @kapabeates, @zamery, @viktor.gonczi, @pal.suta, @miv, and @Joeman_. For Belarusian thanks to @shurix83, @haxycgm, and @metalomaniax. For Catalan thank you to @Poliwhirl, @Pep-33, @marqmarti, @meuca, @Guiwdin, @carlescampi, @jairobtx, @Neoares, @darknsis, @augustfarrerasgimeno, and @fornons. Finally for Albanian thanks to @ATSHOOTER and @lakedeejay. We apologize if we missed anyone and welcome corrections. -- Our release process is now fully automated from tagging a release to publishing installers to all of the appropriate locations and now makes the release artifacts available via torrents as well. -- All Chia repositories now automatically build M1 wheels and create a new MacOS M1 native installer. -- New CLI command `chia plotnft` to manage pools. -- We have added a new RPC `get_harvesters` to the farmer. This returns information about remote harvesters and plots. -- We have added a new RPC `check_delete_key` to the wallet, to check keys prior to deleting them. -- We have added a new RPC `delete_unconfirmed_transactions` to the wallet which deletes these transactions for a given wallet ID. -- We have added a new RPC `get_puzzle_and_solution` to the full node, which takes in a coin ID. -- We have added a new RPC `get_recent_signage_point_or_eos` to the full node, to support pooling. -- We have added a new RPC `send_transaction_multi` to the wallet, which sends a payment with multiple payees. - -### Changed - -- We have made a host of changes to the GUI to support pooling and to improve the wallet experience. -- We updated chiapos to version 1.0.3. This adds parallel reads to GetFullProof. Thanks to @marcoabreu ! We now print target/final directory early in the logs refs and log process ID. Thanks to @grayfallstown ! We are now using Gulrak 1.5.6. -@683280 optimized code in phase1.hpp. @jespino and @mrhacky started migrating to flags instead of booleans parameters for `show_progress` and `nobitfield`. If you are providing third-party tools you may need to make adjustments if relying on the chiapos log. -- Updated chiavdf to version 1.0.2 to fix certain tests. -- Windows builds now rely upon Python 3.9 which obviates the fix in 1.1.7. -- We are now using miniupnpc version 2.2.2 so that we can support Python 3.9 on Windows. -- We updated to clvm 0.9.6 and clvm_rs 0.1.8. CLVMObject now lazily converts python types to CLVM types as elements are inspected in clvm. cvlm_rs now returns python objects rather than a serialized object. -- We now have rudimentary checks to makes sure that fees are less than the amount being spent. -- The harvester API no longer relies upon time:time with thanks to @x1957. -- We have increased the strictness of validating Chialisp in the mempool and clvm. -- Thanks to @ruslanskorb for improvements to the human-readable forms in the CLI. -- Thanks to @etr2460 for improvements to the plotting progress bar in the GUI and enhancements to human-readable sizes. -- @dkackman changed the way that configuration was found on startup. -- We now delay peer start for wallet until after backup init and make sure only one copy is started. -- Wallets now trust the local node more for enhanced wallet sync speed. -- We now store tasks used to initiate peer connections to ensure they are kept alive and to be able to wait for them if we hit the upper limit on number of pending outgoing connections. -- We improved weight proof validation. -- @cvet changed the wallet to take `override` instead of `confirm`. - -### Fixed - -- The delete plots button in the Windows GUI has been fixed and re-enabled. -- Sometimes upon startup, the GUI takes a while to load the plots to display. We've made a temporary improvement that adds a "Refresh Plots" button whenever the GUI has not yet found plots. -- Correctly display private key in `chia keys show`. -- Thanks to @gldecurtins for removing a default printout of the private key mnemonic in `chia keys show`. -- Shutting down the full node is cleaner and manages uPnP better. -- DNS introducer could fail. -- Fixed a potential timelord bug that could lead to a chain stall. -- Add an explicit error message when mnemonic words are not in the dictionary; should help users self-service issues like #3425 faster. Thank you to @elliotback for this PR. -- Thank you to @Nikolaj-K for various typo corrections around the Mozilla CA, code simplifications and improvements in converting to human-readable size estimations, and clean up in the RPCs and logging. -- Thank you to @ChiaMineJP for various improvements. -- @asdf2014 removed some useless code in the wallet node API. -- Thanks to @willi123yao for a fix to under development pool wallets. -- `chia farm summary` better handles wallet errors. -- @Hoinor fixed formatting issues around the Chinese translation in the GUI. -- Sometimes the GUI would stop refreshing certain fields. -- We have better error handling for misbehaving peers from naive forks/clones. -- We have fixed an error where the wallet could get corrupted, which previously required restarting the application. -- We have fixed an error where transactions were not being resubmitted from the wallet. - -### Known Issues - -- If you resync your wallet, transactions made with your plot NFTs will show incorrectly in the GUI. The internal accounting, and total balance displayed is correct. - -### 1.1.7 Chia Blockchain 2021-06-05 - -### Fixed - -Batch process weight proof epochs in groups of 900 to fit below May 2020 sqlite limit (999 for Python 3.7 on Windows). Fixes sqlite3.OperationalError: too many SQL variables error and resulting issues with syncing wallets on Windows. - -## 1.1.6 Chia Blockchain 2021-05-20 - -### Added - -- This is the initial release of our DNS introducer. We built a far too simple basic introducer that we hoped to replace as quickly as possible with an introducer that uses DNS in the style of Bitcoin. This release will now use both and as we gain testing with the DNS version, we will slowly be phasing the classic introducers out. This should significantly help in finding nodes to connect and sync to. -- You can now whitelist networks and hosts so that a node can always connect with chosen peers. -- We added a simple profiler to track performance times in the application (see /chia/util/profiler.py for instructions). -- We added a transaction filter to get_header_blocks_in_range. -- There is now an unspent coin count and pending coin removal count to wallet_rpc_api. -- Added configuration options for moving an install to testnet and back (use `chia configure -t true|false`). -- Added Arabic language support. Thank you to the following community members for their translation contributions: @MohamedSiddig, @bilalghalib, @HoussenAlSamer, @esmailelbob, @MCoreiX, @bestq8, @bt.layth, @sam_774, @yahyakhalid, @itsmekarim44, @anasjawabreh1996, @algeria98, @abduallh, @rabee.khalil, @ajoolee. -- Added Bulgarian language support. Thank you to the following community members for their translation contributions: @shaosoft, @sitio72, @yonchevsv, @sleit2000, @TerminalX, @WoWGeleto, @DrEnderTV, @l2rx, @iliakurdalanov, @liveroy. -- Added Croatian language support. Thank you to the following community members for their translation contributions: @hrvoje555, @ATfarm, @m.filipovski2505, @goranpravda035, @Fistrake, @marko.anti12. -- Added Persian language support. Thank you to the following community members for their translation contributions: @ali.tavanaie, @soheils13, @zanaei, @parham_saeedi, @HYNazism, @IGSkyGuy, @mmbtmp, @esfandani, @amirhh00, @Alirezabayatorg, @dotMahdi, @amirisatisss, @Navidnkh, @tgmgfe, @babooshios, @mahbodius, @amiragheli, @pouyanagazadeh97, @yaghout.ad, @faramarz1985, @inert1a, @want3d, @avion.raid, @hadiamirnejad, @iziran, @hamidreza13771393, @ebrahimfalamarzi, @navidnr, @behzadmosaffa. -- Added Serbian language support. Thank you to the following community members for their translation contributions: @mihailokg, @Cheli0S, @stevica.canadi, @ukica92, @stefanmih, @acko83. -- Added Spanish (Argentina) language support. Thank you to the following community members for their translation contributions: @franpepper94, @gdestribats, @omar17, @tomigambi, @doldraug. -- Added Spanish (Mexico) language support. Thank you to the following community members for their translation contributions: @javieriv, @dvd101x, @cdgraff, @danielrangel6. -- Thanks to @proea for adding RockyLinux support for install-gui.sh. -- And thank you to @etr2460 for various GUI contributions. - -### Changed - -- Performance improvement of speeding up outbound connections. -- Performance improvements to block_store. -- Optimized Streamable parsing by avoiding extra post-init checks, making parsing block records from database up to 40% faster. -- Made the serialization of Coin follow the normal protocol of implementing stream(). -- Minor improvements to add_spendbundle and weight proofs. -- We now use version 1.0.2 of chiapos. We now reopen files on read or write failure with thanks to @mreid-moz! We also prevent chiapos prover crashing for more bad plots. -- Disabled deletion of running plot for Windows users as the crash/lockup bug has returned. -- We more clearly prohibit root from installing/running the GUI. -- Thanks to @sargonas for improvements to the template for creating Issues. -- Thanks to @aisk for continuing to add more types. -- Thanks for @dkackman for improving the remote harvester setup by having init -c only copy the right certs. -- And thank you to @vidschofelix, @meawoppl, and @rongou for various other changes and improvements. - -### Fixed - -- Fixed a bug where multiple wallets running at the same time would all issue a transaction. -- Fixed issues with signage points: duplicate signage point spikes, and bugs in signage point cache. -- Fixed a blank screen error during Centos install. -- Thanks to @linnik for fixing a TypeError exception in case of unresponsive service. -- Thanks to @msg7086 for fixing install.sh for Debian. -- And thank you to @alfonsoperez, @asdf2014, @fredericosilva, @lamba09, @Nikolaj-K, @sargonas, @aisk, @Ich5003, and @trumankain for various other fixes and improvements. - -## 1.1.5 Chia Blockchain 2021-05-09 - -### Fixed - -- We were not checking for negative values in the uint64 constructor. Therefore coins with negative values were added to the mempool. These blocks passed validation, but they did not get added into the blockchain due to negative values not serializing in uint64. Farmers making these blocks would make blocks that did not make it into or advance the chain, so the blockchain slowed down starting at block 255518 around 6:35AM PDT 5/9/2021. The fix adds a check in the mempool and block validation, and does not disconnect peers who send these invalid blocks (any peer 1.1.4 or older), making this update not mandatory but is recommended. Users not updating might see their blocks get rejected from other peers. Upgraded nodes will show an error when they encounter an old node trying to send an invalid block. This "Consensus error 124..." can be safely ignored. - -## 1.1.4 Chia Blockchain 2021-05-04 - -### Changed - -- Secret wallet key is hidden by default in `chia keys show`. Use `chia keys show --show-mnemonic-seed` for private keys. -- Performance improvement while parsing variable length field in transaction blocks. - -### Fixed - -- Spends are now sorted in the mempool by fee/cost. -- Resolved pending transaction issue during reorgs. -- Fixed bug in message send retry logic. -- Two issues with processing Weight Proofs during syncing while farming. -- Fixed a bug in the outgoing rate control logic that could prevent messages being sent. - -## 1.1.3 Chia Blockchain 2021-05-01 - -### Added - -- Significant speed improvements have been added to the Node during P2P operations. This is mostly a performance improvement to make sure there is plenty of overhead in Node for transaction processing. Smaller machines like the Pi 4 are strongly advised to update to this release before Monday 5/3/21 at 10AM PDT when transactions start. -- Significant syncing speed improvements have been added. However, there is a lot of low hanging fruit to continue to increase overall chain sync speed in subsequent releases. - -### Changed - -- We now require node 12.x to build the GUI. Installers have been building using node 12.x for quite some time. -- Node will now farm while syncing. -- We changed chialisp singletons to take a puzzlehash as its origin. We also updated the DID wallet to use this. -- Transactions are now cached for 10 minutes in mempool to retry if there is a failure of a spending attempt. -- Thank you to @Chida82 who made the log rotation count fully configurable. Apologies to him for not initially being included here. -- Thank you to @fiveangle for making install.sh more resilient across python installations. -- Standard transactions now all have announcements. -- VDF verification during sync and normal operations are now cached to enhance node performance. -- Target peer count has been increased from 60 to 80 to increase the number of peer Nodes available to connect to. Outbound connections were lowered from 10 to 8. -- The streamables class has had significant performance improvements. -- If a proof of space lookup takes longer than 5 seconds we will now log an error at WARNING level. -- Allow configuration of the plot loading interval (default is 2 minutes) in config.yaml. -- CLI wallet UI was improved and shows syncing status of wallet. -- @martomi added logging of added coins back. -- Thank you to @aisk for additional type checking. -- @aisk added error checking in bech32m -- Chialisp programs now remained serialized in Node for better performance. -- Mempool is now set to be 50 times the single block size. -- Mitigate 1-3 mojo dust attacks. -- CLI now switches to EiB for netspace display as appropriate. - -### Fixed - -- We fixed excess memory use when displaying plot logs in GUI. This was causing the GUI application to fail in many "fun" ways after plotting a lot of plots in parallel. -- Fixed plot update issues in the GUI. -- Long syncing will now correctly show "Syncing" around the application. -- Nonce collisions in request IDs is fixed. -- Some duplicate plots were not being caught and logged by harvester on loading. -- We have removed many places where Node was making duplicate requests of other nodes. -- Daemon now waits for services to end to attempt to avoid zombie processes. -- Node is less likely to lose sync due to state inconsistency. -- A large thank you to @sargonas for diagnosing why so many technical support questions were flooding GitHub issues, PRing a fix, and mass migrating issues to Discussions. -- Thanks to @jeolcho for fixing a bug in full_node_rpc_api.py. -- Thanks @antoniobg for a typo fix in keychain.py. -- Thanks to @altendky for catching a Copyright date error. - -## 1.1.2 Chia Blockchain 2021-04-24 - -### Changed - -- Weight proof time outs have been increased from 3 minutes to 6 minutes. - -### Fixed - -- When attempting to sync, connections could accidentally disconnect for rate limiting reasons. This was causing many to not be able to sync. -- Some temp files were not being closed during GUI plotting. - -## 1.1.1 Chia Blockchain 2021-04-21 - -### Added - -- This is a bug fix release for 1.1.0. It is not required to upgrade from 1.1.0 if you are not experiencing the specific issue that it addresses. You are required to upgrade from any 1.0.x version before Monday evening PDT to continue farming. - -### Changed - -- Logging now includes year, month, and date. Thanks and apologies for not tipping the hat sooner to @alfonsoperez for the PR. - -### Fixed - -- Changes were made in 1.1.0 to make sure that even out of order signage points were found and responded to by as many farmers as possible. That change lead to a situation where the harvester could thrash on the same cached signage point. - -## 1.1.0 Chia Blockchain 2021-04-21 - -### Added - -- This fork release includes full transaction support for the Chia Blockchain. Transactions are still disabled until 5/3/2021 at 10:00AM PDT. It is hard to overstate how much work and clean up went into this release. -- This is the 1.0 release of Chialisp. Much has been massaged and finalized. We will be putting a focus on updating and expanding the documentation on [chialisp.com](https://chialisp.com) shortly. -- Farmers now compress blocks using code snippets from previous blocks. This saves storage space and allows larger smart coins to have a library of sorts on chain. -- We now support offline signing of coins. -- You can now ask for an offset wallet receive address in the cli. Thanks @jespino. -- When adding plots we attempt to detect a duplicate and not load it. - -### Changed - -- We have changed how transactions will unlock from a blockheight to a timestamp. As noted above that timestamp is 5/3/2021 at 10AM PDT. -- We have temporarily disabled the "Delete Plots" button in the Windows GUI as we are still working on debugging upstream issues that are causing it. -- There are various optimizations in node and wallet to increase sync speed and lower work to stay in sync. We expect to add additional significant performance improvements in the next release also. -- Transactions now add the agg_sig_me of the genesis block for chain compatibility reasons. -- Wallet is far less chatty to unload the classic introducers. DNS introducers will be coming shortly to replace the classic introducers that are still deployed. -- Netspace is now calculated across the previous 4068 blocks (generally the past 24 hours) in the GUI and cli. - -### Fixed - -- Performance of streamable has been increased, which should help the full node use less CPU - especially when syncing. -- Timelords are now successfully infusing almost 100% of blocks. -- Harvester should be a bit more tolerant of some bad plots. - -## 1.0.5 Chia Blockchain 2021-04-14 - -### Added - -- This is a maintenance release for 1.0.4 to fix a few mostly cosmetic issues. Please refer to the 1.0.4 notes for the substantive plotting changes - for example - in that release. - -### Changed - -- The GUI now calls it an Estimated Time to Win and has enhanced explanations in the tool tip that the estimated time is often not be the actual time. We have some additional improvements we plan to make here in future releases. -- Development installers now handle semver development versions correctly. - -### Fixed - -- Temp space sizes needed for k = 33 and higher were accidentally under-reported. The values we have placed into the GUI may be conservative in being too large and appreciate feedback from the community on the new optimal temp space needed and RAM choices. -- The GUI plotting progress bar was reaching 100% too early. Thanks to @davidbb for the PR. -- Help -> About was blank. -- Our estimate for k=32 was about 0.4GiB too low in some cases. -- Building the GUI in especially ARM64 Linux was painful enough to be considered broken. - -## 1.0.4 Chia Blockchain 2021-04-12 - -### Added - -- Starting approximately April 21, 2021, the GUI will notify you that this version will stop working at block height 193,536 and will persistently warn you from that block on that you can not use this version (or any earlier version) to farm. This is to support the upgrade to the transaction fork. -- We now have translations for Brazilian Portuguese, Australian English, and Pirate. Thanks to @fsavaget, @darkflare, @maahhh, @harold_257, @kontin, and @GunnlaugurCalvi. Yarr - don't be losing your 24 word treasure map... - -### Changed - -- The plotter in bitfield mode is much improved in plotting speed (~15% faster than in 1.0.3), now requires 28% less temporary space (238.3 GiB/256 GB), and now uses its maximum memory in phase 1 and only needs 3389MiB for optimal sorting of a k32. Total writes should also be down by about 20%. On almost all machines we expect bitfield to be as fast or faster. For CPUs that predate the [Nehalem architecture](https://en.wikipedia.org/wiki/Nehalem_(microarchitecture)), bitfield plotting will not work and you will need to use no bitfield. Those CPUs were generally designed before 2010. -- The `src` directory in chia-blockchain has been changed to `chia` to avoid namespace collisions. -- GUI install builds have been simplified to rely on one `.spec` file in `chia/` -- The weight proof timeout can now be configured in config.yaml. -- Peer discovery is now retried more often after you receive initial peers. - -### Fixed - -- We have made significant improvements and bug fixes to stop blockchain and wallet database corruption issues. -- We now pass the environment into the Daemon and this should solve some Windows and MacOS startup bugs. -- The ARM64 .deb installer will now work well on Raspberry Pi OS 64 bit and Ubuntu 18.04 LTS or newer. -- We have made improvements in weight proof generation and saving. -- Wallet start up would have a race condition that output a harmless error on startup. -- Thanks for a typo fix from @alfonsoperez. - -## 1.0.3 Chia Blockchain 2021-03-30 - -### Added - -- This is a minor bug fix release for version 1.0.2 -- You should review the [release notes for v1.0.2](https://github.com/Chia-Network/chia-blockchain/releases/tag/1.0.2) but we especially want to point out that wallet sync is much faster than in 1.0.1 and earlier versions. - -### Fixed - -- An incorrect merge brought in unreleased features and broke `chia keys`. -- Omitted from the 1.0.2 changelog, we fixed one crash in harvester with the release of chiapos 1.0.0 as well. - -## 1.0.2 Chia Blockchain 2021-03-30 - -### Added - -- We have released version 1.0.0 of [chiapos](https://github.com/Chia-Network/chiapos). This includes a 20% speed increase for bitfield plotting compared to the previous version on the same machine. In many cases this will mean that bitfield plotting is as fast or faster than non bitfield plotting. -- @xorinox improved our support for RedHat related distributions in `install.sh`. -- @ayaseen improved our support for RedHat related distributions in `install-timelord.sh`. -- We have added Dutch and Polish to supported translations. Thanks @psydafke, @WesleyVH, @pieterhauwaerts, @bartlomiej.tokarzewski, @abstruso, @feel.the.code, and @Axadiw for contributions to [translations on Crowdin](https://crowdin.com/project/chia-blockchain). -- The GUI now supports "Exclude final directory" when plotting. This is found in the Advanced Options for step 2 on the plot creation page. - -### Changed - -- Wallet now uses a trusted node and, when syncing from that node, Wallet does not do as many validations. -- @jespino changed `chia keys show` to require the `--show-mnemonic-seed` before it displays your 24 work private key mnemonic. -- We decreased the size of the block cache in node to perform better with longer chains. -- You can now add a private key mnemonic from a file with `chia keys show`. -- @Flofie caught an error in CONTRIBUTING.md. -- We no longer rely on aiter so it has been removed. -- Keyring deprecated the use of OS_X in favor of MacOS. -- "Broken pipe" error was decreased to a warning. -- Many non critical log messages were decreased from warning to info log level. -- Harvester should now log the plot file name if it finds a bad plot at error log level. - -### Fixed - -- Peer ips were being written to the database on a per ip basis. This caused a lot of wasted disk activity and was costing full node performance. -- We fixed an issue where the last block wasn't fetched by the GUI. -- There was an edge case with full node store that can stall syncing. -- There was a potential node locking issue that could have prevented a Timelord from getting a new peak and cause a chain stall. -- We did not correctly support some Crowdin locales. Pirate English was starting to overwrite US English for example. - -## 1.0.1 Chia Blockchain 2021-03-23 - -### Added - -- There is now a simple progress bar on the GUI Plot page and when you view the log from the three dots on the right. -- Users must now explicitly set the `--show-mnemonic-seed` flag to see their private keys when running `chia keys show`. -- We are now building Linux GUI installers. These should be considered beta quality for now. -- Translations now available for German, Traditional Chinese, and Danish. Thanks to @Dravenex, @MaestroOnICe, @loudsyncro, @loppefaaret, @thirteenthd, @wong8888, @N418, and @swjz for all the translation help. You to can translate at our [Crowdin project](https://crowdin.com/project/chia-blockchain/). - -### Changed - -- The mainnet genesis is now in the initial config.yaml and the green flag components have been removed. -- Our release process and branching strategy has changed. CONTRIBUTING.md will be updated in the main branch soon with details. -- This mainnet release does not migrate previous testnet configuration files. - -### Fixed - -- Weight proofs, especially wallet weight proofs were failing when some Blueboxed proofs of time were encountered. -- Users can now pip install e.g. chia-blockchain==1.0.1 on most platforms. -- Sometimes the GUI had an error regarding MainWindow. - -## 1.0.0 First Release of Chia Blockchain 2021-03-17 - -### Added - -- This is the first production release of the Chia Blockchain. This can be installed and will wait for the green flag that will be dropped at approximately 7AM PDST (14:00 UTC) on Friday March 19, 2021. All farming rewards from that point forward will be considered valid and valuable XCH. There is a six week lock on all transactions. During those six weeks farmers will be earning their farming rewards but those rewards can not be spent. -- Initial difficulty will be set for 100PB. This may mean the initial epoch may be slow. Mainnet difficulty resets are targeted for 24 hours so this difficulty will adjust to the actual space brought online in 24 to 48 hours after launch. -- Transactions are not enabled in the 1.0.0 version and will be soft forked in during the six week period via a 1.1.0 release. -- There will also be a 1.0.1 release after the green flag process is complete to simplify install for new users by removing the green flag alert. In the interim there will be new testnet releases using the 1.1bx version scheme. -- Starting with release 1.0.0 you usually no longer need to upgrade and 1.0.1 will be fully optional. However you will have to upgrade to 1.1 after it is out and before the six week period ends. We plan to give plenty of time between those two events up to and including pushing back the transaction start date by a short period of time. -- Thank you to @L3Sota for adding a Japanese translation via our [Crowdin project](https://crowdin.com/project/chia-blockchain). -- The generation of CoinIDs is now unique on mainnet to avoid testnet transaction replays. -- Validation of transactions will now fail after the expiration of the six week period. - -### Changed - -- Weight proof request timeout was increased to 180 seconds. -- Mainnet uses port 8444 and other constants and service names were changed for mainnet. -- GUI locales are now extracted and compiled in `npm run build`. -- Daemon now logs to STDERR also. - -### Fixed - -- GUI plotting on some Macs was not working due to locale issues with Click. -- Thank you @L3Sota for bringing this log back into 2021. -- The errant warning on Electron startup has been removed. Thanks @dkackman. - -## 1.0rc9 aka Release Candidate 9 - 2021-03-16 - -### Changed - -- This is a hard fork/breaking change from RC6/7/8. The current plan is to drop the flag at noon pacific time, today 3/16. -- Using the real prefarm keys for this test - -### Fixed - -- Found and fixed another green flag related issue -- Fixed an issue with weight proofs where all sub-epochs were sampled, and the size of the weight proof kept growing -- Fixed an issue with install-gui.sh, where npm audit fix was failing. (Thanks @Depado!) -- Migration with CHIA_ROOT set does not crash chia init - -## 1.0rc8 aka Release Candidate 8 - 2021-03-15 - -### Added - -- This is a hard fork/breaking change from RC6/7. TXCH Coins will **not** be moved forward but your plots and keys and parts of your configuration do. When you install this version before 10AM PDST on 3/16/2021 it will load up, start finding peers, and otherwise wait for the flag drop at that time to start farming. This is likely to be the last dress rehearsal for mainnet launch. Our [3/15/2021 blog post](https://www.chia.net/2021/03/15/mainnet-update.html) has more details on the current mainnet launch plan. -- The GUI now has a tooltip that directs users to the explanation of the plot filter. -- The GUI now has a tooltip to explain the "Disable bitfield plotting" option. Thanks @shaneo257 for the idea. -- The GUI now has a tooltip to explain Hierarchical Deterministic keys next to Receive Address on the Wallet page. - -### Changed - -- We now use Python 3.9 to build MacOS installers. -- Harvester now catches another error class and continues to harvest. Thanks to @xorinox for this PR. -- We now use a smaller weight proof sample size to ease the load on smaller machines when syncing. -- Starting the GUI from Linux will now also error out if `npm run build` is run outside the venv. Huge thanks to @dkackman for that PR. -- `chia farm summary` will now display TXCH or XCH as appropriate. -- We added more time to our API timeouts and improved logging around times outs. - -### Fixed - -- We no longer use the transaction cache to look up transactions for new transactions as that was causing a wallet sync bug. -- Sometimes the GUI would not pick up the fingerprint for the plotting key. -- `chia farm summary` displayed some incorrect amounts. -- Weight proofs were timing out. -- Changes to farming rewards target addresses from the GUI were not being saved for restart correctly. -- Signage points, recent deficit blocks, and slots for overflow challenge blocks had minor issues. - -## 1.0rc7 aka Release Candidate 7 - 2021-03-13 - -### Changed - -- Our green flag test blockchain launch worked but it uncovered a flaw in our installer versions. This release is a bug fix release to address that flaw. You should read the RC6 changes below if this is your first time installing since RC5. -- Thanks to @dkackman for implementing an early exit of the GUI if you run `npm run build` without being in the `venv`. -- `chia netspace` now defaults to 1000 blocks to mirror the GUI. -- The installer build process was spruced up some. - -### Fixed - -- Setting difficulty way too low on the testnet_6 launch revealed a Timelord edge case. The full node was hardcoding the default difficulty if block height is < EPOCH_BLOCKS. However there were many overlapping blocks, so none of the blocks reached the height, and therefore the timelord infused the wrong difficulty. -- Fixed a race condition in the Timelord, where it took time to update the state, so it ignored the new_peak_timelord form the full_node, which should have reset the timelord to a good state. -- Wallet notoriously showed "not synced" when it was in sync. -- Installers were not correctly placing root TLS certificates into the bundle. -- Weight proofs had a logic typo. -- There was a typo in `chia netspace`. Thanks @altendky. -- There was a typo in `chia plots`. Thanks @adamfiddler. - -### Known Issues - -- Some users can't plot in the GUI in MacOS Big Sur - especially on M1. See issue [1189](https://github.com/Chia-Network/chia-blockchain/issues/1189) - -## 1.0rc6 aka Release Candidate 6 - 2021-03-11 - -### Added - -- This is a hard fork/breaking change from RC5. TXCH Coins will **not** be moved forward but your plots and keys and parts of your configuration do. We will be testing the final mainnet release strategy with the launch of RC6. For the test, those who are comfortable running the dev branch will update and start up their farms. All harvesters and plots will load and until the green flag drops, peers will be gossiped so your farm can establish good network connectivity. When the flag drops, each node will pull down the signed genesis challenge and start farming. Block 1 will be broadcast to anyone who hasn't seen the flag drop yet. The only difference for mainnet is that there will be 1.0 installers and a main branch release more than 24 hours before the real green flag. -- There is now basic plot queueing functionality in the GUI. By default, plotting works as it has in the past. However you can now name a queue in Step 2 Advanced Options. Chose something like `first`. Everything you add to the `first` queue will start up like it has in the past but now you can go through the steps again and create a queue named `second` and it will immediately start plotting as if it is unaware of and parallel with `first`. A great use case is that you would set `first` to plot 5 plots sequentially and then you'd set `second` to plot 5 sequentially and that would give you two parallel queues of 5 plot's each. We will be returning to plotting speed and UI soon. Thanks @jespino for this clever work around for now. -- There is now an option on the Farm page to manage your farming rewards receive addresses. This makes it easy to send your farming rewards to an offline wallet. This also checks your existing rewards addresses and warns if you do not have the matching private key. That is expected if you are using an offline wallet of course. -- Functionally has been added to the farmer rpc including checking and changing your farming rewards target addresses. -- Added the ability to translate material-ui components like `Row 1 of 10`. Thanks @jespino. -- Arch linux support has been added to `sh install.sh`. Thanks @jespino. -- Update FullBlock to Allow Generator References - a list of block heights of generators to be made available to the block program of the current block at generator runtime. This sets the stage for smart coins calling existing "libraries" already on the chain to lower fees and increase the scale of complex smart coins. - -## Changed - -- Remove `chia plots "-s" "--stripe_size"` and the strip size setting in the Advanced section of the GUI. We now always use the best default of 64K for the GUI and cli. -- `chia keys add` takes secret words a prompt on the command line or stdin instead of command line arguments for security. -- Version 1.0.1 of chiavdf was added. This brought MPIR on Windows to the most recent release. Additionally we removed inefficient ConvertIntegerToBytes() and ConvertBytesToInt() functions, use GMP library's mpz_export/mpz_import for big integers and simple helper functions for built-in integer types. The latter are taken from chiavdf. We now require compressed forms to be encoded canonically when deserializing. This should prevent potential grinding attacks where some non-canonical encodings of a compressed form could be used to change its hash and thus the next challenges derived from it. Canonically encoded compressed forms must be reduced and must produce the same string when deserialized and serialized again. -- Version 1.0 of our BLS signature library is included. We brought Relic, gmp and MPIR up to their most recent releases. We again thank the Dash team for their fixes and improvements. -- We now hand build Apple Silicon native binary wheels for all chia-blockchain dependencies and host them at [https://pypi.chia.net/simple](https://pypi.chia.net/simple). We are likely to hand build a MacOS ARM64 dmg available and certainly will for 1.0. You can install natively on M1 now with the `git clone` developer method today. Just make sure Python 3.9 is installed. `python3 --version` works. -- The GUI now shows you which network you are connected to on the Full Node page. It will also wait patiently for the green flag to drop on a network launch. -- In the GUI you can only plot k=32 or larger with the single exception of k=25 for testing. You will have to confirm choosing k=25 however. Thanks to @jespino for help on this and limiting the cli as well. -- The restore smart wallets from backup prompt has been improved to better get the intent across and that it can be skipped. -- At the top of the plotting wizard we have added text pointing out that you can plot without being in sync or on the internet. -- Wallet no longer automatically creates a new hierarchical deterministic wallet receive address on each start. You can and still should choose a new one with the `NEW ADDRESS` button for each new transaction for privacy. -- The network maximum k size is now set to k=50. We think that may be more storage than atoms in the solar system so it should be ok. But we will probably be hated for it in 200 years... -- The formula for computing iterations is simplified, so that only one division is necessary, and inverting the (1-x) into just x. -- There are new timestamp consensus rules. A block N must have a greater timestamp than block N-1. Also, a block's timestamp cannot be more than 5 minutes in the future. Note that we have decided that work factor difficulty resets are now going to be 24 hours on mainnet but are still shorter on testnet. -- A List[Tuple[uint16, str]] is added to the peer network handshake. These are the capabilities that the node supports, to add new features to the protocol in an easy - soft fork - manner. The message_id is now before the data in each message. -- Peer gossip limits were set. -- Generators have been re-worked in CLVM. We added a chialisp deserialization puzzle and improved the low-level generator. We reduce the accepted atom size to 1MB during ChiaLisp native deserialization. -- When processing mempool transactions, Coin IDs are now calculated from parent coin ID and amount -- We implemented rate limiting for full node. This can and will lead to short term bans of certain peers that didn't behave in expected ways. This is ok and normal, but strong defense against many DDOS attacks. -- `requirements-dev.txt` has been removed in favor of the CI actions and test scripts. -- We have moved to a new and much higher scalability download.chia.net to support the mainnet launch flag and additional download demand. -- To always get the latest testnet and then mainnet installers you can now use a latest URL: [Windows](https://download.chia.net/latest/Setup-Win64.exe) and [MacOS x86_64](https://download.chia.net/latest/Setup-MacOS.dmg). -- Chia wheels not on Pypi and some dependecies not found there also are now on pypi.chia.net. -- Additional typing has been added to the Python code with thanks to @jespino. -- Cryptography and Keyring have been bumped to their current releases. -- PRs and commits to the chia-blockchain-gui repository will automatically have their locales updated. - -## Fixed - -- The Farm page will now no longer get stuck at 50 TXCH farmed. -- `chia farm` has had multiple bugs and spelling issues addressed. Thanks to @alfonsoperez, @soulmerge and @olivernyc for your contributions. -- `chia wallet` had various bugs. -- Various weight proof improvements. -- Some users on Big Sur could not plot from the GUI as the log window would be stuck on "Loading." -- We believe we have fixed the chain stall/confused Timelord bug from ~ 13:00 UTC 3/10/21. We've added additional recovery logic as well. -- Logs from receiving a duplicate compacted Proof of Time are much more human friendly. -- We believe that the install/migrate process was bringing forward bad farming rewards receive addresses. We have attempted to stop that by only migrating RC3 and newer configurations. You can make sure you are not effected by using the Manage Farming Rewards tool mentioned above or putting a known good wallet receive address in both `xch_target_address` sections of config.yaml. -- Wallet cached transactions incorrectly in some cases. - -## 1.0rc5 aka Release Candidate 5 - 2021-03-04 - -### Added - -- The RC5 release is a new breaking change/hard fork blockchain. Plots and keys from previous chains will work fine on RC5 but balances of TXCH will not come forward. -- We now support a "green flag" chain launch process. A new version of the software will poll download.chia.net/notify/ for a signed json file that will be the genesis block of the chain for that version. This will allow unattended start at mainnet. -- Bluebox Timelords are back. These are Timelords most anyone can run. They search through the historical chain and find large proofs of times and compact them down to their smallest representation. This significantly speeds up syncing for newly started nodes. Currently this is only supported on Linux and MacOS x86_64 but we will expand that. Any desktop or server of any age will be fast enough to be a useful Bluebox Timelord. -- Thanks to @jespino there is now `chia farm summary`. You can now get almost exactly the same farming information on the CLI as the GUI. -- We have added Romanian to the GUI translations. Thank you to @bicilis on [Crowdin](https://crowdin.com/project/chia-blockchain). We also added a couple of additional target languages. Klingon anyone? -- `chia wallet` now takes get_address to get a new wallet receive address from the CLI. -- `chia plots check` will list out all the failed plot filenames at the end of the report. Thanks for the PR go to @eFishCent. -- Chialisp and the clvm have had the standard puzzle updated and we replaced `((c P A))` with `(a P A)`. - -## Changed - -- Testnets and mainnet now set their minimum `k` size and enforce it. RC5 testnet will reject plots of size less than k=32. -- Sub slots now require 16 blocks instead of 12. -- Thanks to @xdustinface of Dash, the BlS Signature library has been updated to 0.9 with clean ups and some speed ups. This changed how the G2 infinity element was handled and we now manage it inside of chia-blockchain, etc., instead of in blspy. -- We have updated the display of peer nodes and moved adding a peer to it's own pop up in the GUI. -- Block searching in the GUI has been improved. -- @jespino added i18n support and refactored how locales are loaded in the GUI. Additionally he moved more strings into the translation infrastructure for translators. -- In chiavdf we changed n-Wesolowski proofs to include B instead of y in segments. Proof segments now have the form (iters, B, proof) instead of (iters, y, proof). This reduces proof segment size from 208 to 141 bytes. -- The new chiavdf proof format is not compatible with the old one, however zero-Wesolowski proofs are not affected as they have zero proof segments and consist only of (y, proof). -- We made two HashPrime optimizations in chiavdf. This forces numbers being tested for primality to be odd and avoids an unnecessary update of the sprout vector by stopping after the first non-zero value. This is a breaking change as it changes the prime numbers generated from a given seed. We believe this is the final breaking change for chiavdf. -- chiabip158 was set to a gold 1.0 version. -- Comments to Chialisp and clvm source have been updated for all of the Chialisp changes over the proceeding three weeks. -- And thanks yet again to @jespino for a host of PRs to add more detailed typing to various components in chia-blockchain. -- aiohttp was updated to 3.7.4 to address a low severity [security issue](https://github.com/advisories/GHSA-v6wp-4m6f-gcjg). -- calccrypto/uint128_t was updated in the Windows chiapos implementation. Chiapos required some changes its build process to support MacOS ARM64. - -### Fixed - -- Harvester would crash if it encountered more than 16,000 plot files or 256 directories. -- Nodes that were interrupted by a network crash or standby on a laptop were not syncing upon reconnection in RC4. -- Sync issues could stop syncing from restarting and could lead to a peer host that you could not remove. -- Adding Click changed the behavior of `chia keys add -m`. The help now makes it clear that the 24 word mnemonic needs to be surrounded by a pair of quotes. -- Python root CA certificates have issues so we have added the Mozilla certificate store via curl.se and use that to connect to backup.chia.net via https, for example. -- The difficulty adjustment calculation was simplified. -- All of the chia sub repositories that were attempting to build MacOS Universal wheels were only generating x86_64 wheels internally. We have moved back to only generating x86_64 MacOS wheels on CI. -- However, we have updated and test compiled all Chia dependencies on Apple Silicon and will be making available a test .dmg for MacOS ARM64 shortly. -- Various weight proof edge cases have been fixed. -- Various typos and style clean ups were made to the Click CLI implementation. `chia -upnp f` was added to disable uPnP. -- `chia plots check` shouldn't crash when encountering plots that cause RuntimeError. PR again thanks to @eFishCent. -- Coloured coin announcements had a bug that would allow counterfeiting. - -## 1.0rc4 aka Release Candidate 4 - 2021-02-25 - -### Fixed - -- This is a bug fix release for RC3. There was an unexpected interaction between the GUI and the Click cli tool regarding Windows that made GUI plotting not start on all GUIs. - -## 1.0rc3 aka Release Candidate 3 - 2021-02-25 - -### Added - -- RC3 is a new chain to support the last major chialisp changes. TXCH from the RC1/2 chain do not come forward to this chain but plots and keys continue to work as usual. -- We have lowered the transaction lock to the first 5000 blocks to facilitate testing. We also started this chain at a lower difficulty. -- A new RPC api: /push_tx. Using this RPC, you can spend custom chialisp programs. You need to make a SpendBundle, which includes the puzzle reveal (chialisp), a solution (chialisp) and a signature. -- You can now use the RPC apis to query the mempool. -- There are now Swedish, Spanish, and Slovak translations. Huge thanks to @ordtrogen (Swedish), @jespino and @dvd101x (Spanish), and our own @seeden (Slovak). Also thanks were due to @f00b4r (Finnish), @A-Caccese (Italian), and @Bibop182 and @LeonidShamis (Russian). Quite a few more are almost complete and ready for inclusion. You can help translate and review translations at our [crowdin project](https://crowdin.com/project/chia-blockchain). -- You can obtain a new wallet receive address on the command line with `chia wallet new_address`. Thanks to @jespino for this and a lot more in the next section below. -- You will now see Your Harvester Network in the GUI even if you have no plots. - -### Changed - -- All chialisp opcodes have been renumbered. This should be the last major breaking change for chialisp and the clvm. There are a couple minor enhancements still needed for mainnet launch, but they may or may not require minor breaking changes. We will be restarting testnet chains on a mostly weekly basis either way. -- Node batch syncing performance was increased, and it now avoids re-validating blocks that node had already validated. -- The entire CLI has been ported to [Click](https://click.palletsprojects.com/en/7.x/). Huge thanks to @jespino for the big assist and @unparalleled-js for the [recommendation and the initial start](https://github.com/Chia-Network/chia-blockchain/issues/464). This will make building out the CLI much easier. There are some subtle changes and some shortcuts are not there anymore. `chia -h` and `chia SUBCOMMAND -h` can be your guide. -- We have upgraded Electron to 11.3 to support Apple Silicon. There are still one or two issues in our build chain for Apple Silicon but we should have an M1 native build shortly. -- The websocket address is no longer displayed in the GUI unless it is running as a remote GUI. Thanks @dkackman ! -- `chia plots check` now will continue checking after it finds an error in a plot to the total number of checks you specified. -- If you run install-gui.sh or install-timelord.sh without being in the venv, the script will warn you that you need to `. ./activate` and exit with error. -- If you attempt to install on a 32 bit Pi/ARM OS, the installer exits with a helpful error message. You can still fail when running under a 64 bit kernel but using a 32 bit Python 3. -- The application is now more aware of whether it is running a testnet or mainnet. This impacts wallet's display behavior and certain blockchain validation rules. -- Interface improvements for `chia netspace`. -- Now that aiosqlite included our upstream improvements we install version 0.17.0. -- `chia init` only migrates release candidate directories. The versioned sub directories under `~/chia` will be going away before mainnet. - -### Fixed - -- The GUI was often getting stuck on connecting to wallet. We beleive we have resolved this. -- We identified and fixed an issue where harvester would crash, especially when loading plots or checking a large amount of plots. -- The software now reports not synced in the GUI if not synced or being behind by 7 minutes or more. -- Difficulty was set too high for the RC1/2 chain. This lead to odd rewards behaviour as well as difficulty artificially could not fall as low as it should. -- Don't load plots that don't need to be loaded. -- We made various fixes and changes to weight proofs. -- Some configuration values were improperly ignored in migrations. -- Some debug logging was accidentally left in. -- `chia configure -log-level` was broken. -- We believe we finally have the Windows Installer obtaining the correct version information at build time. -- The application was sometimes not cancel pending items when closing certain websockets. -- Fixed filter hash and generator validation. -- Recursive replace was being called from the test suite. - -## 1.0rc2 aka Release Candidate 2 - 2021-02-18 - -### Fixed - -- This is an errata release for Release Candidate 1. There were a couple of things that did not smoothly migrate from the Beta versions. Please make sure you also consult the [release notes for RC-1](https://github.com/Chia-Network/chia-blockchain/releases/tag/1.0rc1) was well. -- Incorrect older spend to addresses were being migrated from Beta 27. This would send farming rewards to un-spendable coins. -- Netspace was not calculating properly in RC-1. -- The Windows installer was building with the wrong version number. -- @eFishCent didn't get correct credit in the RC 1 release notes. They have been updated below to be correct. - -## 1.0rc1 aka Release Candidate 1 - 2021-02-18 - -### Added - -- This is the first release in our release candidate series. There are still a few things that will change at the edges but the blockchain, clvm, and chialisp are in release form. We have one major change to chialisp/clvm that we have chosen to schedule for the next release as in this release we're breaking the way q/quote works. We also have one more revision to the VDF that will decrease the sizes of the proofs of time. We expect a few more releases in the release candidate series. -- Installers will now be of the pattern ChiaSetup-0.2.1.exe. `0.2` is release candidate and the final `.1` is the first release candidate. -- Use 'chia wallet get_transactions' in the command line to see your transactions. -- 'chia wallet show' now shows your wallet's height. -- Last Attempted Proof is now above Latest Block Challenge on the Farm page of the GUI. -- The GUI now detects duplicate plots and also only counts unique plots and unique plot size. -- We have integrated with crowdin to make it easier to translate the GUI. Check out [Chia Blockchain GUI](https://crowdin.com/project/chia-blockchain) there. -- We have added Italian, Russian, and Finnish. More to come soon. -- There is now remote UI support. [Documents](https://github.com/Chia-Network/chia-blockchain-gui/blob/main/remote.md) will temporarily live in the repository but have moved to the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki/Connecting-the-UI-to-a-remote-daemon). Thanks to @dkackman for this excellent addition! -- Added the ability to specify an address for the pool when making plots (-c flag), as opposed to a public key. The block -validation was changed to allow blocks like these to be made. This will enable changing pools in the future, by specifying a smart transaction for your pool rewards. -- Added `chia plots check --challenge-start [start]` that begins at a different `[start]` for `-n [challenges]`. Useful when you want to do more detailed checks on plots without restarting from lower challenge values you already have done. Huge thanks to @eFishCent for this and all of the debugging work behind the scenes confirming that plot failures were machine errors and not bugs! - -### Changed - -- Sub blocks renamed to blocks, and blocks renamed to transaction blocks, everywhere. This effects the RPC, now -all fields that referred to sub blocks are changed to blocks. -- Base difficulty and weight have increased, so difficulty of "5" in the rc1 testnet will be equivalent to "21990232555520" in the previous testnet. -- 'chia wallet send' now takes in TXCH or XCH as units instead of mojos. -- Transactions have been further sped up. -- The blockchain database has more careful validation. -- The GUI is now using bech32m. - -### Fixed - -- We updated chiapos to hopefully address some harvester crashes when moving plot files. -- Many of the cards on the Farming page have had bugs addressed including last block farmed, block rewards, and user fees. -- Improved validation of overflow blocks. - -## [1.0beta27] aka Beta 1.27 - 2021-02-11 - -### Added - -- The Beta 27 chain is a hard fork. All TXCH from previous releases has been reset on this chain. Your keys and plots of k=32 or larger continue to work just fine on this new chain. -- We now use the rust version of clvm, clvm_rs, in preference to validate transactions. We have additionally published binary wheels or clvm_rs for all four platforms and all three supported python versions. The rust version is approximately 50 times faster than the python version used to validate on chain transactions in previous versions. -- We have moved to compressed quadratic forms for VDFs. Using compressed representation of quadratic forms reduces their serialized size from 130 to 100 bytes (for forms with 1024-bit discriminant). This shrinks the size of VDF outputs and VDF proofs, and it's a breaking change as the compressed representation is not compatible with the older uncompressed (a, b) representation. Compressed forms are also used in calls to chiavdf and in timelord's communication with VDF clients. The form compression algorithm is based on ["Trustless Groups of Unknown Order with Hyperelliptic Curves"](https://eprint.iacr.org/2020/196) by Samuel Dobson, Steven D. Galbraith and Benjamin Smith. -- Last Attempted Proof on the Farm tab of the GUI now shows hours:minutes:seconds instead of just hours:minutes. This makes it much easier to see that your farmer is responding to recent challenges at a glance. -- You can now send and receive transactions with the command line. Try `chia wallet -h` to learn more. Also, `chia wallet` now requires a third argument of `show`, therefor you will use `chia wallet show` to see your wallet balance. -- We have added the [Crowdin](https://crowdin.com/) translation platform to [chia blockchain gui](https://crowdin.com/project/chia-blockchain). We are still getting it fully set up, but helping to translate the GUI is going to be much easier. -- Full Node > Connections in the GUI now shows the peak sub block height your connected peers believe they are at. A node syncing from you will not be at the true peak sub block height until it gets into sync. -- `chia init -c [directory]` will create new TLS certificates signed by your CA located in `[directory]`. Use this feature to configure a new remote harvester. Type `chia init -h` to get instructions. Huge thanks to a very efficient @eFishCent for this quick and thorough pull request. -- We build both MacOS x86_64 and MacOS universal wheels for chiapos, chiavdf, blpsy, and chiabip158 in Python 3.9. The universal build allows M1 Macs to run these dependencies in ARM64 native mode. -- On first run in the GUI (or when there are no plot directories) there is now an "Add Plot Directories" on the Farm tab also. - -### Changed - -- We are moving away from the terms sub blocks and blocks in our new consensus. What used to be called sub blocks will now just be blocks. Some blocks are now also transaction blocks. This is simpler both in the code and to reason about. Not all the code or UI may have caught up yet. -- This release has the final mainnet rewards schedule. During the first three years, each block winner will win 2 TXCH/XCH per block for a total of 9216 TXCH per day from 4608 challenges per day. -- Smart transactions now use an announcement instead of 'coin consumed' or lock methods. -- The GUI is now in a separate submodule repository from chia-blockchain, [chia-blockchain-gui](https://github.com/Chia-Network/chia-blockchain-gui). The installers and install scripts have been updated and it continues to follow the same install steps. Note that the GUI directory will now be `chia-blockchain-gui`. The workflow for this may be "touch and go" for people who use the git install methods over the short term. -- Very large coin counts are now supported. -- Various RPC endpoints have been renamed to follow our switch to "just blocks" from sub blocks. -- We've made changes to the protocol handshake and the blockchain genesis process to support mainnet launch and running/farming more than one chain at a time. That also means we can't as easily determine when an old version of the peer tries to connect so we will put warnings in the logs for now. -- We no longer replace addresses in the config. **IMPORTANT** - This means if you change the target address in config.yml, you have to make sure you control the correct keys. -- We now only migrate Beta 19 and newer installations. -- We have removed cbor2 as a dependency. -- We updated various dependencies including cryptography, packaging, portalocker, and pyyaml - most of which are only development dependencies. - -### Fixed - -- The function that estimated total farming space was counting space at twice the actual rate. Netspace will display half of the previous space estimate which is now a correct estimate of the actual space currently being farmed. -- We fixed many sync and stay in sync issue for both node and wallet including that both would send peaks to other peers multiple times and would validate the same transaction multiple times. -- The GUI was incorrectly reporting the time frame that the netspace estimate it displays utilizes. It is technically 312.5 minutes, on average, over the trailing 1000 sub blocks. -- Coloured coins were not working in the new consensus. -- Some Haswell processors do not have certain AVX extensions and therefor would not run. -- The cli wallet, `chia wallet`, was incorrectly displaying TXCH balances as if they were Coloured Coins. -- We addressed [CVE-2020-28477](https://nvd.nist.gov/vuln/detail/CVE-2020-28477) in the GUI. -- We made changes to CI to hopefully not repeat our skipped releases from the previous release cycle. - -## [1.0beta26] aka Beta 1.26 - 2021-02-05 - -### Added - -- We now use our own faster primality test based on Baillie-PSW. The new primality test is based on the 2020 paper ["Strengthening the Baillie-PSW primality test" by Robert Baillie, Andrew Fiori, Samuel S. Wagstaff Jr](https://arxiv.org/abs/2006.14425). The new test works approximately 20% faster than GMP library's mpz_probab_prime_p() function when generating random 1024-bit primes. This lowers the load on Timelords and speeds up VDF verifications in full node. -- The GUI now checks for an an already running GUI and stops the second launch. Thank you for that PR to @dkackman ! -- Transactions are now validated in a separate process in full node. -- `chia plots check -l` will list all duplicate plot IDs found on the machine. Thanks very much for this PR @eFishCent. - -### Changed - -- Significant improvements have been made to how the full node handles the mempool. This generally cuts CPU usage of node by 2x or more. Part of this increase is that we have temporarily limited the size of transactions. If you want to test sending a transaction you should keep the value of your transaction below 20 TXCH as new consensus will cause you to use a lot of inputs. This will be returned to the expected level as soon as the integration of [clvm rust](https://github.com/Chia-Network/clvm_rs) is complete. -- We have changed the way TLS between nodes and between chia services work. Each node now has two certificate authorities. One is a public, shared CA that signs the TLS certificates that every node uses to connect to other nodes on 8444 or 58444. You now also have a self generated private CA that must sign e.g. farmer and harvester's certificates. To run a remote harvester you need a new harvester key that is then signed by your private CA. We know this is not easy for remote harvester in this release but will address it quickly. -- We have changed the way we compile the proof of space plotter and added one additional optimization. On many modern processors this will mean that using the plotter with the `-e` flag will be 2-3% faster than the Beta 17 plotter on the same CPU. We have found this to be very sensitive to different CPUs but are now confident that, at worst, the Beta 24 plotter with `-e` will be the same speed as Beta 17 if not slightly faster on the same hardware. Huge thanks to @xorinox for meticulously tracking down and testing this. -- If a peer is not responsive during sync, node will disconnect it. -- Peers that have not sent data in the last hour are now disconnected. -- We have made the "Help Translate" button in the GUI open in your default web browser and added instructions for adding new translations and more phrases in existing translations at that [URL](https://github.com/Chia-Network/chia-blockchain/tree/main/electron-react/src/locales). Try the "Help Translate" option on the language selection pull down to the left of the dark/light mode selection at the top right of the GUI. -- Sync store now tracks all connected peers and removes them as they get removed. -- The Rate Limited Wallet has been ported to new consensus and updated Chialisp methods. -- We are down to only one sub dependency that does not ship binary wheels for all four platforms. The only platform still impacted is ARM64 (generally Raspberry Pi) but that only means that you still need the minor build tools as outlined on the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki/Raspberry-Pi). -- We upgraded to Electron 9.4.2 for the GUI. -- We have upgraded to py-setproctitle 1.2.2. We now have binary wheels for setproctitle on all four platforms and make it a requirement in setup.py. It is run-time optional if you wish to disable it. - -### Fixed - -- On the Farm page of the GUI Latest Block Challenge is now populated. This shows you the actual challenge that came from the Timelord. Index is the signage point index in the current slot. There are 64 signage points every 10 minutes on average where 32 sub blocks can be won. -- Last Attempted Proof is now fixed. This will show you the last time one of your plots passed the [plot filter](https://github.com/Chia-Network/chia-blockchain/wiki/FAQ#what-is-the-plot-filter-and-why-didnt-my-plot-pass-it). -- Plot filename is now back in the Plots table of the GUI. -- There was a bug in adding a sub block to weight proofs and an issue in the weight proof index. -- Over time the node would think that there were no peers attached with peak sub block heights higher than 0. -- There was a potential bug in Python 3.9.0 that required us to update blspy, chiapos, chiavdf, and chiabip158. -- An off by one issue could cause syncing to ask for 1 sub block when it should ask for e.g. 32. -- Short sync and backtrack sync both had various issues. -- There was an edge case in bip158 handling. - -### Known issues - -- There is a remaining sync disconnect issue where your synced node will stop hearing responses from the network even though it still gets a few peaks and then stalls. Restarting node should let you quickly short sync back to the blockchain tip. - -## [1.0beta25] aka Beta 1.25 - -### Skipped - -## [1.0beta24] aka Beta 1.24 - -### Skipped - -## [1.0beta23] aka Beta 1.23 - 2021-01-26 - -### Added - -- The GUI now displays sub blocks as well as transaction blocks on the Full Node page. -- `chia plots check` enforces a minimum of `-n 5` to decrease false negatives. Thanks to @eFishCent for these ongoing pull requests! -- Testnets and mainnets will now have an initial period of sub blocks where transactions are blocked. -- Transaction volume testing added to tests and various tests have been sped up. -- We have added connection limits for max_inbound_wallet, max_inbound_farmer, and max_inbound_timelord. - -### Changed - -- On starting full node, the weight proof cache does not attempt to load all sub blocks. Startup times are noticeably improved though there remains a hesitation when validating the mempool. Our clvm Rust implementation, which will likely ship in the next release, will drop example processing times from 180 to 3 seconds. -- Changes to weight proofs and sub block storage and cacheing required a new database schema. This will require a re-sync or obtaining a synced blockchain_v23.db. -- clvm bytecode is now generated and confirmed that the checked-in clvm and ChiaLisp code matches the CI compiled code. -- We have removed the '-r' flag from `chia` as it was being overridden in most cases by the `-r` for restart flag to `chia start`. Use `chia --root-path` instead. -- `chia -h` now recommends `chia netspace -d 192` which is approximately one hours worth of sub blocks. Use `-d 1000` to get the same estimate of netspace as the RPC and GUI. -- `chia show -c` now displays in MiB and the GUI has been changed to MiB to match. -- `chia configure` now accepts the shorter `-upnp` and `-log-level` arguments also. -- `chia plots check` now defaults to `-n 30` instead of `-n 1` - HT @eFishCent. -- `chia plots create` now enforces a minimum of k=22. As a reminder, anything less than k=32 is just for testing and be careful extrapolating performance of a k less than 30 to a k=32 or larger. -- We have updated development dependencies for setuptools, yarl, idna, multidict, and chardet. -- Updated some copyright dates to 2021. - -### Fixed - -- We upgraded our fork of aiosqlite to version 16.0 which has significant performance improvements. Our fixes to aiosqlite are waiting to be upstreamed. -- The Plots tab in the GUI will no longer show red/error when the node is still syncing. -- Inbound and outbound peer connection limits were not being honored. -- Weight proofs were not correctly extending. -- In some cases when closing a p2p connection to another node, there was an infinite "Closing" loop. -- `chia show -c` was showing upload MiB in the download column and vice versa. @pyl and @psydafke deserves credit for insisting it was broken and @kd637xx for the PR assist. -- `chia show` handles sub block 0 better. - -## [1.0beta22] aka Beta 1.22 - 2021-01-19 - -### Added - -- Node now attempts to pre-validate and cache transactions. -- The harvester will try to not load a plot file that is too small for its k size. This should help keep from partial plots being found when they are copied into a harvester directory. Harvester will check again on the next challenge and find a completed copy of a plot file then. -- `chia plots create -x` skips adding [final dir] to harvester for farming - -### Changed - -- We now use bech32m and have added the bech32m tests from Pieter Wuille (@sipa) outlined [here](https://gist.github.com/sipa/14c248c288c3880a3b191f978a34508e) with thanks. -- In the GUI, choosing to parallel plot with a delay now is a delay between the start of the parallel plots started in one session. -- Removed loading plot file names when starting `chia plots create`; decreases plotter time when there are a lot of plots on the machine. Huge thanks to @eFishCent for this PR! - -### Fixed - -- Various fixes to improve node's ability to sync. There are still plenty of additional performance improvements coming for node so expect it to get easier to run on less powerful devices. -- Wallet now handles large amounts of coins much better and generally syncs better. -- Thanks to @nup002 for the PR to use scientific notation in the logs for address_manager.select_peer timings. -- `chia show -h` now correctly states that you use the first 8 characters of the node id to remove a node on the cli. -- Thank you to @wallentx for adding better help for `chia configure --enable-upnp`. -- Pull requests from forks won't have failures on CI. - -## [1.0beta21] aka Beta 1.21 - 2021-01-16 - -### Added - -- The cli now warns if you attempt to create a plot smaller than k=32. -- `chia configure` now lets you enable or disable uPnP. -- If a peer gives a bad weight proof it will now be disconnected. - -### Changed - -- Harvester now only checks every 2 minutes for new files and otherwise caches the plot listing in memory and logs how long it took to load all plot files at INFO level. -- Harvester multithreading is now configureable in config.yaml. -- Websocket heartbeat timeout was increased from 30 seconds to 300 seconds. -- Bumped Colorlog to 4.7.2, and pyinstaller to 4.2. - -### Fixed - -- Weight proofs were failing to verify contributing to a chain stall. This release gets things moving again but nodes are using too much CPU and can pause/lag at times. This may resolve as people upgrade to Beta 21. -- A toxic combination of transaction limits set too high and a non performant clvm kept the chain stalled. A faster rust implementation of clvm is already nearing completion. -- `chia netspace -s` would not correctly look up the start block height by block hash. Additionally netspace now flips to PiB above 1024 TiB. To compare netspace to `chia show` of the GUI use `chia netspace -d 1000` as `chia netspace` defaults to `-d 192` which is one hour. - -## [1.0beta20] aka Beta 1.20 - 2021-01-14 - -### Added - -- Plotting now checks to see if there are MacOS created `._` plot files and ignores them. -- Mnemonics now autocomplete in the GUI. - -### Changed - -- Node sync is now multithreaded and much quicker. -- Peer gossip is faster and smarter. It also will no longer accidentally gossip a private IP address to another peer. -- When syncing in the GUI, estimated time to win just shows syncing until synced. -- If harvester hits an exception it will be caught, logged and skipped. This normally happens if it attempts to harvest a plot file you are still copying in. -- The Rate Limited wallet has been updated to work in new consensus. - -### Fixed - -- There was a bug in block reorg code that would keep a peer with a lower weight chain from validating and syncing to a higher weight chain when the node thought it had a double spend in the other chain. This caused a persistent chain split. -- The Farm page in the GUI should not report just error when initially starting to sync. - -## [1.0beta19] aka Beta 1.19 - 2021-01-12 - -### Added - -- Welcome to the new consensus. This release is an all but a full re-write of the blockchain in under 30 days. There is now only one tip of the blockchain but we went from two chains to three. Block times are now a little under a minute but there are a couple of sub blocks between each transaction block. A block is also itself a special kind of sub block and each sub block rewards the farmer who won it 1 TXCH. Sub blocks come, on average, about every 17 to 18 seconds. -- Starting with this Beta, there are 4608 opportunities per day for a farmer to win 1 TXCH compared to Beta 18 where there were 288 opportunities per day for a farmer to win 16 TXCH. -- There is a lot more information and explanation of the new consensus algorithm in the New Consensus Working Document linked from [chia.net](https://chia.net/). Among the improvements this gives the Chia blockchain are a much higher security level against all attacks, more frequent transaction blocks that have less time variation between them and are then buried under confirmations (sub blocks also count towards re-org security) much more quickly. -- New consensus means this is a very hard fork. All of your TXCH from Beta 17/18 will be gone. Your plots and keys will work just fine however. You will have to sync to the new chain. -- You now have to sync 16 times more "blocks" for every 5 minutes of historical time so syncing is slower than it was on the old chain. We're aware of this and will be speeding it up and addressing blockchain database growth in the nest couple of releases. -- Prior to this Beta 19, we had block times that targeted 5 minutes and rewarded 16 TXCH to one farmer. Moving forward we have epoch times that target 10 minutes and reward 32 TXCH to 32 farmers about every 17-18 seconds over that period. This has subtle naming and UI impacts in various places. -- Total transaction throughput is still targeted at 2.1x Bitcoin's throughput per hour but you will get more confirmations on a transaction much faster. This release has the errata that it doesn't limit transaction block size correctly. -- For testing purposes this chain is quickly halving block rewards. By the time you're reading this and using the chain, farmers and pools will be receiving less than 1 TXCH for each block won as if it were 15-20 years from now. Block rewards are given in two components, 7/8's to the pool key and 1/8 to the farmer. The farmer also receives any transaction fees from the block. -- You can now plot in parallel using the GUI. A known limitation is that you can't yet specify that you want 4 sets of two parallel plots. Each parallel plot added starts immediately parallel. We will continue to improve this. -- The GUI now warns if you attempt to create a plot smaller than k=32. -- Added Chinese language localization (zh-cn). A big thank you to @goomario for their pull request! -- You can now specify which private key to use for `chia plots create`. After obtaining the fingerprint from `chia keys show`, try `chia plots create -a FINGERPRINT`. Thanks to @eFishCent for this pull request! -- We use a faster hash to prime function for chiavdf from the current release of gmp-6.2.1 which we have upgraded chiavdf and blspy to support. -- There is a new cli command - `chia configure`. This allows you to update certain configuration details like log level in config.yaml from the command line. This is particularly useful in containerization and linux automation. Try `chia configure -h`. Note that if chia services are running and you issue this command you will have to restart them for changes to take effect but you can use this command in the venv when no services are running or call it directly by path in the venv without activating the venv. Expect the options for this command to expand. -- We now fully support Python 3.9. - -### Changed - -- The Plot tab on the GUI is now the Plots tab. It starts out with a much more friendly new user wizard and otherwise keeps all of your farming plots listed here. Use the "+ ADD A PLOT" button in the top right to plot your second or later plot. -- The new plots page offers advanced plotting options in the various "Show Advanced Options" fold outs. -- The plotter supports the new bitfield back propagation method and the old method from Beta 17. To choose the old method add a `-e` to the command line or choose "Disable bitfield plotting" in "Show Advanced Options" of the Plots tab. Bitfield back propagation writes about 13% less total writes and can be faster on some slower hard drive temp spaces. For now, SSD temp space will likely plot faster with bitfield back propagation disabled. We will be returning to speed enhancements to the plotter as we approach and pass our mainnet launch. -- The Farm tab in the GUI is significantly enhanced. Here you have a dashboard overview of your farm and your activity in response to challenges blockchain challnegs, how long it will take you - on average - to win a block, and how much TXCH you've won so far. Harvester and Full Node connections have moved to Advanced Options. -- Harvester and farmer will start when the GUI starts instead of waiting for key selection if there are already keys available. This means you will start farming on reboot if you have the Chia application set to launch on start. -- Testnet is now running at the primary port of 58444. Update your routers appropriately. This opens 8444 for mainnet. -- All networking code has been refactored and mostly moved to websockets. -- RPCs and daemon now communicate over TLS with certificates that are generated into `~/.chia/VERSION/config/` -- We have moved to taproot across all of our transactions and smart transactions. -- We have adopted chech32m encoding of keys and addresses in parallel to bitcoin's coming adoption of bech32m. -- The rate limited wallet was updated and re-factored. -- All appropriate Chialisp smart transactions have been updated to use aggsig_me. -- Full node should be more aggressive about finding other peers. -- Peer disconnect messages are now set to log level INFO down from WARNING. -- chiavdf now allows passing in input to a VDF for new consensus. -- sha256tree has been removed from Chialisp. -- `chia show -s` has been refactored to support the new consensus. -- `chia netspace` has been refactored for new consensus. -- aiohttp, clvm-tools, colorlog, concurrent-log-handler, keyring, cryptography, and sortedcontainers have been upgraded to their current versions. -- Tests now place a cache of blocks and plots in the ~/.chia/ directory to speed up total testing time. -- Changes were made to chiapos to correctly support the new bitfiled backpropogation on FreeBSD and OpenBSD. With the exception of needing to work around python cryptography as outlined on the wiki, FreeBSD and OpenBSD should be able to compile and run chia-blockchain. -- With the change to new consensus many components of the chain and local database are not yet stored optimally. Startup and sync times may be slower than usual so please be patient. This will improve next release. -- Errata: Coinbase amount is missing from the GUI Block view. -- Eratta: wallet Backup, and Fly-sync on the wallet are currently not working. - -### Fixed - -- There was a regression in Beta 18 where the plotter took 499GiB of temp space for a k32 when it used to only use 332GiB. The plotter should now use just slightly less than it did in Beta 17. -- blspy was bumped to 0.3.1 which now correctly supports the aggsig of no signatures and is built with gmp-6.2.1. -- Fixed a plotter crash after pulling a disk without ejecting it first. -- `sh install.sh` now works properly on Linux Mint. -- `chia show -s` now is less brain dead when a node is initially starting to sync. - -## [1.0beta18] aka Beta 1.18 - 2020-12-03 - -### Added - -- F1 generation in the plotter is now fully parallel for a small speedup. -- We have bitfield optimized phase 2 of plotting. There is only about a 1% increase in speed from this change but there is a 12% decrease in writes with a penalty of 3% more reads. More details in [PR 120](https://github.com/Chia-Network/chiapos/pull/120). Note that some sorts in phase 2 and phase 3 will now appear "out of order" and that is now expected behavior. -- Partial support for Python 3.9. That includes new versions of Chia dependencies like chiabip158. - -### Changed - -- We have moved from using gulrak/filesystem across all platforms to only using it on MacOS. It's required on MacOS as we are still targeting Mojave compatibility. This should resolve Windows path issues. -- We upgraded to cbor 5.2.0 but expect to deprecate cbor in a future release. - -### Fixed - -- A segfault caused by memory leaks in bls-library has been fixed. This should end the random farmer and harvester crashes over time as outlined in [Issue 500](https://github.com/Chia-Network/chia-blockchain/issues/500). -- Plotting could hang up retrying in an "error 0" state due to a bug in table handling in some edge cases. -- CPU utilization as reported in the plotter is now accurate for Windows. -- FreeBSD and OpenBSD should be able to build and install chia-blockchain and its dependencies again. -- Starting with recent setuptools fixes, we can no longer pass an empty string to the linker on Windows when building binary wheels in the sub repos. Thanks @jaraco for tracking this down. - -## [1.0beta17] aka Beta 1.17 - 2020-10-22 - -### Changed - -- Bumped aiohttp to 3.6.3 - -### Fixed - -- In the GUI there was [a regression](https://github.com/Chia-Network/chia-blockchain/issues/484) that removed the scroll bar on the Plot page. The scroll bar has returned! -- In Dark Mode you couldn't read the white on white plotting log text. -- To fix a bug in Beta 15's plotter we introduced a fixed that slowed plotting by as much as 25%. -- Certain NTFS root mount points couldn't be used for plotting or farming. -- Logging had [a regression](https://github.com/Chia-Network/chia-blockchain/issues/485) where log level could no longer be set by service. - -## [1.0beta16] aka Beta 1.16 - 2020-10-20 - -### Added - -- The Chia GUI now supports dark and light mode. -- The GUI now supports translations and localizations. If you'd like to add your language you can see the examples in [the locales directory](https://github.com/Chia-Network/chia-blockchain/tree/dev/electron-react/src/locales) of the chia-blockchain repository. -- `chia check plots` now takes a `-g` option that allows you to specify a matching path string to only check a single plot file, a wild card list of plot files, or all plots in a single directory instead of the default behavior of checking every directory listed in your config.yaml. A big thank you to @eFishCent for this pull request! -- Better documentation of the various timelord options in the default config.yaml. - -### Changed - -- The entire GUI has been refactored for code quality and performance. -- Updated to chiapos 0.12.32. This update significantly speeds up the F1/first table plot generation. It also now can log disk usage while plotting and generate graphs. More details in the [chiapos release notes](https://github.com/Chia-Network/chiapos/releases/tag/0.12.32). -- Node losing or not connecting to another peer node (which is entirely normal behaviour) is now logged at INFO and not WARNING. Your logs will be quieter. -- Both the GUI and CLI now default to putting the second temporary directory files into the specified temporary directory. -- SSL Certificate handling was refactored along with Consensus constants, service launching, and internal configuration management. -- Updated to clvm 0.5.3. This fixed a bug in the `point_add` operator, that was causing taproot issues. This also removed the `SExp.is_legit_list` function. There were significant refactoring of various smart transactions for simplicity and efficiency. -- WalletTool was generally removed. -- Deprecated pep517.build for the new standard `python -m build --sdist --outdir dist .` - -### Fixed - -- A bug in bls-singatures/blspy could cause a stack overflow if too many signatures were verified at once. This caused the block of death at 11997 of the Beta 15 chain. Updated to 0.2.4 to address the issue. -- GUI Wallet now correctly updates around reorgs. -- chiapos 0.12.32 fixed a an out of bounds read that could crash the plotter. It also contains a fix to better handle the case of drive letters on Windows. -- Node would fail to start on Windows Server 2016 with lots of cores. This [python issue explains]( https://bugs.python.org/issue26903) the problem. - -### Known Issues - -- On NTFS, plotting and farming can't use a path that includes a non root mountpoint. This is fixed in an upcoming version but did not have enough testing time for this release. - -## [1.0beta15] aka Beta 1.15 - 2020-10-07 - -### Added - -- Choosing a larger k size in the GUI also increases the default memory buffer. - -### Changed - -- The development tool WalletTool was refactored out. -- Update to clvm 0.5.3. -- As k=30 and k=31 are now ruled out for mainnet, the GUI defaults to a plot size of k=32. - -### Fixed - -- Over time the new peer gossip protocol could slowly disconnect all peers and take your node offline. -- Sometimes on restart the peer connections database could cause fullnode to crash. - -## [1.0beta14] aka Beta 1.14 - 2020-10-01 - -### Added - -- Node peers are now gossiped between nodes with logic to keep connected nodes on disparate internet networks to partially protect from eclipse attacks. This is the second to last step to remove our temporary introducer and migrate to DNS introducers with peer gossip modeled directly off of Bitcoin. This adds a new database of valid peer nodes that will persist across node restarts. This also makes changes to config.yaml's contents. -- For 'git clone' installs there is now a separate install-gui.sh which speeds up running install.sh for those who wish to run headless and makes docker and other automation simpler. -- The rate limited wallet library now supports coin aggregation for adding additional funds after the time of creation. -- Fees are now used in all applicable rate limited wallet calls -- New parameters for plotting: -r (number of threads) -s (stripe size) -u (number of buckets) in cli and GUI -- chiavdf now has full IFMA optimizations for processors that support it. - -### Changed - -- Multithreading support in chiapos, as well as a new algorithm which is faster and does 70% less IO. This is a significant improvement in speed, much lower total writing, and configurability for different hardware environments. -- Default -b changed to 3072 to improve performance -- The correct amount of memory is used for plotting -- `sh install.sh` was upgraded so that on Ubuntu it will install any needed OS dependencies. -- Wallet and puzzlehash generation have been refactored and simplified. -- Wallet has had various sync speed ups added. -- The rpc interfaces of all chia services have been refactored, simplified, and had various additional functionality added. -- Block timestamps are now stored in the wallet database. Both database versions were incremented and databases from previous versions will not work with Beta 14. However, upon re-sync all test chia since Beta 12 should appear in your wallet. -- All vestigial references to plots.yaml have been removed. - -### Fixed - -- Temporary space required for each k size was updated with more accurate estimates. -- Tables in the README.MD were not rendering correctly on Pypi. Thanks again @altendky. -- Chiapos issue where memory was spiking and increasing -- Fixed working space estimates so they are exact -- Log all errors in chiapos -- Fixed a bug that was causing Bluebox vdfs to fail. - -## [1.0beta13] aka Beta 1.13 - 2020-09-15 - -### Added - -### Changed - -- Long_description_content_type is now set to improve chia-blockchian's Pypi entry. Thanks to @altendky for this pull request. -- A minor edit was made to clarify that excessive was only related to trolling in the Code of Conduct document. - -### Fixed - -- When starting the GUI from an installer or the command line on Linux, if you had not previously generated a key on your machine, the generate new key GUI would not launch and you would be stuck with a spinner. -- Farmer display now correctly displays balance. - -## [1.0beta12] aka Beta 1.12 - 2020-09-14 - -### Added - -- Rate limited wallets can now have unspent and un-spendable funds clawed back by the Admin wallet. -- You can now backup your wallet related metadata in an encrypted and signed file to a free service from Chia Network at backup.chia.net. Simply having a backup of your private key will allow you to fully restore the state of your wallet including coloured coins, rate limited wallets, distributed identity wallets and many more. Your private key is used to automatically restore the last backup you saved to the Chia backup cloud service. This service is open source and ultimately you will be able to configure your backups to go to backup.chia.net, your own installation, or a third party's version of it. -- Added a Code of Conduct in CODE_OF_CONDUCT.md. -- Added a bug report template in `.github/ISSUE_TEMPLATE/bug_report.md`. - -### Changed - -- This is a new blockchain as we changed how the default puzzle hashes are generated and previous coins would not be easy to spend. Plots made with Beta 8 and newer continue to work, but all previous test chia are left on the old chain and do not migrate over. Configuration data like plot directories automatically migrate in your `~/.chia` directory. -- Proof of Space now requires significantly less temp space to generate a new plot. A k=32 that used to require 524GiB now requires only 313GiB - generally a 40% decrease across all k sizes. -- When plotting, instead of 1 monolithic temp file, there are now 8 files - one for each of the 7 tables and one for sorting plot data. These files are deleted as the `-2` or `-d` final file is written so the final file can fit within the footprint of the temporary files on the same filesystem. -- We've made various additional CPU optimizations to the Proof of Space plotter that reduces plotting time by an additional 13%. These changes will also reduce CPU utilization in harvesting. -- We have ruled out k=30 for mainnet minimum plot size. k=31 may still make mainnet. k=32 and larger will be viable on mainnet. -- We moved to react-styleguidist to develop reusable components in isolation and better document the UI. Thanks to @embiem for this pull request. -- Coloured coins have been updated to simplify them, remove 'a', and stop using an 'auditor'. -- clvm has been significantly changed to support the new coloured coins implementation. -- Bumped cryptography to 3.1. Cryptography is now publishing ARM64 binary wheels to PyPi so Raspberry Pi installs should be even easier. -- `chia init` now automatically discovers previous releases in each new release. - -### Fixed - -- `chia show -w` should now more reliably work. Wallet balances should be more often correct. -- View -> Developer -> Developer Tools now correctly opens the developer tools. Thank you to @roxaaams for this pull request! -- Fixed 'Receive Address' typo in Wallet. Thanks @meurtn on Keybase. -- Fixed a typo in `chia show -w` with thanks to @pyl on Keybase. -- In Windows the start menu item is now Chia Network and the icon in Add/Remove is updated. - -## [1.0beta11] aka Beta 1.11 - 2020-08-24 - -### Added - -- The Chia UI now has a proper About menu entry that gives the various component versions and directs people to submit issues on GitHub. Thank you to @freddiecoleman for this pull request! -- Ability to run only the farmer, wallet, or timelord services, for more advanced configurations (chia run farmer-only, wallet-only, timelord-only) - -### Changed - -- To complement the new About menu, we have revamped all Electron menus and made them OS native. There are now direct links to the Wiki, Keybase, and FAQ in the Help menu. -- There are minor improvements to how working space is calculated and displayed by the plotter. The plotter also has additional debugging information in its output. -- Successful plots only have an atomic rename. - -### Fixed - -- kOffsetSize should have been 10 bits and not 9. This was causing plots, especially larger plots, to fail with "Error 0". This bug was introduced in Beta 8 with the new plot file format. -- A bug in aiosqlite was causing tests to hang - especially on the ci. This may also have been causing wallet database corruption. -- `chia show -w` now correctly outputs all wallet types and balances from the local wallet. - -## [1.0beta10] aka Beta 1.10 - 2020-08-18 - -### Added - -- Meet our new Rate Limited wallet. You can now fund a wallet from an Admin wallet that will set how many coins can be spent over a given range of blocks for a given User wallet. Once combined with on chain wallet recovery, this makes it much easier to secure your "spending money" wallet so that if it is compromised you have time to get most of the funds back before an attacker can steal them all. This wallet should be considered alpha in this release as additional fixes and functionality will be coming in subsequent releases. -- We've added unhardened HD keys to bls-signatures for the smart wallets that need them. We've added significant cross project testing to our BLS implementation. -- The python implementation of bls-signatures is now current to the new specification. -- `chia show -b` now returns plot public key and pool public key for each block. -- Added cbor2 binary wheels for ARM64 to the Chia simple site. Raspberry Pi should be just a little easier to install. - -### Changed - -- Wallet addresses and other key related elements are now expressed in Chech32 which is the Chia implementation of [Bech32](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki). All of your old wallet addresses will be replaced with the new Chech32 addresses. The only thing you can't do is send test chia between 1.8/1.9 and 1.10 software. Anyone who upgrades to 1.10 will keep their transactions and balances of test chia from the earlier two releases however. -- We added a first few enhancements to plotting speed. For a k=30 on a ramdisk with `-b 64 GiB` it results in an 11% speedup in overall plotting speed and a 23% improvement in phase 1 speed. Many more significant increases in plotting speed are in the works. -- The proof of space document in chiapos has been updated to the new format and edited for clarity. Additionally GitHub actions now has the on demand ability to create the PDF version. -- Relic has upstreamed our changes required for the IETF BLS standard. We now build directly from the Relic repository for all but Windows and will be migrating Windows in the next release. -- Minor improvements to the Coloured Coin wallet were integrated in advance of an upcoming re-factor. -- Smart wallet backup was upgraded to encrypt and sign the contents of the backup. - -### Fixed - -- Proof of space plotting now correctly calculates the total working space used in the `-t` directory. -- `chia show -w` now displays a message when balances cannot be displayed instead of throwing an error. Thanks to @freddiecoleman for this fix! -- Fix issue with shutting down full node (full node processes remained open, and caused a spinner when launching Chia) -- Various code review alerts for comparing to a wider type in chiapos were fixed. Additionally, unused code was removed from chiapos -- Benchmarking has been re-enabled in bls-signatures. -- Various node security vulnerabilities were addressed. -- Updated keyring, various GitHub actions, colorlog, cbor2, and clvm_tools. - -## [1.0beta9] aka Beta 1.9 - 2020-07-27 - -### Added - -- See wallet balances in command line: `chia show -w` -- Retry opening invalid plots every 20 minutes (so you can copy a large plot into a plot directory.) -- We've added `chia keys sign` and `chia keys verify` to allow farmers to certify their ownership of keys. -- Windows BLS Signature library now uses libsodium for additional security. -- You can now backup and restore Smart Wallet metadata. -- Binary wheels for ARM64/aarch64 also build for python 3.7. -- See and remove plot directories from the UI and command line. -- You can now specify the memory buffer in UI. -- Optimized MPIR for Sandybridge and Ivybridge CPUs under Windows - -### Changed - -- `chia start wallet-server` changed to `chia start wallet`, for consistency. -- All data size units are clarified to displayed in GiB instead of GB (powers of 1024 instead of 1000.) -- Better error messages for restoring wallet from mnemonic. - -### Fixed - -- Fixed open_connection not being cancelled when node exits. -- Increase the robustness of node and wallet shutdown. -- Handle disconnection and reconnection of hard drives properly. -- Addressed pre-Haswell Windows signatures failing. -- MacOS, Linux x64, and Linux aarch64 were not correctly compiling libsodium in -the blspy/bls-signatures library. -- Removed outdated "200 plots" language from Plot tab. -- Fixed spelling error for "folder" on Plot tab. -- Various node dependency security vulnerabilities have been fixed. -- Request peers was not returning currently connected peers older than 1 day. -- Fixed timeout exception inheritance changes under python 3.8 (pull 13528) - -### Deprecated - -- Removed legacy scripts such as chia-stop-server, chia-restart-harvester, etc. - -## [1.0beta8] aka Beta 1.8 - 2020-07-16 - -### Added - -- We have released a new plot file format. We believe that plots made in this -format and with these IETF BLS keys will work without significant changes on -mainnet at launch. -- We now use [chacha8](https://cr.yp.to/chacha.html) and -[blake3](https://github.com/BLAKE3-team/BLAKE3) for proof of space instead of -the now deprecated AES methods. This should increase plotting speed and support -more processors. -- Plot refreshing happens during all new challenges and only new/modified files -are read. -- Updated [blspy](https://github.com/Chia-Network/bls-signatures) to use the -new [IETF standard for BLS signatures](https://tools.ietf.org/html/draft-irtf-cfrg-bls-signature-02). -- Added a faster VDF process which generates n-wesolowski proofs quickly -after the VDF result is known. This requires a high number of CPUs. To use it, -set timelord.fast_algorithm = True in the config file. -- Added a new type of timelord helper - blue boxes, which generate compact -proofs of time for existing proven blocks. This helps reducing the database -size and speeds up syncing a node for new users joining the network. Full nodes -send 100 random un-compact blocks per hour to blue boxes, and if -timelord.sanitizer_mode = True, the blue box timelord will work on those -challenges. Unlike the main timelord, average machines can run blue boxes -and contribute to the chain. Expect improvements to the install method for -blue boxes in future releases. -- From the UI you can add a directory that harvester will always check for -existing and new plots. Harvester will only look in the specific directory you -specify so you'll have to add any subfolders you want to also contain plots. -- The UI now asks for confirmation before closing and shows shutdown progress. -- UI now tries to shut down servers gracefully before exiting, and also closes -the daemon before starting. -- The various sub repositories (chiapos, chiavdf, etc.) now build ARM64 binary -wheels for Linux with Python 3.8. This makes installing on Ubuntu 20.04 lts on -a Raspberry Pi 3 or 4 easy. -- Ci's check to see if they have secret access and attempt to fail cleanly so -that ci runs successfully complete from PRs or forked repositories. -- Farmer now sends challenges after a handshake with harvester. -- The bls-signatures binary wheels include libsodium on all but Windows which -we expect to add in future releases. -- The chia executable is now available if installing from the Windows or MacOS -Graphical installer. Try `./chia -h` from -`~\AppData\Local\Chia-Blockchain\app-0.1.8\resources\app.asar.unpacked\daemon\` -in Windows or -`/Applications/Chia.app/Contents/Resources/app.asar.unpacked/daemon` on MacOS. - -### Changed - -- Minor changes have been made across the repositories to better support -compiling on OpenBSD. HT @n1000. -- Changed XCH units to TXCH units for testnet. -- A push to a branch will cancel all ci runs still running for that branch. -- Ci's now cache pip and npm caches between runs. -- Improve test speed with smaller discriminants, less blocks, less keys, and -smaller plots. -- RPC servers and clients were refactored. -- The keychain no longer supports old keys that don't have mnemonics. -- The keychain uses BIP39 for seed derivation, using the "" passphrase, and -also stores public keys. -- Plots.yaml has been replaced. Plot secret keys are stored in the plots, - and a list of directories that harvester can find plots in are in config.yaml. -You can move plots around to any directory in config.yaml as long as the farmer -has the correct farmer's secret key too. -- Auto scanning of plot directories for .plot files. -- The block header format was changed (puzzle hashes and pool signature). -- Coinbase and fees coin are now in merkle set, and bip158 filter. -- New harvester protocol with 2/2 harvester and farmer signatures, and modified -farmer and full node protocols. -- 255/256 filter which allows virtually unlimited plots per harvester or drive. -- Improved create_plots and check_plots scripts, which are now -"chia plots create" and "chia plots check". -- Add plot directories to config.yaml from the cli with "chia plots add". -- Use real plot sizes in UI instead of a formula/ -- HD keys now use EIP 2333 format instead of BIP32, for compatibility with -other chains. -- Keys are now derived with the EIP 2334 (m/12381/8444/a/b). -- Removed the ability to pass in sk_seed to plotting, to increase security. -- Linux builds of chiavdf and blspy now use a fresh build of gmp 6.2.1. - -### Fixed - -- uPnP now works on Windows. -- Log rotation should now properly rotate every 20MB and keep 7 historical logs. -- Node had a significant memory leak under load due to an extraneous fork -in the network code. -- Skylake processors on Windows without AVX would fail to run. -- Harvester no longer runs into 512 maximum file handles open issue on Windows. -- The version generator for new installers incorrectly handled the "dev" -versions after a release tag. -- Due to a python bug, ssl connections could randomly fail. Worked around -[Python issue 29288](https://bugs.python.org/issue29288) -- Removed websocket max message limit, allowing for more plots -- Daemon was crashing when websocket gets improperly closed - -### Deprecated - -- All keys generated before Beta 1.8 are of an old format and no longer useful. -- All plots generated before Beta 1.8 are no longer compatible with testnet and -should be deleted. - -### Known Issues - -- For Windows users on pre Haswell CPUs there is a known issue that causes -"Given G1 element failed g1_is_valid check" when attempting to generate -keys. This is a regression from our previous fix when it was upstreamed into -relic. We will make a patch available for these systems shortly. - -## [1.0beta7] aka Beta 1.7 - 2020-06-08 - -### Added - -- Added ability to add plot from filesystem (you will need pool_pk and sk from plots.yaml.) -- Added ability to import private keys in the UI. -- Added ability to see private keys and mnemonic seeds in the keys menu -- User can specify log level in the config file (defaults to info.) -- The Windows installer is now signed by a Chia Network certificate. It may take some time to develop enough reputation to not warn multiple times during install. - -### Changed - -- Plots are now refreshed in the UI after each plot instead of at the end of plotting. -- We have made performance improvements to plotting speed on all platforms. -- The command line plotter now supports specifying it's memory buffer size. -- Test plots for the simulation and testing harness now go into `~/.chia/test-plots/` -- We have completely refactored all networking code towards making each Chia service use the same default networking infrastructure and move to websockets as the default networking wire protocol. -- We added additional improvements and more RPCs to the start daemon and various services to continue to make chia start/stop reliable cross platform. -- The install.sh script now discovers if it's running on Ubuntu less than 20.04 and correctly upgrades node.js to the current stable version. -- For GitHub ci builds of the Windows installer, editbin.exe is more reliably found. -- All installer ci builds now obtain version information automatically from setuptools_scm and convert it to an installer version number that is appropriate for the platform and type of release (dev versus release.) -- We now codesign the Apple .dmg installer with the Chia Network developer ID on both GitHub Actions and Azure Pipelines. We will be notarizing and distributing the Azure Pipelines version as it's built on MacOS Mojave (10.14.6) for stronger cross version support. - -### Fixed - -- Having spaces in the path to a plot or temporary directory caused plotting to fail. -- Changing keys will no longer interrupt plotting log. -- 1.6 introduced a bug where certain very many core machines would sync the blockchain very slowly. -- The plotter log in the UI should scroll more reliably. -- The plotter UI should display the correct log on all platforms -- Starting chia now waits for the full node to be active before contacting the introducer. - -## [1.0beta6] aka Beta 1.6 - 2020-06-01 - -### Added - -- Windows and MacOS now have one click installers that then send users to a GUI on both platforms to farm or use their wallets. Windows is built on GitHub Actions and MacOS is also built on Azure Pipelines so as to build on Mojave. -- You can see and control your farmer, harvester, and plotter from the GUI on Windows, MacOS, and Linux. -- Create plots and see the plotting log from a GUI on Windows, MacOS, and Linux. -- You can now create or import private keys with a 24 word mnemonic, both in the UI and 'chia keys' command line. -- You can delete and change active keys from the GUI and cli. -- We added a new keychain system that replaces keys.yaml, and migrates existing users from keys.yaml. It utilizes each OS's keychain for slightly more secure key storage. -- We added a `chia keys` command line program, to see, add, and remove private keys. -- We added RPC servers and RPC client implementations for Farmer and Harvester. The new UI uses these for additional information and functionality. -- We added total network storage space estimation to the node RPC at the `/get_network_space` endpoint instead of only being available in the cli. The RPC endpoint takes two block header hashes and estimates space between those header hashes. -- Logs now autorotate. Once the debug.log reaches 20MB it is compressed and archived keeping 7 historical 20MB logs. -- We now have a CHANGELOG.md that adheres closely to the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) standard. We merged in the version history and updated some previous release notes to capture items important to the change log. We are modifying our release process to accumulate changes at the top of the change log and then copy those to the release notes at the time of the release. -- We added [lgtm](https://lgtm.com/) source analysis on pull request to the chia-blockchain, chiapos, chiavdf, chiabip158, and bls-library repositories to add some automated security analysis to our ci. - -### Changed - -- Due to an issue with aggsig and aggsig-me, the beta 1.6 blockchain is not compatible with earlier chains. -- We replaced the Electron/JavaScript interface with a React user interface which is cleaner and more responsive. -- We now have a multithreaded harvester to farm more plots concurrently. This is especially faster when there are multiple disks being harvested. The class is also made thread safe with mutex guards. This is achieved by releasing GIL in the python bindings when fetching qualities and proofs. We estimate that the former guidance of only 50 plots per physical drive should be updated to 250-350 plots per physical drive. We will continue to improve the plots per physical drive limit during the beta period. -- Syncing a node is now much faster and uses less memory. -- `chia netspace` has been refactored to use the `/get_network_space` RPC. The command - syntax has changed slightly. By default it calculates the last 24 blocks from the - current LCA. Optionally you can use the `-b` flag to start the calculation from a different block - height. Use `-d` to specify the delta number of blocks back into history to estimate over from either LCA or your `-b` block height. -- The Full node RPC response formats have been changed. All API calls now return a dict with success, and an additional value, for example {"success": True, "block": block}. -- chiapos is now easier to compile with MSVC. -- create plots now takes in an optional sk_seed, it is no longer read in from keys.yaml. If not passed in, it is randomly generated. The -i argument can now only be used when you provide an sk_seed. -- Moved to PyYAML 5.3.1 which prevents arbitrary code execution during python/object/new constructor. -- Moved to Python cryptography 2.9.2 which deprecates OpenSSL 1.0.1 and now relies upon OpenSSL 1.1.1g. -- Moved to aiosqlite 0.13.0 which adds official support for Python 3.8 and fixes a possible hung thread if a connection failed. - -### Fixed - -- In beta 1.5 we introduced a bug in aggsig and aggsig-me that we have fixed in this release. That forced a hard fork of the chain so coins and balances are lost from beta 1.5. There is no impact on existing plots. -- Starting and stopping servers now works much more reliably. -- `chia-check-plots` uses the plot root and checks the plots in the same manner as harvester. -- `chia-check-plots` now does not override plots.yaml, which means concurrent plots will properly be added to plots.yaml. -- Fixed and issue where [Relic](https://github.com/relic-toolkit/relic) and thus blspy would crash on processors older than Haswell as they don't support lzc. -- Some non-critical networking errors are no longer logged. -- Blocks with compact proofs of time are now able to be updated into the node database. -- The `install-timelord.sh` script now correctly determines which version of python it is running under and correctly builds vdf_client and correctly links to vdf_bench. It also handles upgrading CMake on Ubuntu's older than 20.04LTS do satisfy the new CMake 3.14+ requirement to build Timelord. -- An issue in asyncio was not being caught correctly and that could cause nodes to crash. -- The build status shield layout is fixed in README.md -- Raspberry Pi 3/4 with Ubuntu 20.04LTS 64 bit should compile again. - -## [1.0beta5] aka Beta 1.5 - 2020-05-05 - -### Added - -- This release is primarily a maintenance release for Beta 1.4. -- We have added an option to `chia-create-plots` to specify the second temporary directory. Creating a plot is a three step process. First a working file ending in `.dat.tmp` is created. This file is usually 5 times larger than the final plot file. In the later stages of plotting a second temp file is created ending in `.dat.2.tmp` which will grow to the size of the final plot file. In the final step, the `.dat.2.tmp` is copied to the final `.dat` plot file. You can now optionally set the directory for the `.dat.2.tmp` file with the `-2` flag. An example use case is plotting on a ramdisk and writing both the second temp file and the final file out to an SSD - `chia-create-plots -n 1 -k 30 -t /mnt/ramdisk -2 /mnt/SSD -d /mnt/SSD`. - -### Changed - -- `chia init` properly migrates from previous versions including the k>=32 workaround. Additionally, the farming target key is checked to make sure that it is the valid and correct public key format. -- We have implemented a workaround for the `chia start` issues some were having upon crash or reboot. We will be rebuilding start and stop to be robust across platforms. -- This release re-includes `chia-start-harvester`. -- Coloured coins now have a prefix to help identify them. When sending transactions, the new prefix is incompatible with older clients. -- The user interface now refers to chia coins with their correct currency code of XCH. -- The next release will now be in the dev branch instead of the e.g. beta-1.5. Additionally we are enforcing linear merge into dev and prefer rebase merges or partial squash merges of particularly chatty commit histories. -- Building the sub reposities (chiapos, chiavdf, blslibrary) now requires CMake 3.14+. - -### Fixed - -- There was a regression in Chia Proof of Space ([chiapos](https://github.com/Chia-Network/chiapos)) that came from our efforts to speed up plotting on Windows native. Now k>=32 plots work correctly. We made additional bug fixes and corrected limiting small k size generation. -- There was a bug in Timelord handling that could stop all VDF progress. - -### Deprecated - -- We have made significant changes to the full node database to make it more reliable and quicker to restart. This requires re-syncing the current chain. If you use `chia init` then sync on first start will happen automatically. "\$CHIA_ROOT" users will need to delete `$CHIA_ROOT/db/*` before starting Beta 1.5. This also fixes the simulation issue in Beta 1.4 where tips could go "back in time." - -### Known issues - -- uPnP support on Windows may be broken. However, Windows nodes will be able to connect to other nodes and, once connected, participate fully in the network. -- Currently, there is no way to restore a Coloured Coin Wallet. - -## [1.0beta4] aka Beta 1.4 - 2020-04-29 - -### Added - -- This release adds Coloured coin support with offers. Yes that is the correct spelling. Coloured coins allow you to issue a coin, token, or asset with nearly unlimited issuance plans and functionality. They support inner smart transactions so they can inherit any of the other functionality you can implement in Chialisp. Offers are especially cool as they create a truly decentralized exchange capability. Read much more about them in Bram's [blog post on Coloured coins](https://chia.net/2020/04/29/coloured-coins-launch.en.html). -- This release adds support for native Windows via a (mostly) automated installer and MacOS Mojave. Windows still requires some PowerShell command line use. You should expect ongoing improvements in ease of install and replication of the command line tools in the GUI. Again huge thanks to @dkackman for continued Windows installer development. Native Windows is currently slightly slower than the same version running in WSL 2 on the same machine for both block verification and plotting. -- We made some speed improvements that positively affected all platforms while trying to increase plotting speed in Windows. -- The graphical Full Node display now shows the expected finish times of each of the prospective chain tips. -- Now you can run estimates of the total space currently farming the network. Try `chia netspace -d 12` to run an estimate over the last 12 blocks which is approximately 1 hour. -- We’ve added TLS authentication for incoming farmer connections. TLS certs and keys are generated during chia init and only full nodes with your keys will be able to connect to your Farmer. Also, Harvester, Timelord, and Wallet will now not accept incoming connections which reduces the application attack surface. -- The node RPC has a new endpoint get_header_by_height which allows you to retrieve the block header from a block height. Try `chia show -bh 1000` to see the block header hash of block 1000. You can then look up the block details with `chia show -b f655e1a9f7f8c89a703e40d9ce82ae33508badaf7b37fa1a56cad27926b5e936` which will look up a block by it's header hash. -- Our Windows binaries check the processor they are about to run on at runtime and choose the best processor optimizations for our [MPIR](http://mpir.org/) VDF dependency on Windows. -- Most of the content of README.md and INSTALL.md have been moved to the [repository wiki](https://github.com/Chia-Network/chia-blockchain/wiki) and placed in [INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL) and [Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide) -- Harvester is now asynchronous and will better be able to look up more plots spread across more physical drives. -- Full node startup time has been sped up significantly by optimizing the loading of the blockchain from disk. - -### Changed - -- Most scripts have been removed in favor of chia action commands. You can run `chia version` or `chia start node` for example. Just running `chia` will show you more options. However `chia-create-plots` continues to use the hyphenated form. Also it's now `chia generate keys` as another example. -- Chia start commands like `chia start farmer` and `chia stop node` now keep track of process IDs in a run/ directory in your configuration directory. `chia stop` is unlikely to work on Windows native for now. If `chia start -r node` doesn't work you can force the run/ directory to be reset with `chia start -f node`. -- We suggest you take a look at our [Upgrading documentation](https://github.com/Chia-Network/chia-blockchain/wiki/Updating-beta-software) if you aren't performing a new install. -- blspy now has libsodium included in the MacOS and Linux binary wheels. -- miniupnpc and setprotitle were dynamically checked for an installed at runtime. Removed those checks and we rely upon the install tools installing them before first run. -- Windows wheels that the Windows Installer packages are also available in the ci Artifacts in a .zip file. -- The script `chia start wallet-gui` has been chaned to `chia start wallet` which launches but the GUI and server on MacOS and Linux. `chia start wallet-server` remains for WSL 2 and Windows native. - -### Deprecated - -- This release breaks the wire protocol so it comes with a new chain. As we merged in Coloured coins we found that we needed to change how certain hashes were managed. Your 1.0beta3 coin balances will be lost when you upgrade but your plots will continue to work on the 1.0beta4 chain. Since we had to make a breaking wire protocol change we accelerated changing our hash to prime function for starting proofs of time. That was also going to be a future breaking change. - -### Known issues - -- Plots of k>=32 are not working for farming, and some broken plots can cause a memory leak. A [workaround is available](https://github.com/Chia-Network/chia-blockchain/wiki/Beta-1.4-k=32-or-larger-work-around). -- If you are running a simulation, blockchain tips are not saved in the database and this is a regression. If you stop a node it can go back in time and cause an odd state. This doesn't practically effect testnet participation as, on restart, node will just sync up a few blocks to the then current tips. -- uPnP support on Windows may be broken. However, Windows nodes will be able to connect to other nodes and, once connected, participate fully in the network. -- Coins are not currently reserved as part of trade offers and thus could potentially be spent before the offer is accepted resulting in a failed offer transaction. -- Currently, there is no way to restore a Coloured Coin Wallet. -- The `chia stop all` command sometimes fails, use `chia-stop-all` instead. In windows, use the task manager to stop the servers. - -## [1.0beta3] aka Beta 1.3 - 2020-04-08 - -### Added - -- Windows, WSL 2, Linux and MacOS installation is significantly streamlined. There is a new Windows installer for the Wallet GUI (huge thanks to @dkackman). -- All installs can now be from the source repository or just the binary dependencies on WSL 2, most modern Linuxes, and MacOS Catalina. Binary support is for both Python 3.7 and 3.8. -- There is a new migration tool to move from Beta1 (or 2) to Beta3. It should move everything except your plots. -- There is a new command `chia init` that will migrate files and generate your initial configuration. If you want to use the Wallet or farm, you will also have to `chia-generate-keys`. You can read step by step instructions for [upgrading from a previous beta release](https://github.com/Chia-Network/chia-blockchain/wiki/Updating-beta-software). If you've set `$CHIA_ROOT` you will have to make sure your existing configuration remains compatible manually. -- Wallet has improved paper wallet recovery support. -- We now also support restoring old wallets with only the wallet_sk and wallet_target. Beta3's Wallet will re-sync from scratch. -- We've made lots of little improvements that should speed up node syncing -- We added full block lookup to `chia show`. - -### Changed - -- `chia-restart-harvester` has been renamed from `chia-start-harvester` to better reflect its functionality. Use it to restart a harvester that's farming so that it will pick up newly finished plots. -- We made the Wallet configurable to connect to a remote trusted node. -- We now have farmers reconnect to their trusted node if they lose contact. -- We updated our miniupnpc dependency to version 2.1. -- We increase the default farmer propagate threshold to reduce chain stall probability. - -### Deprecated - -- You should not copy over any prior Wallet database as they are not compatible with Beta3. Your existing full node will not have to re-sync and its database remains compatible. - -#### Fixed - -- Among a lot of bug fixes was removing a regression that slowed plotting on MacOS by 3 times and may have had smaller impacts on plotting speed on other platforms. -- We've removed some race conditions in the Wallet -- We resolved the "invalid blocks could disconnect farmers" bug -- We and upped the default tls certificate size to 2048 for some unhappy operating systems. - -### Known issues - -- Windows native is close but not here yet. Also, we should be adding back MacOS Mojave support shortly. -- So why is this Beta 3 you're wondering? Well, we're getting used to our new release management tools and a hotfix devoured our beta2 nomenclature... We've marked it YANKED here. -- If you previously used the plot_root variable in config, your plot directory names might not migrate correctly. Please double check the filenames in `~/.chia/beta-1.0b3/config/plots.yaml` after migrating - -## [1.0beta2] aka Beta 1.2 - 2020-04-04 [YANKED] - -## [1.0beta1] aka Beta 1.0 - 2020-04-02 - -### Added - -- There is now full transaction support on the Chia blockchain. In this initial Beta 1.0 release, all transaction types are supported though the wallets and UIs currently only directly support basic transactions like coinbase rewards and sending coins while paying fees. UI support for our [smart transactions](https://github.com/Chia-Network/wallets/blob/main/README.md) will be available in the UIs shortly. -- Wallet and Node GUI’s are available on Windows, Mac, and desktop Linux platforms. We now use an Electron UI that is a full light client wallet that can also serve as a node UI. Our Windows Electron Wallet can run standalone by connecting to other nodes on the network or another node you run. WSL 2 on Windows can run everything except the Wallet but you can run the Wallet on the native Windows side of the same machine. Also the WSL 2 install process is 3 times faster and *much* easier. Windows native node/farmer/plotting functionality are coming soon. -- Install is significantly easier with less dependencies on all supported platforms. -- If you’re a farmer you can use the Wallet to keep track of your earnings. Either use the same keys.yaml on the same machine or copy the keys.yaml to another machine where you want to track of and spend your coins. -- We have continued to make improvements to the speed of VDF squaring, creating a VDF proof, and verifying a VDF proof. - -### Changed - -- We have revamped the chia management command line. To start a farmer all you have to do is start the venv with `. ./activate` and then type `chia-start-farmer &`. The [README.md](https://github.com/Chia-Network/chia-blockchain/blob/main/README.md) has been updated to reflect the new commands. -- We have moved all node to node communication to TLS 1.3 by default. For now, all TLS is unauthenticated but certain types of over the wire node to node communications will have the ability to authenticate both by certificate and by inter protocol signature. Encrypting over the wire by default stops casual snooping of transaction origination, light wallet to trusted node communication, and harvester-farmer-node communication for example. This leaves only the mempool and the chain itself open to casual observation by the public and the various entities around the world. -- Configuration directories have been moved to a default location of HomeDirectory/.chia/release/config, plots/ db/, wallet/ etc. This can be overridden by `export CHIA_ROOT=~/.chia` for example which would then put the plots directory in `HomeDirectory/.chia/plots`. -- The libraries chia-pos, chia-fast-vdf, and chia-bip-158 have been moved to their own repositories: [chiapos](https://github.com/Chia-Network/chiapos), [chiavdf](https://github.com/Chia-Network/chiavdf), and [chaibip158](https://github.com/Chia-Network/chiabip158). They are brought in by chia-blockchain at install time. Our BLS signature library remains at [bls-signatures](https://github.com/Chia-Network/bls-signatures). -- The install process now brings in chiapos, chiavdf, etc from Pypi where they are auto published via GitHub Actions ci using cibuildwheel. Check out `.github/workflows/build.yml` for build methods in each of the sub repositories. -- `chia-regenerate-keys` has been renamed `chia-generate-keys`. -- setproctitle is now an optional install dependency that we will continue to install in the default install methods. -- The project now defaults to `venv` without the proceeding . to better match best practices. -- Developer requirements were separated from the actual requirements. -- `install-timelord.sh` has been pulled out from `install.sh`. This script downloads the source python package for chiavdf and compiles it locally for timelords. vdf_client can be included or excluded to make building normal user wheels easier. - -### Removed - -- The Beta release is not compatible with the history of the Alpha blockchain and we will be ceasing support of the Alpha chain approximately two weeks after the release of this Beta. However, your plots and keys are fully compatible with the Beta chain. Please save your plot keys! Examples of how to save your keys and upgrade to the Beta are available on the [repo wiki](https://github.com/Chia-Network/chia-blockchain/wiki). -- The ssh ui and web ui are removed in favor of the cli ui and the Electron GUI. To mimic the ssh ui try `chia show -s -c` and try `chia show --help` for usage instructions. -- We have removed the inkfish vdf implementation and replaced it with the pybind11 C++ version. - -### Known Issues - -- Wallet currently has limited support for restoring from a paper wallet. Wallet uses hierarchically deterministic keys, and assumes that any keys that are at index "higher than one" have not been used yet. If you have received a payment to an address associated with a key at a higher index and you want it to appear in Wallet, the current work around is to press the "NEW ADDRESS" button multiple times shortly after sync start. That will make wallet "aware of" addresses at higher indexes. Full support for paper wallet restoration will be added soon. -- We. Don't... Have.. Windows.... Native. YET!?! But the entire project is compiling on Windows 10 natively. Assistance would be more than appreciated if you have experience building binary python wheels for Windows. We are pushing some limits like uint-128, avx-2, avx-512, and AES-NI so it's not as easy as it looks... - -## [Alpha 1.5.1] - 2020-03-24 - -### Fixed - -- Fixed a bug in harvester that caused plots not to be farmed. - -## [Alpha 1.5] - 2020-03-08 - -### Added - -- You can now provide an index to create_plots using the -i flag to create an arbitrary new plot derived from an existing plot key. Thanks @xorinox. -- There is a new restart_harvester.sh in scripts/ to easily restart a harvester when you want to add a newly completed plot to the farm without restarting farmer, fullnode, timelord, etc. -- Harvesters now log errors if they encounter a malformed or corrupted plot file. Again thanks @xorinox. -- New AJAX based full node UI. To access go to [http://127.0.0.1:8555/index.html](http://127.0.0.1:8555/index.html) with any modern web browser on the same machine as the full node. -- If you want to benchmark your CPU as a VDF you can use vdf_bench square_asm 500000 for the assembly optimized test or just vdf_bench square 500000 for the plain C++ code path. This tool is found in lib/chiavdf/fast_vdf/. -- Improvements to shutting down services in all of the scripts in scripts/. Another @xorinox HT. - -### Changed - -- VDF verification code is improved and is now more paranoid. -- Timelords can now be run as a cluster of VDF client instances around a central Timelord instance.. Instructions are available in the Cluster Timelord section of the repo wiki. - -### Fixed - -- Thanks @dkackman for clean ups to the proof of space code. -- Thanks to @davision for some typo fixes. - -## [Alpha 1.4.1] - 2020-03-06 - -### Fixed - -- Stack overflow in verifier - -## [Alpha 1.4] - 2020-02-19 - -### Added - -- Compiling and execution now detect AES-NI, or a lack of it, and fall back to a software AES implementation. -- Software AES adds support for Raspberry Pi 4, related ARM processors and Celeron processors. -- Added install instructions for CentOS/RHEL 8.1. -- Plotting working directory and final directory can both be specified in config.yaml -- Proof of space binary and create_plots scripts now allows passing in temp and final directories. -- Plotting now logs a timestamp at each major step. -- Added support for Python 3.8. - -### Changed - -- Due to changes to the sqlite database that are not backwards compatible, re-synch will be required. -- Loading the blockchain only loads headers into memory instead of header blocks (header + proofs), speeds up the startup, and reduces normal operation memory usage by 80%. -- Memory access is now synchronous to reduce use of locks and speed up block processing. -- Chia fullnode, farmer and harvester now default to logging to chia.log in the chia-blockchain directory. This is configured in config.yaml and due to config.yaml changes it is recommended to edit the new template config instead of using older config.yaml’s from previous versions. -- uvloop is now an optional add on. -- Harvester/farmer will not try to farm plots that they don’t have the key for. - -### Fixed - -- Thanks to @A-Caccese for fixes to Windows WSL instructions. -- Thanks @dkackman who also fixed some compiler warnings. - -## [Alpha 1.3] - 2020-01-21 - -### Added - -- FullNode performance improvements - Syncing up to the blockchain by importing all blocks is faster due to improvements in VDF verification speed and multithreading block verification. -- VDF improvements - VDF verification and generation speed has increased and dependence on flint2 has been removed. We wish to thank Dr. William Hart (@wbhart) for dual licensing parts of his contributions in FLINT and Antic for inclusion in the Chia blockchain. -- Implemented an RPC interface with JSON serialization for streamables - currently on port 8555. -- Added details on how to contribute in CONTRIBUTING.md. Thanks @RichardLitt. -- Added color logging -- Now chia_harvester will periodically announce which plots it is currently farming and their k sizes. - -### Changed - -- Moved the ssh UI to use RPC. -- Changed the displayed process names for harvester, farmer, fullnode, timelords, and VDFs to to chia_full node, chia_harvester, etc. Fixed a bug that could cause inadvertent shutdown of other processes like an ongoing plotting session when new chia services were started. -- Clarified the minimum version of boost required to build timelord/VDFs. Hat tip @AdrianScott -- Consensus and related documentation moved to the repository wiki. - -### Fixed - -- Fixed a bug where the node may not sync if it restarts close to a tip. -- Fixed a typo in the UI. Hat tip to @lvcivs for the pr. -- Fixed a memory leak in qfb_nudupl. -- Lots of smaller bug and documentation fixes. - -### Removed - -- Mongodb removed and replaced with SQLite for the blockchain database. This will require nodes to re-sync with the network. Luckily this is now faster. - -## [Alpha 1.2] - 2020-01-08 - -### Added - -- Performance improvements - - Removes database access from blockchain, and handles headers instead of blocks - - Avoid processing blocks and unfinished blocks that we have already seen. - - Also adds test for load. - -### Changed - -- Improvements to plotting via lookup table - as much as 15% faster - -### Fixed - -- Fixed a blockchain initialization bug - -## [Alpha 1.1.1] - 2019-12-25 - -### Added - -- Added install instructions for Windows using WSL and Ubuntu. -- Added install instructions for CentOS 7.7. -- Added install instructions for Amazon Linux 2. -- New install_timelord.sh. - -### Changed - -- Installation is now separated into everything except timelord/vdf and timelord/vdf. -- replaced VDF server compilation scripts with Makefile - -### Fixed - -- setuptools_scm was corrupting .zip downloads of the repository. - -## [Alpha 1.1] - 2019-12-12 - -### Added - -- Introducer now makes sure it only sends peer addresses to peers of peers that it can reach on port 8444 or their UPnP port. -- We are now using setuptools_scm for versioning. - -### Changed - -- Timelord VDF submission and management logic upgraded. - -### Fixed - -- FullNode: A long running or low ulimit situation could cause an “out of files” issue which would stop new connection creation. Removed the underlying socket leak. -- FullNode: Multiple SSH UI bugs fixed. -- Harvester: Farming a plot of k = 30 or greater could lead to a segfault in the harvester. -- Updated blspy requirement to address an issue in the underlying bls-signatures library. - -## [Alpha 1.0] - 2019-12-05 - -### Added - -- This is the first release of the Chia testnet! Blockchain consensus, proof of time, and proof of space are included. -- More details on the release at [https://www.chia.net/developer/](https://www.chia.net/developer/) - -[unreleased]: https://github.com/Chia-Network/chia-blockchain/compare/1.0beta5...dev -[1.0beta5]: https://github.com/Chia-Network/chia-blockchain/compare/1.0beta4...1.0beta5 -[1.0beta4]: https://github.com/Chia-Network/chia-blockchain/compare/1.0beta3...1.0beta4 -[1.0beta3]: https://github.com/Chia-Network/chia-blockchain/compare/1.0beta2...1.0beta3 -[1.0beta2]: https://github.com/Chia-Network/chia-blockchain/compare/1.0beta1...1.0beta2 -[1.0beta1]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.5.1...1.0beta1 -[alpha 1.5.1]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.5...alpha-1.5.1 -[alpha 1.5]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.4.1...alpha-1.5 -[alpha 1.4.1]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.4...alpha-1.4.1 -[alpha 1.4]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.3...alpha-1.4 -[alpha 1.3]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.2...alpha-1.3 -[alpha 1.2]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.1.1...alpha-1.2 -[alpha 1.1.1]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.1...alpha-1.1.1 -[alpha 1.1]: https://github.com/Chia-Network/chia-blockchain/compare/alpha-1.0...alpha-1.1 -[alpha 1.0]: https://github.com/Chia-Network/chia-blockchain/releases/tag/Alpha-1.0 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 899890623..0ad6e0656 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at legal@chia.net. All +reported by contacting the project team at legal@flaxnetwork.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4833b3b0b..05005a782 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,13 @@ # Introduction -Welcome to the chia-blockchain project! -We are happy that you are taking a look at the code for Chia, a proof of space and time cryptocurrency. +Welcome to the flax-blockchain project! +We are happy that you are taking a look at the code for Flax, a proof of space and time cryptocurrency. A lot of fascinating new cryptography and blockchain concepts are used and implemented here. -This repo includes the code for the Chia full node, farmer, and timelord (in chia folder), which are all written in python. -It also includes a verifiable delay function implementation that it imports from the [chiavdf repo](https://github.com/Chia-Network/chiavdf) (in c/c++), and a proof of space implementation that it imports from the [chiapos repo](https://github.com/Chia-Network/chiapos). BLS signatures are imported from the [bls-signatures repo](https://github.com/Chia-Network/bls-signatures) as blspy. There is an additional dependency on the [chiabip158 repo](https://github.com/Chia-Network/chiabip158). For major platforms, binary and source wheels are shipped to PyPI from each dependent repo. Then chia-blockchain can pip install those from PyPI or they can be prepackaged as is done for the Windows installer. On unsupported platforms, pip will fall back to the source distributions, to be compiled locally. +This repo includes the code for the Flax full node, farmer, and timelord (in flax folder), which are all written in python. +It also includes a verifiable delay function implementation that it imports from the [chiavdf repo](https://github.com/Flax-Network/chiavdf) (in c/c++), and a proof of space implementation that it imports from the [chiapos repo](https://github.com/Flax-Network/chiapos). BLS signatures are imported from the [bls-signatures repo](https://github.com/Flax-Network/bls-signatures) as blspy. There is an additional dependency on the [chiabip158 repo](https://github.com/Flax-Network/chiabip158). For major platforms, binary and source wheels are shipped to PyPI from each dependent repo. Then flax-blockchain can pip install those from PyPI or they can be prepackaged as is done for the Windows installer. On unsupported platforms, pip will fall back to the source distributions, to be compiled locally. -If you want to learn more about this project, read the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki), or check out the [green paper](https://www.chia.net/assets/ChiaGreenPaper.pdf). +If you want to learn more about this project, read the [wiki](https://github.com/Flax-Network/flax-blockchain/wiki), or check out the [green paper](https://www.flaxnetwork.org/assets/FlaxGreenPaper.pdf). ## Contributions @@ -19,13 +19,13 @@ You can visit our [Trello project board](https://trello.com/b/ZuNx7sET) to get a Generally, things to the left are in progress or done. Some things go through "Coming up soon", but some will come directly out of other columns. Usually, the things closer to the top of each column are the ones that will be worked on soonest. If you are interested in cryptography, math, or just like hacking in python, there are many interesting problems to work on. -Contact any of the team members on [Keybase](https://keybase.io/team/chia_network.public), which we use as the main communication method. You can also comment on any Trello card. +Contact any of the team members on [Discord](https://discord.gg/yEWaF6CQcA), which we use as the main communication method. You can also comment on any Trello card. We ask that external contributors create a fork of the `main` branch for any feature work they wish to take on. -Members of the Chia organization may create feature branches from the `main` branch. +Members of the Flax organization may create feature branches from the `main` branch. -In the event an emergency fix is required for the release version of Chia, members of the Chia organization will create a feature branch from the current release branch `latest`. +In the event an emergency fix is required for the release version of Flax, members of the Flax organization will create a feature branch from the current release branch `latest`. ## Branching Strategy @@ -34,7 +34,7 @@ In the event an emergency fix is required for the release version of Chia, membe 1. All changes go into the main branch. 2. Main is stable at all times, all tests pass. 3. Features (with tests) are developed and fully tested on feature branches, and reviewed before landing in main. -4. Chia Network's nodes on the public testnet are running the latest version `x.y.z`. +4. Flax Network's nodes on the public testnet are running the latest version `x.y.z`. 5. The `main` branch will have a long running `beta testnet` to allow previewing of changes. 6. Pull Request events may require a `beta testnet` review environment. At the moment this is at the discretion of the reviewer. 7. Hotfixes land in the release branch they fix, and all later versions. (This will be achieved by regularly merging from `1.3.x` to main). @@ -53,7 +53,7 @@ to configure how the tests are run. For example, for more logging: change the lo ```bash sh install.sh -d . ./activate -black . && isort benchmarks build_scripts chia tests tools *.py && mypy && flake8 benchmarks build_scripts chia tests tools *.py && pylint benchmarks build_scripts chia tests tools *.py +black . && isort benchmarks build_scripts flax tests tools *.py && mypy && flake8 benchmarks build_scripts flax tests tools *.py && pylint benchmarks build_scripts flax tests tools *.py py.test tests -v --durations 0 ``` @@ -67,7 +67,7 @@ If you want verbose logging for tests, edit the `tests/pytest.ini` file. ## Pre-Commit -We provide a [pre-commit configuration](https://github.com/Chia-Network/chia-blockchain/blob/main/.pre-commit-config.yaml) which triggers several useful +We provide a [pre-commit configuration](https://github.com/Flax-Network/flax-blockchain/blob/main/.pre-commit-config.yaml) which triggers several useful hooks (including linters/formatter) before each commit you make if you installed and set up [pre-commit](https://pre-commit.com/). This will help to reduce the time you spend on failed CI jobs. @@ -83,7 +83,7 @@ provided configuration with `pre-commit install`. 4. Preferences > Settings > Python > Linting > flake8 enabled 5. Preferences > Settings > Python > Linting > mypy enabled 6. Preferences > Settings > Formatting > Python > Provider > black -7. Preferences > Settings > mypy > Targets: set to `./chia` and `./tests` +7. Preferences > Settings > mypy > Targets: set to `./flax` and `./tests` ## Configure Pycharm @@ -99,19 +99,19 @@ workflow. It's also especially efficient for git branching, cherry-picking, comm ## Testnets and review environments -The current official testnet is testnet10. Look at `chia/util/initial_config.yaml` to see the configuration parameters +The current official testnet is testnet10. Look at `flax/util/initial_config.yaml` to see the configuration parameters for each testnet. Information on how to use the testnet can be found in the wiki. Prior to proposing changes to `main`, proposers should consider if running a `beta testnet` review environment will make the reviewer more effective when evaluating a change. Changes that impact the blockchain could require a review environment before acceptance into `main`. This is at the discretion of the reviewer. -Chia organization members have been granted CI access to deploy `beta testnets`. -If you are not a Chia organization member, you can enquire about deploying a `beta testnet` in the public dev Keybase channel. +Flax organization members have been granted CI access to deploy `beta testnets`. +If you are not a Flax organization member, you can enquire about deploying a `beta testnet` in the public dev Discord channel. ## Submit changes To propose changes, please make a pull request to the `main` branch. See Branching Strategy above. -To propose changes for the production releases of Chia, please make a pull request to the latest release branch. +To propose changes for the production releases of Flax, please make a pull request to the latest release branch. ## Copyright diff --git a/INSTALL.md b/INSTALL.md index 37814ef86..8156df944 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,7 +1,7 @@ # Installation -Install instructions have been moved to the [INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL) section of the repository [Wiki](https://github.com/Chia-Network/chia-blockchain/wiki). +Install instructions have been moved to the [INSTALL](https://github.com/Flax-Network/flax-blockchain/wiki/INSTALL) section of the repository [Wiki](https://github.com/Flax-Network/flax-blockchain/wiki). After installing, follow the remaining instructions in the -[Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide) +[Quick Start Guide](https://github.com/Flax-Network/flax-blockchain/wiki/Quick-Start-Guide) to run the software. diff --git a/Install-gui.ps1 b/Install-gui.ps1 index 502797a2c..7b548ecd6 100644 --- a/Install-gui.ps1 +++ b/Install-gui.ps1 @@ -3,7 +3,7 @@ $SUBMODULE_BRANCH = $args[0] if ($null -eq (Get-ChildItem env:VIRTUAL_ENV -ErrorAction SilentlyContinue)) { - Write-Output "This script requires that the Chia Python virtual environment is activated." + Write-Output "This script requires that the Flax Python virtual environment is activated." Write-Output "Execute '.\venv\Scripts\Activate.ps1' before running." Exit 1 } @@ -28,18 +28,18 @@ if ( $SUBMODULE_BRANCH ) { Push-Location try { - Set-Location chia-blockchain-gui + Set-Location flax-blockchain-gui $ErrorActionPreference = "SilentlyContinue" - npm ci --loglevel=error + npm install --loglevel=error npm audit fix npm run build py ..\installhelper.py Write-Output "" - Write-Output "Chia blockchain Install-gui.ps1 completed." + Write-Output "Flax blockchain Install-gui.ps1 completed." Write-Output "" - Write-Output "Type 'cd chia-blockchain-gui' and then 'npm run electron' to start the GUI." + Write-Output "Type 'cd flax-blockchain-gui' and then 'npm run electron' to start the GUI." } finally { Pop-Location } diff --git a/Install-plotter.ps1 b/Install-plotter.ps1 index 0cc237c35..ad4230646 100644 --- a/Install-plotter.ps1 +++ b/Install-plotter.ps1 @@ -56,10 +56,10 @@ function get_madmax_filename() [string]$arch ) - $chia_plot = "chia_plot" + $flax_plot = "flax_plot" if ("${ksize}" -eq "k34") { - $chia_plot = "chia_plot_k34" + $flax_plot = "flax_plot_k34" } $suffix = "" if ("${os}" -eq "macos") @@ -75,7 +75,7 @@ function get_madmax_filename() $suffix = "-${arch}" } - "${chia_plot}-${ver}${suffix}" + "${flax_plot}-${ver}${suffix}" } function get_madmax_url() @@ -102,7 +102,7 @@ $ARCH = "x86-64" if ($null -eq (Get-ChildItem env:VIRTUAL_ENV -ErrorAction SilentlyContinue)) { - Write-Output "This script requires that the Chia Python virtual environment is activated." + Write-Output "This script requires that the Flax Python virtual environment is activated." Write-Output "Execute '.\venv\Scripts\Activate.ps1' before running." Exit 1 } @@ -159,9 +159,9 @@ try { $URL = get_madmax_url -ksize k32 -ver "${VERSION}" -os "${OS}" -arch "${ARCH}" Write-Output "Fetching binary from: ${URL}" try { - Invoke-WebRequest -Uri "$URL" -Outfile "chia_plot.exe" + Invoke-WebRequest -Uri "$URL" -Outfile "flax_plot.exe" Write-Output "Successfully downloaded: $URL" - Write-Output "Successfully installed madmax to $(Get-Location)\chia_plot.exe" + Write-Output "Successfully installed madmax to $(Get-Location)\flax_plot.exe" } catch { Write-Output "ERROR: Download failed. Maybe specified version of the binary does not exist." @@ -173,9 +173,9 @@ try { $URL = get_madmax_url -ksize k34 -ver "${VERSION}" -os "${OS}" -arch "${ARCH}" Write-Output "Fetching binary from: ${URL}" try { - Invoke-WebRequest -Uri "$URL" -Outfile "chia_plot_k34.exe" + Invoke-WebRequest -Uri "$URL" -Outfile "flax_plot_k34.exe" Write-Output "Successfully downloaded: $URL" - Write-Output "Successfully installed madmax for k34 to $(Get-Location)\chia_plot_k34.exe" + Write-Output "Successfully installed madmax for k34 to $(Get-Location)\flax_plot_k34.exe" } catch { Write-Output "madmax for k34 is not found" diff --git a/Install.ps1 b/Install.ps1 index d8efb28a8..476e88bd7 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -15,7 +15,7 @@ if ($d) if ([Environment]::Is64BitOperatingSystem -eq $false) { - Write-Output "Chia requires a 64-bit Windows installation" + Write-Output "Flax requires a 64-bit Windows installation" Exit 1 } @@ -118,13 +118,13 @@ if ($p) } Write-Output "" -Write-Output "Chia blockchain .\Install.ps1 complete." -Write-Output "For assistance join us on Keybase in the #support chat channel:" -Write-Output "https://keybase.io/team/chia_network.public" +Write-Output "Flax blockchain .\Install.ps1 complete." +Write-Output "For assistance join us on Discord in the #support chat channel:" +Write-Output "https://discord.gg/yEWaF6CQcA" Write-Output "" -Write-Output "Try the Quick Start Guide to running chia-blockchain:" -Write-Output "https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide" +Write-Output "Try the Quick Start Guide to running flax-blockchain:" +Write-Output "https://github.com/Flax-Network/flax-blockchain/wiki/Quick-Start-Guide" Write-Output "" Write-Output "To install the GUI type '.\Install-gui.ps1' after '.\venv\scripts\Activate.ps1'." Write-Output "" -Write-Output "Type '.\venv\Scripts\Activate.ps1' and then 'chia init' to begin." +Write-Output "Type '.\venv\Scripts\Activate.ps1' and then 'flax init' to begin." diff --git a/README.md b/README.md index a88926b9c..782ca0506 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,3 @@ -# chia-blockchain +# flax-blockchain -![Alt text](https://www.chia.net/wp-content/uploads/2022/09/chia-logo.svg) - -| Current Release/main | Development Branch/dev | -| :---: | :---: | -| [![Ubuntu Core Tests](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-ubuntu-core.yml/badge.svg)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-ubuntu-core.yml) [![MacOS Core Tests](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-macos-core.yml/badge.svg)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-macos-core.yml) [![Windows Installer on Windows 10 and Python 3.7](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-windows-installer.yml/badge.svg)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-windows-installer.yml) | [![Ubuntu Core Tests](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-ubuntu-core.yml/badge.svg?branch=dev)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-ubuntu-core.yml) [![MacOS Core Tests](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-macos-core.yml/badge.svg?branch=dev)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-test-macos-core.yml) [![Windows Installer on Windows 10 and Python 3.7](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-windows-installer.yml/badge.svg?branch=dev)](https://github.com/Chia-Network/chia-blockchain/actions/workflows/build-windows-installer.yml) | - -![GitHub contributors](https://img.shields.io/github/contributors/Chia-Network/chia-blockchain?logo=GitHub) - -Chia is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. Here are some of the features and benefits: -* [Proof of space and time](https://docs.google.com/document/d/1tmRIb7lgi4QfKkNaxuKOBHRmwbVlGL4f7EsBDr_5xZE/edit) based consensus which allows anyone to farm with commodity hardware -* Very easy to use full node and farmer GUI and cli (thousands of nodes active on mainnet) -* [Chia seeder](https://github.com/Chia-Network/chia-blockchain/wiki/Chia-Seeder-User-Guide), which maintains a list of reliable nodes within the Chia network via a built-in DNS server. -* Simplified UTXO based transaction model, with small on-chain state -* Lisp-style Turing-complete functional [programming language](https://chialisp.com/) for money related use cases -* BLS keys and aggregate signatures (only one signature per block) -* [Pooling protocol](https://github.com/Chia-Network/chia-blockchain/wiki/Pooling-User-Guide) that allows farmers to have control of making blocks -* Support for light clients with fast, objective syncing -* A growing community of farmers and developers around the world - -Please check out the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki) -and [FAQ](https://github.com/Chia-Network/chia-blockchain/wiki/FAQ) for -information on this project. - -Python 3.7+ is required. Make sure your default python version is >=3.7 -by typing `python3`. - -If you are behind a NAT, it can be difficult for peers outside your subnet to -reach you when they start up. You can enable -[UPnP](https://www.homenethowto.com/ports-and-nat/upnp-automatic-port-forward/) -on your router or add a NAT (for IPv4 but not IPv6) and firewall rules to allow -TCP port 8444 access to your peer. -These methods tend to be router make/model specific. - -Most users should only install harvesters, farmers, plotter, full nodes, and wallets. -Setting up a seeder is best left to more advanced users. -Building Timelords and VDFs is for sophisticated users, in most environments. -Chia Network and additional volunteers are running sufficient Timelords -for consensus. - -## Installing - -Install instructions are available in the -[INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL) -section of the -[chia-blockchain repository wiki](https://github.com/Chia-Network/chia-blockchain/wiki). - -## Running - -Once installed, a -[Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide) -is available from the repository -[wiki](https://github.com/Chia-Network/chia-blockchain/wiki). +**Flax** is a modern community-centric green cryptocurrency based on a proof-of-space-and-time consensus algorithm. It is a community-supported fork of the [Chia Network](https://github.com/Chia-Network/chia-blockchain) codebase. diff --git a/activated.py b/activated.py old mode 100755 new mode 100644 diff --git a/activated.sh b/activated.sh old mode 100755 new mode 100644 diff --git a/benchmarks/block_ref.py b/benchmarks/block_ref.py index 00968c8ad..db6164a2e 100644 --- a/benchmarks/block_ref.py +++ b/benchmarks/block_ref.py @@ -11,15 +11,15 @@ import aiosqlite import click -from chia.consensus.blockchain import Blockchain -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_version import lookup_db_version -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint32 +from flax.consensus.blockchain import Blockchain +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_version import lookup_db_version +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint32 # the first transaction block. Each byte in transaction_height_delta is the # number of blocks to skip forward to get to the next transaction block diff --git a/benchmarks/block_store.py b/benchmarks/block_store.py index 1a6304930..ebb837aa0 100644 --- a/benchmarks/block_store.py +++ b/benchmarks/block_store.py @@ -20,18 +20,18 @@ ) from benchmarks.utils import clvm_generator -from chia.consensus.block_record import BlockRecord -from chia.full_node.block_store import BlockStore -from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.full_block import FullBlock -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint8, uint32, uint64, uint128 +from flax.consensus.block_record import BlockRecord +from flax.full_node.block_store import BlockStore +from flax.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.full_block import FullBlock +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint8, uint32, uint64, uint128 NUM_ITERS = 20000 diff --git a/benchmarks/clvm_generator.bin b/benchmarks/clvm_generator.bin index 140b6edea47cecd7608bf2d7544799e9925087c4..9d25906dafce20c825e52b43b74eed0e86d7dbd9 100644 GIT binary patch delta 22 ecmX@UmHqfu_J%EtTo+l=auO@H^Ic@z$q4{)2?-wn delta 22 ecmX@UmHqfu_J%EtTo+lAGcpsm^Ic@z$q4{(W(f%Z diff --git a/benchmarks/coin_store.py b/benchmarks/coin_store.py index 3591bd1f8..d34a25453 100644 --- a/benchmarks/coin_store.py +++ b/benchmarks/coin_store.py @@ -10,11 +10,11 @@ from utils import rand_hash, rewards, setup_db -from chia.full_node.coin_store import CoinStore -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint32, uint64 +from flax.full_node.coin_store import CoinStore +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint32, uint64 NUM_ITERS = 200 diff --git a/benchmarks/mempool.py b/benchmarks/mempool.py index ca4bd79bb..0529b1056 100644 --- a/benchmarks/mempool.py +++ b/benchmarks/mempool.py @@ -9,19 +9,19 @@ from utils import setup_db -from chia.consensus.block_record import BlockRecord -from chia.consensus.coinbase import create_farmer_coin, create_pool_coin -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.full_node.coin_store import CoinStore -from chia.full_node.mempool_manager import MempoolManager -from chia.simulator.wallet_tools import WalletTool -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32, bytes100 -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.spend_bundle import SpendBundle -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint8, uint32, uint64, uint128 +from flax.consensus.block_record import BlockRecord +from flax.consensus.coinbase import create_farmer_coin, create_pool_coin +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.full_node.coin_store import CoinStore +from flax.full_node.mempool_manager import MempoolManager +from flax.simulator.wallet_tools import WalletTool +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32, bytes100 +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.spend_bundle import SpendBundle +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint8, uint32, uint64, uint128 NUM_ITERS = 100 NUM_PEERS = 5 diff --git a/benchmarks/streamable.py b/benchmarks/streamable.py index b3fb6829a..232f56156 100644 --- a/benchmarks/streamable.py +++ b/benchmarks/streamable.py @@ -11,10 +11,10 @@ import click from utils import EnumType, get_commit_hash, rand_bytes, rand_full_block, rand_hash -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.util.ints import uint8, uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.util.ints import uint8, uint64 +from flax.util.streamable import Streamable, streamable _version = 1 diff --git a/benchmarks/utils.py b/benchmarks/utils.py index f344403f8..762e0a74c 100644 --- a/benchmarks/utils.py +++ b/benchmarks/utils.py @@ -12,20 +12,20 @@ import click from blspy import AugSchemeMPL, G1Element, G2Element -from chia.consensus.coinbase import create_farmer_coin, create_pool_coin -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock -from chia.types.blockchain_format.sized_bytes import bytes32, bytes100 -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.full_block import FullBlock -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint8, uint32, uint64, uint128 +from flax.consensus.coinbase import create_farmer_coin, create_pool_coin +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock +from flax.types.blockchain_format.sized_bytes import bytes32, bytes100 +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.full_block import FullBlock +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint8, uint32, uint64, uint128 # farmer puzzle hash ph = bytes32(b"a" * 32) diff --git a/build_scripts/assets/deb/control.j2 b/build_scripts/assets/deb/control.j2 index 29e9d2678..fe29e1541 100644 --- a/build_scripts/assets/deb/control.j2 +++ b/build_scripts/assets/deb/control.j2 @@ -1,6 +1,6 @@ -Package: chia-blockchain-cli -Version: {{ CHIA_INSTALLER_VERSION }} +Package: flax-blockchain-cli +Version: {{ FLAX_INSTALLER_VERSION }} Architecture: {{ PLATFORM }} -Maintainer: Chia Network Inc -Description: Chia Blockchain - Chia is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. +Maintainer: Flax Network Inc +Description: Flax Blockchain + Flax is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. diff --git a/build_scripts/assets/deb/postinst.sh b/build_scripts/assets/deb/postinst.sh index b4c226651..d3377d4d4 100644 --- a/build_scripts/assets/deb/postinst.sh +++ b/build_scripts/assets/deb/postinst.sh @@ -3,4 +3,4 @@ set -e -ln -s /opt/chia/resources/app.asar.unpacked/daemon/chia /usr/bin/chia || true +ln -s /opt/flax/resources/app.asar.unpacked/daemon/flax /usr/bin/flax || true diff --git a/build_scripts/assets/deb/prerm.sh b/build_scripts/assets/deb/prerm.sh index c4df691d5..0e87e5f72 100644 --- a/build_scripts/assets/deb/prerm.sh +++ b/build_scripts/assets/deb/prerm.sh @@ -3,4 +3,4 @@ set -e -unlink /usr/bin/chia || true +unlink /usr/bin/flax || true diff --git a/build_scripts/assets/rpm/postinst.sh b/build_scripts/assets/rpm/postinst.sh index 6e6d7f00c..10a77cda4 100644 --- a/build_scripts/assets/rpm/postinst.sh +++ b/build_scripts/assets/rpm/postinst.sh @@ -3,4 +3,4 @@ set -e -ln -s /opt/chia/resources/app.asar.unpacked/daemon/chia /usr/bin/chia || true +ln -s /opt/flax/resources/app.asar.unpacked/daemon/flax /usr/bin/flax || true diff --git a/build_scripts/assets/rpm/prerm.sh b/build_scripts/assets/rpm/prerm.sh index 210e44c86..878345142 100644 --- a/build_scripts/assets/rpm/prerm.sh +++ b/build_scripts/assets/rpm/prerm.sh @@ -3,4 +3,4 @@ set -e -unlink /usr/bin/chia || true +unlink /usr/bin/flax || true diff --git a/build_scripts/build_linux_deb-1-gui.sh b/build_scripts/build_linux_deb-1-gui.sh index 406fac957..43f5d536e 100644 --- a/build_scripts/build_linux_deb-1-gui.sh +++ b/build_scripts/build_linux_deb-1-gui.sh @@ -4,17 +4,17 @@ set -o errexit echo "Installing global npm packages" cd npm_linux || exit 1 -npm ci +npm install PATH=$(npm bin):$PATH cd ../../ || exit 1 -git submodule update --init chia-blockchain-gui +git submodule update --init flax-blockchain-gui -cd ./chia-blockchain-gui || exit 1 +cd ./flax-blockchain-gui || exit 1 echo "npm build" lerna clean -y -npm ci +npm install # Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663 # npm audit fix npm run build @@ -27,9 +27,9 @@ fi # Remove unused packages rm -rf node_modules -# Other than `chia-blockchain-gui/package/gui`, all other packages are no longer necessary after build. +# Other than `flax-blockchain-gui/package/gui`, all other packages are no longer necessary after build. # Since these unused packages make cache unnecessarily fat, here unused packages are removed. -echo "Remove unused @chia packages to make cache slim" +echo "Remove unused @flax packages to make cache slim" ls -l packages rm -rf packages/api rm -rf packages/api-react @@ -44,5 +44,5 @@ rm -rf electron/dist # ~186MB rm -rf "@mui" # ~71MB rm -rf typescript # ~63MB -# Remove `packages/gui/node_modules/@chia` because it causes an error on later `electron-packager` command -rm -rf "@chia" +# Remove `packages/gui/node_modules/@flax` because it causes an error on later `electron-packager` command +rm -rf "@flax" diff --git a/build_scripts/build_linux_deb-2-installer.sh b/build_scripts/build_linux_deb-2-installer.sh index 24ab2e518..d9a5880fd 100644 --- a/build_scripts/build_linux_deb-2-installer.sh +++ b/build_scripts/build_linux_deb-2-installer.sh @@ -18,16 +18,16 @@ git submodule # If the env variable NOTARIZE and the username and password variables are # set, this will attempt to Notarize the signed DMG -if [ ! "$CHIA_INSTALLER_VERSION" ]; then - echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0." - CHIA_INSTALLER_VERSION="0.0.0" +if [ ! "$FLAX_INSTALLER_VERSION" ]; then + echo "WARNING: No environment variable FLAX_INSTALLER_VERSION set. Using 0.0.0." + FLAX_INSTALLER_VERSION="0.0.0" fi -echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION" -export CHIA_INSTALLER_VERSION +echo "Flax Installer Version is: $FLAX_INSTALLER_VERSION" +export FLAX_INSTALLER_VERSION echo "Installing npm and electron packagers" cd npm_linux || exit 1 -npm ci +npm install PATH=$(npm bin):$PATH cd .. || exit 1 @@ -36,7 +36,7 @@ rm -rf dist mkdir dist echo "Create executables with pyinstaller" -SPEC_FILE=$(python -c 'import chia; print(chia.PYINSTALLER_SPEC_PATH)') +SPEC_FILE=$(python -c 'import flax; print(flax.PYINSTALLER_SPEC_PATH)') pyinstaller --log-level=INFO "$SPEC_FILE" LAST_EXIT_CODE=$? if [ "$LAST_EXIT_CODE" -ne 0 ]; then @@ -47,27 +47,27 @@ fi # Builds CLI only .deb # need j2 for templating the control file pip install j2cli -CLI_DEB_BASE="chia-blockchain-cli_$CHIA_INSTALLER_VERSION-1_$PLATFORM" -mkdir -p "dist/$CLI_DEB_BASE/opt/chia" +CLI_DEB_BASE="flax-blockchain-cli_$FLAX_INSTALLER_VERSION-1_$PLATFORM" +mkdir -p "dist/$CLI_DEB_BASE/opt/flax" mkdir -p "dist/$CLI_DEB_BASE/usr/bin" mkdir -p "dist/$CLI_DEB_BASE/DEBIAN" j2 -o "dist/$CLI_DEB_BASE/DEBIAN/control" assets/deb/control.j2 -cp -r dist/daemon/* "dist/$CLI_DEB_BASE/opt/chia/" -ln -s ../../opt/chia/chia "dist/$CLI_DEB_BASE/usr/bin/chia" +cp -r dist/daemon/* "dist/$CLI_DEB_BASE/opt/flax/" +ln -s ../../opt/flax/flax "dist/$CLI_DEB_BASE/usr/bin/flax" dpkg-deb --build --root-owner-group "dist/$CLI_DEB_BASE" # CLI only .deb done -cp -r dist/daemon ../chia-blockchain-gui/packages/gui +cp -r dist/daemon ../flax-blockchain-gui/packages/gui # Change to the gui package -cd ../chia-blockchain-gui/packages/gui || exit 1 +cd ../flax-blockchain-gui/packages/gui || exit 1 -# sets the version for chia-blockchain in package.json +# sets the version for flax-blockchain in package.json cp package.json package.json.orig -jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json +jq --arg VER "$FLAX_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json echo "Building Linux(deb) Electron app" -PRODUCT_NAME="chia" +PRODUCT_NAME="flax" if [ "$PLATFORM" = "arm64" ]; then # electron-builder does not work for arm64 as of Aug 16, 2022. # This is a temporary fix. @@ -83,19 +83,19 @@ if [ "$PLATFORM" = "arm64" ]; then sudo gem install public_suffix -v 4.0.7 sudo gem install fpm echo USE_SYSTEM_FPM=true electron-builder build --linux deb --arm64 \ - --config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Chia Blockchain" \ - --config.deb.packageName="chia-blockchain" + --config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Flax Blockchain" \ + --config.deb.packageName="flax-blockchain" USE_SYSTEM_FPM=true electron-builder build --linux deb --arm64 \ - --config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Chia Blockchain" \ - --config.deb.packageName="chia-blockchain" + --config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Flax Blockchain" \ + --config.deb.packageName="flax-blockchain" LAST_EXIT_CODE=$? else echo electron-builder build --linux deb --x64 \ - --config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Chia Blockchain" \ - --config.deb.packageName="chia-blockchain" + --config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Flax Blockchain" \ + --config.deb.packageName="flax-blockchain" electron-builder build --linux deb --x64 \ - --config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Chia Blockchain" \ - --config.deb.packageName="chia-blockchain" + --config.productName="$PRODUCT_NAME" --config.linux.desktop.Name="Flax Blockchain" \ + --config.deb.packageName="flax-blockchain" LAST_EXIT_CODE=$? fi ls -l dist/linux*-unpacked/resources @@ -108,8 +108,8 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then exit $LAST_EXIT_CODE fi -GUI_DEB_NAME=chia-blockchain_${CHIA_INSTALLER_VERSION}_${PLATFORM}.deb -mv "dist/${PRODUCT_NAME}-${CHIA_INSTALLER_VERSION}.deb" "../../../build_scripts/dist/${GUI_DEB_NAME}" +GUI_DEB_NAME=flax-blockchain_${FLAX_INSTALLER_VERSION}_${PLATFORM}.deb +mv "dist/${PRODUCT_NAME}-${FLAX_INSTALLER_VERSION}.deb" "../../../build_scripts/dist/${GUI_DEB_NAME}" cd ../../../build_scripts || exit 1 echo "Create final installer" diff --git a/build_scripts/build_linux_rpm-1-gui.sh b/build_scripts/build_linux_rpm-1-gui.sh index 64f33c01e..80fc60c3c 100644 --- a/build_scripts/build_linux_rpm-1-gui.sh +++ b/build_scripts/build_linux_rpm-1-gui.sh @@ -4,16 +4,16 @@ set -o errexit echo "Installing global npm packages" cd npm_linux || exit 1 -npm ci +npm install PATH=$(npm bin):$PATH cd ../../ || exit 1 -git submodule update --init chia-blockchain-gui +git submodule update --init flax-blockchain-gui -cd ./chia-blockchain-gui || exit 1 +cd ./flax-blockchain-gui || exit 1 echo "npm build" lerna clean -y -npm ci +npm install # Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663 # npm audit fix npm run build @@ -26,9 +26,9 @@ fi # Remove unused packages rm -rf node_modules -# Other than `chia-blockchain-gui/package/gui`, all other packages are no longer necessary after build. +# Other than `flax-blockchain-gui/package/gui`, all other packages are no longer necessary after build. # Since these unused packages make cache unnecessarily fat, here unused packages are removed. -echo "Remove unused @chia packages to make cache slim" +echo "Remove unused @flax packages to make cache slim" ls -l packages rm -rf packages/api rm -rf packages/api-react @@ -43,5 +43,5 @@ rm -rf electron/dist # ~186MB rm -rf "@mui" # ~71MB rm -rf typescript # ~63MB -# Remove `packages/gui/node_modules/@chia` because it causes an error on later `electron-packager` command -rm -rf "@chia" +# Remove `packages/gui/node_modules/@flax` because it causes an error on later `electron-packager` command +rm -rf "@flax" diff --git a/build_scripts/build_linux_rpm-2-installer.sh b/build_scripts/build_linux_rpm-2-installer.sh index 01d47d735..aa94e788a 100644 --- a/build_scripts/build_linux_rpm-2-installer.sh +++ b/build_scripts/build_linux_rpm-2-installer.sh @@ -17,15 +17,15 @@ fi # If the env variable NOTARIZE and the username and password variables are # set, this will attempt to Notarize the signed DMG -if [ ! "$CHIA_INSTALLER_VERSION" ]; then - echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0." - CHIA_INSTALLER_VERSION="0.0.0" +if [ ! "$FLAX_INSTALLER_VERSION" ]; then + echo "WARNING: No environment variable FLAX_INSTALLER_VERSION set. Using 0.0.0." + FLAX_INSTALLER_VERSION="0.0.0" fi -echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION" +echo "Flax Installer Version is: $FLAX_INSTALLER_VERSION" echo "Installing npm and electron packagers" cd npm_linux || exit 1 -npm ci +npm install PATH=$(npm bin):$PATH cd .. || exit 1 @@ -34,7 +34,7 @@ rm -rf dist mkdir dist echo "Create executables with pyinstaller" -SPEC_FILE=$(python -c 'import chia; print(chia.PYINSTALLER_SPEC_PATH)') +SPEC_FILE=$(python -c 'import flax; print(flax.PYINSTALLER_SPEC_PATH)') pyinstaller --log-level=INFO "$SPEC_FILE" LAST_EXIT_CODE=$? if [ "$LAST_EXIT_CODE" -ne 0 ]; then @@ -43,11 +43,11 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then fi # Builds CLI only rpm -CLI_RPM_BASE="chia-blockchain-cli-$CHIA_INSTALLER_VERSION-1.$REDHAT_PLATFORM" -mkdir -p "dist/$CLI_RPM_BASE/opt/chia" +CLI_RPM_BASE="flax-blockchain-cli-$FLAX_INSTALLER_VERSION-1.$REDHAT_PLATFORM" +mkdir -p "dist/$CLI_RPM_BASE/opt/flax" mkdir -p "dist/$CLI_RPM_BASE/usr/bin" -cp -r dist/daemon/* "dist/$CLI_RPM_BASE/opt/chia/" -ln -s ../../opt/chia/chia "dist/$CLI_RPM_BASE/usr/bin/chia" +cp -r dist/daemon/* "dist/$CLI_RPM_BASE/opt/flax/" +ln -s ../../opt/flax/flax "dist/$CLI_RPM_BASE/usr/bin/flax" # This is built into the base build image # shellcheck disable=SC1091 . /etc/profile.d/rvm.sh @@ -58,36 +58,36 @@ rvm use ruby-3 fpm -s dir -t rpm \ -C "dist/$CLI_RPM_BASE" \ -p "dist/$CLI_RPM_BASE.rpm" \ - --name chia-blockchain-cli \ + --name flax-blockchain-cli \ --license Apache-2.0 \ - --version "$CHIA_INSTALLER_VERSION" \ + --version "$FLAX_INSTALLER_VERSION" \ --architecture "$REDHAT_PLATFORM" \ - --description "Chia is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure." \ + --description "Flax is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure." \ --depends /usr/lib64/libcrypt.so.1 \ . # CLI only rpm done -cp -r dist/daemon ../chia-blockchain-gui/packages/gui +cp -r dist/daemon ../flax-blockchain-gui/packages/gui # Change to the gui package -cd ../chia-blockchain-gui/packages/gui || exit 1 +cd ../flax-blockchain-gui/packages/gui || exit 1 -# sets the version for chia-blockchain in package.json +# sets the version for flax-blockchain in package.json cp package.json package.json.orig -jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json +jq --arg VER "$FLAX_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json echo "Building Linux(rpm) Electron app" OPT_ARCH="--x64" if [ "$REDHAT_PLATFORM" = "arm64" ]; then OPT_ARCH="--arm64" fi -PRODUCT_NAME="chia" +PRODUCT_NAME="flax" echo electron-builder build --linux rpm "${OPT_ARCH}" \ - --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ - --config.rpm.packageName="chia-blockchain" + --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Flax Blockchain" \ + --config.rpm.packageName="flax-blockchain" electron-builder build --linux rpm "${OPT_ARCH}" \ - --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Chia Blockchain" \ - --config.rpm.packageName="chia-blockchain" + --config.productName="${PRODUCT_NAME}" --config.linux.desktop.Name="Flax Blockchain" \ + --config.rpm.packageName="flax-blockchain" LAST_EXIT_CODE=$? ls -l dist/linux*-unpacked/resources @@ -99,8 +99,8 @@ if [ "$LAST_EXIT_CODE" -ne 0 ]; then exit $LAST_EXIT_CODE fi -GUI_RPM_NAME="chia-blockchain-${CHIA_INSTALLER_VERSION}-1.${REDHAT_PLATFORM}.rpm" -mv "dist/${PRODUCT_NAME}-${CHIA_INSTALLER_VERSION}.rpm" "../../../build_scripts/dist/${GUI_RPM_NAME}" +GUI_RPM_NAME="flax-blockchain-${FLAX_INSTALLER_VERSION}-1.${REDHAT_PLATFORM}.rpm" +mv "dist/${PRODUCT_NAME}-${FLAX_INSTALLER_VERSION}.rpm" "../../../build_scripts/dist/${GUI_RPM_NAME}" cd ../../../build_scripts || exit 1 echo "Create final installer" diff --git a/build_scripts/build_macos-1-gui.sh b/build_scripts/build_macos-1-gui.sh index e111bb693..ee8a2ba95 100644 --- a/build_scripts/build_macos-1-gui.sh +++ b/build_scripts/build_macos-1-gui.sh @@ -6,15 +6,15 @@ git status echo "Installing global npm packages" cd npm_macos || exit 1 -npm ci +npm install PATH=$(npm bin):$PATH cd ../../ || exit 1 -git submodule update --init chia-blockchain-gui +git submodule update --init flax-blockchain-gui -cd ./chia-blockchain-gui || exit 1 +cd ./flax-blockchain-gui || exit 1 echo "npm build" lerna clean -y -npm ci +npm install # Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663 # npm audit fix npm run build @@ -27,9 +27,9 @@ fi # Remove unused packages rm -rf node_modules -# Other than `chia-blockchain-gui/package/gui`, all other packages are no longer necessary after build. +# Other than `flax-blockchain-gui/package/gui`, all other packages are no longer necessary after build. # Since these unused packages make cache unnecessarily fat, unused packages should be removed. -echo "Remove unused @chia packages to make cache slim" +echo "Remove unused @flax packages to make cache slim" ls -l packages rm -rf packages/api rm -rf packages/api-react @@ -44,5 +44,5 @@ rm -rf electron/dist # ~186MB rm -rf "@mui" # ~71MB rm -rf typescript # ~63MB -# Remove `packages/gui/node_modules/@chia` because it causes an error on later `electron-packager` command -rm -rf "@chia" +# Remove `packages/gui/node_modules/@flax` because it causes an error on later `electron-packager` command +rm -rf "@flax" diff --git a/build_scripts/build_macos-2-installer.sh b/build_scripts/build_macos-2-installer.sh index 3e639ea77..d6fff7833 100644 --- a/build_scripts/build_macos-2-installer.sh +++ b/build_scripts/build_macos-2-installer.sh @@ -8,15 +8,15 @@ git submodule # If the env variable NOTARIZE and the username and password variables are # set, this will attempt to Notarize the signed DMG. -if [ ! "$CHIA_INSTALLER_VERSION" ]; then - echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0." - CHIA_INSTALLER_VERSION="0.0.0" +if [ ! "$FLAX_INSTALLER_VERSION" ]; then + echo "WARNING: No environment variable FLAX_INSTALLER_VERSION set. Using 0.0.0." + FLAX_INSTALLER_VERSION="0.0.0" fi -echo "Chia Installer Version is: $CHIA_INSTALLER_VERSION" +echo "Flax Installer Version is: $FLAX_INSTALLER_VERSION" echo "Installing npm utilities" cd npm_macos || exit 1 -npm ci +npm install PATH=$(npm bin):$PATH cd .. || exit 1 @@ -25,29 +25,29 @@ sudo rm -rf dist mkdir dist echo "Create executables with pyinstaller" -SPEC_FILE=$(python -c 'import chia; print(chia.PYINSTALLER_SPEC_PATH)') +SPEC_FILE=$(python -c 'import flax; print(flax.PYINSTALLER_SPEC_PATH)') pyinstaller --log-level=INFO "$SPEC_FILE" LAST_EXIT_CODE=$? if [ "$LAST_EXIT_CODE" -ne 0 ]; then echo >&2 "pyinstaller failed!" exit $LAST_EXIT_CODE fi -cp -r dist/daemon ../chia-blockchain-gui/packages/gui +cp -r dist/daemon ../flax-blockchain-gui/packages/gui # Change to the gui package -cd ../chia-blockchain-gui/packages/gui || exit 1 +cd ../flax-blockchain-gui/packages/gui || exit 1 -# sets the version for chia-blockchain in package.json +# sets the version for flax-blockchain in package.json brew install jq cp package.json package.json.orig -jq --arg VER "$CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json +jq --arg VER "$FLAX_INSTALLER_VERSION" '.version=$VER' package.json > temp.json && mv temp.json package.json echo "Building macOS Electron app" OPT_ARCH="--x64" if [ "$(arch)" = "arm64" ]; then OPT_ARCH="--arm64" fi -PRODUCT_NAME="Chia" +PRODUCT_NAME="Flax" if [ "$NOTARIZE" == true ]; then echo "Setting credentials for signing" export CSC_LINK=$APPLE_DEV_ID_APP @@ -59,7 +59,7 @@ fi echo electron-builder build --mac "${OPT_ARCH}" --config.productName="$PRODUCT_NAME" electron-builder build --mac "${OPT_ARCH}" --config.productName="$PRODUCT_NAME" LAST_EXIT_CODE=$? -ls -l dist/mac*/chia.app/Contents/Resources/app.asar +ls -l dist/mac*/flax.app/Contents/Resources/app.asar # reset the package.json to the original mv package.json.orig package.json @@ -73,10 +73,10 @@ mv dist/* ../../../build_scripts/dist/ cd ../../../build_scripts || exit 1 mkdir final_installer -DMG_NAME="chia-${CHIA_INSTALLER_VERSION}.dmg" +DMG_NAME="flax-${FLAX_INSTALLER_VERSION}.dmg" if [ "$(arch)" = "arm64" ]; then - mv dist/${DMG_NAME} dist/chia-${CHIA_INSTALLER_VERSION}-arm64.dmg - DMG_NAME=chia-${CHIA_INSTALLER_VERSION}-arm64.dmg + mv dist/${DMG_NAME} dist/flax-${FLAX_INSTALLER_VERSION}-arm64.dmg + DMG_NAME=flax-${FLAX_INSTALLER_VERSION}-arm64.dmg fi mv dist/$DMG_NAME final_installer/ @@ -85,7 +85,7 @@ ls -lh final_installer if [ "$NOTARIZE" == true ]; then echo "Notarize $DMG_NAME on ci" cd final_installer || exit 1 - notarize-cli --file="$DMG_NAME" --bundle-id net.chia.blockchain \ + notarize-cli --file="$DMG_NAME" --bundle-id net.flax.blockchain \ --username "$APPLE_NOTARIZE_USERNAME" --password "$APPLE_NOTARIZE_PASSWORD" echo "Notarization step complete" else @@ -96,7 +96,7 @@ fi # # Ask for username and password. password should be an app specific password. # Generate app specific password https://support.apple.com/en-us/HT204397 -# xcrun altool --notarize-app -f Chia-0.1.X.dmg --primary-bundle-id net.chia.blockchain -u username -p password +# xcrun altool --notarize-app -f Flax-0.1.X.dmg --primary-bundle-id net.flax.blockchain -u username -p password # xcrun altool --notarize-app; -should return REQUEST-ID, use it in next command # # Wait until following command return a success message". @@ -104,7 +104,7 @@ fi # It can take a while, run it every few minutes. # # Once that is successful, execute the following command": -# xcrun stapler staple Chia-0.1.X.dmg +# xcrun stapler staple Flax-0.1.X.dmg # # Validate DMG: -# xcrun stapler validate Chia-0.1.X.dmg +# xcrun stapler validate Flax-0.1.X.dmg diff --git a/build_scripts/build_windows-1-gui.ps1 b/build_scripts/build_windows-1-gui.ps1 index 22c4d05e2..1b20a570c 100644 --- a/build_scripts/build_windows-1-gui.ps1 +++ b/build_scripts/build_windows-1-gui.ps1 @@ -8,13 +8,13 @@ Write-Output " ---" Write-Output "Setup npm packager" Write-Output " ---" Set-Location -Path ".\npm_windows" -PassThru -npm ci +npm install $Env:Path = $(npm bin) + ";" + $Env:Path Set-Location -Path "..\..\" -PassThru -git submodule update --init chia-blockchain-gui +git submodule update --init flax-blockchain-gui -Set-Location -Path ".\chia-blockchain-gui" -PassThru +Set-Location -Path ".\flax-blockchain-gui" -PassThru Write-Output " ---" Write-Output "Build GUI npm modules" @@ -23,8 +23,8 @@ $Env:NODE_OPTIONS = "--max-old-space-size=3000" Write-Output "lerna clean -y" lerna clean -y -Write-Output "npm ci" -npm ci +Write-Output "npm install" +npm install # Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663 # npm audit fix @@ -39,9 +39,9 @@ If ($LastExitCode -gt 0){ # Remove unused packages Remove-Item node_modules -Recurse -Force -# Other than `chia-blockchain-gui/package/gui`, all other packages are no longer necessary after build. +# Other than `flax-blockchain-gui/package/gui`, all other packages are no longer necessary after build. # Since these unused packages make cache unnecessarily fat, unused packages should be removed. -Write-Output "Remove unused @chia packages to make cache slim" +Write-Output "Remove unused @flax packages to make cache slim" Remove-Item packages\api -Recurse -Force Remove-Item packages\api-react -Recurse -Force Remove-Item packages\core -Recurse -Force @@ -55,5 +55,5 @@ Remove-Item electron\dist -Recurse -Force # ~186MB Remove-Item "@mui" -Recurse -Force # ~71MB Remove-Item typescript -Recurse -Force # ~63MB -# Remove `packages/gui/node_modules/@chia` because it causes an error on later `electron-packager` command -Remove-Item "@chia" -Recurse -Force +# Remove `packages/gui/node_modules/@flax` because it causes an error on later `electron-packager` command +Remove-Item "@flax" -Recurse -Force diff --git a/build_scripts/build_windows-2-installer.ps1 b/build_scripts/build_windows-2-installer.ps1 index f6a8d9f56..17c8c3de8 100644 --- a/build_scripts/build_windows-2-installer.ps1 +++ b/build_scripts/build_windows-2-installer.ps1 @@ -7,29 +7,29 @@ mkdir build_scripts\win_build git status git submodule -if (-not (Test-Path env:CHIA_INSTALLER_VERSION)) { - $env:CHIA_INSTALLER_VERSION = '0.0.0' - Write-Output "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0" +if (-not (Test-Path env:FLAX_INSTALLER_VERSION)) { + $env:FLAX_INSTALLER_VERSION = '0.0.0' + Write-Output "WARNING: No environment variable FLAX_INSTALLER_VERSION set. Using 0.0.0" } -Write-Output "Chia Version is: $env:CHIA_INSTALLER_VERSION" +Write-Output "Flax Version is: $env:FLAX_INSTALLER_VERSION" Write-Output " ---" Write-Output " ---" -Write-Output "Use pyinstaller to create chia .exe's" +Write-Output "Use pyinstaller to create flax .exe's" Write-Output " ---" -$SPEC_FILE = (python -c 'import chia; print(chia.PYINSTALLER_SPEC_PATH)') -join "`n" +$SPEC_FILE = (python -c 'import flax; print(flax.PYINSTALLER_SPEC_PATH)') -join "`n" pyinstaller --log-level INFO $SPEC_FILE Write-Output " ---" -Write-Output "Copy chia executables to chia-blockchain-gui\" +Write-Output "Copy flax executables to flax-blockchain-gui\" Write-Output " ---" -Copy-Item "dist\daemon" -Destination "..\chia-blockchain-gui\packages\gui\" -Recurse +Copy-Item "dist\daemon" -Destination "..\flax-blockchain-gui\packages\gui\" -Recurse Write-Output " ---" Write-Output "Setup npm packager" Write-Output " ---" Set-Location -Path ".\npm_windows" -PassThru -npm ci +npm install $Env:Path = $(npm bin) + ";" + $Env:Path Set-Location -Path "..\..\" -PassThru @@ -43,16 +43,16 @@ Write-Output " ---" $Env:NODE_OPTIONS = "--max-old-space-size=3000" # Change to the GUI directory -Set-Location -Path "chia-blockchain-gui\packages\gui" -PassThru +Set-Location -Path "flax-blockchain-gui\packages\gui" -PassThru Write-Output " ---" -Write-Output "Increase the stack for chia command for (chia plots create) chiapos limitations" +Write-Output "Increase the stack for flax command for (flax plots create) chiapos limitations" # editbin.exe needs to be in the path -editbin.exe /STACK:8000000 daemon\chia.exe +editbin.exe /STACK:8000000 daemon\flax.exe Write-Output " ---" -$packageVersion = "$env:CHIA_INSTALLER_VERSION" -$packageName = "Chia-$packageVersion" +$packageVersion = "$env:FLAX_INSTALLER_VERSION" +$packageName = "Flax-$packageVersion" Write-Output "packageName is $packageName" @@ -60,14 +60,14 @@ Write-Output " ---" Write-Output "fix version in package.json" choco install jq cp package.json package.json.orig -jq --arg VER "$env:CHIA_INSTALLER_VERSION" '.version=$VER' package.json > temp.json +jq --arg VER "$env:FLAX_INSTALLER_VERSION" '.version=$VER' package.json > temp.json rm package.json mv temp.json package.json Write-Output " ---" Write-Output " ---" Write-Output "electron-builder" -electron-builder build --win --x64 --config.productName="Chia" +electron-builder build --win --x64 --config.productName="Flax" Get-ChildItem dist\win-unpacked\resources Write-Output " ---" @@ -75,7 +75,7 @@ If ($env:HAS_SECRET) { Write-Output " ---" Write-Output "Verify signature" Write-Output " ---" - signtool.exe verify /v /pa .\dist\ChiaSetup-$packageVersion.exe + signtool.exe verify /v /pa .\dist\FlaxSetup-$packageVersion.exe } Else { Write-Output "Skipping verify signatures - no authorization to install certificates" } @@ -83,9 +83,9 @@ If ($env:HAS_SECRET) { Write-Output " ---" Write-Output "Moving final installers to expected location" Write-Output " ---" -Copy-Item ".\dist\win-unpacked" -Destination "$env:GITHUB_WORKSPACE\chia-blockchain-gui\Chia-win32-x64" -Recurse -mkdir "$env:GITHUB_WORKSPACE\chia-blockchain-gui\release-builds\windows-installer" -ea 0 -Copy-Item ".\dist\ChiaSetup-$packageVersion.exe" -Destination "$env:GITHUB_WORKSPACE\chia-blockchain-gui\release-builds\windows-installer" +Copy-Item ".\dist\win-unpacked" -Destination "$env:GITHUB_WORKSPACE\flax-blockchain-gui\Flax-win32-x64" -Recurse +mkdir "$env:GITHUB_WORKSPACE\flax-blockchain-gui\release-builds\windows-installer" -ea 0 +Copy-Item ".\dist\FlaxSetup-$packageVersion.exe" -Destination "$env:GITHUB_WORKSPACE\flax-blockchain-gui\release-builds\windows-installer" Write-Output " ---" Write-Output "Windows Installer complete" diff --git a/build_scripts/clean-runner.sh b/build_scripts/clean-runner.sh index 6aba280b1..b1a874a58 100644 --- a/build_scripts/clean-runner.sh +++ b/build_scripts/clean-runner.sh @@ -7,15 +7,15 @@ PWD=$(pwd) rm -rf ../venv || true rm -rf venv || true -rm -rf chia_blockchain.egg-info || true +rm -rf flax_blockchain.egg-info || true rm -rf build_scripts/final_installer || true rm -rf build_scripts/dist || true rm -rf build_scripts/pyinstaller || true -rm -rf chia-blockchain-gui/build || true -rm -rf chia-blockchain-gui/daemon || true -rm -rf chia-blockchain-gui/node_modules || true -rm chia-blockchain-gui/temp.json || true -( cd "$PWD/chia-blockchain-gui" && git checkout HEAD -- package-lock.json ) || true +rm -rf flax-blockchain-gui/build || true +rm -rf flax-blockchain-gui/daemon || true +rm -rf flax-blockchain-gui/node_modules || true +rm flax-blockchain-gui/temp.json || true +( cd "$PWD/flax-blockchain-gui" && git checkout HEAD -- package-lock.json ) || true cd "$PWD" || true # Clean up old globally installed node_modules that might conflict with the current build diff --git a/chia-blockchain-gui b/chia-blockchain-gui deleted file mode 160000 index 5ae320421..000000000 --- a/chia-blockchain-gui +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5ae320421f256ba8a81e084f90d8a5bdf306fdff diff --git a/chia/ssl/chia_ca.crt b/chia/ssl/chia_ca.crt deleted file mode 100644 index ab2f35748..000000000 --- a/chia/ssl/chia_ca.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDKTCCAhGgAwIBAgIUXIpxI5MoZQ65/vhc7DK/d5ymoMUwDQYJKoZIhvcNAQEL -BQAwRDENMAsGA1UECgwEQ2hpYTEQMA4GA1UEAwwHQ2hpYSBDQTEhMB8GA1UECwwY -T3JnYW5pYyBGYXJtaW5nIERpdmlzaW9uMB4XDTIxMDEyMzA4NTEwNloXDTMxMDEy -MTA4NTEwNlowRDENMAsGA1UECgwEQ2hpYTEQMA4GA1UEAwwHQ2hpYSBDQTEhMB8G -A1UECwwYT3JnYW5pYyBGYXJtaW5nIERpdmlzaW9uMIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEAzz/L219Zjb5CIKnUkpd2julGC+j3E97KUiuOalCH9wdq -gpJi9nBqLccwPCSFXFew6CNBIBM+CW2jT3UVwgzjdXJ7pgtu8gWj0NQ6NqSLiXV2 -WbpZovfrVh3x7Z4bjPgI3ouWjyehUfmK1GPIld4BfUSQtPlUJ53+XT32GRizUy+b -0CcJ84jp1XvyZAMajYnclFRNNJSw9WXtTlMUu+Z1M4K7c4ZPwEqgEnCgRc0TCaXj -180vo7mCHJQoDiNSCRATwfH+kWxOOK/nePkq2t4mPSFaX8xAS4yILISIOWYn7sNg -dy9D6gGNFo2SZ0FR3x9hjUjYEV3cPqg3BmNE3DDynQIDAQABoxMwETAPBgNVHRMB -Af8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAEugnFQjzHhS0eeCqUwOHmP3ww -/rXPkKF+bJ6uiQgXZl+B5W3m3zaKimJeyatmuN+5ST1gUET+boMhbA/7grXAsRsk -SFTHG0T9CWfPiuimVmGCzoxLGpWDMJcHZncpQZ72dcy3h7mjWS+U59uyRVHeiprE -hvSyoNSYmfvh7vplRKS1wYeA119LL5fRXvOQNW6pSsts17auu38HWQGagSIAd1UP -5zEvDS1HgvaU1E09hlHzlpdSdNkAx7si0DMzxKHUg9oXeRZedt6kcfyEmryd52Mj -1r1R9mf4iMIUv1zc2sHVc1omxnCw9+7U4GMWLtL5OgyJyfNyoxk3tC+D3KNU ------END CERTIFICATE----- diff --git a/chia/ssl/chia_ca.key b/chia/ssl/chia_ca.key deleted file mode 100644 index e37eb96b2..000000000 --- a/chia/ssl/chia_ca.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAzz/L219Zjb5CIKnUkpd2julGC+j3E97KUiuOalCH9wdqgpJi -9nBqLccwPCSFXFew6CNBIBM+CW2jT3UVwgzjdXJ7pgtu8gWj0NQ6NqSLiXV2WbpZ -ovfrVh3x7Z4bjPgI3ouWjyehUfmK1GPIld4BfUSQtPlUJ53+XT32GRizUy+b0CcJ -84jp1XvyZAMajYnclFRNNJSw9WXtTlMUu+Z1M4K7c4ZPwEqgEnCgRc0TCaXj180v -o7mCHJQoDiNSCRATwfH+kWxOOK/nePkq2t4mPSFaX8xAS4yILISIOWYn7sNgdy9D -6gGNFo2SZ0FR3x9hjUjYEV3cPqg3BmNE3DDynQIDAQABAoIBAGupS4BJdx8gEAAh -2VDRqAAzhHTZb8j9uoKXJ+NotEkKrDTqUMiOu0nOqOsFWdYPo9HjxoggFuEU+Hpl -a4kj4uF3OG6Yj+jgLypjpV4PeoFM6M9R9BCp07In2i7DLLK9gvYA85SoVLBd/tW4 -hFH+Qy3M+ZNZ1nLCK4pKjtaYs0dpi5zLoVvpEcEem2O+aRpUPCZqkNwU0umATCfg -ZGfFzgXI/XPJr8Uy+LVZOFp3PXXHfnZZD9T5AjO/ViBeqbMFuWQ8BpVOqapNPKj8 -xDY3ovw3uiAYPC7eLib3u/WoFelMc2OMX0QljLp5Y+FScFHAMxoco3AQdWSYvSQw -b5xZmg0CgYEA6zKASfrw3EtPthkLR5NBmesI4RbbY6iFVhS5loLbzTtStvsus8EI -6RQgLgAFF14H21YSHxb6dB1Mbo45BN83gmDpUvKPREslqD3YPMKFo5GXMmv+JhNo -5Y9fhiOEnxzLJGtBB1HeGmg5NXp9mr2Ch9u8w/slfuCHckbA9AYvdxMCgYEA4ZR5 -zg73+UA1a6Pm93bLYZGj+hf7OaB/6Hiw9YxCBgDfWM9dJ48iz382nojT5ui0rClV -5YAo8UCLh01Np9AbBZHuBdYm9IziuKNzTeK31UW+Tvbz+dEx7+PlYQffNOhcIgd+ -9SXjoZorQksImKdMGZld1lEReHuBawq92JQvtY8CgYEAtNwUws7xQLW5CjKf9d5K -5+1Q2qYU9sG0JsmxHQhrtZoUtRjahOe/zlvnkvf48ksgh43cSYQF/Bw7lhhPyGtN -6DhVs69KdB3FS2ajTbXXxjxCpEdfHDB4zW4+6ouNhD1ECTFgxBw0SuIye+lBhSiN -o6NZuOr7nmFSRpIZ9ox7G3kCgYA4pvxMNtAqJekEpn4cChab42LGLX2nhFp7PMxc -bqQqM8/j0vg3Nihs6isCd6SYKjstvZfX8m7V3/rquQxWp9oRdQvNJXJVGojaDBqq -JdU7V6+qzzSIufQLpjV2P+7br7trxGwrDx/y9vAETynShLmE+FJrv6Jems3u3xy8 -psKwmwKBgG5uLzCyMvMB2KwI+f3np2LYVGG0Pl1jq6yNXSaBosAiF0y+IgUjtWY5 -EejO8oPWcb9AbqgPtrWaiJi17KiKv4Oyba5+y36IEtyjolWt0AB6F3oDK0X+Etw8 -j/xlvBNuzDL6gRJHQg1+d4dO8Lz54NDUbKW8jGl+N/7afGVpGmX9 ------END RSA PRIVATE KEY----- diff --git a/chia/util/default_root.py b/chia/util/default_root.py deleted file mode 100644 index e29543c49..000000000 --- a/chia/util/default_root.py +++ /dev/null @@ -1,8 +0,0 @@ -from __future__ import annotations - -import os -from pathlib import Path - -DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_ROOT", "~/.chia/mainnet"))).resolve() - -DEFAULT_KEYS_ROOT_PATH = Path(os.path.expanduser(os.getenv("CHIA_KEYS_ROOT", "~/.chia_keys"))).resolve() diff --git a/chia/util/service_groups.py b/chia/util/service_groups.py deleted file mode 100644 index 1c3d902de..000000000 --- a/chia/util/service_groups.py +++ /dev/null @@ -1,39 +0,0 @@ -from typing import KeysView, Generator - -SERVICES_FOR_GROUP = { - "all": ( - "chia_harvester chia_timelord_launcher chia_timelord chia_farmer " - "chia_full_node chia_wallet chia_data_layer chia_data_layer_http" - ).split(), - # TODO: should this be `data_layer`? - "data": "chia_wallet chia_data_layer".split(), - "data_layer_http": "chia_data_layer_http".split(), - "node": "chia_full_node".split(), - "harvester": "chia_harvester".split(), - "farmer": "chia_harvester chia_farmer chia_full_node chia_wallet".split(), - "farmer-no-wallet": "chia_harvester chia_farmer chia_full_node".split(), - "farmer-only": "chia_farmer".split(), - "timelord": "chia_timelord_launcher chia_timelord chia_full_node".split(), - "timelord-only": "chia_timelord".split(), - "timelord-launcher-only": "chia_timelord_launcher".split(), - "wallet": "chia_wallet".split(), - "introducer": "chia_introducer".split(), - "simulator": "chia_full_node_simulator".split(), - "crawler": "chia_crawler".split(), - "seeder": "chia_crawler chia_seeder".split(), - "seeder-only": "chia_seeder".split(), -} - - -def all_groups() -> KeysView[str]: - return SERVICES_FOR_GROUP.keys() - - -def services_for_groups(groups) -> Generator[str, None, None]: - for group in groups: - for service in SERVICES_FOR_GROUP[group]: - yield service - - -def validate_service(service: str) -> bool: - return any(service in _ for _ in SERVICES_FOR_GROUP.values()) diff --git a/chia/wallet/cat_wallet/cat_constants.py b/chia/wallet/cat_wallet/cat_constants.py deleted file mode 100644 index ab5fb729d..000000000 --- a/chia/wallet/cat_wallet/cat_constants.py +++ /dev/null @@ -1,32 +0,0 @@ -from __future__ import annotations - -SPACEBUCKS = { - "asset_id": "a628c1c2c6fcb74d53746157e438e108eab5c0bb3e5c80ff9b1910b3e4832913", - "name": "Spacebucks", - "symbol": "SBX", -} - -MARMOT = { - "asset_id": "8ebf855de6eb146db5602f0456d2f0cbe750d57f821b6f91a8592ee9f1d4cf31", - "name": "Marmot", - "symbol": "MRMT", -} - -STABLY_USDS = { - "asset_id": "6d95dae356e32a71db5ddcb42224754a02524c615c5fc35f568c2af04774e589", - "name": "Stably USD", - "symbol": "USDS", -} - -CHIA_HOLIDAY_TOKEN = { - "asset_id": "509deafe3cd8bbfbb9ccce1d930e3d7b57b40c964fa33379b18d628175eb7a8f", - "name": "Chia Holiday 2021 Token", - "symbol": "CH21", -} - -DEFAULT_CATS = { - SPACEBUCKS["asset_id"]: SPACEBUCKS, - MARMOT["asset_id"]: MARMOT, - STABLY_USDS["asset_id"]: STABLY_USDS, - CHIA_HOLIDAY_TOKEN["asset_id"]: CHIA_HOLIDAY_TOKEN, -} diff --git a/chia/wallet/util/json_clvm_utils.py b/chia/wallet/util/json_clvm_utils.py deleted file mode 100644 index a81f4ba97..000000000 --- a/chia/wallet/util/json_clvm_utils.py +++ /dev/null @@ -1,19 +0,0 @@ -from __future__ import annotations - -from typing import Any - -from chia.types.blockchain_format.program import Program - - -def json_to_chialisp(json_data: Any) -> Any: - list_for_chialisp = [] - if isinstance(json_data, list): - for value in json_data: - list_for_chialisp.append(json_to_chialisp(value)) - else: - if isinstance(json_data, dict): - for key, value in json_data: - list_for_chialisp.append((key, json_to_chialisp(value))) - else: - list_for_chialisp = json_data - return Program.to(list_for_chialisp) diff --git a/flax-blockchain-gui b/flax-blockchain-gui new file mode 160000 index 000000000..97c8cc2db --- /dev/null +++ b/flax-blockchain-gui @@ -0,0 +1 @@ +Subproject commit 97c8cc2dbdc6923c6498bd5b9b1655a314fd3fae diff --git a/chia/__init__.py b/flax/__init__.py similarity index 63% rename from chia/__init__.py rename to flax/__init__.py index 373e0aaeb..075d5ed2a 100644 --- a/chia/__init__.py +++ b/flax/__init__.py @@ -3,9 +3,9 @@ from pkg_resources import DistributionNotFound, get_distribution, resource_filename try: - __version__ = get_distribution("chia-blockchain").version + __version__ = get_distribution("flax-blockchain").version except DistributionNotFound: # package is not installed __version__ = "unknown" -PYINSTALLER_SPEC_PATH = resource_filename("chia", "pyinstaller.spec") +PYINSTALLER_SPEC_PATH = resource_filename("flax", "pyinstaller.spec") diff --git a/chia/clvm/__init__.py b/flax/clvm/__init__.py similarity index 100% rename from chia/clvm/__init__.py rename to flax/clvm/__init__.py diff --git a/chia/clvm/singleton.py b/flax/clvm/singleton.py similarity index 80% rename from chia/clvm/singleton.py rename to flax/clvm/singleton.py index 3a1419de6..0ced194c3 100644 --- a/chia/clvm/singleton.py +++ b/flax/clvm/singleton.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile P2_SINGLETON_MOD = load_clvm_maybe_recompile("p2_singleton.clvm") SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer.clvm") diff --git a/chia/clvm/spend_sim.py b/flax/clvm/spend_sim.py similarity index 92% rename from chia/clvm/spend_sim.py rename to flax/clvm/spend_sim.py index 7f266683e..deb95132a 100644 --- a/chia/clvm/spend_sim.py +++ b/flax/clvm/spend_sim.py @@ -4,36 +4,36 @@ from dataclasses import dataclass from typing import Optional, List, Dict, Tuple, Any, Type, TypeVar -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.coin import Coin -from chia.types.mempool_item import MempoolItem -from chia.util.ints import uint64, uint32 -from chia.util.hash import std_hash -from chia.util.errors import Err, ValidationError -from chia.util.db_wrapper import DBWrapper2 -from chia.util.streamable import Streamable, streamable -from chia.types.coin_record import CoinRecord -from chia.types.spend_bundle import SpendBundle -from chia.types.generator_types import BlockGenerator -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.coin_spend import CoinSpend -from chia.full_node.bundle_tools import simple_solution_generator -from chia.full_node.mempool_manager import MempoolManager -from chia.full_node.coin_store import CoinStore -from chia.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.consensus.coinbase import create_pool_coin, create_farmer_coin -from chia.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward -from chia.consensus.cost_calculator import NPCResult +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.coin import Coin +from flax.types.mempool_item import MempoolItem +from flax.util.ints import uint64, uint32 +from flax.util.hash import std_hash +from flax.util.errors import Err, ValidationError +from flax.util.db_wrapper import DBWrapper2 +from flax.util.streamable import Streamable, streamable +from flax.types.coin_record import CoinRecord +from flax.types.spend_bundle import SpendBundle +from flax.types.generator_types import BlockGenerator +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.coin_spend import CoinSpend +from flax.full_node.bundle_tools import simple_solution_generator +from flax.full_node.mempool_manager import MempoolManager +from flax.full_node.coin_store import CoinStore +from flax.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.consensus.coinbase import create_pool_coin, create_farmer_coin +from flax.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward +from flax.consensus.cost_calculator import NPCResult """ -The purpose of this file is to provide a lightweight simulator for the testing of Chialisp smart contracts. +The purpose of this file is to provide a lightweight simulator for the testing of Flaxlisp smart contracts. The Node object uses actual MempoolManager, Mempool and CoinStore objects, while substituting FullBlock and BlockRecord objects for trimmed down versions. -There is also a provided NodeClient object which implements many of the methods from chia.rpc.full_node_rpc_client +There is also a provided NodeClient object which implements many of the methods from flax.rpc.full_node_rpc_client and is designed so that you could test with it and then swap in a real rpc client that uses the same code you tested. """ diff --git a/chia/cmds/__init__.py b/flax/cmds/__init__.py similarity index 100% rename from chia/cmds/__init__.py rename to flax/cmds/__init__.py diff --git a/chia/cmds/beta.py b/flax/cmds/beta.py similarity index 90% rename from chia/cmds/beta.py rename to flax/cmds/beta.py index f96dd5ab6..af29b24ae 100644 --- a/chia/cmds/beta.py +++ b/flax/cmds/beta.py @@ -7,9 +7,9 @@ import click -from chia.cmds.beta_funcs import ( +from flax.cmds.beta_funcs import ( default_beta_root_path, - prepare_chia_blockchain_log, + prepare_flax_blockchain_log, prepare_logs, prepare_plotting_log, prompt_beta_warning, @@ -19,12 +19,12 @@ validate_beta_path, validate_metrics_log_interval, ) -from chia.util.beta_metrics import metrics_log_interval_default -from chia.util.config import lock_and_load_config, save_config +from flax.util.beta_metrics import metrics_log_interval_default +from flax.util.config import lock_and_load_config, save_config def print_restart_warning() -> None: - print("\nRestart the daemon and any running chia services for changes to take effect.") + print("\nRestart the daemon and any running flax services for changes to take effect.") @click.group("beta", hidden=True) @@ -40,7 +40,7 @@ def configure(ctx: click.Context, path: Optional[str], interval: Optional[int]) root_path = ctx.obj["root_path"] with lock_and_load_config(root_path, "config.yaml") as config: if "beta" not in config: - raise click.ClickException("beta test mode is not enabled, enable it first with `chia beta enable`") + raise click.ClickException("beta test mode is not enabled, enable it first with `flax beta enable`") # Adjust the path if path is None: @@ -124,7 +124,7 @@ def prepare_submission_cmd(ctx: click.Context) -> None: with lock_and_load_config(ctx.obj["root_path"], "config.yaml") as config: beta_root_path = config.get("beta", {}).get("path", None) if beta_root_path is None: - raise click.ClickException("beta test mode not enabled. Run `chia beta enable` first.") + raise click.ClickException("beta test mode not enabled. Run `flax beta enable` first.") beta_root_path = Path(beta_root_path) validate_beta_path(beta_root_path) available_results = sorted([path for path in beta_root_path.iterdir() if path.is_dir()]) @@ -142,9 +142,9 @@ def prepare_submission_cmd(ctx: click.Context) -> None: except IndexError: raise click.ClickException(f"Invalid choice: {user_input}") plotting_path = Path(prepare_result / "plotting") - chia_blockchain_path = Path(prepare_result / "chia-blockchain") - chia_logs = prepare_logs(plotting_path, prepare_chia_blockchain_log) - plotting_logs = prepare_logs(chia_blockchain_path, prepare_plotting_log) + flax_blockchain_path = Path(prepare_result / "flax-blockchain") + flax_logs = prepare_logs(plotting_path, prepare_flax_blockchain_log) + plotting_logs = prepare_logs(flax_blockchain_path, prepare_plotting_log) submission_file_path = ( prepare_result / f"submission_{prepare_result.name}__{datetime.now().strftime('%m_%d_%Y__%H_%M_%S')}.zip" @@ -160,11 +160,11 @@ def add_files(paths: List[Path]) -> int: return added with zipfile.ZipFile(submission_file_path, "w", zipfile.ZIP_DEFLATED) as zip_file: - files_added = add_files(chia_logs) + add_files(plotting_logs) + files_added = add_files(flax_logs) + add_files(plotting_logs) if files_added == 0: submission_file_path.unlink() - message = f"No logs files found in {str(plotting_path)!r} and {str(chia_blockchain_path)!r}." + message = f"No logs files found in {str(plotting_path)!r} and {str(flax_blockchain_path)!r}." raise click.ClickException(message) print(f"\nDone. You can find the prepared submission data in {submission_file_path}.") @@ -176,7 +176,7 @@ def status(ctx: click.Context) -> None: with lock_and_load_config(ctx.obj["root_path"], "config.yaml") as config: beta_config = config.get("beta") if beta_config is None: - raise click.ClickException("beta test mode is not enabled, enable it first with `chia beta enable`") + raise click.ClickException("beta test mode is not enabled, enable it first with `flax beta enable`") print(f"enabled: {beta_config['enabled']}") print(f"path: {beta_config['path']}") diff --git a/chia/cmds/beta_funcs.py b/flax/cmds/beta_funcs.py similarity index 90% rename from chia/cmds/beta_funcs.py rename to flax/cmds/beta_funcs.py index 24e1354c9..930a70058 100644 --- a/chia/cmds/beta_funcs.py +++ b/flax/cmds/beta_funcs.py @@ -5,19 +5,19 @@ from pathlib import Path from typing import Any, Callable, Dict, List, Optional -from chia.util.beta_metrics import metrics_log_interval_max, metrics_log_interval_min -from chia.util.chia_logging import get_beta_logging_config -from chia.util.errors import InvalidPathError -from chia.util.misc import format_bytes, prompt_yes_no, validate_directory_writable +from flax.util.beta_metrics import metrics_log_interval_max, metrics_log_interval_min +from flax.util.flax_logging import get_beta_logging_config +from flax.util.errors import InvalidPathError +from flax.util.misc import format_bytes, prompt_yes_no, validate_directory_writable def default_beta_root_path() -> Path: - return Path(os.path.expanduser(os.getenv("CHIA_BETA_ROOT", "~/chia-beta-test"))).resolve() + return Path(os.path.expanduser(os.getenv("FLAX_BETA_ROOT", "~/flax-beta-test"))).resolve() def warn_if_beta_enabled(config: Dict[str, Any]) -> None: if config.get("beta", {}).get("enabled", False): - print("\nWARNING: beta test mode is enabled. Run `chia beta disable` if this is unintentional.\n") + print("\nWARNING: beta test mode is enabled. Run `flax beta disable` if this is unintentional.\n") def prompt_beta_warning() -> bool: @@ -115,7 +115,7 @@ def prepare_plotting_log(path: Path) -> None: print(f" - {path.name}") -def prepare_chia_blockchain_log(path: Path) -> None: +def prepare_flax_blockchain_log(path: Path) -> None: # TODO: Do stuff we want to do with the logs before submission. Maybe even just fully parse them and # create some final result files and zip them instead of just the logs. print(f" - {path.name}") diff --git a/chia/cmds/cmds_util.py b/flax/cmds/cmds_util.py similarity index 89% rename from chia/cmds/cmds_util.py rename to flax/cmds/cmds_util.py index 9ef9a2ce5..f4e18b4f4 100644 --- a/chia/cmds/cmds_util.py +++ b/flax/cmds/cmds_util.py @@ -6,17 +6,17 @@ from aiohttp import ClientConnectorError -from chia.rpc.farmer_rpc_client import FarmerRpcClient -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.rpc.harvester_rpc_client import HarvesterRpcClient -from chia.rpc.rpc_client import RpcClient -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.mempool_submission_status import MempoolSubmissionStatus -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint16 -from chia.wallet.transaction_record import TransactionRecord +from flax.rpc.farmer_rpc_client import FarmerRpcClient +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.rpc.harvester_rpc_client import HarvesterRpcClient +from flax.rpc.rpc_client import RpcClient +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.mempool_submission_status import MempoolSubmissionStatus +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint16 +from flax.wallet.transaction_record import TransactionRecord NODE_TYPES: Dict[str, Type[RpcClient]] = { "farmer": FarmerRpcClient, @@ -32,7 +32,7 @@ def transaction_submitted_msg(tx: TransactionRecord) -> str: def transaction_status_msg(fingerprint: int, tx_id: bytes32) -> str: - return f"Run 'chia wallet get_transaction -f {fingerprint} -tx 0x{tx_id}' to get status" + return f"Run 'flax wallet get_transaction -f {fingerprint} -tx 0x{tx_id}' to get status" async def validate_client_connection( @@ -98,7 +98,7 @@ async def get_wallet(wallet_client: WalletRpcClient, fingerprint: Optional[int]) else: fingerprints = await wallet_client.get_public_keys() if len(fingerprints) == 0: - print("No keys loaded. Run 'chia keys generate' or import a key") + print("No keys loaded. Run 'flax keys generate' or import a key") return None if len(fingerprints) == 1: fingerprint = fingerprints[0] diff --git a/chia/cmds/configure.py b/flax/cmds/configure.py similarity index 95% rename from chia/cmds/configure.py rename to flax/cmds/configure.py index 91aa04b0c..a146fcc3e 100644 --- a/chia/cmds/configure.py +++ b/flax/cmds/configure.py @@ -5,7 +5,7 @@ import click -from chia.util.config import load_defaults_for_missing_services, lock_and_load_config, save_config, str2bool +from flax.util.config import load_defaults_for_missing_services, lock_and_load_config, save_config, str2bool def configure( @@ -100,10 +100,10 @@ def configure( if testnet: if testnet == "true" or testnet == "t": print("Setting Testnet") - testnet_port = "58444" - testnet_introducer = "introducer-testnet10.chia.net" - testnet_dns_introducer = "dns-introducer-testnet10.chia.net" - bootstrap_peers = ["testnet10-node.chia.net"] + testnet_port = "56888" + testnet_introducer = "introducer-testnet10.flaxnetwork.org" + testnet_dns_introducer = "dns-introducer-testnet10.flaxnetwork.org" + bootstrap_peers = ["testnet10-node.flaxnetwork.org"] testnet = "testnet10" config["full_node"]["port"] = int(testnet_port) if config["full_node"]["introducer_peer"] is None: @@ -144,10 +144,10 @@ def configure( elif testnet == "false" or testnet == "f": print("Setting Mainnet") - mainnet_port = "8444" - mainnet_introducer = "introducer.chia.net" - mainnet_dns_introducer = "dns-introducer.chia.net" - bootstrap_peers = ["node.chia.net"] + mainnet_port = "6888" + mainnet_introducer = "introducer.flaxnetwork.org" + mainnet_dns_introducer = "dns-introducer.flaxnetwork.org" + bootstrap_peers = ["node.flaxnetwork.org"] net = "mainnet" config["full_node"]["port"] = int(mainnet_port) config["full_node"]["introducer_peer"]["port"] = int(mainnet_port) @@ -203,7 +203,7 @@ def configure( change_made = True if change_made: - print("Restart any running chia services for changes to take effect") + print("Restart any running flax services for changes to take effect") save_config(root_path, "config.yaml", config) diff --git a/chia/cmds/data.py b/flax/cmds/data.py similarity index 90% rename from chia/cmds/data.py rename to flax/cmds/data.py index dfa9ccf3a..d9647209e 100644 --- a/chia/cmds/data.py +++ b/flax/cmds/data.py @@ -95,7 +95,7 @@ def create_fee_option() -> Callable[[FC], FC]: return click.option( "-m", "--fee", - help="Set the fees for the transaction, in XCH", + help="Set the fees for the transaction, in XFX", type=str, default=None, show_default=True, @@ -110,7 +110,7 @@ def create_data_store( data_rpc_port: int, fee: Optional[str], ) -> None: - from chia.cmds.data_funcs import create_data_store_cmd + from flax.cmds.data_funcs import create_data_store_cmd run(create_data_store_cmd(data_rpc_port, fee)) @@ -126,7 +126,7 @@ def get_value( root_hash: Optional[str], data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import get_value_cmd + from flax.cmds.data_funcs import get_value_cmd run(get_value_cmd(data_rpc_port, id, key_string, root_hash)) @@ -142,7 +142,7 @@ def update_data_store( data_rpc_port: int, fee: str, ) -> None: - from chia.cmds.data_funcs import update_data_store_cmd + from flax.cmds.data_funcs import update_data_store_cmd run(update_data_store_cmd(rpc_port=data_rpc_port, store_id=id, changelist=json.loads(changelist_string), fee=fee)) @@ -156,7 +156,7 @@ def get_keys( root_hash: Optional[str], data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import get_keys_cmd + from flax.cmds.data_funcs import get_keys_cmd run(get_keys_cmd(data_rpc_port, id, root_hash)) @@ -170,7 +170,7 @@ def get_keys_values( root_hash: Optional[str], data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import get_keys_values_cmd + from flax.cmds.data_funcs import get_keys_values_cmd run(get_keys_values_cmd(data_rpc_port, id, root_hash)) @@ -182,7 +182,7 @@ def get_root( id: str, data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import get_root_cmd + from flax.cmds.data_funcs import get_root_cmd run(get_root_cmd(rpc_port=data_rpc_port, store_id=id)) @@ -203,7 +203,7 @@ def subscribe( urls: List[str], data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import subscribe_cmd + from flax.cmds.data_funcs import subscribe_cmd run(subscribe_cmd(rpc_port=data_rpc_port, store_id=id, urls=urls)) @@ -217,7 +217,7 @@ def remove_subscription( urls: List[str], data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import remove_subscriptions_cmd + from flax.cmds.data_funcs import remove_subscriptions_cmd run(remove_subscriptions_cmd(rpc_port=data_rpc_port, store_id=id, urls=urls)) @@ -229,7 +229,7 @@ def unsubscribe( id: str, data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import unsubscribe_cmd + from flax.cmds.data_funcs import unsubscribe_cmd run(unsubscribe_cmd(rpc_port=data_rpc_port, store_id=id)) @@ -247,7 +247,7 @@ def get_kv_diff( hash_2: str, data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import get_kv_diff_cmd + from flax.cmds.data_funcs import get_kv_diff_cmd run(get_kv_diff_cmd(rpc_port=data_rpc_port, store_id=id, hash_1=hash_1, hash_2=hash_2)) @@ -259,7 +259,7 @@ def get_root_history( id: str, data_rpc_port: int, ) -> None: - from chia.cmds.data_funcs import get_root_history_cmd + from flax.cmds.data_funcs import get_root_history_cmd run(get_root_history_cmd(rpc_port=data_rpc_port, store_id=id)) @@ -282,7 +282,7 @@ def get_root_history( ) @create_rpc_port_option() def add_missing_files(ids: Optional[str], overwrite: bool, foldername: Optional[str], data_rpc_port: int) -> None: - from chia.cmds.data_funcs import add_missing_files_cmd + from flax.cmds.data_funcs import add_missing_files_cmd run( add_missing_files_cmd( @@ -310,7 +310,7 @@ def add_missing_files(ids: Optional[str], overwrite: bool, foldername: Optional[ @create_fee_option() @create_rpc_port_option() def add_mirror(id: str, amount: int, urls: List[str], fee: Optional[str], data_rpc_port: int) -> None: - from chia.cmds.data_funcs import add_mirror_cmd + from flax.cmds.data_funcs import add_mirror_cmd run( add_mirror_cmd( @@ -328,7 +328,7 @@ def add_mirror(id: str, amount: int, urls: List[str], fee: Optional[str], data_r @create_fee_option() @create_rpc_port_option() def delete_mirror(coin_id: str, fee: Optional[str], data_rpc_port: int) -> None: - from chia.cmds.data_funcs import delete_mirror_cmd + from flax.cmds.data_funcs import delete_mirror_cmd run( delete_mirror_cmd( @@ -343,7 +343,7 @@ def delete_mirror(coin_id: str, fee: Optional[str], data_rpc_port: int) -> None: @click.option("-i", "--id", help="Store id", type=str, required=True) @create_rpc_port_option() def get_mirrors(id: str, data_rpc_port: int) -> None: - from chia.cmds.data_funcs import get_mirrors_cmd + from flax.cmds.data_funcs import get_mirrors_cmd run( get_mirrors_cmd( @@ -356,7 +356,7 @@ def get_mirrors(id: str, data_rpc_port: int) -> None: @data_cmd.command("get_subscriptions", short_help="Get subscribed stores, including the owned stores") @create_rpc_port_option() def get_subscriptions(data_rpc_port: int) -> None: - from chia.cmds.data_funcs import get_subscriptions_cmd + from flax.cmds.data_funcs import get_subscriptions_cmd run( get_subscriptions_cmd( @@ -368,7 +368,7 @@ def get_subscriptions(data_rpc_port: int) -> None: @data_cmd.command("get_owned_stores", short_help="Get owned stores") @create_rpc_port_option() def get_owned_stores(data_rpc_port: int) -> None: - from chia.cmds.data_funcs import get_owned_stores_cmd + from flax.cmds.data_funcs import get_owned_stores_cmd run( get_owned_stores_cmd( diff --git a/chia/cmds/data_funcs.py b/flax/cmds/data_funcs.py similarity index 94% rename from chia/cmds/data_funcs.py rename to flax/cmds/data_funcs.py index c76159a1c..5597db24d 100644 --- a/chia/cmds/data_funcs.py +++ b/flax/cmds/data_funcs.py @@ -7,13 +7,13 @@ import aiohttp -from chia.cmds.units import units -from chia.rpc.data_layer_rpc_client import DataLayerRpcClient -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint16, uint64 +from flax.cmds.units import units +from flax.rpc.data_layer_rpc_client import DataLayerRpcClient +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint16, uint64 # TODO: there seems to be a large amount of repetition in these to dedupe @@ -37,7 +37,7 @@ async def get_client(rpc_port: Optional[int]) -> AsyncIterator[Tuple[DataLayerRp async def create_data_store_cmd(rpc_port: Optional[int], fee: Optional[str]) -> None: final_fee = None if fee is not None: - final_fee = uint64(int(Decimal(fee) * units["chia"])) + final_fee = uint64(int(Decimal(fee) * units["flax"])) try: async with get_client(rpc_port) as (client, rpc_port): res = await client.create_data_store(fee=final_fee) @@ -74,7 +74,7 @@ async def update_data_store_cmd( store_id_bytes = bytes32.from_hexstr(store_id) final_fee = None if fee is not None: - final_fee = uint64(int(Decimal(fee) * units["chia"])) + final_fee = uint64(int(Decimal(fee) * units["flax"])) try: async with get_client(rpc_port) as (client, rpc_port): res = await client.update_data_store(store_id=store_id_bytes, changelist=changelist, fee=final_fee) @@ -246,7 +246,7 @@ async def add_mirror_cmd( store_id_bytes = bytes32.from_hexstr(store_id) final_fee = None if fee is not None: - final_fee = uint64(int(Decimal(fee) * units["chia"])) + final_fee = uint64(int(Decimal(fee) * units["flax"])) async with get_client(rpc_port) as (client, rpc_port): res = await client.add_mirror( store_id=store_id_bytes, @@ -266,7 +266,7 @@ async def delete_mirror_cmd(rpc_port: Optional[int], coin_id: str, fee: Optional coin_id_bytes = bytes32.from_hexstr(coin_id) final_fee = None if fee is not None: - final_fee = uint64(int(Decimal(fee) * units["chia"])) + final_fee = uint64(int(Decimal(fee) * units["flax"])) async with get_client(rpc_port) as (client, rpc_port): res = await client.delete_mirror( coin_id=coin_id_bytes, diff --git a/chia/cmds/db.py b/flax/cmds/db.py similarity index 94% rename from chia/cmds/db.py rename to flax/cmds/db.py index 7ef1383ee..a2a807d70 100644 --- a/chia/cmds/db.py +++ b/flax/cmds/db.py @@ -1,8 +1,8 @@ from pathlib import Path import click -from chia.cmds.db_upgrade_func import db_upgrade_func -from chia.cmds.db_validate_func import db_validate_func -from chia.cmds.db_backup_func import db_backup_func +from flax.cmds.db_upgrade_func import db_upgrade_func +from flax.cmds.db_validate_func import db_validate_func +from flax.cmds.db_backup_func import db_backup_func @click.group("db", short_help="Manage the blockchain database") diff --git a/chia/cmds/db_backup_func.py b/flax/cmds/db_backup_func.py similarity index 97% rename from chia/cmds/db_backup_func.py rename to flax/cmds/db_backup_func.py index d63c12bec..914fff54c 100644 --- a/chia/cmds/db_backup_func.py +++ b/flax/cmds/db_backup_func.py @@ -3,8 +3,8 @@ from pathlib import Path from typing import Any, Dict, Optional -from chia.util.config import load_config -from chia.util.path import path_from_root +from flax.util.config import load_config +from flax.util.path import path_from_root def db_backup_func( diff --git a/chia/cmds/db_upgrade_func.py b/flax/cmds/db_upgrade_func.py similarity index 98% rename from chia/cmds/db_upgrade_func.py rename to flax/cmds/db_upgrade_func.py index ce00663e3..9cd5133d9 100644 --- a/chia/cmds/db_upgrade_func.py +++ b/flax/cmds/db_upgrade_func.py @@ -7,10 +7,10 @@ import textwrap import os -from chia.util.config import load_config, lock_and_load_config, save_config -from chia.util.path import path_from_root -from chia.util.ints import uint32 -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.util.config import load_config, lock_and_load_config, save_config +from flax.util.path import path_from_root +from flax.util.ints import uint32 +from flax.types.blockchain_format.sized_bytes import bytes32 # if either the input database or output database file is specified, the diff --git a/chia/cmds/db_validate_func.py b/flax/cmds/db_validate_func.py similarity index 96% rename from chia/cmds/db_validate_func.py rename to flax/cmds/db_validate_func.py index 0d310345a..8b2b13dd1 100644 --- a/chia/cmds/db_validate_func.py +++ b/flax/cmds/db_validate_func.py @@ -3,12 +3,12 @@ from pathlib import Path from typing import Any, Dict, Optional -from chia.consensus.block_record import BlockRecord -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.util.config import load_config -from chia.util.path import path_from_root +from flax.consensus.block_record import BlockRecord +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.util.config import load_config +from flax.util.path import path_from_root def db_validate_func( diff --git a/chia/cmds/farm.py b/flax/cmds/farm.py similarity index 100% rename from chia/cmds/farm.py rename to flax/cmds/farm.py diff --git a/chia/cmds/farm_funcs.py b/flax/cmds/farm_funcs.py similarity index 91% rename from chia/cmds/farm_funcs.py rename to flax/cmds/farm_funcs.py index 173d0d685..aa4997f1f 100644 --- a/chia/cmds/farm_funcs.py +++ b/flax/cmds/farm_funcs.py @@ -1,15 +1,15 @@ from typing import Any, Dict, List, Optional -from chia.cmds.cmds_util import get_any_service_client -from chia.cmds.units import units -from chia.consensus.block_record import BlockRecord -from chia.rpc.farmer_rpc_client import FarmerRpcClient -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.util.misc import format_bytes -from chia.util.misc import format_minutes -from chia.util.network import is_localhost +from flax.cmds.cmds_util import get_any_service_client +from flax.cmds.units import units +from flax.consensus.block_record import BlockRecord +from flax.rpc.farmer_rpc_client import FarmerRpcClient +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.util.misc import format_bytes +from flax.util.misc import format_minutes +from flax.util.network import is_localhost SECONDS_PER_BLOCK = (24 * 3600) / 4608 @@ -124,9 +124,9 @@ async def summary( print("Farming") if amounts is not None: - print(f"Total chia farmed: {amounts['farmed_amount'] / units['chia']}") - print(f"User transaction fees: {amounts['fee_amount'] / units['chia']}") - print(f"Block rewards: {(amounts['farmer_reward_amount'] + amounts['pool_reward_amount']) / units['chia']}") + print(f"Total flax farmed: {amounts['farmed_amount'] / units['flax']}") + print(f"User transaction fees: {amounts['fee_amount'] / units['flax']}") + print(f"Block rewards: {(amounts['farmer_reward_amount'] + amounts['pool_reward_amount']) / units['flax']}") print(f"Last height farmed: {amounts['last_height_farmed']}") class PlotStats: @@ -190,8 +190,8 @@ def process_harvesters(harvester_peers_in: dict): if amounts is None: if wallet_not_running: - print("For details on farmed rewards and fees you should run 'chia start wallet' and 'chia wallet show'") + print("For details on farmed rewards and fees you should run 'flax start wallet' and 'flax wallet show'") elif wallet_not_ready: - print("For details on farmed rewards and fees you should run 'chia wallet show'") + print("For details on farmed rewards and fees you should run 'flax wallet show'") else: - print("Note: log into your key using 'chia wallet show' to see rewards for each key") + print("Note: log into your key using 'flax wallet show' to see rewards for each key") diff --git a/chia/cmds/chia.py b/flax/cmds/flax.py similarity index 70% rename from chia/cmds/chia.py rename to flax/cmds/flax.py index 7e9503efd..e44e1dd51 100644 --- a/chia/cmds/chia.py +++ b/flax/cmds/flax.py @@ -1,40 +1,39 @@ from io import TextIOWrapper import click -from chia import __version__ -from chia.cmds.beta import beta_cmd -from chia.cmds.configure import configure_cmd -from chia.cmds.farm import farm_cmd -from chia.cmds.data import data_cmd -from chia.cmds.init import init_cmd -from chia.cmds.keys import keys_cmd -from chia.cmds.netspace import netspace_cmd -from chia.cmds.passphrase import passphrase_cmd -from chia.cmds.peer import peer_cmd -from chia.cmds.plots import plots_cmd -from chia.cmds.rpc import rpc_cmd -from chia.cmds.show import show_cmd -from chia.cmds.start import start_cmd -from chia.cmds.stop import stop_cmd -from chia.cmds.wallet import wallet_cmd -from chia.cmds.plotnft import plotnft_cmd -from chia.cmds.plotters import plotters_cmd -from chia.cmds.db import db_cmd -from chia.util.default_root import DEFAULT_KEYS_ROOT_PATH, DEFAULT_ROOT_PATH -from chia.util.errors import KeychainCurrentPassphraseIsInvalid -from chia.util.keychain import ( +from flax import __version__ +from flax.cmds.beta import beta_cmd +from flax.cmds.configure import configure_cmd +from flax.cmds.farm import farm_cmd +from flax.cmds.data import data_cmd +from flax.cmds.init import init_cmd +from flax.cmds.keys import keys_cmd +from flax.cmds.netspace import netspace_cmd +from flax.cmds.passphrase import passphrase_cmd +from flax.cmds.peer import peer_cmd +from flax.cmds.plots import plots_cmd +from flax.cmds.rpc import rpc_cmd +from flax.cmds.show import show_cmd +from flax.cmds.start import start_cmd +from flax.cmds.stop import stop_cmd +from flax.cmds.wallet import wallet_cmd +from flax.cmds.plotters import plotters_cmd +from flax.cmds.db import db_cmd +from flax.util.default_root import DEFAULT_KEYS_ROOT_PATH, DEFAULT_ROOT_PATH +from flax.util.errors import KeychainCurrentPassphraseIsInvalid +from flax.util.keychain import ( Keychain, set_keys_root_path, ) -from chia.util.ssl_check import check_ssl +from flax.util.ssl_check import check_ssl from typing import Optional CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) @click.group( - help=f"\n Manage chia blockchain infrastructure ({__version__})\n", - epilog="Try 'chia start node', 'chia netspace -d 192', or 'chia show -s'", + help=f"\n Manage flax blockchain infrastructure ({__version__})\n", + epilog="Try 'flax start node', 'flax netspace -d 192', or 'flax show -s'", context_settings=CONTEXT_SETTINGS, ) @click.option("--root-path", default=DEFAULT_ROOT_PATH, help="Config file root", type=click.Path(), show_default=True) @@ -67,7 +66,7 @@ def cli( set_keys_root_path(Path(keys_root_path)) if passphrase_file is not None: - from chia.cmds.passphrase_funcs import cache_passphrase, read_passphrase_from_file + from flax.cmds.passphrase_funcs import cache_passphrase, read_passphrase_from_file from sys import exit try: @@ -88,24 +87,24 @@ def cli( check_ssl(Path(root_path)) -@cli.command("version", short_help="Show chia version") +@cli.command("version", short_help="Show flax version") def version_cmd() -> None: print(__version__) -@cli.command("run_daemon", short_help="Runs chia daemon") +@cli.command("run_daemon", short_help="Runs flax daemon") @click.option( "--wait-for-unlock", help="If the keyring is passphrase-protected, the daemon will wait for an unlock command before accessing keys", default=False, is_flag=True, - hidden=True, # --wait-for-unlock is only set when launched by chia start + hidden=True, # --wait-for-unlock is only set when launched by flax start ) @click.pass_context def run_daemon_cmd(ctx: click.Context, wait_for_unlock: bool) -> None: import asyncio - from chia.daemon.server import async_run_daemon - from chia.util.keychain import Keychain + from flax.daemon.server import async_run_daemon + from flax.util.keychain import Keychain wait_for_unlock = wait_for_unlock and Keychain.is_keyring_locked() @@ -115,7 +114,6 @@ def run_daemon_cmd(ctx: click.Context, wait_for_unlock: bool) -> None: cli.add_command(keys_cmd) cli.add_command(plots_cmd) cli.add_command(wallet_cmd) -cli.add_command(plotnft_cmd) cli.add_command(configure_cmd) cli.add_command(init_cmd) cli.add_command(rpc_cmd) diff --git a/chia/cmds/init.py b/flax/cmds/init.py similarity index 70% rename from chia/cmds/init.py rename to flax/cmds/init.py index df0e7e622..e2067c232 100644 --- a/chia/cmds/init.py +++ b/flax/cmds/init.py @@ -14,7 +14,7 @@ is_flag=True, help="Attempt to fix SSL certificate/key file permissions", ) -@click.option("--testnet", is_flag=True, help="Configure this chia install to connect to the testnet") +@click.option("--testnet", is_flag=True, help="Configure this flax install to connect to the testnet") @click.option("--set-passphrase", "-s", is_flag=True, help="Protect your keyring with a passphrase") @click.option( "--v1-db", @@ -28,16 +28,16 @@ def init_cmd(ctx: click.Context, create_certs: str, fix_ssl_permissions: bool, t \b Follow these steps to create new certificates for a remote harvester: - - Make a copy of your Farming Machine CA directory: ~/.chia/[version]/config/ssl/ca - - Shut down all chia daemon processes with `chia stop all -d` - - Run `chia init -c [directory]` on your remote harvester, + - Make a copy of your Farming Machine CA directory: ~/.flax/[version]/config/ssl/ca + - Shut down all flax daemon processes with `flax stop all -d` + - Run `flax init -c [directory]` on your remote harvester, where [directory] is the the copy of your Farming Machine CA directory - - Get more details on remote harvester on Chia wiki: - https://github.com/Chia-Network/chia-blockchain/wiki/Farming-on-many-machines + - Get more details on remote harvester on Flax wiki: + https://github.com/Flax-Network/flax-blockchain/wiki/Farming-on-many-machines """ from pathlib import Path from .init_funcs import init - from chia.cmds.passphrase_funcs import initialize_passphrase + from flax.cmds.passphrase_funcs import initialize_passphrase set_passphrase = kwargs.get("set_passphrase") if set_passphrase: @@ -53,7 +53,7 @@ def init_cmd(ctx: click.Context, create_certs: str, fix_ssl_permissions: bool, t if __name__ == "__main__": - from .init_funcs import chia_init - from chia.util.default_root import DEFAULT_ROOT_PATH + from .init_funcs import flax_init + from flax.util.default_root import DEFAULT_ROOT_PATH - chia_init(DEFAULT_ROOT_PATH) + flax_init(DEFAULT_ROOT_PATH) diff --git a/chia/cmds/init_funcs.py b/flax/cmds/init_funcs.py similarity index 87% rename from chia/cmds/init_funcs.py rename to flax/cmds/init_funcs.py index bd674018d..c3d04bba1 100644 --- a/chia/cmds/init_funcs.py +++ b/flax/cmds/init_funcs.py @@ -6,28 +6,28 @@ import yaml -from chia import __version__ -from chia.consensus.coinbase import create_puzzlehash_for_pk -from chia.ssl.create_ssl import ( +from flax import __version__ +from flax.consensus.coinbase import create_puzzlehash_for_pk +from flax.ssl.create_ssl import ( ensure_ssl_dirs, generate_ca_signed_cert, - get_chia_ca_crt_key, + get_flax_ca_crt_key, make_ca_cert, write_ssl_cert_and_key, ) -from chia.util.bech32m import encode_puzzle_hash -from chia.util.config import ( - create_default_chia_config, +from flax.util.bech32m import encode_puzzle_hash +from flax.util.config import ( + create_default_flax_config, initial_config_file, load_config, lock_and_load_config, save_config, unflatten_properties, ) -from chia.util.db_version import set_db_version -from chia.util.keychain import Keychain -from chia.util.path import path_from_root -from chia.util.ssl_check import ( +from flax.util.db_version import set_db_version +from flax.util.keychain import Keychain +from flax.util.path import path_from_root +from flax.util.ssl_check import ( DEFAULT_PERMISSIONS_CERT_FILE, DEFAULT_PERMISSIONS_KEY_FILE, RESTRICT_MASK_CERT_FILE, @@ -35,14 +35,14 @@ check_and_fix_permissions_for_ssl_file, fix_ssl, ) -from chia.wallet.derive_keys import ( +from flax.wallet.derive_keys import ( master_sk_to_pool_sk, master_sk_to_wallet_sk_intermediate, master_sk_to_wallet_sk_unhardened_intermediate, _derive_path, _derive_path_unhardened, ) -from chia.cmds.configure import configure +from flax.cmds.configure import configure _all_private_node_names: List[str] = [ "full_node", @@ -83,14 +83,14 @@ def check_keys(new_root: Path, keychain: Optional[Keychain] = None) -> None: keychain = Keychain() all_sks = keychain.get_all_private_keys() if len(all_sks) == 0: - print("No keys are present in the keychain. Generate them with 'chia keys generate'") + print("No keys are present in the keychain. Generate them with 'flax keys generate'") return None with lock_and_load_config(new_root, "config.yaml") as config: pool_child_pubkeys = [master_sk_to_pool_sk(sk).get_g1() for sk, _ in all_sks] all_targets = [] - stop_searching_for_farmer = "xch_target_address" not in config["farmer"] - stop_searching_for_pool = "xch_target_address" not in config["pool"] + stop_searching_for_farmer = "xfx_target_address" not in config["farmer"] + stop_searching_for_pool = "xfx_target_address" not in config["pool"] number_of_ph_to_search = 50 selected = config["selected_network"] prefix = config["network_overrides"]["config"][selected]["address_prefix"] @@ -117,46 +117,46 @@ def check_keys(new_root: Path, keychain: Optional[Keychain] = None) -> None: all_targets.append( encode_puzzle_hash(create_puzzlehash_for_pk(_derive_path(intermediate_n, [i]).get_g1()), prefix) ) - if all_targets[-1] == config["farmer"].get("xch_target_address") or all_targets[-2] == config[ + if all_targets[-1] == config["farmer"].get("xfx_target_address") or all_targets[-2] == config[ "farmer" - ].get("xch_target_address"): + ].get("xfx_target_address"): stop_searching_for_farmer = True - if all_targets[-1] == config["pool"].get("xch_target_address") or all_targets[-2] == config["pool"].get( - "xch_target_address" + if all_targets[-1] == config["pool"].get("xfx_target_address") or all_targets[-2] == config["pool"].get( + "xfx_target_address" ): stop_searching_for_pool = True # Set the destinations, if necessary updated_target: bool = False - if "xch_target_address" not in config["farmer"]: + if "xfx_target_address" not in config["farmer"]: print( - f"Setting the xch destination for the farmer reward (1/8 plus fees, solo and pooling)" + f"Setting the xfx destination for the farmer reward (1/8 plus fees, solo and pooling)" f" to {all_targets[0]}" ) - config["farmer"]["xch_target_address"] = all_targets[0] + config["farmer"]["xfx_target_address"] = all_targets[0] updated_target = True - elif config["farmer"]["xch_target_address"] not in all_targets: + elif config["farmer"]["xfx_target_address"] not in all_targets: print( f"WARNING: using a farmer address which we might not have the private" f" keys for. We searched the first {number_of_ph_to_search} addresses. Consider overriding " - f"{config['farmer']['xch_target_address']} with {all_targets[0]}" + f"{config['farmer']['xfx_target_address']} with {all_targets[0]}" ) if "pool" not in config: config["pool"] = {} - if "xch_target_address" not in config["pool"]: - print(f"Setting the xch destination address for pool reward (7/8 for solo only) to {all_targets[0]}") - config["pool"]["xch_target_address"] = all_targets[0] + if "xfx_target_address" not in config["pool"]: + print(f"Setting the xfx destination address for pool reward (7/8 for solo only) to {all_targets[0]}") + config["pool"]["xfx_target_address"] = all_targets[0] updated_target = True - elif config["pool"]["xch_target_address"] not in all_targets: + elif config["pool"]["xfx_target_address"] not in all_targets: print( f"WARNING: using a pool address which we might not have the private" f" keys for. We searched the first {number_of_ph_to_search} addresses. Consider overriding " - f"{config['pool']['xch_target_address']} with {all_targets[0]}" + f"{config['pool']['xfx_target_address']} with {all_targets[0]}" ) if updated_target: print( - f"To change the XCH destination addresses, edit the `xch_target_address` entries in" + f"To change the XFX destination addresses, edit the `xfx_target_address` entries in" f" {(new_root / 'config' / 'config.yaml').absolute()}." ) @@ -246,10 +246,10 @@ def create_all_ssl( private_ca_key_path = ca_dir / "private_ca.key" private_ca_crt_path = ca_dir / "private_ca.crt" - chia_ca_crt, chia_ca_key = get_chia_ca_crt_key() - chia_ca_crt_path = ca_dir / "chia_ca.crt" - chia_ca_key_path = ca_dir / "chia_ca.key" - write_ssl_cert_and_key(chia_ca_crt_path, chia_ca_crt, chia_ca_key_path, chia_ca_key, overwrite=overwrite) + flax_ca_crt, flax_ca_key = get_flax_ca_crt_key() + flax_ca_crt_path = ca_dir / "flax_ca.crt" + flax_ca_key_path = ca_dir / "flax_ca.key" + write_ssl_cert_and_key(flax_ca_crt_path, flax_ca_crt, flax_ca_key_path, flax_ca_key, overwrite=overwrite) # If Private CA crt/key are passed-in, write them out if private_ca_crt_and_key is not None: @@ -287,11 +287,11 @@ def create_all_ssl( overwrite=overwrite, ) - chia_ca_crt, chia_ca_key = get_chia_ca_crt_key() + flax_ca_crt, flax_ca_key = get_flax_ca_crt_key() generate_ssl_for_nodes( ssl_dir, - chia_ca_crt, - chia_ca_key, + flax_ca_crt, + flax_ca_key, prefix="public", nodes=public_node_names, overwrite=False, @@ -362,7 +362,7 @@ def init( print(f"** {root_path} does not exist. Executing core init **") # sanity check here to prevent infinite recursion if ( - chia_init( + flax_init( root_path, fix_ssl_permissions=fix_ssl_permissions, testnet=testnet, @@ -376,10 +376,10 @@ def init( print(f"** {root_path} was not created. Exiting **") return -1 else: - return chia_init(root_path, fix_ssl_permissions=fix_ssl_permissions, testnet=testnet, v1_db=v1_db) + return flax_init(root_path, fix_ssl_permissions=fix_ssl_permissions, testnet=testnet, v1_db=v1_db) -def chia_version_number() -> Tuple[str, str, str, str]: +def flax_version_number() -> Tuple[str, str, str, str]: scm_full_version = __version__ left_full_version = scm_full_version.split("+") @@ -427,12 +427,12 @@ def chia_version_number() -> Tuple[str, str, str, str]: return major_release_number, minor_release_number, patch_release_number, dev_release_number -def chia_full_version_str() -> str: - major, minor, patch, dev = chia_version_number() +def flax_full_version_str() -> str: + major, minor, patch, dev = flax_version_number() return f"{major}.{minor}.{patch}{dev}" -def chia_init( +def flax_init( root_path: Path, *, should_check_keys: bool = True, @@ -448,13 +448,13 @@ def chia_init( protected Keychain. When launching the daemon from the GUI, we want the GUI to handle unlocking the keychain. """ - chia_root = os.environ.get("CHIA_ROOT", None) - if chia_root is not None: - print(f"CHIA_ROOT is set to {chia_root}") + flax_root = os.environ.get("FLAX_ROOT", None) + if flax_root is not None: + print(f"FLAX_ROOT is set to {flax_root}") - print(f"Chia directory {root_path}") + print(f"Flax directory {root_path}") if root_path.is_dir() and Path(root_path / "config" / "config.yaml").exists(): - # This is reached if CHIA_ROOT is set, or if user has run chia init twice + # This is reached if FLAX_ROOT is set, or if user has run flax init twice # before a new update. if testnet: configure( @@ -481,7 +481,7 @@ def chia_init( print(f"{root_path} already exists, no migration action taken") return -1 - create_default_chia_config(root_path) + create_default_flax_config(root_path) if testnet: configure( root_path, @@ -537,6 +537,6 @@ def chia_init( pass print("") - print("To see your keys, run 'chia keys show --show-mnemonic-seed'") + print("To see your keys, run 'flax keys show --show-mnemonic-seed'") return 0 diff --git a/chia/cmds/keys.py b/flax/cmds/keys.py similarity index 97% rename from chia/cmds/keys.py rename to flax/cmds/keys.py index ae9b1e14b..7fe6281c4 100644 --- a/chia/cmds/keys.py +++ b/flax/cmds/keys.py @@ -15,7 +15,7 @@ def keys_cmd(ctx: click.Context): root_path: Path = ctx.obj["root_path"] if not root_path.is_dir(): - raise RuntimeError("Please initialize (or migrate) your config directory with chia init") + raise RuntimeError("Please initialize (or migrate) your config directory with flax init") if ctx.obj["force_legacy_keyring_migration"] and not asyncio.run(migrate_keys(root_path, True)): sys.exit(1) @@ -47,7 +47,7 @@ def generate_cmd(ctx: click.Context, label: Optional[str]): "--non-observer-derivation", "-d", help=( - "Show the first wallet address using non-observer derivation. Older Chia versions use " + "Show the first wallet address using non-observer derivation. Older Flax versions use " "non-observer derivation when generating wallet addresses." ), default=False, @@ -159,7 +159,7 @@ def delete_cmd(ctx: click.Context, fingerprint: int): @keys_cmd.command("delete_all", short_help="Delete all private keys in keychain") def delete_all_cmd(): - from chia.util.keychain import Keychain + from flax.util.keychain import Keychain Keychain().delete_all_keys() @@ -215,7 +215,7 @@ def verify_cmd(message: str, public_key: str, signature: str): verify(message, public_key, signature) -@keys_cmd.command("migrate", short_help="Attempt to migrate keys to the Chia keyring") +@keys_cmd.command("migrate", short_help="Attempt to migrate keys to the Flax keyring") @click.pass_context def migrate_cmd(ctx: click.Context): from .keys_funcs import migrate_keys @@ -283,7 +283,7 @@ def derive_cmd(ctx: click.Context, fingerprint: Optional[int], filename: Optiona "non-observer derivation should be used at that index. Example HD path: m/12381n/8444n/2/", type=str, ) -@click.option("--prefix", "-x", help="Address prefix (xch for mainnet, txch for testnet)", default=None, type=str) +@click.option("--prefix", "-x", help="Address prefix (xfx for mainnet, txfx for testnet)", default=None, type=str) @click.pass_context def search_cmd( ctx: click.Context, @@ -327,7 +327,7 @@ def search_cmd( "--index", "-i", help="Index of the first wallet address to derive. Index 0 is the first wallet address.", default=0 ) @click.option("--count", "-n", help="Number of wallet addresses to derive, starting at index.", default=1) -@click.option("--prefix", "-x", help="Address prefix (xch for mainnet, txch for testnet)", default=None, type=str) +@click.option("--prefix", "-x", help="Address prefix (xfx for mainnet, txfx for testnet)", default=None, type=str) @click.option( "--non-observer-derivation", "-d", diff --git a/chia/cmds/keys_funcs.py b/flax/cmds/keys_funcs.py similarity index 95% rename from chia/cmds/keys_funcs.py rename to flax/cmds/keys_funcs.py index 78b588464..a011abd4b 100644 --- a/chia/cmds/keys_funcs.py +++ b/flax/cmds/keys_funcs.py @@ -7,20 +7,20 @@ from pathlib import Path from typing import Any, Dict, List, Optional, Tuple, Union -from chia.consensus.coinbase import create_puzzlehash_for_pk -from chia.cmds.passphrase_funcs import obtain_current_passphrase -from chia.daemon.client import connect_to_daemon_and_validate -from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain -from chia.util.bech32m import encode_puzzle_hash -from chia.util.errors import KeychainNotSet -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.errors import KeychainException -from chia.util.file_keyring import MAX_LABEL_LENGTH -from chia.util.ints import uint32 -from chia.util.keychain import Keychain, bytes_to_mnemonic, generate_mnemonic, mnemonic_to_seed -from chia.util.keyring_wrapper import KeyringWrapper -from chia.wallet.derive_keys import ( +from flax.consensus.coinbase import create_puzzlehash_for_pk +from flax.cmds.passphrase_funcs import obtain_current_passphrase +from flax.daemon.client import connect_to_daemon_and_validate +from flax.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain +from flax.util.bech32m import encode_puzzle_hash +from flax.util.errors import KeychainNotSet +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.errors import KeychainException +from flax.util.file_keyring import MAX_LABEL_LENGTH +from flax.util.ints import uint32 +from flax.util.keychain import Keychain, bytes_to_mnemonic, generate_mnemonic, mnemonic_to_seed +from flax.util.keyring_wrapper import KeyringWrapper +from flax.wallet.derive_keys import ( master_sk_to_farmer_sk, master_sk_to_pool_sk, master_sk_to_wallet_sk, @@ -49,7 +49,7 @@ def generate_and_print(): mnemonic = generate_mnemonic() print("Generating private key. Mnemonic (24 secret words):") print(mnemonic) - print("Note that this key has not been added to the keychain. Run chia keys add") + print("Note that this key has not been added to the keychain. Run flax keys add") return mnemonic @@ -99,7 +99,7 @@ def print_line(fingerprint: str, label: str) -> None: keys = Keychain().get_keys() if len(keys) == 0: - sys.exit("No keys are present in the keychain. Generate them with 'chia keys generate'") + sys.exit("No keys are present in the keychain. Generate them with 'flax keys generate'") print_line("fingerprint", "label") print_line("-" * fingerprint_width, "-" * MAX_LABEL_LENGTH) @@ -188,7 +188,7 @@ def derive_sk_from_hd_path(master_sk: PrivateKey, hd_path_root: str) -> Tuple[Pr and returns the derived key and the HD path that was used to derive it. """ - from chia.wallet.derive_keys import _derive_path, _derive_path_unhardened + from flax.wallet.derive_keys import _derive_path, _derive_path_unhardened class DerivationType(Enum): NONOBSERVER = 0 @@ -246,12 +246,12 @@ def verify(message: str, public_key: str, signature: str): async def migrate_keys(root_path: Path, forced: bool = False) -> bool: - from chia.util.keyring_wrapper import KeyringWrapper - from chia.util.misc import prompt_yes_no + from flax.util.keyring_wrapper import KeyringWrapper + from flax.util.misc import prompt_yes_no deprecation_message = ( "\nLegacy keyring support is deprecated and will be removed in an upcoming version. " - "You need to migrate your keyring to continue using Chia.\n" + "You need to migrate your keyring to continue using Flax.\n" ) # Check if the keyring needs a full migration (i.e. if it's using the old keyring) @@ -295,7 +295,7 @@ async def migrate_keys(root_path: Path, forced: bool = False) -> bool: print() if not prompt_yes_no("Migrate these keys?"): await keychain_proxy.close() - print("Migration aborted, can't run any chia commands.") + print("Migration aborted, can't run any flax commands.") return False for sk, seed_bytes in keys_to_migrate: @@ -356,7 +356,7 @@ def _search_derived( the provided search terms. """ - from chia.wallet.derive_keys import _derive_path, _derive_path_unhardened + from flax.wallet.derive_keys import _derive_path, _derive_path_unhardened class DerivedSearchResultType(Enum): PUBLIC_KEY = "public key" @@ -657,7 +657,7 @@ def derive_child_key( Derive child keys from the provided master key. """ - from chia.wallet.derive_keys import _derive_path, _derive_path_unhardened + from flax.wallet.derive_keys import _derive_path, _derive_path_unhardened derivation_root_sk: Optional[PrivateKey] = None hd_path_root: Optional[str] = None diff --git a/chia/cmds/netspace.py b/flax/cmds/netspace.py similarity index 100% rename from chia/cmds/netspace.py rename to flax/cmds/netspace.py diff --git a/chia/cmds/netspace_funcs.py b/flax/cmds/netspace_funcs.py similarity index 92% rename from chia/cmds/netspace_funcs.py rename to flax/cmds/netspace_funcs.py index 7c76ad388..b5b374c88 100644 --- a/chia/cmds/netspace_funcs.py +++ b/flax/cmds/netspace_funcs.py @@ -2,10 +2,10 @@ from typing import Optional -from chia.cmds.cmds_util import get_any_service_client -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.util.byte_types import hexstr_to_bytes -from chia.util.misc import format_bytes +from flax.cmds.cmds_util import get_any_service_client +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.util.byte_types import hexstr_to_bytes +from flax.util.misc import format_bytes async def netstorge_async(rpc_port: Optional[int], delta_block_height: str, start: str) -> None: diff --git a/chia/cmds/passphrase.py b/flax/cmds/passphrase.py similarity index 99% rename from chia/cmds/passphrase.py rename to flax/cmds/passphrase.py index 0f6934a83..e25815f45 100644 --- a/chia/cmds/passphrase.py +++ b/flax/cmds/passphrase.py @@ -4,7 +4,7 @@ from io import TextIOWrapper from typing import Optional -from chia.util.config import load_config +from flax.util.config import load_config @click.group("passphrase", short_help="Manage your keyring passphrase") diff --git a/chia/cmds/passphrase_funcs.py b/flax/cmds/passphrase_funcs.py similarity index 95% rename from chia/cmds/passphrase_funcs.py rename to flax/cmds/passphrase_funcs.py index 9f5aab28a..51bed16bb 100644 --- a/chia/cmds/passphrase_funcs.py +++ b/flax/cmds/passphrase_funcs.py @@ -4,13 +4,13 @@ import sys import time -from chia.daemon.client import acquire_connection_to_daemon -from chia.util.config import load_config -from chia.util.errors import KeychainMaxUnlockAttempts -from chia.util.keychain import Keychain, supports_os_passphrase_storage -from chia.util.keyring_wrapper import KeyringWrapper, DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE -from chia.util.misc import prompt_yes_no -from chia.util.ws_message import WsRpcMessage +from flax.daemon.client import acquire_connection_to_daemon +from flax.util.config import load_config +from flax.util.errors import KeychainMaxUnlockAttempts +from flax.util.keychain import Keychain, supports_os_passphrase_storage +from flax.util.keyring_wrapper import KeyringWrapper, DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE +from flax.util.misc import prompt_yes_no +from flax.util.ws_message import WsRpcMessage from getpass import getpass from io import TextIOWrapper from pathlib import Path @@ -118,7 +118,7 @@ def prompt_to_save_passphrase() -> bool: print( "\n" "Your passphrase can be stored in your system's secure credential store. " - "Other Chia processes will be able to access your keys without prompting for your passphrase." + "Other Flax processes will be able to access your keys without prompting for your passphrase." ) if warning is not None: colorama.init() @@ -155,7 +155,7 @@ def prompt_for_new_passphrase() -> Tuple[str, bool]: def read_passphrase_from_file(passphrase_file: TextIOWrapper) -> str: - passphrase = passphrase_file.read().rstrip(os.environ.get("CHIA_PASSPHRASE_STRIP_TRAILING_CHARS", "\r\n")) + passphrase = passphrase_file.read().rstrip(os.environ.get("FLAX_PASSPHRASE_STRIP_TRAILING_CHARS", "\r\n")) passphrase_file.close() return passphrase @@ -163,7 +163,7 @@ def read_passphrase_from_file(passphrase_file: TextIOWrapper) -> str: def initialize_passphrase() -> None: if Keychain.has_master_passphrase(): print("Keyring is already protected by a passphrase") - print("\nUse 'chia passphrase set' or 'chia passphrase remove' to update or remove your passphrase") + print("\nUse 'flax passphrase set' or 'flax passphrase remove' to update or remove your passphrase") sys.exit(1) # We'll rely on Keyring initialization to leverage the cached passphrase for diff --git a/chia/cmds/peer.py b/flax/cmds/peer.py similarity index 93% rename from chia/cmds/peer.py rename to flax/cmds/peer.py index c636635da..1113b9067 100644 --- a/chia/cmds/peer.py +++ b/flax/cmds/peer.py @@ -4,8 +4,8 @@ import click -from chia.cmds.cmds_util import NODE_TYPES -from chia.cmds.peer_funcs import peer_async +from flax.cmds.cmds_util import NODE_TYPES +from flax.cmds.peer_funcs import peer_async @click.command("peer", short_help="Show, or modify peering connections", no_args_is_help=True) diff --git a/chia/cmds/peer_funcs.py b/flax/cmds/peer_funcs.py similarity index 92% rename from chia/cmds/peer_funcs.py rename to flax/cmds/peer_funcs.py index 963bf51b7..d04aeb963 100644 --- a/chia/cmds/peer_funcs.py +++ b/flax/cmds/peer_funcs.py @@ -3,8 +3,8 @@ from pathlib import Path from typing import Any, Dict, Optional -from chia.cmds.cmds_util import get_any_service_client -from chia.rpc.rpc_client import RpcClient +from flax.cmds.cmds_util import get_any_service_client +from flax.rpc.rpc_client import RpcClient async def add_node_connection(rpc_client: RpcClient, add_connection: str) -> None: @@ -23,7 +23,7 @@ async def add_node_connection(rpc_client: RpcClient, add_connection: str) -> Non async def remove_node_connection(rpc_client: RpcClient, remove_connection: str) -> None: - from chia.server.outbound_message import NodeType + from flax.server.outbound_message import NodeType result_txt = "" if len(remove_connection) != 8: @@ -49,8 +49,8 @@ async def remove_node_connection(rpc_client: RpcClient, remove_connection: str) async def print_connections(rpc_client: RpcClient, trusted_peers: Dict[str, Any]) -> None: import time - from chia.server.outbound_message import NodeType - from chia.util.network import is_trusted_inner + from flax.server.outbound_message import NodeType + from flax.util.network import is_trusted_inner connections = await rpc_client.get_connections() print("Connections:") diff --git a/chia/cmds/plotnft.py b/flax/cmds/plotnft.py similarity index 96% rename from chia/cmds/plotnft.py rename to flax/cmds/plotnft.py index 79fb3049c..fc7817a1b 100644 --- a/chia/cmds/plotnft.py +++ b/flax/cmds/plotnft.py @@ -2,7 +2,7 @@ from typing import Optional import click -from chia.cmds.cmds_util import execute_with_wallet +from flax.cmds.cmds_util import execute_with_wallet MAX_CMDLINE_FEE = Decimal(0.5) @@ -12,7 +12,7 @@ def validate_fee(ctx, param, value): try: fee = Decimal(value) except ValueError: - raise click.BadParameter("Fee must be decimal dotted value in XCH (e.g. 0.00005)") + raise click.BadParameter("Fee must be decimal dotted value in XFX (e.g. 0.00005)") if fee < 0 or fee > MAX_CMDLINE_FEE: raise click.BadParameter(f"Fee must be in the range 0 to {MAX_CMDLINE_FEE}") return value @@ -60,7 +60,7 @@ def get_login_link_cmd(launcher_id: str) -> None: @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH. Fee is used TWICE: once to create the singleton, once for init.", + help="Set the fees per transaction, in XFX. Fee is used TWICE: once to create the singleton, once for init.", type=str, default="0", show_default=True, @@ -110,7 +110,7 @@ def create_cmd( @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH. Fee is used TWICE: once to leave pool, once to join.", + help="Set the fees per transaction, in XFX. Fee is used TWICE: once to leave pool, once to join.", type=str, default="0", show_default=True, @@ -140,7 +140,7 @@ def join_cmd(wallet_rpc_port: Optional[int], fingerprint: int, id: int, fee: int @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH. Fee is charged TWICE.", + help="Set the fees per transaction, in XFX. Fee is charged TWICE.", type=str, default="0", show_default=True, @@ -188,7 +188,7 @@ def inspect(wallet_rpc_port: Optional[int], fingerprint: int, id: int) -> None: @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH.", + help="Set the fees per transaction, in XFX.", type=str, default="0", show_default=True, diff --git a/chia/cmds/plotnft_funcs.py b/flax/cmds/plotnft_funcs.py similarity index 92% rename from chia/cmds/plotnft_funcs.py rename to flax/cmds/plotnft_funcs.py index f0409a057..5952ad641 100644 --- a/chia/cmds/plotnft_funcs.py +++ b/flax/cmds/plotnft_funcs.py @@ -10,24 +10,24 @@ from pprint import pprint from typing import Any, List, Dict, Optional, Callable -from chia.cmds.units import units -from chia.cmds.wallet_funcs import print_balance, wallet_coin_unit -from chia.pools.pool_config import load_pool_config, PoolWalletConfig, update_pool_config -from chia.pools.pool_wallet_info import PoolWalletInfo, PoolSingletonState -from chia.protocols.pool_protocol import POOL_PROTOCOL_VERSION -from chia.rpc.farmer_rpc_client import FarmerRpcClient -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.server.server import ssl_context_for_root -from chia.ssl.create_ssl import get_mozilla_ca_crt -from chia.util.bech32m import encode_puzzle_hash, decode_puzzle_hash -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint32, uint64 -from chia.cmds.cmds_util import transaction_submitted_msg, transaction_status_msg, get_any_service_client -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.wallet_types import WalletType +from flax.cmds.units import units +from flax.cmds.wallet_funcs import print_balance, wallet_coin_unit +from flax.pools.pool_config import load_pool_config, PoolWalletConfig, update_pool_config +from flax.pools.pool_wallet_info import PoolWalletInfo, PoolSingletonState +from flax.protocols.pool_protocol import POOL_PROTOCOL_VERSION +from flax.rpc.farmer_rpc_client import FarmerRpcClient +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.server.server import ssl_context_for_root +from flax.ssl.create_ssl import get_mozilla_ca_crt +from flax.util.bech32m import encode_puzzle_hash, decode_puzzle_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint32, uint64 +from flax.cmds.cmds_util import transaction_submitted_msg, transaction_status_msg, get_any_service_client +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.wallet_types import WalletType async def create_pool_args(pool_url: str) -> Dict: @@ -57,7 +57,7 @@ async def create(args: dict, wallet_client: WalletRpcClient, fingerprint: int) - state = args["state"] prompt = not args.get("yes", False) fee = Decimal(args.get("fee", 0)) - fee_mojos = uint64(int(fee * units["chia"])) + fee_mojos = uint64(int(fee * units["flax"])) target_puzzle_hash: Optional[bytes32] # Could use initial_pool_state_from_dict to simplify if state == "SELF_POOLING": @@ -104,7 +104,7 @@ async def create(args: dict, wallet_client: WalletRpcClient, fingerprint: int) - print(transaction_status_msg(fingerprint, tx_record.name)) return None except Exception as e: - print(f"Error creating plot NFT: {e}\n Please start both farmer and wallet with: chia start -r farmer") + print(f"Error creating plot NFT: {e}\n Please start both farmer and wallet with: flax start -r farmer") return print("Aborting.") @@ -265,7 +265,7 @@ async def join_pool(args: dict, wallet_client: WalletRpcClient, fingerprint: int enforce_https = config["full_node"]["selected_network"] == "mainnet" pool_url: str = args["pool_url"] fee = Decimal(args.get("fee", 0)) - fee_mojos = uint64(int(fee * units["chia"])) + fee_mojos = uint64(int(fee * units["flax"])) if enforce_https and not pool_url.startswith("https://"): print(f"Pool URLs must be HTTPS on mainnet {pool_url}. Aborting.") @@ -309,7 +309,7 @@ async def self_pool(args: dict, wallet_client: WalletRpcClient, fingerprint: int wallet_id = args.get("id", None) prompt = not args.get("yes", False) fee = Decimal(args.get("fee", 0)) - fee_mojos = uint64(int(fee * units["chia"])) + fee_mojos = uint64(int(fee * units["flax"])) msg = f"Will start self-farming with Plot NFT on wallet id {wallet_id} fingerprint {fingerprint}." func = functools.partial(wallet_client.pw_self_pool, wallet_id, fee_mojos) @@ -332,7 +332,7 @@ async def inspect_cmd(args: dict, wallet_client: WalletRpcClient, fingerprint: i async def claim_cmd(args: dict, wallet_client: WalletRpcClient, fingerprint: int) -> None: wallet_id = args.get("id", None) fee = Decimal(args.get("fee", 0)) - fee_mojos = uint64(int(fee * units["chia"])) + fee_mojos = uint64(int(fee * units["flax"])) msg = f"\nWill claim rewards for wallet ID: {wallet_id}." func = functools.partial( wallet_client.pw_absorb_rewards, diff --git a/chia/cmds/plots.py b/flax/cmds/plots.py similarity index 91% rename from chia/cmds/plots.py rename to flax/cmds/plots.py index 3d7d5e757..32ee5eb83 100644 --- a/chia/cmds/plots.py +++ b/flax/cmds/plots.py @@ -7,21 +7,21 @@ import click -from chia.plotting.util import add_plot_directory, validate_plot_size +from flax.plotting.util import add_plot_directory, validate_plot_size DEFAULT_STRIPE_SIZE = 65536 log = logging.getLogger(__name__) def show_plots(root_path: Path): - from chia.plotting.util import get_plot_directories + from flax.plotting.util import get_plot_directories print("Directories where plots are being searched for:") print("Note that subdirectories must be added manually") print( - "Add with 'chia plots add -d [dir]' and remove with" - + " 'chia plots remove -d [dir]'" - + " Scan and check plots with 'chia plots check'" + "Add with 'flax plots add -d [dir]' and remove with" + + " 'flax plots remove -d [dir]'" + + " Scan and check plots with 'flax plots check'" ) print() for str_path in get_plot_directories(root_path): @@ -32,11 +32,11 @@ def show_plots(root_path: Path): @click.pass_context def plots_cmd(ctx: click.Context): """Create, add, remove and check your plots""" - from chia.util.chia_logging import initialize_logging + from flax.util.flax_logging import initialize_logging root_path: Path = ctx.obj["root_path"] if not root_path.is_dir(): - raise RuntimeError("Please initialize (or migrate) your config directory with 'chia init'") + raise RuntimeError("Please initialize (or migrate) your config directory with 'flax init'") initialize_logging("", {"log_level": "INFO", "log_stdout": True}, root_path) @@ -116,7 +116,7 @@ def create_cmd( exclude_final_dir: bool, connect_to_daemon: bool, ): - from chia.plotting.create_plots import create_plots, resolve_plot_keys + from flax.plotting.create_plots import create_plots, resolve_plot_keys class Params(object): def __init__(self): @@ -176,7 +176,7 @@ def __init__(self): def check_cmd( ctx: click.Context, num: int, grep_string: str, list_duplicates: bool, debug_show_memo: bool, challenge_start: int ): - from chia.plotting.check_plots import check_plots + from flax.plotting.check_plots import check_plots check_plots(ctx.obj["root_path"], num, challenge_start, grep_string, list_duplicates, debug_show_memo) @@ -192,7 +192,7 @@ def check_cmd( ) @click.pass_context def add_cmd(ctx: click.Context, final_dir: str): - from chia.plotting.util import add_plot_directory + from flax.plotting.util import add_plot_directory try: add_plot_directory(ctx.obj["root_path"], final_dir) @@ -212,7 +212,7 @@ def add_cmd(ctx: click.Context, final_dir: str): ) @click.pass_context def remove_cmd(ctx: click.Context, final_dir: str): - from chia.plotting.util import remove_plot_directory + from flax.plotting.util import remove_plot_directory remove_plot_directory(ctx.obj["root_path"], final_dir) diff --git a/chia/cmds/plotters.py b/flax/cmds/plotters.py similarity index 86% rename from chia/cmds/plotters.py rename to flax/cmds/plotters.py index 84fe4367d..cc03d3b22 100644 --- a/chia/cmds/plotters.py +++ b/flax/cmds/plotters.py @@ -1,5 +1,5 @@ import click -from chia.plotters.plotters import call_plotters +from flax.plotters.plotters import call_plotters @click.command( diff --git a/chia/cmds/rpc.py b/flax/cmds/rpc.py similarity index 96% rename from chia/cmds/rpc.py rename to flax/cmds/rpc.py index 541980b38..72be01892 100644 --- a/chia/cmds/rpc.py +++ b/flax/cmds/rpc.py @@ -8,15 +8,15 @@ import click from aiohttp import ClientResponseError -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint16 +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint16 services: List[str] = ["crawler", "farmer", "full_node", "harvester", "timelord", "wallet", "data_layer"] async def call_endpoint(service: str, endpoint: str, request: Dict[str, Any], config: Dict[str, Any]) -> Dict[str, Any]: - from chia.rpc.rpc_client import RpcClient + from flax.rpc.rpc_client import RpcClient port: uint16 if service == "crawler": diff --git a/chia/cmds/show.py b/flax/cmds/show.py similarity index 87% rename from chia/cmds/show.py rename to flax/cmds/show.py index 2e79d059e..7e304d608 100644 --- a/chia/cmds/show.py +++ b/flax/cmds/show.py @@ -2,7 +2,7 @@ import click -from chia.cmds.show_funcs import show_async +from flax.cmds.show_funcs import show_async @click.command("show", short_help="Show node information", no_args_is_help=True) @@ -52,13 +52,13 @@ def show_cmd( import asyncio if connections: - print("'chia show -c' has been renamed to 'chia peer -c' ") + print("'flax show -c' has been renamed to 'flax peer -c' ") if add_connection != "": - print("'chia show -a' has been renamed to 'chia peer -a' ") + print("'flax show -a' has been renamed to 'flax peer -a' ") if remove_connection != "": - print("'chia show -r' has been renamed to 'chia peer -r' ") + print("'flax show -r' has been renamed to 'flax peer -r' ") if wallet_rpc_port is not None: - print("'chia show -wp' is not used, please remove it from your command.") + print("'flax show -wp' is not used, please remove it from your command.") asyncio.run( show_async( rpc_port, diff --git a/chia/cmds/show_funcs.py b/flax/cmds/show_funcs.py similarity index 93% rename from chia/cmds/show_funcs.py rename to flax/cmds/show_funcs.py index 94e73ebaf..c9f38d239 100644 --- a/chia/cmds/show_funcs.py +++ b/flax/cmds/show_funcs.py @@ -3,15 +3,15 @@ from pathlib import Path from typing import Any, Dict, List, Optional, Union -from chia.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.rpc.full_node_rpc_client import FullNodeRpcClient async def print_blockchain_state(node_client: FullNodeRpcClient, config: Dict[str, Any]) -> bool: import time - from chia.consensus.block_record import BlockRecord - from chia.util.ints import uint64 - from chia.util.misc import format_bytes + from flax.consensus.block_record import BlockRecord + from flax.util.ints import uint64 + from flax.util.misc import format_bytes blockchain_state = await node_client.get_blockchain_state() if blockchain_state is None: @@ -48,7 +48,7 @@ async def print_blockchain_state(node_client: FullNodeRpcClient, config: Dict[st print(f"Current Blockchain Status: Not Synced. Peak height: {peak.height}") else: print("\nSearching for an initial chain\n") - print("You may be able to expedite with 'chia show -a host:port' using a known node.\n") + print("You may be able to expedite with 'flax show -a host:port' using a known node.\n") if peak is not None: if peak.is_transaction_block: @@ -94,11 +94,11 @@ async def print_block_from_hash( ) -> None: import time - from chia.consensus.block_record import BlockRecord - from chia.types.blockchain_format.sized_bytes import bytes32 - from chia.types.full_block import FullBlock - from chia.util.bech32m import encode_puzzle_hash - from chia.util.byte_types import hexstr_to_bytes + from flax.consensus.block_record import BlockRecord + from flax.types.blockchain_format.sized_bytes import bytes32 + from flax.types.full_block import FullBlock + from flax.util.bech32m import encode_puzzle_hash + from flax.util.byte_types import hexstr_to_bytes block: Optional[BlockRecord] = await node_client.get_block_record(hexstr_to_bytes(block_by_header_hash)) full_block: Optional[FullBlock] = await node_client.get_block(hexstr_to_bytes(block_by_header_hash)) @@ -183,7 +183,7 @@ async def show_async( block_header_hash_by_height: str, block_by_header_hash: str, ) -> None: - from chia.cmds.cmds_util import get_any_service_client + from flax.cmds.cmds_util import get_any_service_client node_client: Optional[FullNodeRpcClient] async with get_any_service_client("full_node", rpc_port, root_path) as node_config_fp: diff --git a/chia/cmds/start.py b/flax/cmds/start.py similarity index 81% rename from chia/cmds/start.py rename to flax/cmds/start.py index 9d9b1303a..45850232a 100644 --- a/chia/cmds/start.py +++ b/flax/cmds/start.py @@ -1,7 +1,7 @@ import click -from chia.util.config import load_config -from chia.util.service_groups import all_groups +from flax.util.config import load_config +from flax.util.service_groups import all_groups @click.command("start", short_help="Start service groups") @@ -10,7 +10,7 @@ @click.pass_context def start_cmd(ctx: click.Context, restart: bool, group: str) -> None: import asyncio - from chia.cmds.beta_funcs import warn_if_beta_enabled + from flax.cmds.beta_funcs import warn_if_beta_enabled from .start_funcs import async_start root_path = ctx.obj["root_path"] diff --git a/chia/cmds/start_funcs.py b/flax/cmds/start_funcs.py similarity index 87% rename from chia/cmds/start_funcs.py rename to flax/cmds/start_funcs.py index 0d1a14fa1..231c57197 100644 --- a/chia/cmds/start_funcs.py +++ b/flax/cmds/start_funcs.py @@ -7,16 +7,16 @@ from pathlib import Path from typing import Any, Dict, Optional -from chia.cmds.keys_funcs import migrate_keys -from chia.cmds.passphrase_funcs import get_current_passphrase -from chia.daemon.client import DaemonProxy, connect_to_daemon_and_validate -from chia.util.errors import KeychainMaxUnlockAttempts -from chia.util.keychain import Keychain -from chia.util.service_groups import services_for_groups +from flax.cmds.keys_funcs import migrate_keys +from flax.cmds.passphrase_funcs import get_current_passphrase +from flax.daemon.client import DaemonProxy, connect_to_daemon_and_validate +from flax.util.errors import KeychainMaxUnlockAttempts +from flax.util.keychain import Keychain +from flax.util.service_groups import services_for_groups def launch_start_daemon(root_path: Path) -> subprocess.Popen: - os.environ["CHIA_ROOT"] = str(root_path) + os.environ["FLAX_ROOT"] = str(root_path) # TODO: use startupinfo=subprocess.DETACHED_PROCESS on windows process = subprocess.Popen([sys.argv[0], "run_daemon", "--wait-for-unlock"], stdout=subprocess.PIPE) return process @@ -60,7 +60,7 @@ async def async_start( return None if daemon is None: - print("Failed to create the chia daemon") + print("Failed to create the flax daemon") return None if force_keyring_migration: diff --git a/chia/cmds/stop.py b/flax/cmds/stop.py similarity index 86% rename from chia/cmds/stop.py rename to flax/cmds/stop.py index 55962ee22..b6bdeff89 100644 --- a/chia/cmds/stop.py +++ b/flax/cmds/stop.py @@ -7,16 +7,16 @@ import click -from chia.util.config import load_config -from chia.util.service_groups import all_groups, services_for_groups +from flax.util.config import load_config +from flax.util.service_groups import all_groups, services_for_groups async def async_stop(root_path: Path, config: Dict[str, Any], group: str, stop_daemon: bool) -> int: - from chia.daemon.client import connect_to_daemon_and_validate + from flax.daemon.client import connect_to_daemon_and_validate daemon = await connect_to_daemon_and_validate(root_path, config) if daemon is None: - print("Couldn't connect to chia daemon") + print("Couldn't connect to flax daemon") return 1 if stop_daemon: @@ -52,7 +52,7 @@ async def async_stop(root_path: Path, config: Dict[str, Any], group: str, stop_d @click.argument("group", type=click.Choice(list(all_groups())), nargs=-1, required=True) @click.pass_context def stop_cmd(ctx: click.Context, daemon: bool, group: str) -> None: - from chia.cmds.beta_funcs import warn_if_beta_enabled + from flax.cmds.beta_funcs import warn_if_beta_enabled root_path = ctx.obj["root_path"] config = load_config(root_path, "config.yaml") diff --git a/chia/cmds/units.py b/flax/cmds/units.py similarity index 80% rename from chia/cmds/units.py rename to flax/cmds/units.py index d352d4813..4686ef901 100644 --- a/chia/cmds/units.py +++ b/flax/cmds/units.py @@ -5,7 +5,7 @@ # The rest of the codebase uses mojos everywhere. # Only use these units for user facing interfaces. units: Dict[str, int] = { - "chia": 10**12, # 1 chia (XCH) is 1,000,000,000,000 mojo (1 trillion) + "flax": 10**12, # 1 flax (XFX) is 1,000,000,000,000 mojo (1 trillion) "mojo": 1, "cat": 10**3, # 1 CAT is 1000 CAT mojos } diff --git a/chia/cmds/wallet.py b/flax/cmds/wallet.py similarity index 97% rename from chia/cmds/wallet.py rename to flax/cmds/wallet.py index 038a690c6..1bee27470 100644 --- a/chia/cmds/wallet.py +++ b/flax/cmds/wallet.py @@ -3,11 +3,11 @@ import click -from chia.cmds.plotnft import validate_fee -from chia.wallet.transaction_sorting import SortKey -from chia.wallet.util.address_type import AddressType -from chia.wallet.util.wallet_types import WalletType -from chia.cmds.cmds_util import execute_with_wallet +from flax.cmds.plotnft import validate_fee +from flax.wallet.transaction_sorting import SortKey +from flax.wallet.util.address_type import AddressType +from flax.wallet.util.wallet_types import WalletType +from flax.cmds.cmds_util import execute_with_wallet @click.group("wallet", short_help="Manage your wallet") @@ -126,7 +126,7 @@ def get_transactions_cmd( sys.stdout.close() -@wallet_cmd.command("send", short_help="Send chia to another wallet") +@wallet_cmd.command("send", short_help="Send flax to another wallet") @click.option( "-wp", "--wallet-rpc-port", @@ -136,25 +136,25 @@ def get_transactions_cmd( ) @click.option("-f", "--fingerprint", help="Set the fingerprint to specify which wallet to use", type=int) @click.option("-i", "--id", help="Id of the wallet to use", type=int, default=1, show_default=True, required=True) -@click.option("-a", "--amount", help="How much chia to send, in XCH", type=str, required=True) +@click.option("-a", "--amount", help="How much flax to send, in XFX", type=str, required=True) @click.option("-e", "--memo", help="Additional memo for the transaction", type=str, default=None) @click.option( "-m", "--fee", - help="Set the fees for the transaction, in XCH", + help="Set the fees for the transaction, in XFX", type=str, default="0", show_default=True, required=True, ) -@click.option("-t", "--address", help="Address to send the XCH", type=str, required=True) +@click.option("-t", "--address", help="Address to send the XFX", type=str, required=True) @click.option( "-o", "--override", help="Submits transaction without checking for unusual values", is_flag=True, default=False ) @click.option( "-ma", "--min_coin_amount", - help="Ignore coins worth less then this much XCH or CAT units", + help="Ignore coins worth less then this much XFX or CAT units", type=str, required=False, default="0", @@ -288,7 +288,7 @@ def get_derivation_index_cmd(wallet_rpc_port: Optional[int], fingerprint: int) - @click.option("-a", "--address", help="The address you want to use for signing", type=str, required=True) @click.option("-m", "--hex_message", help="The hex message you want sign", type=str, required=True) def address_sign_message(wallet_rpc_port: Optional[int], fingerprint: int, address: str, hex_message: str) -> None: - extra_params: Dict[str, Any] = {"address": address, "message": hex_message, "type": AddressType.XCH} + extra_params: Dict[str, Any] = {"address": address, "message": hex_message, "type": AddressType.XFX} import asyncio from .wallet_funcs import sign_message @@ -351,7 +351,7 @@ def add_token_cmd(wallet_rpc_port: Optional[int], asset_id: str, token_name: str asyncio.run(execute_with_wallet(wallet_rpc_port, fingerprint, extra_params, add_token)) -@wallet_cmd.command("make_offer", short_help="Create an offer of XCH/CATs for XCH/CATs") +@wallet_cmd.command("make_offer", short_help="Create an offer of XFX/CATs for XFX/CATs") @click.option( "-wp", "--wallet-rpc-port", @@ -500,7 +500,7 @@ def did_cmd(): @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH.", + help="Set the fees per transaction, in XFX.", type=str, default="0", show_default=True, @@ -641,7 +641,7 @@ def nft_sign_message(wallet_rpc_port: Optional[int], fingerprint: int, nft_id: s @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH.", + help="Set the fees per transaction, in XFX.", type=str, default="0", show_default=True, @@ -722,7 +722,7 @@ def nft_mint_cmd( @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH.", + help="Set the fees per transaction, in XFX.", type=str, default="0", show_default=True, @@ -767,7 +767,7 @@ def nft_add_uri_cmd( @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH.", + help="Set the fees per transaction, in XFX.", type=str, default="0", show_default=True, @@ -826,7 +826,7 @@ def nft_list_cmd(wallet_rpc_port: Optional[int], fingerprint: int, id: int) -> N @click.option( "-m", "--fee", - help="Set the fees per transaction, in XCH.", + help="Set the fees per transaction, in XFX.", type=str, default="0", show_default=True, @@ -912,7 +912,7 @@ def _send_notification( ) -> None: import asyncio from .wallet_funcs import send_notification - from chia.cmds.cmds_util import execute_with_wallet + from flax.cmds.cmds_util import execute_with_wallet extra_params = { "address": to_address, @@ -944,7 +944,7 @@ def _get_notifications( ) -> None: import asyncio from .wallet_funcs import get_notifications - from chia.cmds.cmds_util import execute_with_wallet + from flax.cmds.cmds_util import execute_with_wallet extra_params = { "ids": id, @@ -973,7 +973,7 @@ def _delete_notifications( ) -> None: import asyncio from .wallet_funcs import delete_notifications - from chia.cmds.cmds_util import execute_with_wallet + from flax.cmds.cmds_util import execute_with_wallet extra_params = { "ids": id, diff --git a/chia/cmds/wallet_funcs.py b/flax/cmds/wallet_funcs.py similarity index 92% rename from chia/cmds/wallet_funcs.py rename to flax/cmds/wallet_funcs.py index b72c5cde7..8d6159351 100644 --- a/chia/cmds/wallet_funcs.py +++ b/flax/cmds/wallet_funcs.py @@ -7,26 +7,26 @@ from decimal import Decimal from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Union -from chia.cmds.cmds_util import transaction_status_msg, transaction_submitted_msg -from chia.cmds.peer_funcs import print_connections -from chia.cmds.units import units -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.server.start_wallet import SERVICE_NAME -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.bech32m import bech32_decode, decode_puzzle_hash, encode_puzzle_hash -from chia.util.config import load_config, selected_network_address_prefix -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.nft_wallet.nft_info import NFTInfo -from chia.wallet.outer_puzzles import AssetType -from chia.wallet.puzzle_drivers import PuzzleInfo -from chia.wallet.trade_record import TradeRecord -from chia.wallet.trading.offer import Offer -from chia.wallet.trading.trade_status import TradeStatus -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.address_type import AddressType, ensure_valid_address -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_types import WalletType +from flax.cmds.cmds_util import transaction_status_msg, transaction_submitted_msg +from flax.cmds.peer_funcs import print_connections +from flax.cmds.units import units +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.server.start_wallet import SERVICE_NAME +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.bech32m import bech32_decode, decode_puzzle_hash, encode_puzzle_hash +from flax.util.config import load_config, selected_network_address_prefix +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.nft_wallet.nft_info import NFTInfo +from flax.wallet.outer_puzzles import AssetType +from flax.wallet.puzzle_drivers import PuzzleInfo +from flax.wallet.trade_record import TradeRecord +from flax.wallet.trading.offer import Offer +from flax.wallet.trading.trade_status import TradeStatus +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.address_type import AddressType, ensure_valid_address +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_types import WalletType CATNameResolver = Callable[[bytes32], Awaitable[Optional[Tuple[Optional[uint32], str]]]] @@ -48,12 +48,12 @@ def print_transaction(tx: TransactionRecord, verbose: bool, name, address_prefix if verbose: print(tx) else: - chia_amount = Decimal(int(tx.amount)) / mojo_per_unit + flax_amount = Decimal(int(tx.amount)) / mojo_per_unit to_address = encode_puzzle_hash(tx.to_puzzle_hash, address_prefix) print(f"Transaction {tx.name}") print(f"Status: {'Confirmed' if tx.confirmed else ('In mempool' if tx.is_in_mempool() else 'Pending')}") description = transaction_description_from_type(tx) - print(f"Amount {description}: {chia_amount} {name}") + print(f"Amount {description}: {flax_amount} {name}") print(f"To address: {to_address}") print("Created at:", datetime.fromtimestamp(tx.created_at_time).strftime("%Y-%m-%d %H:%M:%S")) print("") @@ -62,7 +62,7 @@ def print_transaction(tx: TransactionRecord, verbose: bool, name, address_prefix def get_mojo_per_unit(wallet_type: WalletType) -> int: mojo_per_unit: int if wallet_type in {WalletType.STANDARD_WALLET, WalletType.POOLING_WALLET, WalletType.DATA_LAYER}: - mojo_per_unit = units["chia"] + mojo_per_unit = units["flax"] elif wallet_type == WalletType.CAT: mojo_per_unit = units["cat"] else: @@ -214,12 +214,12 @@ async def send(args: dict, wallet_client: WalletRpcClient, fingerprint: int) -> print(f"Wallet id: {wallet_id} not found.") return - final_fee = uint64(int(fee * units["chia"])) + final_fee = uint64(int(fee * units["flax"])) final_amount: uint64 final_min_coin_amount: uint64 if typ == WalletType.STANDARD_WALLET: - final_amount = uint64(int(amount * units["chia"])) - final_min_coin_amount = uint64(int(min_coin_amount * units["chia"])) + final_amount = uint64(int(amount * units["flax"])) + final_min_coin_amount = uint64(int(min_coin_amount * units["flax"])) print("Submitting transaction...") res = await wallet_client.send_transaction( str(wallet_id), final_amount, address, final_fee, memos, final_min_coin_amount @@ -246,7 +246,7 @@ async def send(args: dict, wallet_client: WalletRpcClient, fingerprint: int) -> return None print("Transaction not yet submitted to nodes") - print(f"To get status, use command: chia wallet get_transaction -f {fingerprint} -tx 0x{tx_id}") + print(f"To get status, use command: flax wallet get_transaction -f {fingerprint} -tx 0x{tx_id}") async def get_address(args: dict, wallet_client: WalletRpcClient, fingerprint: int) -> None: @@ -301,7 +301,7 @@ async def make_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in offers: List[str] = args["offers"] requests: List[str] = args["requests"] filepath: str = args["filepath"] - fee: int = int(Decimal(args["fee"]) * units["chia"]) + fee: int = int(Decimal(args["fee"]) * units["flax"]) config = load_config(DEFAULT_ROOT_PATH, "config.yaml") if [] in [offers, requests]: @@ -359,7 +359,7 @@ async def make_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in }, } royalty_asset_dict[name] = ( - encode_puzzle_hash(info.royalty_puzzle_hash, AddressType.XCH.hrp(config)), + encode_puzzle_hash(info.royalty_puzzle_hash, AddressType.XFX.hrp(config)), info.royalty_percentage, ) else: @@ -369,8 +369,8 @@ async def make_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in except ValueError: id = uint32(int(name)) if id == 1: - name = "XCH" - unit = units["chia"] + name = "XFX" + unit = units["flax"] else: name = await wallet_client.get_cat_name(str(id)) unit = units["cat"] @@ -408,7 +408,7 @@ async def make_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in for nft_id, summaries in royalty_summary.items(): print(f" - For {nft_id}:") for summary in summaries: - divisor = units["chia"] if summary["asset"] == "XCH" else units["cat"] + divisor = units["flax"] if summary["asset"] == "XFX" else units["cat"] converted_amount = Decimal(summary["amount"]) / divisor total_amounts_requested.setdefault(summary["asset"], fungible_asset_dict[summary["asset"]]) total_amounts_requested[summary["asset"]] += summary["amount"] @@ -419,7 +419,7 @@ async def make_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in print() print("Total Amounts Offered:") for asset, requested_amount in total_amounts_requested.items(): - divisor = units["chia"] if asset == "XCH" else units["cat"] + divisor = units["flax"] if asset == "XFX" else units["cat"] converted_amount = Decimal(requested_amount) / divisor print(f" - {converted_amount} {asset} ({requested_amount} mojos)") @@ -443,7 +443,7 @@ async def make_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in with open(pathlib.Path(filepath), "w") as file: file.write(offer.to_bech32()) print(f"Created offer with ID {trade_record.trade_id}") - print(f"Use chia wallet get_offers --id {trade_record.trade_id} -f {fingerprint} to view status") + print(f"Use flax wallet get_offers --id {trade_record.trade_id} -f {fingerprint} to view status") else: print("Error creating offer") @@ -455,11 +455,11 @@ def timestamp_to_time(timestamp): async def print_offer_summary(cat_name_resolver: CATNameResolver, sum_dict: Dict[str, int], has_fee: bool = False): for asset_id, amount in sum_dict.items(): description: str = "" - unit: int = units["chia"] - wid: str = "1" if asset_id == "xch" else "" + unit: int = units["flax"] + wid: str = "1" if asset_id == "xfx" else "" mojo_amount: int = int(Decimal(amount)) - name: str = "XCH" - if asset_id != "xch": + name: str = "XFX" + if asset_id != "xfx": name = asset_id if asset_id == "unknown": name = "Unknown" @@ -506,7 +506,7 @@ async def print_trade_record(record, wallet_client: WalletRpcClient, summaries: await print_offer_summary(cat_name_resolver, requested) print("Pending Outbound Balances:") await print_offer_summary(cat_name_resolver, outbound_balances, has_fee=(fees > 0)) - print(f"Included Fees: {fees / units['chia']}") + print(f"Included Fees: {fees / units['flax']}") print("---------------") @@ -565,7 +565,7 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in offer_hex = args["file"] examine_only: bool = args["examine_only"] - fee: int = int(Decimal(args["fee"]) * units["chia"]) + fee: int = int(Decimal(args["fee"]) * units["flax"]) config = load_config(DEFAULT_ROOT_PATH, "config.yaml") try: @@ -577,9 +577,9 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in ### # This is temporary code, delete it when we no longer care about incorrectly parsing CAT1s # There's also temp code in test_wallet_rpc.py and wallet_rpc_api.py - from chia.types.spend_bundle import SpendBundle - from chia.util.bech32m import bech32_decode, convertbits - from chia.wallet.util.puzzle_compression import decompress_object_with_puzzles + from flax.types.spend_bundle import SpendBundle + from flax.util.bech32m import bech32_decode, convertbits + from flax.wallet.util.puzzle_compression import decompress_object_with_puzzles hrpgot, data = bech32_decode(offer_hex, max_length=len(offer_hex)) if data is None: @@ -614,18 +614,18 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in if royalty_asset_id.hex() in offered: percentage, address = await get_nft_royalty_percentage_and_address(royalty_asset_id, wallet_client) royalty_asset_dict[encode_puzzle_hash(royalty_asset_id, AddressType.NFT.hrp(config))] = ( - encode_puzzle_hash(address, AddressType.XCH.hrp(config)), + encode_puzzle_hash(address, AddressType.XFX.hrp(config)), percentage, ) if royalty_asset_dict != {}: fungible_asset_dict: Dict[Any, uint64] = {} for fungible_asset_id in fungible_assets_from_offer(offer): - fungible_asset_id_str = fungible_asset_id.hex() if fungible_asset_id is not None else "xch" + fungible_asset_id_str = fungible_asset_id.hex() if fungible_asset_id is not None else "xfx" if fungible_asset_id_str in requested: nft_royalty_currency: str = "Unknown CAT" if fungible_asset_id is None: - nft_royalty_currency = "XCH" + nft_royalty_currency = "XFX" else: result = await wallet_client.cat_asset_id_to_name(fungible_asset_id) if result is not None: @@ -641,7 +641,7 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in for nft_id, summaries in royalty_summary.items(): print(f" - For {nft_id}:") for summary in summaries: - divisor = units["chia"] if summary["asset"] == "XCH" else units["cat"] + divisor = units["flax"] if summary["asset"] == "XFX" else units["cat"] converted_amount = Decimal(summary["amount"]) / divisor total_amounts_requested.setdefault(summary["asset"], fungible_asset_dict[summary["asset"]]) total_amounts_requested[summary["asset"]] += summary["amount"] @@ -652,11 +652,11 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in print() print("Total Amounts Requested:") for asset, amount in total_amounts_requested.items(): - divisor = units["chia"] if asset == "XCH" else units["cat"] + divisor = units["flax"] if asset == "XFX" else units["cat"] converted_amount = Decimal(amount) / divisor print(f" - {converted_amount} {asset} ({amount} mojos)") - print(f"Included Fees: {Decimal(offer.bundle.fees()) / units['chia']}") + print(f"Included Fees: {Decimal(offer.bundle.fees()) / units['flax']}") if not examine_only: print() @@ -664,13 +664,13 @@ async def take_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: in if confirmation in ["y", "yes"]: trade_record = await wallet_client.take_offer(offer, fee=fee) print(f"Accepted offer with ID {trade_record.trade_id}") - print(f"Use chia wallet get_offers --id {trade_record.trade_id} -f {fingerprint} to view its status") + print(f"Use flax wallet get_offers --id {trade_record.trade_id} -f {fingerprint} to view its status") async def cancel_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: int) -> None: id = bytes32.from_hexstr(args["id"]) secure: bool = not args["insecure"] - fee: int = int(Decimal(args["fee"]) * units["chia"]) + fee: int = int(Decimal(args["fee"]) * units["flax"]) trade_record = await wallet_client.get_offer(id, file_contents=True) await print_trade_record(trade_record, wallet_client, summaries=True) @@ -680,14 +680,14 @@ async def cancel_offer(args: dict, wallet_client: WalletRpcClient, fingerprint: await wallet_client.cancel_offer(id, secure=secure, fee=fee) print(f"Cancelled offer with ID {trade_record.trade_id}") if secure: - print(f"Use chia wallet get_offers --id {trade_record.trade_id} -f {fingerprint} to view cancel status") + print(f"Use flax wallet get_offers --id {trade_record.trade_id} -f {fingerprint} to view cancel status") def wallet_coin_unit(typ: WalletType, address_prefix: str) -> Tuple[str, int]: if typ == WalletType.CAT: return "", units["cat"] if typ in [WalletType.STANDARD_WALLET, WalletType.POOLING_WALLET, WalletType.MULTI_SIG]: - return address_prefix, units["chia"] + return address_prefix, units["flax"] return "", units["mojo"] @@ -764,7 +764,7 @@ async def print_balances(args: dict, wallet_client: WalletRpcClient, fingerprint async def create_did_wallet(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) -> None: amount = args["amount"] - fee: int = int(Decimal(args["fee"]) * units["chia"]) + fee: int = int(Decimal(args["fee"]) * units["flax"]) name = args["name"] try: response = await wallet_client.create_new_did_wallet(amount, fee, name) @@ -815,12 +815,12 @@ async def mint_nft(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) royalty_address = ( None if not args["royalty_address"] - else ensure_valid_address(args["royalty_address"], allowed_types={AddressType.XCH}, config=config) + else ensure_valid_address(args["royalty_address"], allowed_types={AddressType.XFX}, config=config) ) target_address = ( None if not args["target_address"] - else ensure_valid_address(args["target_address"], allowed_types={AddressType.XCH}, config=config) + else ensure_valid_address(args["target_address"], allowed_types={AddressType.XFX}, config=config) ) no_did_ownership = args["no_did_ownership"] hash = args["hash"] @@ -831,7 +831,7 @@ async def mint_nft(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) license_uris = args["license_uris"] edition_total = args["edition_total"] edition_number = args["edition_number"] - fee: int = int(Decimal(args["fee"]) * units["chia"]) + fee: int = int(Decimal(args["fee"]) * units["flax"]) royalty_percentage = args["royalty_percentage"] try: response = await wallet_client.get_nft_wallet_did(wallet_id) @@ -890,7 +890,7 @@ async def add_uri_to_nft(args: Dict, wallet_client: WalletRpcClient, fingerprint uri_value = license_uri else: raise ValueError("You must provide at least one of the URI flags") - fee: int = int(Decimal(args["fee"]) * units["chia"]) + fee: int = int(Decimal(args["fee"]) * units["flax"]) response = await wallet_client.add_uri_to_nft(wallet_id, nft_coin_id, key, uri_value, fee) spend_bundle = response["spend_bundle"] print(f"URI added successfully with spend bundle: {spend_bundle}") @@ -903,8 +903,8 @@ async def transfer_nft(args: Dict, wallet_client: WalletRpcClient, fingerprint: wallet_id = args["wallet_id"] nft_coin_id = args["nft_coin_id"] config = load_config(DEFAULT_ROOT_PATH, "config.yaml") - target_address = ensure_valid_address(args["target_address"], allowed_types={AddressType.XCH}, config=config) - fee: int = int(Decimal(args["fee"]) * units["chia"]) + target_address = ensure_valid_address(args["target_address"], allowed_types={AddressType.XFX}, config=config) + fee: int = int(Decimal(args["fee"]) * units["flax"]) response = await wallet_client.transfer_nft(wallet_id, nft_coin_id, target_address, fee) spend_bundle = response["spend_bundle"] print(f"NFT transferred successfully with spend bundle: {spend_bundle}") @@ -969,7 +969,7 @@ async def set_nft_did(args: Dict, wallet_client: WalletRpcClient, fingerprint: i wallet_id = args["wallet_id"] did_id = args["did_id"] nft_coin_id = args["nft_coin_id"] - fee: int = int(Decimal(args["fee"]) * units["chia"]) + fee: int = int(Decimal(args["fee"]) * units["flax"]) try: response = await wallet_client.set_nft_did(wallet_id, did_id, nft_coin_id, fee) spend_bundle = response["spend_bundle"] @@ -1048,14 +1048,14 @@ def fungible_assets_from_offer(offer: Offer) -> List[Optional[bytes32]]: async def send_notification(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) -> None: address: bytes32 = decode_puzzle_hash(args["address"]) - amount: uint64 = uint64(Decimal(args["amount"]) * units["chia"]) + amount: uint64 = uint64(Decimal(args["amount"]) * units["flax"]) message: bytes = bytes(args["message"], "utf8") - fee: uint64 = uint64(Decimal(args["fee"]) * units["chia"]) + fee: uint64 = uint64(Decimal(args["fee"]) * units["flax"]) tx = await wallet_client.send_notification(address, message, amount, fee) print("Notification sent successfully.") - print(f"To get status, use command: chia wallet get_transaction -f {fingerprint} -tx 0x{tx.name}") + print(f"To get status, use command: flax wallet get_transaction -f {fingerprint} -tx 0x{tx.name}") async def get_notifications(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) -> None: @@ -1081,7 +1081,7 @@ async def delete_notifications(args: Dict, wallet_client: WalletRpcClient, finge async def sign_message(args: Dict, wallet_client: WalletRpcClient, fingerprint: int) -> None: - if args["type"] == AddressType.XCH: + if args["type"] == AddressType.XFX: pubkey, signature = await wallet_client.sign_message_by_address(args["address"], args["message"]) elif args["type"] == AddressType.DID: pubkey, signature = await wallet_client.sign_message_by_id(args["did_id"], args["message"]) diff --git a/chia/consensus/__init__.py b/flax/consensus/__init__.py similarity index 100% rename from chia/consensus/__init__.py rename to flax/consensus/__init__.py diff --git a/chia/consensus/block_body_validation.py b/flax/consensus/block_body_validation.py similarity index 94% rename from chia/consensus/block_body_validation.py rename to flax/consensus/block_body_validation.py index 9bf0b1e63..dd3da2bc9 100644 --- a/chia/consensus/block_body_validation.py +++ b/flax/consensus/block_body_validation.py @@ -6,30 +6,30 @@ from chiabip158 import PyBIP158 -from chia.consensus.block_record import BlockRecord -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.consensus.block_root_validation import validate_block_merkle_roots -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.coinbase import create_farmer_coin, create_pool_coin -from chia.consensus.constants import ConsensusConstants -from chia.consensus.cost_calculator import NPCResult -from chia.consensus.find_fork_point import find_fork_point_in_chain -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions, mempool_check_time_locks -from chia.types.block_protocol import BlockInfo -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32, bytes48 -from chia.types.coin_record import CoinRecord -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.types.unfinished_block import UnfinishedBlock -from chia.util import cached_bls -from chia.util.condition_tools import pkm_pairs -from chia.util.errors import Err -from chia.util.generator_tools import tx_removals_and_additions -from chia.util.hash import std_hash -from chia.util.ints import uint32, uint64 +from flax.consensus.block_record import BlockRecord +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.consensus.block_root_validation import validate_block_merkle_roots +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.coinbase import create_farmer_coin, create_pool_coin +from flax.consensus.constants import ConsensusConstants +from flax.consensus.cost_calculator import NPCResult +from flax.consensus.find_fork_point import find_fork_point_in_chain +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions, mempool_check_time_locks +from flax.types.block_protocol import BlockInfo +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32, bytes48 +from flax.types.coin_record import CoinRecord +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.types.unfinished_block import UnfinishedBlock +from flax.util import cached_bls +from flax.util.condition_tools import pkm_pairs +from flax.util.errors import Err +from flax.util.generator_tools import tx_removals_and_additions +from flax.util.hash import std_hash +from flax.util.ints import uint32, uint64 log = logging.getLogger(__name__) diff --git a/chia/consensus/block_creation.py b/flax/consensus/block_creation.py similarity index 93% rename from chia/consensus/block_creation.py rename to flax/consensus/block_creation.py index b31951d62..3d385c96c 100644 --- a/chia/consensus/block_creation.py +++ b/flax/consensus/block_creation.py @@ -10,29 +10,29 @@ from chia_rs import compute_merkle_set_root from chiabip158 import PyBIP158 -from chia.consensus.block_record import BlockRecord -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.coinbase import create_farmer_coin, create_pool_coin -from chia.consensus.constants import ConsensusConstants -from chia.consensus.cost_calculator import NPCResult -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.full_node.signage_point import SignagePoint -from chia.types.blockchain_format.coin import Coin, hash_coin_ids -from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.prev_transaction_block import get_prev_transaction_block -from chia.util.recursive_replace import recursive_replace +from flax.consensus.block_record import BlockRecord +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.coinbase import create_farmer_coin, create_pool_coin +from flax.consensus.constants import ConsensusConstants +from flax.consensus.cost_calculator import NPCResult +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.full_node.signage_point import SignagePoint +from flax.types.blockchain_format.coin import Coin, hash_coin_ids +from flax.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.prev_transaction_block import get_prev_transaction_block +from flax.util.recursive_replace import recursive_replace log = logging.getLogger(__name__) @@ -87,7 +87,7 @@ def create_foliage( random.seed(seed) # Use the extension data to create different blocks based on header hash - extension_data: bytes32 = bytes32(random.randint(0, 100000000).to_bytes(32, "big")) + extension_data: bytes32 = random.randint(11, 100000000).to_bytes(32, "big") if prev_block is None: height: uint32 = uint32(0) else: diff --git a/chia/consensus/block_header_validation.py b/flax/consensus/block_header_validation.py similarity index 97% rename from chia/consensus/block_header_validation.py rename to flax/consensus/block_header_validation.py index ee187f241..ccf980f01 100644 --- a/chia/consensus/block_header_validation.py +++ b/flax/consensus/block_header_validation.py @@ -7,31 +7,31 @@ from blspy import AugSchemeMPL -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.deficit import calculate_deficit -from chia.consensus.difficulty_adjustment import can_finish_sub_and_full_epoch -from chia.consensus.get_block_challenge import final_eos_is_already_included, get_block_challenge -from chia.consensus.make_sub_epoch_summary import make_sub_epoch_summary -from chia.consensus.pot_iterations import ( +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.deficit import calculate_deficit +from flax.consensus.difficulty_adjustment import can_finish_sub_and_full_epoch +from flax.consensus.get_block_challenge import final_eos_is_already_included, get_block_challenge +from flax.consensus.make_sub_epoch_summary import make_sub_epoch_summary +from flax.consensus.pot_iterations import ( calculate_ip_iters, calculate_iterations_quality, calculate_sp_interval_iters, calculate_sp_iters, is_overflow_block, ) -from chia.consensus.vdf_info_computation import get_signage_point_vdf_info -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.slots import ChallengeChainSubSlot, RewardChainSubSlot, SubSlotProofs -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.header_block import HeaderBlock -from chia.types.unfinished_header_block import UnfinishedHeaderBlock -from chia.util.errors import Err, ValidationError -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint32, uint64, uint128 +from flax.consensus.vdf_info_computation import get_signage_point_vdf_info +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.slots import ChallengeChainSubSlot, RewardChainSubSlot, SubSlotProofs +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.header_block import HeaderBlock +from flax.types.unfinished_header_block import UnfinishedHeaderBlock +from flax.util.errors import Err, ValidationError +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint32, uint64, uint128 log = logging.getLogger(__name__) diff --git a/chia/consensus/block_record.py b/flax/consensus/block_record.py similarity index 88% rename from chia/consensus/block_record.py rename to flax/consensus/block_record.py index e132179f3..7880e8498 100644 --- a/chia/consensus/block_record.py +++ b/flax/consensus/block_record.py @@ -3,14 +3,14 @@ from dataclasses import dataclass from typing import List, Optional -from chia.consensus.constants import ConsensusConstants -from chia.consensus.pot_iterations import calculate_ip_iters, calculate_sp_iters -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.streamable import Streamable, streamable +from flax.consensus.constants import ConsensusConstants +from flax.consensus.pot_iterations import calculate_ip_iters, calculate_sp_iters +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/consensus/block_rewards.py b/flax/consensus/block_rewards.py similarity index 62% rename from chia/consensus/block_rewards.py rename to flax/consensus/block_rewards.py index 17dd028ba..907dd0e0e 100644 --- a/chia/consensus/block_rewards.py +++ b/flax/consensus/block_rewards.py @@ -1,9 +1,9 @@ from __future__ import annotations -from chia.util.ints import uint32, uint64 +from flax.util.ints import uint32, uint64 -# 1 Chia coin = 1,000,000,000,000 = 1 trillion mojo. -_mojo_per_chia = 1000000000000 +# 1 Flax coin = 1,000,000,000,000 = 1 trillion mojo. +_mojo_per_flax = 1000000000000 _blocks_per_year = 1681920 # 32 * 6 * 24 * 365 @@ -17,17 +17,17 @@ def calculate_pool_reward(height: uint32) -> uint64: """ if height == 0: - return uint64(int((7 / 8) * 21000000 * _mojo_per_chia)) + return uint64(int((7 / 8) * 300000 * _mojo_per_flax)) elif height < 3 * _blocks_per_year: - return uint64(int((7 / 8) * 2 * _mojo_per_chia)) + return uint64(int((7 / 8) * 2 * _mojo_per_flax)) elif height < 6 * _blocks_per_year: - return uint64(int((7 / 8) * 1 * _mojo_per_chia)) + return uint64(int((7 / 8) * 1 * _mojo_per_flax)) elif height < 9 * _blocks_per_year: - return uint64(int((7 / 8) * 0.5 * _mojo_per_chia)) + return uint64(int((7 / 8) * 0.5 * _mojo_per_flax)) elif height < 12 * _blocks_per_year: - return uint64(int((7 / 8) * 0.25 * _mojo_per_chia)) + return uint64(int((7 / 8) * 0.25 * _mojo_per_flax)) else: - return uint64(int((7 / 8) * 0.125 * _mojo_per_chia)) + return uint64(int((7 / 8) * 0.125 * _mojo_per_flax)) def calculate_base_farmer_reward(height: uint32) -> uint64: @@ -40,14 +40,14 @@ def calculate_base_farmer_reward(height: uint32) -> uint64: rates increase continuously. """ if height == 0: - return uint64(int((1 / 8) * 21000000 * _mojo_per_chia)) + return uint64(int((1 / 8) * 300000 * _mojo_per_flax)) elif height < 3 * _blocks_per_year: - return uint64(int((1 / 8) * 2 * _mojo_per_chia)) + return uint64(int((1 / 8) * 2 * _mojo_per_flax)) elif height < 6 * _blocks_per_year: - return uint64(int((1 / 8) * 1 * _mojo_per_chia)) + return uint64(int((1 / 8) * 1 * _mojo_per_flax)) elif height < 9 * _blocks_per_year: - return uint64(int((1 / 8) * 0.5 * _mojo_per_chia)) + return uint64(int((1 / 8) * 0.5 * _mojo_per_flax)) elif height < 12 * _blocks_per_year: - return uint64(int((1 / 8) * 0.25 * _mojo_per_chia)) + return uint64(int((1 / 8) * 0.25 * _mojo_per_flax)) else: - return uint64(int((1 / 8) * 0.125 * _mojo_per_chia)) + return uint64(int((1 / 8) * 0.125 * _mojo_per_flax)) diff --git a/chia/consensus/block_root_validation.py b/flax/consensus/block_root_validation.py similarity index 90% rename from chia/consensus/block_root_validation.py rename to flax/consensus/block_root_validation.py index a4815419f..04865ba04 100644 --- a/chia/consensus/block_root_validation.py +++ b/flax/consensus/block_root_validation.py @@ -4,9 +4,9 @@ from chia_rs import compute_merkle_set_root -from chia.types.blockchain_format.coin import Coin, hash_coin_ids -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.errors import Err +from flax.types.blockchain_format.coin import Coin, hash_coin_ids +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.errors import Err def validate_block_merkle_roots( diff --git a/chia/consensus/blockchain.py b/flax/consensus/blockchain.py similarity index 95% rename from chia/consensus/blockchain.py rename to flax/consensus/blockchain.py index 51d44a154..2e1b09651 100644 --- a/chia/consensus/blockchain.py +++ b/flax/consensus/blockchain.py @@ -12,44 +12,44 @@ from pathlib import Path from typing import Dict, List, Optional, Set, Tuple -from chia.consensus.block_body_validation import validate_block_body -from chia.consensus.block_header_validation import validate_unfinished_header_block -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.cost_calculator import NPCResult -from chia.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty -from chia.consensus.find_fork_point import find_fork_point_in_chain -from chia.consensus.full_block_to_block_record import block_to_block_record -from chia.consensus.multiprocess_validation import ( +from flax.consensus.block_body_validation import validate_block_body +from flax.consensus.block_header_validation import validate_unfinished_header_block +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.cost_calculator import NPCResult +from flax.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty +from flax.consensus.find_fork_point import find_fork_point_in_chain +from flax.consensus.full_block_to_block_record import block_to_block_record +from flax.consensus.multiprocess_validation import ( PreValidationResult, _run_generator, pre_validate_blocks_multiprocessing, ) -from chia.full_node.block_height_map import BlockHeightMap -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.types.block_protocol import BlockInfo -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.blockchain_format.vdf import VDFInfo -from chia.types.coin_record import CoinRecord -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.types.header_block import HeaderBlock -from chia.types.unfinished_block import UnfinishedBlock -from chia.types.unfinished_header_block import UnfinishedHeaderBlock -from chia.types.weight_proof import SubEpochChallengeSegment -from chia.util.errors import ConsensusError, Err -from chia.util.generator_tools import get_block_header, tx_removals_and_additions -from chia.util.hash import std_hash -from chia.util.inline_executor import InlineExecutor -from chia.util.ints import uint16, uint32, uint64, uint128 -from chia.util.setproctitle import getproctitle, setproctitle +from flax.full_node.block_height_map import BlockHeightMap +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.block_protocol import BlockInfo +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.vdf import VDFInfo +from flax.types.coin_record import CoinRecord +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.types.header_block import HeaderBlock +from flax.types.unfinished_block import UnfinishedBlock +from flax.types.unfinished_header_block import UnfinishedHeaderBlock +from flax.types.weight_proof import SubEpochChallengeSegment +from flax.util.errors import ConsensusError, Err +from flax.util.generator_tools import get_block_header, tx_removals_and_additions +from flax.util.hash import std_hash +from flax.util.inline_executor import InlineExecutor +from flax.util.ints import uint16, uint32, uint64, uint128 +from flax.util.setproctitle import getproctitle, setproctitle log = logging.getLogger(__name__) diff --git a/chia/consensus/blockchain_interface.py b/flax/consensus/blockchain_interface.py similarity index 85% rename from chia/consensus/blockchain_interface.py rename to flax/consensus/blockchain_interface.py index 0a44bcf66..e5c188be0 100644 --- a/chia/consensus/blockchain_interface.py +++ b/flax/consensus/blockchain_interface.py @@ -2,13 +2,13 @@ from typing import Dict, List, Optional -from chia.consensus.block_record import BlockRecord -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.blockchain_format.vdf import VDFInfo -from chia.types.header_block import HeaderBlock -from chia.types.weight_proof import SubEpochChallengeSegment -from chia.util.ints import uint32 +from flax.consensus.block_record import BlockRecord +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.vdf import VDFInfo +from flax.types.header_block import HeaderBlock +from flax.types.weight_proof import SubEpochChallengeSegment +from flax.util.ints import uint32 class BlockchainInterface: diff --git a/chia/consensus/coinbase.py b/flax/consensus/coinbase.py similarity index 81% rename from chia/consensus/coinbase.py rename to flax/consensus/coinbase.py index 4828b2de1..93a58490b 100644 --- a/chia/consensus/coinbase.py +++ b/flax/consensus/coinbase.py @@ -2,10 +2,10 @@ from blspy import G1Element -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32, uint64 -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_hash_for_pk +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32, uint64 +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_hash_for_pk def create_puzzlehash_for_pk(pub_key: G1Element) -> bytes32: diff --git a/chia/consensus/condition_costs.py b/flax/consensus/condition_costs.py similarity index 100% rename from chia/consensus/condition_costs.py rename to flax/consensus/condition_costs.py diff --git a/chia/consensus/constants.py b/flax/consensus/constants.py similarity index 93% rename from chia/consensus/constants.py rename to flax/consensus/constants.py index 14715687a..a760b97c9 100644 --- a/chia/consensus/constants.py +++ b/flax/consensus/constants.py @@ -4,9 +4,9 @@ import logging from typing import Any -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint8, uint32, uint64, uint128 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint8, uint32, uint64, uint128 log = logging.getLogger(__name__) @@ -40,14 +40,14 @@ class ConsensusConstants: # Used as the initial cc rc challenges, as well as first block back pointers, and first SES back pointer # We override this value based on the chain being run (testnet0, testnet1, mainnet, etc) GENESIS_CHALLENGE: bytes32 - # Forks of chia should change this value to provide replay attack protection + # Forks of flax should change this value to provide replay attack protection AGG_SIG_ME_ADDITIONAL_DATA: bytes GENESIS_PRE_FARM_POOL_PUZZLE_HASH: bytes32 # The block at height must pay out to this pool puzzle hash GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: bytes32 # The block at height must pay out to this farmer puzzle hash MAX_VDF_WITNESS_SIZE: int # The maximum number of classgroup elements within an n-wesolowski proof # Size of mempool = 10x the size of block MEMPOOL_BLOCK_BUFFER: int - # Max coin amount uint(1 << 64). This allows coin amounts to fit in 64 bits. This is around 18M chia. + # Max coin amount uint(1 << 64). This allows coin amounts to fit in 64 bits. This is around 18M flax. MAX_COIN_AMOUNT: int # Max block cost in clvm cost units MAX_BLOCK_COST_CLVM: int diff --git a/chia/consensus/cost_calculator.py b/flax/consensus/cost_calculator.py similarity index 68% rename from chia/consensus/cost_calculator.py rename to flax/consensus/cost_calculator.py index 468c7f376..10f9cd18c 100644 --- a/chia/consensus/cost_calculator.py +++ b/flax/consensus/cost_calculator.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from typing import Optional -from chia.types.spend_bundle_conditions import SpendBundleConditions -from chia.util.ints import uint16, uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.spend_bundle_conditions import SpendBundleConditions +from flax.util.ints import uint16, uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/consensus/default_constants.py b/flax/consensus/default_constants.py similarity index 88% rename from chia/consensus/default_constants.py rename to flax/consensus/default_constants.py index 57b5adb59..13e71aa1f 100644 --- a/chia/consensus/default_constants.py +++ b/flax/consensus/default_constants.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.util.ints import uint64 +from flax.util.ints import uint64 from .constants import ConsensusConstants @@ -12,7 +12,7 @@ "SUB_SLOT_ITERS_STARTING": 2**27, # DIFFICULTY_STARTING is the starting difficulty for the first epoch, which is then further # multiplied by another factor of DIFFICULTY_CONSTANT_FACTOR, to be used in the VDF iter calculation formula. - "DIFFICULTY_CONSTANT_FACTOR": 2**67, + "DIFFICULTY_CONSTANT_FACTOR": 2**57, "DIFFICULTY_STARTING": 7, "DIFFICULTY_CHANGE_MAX_FACTOR": 3, # The next difficulty is truncated to range [prev / FACTOR, prev * FACTOR] # These 3 constants must be changed at the same time @@ -31,13 +31,13 @@ # We override this value based on the chain being run (testnet0, testnet1, mainnet, etc) # Default used for tests is std_hash(b'') "GENESIS_CHALLENGE": bytes.fromhex("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"), - # Forks of chia should change this value to provide replay attack protection. This is set to mainnet genesis chall - "AGG_SIG_ME_ADDITIONAL_DATA": bytes.fromhex("ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb"), + # Forks of flax should change this value to provide replay attack protection. This is set to mainnet genesis chall + "AGG_SIG_ME_ADDITIONAL_DATA": bytes.fromhex("9b9ffca948750d8b41ac755da213461e9d2253ec7bfce80695d78f7fe7d55112"), "GENESIS_PRE_FARM_POOL_PUZZLE_HASH": bytes.fromhex( - "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc" + "e8e245e2e6536e17fd7cbc2e3bd90de06f55362ee3c84cea5a68391e5bad7ef6" ), "GENESIS_PRE_FARM_FARMER_PUZZLE_HASH": bytes.fromhex( - "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af" + "e8e245e2e6536e17fd7cbc2e3bd90de06f55362ee3c84cea5a68391e5bad7ef6" ), "MAX_VDF_WITNESS_SIZE": 64, # Size of mempool = 50x the size of block diff --git a/chia/consensus/deficit.py b/flax/consensus/deficit.py similarity index 93% rename from chia/consensus/deficit.py rename to flax/consensus/deficit.py index 050dbcf33..d7a20d5d6 100644 --- a/chia/consensus/deficit.py +++ b/flax/consensus/deficit.py @@ -2,9 +2,9 @@ from typing import Optional -from chia.consensus.block_record import BlockRecord -from chia.consensus.constants import ConsensusConstants -from chia.util.ints import uint8, uint32 +from flax.consensus.block_record import BlockRecord +from flax.consensus.constants import ConsensusConstants +from flax.util.ints import uint8, uint32 def calculate_deficit( diff --git a/chia/consensus/difficulty_adjustment.py b/flax/consensus/difficulty_adjustment.py similarity index 98% rename from chia/consensus/difficulty_adjustment.py rename to flax/consensus/difficulty_adjustment.py index 8c91fcf88..bc13643b1 100644 --- a/chia/consensus/difficulty_adjustment.py +++ b/flax/consensus/difficulty_adjustment.py @@ -2,12 +2,12 @@ from typing import List, Optional, Tuple -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.significant_bits import count_significant_bits, truncate_to_significant_bits +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.significant_bits import count_significant_bits, truncate_to_significant_bits def _get_blocks_at_height( diff --git a/chia/consensus/find_fork_point.py b/flax/consensus/find_fork_point.py similarity index 86% rename from chia/consensus/find_fork_point.py rename to flax/consensus/find_fork_point.py index 1dc233c15..0378427e3 100644 --- a/chia/consensus/find_fork_point.py +++ b/flax/consensus/find_fork_point.py @@ -2,9 +2,9 @@ from typing import Union -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.types.header_block import HeaderBlock +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.types.header_block import HeaderBlock def find_fork_point_in_chain( diff --git a/chia/consensus/full_block_to_block_record.py b/flax/consensus/full_block_to_block_record.py similarity index 87% rename from chia/consensus/full_block_to_block_record.py rename to flax/consensus/full_block_to_block_record.py index b817e5d8d..e26a1810c 100644 --- a/chia/consensus/full_block_to_block_record.py +++ b/flax/consensus/full_block_to_block_record.py @@ -2,21 +2,21 @@ from typing import List, Optional, Union -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.deficit import calculate_deficit -from chia.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty -from chia.consensus.make_sub_epoch_summary import make_sub_epoch_summary -from chia.consensus.pot_iterations import is_overflow_block -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.slots import ChallengeBlockInfo -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.full_block import FullBlock -from chia.types.header_block import HeaderBlock -from chia.util.errors import Err -from chia.util.ints import uint8, uint32, uint64 +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.deficit import calculate_deficit +from flax.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty +from flax.consensus.make_sub_epoch_summary import make_sub_epoch_summary +from flax.consensus.pot_iterations import is_overflow_block +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.slots import ChallengeBlockInfo +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.full_block import FullBlock +from flax.types.header_block import HeaderBlock +from flax.util.errors import Err +from flax.util.ints import uint8, uint32, uint64 def block_to_block_record( diff --git a/chia/consensus/get_block_challenge.py b/flax/consensus/get_block_challenge.py similarity index 90% rename from chia/consensus/get_block_challenge.py rename to flax/consensus/get_block_challenge.py index f3ac1f84c..8b3bb2eb4 100644 --- a/chia/consensus/get_block_challenge.py +++ b/flax/consensus/get_block_challenge.py @@ -3,15 +3,15 @@ import logging from typing import List, Union -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.types.header_block import HeaderBlock -from chia.types.unfinished_block import UnfinishedBlock -from chia.types.unfinished_header_block import UnfinishedHeaderBlock -from chia.util.ints import uint64 +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.types.header_block import HeaderBlock +from flax.types.unfinished_block import UnfinishedBlock +from flax.types.unfinished_header_block import UnfinishedHeaderBlock +from flax.util.ints import uint64 log = logging.getLogger(__name__) diff --git a/chia/consensus/make_sub_epoch_summary.py b/flax/consensus/make_sub_epoch_summary.py similarity index 92% rename from chia/consensus/make_sub_epoch_summary.py rename to flax/consensus/make_sub_epoch_summary.py index 09e7d072d..9fe82f869 100644 --- a/chia/consensus/make_sub_epoch_summary.py +++ b/flax/consensus/make_sub_epoch_summary.py @@ -3,22 +3,22 @@ import logging from typing import Optional, Union -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.deficit import calculate_deficit -from chia.consensus.difficulty_adjustment import ( +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.deficit import calculate_deficit +from flax.consensus.difficulty_adjustment import ( _get_next_difficulty, _get_next_sub_slot_iters, can_finish_sub_and_full_epoch, get_next_sub_slot_iters_and_difficulty, height_can_be_first_in_epoch, ) -from chia.consensus.pot_iterations import calculate_ip_iters, calculate_sp_iters, is_overflow_block -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.full_block import FullBlock -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.ints import uint8, uint32, uint64, uint128 +from flax.consensus.pot_iterations import calculate_ip_iters, calculate_sp_iters, is_overflow_block +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.full_block import FullBlock +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.ints import uint8, uint32, uint64, uint128 log = logging.getLogger(__name__) diff --git a/chia/consensus/multiprocess_validation.py b/flax/consensus/multiprocess_validation.py similarity index 92% rename from chia/consensus/multiprocess_validation.py rename to flax/consensus/multiprocess_validation.py index b4d1fa9bc..99771456e 100644 --- a/chia/consensus/multiprocess_validation.py +++ b/flax/consensus/multiprocess_validation.py @@ -9,30 +9,30 @@ from blspy import AugSchemeMPL, G1Element -from chia.consensus.block_header_validation import validate_finished_header_block -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.cost_calculator import NPCResult -from chia.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty -from chia.consensus.full_block_to_block_record import block_to_block_record -from chia.consensus.get_block_challenge import get_block_challenge -from chia.consensus.pot_iterations import calculate_iterations_quality, is_overflow_block -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.types.block_protocol import BlockInfo -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.types.header_block import HeaderBlock -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.block_cache import BlockCache -from chia.util.condition_tools import pkm_pairs -from chia.util.errors import Err, ValidationError -from chia.util.generator_tools import get_block_header, tx_removals_and_additions -from chia.util.ints import uint16, uint32, uint64 -from chia.util.streamable import Streamable, streamable +from flax.consensus.block_header_validation import validate_finished_header_block +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.cost_calculator import NPCResult +from flax.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty +from flax.consensus.full_block_to_block_record import block_to_block_record +from flax.consensus.get_block_challenge import get_block_challenge +from flax.consensus.pot_iterations import calculate_iterations_quality, is_overflow_block +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.block_protocol import BlockInfo +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.types.header_block import HeaderBlock +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.block_cache import BlockCache +from flax.util.condition_tools import pkm_pairs +from flax.util.errors import Err, ValidationError +from flax.util.generator_tools import get_block_header, tx_removals_and_additions +from flax.util.ints import uint16, uint32, uint64 +from flax.util.streamable import Streamable, streamable log = logging.getLogger(__name__) diff --git a/chia/consensus/pos_quality.py b/flax/consensus/pos_quality.py similarity index 95% rename from chia/consensus/pos_quality.py rename to flax/consensus/pos_quality.py index cc0678e44..95f40f8e5 100644 --- a/chia/consensus/pos_quality.py +++ b/flax/consensus/pos_quality.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.util.ints import uint64 +from flax.util.ints import uint64 # The actual space in bytes of a plot, is _expected_plot_size(k) * UI_ACTUAL_SPACE_CONSTANT_FACTO # This is not used in consensus, only for display purposes diff --git a/chia/consensus/pot_iterations.py b/flax/consensus/pot_iterations.py similarity index 90% rename from chia/consensus/pot_iterations.py rename to flax/consensus/pot_iterations.py index 0aee32f52..bb01a4b67 100644 --- a/chia/consensus/pot_iterations.py +++ b/flax/consensus/pot_iterations.py @@ -1,10 +1,10 @@ from __future__ import annotations -from chia.consensus.constants import ConsensusConstants -from chia.consensus.pos_quality import _expected_plot_size -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint64, uint128 +from flax.consensus.constants import ConsensusConstants +from flax.consensus.pos_quality import _expected_plot_size +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint64, uint128 def is_overflow_block(constants: ConsensusConstants, signage_point_index: uint8) -> bool: diff --git a/chia/consensus/vdf_info_computation.py b/flax/consensus/vdf_info_computation.py similarity index 94% rename from chia/consensus/vdf_info_computation.py rename to flax/consensus/vdf_info_computation.py index 915d863c2..0a8b42d00 100644 --- a/chia/consensus/vdf_info_computation.py +++ b/flax/consensus/vdf_info_computation.py @@ -2,13 +2,13 @@ from typing import List, Optional, Tuple -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.util.ints import uint64, uint128 +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.util.ints import uint64, uint128 def get_signage_point_vdf_info( diff --git a/chia/daemon/__init__.py b/flax/daemon/__init__.py similarity index 100% rename from chia/daemon/__init__.py rename to flax/daemon/__init__.py diff --git a/chia/daemon/client.py b/flax/daemon/client.py similarity index 97% rename from chia/daemon/client.py rename to flax/daemon/client.py index 99df01a12..8495067c5 100644 --- a/chia/daemon/client.py +++ b/flax/daemon/client.py @@ -9,8 +9,8 @@ import aiohttp -from chia.util.json_util import dict_to_json_str -from chia.util.ws_message import WsRpcMessage, create_payload_dict +from flax.util.json_util import dict_to_json_str +from flax.util.ws_message import WsRpcMessage, create_payload_dict class DaemonProxy: @@ -169,7 +169,7 @@ async def connect_to_daemon_and_validate( Connect to the local daemon and do a ping to ensure that something is really there and running. """ - from chia.server.server import ssl_context_for_client + from flax.server.server import ssl_context_for_client try: daemon_max_message_size = config.get("daemon_max_message_size", 50 * 1000 * 1000) diff --git a/chia/daemon/keychain_proxy.py b/flax/daemon/keychain_proxy.py similarity index 97% rename from chia/daemon/keychain_proxy.py rename to flax/daemon/keychain_proxy.py index dabc06fdc..0c7781d73 100644 --- a/chia/daemon/keychain_proxy.py +++ b/flax/daemon/keychain_proxy.py @@ -5,18 +5,18 @@ from aiohttp import ClientSession, ClientConnectorError from blspy import AugSchemeMPL, PrivateKey -from chia.cmds.init_funcs import check_keys -from chia.daemon.client import DaemonProxy -from chia.daemon.keychain_server import ( +from flax.cmds.init_funcs import check_keys +from flax.daemon.client import DaemonProxy +from flax.daemon.keychain_server import ( KEYCHAIN_ERR_KEYERROR, KEYCHAIN_ERR_LOCKED, KEYCHAIN_ERR_MALFORMED_REQUEST, KEYCHAIN_ERR_NO_KEYS, KEYCHAIN_ERR_KEY_NOT_FOUND, ) -from chia.server.server import ssl_context_for_client -from chia.util.config import load_config -from chia.util.errors import ( +from flax.server.server import ssl_context_for_client +from flax.util.config import load_config +from flax.util.errors import ( KeychainIsLocked, KeychainIsEmpty, KeychainKeyNotFound, @@ -24,12 +24,12 @@ KeychainMalformedResponse, KeychainProxyConnectionTimeout, ) -from chia.util.keychain import ( +from flax.util.keychain import ( Keychain, bytes_to_mnemonic, mnemonic_to_seed, ) -from chia.util.ws_message import WsRpcMessage +from flax.util.ws_message import WsRpcMessage from pathlib import Path from typing import Any, Dict, List, Optional, Tuple diff --git a/chia/daemon/keychain_server.py b/flax/daemon/keychain_server.py similarity index 97% rename from chia/daemon/keychain_server.py rename to flax/daemon/keychain_server.py index bb80d863c..cb8e7be52 100644 --- a/chia/daemon/keychain_server.py +++ b/flax/daemon/keychain_server.py @@ -1,11 +1,11 @@ import logging from blspy import PrivateKey -from chia.cmds.init_funcs import check_keys -from chia.util.errors import KeychainException, KeychainFingerprintNotFound -from chia.util.ints import uint32 -from chia.util.keychain import KeyData, Keychain -from chia.util.streamable import streamable, Streamable +from flax.cmds.init_funcs import check_keys +from flax.util.errors import KeychainException, KeychainFingerprintNotFound +from flax.util.ints import uint32 +from flax.util.keychain import KeyData, Keychain +from flax.util.streamable import streamable, Streamable from pathlib import Path from dataclasses import dataclass from typing import Any, Dict, List, Optional, Type diff --git a/chia/daemon/server.py b/flax/daemon/server.py similarity index 95% rename from chia/daemon/server.py rename to flax/daemon/server.py index 3bfc87490..2d2e7b969 100644 --- a/chia/daemon/server.py +++ b/flax/daemon/server.py @@ -15,30 +15,30 @@ from pathlib import Path from typing import Any, Dict, List, Optional, TextIO, Tuple -from chia import __version__ -from chia.cmds.init_funcs import check_keys, chia_init, chia_full_version_str -from chia.cmds.passphrase_funcs import default_passphrase, using_default_passphrase -from chia.daemon.keychain_server import KeychainServer, keychain_commands -from chia.daemon.windows_signal import kill -from chia.plotters.plotters import get_available_plotters -from chia.plotting.util import add_plot_directory -from chia.server.server import ssl_context_for_root, ssl_context_for_server -from chia.ssl.create_ssl import get_mozilla_ca_crt -from chia.util.beta_metrics import BetaMetricsLogger -from chia.util.chia_logging import initialize_service_logging -from chia.util.config import load_config -from chia.util.errors import KeychainRequiresMigration, KeychainCurrentPassphraseIsInvalid -from chia.util.json_util import dict_to_json_str -from chia.util.keychain import ( +from flax import __version__ +from flax.cmds.init_funcs import check_keys, flax_init, flax_full_version_str +from flax.cmds.passphrase_funcs import default_passphrase, using_default_passphrase +from flax.daemon.keychain_server import KeychainServer, keychain_commands +from flax.daemon.windows_signal import kill +from flax.plotters.plotters import get_available_plotters +from flax.plotting.util import add_plot_directory +from flax.server.server import ssl_context_for_root, ssl_context_for_server +from flax.ssl.create_ssl import get_mozilla_ca_crt +from flax.util.beta_metrics import BetaMetricsLogger +from flax.util.flax_logging import initialize_service_logging +from flax.util.config import load_config +from flax.util.errors import KeychainRequiresMigration, KeychainCurrentPassphraseIsInvalid +from flax.util.json_util import dict_to_json_str +from flax.util.keychain import ( Keychain, passphrase_requirements, supports_os_passphrase_storage, ) -from chia.util.lock import Lockfile, LockfileError -from chia.util.network import WebServer -from chia.util.service_groups import validate_service -from chia.util.setproctitle import setproctitle -from chia.util.ws_message import WsRpcMessage, create_payload, format_response +from flax.util.lock import Lockfile, LockfileError +from flax.util.network import WebServer +from flax.util.service_groups import validate_service +from flax.util.setproctitle import setproctitle +from flax.util.ws_message import WsRpcMessage, create_payload, format_response io_pool_exc = ThreadPoolExecutor() @@ -46,13 +46,13 @@ from aiohttp import ClientSession, WSMsgType, web from aiohttp.web_ws import WebSocketResponse except ModuleNotFoundError: - print("Error: Make sure to run . ./activate from the project folder before starting Chia.") + print("Error: Make sure to run . ./activate from the project folder before starting Flax.") quit() log = logging.getLogger(__name__) -service_plotter = "chia_plotter" +service_plotter = "flax_plotter" async def fetch(url: str): @@ -85,19 +85,19 @@ class PlotEvent(str, Enum): # determine if application is a script file or frozen exe if getattr(sys, "frozen", False): name_map = { - "chia": "chia", - "chia_data_layer": "start_data_layer", - "chia_data_layer_http": "start_data_layer_http", - "chia_wallet": "start_wallet", - "chia_full_node": "start_full_node", - "chia_harvester": "start_harvester", - "chia_farmer": "start_farmer", - "chia_introducer": "start_introducer", - "chia_timelord": "start_timelord", - "chia_timelord_launcher": "timelord_launcher", - "chia_full_node_simulator": "start_simulator", - "chia_seeder": "start_seeder", - "chia_crawler": "start_crawler", + "flax": "flax", + "flax_data_layer": "start_data_layer", + "flax_data_layer_http": "start_data_layer_http", + "flax_wallet": "start_wallet", + "flax_full_node": "start_full_node", + "flax_harvester": "start_harvester", + "flax_farmer": "start_farmer", + "flax_introducer": "start_introducer", + "flax_timelord": "start_timelord", + "flax_timelord_launcher": "timelord_launcher", + "flax_full_node_simulator": "start_simulator", + "flax_seeder": "start_seeder", + "flax_crawler": "start_crawler", } def executable_for_service(service_name: str) -> str: @@ -167,7 +167,7 @@ async def start(self): self.log.warning( ( "Deprecation Warning: Your version of SSL (%s) does not support TLS1.3. " - "A future version of Chia will require TLS1.3." + "A future version of Flax will require TLS1.3." ), ssl.OPENSSL_VERSION, ) @@ -892,7 +892,7 @@ def _madmax_plotting_command_args(self, request: Any, ignoreCount: bool, index: def _build_plotting_command_args(self, request: Any, ignoreCount: bool, index: int) -> List[str]: plotter: str = request.get("plotter", "chiapos") - command_args: List[str] = ["chia", "plotters", plotter] + command_args: List[str] = ["flax", "plotters", plotter] command_args.extend(self._common_plotting_command_args(request, ignoreCount)) @@ -1201,7 +1201,7 @@ async def exit(self) -> None: self.webserver.close() await self.webserver.await_closed() self.shutdown_event.set() - log.info("chia daemon exiting") + log.info("flax daemon exiting") async def register_service(self, websocket: WebSocketResponse, request: Dict[str, Any]) -> Dict[str, Any]: self.log.info(f"Register service {request}") @@ -1258,8 +1258,8 @@ def plotter_log_path(root_path: Path, id: str): def launch_plotter(root_path: Path, service_name: str, service_array: List[str], id: str): - # we need to pass on the possibly altered CHIA_ROOT - os.environ["CHIA_ROOT"] = str(root_path) + # we need to pass on the possibly altered FLAX_ROOT + os.environ["FLAX_ROOT"] = str(root_path) service_executable = executable_for_service(service_array[0]) # Swap service name with name of executable @@ -1304,12 +1304,12 @@ def launch_service(root_path: Path, service_command) -> Tuple[subprocess.Popen, """ Launch a child process. """ - # set up CHIA_ROOT + # set up FLAX_ROOT # invoke correct script # save away PID - # we need to pass on the possibly altered CHIA_ROOT - os.environ["CHIA_ROOT"] = str(root_path) + # we need to pass on the possibly altered FLAX_ROOT + os.environ["FLAX_ROOT"] = str(root_path) # Insert proper e service_array = service_command.split() @@ -1321,7 +1321,7 @@ def launch_service(root_path: Path, service_command) -> Tuple[subprocess.Popen, startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - log.debug(f"Launching service {service_array} with CHIA_ROOT: {os.environ['CHIA_ROOT']}") + log.debug(f"Launching service {service_array} with FLAX_ROOT: {os.environ['FLAX_ROOT']}") # CREATE_NEW_PROCESS_GROUP allows graceful shutdown on windows, by CTRL_BREAK_EVENT signal if sys.platform == "win32" or sys.platform == "cygwin": @@ -1396,11 +1396,11 @@ def is_running(services: Dict[str, subprocess.Popen], service_name: str) -> bool async def async_run_daemon(root_path: Path, wait_for_unlock: bool = False) -> int: - # When wait_for_unlock is true, we want to skip the check_keys() call in chia_init + # When wait_for_unlock is true, we want to skip the check_keys() call in flax_init # since it might be necessary to wait for the GUI to unlock the keyring first. - chia_init(root_path, should_check_keys=(not wait_for_unlock)) + flax_init(root_path, should_check_keys=(not wait_for_unlock)) config = load_config(root_path, "config.yaml") - setproctitle("chia_daemon") + setproctitle("flax_daemon") initialize_service_logging("daemon", config) crt_path = root_path / config["daemon_ssl"]["private_crt"] key_path = root_path / config["daemon_ssl"]["private_key"] @@ -1420,7 +1420,7 @@ async def async_run_daemon(root_path: Path, wait_for_unlock: bool = False) -> in sys.stdout.flush() try: with Lockfile.create(daemon_launch_lock_path(root_path), timeout=1): - log.info(f"chia-blockchain version: {chia_full_version_str()}") + log.info(f"flax-blockchain version: {flax_full_version_str()}") beta_metrics: Optional[BetaMetricsLogger] = None if config.get("beta", {}).get("enabled", False): @@ -1459,8 +1459,8 @@ def run_daemon(root_path: Path, wait_for_unlock: bool = False) -> int: def main() -> int: - from chia.util.default_root import DEFAULT_ROOT_PATH - from chia.util.keychain import Keychain + from flax.util.default_root import DEFAULT_ROOT_PATH + from flax.util.keychain import Keychain wait_for_unlock = "--wait-for-unlock" in sys.argv[1:] and Keychain.is_keyring_locked() return run_daemon(DEFAULT_ROOT_PATH, wait_for_unlock) diff --git a/chia/daemon/windows_signal.py b/flax/daemon/windows_signal.py similarity index 100% rename from chia/daemon/windows_signal.py rename to flax/daemon/windows_signal.py diff --git a/chia/data_layer/__init__.py b/flax/data_layer/__init__.py similarity index 100% rename from chia/data_layer/__init__.py rename to flax/data_layer/__init__.py diff --git a/chia/data_layer/data_layer.py b/flax/data_layer/data_layer.py similarity index 96% rename from chia/data_layer/data_layer.py rename to flax/data_layer/data_layer.py index b94a37d5e..cf667371c 100644 --- a/chia/data_layer/data_layer.py +++ b/flax/data_layer/data_layer.py @@ -10,8 +10,8 @@ import aiohttp -from chia.data_layer.data_layer_errors import KeyNotFoundError -from chia.data_layer.data_layer_util import ( +from flax.data_layer.data_layer_errors import KeyNotFoundError +from flax.data_layer.data_layer_util import ( DiffData, InternalNode, KeyValue, @@ -29,20 +29,20 @@ TerminalNode, leaf_hash, ) -from chia.data_layer.data_layer_wallet import DataLayerWallet, Mirror, SingletonRecord, verify_offer -from chia.data_layer.data_store import DataStore -from chia.data_layer.download_data import insert_from_delta_file, write_files_for_root -from chia.rpc.rpc_server import default_get_connections -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32, uint64 -from chia.util.path import path_from_root -from chia.wallet.trade_record import TradeRecord -from chia.wallet.trading.offer import Offer as TradingOffer -from chia.wallet.transaction_record import TransactionRecord +from flax.data_layer.data_layer_wallet import DataLayerWallet, Mirror, SingletonRecord, verify_offer +from flax.data_layer.data_store import DataStore +from flax.data_layer.download_data import insert_from_delta_file, write_files_for_root +from flax.rpc.rpc_server import default_get_connections +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32, uint64 +from flax.util.path import path_from_root +from flax.wallet.trade_record import TradeRecord +from flax.wallet.trading.offer import Offer as TradingOffer +from flax.wallet.transaction_record import TransactionRecord class DataLayer: @@ -56,10 +56,10 @@ class DataLayer: initialized: bool none_bytes: bytes32 lock: asyncio.Lock - _server: Optional[ChiaServer] + _server: Optional[FlaxServer] @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: # This is a stop gap until the class usage is refactored such the values of # integral attributes are known at creation of the instance. if self._server is None: @@ -99,13 +99,13 @@ def __init__( def _set_state_changed_callback(self, callback: Callable[..., object]) -> None: self.state_changed_callback = callback - async def on_connect(self, connection: WSChiaConnection) -> None: + async def on_connect(self, connection: WSFlaxConnection) -> None: pass def get_connections(self, request_node_type: Optional[NodeType]) -> List[Dict[str, Any]]: return default_get_connections(server=self.server, request_node_type=request_node_type) - def set_server(self, server: ChiaServer) -> None: + def set_server(self, server: FlaxServer) -> None: self._server = server async def _start(self) -> None: diff --git a/chia/data_layer/data_layer_api.py b/flax/data_layer/data_layer_api.py similarity index 81% rename from chia/data_layer/data_layer_api.py rename to flax/data_layer/data_layer_api.py index adbeaafa6..b5d17eb97 100644 --- a/chia/data_layer/data_layer_api.py +++ b/flax/data_layer/data_layer_api.py @@ -2,8 +2,8 @@ import logging -from chia.data_layer.data_layer import DataLayer -from chia.server.server import ChiaServer +from flax.data_layer.data_layer import DataLayer +from flax.server.server import FlaxServer class DataLayerAPI: @@ -16,7 +16,7 @@ def __init__(self, data_layer: DataLayer) -> None: # self.full_node.state_changed_callback = callback @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: return self.data_layer.server @property diff --git a/chia/data_layer/data_layer_errors.py b/flax/data_layer/data_layer_errors.py similarity index 94% rename from chia/data_layer/data_layer_errors.py rename to flax/data_layer/data_layer_errors.py index b7bb9c980..2bbdf9bca 100644 --- a/chia/data_layer/data_layer_errors.py +++ b/flax/data_layer/data_layer_errors.py @@ -2,7 +2,7 @@ from typing import Iterable, List -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sized_bytes import bytes32 class IntegrityError(Exception): diff --git a/chia/data_layer/data_layer_server.py b/flax/data_layer/data_layer_server.py similarity index 91% rename from chia/data_layer/data_layer_server.py rename to flax/data_layer/data_layer_server.py index 3cc75bd43..7c0f11de3 100644 --- a/chia/data_layer/data_layer_server.py +++ b/flax/data_layer/data_layer_server.py @@ -12,16 +12,16 @@ import click from aiohttp import web -from chia.data_layer.download_data import is_filename_valid -from chia.server.upnp import UPnP -from chia.util.chia_logging import initialize_logging -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.network import WebServer -from chia.util.path import path_from_root -from chia.util.setproctitle import setproctitle - -# from chia.cmds.chia import monkey_patch_click +from flax.data_layer.download_data import is_filename_valid +from flax.server.upnp import UPnP +from flax.util.flax_logging import initialize_logging +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.network import WebServer +from flax.util.path import path_from_root +from flax.util.setproctitle import setproctitle + +# from flax.cmds.flax import monkey_patch_click # See: https://bugs.python.org/issue29288 diff --git a/chia/data_layer/data_layer_util.py b/flax/data_layer/data_layer_util.py similarity index 95% rename from chia/data_layer/data_layer_util.py rename to flax/data_layer/data_layer_util.py index c1ecbb9d9..c5624fb92 100644 --- a/chia/data_layer/data_layer_util.py +++ b/flax/data_layer/data_layer_util.py @@ -9,21 +9,21 @@ import aiosqlite as aiosqlite from typing_extensions import final -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint64 +from flax.util.streamable import Streamable, streamable if TYPE_CHECKING: - from chia.data_layer.data_store import DataStore + from flax.data_layer.data_store import DataStore def internal_hash(left_hash: bytes32, right_hash: bytes32) -> bytes32: # ignoring hint error here for: - # https://github.com/Chia-Network/clvm/pull/102 - # https://github.com/Chia-Network/clvm/pull/106 + # https://github.com/Flax-Network/clvm/pull/102 + # https://github.com/Flax-Network/clvm/pull/106 return Program.to((left_hash, right_hash)).get_tree_hash_precalc(left_hash, right_hash) # type: ignore[no-any-return] # noqa: E501 @@ -38,8 +38,8 @@ def calculate_internal_hash(hash: bytes32, other_hash_side: Side, other_hash: by def leaf_hash(key: bytes, value: bytes) -> bytes32: # ignoring hint error here for: - # https://github.com/Chia-Network/clvm/pull/102 - # https://github.com/Chia-Network/clvm/pull/106 + # https://github.com/Flax-Network/clvm/pull/102 + # https://github.com/Flax-Network/clvm/pull/106 return Program.to((key, value)).get_tree_hash() # type: ignore[no-any-return] @@ -216,8 +216,8 @@ def sibling_hashes(self) -> List[bytes32]: return [layer.other_hash for layer in self.layers] def as_program(self) -> Program: - # https://github.com/Chia-Network/clvm/pull/102 - # https://github.com/Chia-Network/clvm/pull/106 + # https://github.com/Flax-Network/clvm/pull/102 + # https://github.com/Flax-Network/clvm/pull/106 return Program.to([self.sibling_sides_integer(), self.sibling_hashes()]) # type: ignore[no-any-return] def valid(self) -> bool: @@ -375,7 +375,7 @@ def marshal(self) -> Dict[str, Any]: @dataclasses.dataclass(frozen=True) class Layer: - # This class is similar to chia.data_layer.data_layer_util.ProofOfInclusionLayer + # This class is similar to flax.data_layer.data_layer_util.ProofOfInclusionLayer # but is being retained for now to keep the API schema definition localized here. other_hash_side: Side diff --git a/chia/data_layer/data_layer_wallet.py b/flax/data_layer/data_layer_wallet.py similarity index 95% rename from chia/data_layer/data_layer_wallet.py rename to flax/data_layer/data_layer_wallet.py index 62563b4a6..9ac997ced 100644 --- a/chia/data_layer/data_layer_wallet.py +++ b/flax/data_layer/data_layer_wallet.py @@ -9,21 +9,21 @@ from blspy import G1Element, G2Element from clvm.EvalError import EvalError -from chia.consensus.block_record import BlockRecord -from chia.data_layer.data_layer_errors import OfferIntegrityError -from chia.data_layer.data_layer_util import OfferStore, ProofOfInclusion, ProofOfInclusionLayer, StoreProofs, leaf_hash -from chia.protocols.wallet_protocol import CoinState -from chia.server.ws_connection import WSChiaConnection -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.streamable import Streamable, streamable -from chia.wallet.db_wallet.db_wallet_puzzles import ( +from flax.consensus.block_record import BlockRecord +from flax.data_layer.data_layer_errors import OfferIntegrityError +from flax.data_layer.data_layer_util import OfferStore, ProofOfInclusion, ProofOfInclusionLayer, StoreProofs, leaf_hash +from flax.protocols.wallet_protocol import CoinState +from flax.server.ws_connection import WSFlaxConnection +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.streamable import Streamable, streamable +from flax.wallet.db_wallet.db_wallet_puzzles import ( ACS_MU, ACS_MU_PH, GRAFTROOT_DL_OFFERS, @@ -37,24 +37,24 @@ launcher_to_struct, match_dl_singleton, ) -from chia.wallet.derivation_record import DerivationRecord -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.outer_puzzles import AssetType -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.singleton_top_layer_v1_1 import SINGLETON_LAUNCHER_HASH -from chia.wallet.sign_coin_spends import sign_coin_spends -from chia.wallet.trading.offer import NotarizedPayment, Offer -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.util.merkle_utils import _simplify_merkle_proof -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_info import WalletInfo +from flax.wallet.derivation_record import DerivationRecord +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.outer_puzzles import AssetType +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.singleton_top_layer_v1_1 import SINGLETON_LAUNCHER_HASH +from flax.wallet.sign_coin_spends import sign_coin_spends +from flax.wallet.trading.offer import NotarizedPayment, Offer +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.util.merkle_utils import _simplify_merkle_proof +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_info import WalletInfo if TYPE_CHECKING: - from chia.wallet.wallet_state_manager import WalletStateManager + from flax.wallet.wallet_state_manager import WalletStateManager @streamable @@ -196,7 +196,7 @@ async def match_dl_launcher(launcher_spend: CoinSpend) -> Tuple[bool, Optional[b return True, inner_puzhash - async def get_launcher_coin_state(self, launcher_id: bytes32, peer: WSChiaConnection) -> CoinState: + async def get_launcher_coin_state(self, launcher_id: bytes32, peer: WSFlaxConnection) -> CoinState: coin_states: List[CoinState] = await self.wallet_state_manager.wallet_node.get_coin_state( [launcher_id], peer=peer ) @@ -216,7 +216,7 @@ async def get_launcher_coin_state(self, launcher_id: bytes32, peer: WSChiaConnec async def track_new_launcher_id( self, launcher_id: bytes32, - peer: WSChiaConnection, + peer: WSFlaxConnection, spend: Optional[CoinSpend] = None, height: Optional[uint32] = None, ) -> None: @@ -235,7 +235,7 @@ async def track_new_launcher_id( async def new_launcher_spend( self, launcher_spend: CoinSpend, - peer: WSChiaConnection, + peer: WSFlaxConnection, height: Optional[uint32] = None, ) -> None: launcher_id: bytes32 = launcher_spend.coin.name() @@ -390,13 +390,13 @@ async def generate_new_reporter( return dl_record, std_record, launcher_coin.name() - async def create_tandem_xch_tx( + async def create_tandem_xfx_tx( self, fee: uint64, announcement_to_assert: Announcement, coin_announcement: bool = True, ) -> TransactionRecord: - chia_tx = await self.standard_wallet.generate_signed_transaction( + flax_tx = await self.standard_wallet.generate_signed_transaction( amount=uint64(0), puzzle_hash=await self.standard_wallet.get_new_puzzlehash(), fee=fee, @@ -404,8 +404,8 @@ async def create_tandem_xch_tx( coin_announcements_to_consume={announcement_to_assert} if coin_announcement else None, puzzle_announcements_to_consume=None if coin_announcement else {announcement_to_assert}, ) - assert chia_tx.spend_bundle is not None - return chia_tx + assert flax_tx.spend_bundle is not None + return flax_tx async def create_update_state_spend( self, @@ -612,13 +612,13 @@ async def create_update_state_spend( name=singleton_record.coin_id, ) if fee > 0: - chia_tx = await self.create_tandem_xch_tx( + flax_tx = await self.create_tandem_xfx_tx( fee, Announcement(current_coin.name(), b"$"), coin_announcement=True ) - aggregate_bundle = SpendBundle.aggregate([dl_tx.spend_bundle, chia_tx.spend_bundle]) + aggregate_bundle = SpendBundle.aggregate([dl_tx.spend_bundle, flax_tx.spend_bundle]) dl_tx = dataclasses.replace(dl_tx, spend_bundle=aggregate_bundle) - chia_tx = dataclasses.replace(chia_tx, spend_bundle=None) - txs: List[TransactionRecord] = [dl_tx, chia_tx] + flax_tx = dataclasses.replace(flax_tx, spend_bundle=None) + txs: List[TransactionRecord] = [dl_tx, flax_tx] else: txs = [dl_tx] @@ -749,7 +749,7 @@ async def create_new_mirror( return [create_mirror_tx_record] async def delete_mirror( - self, mirror_id: bytes32, peer: WSChiaConnection, fee: uint64 = uint64(0) + self, mirror_id: bytes32, peer: WSFlaxConnection, fee: uint64 = uint64(0) ) -> List[TransactionRecord]: mirror: Mirror = await self.get_mirror(mirror_id) mirror_coin: Coin = (await self.wallet_state_manager.wallet_node.get_coin_state([mirror.coin_id], peer=peer))[ @@ -810,7 +810,7 @@ async def delete_mirror( ] if excess_fee > 0: - chia_tx: TransactionRecord = await self.wallet_state_manager.main_wallet.generate_signed_transaction( + flax_tx: TransactionRecord = await self.wallet_state_manager.main_wallet.generate_signed_transaction( uint64(1), new_puzhash, fee=uint64(excess_fee), @@ -818,9 +818,9 @@ async def delete_mirror( ) txs = [ dataclasses.replace( - txs[0], spend_bundle=SpendBundle.aggregate([txs[0].spend_bundle, chia_tx.spend_bundle]) + txs[0], spend_bundle=SpendBundle.aggregate([txs[0].spend_bundle, flax_tx.spend_bundle]) ), - dataclasses.replace(chia_tx, spend_bundle=None), + dataclasses.replace(flax_tx, spend_bundle=None), ] return txs @@ -829,7 +829,7 @@ async def delete_mirror( # SYNCING # ########### - async def coin_added(self, coin: Coin, height: uint32, peer: WSChiaConnection) -> None: + async def coin_added(self, coin: Coin, height: uint32, peer: WSFlaxConnection) -> None: if coin.puzzle_hash == create_mirror_puzzle().get_tree_hash(): parent_state: CoinState = ( await self.wallet_state_manager.wallet_node.get_coin_state([coin.parent_coin_info], peer=peer) @@ -1399,6 +1399,6 @@ def verify_offer( if TYPE_CHECKING: - from chia.wallet.wallet_protocol import WalletProtocol + from flax.wallet.wallet_protocol import WalletProtocol _dummy: WalletProtocol = DataLayerWallet() diff --git a/chia/data_layer/data_store.py b/flax/data_layer/data_store.py similarity index 99% rename from chia/data_layer/data_store.py rename to flax/data_layer/data_store.py index 4c9335f68..e1fe396e3 100644 --- a/chia/data_layer/data_store.py +++ b/flax/data_layer/data_store.py @@ -9,8 +9,8 @@ import aiosqlite -from chia.data_layer.data_layer_errors import KeyNotFoundError, NodeHashError, TreeGenerationIncrementingError -from chia.data_layer.data_layer_util import ( +from flax.data_layer.data_layer_errors import KeyNotFoundError, NodeHashError, TreeGenerationIncrementingError +from flax.data_layer.data_layer_util import ( DiffData, InternalNode, Node, @@ -29,9 +29,9 @@ leaf_hash, row_to_node, ) -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2 +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2 log = logging.getLogger(__name__) @@ -167,7 +167,7 @@ async def _insert_root( generation: Optional[int] = None, ) -> None: # This should be replaced by an SQLite schema level check. - # https://github.com/Chia-Network/chia-blockchain/pull/9284 + # https://github.com/Flax-Network/flax-blockchain/pull/9284 tree_id = bytes32(tree_id) async with self.db_wrapper.writer() as writer: @@ -310,8 +310,8 @@ async def _insert_ancestor_table( async def _insert_terminal_node(self, key: bytes, value: bytes) -> bytes32: # forcing type hint here for: - # https://github.com/Chia-Network/clvm/pull/102 - # https://github.com/Chia-Network/clvm/pull/106 + # https://github.com/Flax-Network/clvm/pull/102 + # https://github.com/Flax-Network/clvm/pull/106 node_hash: bytes32 = Program.to((key, value)).get_tree_hash() await self._insert_node( @@ -1133,8 +1133,8 @@ async def get_tree_as_program(self, tree_id: bytes32) -> Program: root_node = hash_to_node[root_node.hash] # TODO: Remove ignore when done. - # https://github.com/Chia-Network/clvm/pull/102 - # https://github.com/Chia-Network/clvm/pull/106 + # https://github.com/Flax-Network/clvm/pull/102 + # https://github.com/Flax-Network/clvm/pull/106 program: Program = Program.to(root_node) return program diff --git a/chia/data_layer/dl_wallet_store.py b/flax/data_layer/dl_wallet_store.py similarity index 97% rename from chia/data_layer/dl_wallet_store.py rename to flax/data_layer/dl_wallet_store.py index 4937546bf..835dd482a 100644 --- a/chia/data_layer/dl_wallet_store.py +++ b/flax/data_layer/dl_wallet_store.py @@ -5,12 +5,12 @@ from aiosqlite import Row -from chia.data_layer.data_layer_wallet import Mirror, SingletonRecord -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.lineage_proof import LineageProof +from flax.data_layer.data_layer_wallet import Mirror, SingletonRecord +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.lineage_proof import LineageProof _T_DataLayerStore = TypeVar("_T_DataLayerStore", bound="DataLayerStore") diff --git a/chia/data_layer/download_data.py b/flax/data_layer/download_data.py similarity index 97% rename from chia/data_layer/download_data.py rename to flax/data_layer/download_data.py index b5f88053c..2bb1afd8f 100644 --- a/chia/data_layer/download_data.py +++ b/flax/data_layer/download_data.py @@ -10,9 +10,9 @@ import aiohttp from typing_extensions import Literal -from chia.data_layer.data_layer_util import NodeType, Root, SerializedNode, ServerInfo, Status -from chia.data_layer.data_store import DataStore -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.data_layer.data_layer_util import NodeType, Root, SerializedNode, ServerInfo, Status +from flax.data_layer.data_store import DataStore +from flax.types.blockchain_format.sized_bytes import bytes32 def get_full_tree_filename(tree_id: bytes32, node_hash: bytes32, generation: int) -> str: diff --git a/chia/data_layer/util/__init__.py b/flax/data_layer/util/__init__.py similarity index 100% rename from chia/data_layer/util/__init__.py rename to flax/data_layer/util/__init__.py diff --git a/chia/data_layer/util/benchmark.py b/flax/data_layer/util/benchmark.py similarity index 96% rename from chia/data_layer/util/benchmark.py rename to flax/data_layer/util/benchmark.py index c4051df17..66432ad98 100644 --- a/chia/data_layer/util/benchmark.py +++ b/flax/data_layer/util/benchmark.py @@ -8,9 +8,9 @@ from pathlib import Path from typing import Dict, Optional -from chia.data_layer.data_layer_util import Side, TerminalNode, leaf_hash -from chia.data_layer.data_store import DataStore -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.data_layer.data_layer_util import Side, TerminalNode, leaf_hash +from flax.data_layer.data_store import DataStore +from flax.types.blockchain_format.sized_bytes import bytes32 async def generate_datastore(num_nodes: int, slow_mode: bool) -> None: diff --git a/chia/farmer/__init__.py b/flax/farmer/__init__.py similarity index 100% rename from chia/farmer/__init__.py rename to flax/farmer/__init__.py diff --git a/chia/farmer/farmer.py b/flax/farmer/farmer.py similarity index 94% rename from chia/farmer/farmer.py rename to flax/farmer/farmer.py index a3cf2df66..d3afdae18 100644 --- a/chia/farmer/farmer.py +++ b/flax/farmer/farmer.py @@ -11,14 +11,14 @@ import aiohttp from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey -import chia.server.ws_connection as ws # lgtm [py/import-and-import-from] -from chia.consensus.constants import ConsensusConstants -from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain -from chia.plot_sync.delta import Delta -from chia.plot_sync.receiver import Receiver -from chia.pools.pool_config import PoolWalletConfig, add_auth_key, load_pool_config -from chia.protocols import farmer_protocol, harvester_protocol -from chia.protocols.pool_protocol import ( +import flax.server.ws_connection as ws # lgtm [py/import-and-import-from] +from flax.consensus.constants import ConsensusConstants +from flax.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain +from flax.plot_sync.delta import Delta +from flax.plot_sync.receiver import Receiver +from flax.pools.pool_config import PoolWalletConfig, add_auth_key, load_pool_config +from flax.protocols import farmer_protocol, harvester_protocol +from flax.protocols.pool_protocol import ( AuthenticationPayload, ErrorResponse, GetFarmerResponse, @@ -29,29 +29,29 @@ PutFarmerRequest, get_current_authentication_token, ) -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.rpc.rpc_server import default_get_connections -from chia.server.outbound_message import NodeType, make_msg -from chia.server.server import ssl_context_for_root -from chia.server.ws_connection import WSChiaConnection -from chia.ssl.create_ssl import get_mozilla_ca_crt -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.bech32m import decode_puzzle_hash -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import config_path_for_filename, load_config, lock_and_load_config, save_config -from chia.util.errors import KeychainProxyConnectionFailure -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint16, uint32, uint64 -from chia.util.keychain import Keychain -from chia.wallet.derive_keys import ( +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.rpc.rpc_server import default_get_connections +from flax.server.outbound_message import NodeType, make_msg +from flax.server.server import ssl_context_for_root +from flax.server.ws_connection import WSFlaxConnection +from flax.ssl.create_ssl import get_mozilla_ca_crt +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.bech32m import decode_puzzle_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import config_path_for_filename, load_config, lock_and_load_config, save_config +from flax.util.errors import KeychainProxyConnectionFailure +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint16, uint32, uint64 +from flax.util.keychain import Keychain +from flax.wallet.derive_keys import ( find_authentication_sk, find_owner_sk, master_sk_to_farmer_sk, master_sk_to_pool_sk, match_address_to_sk, ) -from chia.wallet.puzzles.singleton_top_layer import SINGLETON_MOD +from flax.wallet.puzzles.singleton_top_layer import SINGLETON_MOD singleton_mod_hash = SINGLETON_MOD.get_tree_hash() @@ -135,7 +135,7 @@ async def get_all_private_keys(self): return await keychain_proxy.get_all_private_keys() async def setup_keys(self) -> bool: - no_keys_error_str = "No keys exist. Please run 'chia keys generate' or open the UI." + no_keys_error_str = "No keys exist. Please run 'flax keys generate' or open the UI." try: self.all_root_sks: List[PrivateKey] = [sk for sk, _ in await self.get_all_private_keys()] except KeychainProxyConnectionFailure: @@ -150,22 +150,22 @@ async def setup_keys(self) -> bool: return False config = load_config(self._root_path, "config.yaml") - if "xch_target_address" not in self.config: + if "xfx_target_address" not in self.config: self.config = config["farmer"] - if "xch_target_address" not in self.pool_config: + if "xfx_target_address" not in self.pool_config: self.pool_config = config["pool"] - if "xch_target_address" not in self.config or "xch_target_address" not in self.pool_config: - log.debug("xch_target_address missing in the config") + if "xfx_target_address" not in self.config or "xfx_target_address" not in self.pool_config: + log.debug("xfx_target_address missing in the config") return False # This is the farmer configuration - self.farmer_target_encoded = self.config["xch_target_address"] + self.farmer_target_encoded = self.config["xfx_target_address"] self.farmer_target = decode_puzzle_hash(self.farmer_target_encoded) self.pool_public_keys = [G1Element.from_bytes(bytes.fromhex(pk)) for pk in self.config["pool_public_keys"]] # This is the self pooling configuration, which is only used for original self-pooled plots - self.pool_target_encoded = self.pool_config["xch_target_address"] + self.pool_target_encoded = self.pool_config["xfx_target_address"] self.pool_target = decode_puzzle_hash(self.pool_target_encoded) self.pool_sks_map: Dict = {} for key in self.get_private_keys(): @@ -212,7 +212,7 @@ async def _await_closed(self, shutting_down: bool = True): def _set_state_changed_callback(self, callback: Callable): self.state_changed_callback = callback - async def on_connect(self, peer: WSChiaConnection): + async def on_connect(self, peer: WSFlaxConnection): self.state_changed("add_connection", {}) async def handshake_task(): @@ -257,7 +257,7 @@ def handle_failed_pool_response(self, p2_singleton_puzzle_hash: bytes32, error_m ErrorResponse(uint16(PoolErrorCode.REQUEST_FAILED.value), error_message).to_json_dict() ) - def on_disconnect(self, connection: ws.WSChiaConnection): + def on_disconnect(self, connection: ws.WSFlaxConnection): self.log.info(f"peer disconnected {connection.get_peer_logging()}") self.state_changed("close_connection", {}) if connection.connection_type is NodeType.HARVESTER: @@ -593,11 +593,11 @@ def set_reward_targets(self, farmer_target_encoded: Optional[str], pool_target_e if farmer_target_encoded is not None: self.farmer_target_encoded = farmer_target_encoded self.farmer_target = decode_puzzle_hash(farmer_target_encoded) - config["farmer"]["xch_target_address"] = farmer_target_encoded + config["farmer"]["xfx_target_address"] = farmer_target_encoded if pool_target_encoded is not None: self.pool_target_encoded = pool_target_encoded self.pool_target = decode_puzzle_hash(pool_target_encoded) - config["pool"]["xch_target_address"] = pool_target_encoded + config["pool"]["xfx_target_address"] = pool_target_encoded save_config(self._root_path, "config.yaml", config) async def set_payout_instructions(self, launcher_id: bytes32, payout_instructions: str): diff --git a/chia/farmer/farmer_api.py b/flax/farmer/farmer_api.py similarity index 96% rename from chia/farmer/farmer_api.py rename to flax/farmer/farmer_api.py index 704eb1925..6c7c57be8 100644 --- a/chia/farmer/farmer_api.py +++ b/flax/farmer/farmer_api.py @@ -7,32 +7,32 @@ import aiohttp from blspy import AugSchemeMPL, G2Element, PrivateKey -import chia.server.ws_connection as ws -from chia import __version__ -from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters -from chia.farmer.farmer import Farmer -from chia.protocols import farmer_protocol, harvester_protocol -from chia.protocols.harvester_protocol import ( +import flax.server.ws_connection as ws +from flax import __version__ +from flax.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters +from flax.farmer.farmer import Farmer +from flax.protocols import farmer_protocol, harvester_protocol +from flax.protocols.harvester_protocol import ( PlotSyncDone, PlotSyncPathList, PlotSyncPlotList, PlotSyncStart, PoolDifficulty, ) -from chia.protocols.pool_protocol import ( +from flax.protocols.pool_protocol import ( PoolErrorCode, PostPartialPayload, PostPartialRequest, get_current_authentication_token, ) -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.server.outbound_message import NodeType, make_msg -from chia.server.server import ssl_context_for_root -from chia.ssl.create_ssl import get_mozilla_ca_crt -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.util.api_decorators import api_request, peer_required -from chia.util.ints import uint32, uint64 +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.server.outbound_message import NodeType, make_msg +from flax.server.server import ssl_context_for_root +from flax.ssl.create_ssl import get_mozilla_ca_crt +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.util.api_decorators import api_request, peer_required +from flax.util.ints import uint32, uint64 def strip_old_entries(pairs: List[Tuple[float, Any]], before: float) -> List[Tuple[float, Any]]: @@ -54,7 +54,7 @@ def __init__(self, farmer) -> None: @api_request @peer_required async def new_proof_of_space( - self, new_proof_of_space: harvester_protocol.NewProofOfSpace, peer: ws.WSChiaConnection + self, new_proof_of_space: harvester_protocol.NewProofOfSpace, peer: ws.WSFlaxConnection ): """ This is a response from the harvester, for a NewChallenge. Here we check if the proof @@ -241,7 +241,7 @@ async def new_proof_of_space( f"{pool_url}/partial", json=post_partial_request.to_json_dict(), ssl=ssl_context_for_root(get_mozilla_ca_crt(), log=self.farmer.log), - headers={"User-Agent": f"Chia Blockchain v.{__version__}"}, + headers={"User-Agent": f"Flax Blockchain v.{__version__}"}, ) as resp: if resp.ok: pool_response: Dict = json.loads(await resp.text()) @@ -531,40 +531,40 @@ async def farming_info(self, request: farmer_protocol.FarmingInfo): @api_request @peer_required - async def respond_plots(self, _: harvester_protocol.RespondPlots, peer: ws.WSChiaConnection): + async def respond_plots(self, _: harvester_protocol.RespondPlots, peer: ws.WSFlaxConnection): self.farmer.log.warning(f"Respond plots came too late from: {peer.get_peer_logging()}") @api_request @peer_required - async def plot_sync_start(self, message: PlotSyncStart, peer: ws.WSChiaConnection): + async def plot_sync_start(self, message: PlotSyncStart, peer: ws.WSFlaxConnection): await self.farmer.plot_sync_receivers[peer.peer_node_id].sync_started(message) @api_request @peer_required - async def plot_sync_loaded(self, message: PlotSyncPlotList, peer: ws.WSChiaConnection): + async def plot_sync_loaded(self, message: PlotSyncPlotList, peer: ws.WSFlaxConnection): await self.farmer.plot_sync_receivers[peer.peer_node_id].process_loaded(message) @api_request @peer_required - async def plot_sync_removed(self, message: PlotSyncPathList, peer: ws.WSChiaConnection): + async def plot_sync_removed(self, message: PlotSyncPathList, peer: ws.WSFlaxConnection): await self.farmer.plot_sync_receivers[peer.peer_node_id].process_removed(message) @api_request @peer_required - async def plot_sync_invalid(self, message: PlotSyncPathList, peer: ws.WSChiaConnection): + async def plot_sync_invalid(self, message: PlotSyncPathList, peer: ws.WSFlaxConnection): await self.farmer.plot_sync_receivers[peer.peer_node_id].process_invalid(message) @api_request @peer_required - async def plot_sync_keys_missing(self, message: PlotSyncPathList, peer: ws.WSChiaConnection): + async def plot_sync_keys_missing(self, message: PlotSyncPathList, peer: ws.WSFlaxConnection): await self.farmer.plot_sync_receivers[peer.peer_node_id].process_keys_missing(message) @api_request @peer_required - async def plot_sync_duplicates(self, message: PlotSyncPathList, peer: ws.WSChiaConnection): + async def plot_sync_duplicates(self, message: PlotSyncPathList, peer: ws.WSFlaxConnection): await self.farmer.plot_sync_receivers[peer.peer_node_id].process_duplicates(message) @api_request @peer_required - async def plot_sync_done(self, message: PlotSyncDone, peer: ws.WSChiaConnection): + async def plot_sync_done(self, message: PlotSyncDone, peer: ws.WSFlaxConnection): await self.farmer.plot_sync_receivers[peer.peer_node_id].sync_done(message) diff --git a/chia/full_node/__init__.py b/flax/full_node/__init__.py similarity index 100% rename from chia/full_node/__init__.py rename to flax/full_node/__init__.py diff --git a/chia/full_node/bitcoin_fee_estimator.py b/flax/full_node/bitcoin_fee_estimator.py similarity index 85% rename from chia/full_node/bitcoin_fee_estimator.py rename to flax/full_node/bitcoin_fee_estimator.py index ca8514d1f..2dc0f824f 100644 --- a/chia/full_node/bitcoin_fee_estimator.py +++ b/flax/full_node/bitcoin_fee_estimator.py @@ -3,16 +3,16 @@ import logging from datetime import datetime -from chia.full_node.fee_estimate_store import FeeStore -from chia.full_node.fee_estimation import FeeBlockInfo, FeeMempoolInfo -from chia.full_node.fee_estimator import SmartFeeEstimator -from chia.full_node.fee_estimator_interface import FeeEstimatorInterface -from chia.full_node.fee_tracker import FeeTracker -from chia.types.clvm_cost import CLVMCost -from chia.types.fee_rate import FeeRate -from chia.types.mempool_item import MempoolItem -from chia.types.mojos import Mojos -from chia.util.ints import uint32, uint64 +from flax.full_node.fee_estimate_store import FeeStore +from flax.full_node.fee_estimation import FeeBlockInfo, FeeMempoolInfo +from flax.full_node.fee_estimator import SmartFeeEstimator +from flax.full_node.fee_estimator_interface import FeeEstimatorInterface +from flax.full_node.fee_tracker import FeeTracker +from flax.types.clvm_cost import CLVMCost +from flax.types.fee_rate import FeeRate +from flax.types.mempool_item import MempoolItem +from flax.types.mojos import Mojos +from flax.util.ints import uint32, uint64 class BitcoinFeeEstimator(FeeEstimatorInterface): diff --git a/chia/full_node/block_height_map.py b/flax/full_node/block_height_map.py similarity index 96% rename from chia/full_node/block_height_map.py rename to flax/full_node/block_height_map.py index 1629ffac0..548019e23 100644 --- a/chia/full_node/block_height_map.py +++ b/flax/full_node/block_height_map.py @@ -1,14 +1,14 @@ import logging from typing import Dict, List, Optional, Tuple -from chia.util.ints import uint32 -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.util.ints import uint32 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary from pathlib import Path import aiofiles from dataclasses import dataclass -from chia.util.streamable import Streamable, streamable -from chia.util.files import write_file_async -from chia.util.db_wrapper import DBWrapper2 +from flax.util.streamable import Streamable, streamable +from flax.util.files import write_file_async +from flax.util.db_wrapper import DBWrapper2 log = logging.getLogger(__name__) diff --git a/chia/full_node/block_store.py b/flax/full_node/block_store.py similarity index 97% rename from chia/full_node/block_store.py rename to flax/full_node/block_store.py index fd7bd2bc0..2476bf8d0 100644 --- a/chia/full_node/block_store.py +++ b/flax/full_node/block_store.py @@ -8,17 +8,17 @@ import typing_extensions import zstd -from chia.consensus.block_record import BlockRecord -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.types.weight_proof import SubEpochChallengeSegment, SubEpochSegments -from chia.util.db_wrapper import DBWrapper2, execute_fetchone -from chia.util.errors import Err -from chia.util.full_block_utils import block_info_from_block, generator_from_block -from chia.util.ints import uint32 -from chia.util.lru_cache import LRUCache -from chia.util.full_block_utils import GeneratorBlockInfo +from flax.consensus.block_record import BlockRecord +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.types.weight_proof import SubEpochChallengeSegment, SubEpochSegments +from flax.util.db_wrapper import DBWrapper2, execute_fetchone +from flax.util.errors import Err +from flax.util.full_block_utils import block_info_from_block, generator_from_block +from flax.util.ints import uint32 +from flax.util.lru_cache import LRUCache +from flax.util.full_block_utils import GeneratorBlockInfo log = logging.getLogger(__name__) @@ -61,7 +61,7 @@ async def create(cls, db_wrapper: DBWrapper2) -> BlockStore: await conn.execute("CREATE TABLE IF NOT EXISTS current_peak(key int PRIMARY KEY, hash blob)") # If any of these indices are altered, they should also be altered - # in the chia/cmds/db_upgrade.py file + # in the flax/cmds/db_upgrade.py file log.info("DB: Creating index height") await conn.execute("CREATE INDEX IF NOT EXISTS height on full_blocks(height)") @@ -73,7 +73,7 @@ async def create(cls, db_wrapper: DBWrapper2) -> BlockStore: ) # If any of these indices are altered, they should also be altered - # in the chia/cmds/db_upgrade.py file + # in the flax/cmds/db_upgrade.py file log.info("DB: Creating index is_fully_compactified") await conn.execute( "CREATE INDEX IF NOT EXISTS is_fully_compactified ON" diff --git a/chia/full_node/bundle_tools.py b/flax/full_node/bundle_tools.py similarity index 94% rename from chia/full_node/bundle_tools.py rename to flax/full_node/bundle_tools.py index 71e1e2c47..0b167bcab 100644 --- a/chia/full_node/bundle_tools.py +++ b/flax/full_node/bundle_tools.py @@ -1,13 +1,13 @@ import re from typing import Optional, Tuple, List, Union -from chia.full_node.generator import create_compressed_generator -from chia.types.blockchain_format.program import SerializedProgram, Program -from chia.types.coin_spend import CoinSpend -from chia.types.generator_types import BlockGenerator, CompressorArg -from chia.types.spend_bundle import SpendBundle -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint32 +from flax.full_node.generator import create_compressed_generator +from flax.types.blockchain_format.program import SerializedProgram, Program +from flax.types.coin_spend import CoinSpend +from flax.types.generator_types import BlockGenerator, CompressorArg +from flax.types.spend_bundle import SpendBundle +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint32 from clvm.casts import int_to_bytes diff --git a/chia/full_node/coin_store.py b/flax/full_node/coin_store.py similarity index 98% rename from chia/full_node/coin_store.py rename to flax/full_node/coin_store.py index 7ef227a8a..5ddf8502e 100644 --- a/chia/full_node/coin_store.py +++ b/flax/full_node/coin_store.py @@ -7,17 +7,17 @@ import typing_extensions from aiosqlite import Cursor -from chia.protocols.wallet_protocol import CoinState -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_record import CoinRecord -from chia.util.db_wrapper import DBWrapper2, SQLITE_MAX_VARIABLE_NUMBER -from chia.util.ints import uint32, uint64 -from chia.util.chunks import chunks +from flax.protocols.wallet_protocol import CoinState +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_record import CoinRecord +from flax.util.db_wrapper import DBWrapper2, SQLITE_MAX_VARIABLE_NUMBER +from flax.util.ints import uint32, uint64 +from flax.util.chunks import chunks import time import logging -from chia.util.lru_cache import LRUCache +from flax.util.lru_cache import LRUCache log = logging.getLogger(__name__) diff --git a/chia/full_node/fee_estimate.py b/flax/full_node/fee_estimate.py similarity index 89% rename from chia/full_node/fee_estimate.py rename to flax/full_node/fee_estimate.py index 8075fd824..a84ccccaa 100644 --- a/chia/full_node/fee_estimate.py +++ b/flax/full_node/fee_estimate.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from typing import List, Optional -from chia.types.fee_rate import FeeRate -from chia.util.ints import uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.fee_rate import FeeRate +from flax.util.ints import uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/full_node/fee_estimate_store.py b/flax/full_node/fee_estimate_store.py similarity index 89% rename from chia/full_node/fee_estimate_store.py rename to flax/full_node/fee_estimate_store.py index 49b0cc959..b2d6d79e0 100644 --- a/chia/full_node/fee_estimate_store.py +++ b/flax/full_node/fee_estimate_store.py @@ -5,7 +5,7 @@ import typing_extensions -from chia.full_node.fee_history import FeeTrackerBackup +from flax.full_node.fee_history import FeeTrackerBackup @typing_extensions.final diff --git a/chia/full_node/fee_estimation.py b/flax/full_node/fee_estimation.py similarity index 84% rename from chia/full_node/fee_estimation.py rename to flax/full_node/fee_estimation.py index f1d829141..c892f7bdd 100644 --- a/chia/full_node/fee_estimation.py +++ b/flax/full_node/fee_estimation.py @@ -4,10 +4,10 @@ from datetime import datetime from typing import List -from chia.types.clvm_cost import CLVMCost -from chia.types.fee_rate import FeeRate -from chia.types.mempool_item import MempoolItem -from chia.util.ints import uint32 +from flax.types.clvm_cost import CLVMCost +from flax.types.fee_rate import FeeRate +from flax.types.mempool_item import MempoolItem +from flax.util.ints import uint32 @dataclass(frozen=True) @@ -17,8 +17,8 @@ class FeeMempoolInfo: Updated when `MemPoolItem`s are added or removed from the Mempool. Attributes: - current_mempool_cost (uint64):This is the current capacity of the mempool, measured in XCH per CLVM Cost - max_size_in_cost (uint64): This is the maximum capacity of the mempool, measured in XCH per CLVM Cost + current_mempool_cost (uint64):This is the current capacity of the mempool, measured in XFX per CLVM Cost + max_size_in_cost (uint64): This is the maximum capacity of the mempool, measured in XFX per CLVM Cost minimum_fee_per_cost_to_replace (uint64): Smallest FPC that might be accepted to replace another SpendBundle time (datetime): Local time this sample was taken diff --git a/chia/full_node/fee_estimator.py b/flax/full_node/fee_estimator.py similarity index 92% rename from chia/full_node/fee_estimator.py rename to flax/full_node/fee_estimator.py index 19a594c4c..fc5c3d3cf 100644 --- a/chia/full_node/fee_estimator.py +++ b/flax/full_node/fee_estimator.py @@ -3,11 +3,11 @@ import logging from dataclasses import dataclass, field -from chia.full_node.fee_estimate import FeeEstimate, FeeEstimateGroup -from chia.full_node.fee_estimation import FeeMempoolInfo -from chia.full_node.fee_tracker import BucketResult, EstimateResult, FeeTracker, get_estimate_time_intervals -from chia.types.fee_rate import FeeRate -from chia.util.ints import uint32, uint64 +from flax.full_node.fee_estimate import FeeEstimate, FeeEstimateGroup +from flax.full_node.fee_estimation import FeeMempoolInfo +from flax.full_node.fee_tracker import BucketResult, EstimateResult, FeeTracker, get_estimate_time_intervals +from flax.types.fee_rate import FeeRate +from flax.util.ints import uint32, uint64 # https://github.com/bitcoin/bitcoin/blob/5b6f0f31fa6ce85db3fb7f9823b1bbb06161ae32/src/policy/fees.cpp diff --git a/chia/full_node/fee_estimator_constants.py b/flax/full_node/fee_estimator_constants.py similarity index 100% rename from chia/full_node/fee_estimator_constants.py rename to flax/full_node/fee_estimator_constants.py diff --git a/chia/full_node/fee_estimator_example.py b/flax/full_node/fee_estimator_example.py similarity index 82% rename from chia/full_node/fee_estimator_example.py rename to flax/full_node/fee_estimator_example.py index 6a7c594fe..6c61d460b 100644 --- a/chia/full_node/fee_estimator_example.py +++ b/flax/full_node/fee_estimator_example.py @@ -2,13 +2,13 @@ from typing import Any, Dict, List -from chia.full_node.fee_estimate import FeeEstimate -from chia.full_node.fee_estimation import FeeBlockInfo, FeeMempoolInfo -from chia.full_node.fee_estimator_interface import FeeEstimatorInterface -from chia.types.clvm_cost import CLVMCost -from chia.types.fee_rate import FeeRate -from chia.types.mempool_item import MempoolItem -from chia.util.ints import uint64 +from flax.full_node.fee_estimate import FeeEstimate +from flax.full_node.fee_estimation import FeeBlockInfo, FeeMempoolInfo +from flax.full_node.fee_estimator_interface import FeeEstimatorInterface +from flax.types.clvm_cost import CLVMCost +from flax.types.fee_rate import FeeRate +from flax.types.mempool_item import MempoolItem +from flax.util.ints import uint64 MIN_MOJO_PER_COST = 5 diff --git a/chia/full_node/fee_estimator_interface.py b/flax/full_node/fee_estimator_interface.py similarity index 84% rename from chia/full_node/fee_estimator_interface.py rename to flax/full_node/fee_estimator_interface.py index b8feca022..2d6d130e0 100644 --- a/chia/full_node/fee_estimator_interface.py +++ b/flax/full_node/fee_estimator_interface.py @@ -2,10 +2,10 @@ from typing_extensions import Protocol -from chia.full_node.fee_estimation import FeeBlockInfo, FeeMempoolInfo -from chia.types.clvm_cost import CLVMCost -from chia.types.fee_rate import FeeRate -from chia.types.mempool_item import MempoolItem +from flax.full_node.fee_estimation import FeeBlockInfo, FeeMempoolInfo +from flax.types.clvm_cost import CLVMCost +from flax.types.fee_rate import FeeRate +from flax.types.mempool_item import MempoolItem class FeeEstimatorInterface(Protocol): diff --git a/chia/full_node/fee_history.py b/flax/full_node/fee_history.py similarity index 84% rename from chia/full_node/fee_history.py rename to flax/full_node/fee_history.py index 59c544530..758254d2f 100644 --- a/chia/full_node/fee_history.py +++ b/flax/full_node/fee_history.py @@ -3,8 +3,8 @@ from dataclasses import dataclass from typing import List -from chia.util.ints import uint8, uint32 -from chia.util.streamable import Streamable, streamable +from flax.util.ints import uint8, uint32 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/full_node/fee_tracker.py b/flax/full_node/fee_tracker.py similarity index 98% rename from chia/full_node/fee_tracker.py rename to flax/full_node/fee_tracker.py index af03832dc..0bada5324 100644 --- a/chia/full_node/fee_tracker.py +++ b/flax/full_node/fee_tracker.py @@ -6,8 +6,8 @@ from sortedcontainers import SortedDict -from chia.full_node.fee_estimate_store import FeeStore -from chia.full_node.fee_estimator_constants import ( +from flax.full_node.fee_estimate_store import FeeStore +from flax.full_node.fee_estimator_constants import ( FEE_ESTIMATOR_VERSION, INFINITE_FEE_RATE, INITIAL_STEP, @@ -26,9 +26,9 @@ SUCCESS_PCT, SUFFICIENT_FEE_TXS, ) -from chia.full_node.fee_history import FeeStatBackup, FeeTrackerBackup -from chia.types.mempool_item import MempoolItem -from chia.util.ints import uint8, uint32, uint64 +from flax.full_node.fee_history import FeeStatBackup, FeeTrackerBackup +from flax.types.mempool_item import MempoolItem +from flax.util.ints import uint8, uint32, uint64 @dataclass diff --git a/chia/full_node/full_node.py b/flax/full_node/full_node.py similarity index 96% rename from chia/full_node/full_node.py rename to flax/full_node/full_node.py index 09022f70e..163871912 100644 --- a/chia/full_node/full_node.py +++ b/flax/full_node/full_node.py @@ -15,69 +15,69 @@ import sqlite3 from blspy import AugSchemeMPL -import chia.server.ws_connection as ws # lgtm [py/import-and-import-from] -from chia.consensus.block_creation import unfinished_block_to_full_block -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain import Blockchain, ReceiveBlockResult, StateChangeSummary -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.cost_calculator import NPCResult -from chia.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty -from chia.consensus.make_sub_epoch_summary import next_sub_epoch_summary -from chia.consensus.multiprocess_validation import PreValidationResult -from chia.consensus.pot_iterations import calculate_sp_iters -from chia.full_node.block_store import BlockStore -from chia.full_node.hint_management import get_hints_and_subscription_coin_ids -from chia.full_node.lock_queue import LockQueue, LockClient -from chia.full_node.bundle_tools import detect_potential_template_generator -from chia.full_node.coin_store import CoinStore -from chia.full_node.full_node_store import FullNodeStore, FullNodeStorePeakResult -from chia.full_node.hint_store import HintStore -from chia.full_node.mempool_manager import MempoolManager -from chia.full_node.signage_point import SignagePoint -from chia.full_node.sync_store import SyncStore -from chia.full_node.weight_proof import WeightProofHandler -from chia.protocols import farmer_protocol, full_node_protocol, timelord_protocol, wallet_protocol -from chia.protocols.full_node_protocol import ( +import flax.server.ws_connection as ws # lgtm [py/import-and-import-from] +from flax.consensus.block_creation import unfinished_block_to_full_block +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain import Blockchain, ReceiveBlockResult, StateChangeSummary +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.cost_calculator import NPCResult +from flax.consensus.difficulty_adjustment import get_next_sub_slot_iters_and_difficulty +from flax.consensus.make_sub_epoch_summary import next_sub_epoch_summary +from flax.consensus.multiprocess_validation import PreValidationResult +from flax.consensus.pot_iterations import calculate_sp_iters +from flax.full_node.block_store import BlockStore +from flax.full_node.hint_management import get_hints_and_subscription_coin_ids +from flax.full_node.lock_queue import LockQueue, LockClient +from flax.full_node.bundle_tools import detect_potential_template_generator +from flax.full_node.coin_store import CoinStore +from flax.full_node.full_node_store import FullNodeStore, FullNodeStorePeakResult +from flax.full_node.hint_store import HintStore +from flax.full_node.mempool_manager import MempoolManager +from flax.full_node.signage_point import SignagePoint +from flax.full_node.sync_store import SyncStore +from flax.full_node.weight_proof import WeightProofHandler +from flax.protocols import farmer_protocol, full_node_protocol, timelord_protocol, wallet_protocol +from flax.protocols.full_node_protocol import ( RequestBlocks, RespondBlock, RespondBlocks, RespondSignagePoint, ) -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.wallet_protocol import CoinState, CoinStateUpdate -from chia.server.node_discovery import FullNodePeers -from chia.server.outbound_message import Message, NodeType, make_msg -from chia.server.peer_store_resolver import PeerStoreResolver -from chia.server.server import ChiaServer -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.blockchain_format.vdf import CompressibleVDFField, VDFInfo, VDFProof -from chia.types.coin_record import CoinRecord -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.types.header_block import HeaderBlock -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.spend_bundle import SpendBundle -from chia.types.transaction_queue_entry import TransactionQueueEntry -from chia.types.unfinished_block import UnfinishedBlock -from chia.util import cached_bls -from chia.util.bech32m import encode_puzzle_hash -from chia.util.check_fork_next_block import check_fork_next_block -from chia.util.condition_tools import pkm_pairs -from chia.util.config import PEER_DB_PATH_KEY_DEPRECATED, process_config_start_method -from chia.util.db_wrapper import DBWrapper2, create_connection -from chia.util.errors import ConsensusError, Err, ValidationError -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.path import path_from_root -from chia.util.safe_cancel_task import cancel_task_safe -from chia.util.profiler import profile_task -from chia.util.memory_profiler import mem_profile_task -from chia.util.db_synchronous import db_synchronous_on -from chia.util.db_version import lookup_db_version, set_db_version_async +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.wallet_protocol import CoinState, CoinStateUpdate +from flax.server.node_discovery import FullNodePeers +from flax.server.outbound_message import Message, NodeType, make_msg +from flax.server.peer_store_resolver import PeerStoreResolver +from flax.server.server import FlaxServer +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.vdf import CompressibleVDFField, VDFInfo, VDFProof +from flax.types.coin_record import CoinRecord +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.types.header_block import HeaderBlock +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.spend_bundle import SpendBundle +from flax.types.transaction_queue_entry import TransactionQueueEntry +from flax.types.unfinished_block import UnfinishedBlock +from flax.util import cached_bls +from flax.util.bech32m import encode_puzzle_hash +from flax.util.check_fork_next_block import check_fork_next_block +from flax.util.condition_tools import pkm_pairs +from flax.util.config import PEER_DB_PATH_KEY_DEPRECATED, process_config_start_method +from flax.util.db_wrapper import DBWrapper2, create_connection +from flax.util.errors import ConsensusError, Err, ValidationError +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.path import path_from_root +from flax.util.safe_cancel_task import cancel_task_safe +from flax.util.profiler import profile_task +from flax.util.memory_profiler import mem_profile_task +from flax.util.db_synchronous import db_synchronous_on +from flax.util.db_version import lookup_db_version, set_db_version_async # This is the result of calling peak_post_processing, which is then fed into peak_post_processing_2 @@ -94,7 +94,7 @@ class FullNode: initialized: bool root_path: Path config: Dict[str, Any] - _server: Optional[ChiaServer] + _server: Optional[FlaxServer] _shut_down: bool constants: ConsensusConstants pow_creation: Dict[bytes32, asyncio.Event] @@ -142,7 +142,7 @@ class FullNode: _maybe_blockchain_lock_low_priority: Optional[LockClient] @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: # This is a stop gap until the class usage is refactored such the values of # integral attributes are known at creation of the instance. if self._server is None: @@ -333,6 +333,8 @@ async def _start(self) -> None: self.log.info(f"logging SQL commands to {sql_log_path}") db_sync = db_synchronous_on(self.config.get("db_sync", "auto")) + # Never use pragma synchronous=OFF in Flax. + db_sync = "FULL" self.log.info(f"opening blockchain DB: synchronous={db_sync}") self._db_wrapper = await DBWrapper2.create( @@ -356,7 +358,7 @@ async def _start(self) -> None: self.db_wrapper.db_version = 2 self.log.info("blockchain database is empty, configuring as v2") except sqlite3.OperationalError: - # it could be a database created with "chia init", which is + # it could be a database created with "flax init", which is # empty except it has the database_version table pass @@ -490,7 +492,7 @@ async def initialize_weight_proof(self) -> None: if peak is not None: await self.weight_proof_handler.create_sub_epoch_segments() - def set_server(self, server: ChiaServer) -> None: + def set_server(self, server: FlaxServer) -> None: self._server = server dns_servers: List[str] = [] network_name = self.config["selected_network"] @@ -501,9 +503,9 @@ def set_server(self, server: ChiaServer) -> None: default_port = None if "dns_servers" in self.config: dns_servers = self.config["dns_servers"] - elif self.config["port"] == 8444: + elif self.config["port"] == 6888: # If `dns_servers` misses from the `config`, hardcode it if we're running mainnet. - dns_servers.append("dns-introducer.chia.net") + dns_servers.append("dns-introducer.flaxnetwork.org") try: self.full_node_peers = FullNodePeers( self.server, @@ -534,7 +536,7 @@ def _state_changed(self, change: str, change_data: Optional[Dict[str, Any]] = No if self.state_changed_callback is not None: self.state_changed_callback(change, change_data) - async def short_sync_batch(self, peer: ws.WSChiaConnection, start_height: uint32, target_height: uint32) -> bool: + async def short_sync_batch(self, peer: ws.WSFlaxConnection, start_height: uint32, target_height: uint32) -> bool: """ Tries to sync to a chain which is not too far in the future, by downloading batches of blocks. If the first block that we download is not connected to our chain, we return False and do an expensive long sync instead. @@ -617,7 +619,7 @@ async def short_sync_batch(self, peer: ws.WSChiaConnection, start_height: uint32 return True async def short_sync_backtrack( - self, peer: ws.WSChiaConnection, peak_height: uint32, target_height: uint32, target_unf_hash: bytes32 + self, peer: ws.WSFlaxConnection, peak_height: uint32, target_height: uint32, target_unf_hash: bytes32 ) -> bool: """ Performs a backtrack sync, where blocks are downloaded one at a time from newest to oldest. If we do not @@ -673,7 +675,7 @@ async def _refresh_ui_connections(self, sleep_before: float = 0) -> None: await asyncio.sleep(sleep_before) self._state_changed("peer_changed_peak") - async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaConnection) -> None: + async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSFlaxConnection) -> None: """ We have received a notification of a new peak from a peer. This happens either when we have just connected, or when the peer has updated their peak. @@ -750,7 +752,7 @@ async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaCon self._sync_task = asyncio.create_task(self._sync()) async def send_peak_to_timelords( - self, peak_block: Optional[FullBlock] = None, peer: Optional[ws.WSChiaConnection] = None + self, peak_block: Optional[FullBlock] = None, peer: Optional[ws.WSFlaxConnection] = None ) -> None: """ Sends current peak to timelords @@ -825,7 +827,7 @@ async def synced(self) -> bool: else: return True - async def on_connect(self, connection: ws.WSChiaConnection) -> None: + async def on_connect(self, connection: ws.WSFlaxConnection) -> None: """ Whenever we connect to another node / wallet, send them our current heads. Also send heads to farmers and challenges to timelords. @@ -876,7 +878,7 @@ async def on_connect(self, connection: ws.WSChiaConnection) -> None: elif connection.connection_type is NodeType.TIMELORD: await self.send_peak_to_timelords() - def on_disconnect(self, connection: ws.WSChiaConnection) -> None: + def on_disconnect(self, connection: ws.WSFlaxConnection) -> None: self.log.info(f"peer disconnected {connection.get_peer_logging()}") self._state_changed("close_connection") self._state_changed("sync_mode") @@ -884,7 +886,7 @@ def on_disconnect(self, connection: ws.WSChiaConnection) -> None: self.sync_store.peer_disconnected(connection.peer_node_id) self.remove_subscriptions(connection) - def remove_subscriptions(self, peer: ws.WSChiaConnection) -> None: + def remove_subscriptions(self, peer: ws.WSFlaxConnection) -> None: # Remove all ph | coin id subscription for this peer node_id = peer.peer_node_id if node_id in self.peer_puzzle_hash: @@ -1012,13 +1014,13 @@ async def _sync(self) -> None: # TODO: disconnect from peer which gave us the heaviest_peak, if nobody has the peak peer_ids: Set[bytes32] = self.sync_store.get_peers_that_have_peak([heaviest_peak_hash]) - peers_with_peak: List[ws.WSChiaConnection] = [ + peers_with_peak: List[ws.WSFlaxConnection] = [ c for c in self.server.all_connections.values() if c.peer_node_id in peer_ids ] # Request weight proof from a random peer self.log.info(f"Total of {len(peers_with_peak)} peers with peak {heaviest_peak_height}") - weight_proof_peer: ws.WSChiaConnection = random.choice(peers_with_peak) + weight_proof_peer: ws.WSFlaxConnection = random.choice(peers_with_peak) self.log.info( f"Requesting weight proof from peer {weight_proof_peer.peer_host} up to height" f" {heaviest_peak_height}" @@ -1088,17 +1090,17 @@ async def sync_from_fork_point( ) -> None: buffer_size = 4 self.log.info(f"Start syncing from fork point at {fork_point_height} up to {target_peak_sb_height}") - peers_with_peak: List[ws.WSChiaConnection] = self.get_peers_with_peak(peak_hash) + peers_with_peak: List[ws.WSFlaxConnection] = self.get_peers_with_peak(peak_hash) fork_point_height = await check_fork_next_block( self.blockchain, fork_point_height, peers_with_peak, node_next_block_check ) batch_size = self.constants.MAX_BLOCK_COUNT_PER_REQUESTS async def fetch_block_batches( - batch_queue: asyncio.Queue[Optional[Tuple[ws.WSChiaConnection, List[FullBlock]]]] + batch_queue: asyncio.Queue[Optional[Tuple[ws.WSFlaxConnection, List[FullBlock]]]] ) -> None: start_height, end_height = 0, 0 - new_peers_with_peak: List[ws.WSChiaConnection] = peers_with_peak[:] + new_peers_with_peak: List[ws.WSFlaxConnection] = peers_with_peak[:] try: for start_height in range(fork_point_height, target_peak_sb_height, batch_size): end_height = min(target_peak_sb_height, start_height + batch_size) @@ -1130,11 +1132,11 @@ async def fetch_block_batches( await batch_queue.put(None) async def validate_block_batches( - inner_batch_queue: asyncio.Queue[Optional[Tuple[ws.WSChiaConnection, List[FullBlock]]]] + inner_batch_queue: asyncio.Queue[Optional[Tuple[ws.WSFlaxConnection, List[FullBlock]]]] ) -> None: advanced_peak: bool = False while True: - res: Optional[Tuple[ws.WSChiaConnection, List[FullBlock]]] = await inner_batch_queue.get() + res: Optional[Tuple[ws.WSFlaxConnection, List[FullBlock]]] = await inner_batch_queue.get() if res is None: self.log.debug("done fetching blocks") return None @@ -1163,7 +1165,7 @@ async def validate_block_batches( await self.send_peak_to_wallets() self.blockchain.clean_block_record(end_height - self.constants.BLOCKS_CACHE_SIZE) - batch_queue_input: asyncio.Queue[Optional[Tuple[ws.WSChiaConnection, List[FullBlock]]]] = asyncio.Queue( + batch_queue_input: asyncio.Queue[Optional[Tuple[ws.WSFlaxConnection, List[FullBlock]]]] = asyncio.Queue( maxsize=buffer_size ) fetch_task = asyncio.Task(fetch_block_batches(batch_queue_input)) @@ -1186,7 +1188,7 @@ async def send_peak_to_wallets(self) -> None: ) await self.server.send_to_all([msg], NodeType.WALLET) - def get_peers_with_peak(self, peak_hash: bytes32) -> List[ws.WSChiaConnection]: + def get_peers_with_peak(self, peak_hash: bytes32) -> List[ws.WSFlaxConnection]: peer_ids: Set[bytes32] = self.sync_store.get_peers_that_have_peak([peak_hash]) if len(peer_ids) == 0: self.log.warning(f"Not syncing, no peers with header_hash {peak_hash} ") @@ -1229,7 +1231,7 @@ async def update_wallets( for peer, changes in changes_for_peer.items(): if peer not in self.server.all_connections: continue - ws_peer: ws.WSChiaConnection = self.server.all_connections[peer] + ws_peer: ws.WSFlaxConnection = self.server.all_connections[peer] state = CoinStateUpdate( state_change_summary.peak.height, state_change_summary.fork_height, @@ -1242,7 +1244,7 @@ async def update_wallets( async def receive_block_batch( self, all_blocks: List[FullBlock], - peer: ws.WSChiaConnection, + peer: ws.WSFlaxConnection, fork_point: Optional[uint32], wp_summaries: Optional[List[SubEpochSummary]] = None, ) -> Tuple[bool, Optional[StateChangeSummary]]: @@ -1366,7 +1368,7 @@ def has_valid_pool_sig(self, block: Union[UnfinishedBlock, FullBlock]) -> bool: async def signage_point_post_processing( self, request: full_node_protocol.RespondSignagePoint, - peer: ws.WSChiaConnection, + peer: ws.WSFlaxConnection, ip_sub_slot: Optional[EndOfSubSlotBundle], ) -> None: self.log.info( @@ -1426,7 +1428,7 @@ async def peak_post_processing( self, block: FullBlock, state_change_summary: StateChangeSummary, - peer: Optional[ws.WSChiaConnection], + peer: Optional[ws.WSFlaxConnection], ) -> PeakPostProcessingResult: """ Must be called under self.blockchain.lock. This updates the internal state of the full node with the @@ -1532,7 +1534,7 @@ async def peak_post_processing( async def peak_post_processing_2( self, block: FullBlock, - peer: Optional[ws.WSChiaConnection], + peer: Optional[ws.WSFlaxConnection], state_change_summary: StateChangeSummary, ppp_result: PeakPostProcessingResult, ) -> None: @@ -1610,7 +1612,7 @@ async def peak_post_processing_2( async def respond_block( self, respond_block: full_node_protocol.RespondBlock, - peer: Optional[ws.WSChiaConnection] = None, + peer: Optional[ws.WSFlaxConnection] = None, raise_on_disconnected: bool = False, ) -> Optional[Message]: """ @@ -1815,7 +1817,7 @@ async def respond_block( async def respond_unfinished_block( self, respond_unfinished_block: full_node_protocol.RespondUnfinishedBlock, - peer: Optional[ws.WSChiaConnection], + peer: Optional[ws.WSFlaxConnection], farmed_block: bool = False, block_bytes: Optional[bytes] = None, ) -> None: @@ -1968,7 +1970,7 @@ async def respond_unfinished_block( f"Added unfinished_block {block_hash}, not farmed by us," f" SP: {block.reward_chain_block.signage_point_index} farmer response time: " f"{receive_time - self.signage_point_times[block.reward_chain_block.signage_point_index]:0.4f}, " - f"Pool pk {encode_puzzle_hash(block.foliage.foliage_block_data.pool_target.puzzle_hash, 'xch')}, " + f"Pool pk {encode_puzzle_hash(block.foliage.foliage_block_data.pool_target.puzzle_hash, 'xfx')}, " f"validation time: {validation_time:0.4f} seconds, {pre_validation_log}" f"cost: {block.transactions_info.cost if block.transactions_info else 'None'}" f"{percent_full_str}" @@ -2017,7 +2019,7 @@ async def respond_unfinished_block( self._state_changed("unfinished_block") async def new_infusion_point_vdf( - self, request: timelord_protocol.NewInfusionPointVDF, timelord_peer: Optional[ws.WSChiaConnection] = None + self, request: timelord_protocol.NewInfusionPointVDF, timelord_peer: Optional[ws.WSFlaxConnection] = None ) -> Optional[Message]: # Lookup unfinished blocks unfinished_block: Optional[UnfinishedBlock] = self.full_node_store.get_unfinished_block( @@ -2120,7 +2122,7 @@ async def new_infusion_point_vdf( return None async def respond_end_of_sub_slot( - self, request: full_node_protocol.RespondEndOfSubSlot, peer: ws.WSChiaConnection + self, request: full_node_protocol.RespondEndOfSubSlot, peer: ws.WSFlaxConnection ) -> Tuple[Optional[Message], bool]: fetched_ss = self.full_node_store.get_sub_slot(request.end_of_slot_bundle.challenge_chain.get_hash()) @@ -2211,7 +2213,7 @@ async def respond_transaction( self, transaction: SpendBundle, spend_name: bytes32, - peer: Optional[ws.WSChiaConnection] = None, + peer: Optional[ws.WSFlaxConnection] = None, test: bool = False, tx_bytes: Optional[bytes] = None, ) -> Tuple[MempoolInclusionStatus, Optional[Err]]: @@ -2437,7 +2439,7 @@ async def respond_compact_proof_of_time(self, request: timelord_protocol.Respond if self._server is not None: await self.server.send_to_all([msg], NodeType.FULL_NODE) - async def new_compact_vdf(self, request: full_node_protocol.NewCompactVDF, peer: ws.WSChiaConnection) -> None: + async def new_compact_vdf(self, request: full_node_protocol.NewCompactVDF, peer: ws.WSFlaxConnection) -> None: is_fully_compactified = await self.block_store.is_fully_compactified(request.header_hash) if is_fully_compactified is None or is_fully_compactified: return None @@ -2456,7 +2458,7 @@ async def new_compact_vdf(self, request: full_node_protocol.NewCompactVDF, peer: await self.respond_compact_vdf(response, peer) async def request_compact_vdf( - self, request: full_node_protocol.RequestCompactVDF, peer: ws.WSChiaConnection + self, request: full_node_protocol.RequestCompactVDF, peer: ws.WSFlaxConnection ) -> None: header_block = await self.blockchain.get_header_block_by_height( request.height, request.header_hash, tx_filter=False @@ -2502,7 +2504,7 @@ async def request_compact_vdf( await peer.send_message(msg) async def respond_compact_vdf( - self, request: full_node_protocol.RespondCompactVDF, peer: ws.WSChiaConnection + self, request: full_node_protocol.RespondCompactVDF, peer: ws.WSFlaxConnection ) -> None: field_vdf = CompressibleVDFField(int(request.field_vdf)) if not await self._can_accept_compact_proof( @@ -2629,7 +2631,7 @@ async def broadcast_uncompact_blocks( async def node_next_block_check( - peer: ws.WSChiaConnection, potential_peek: uint32, blockchain: BlockchainInterface + peer: ws.WSFlaxConnection, potential_peek: uint32, blockchain: BlockchainInterface ) -> bool: block_response: Optional[Any] = await peer.request_block(full_node_protocol.RequestBlock(potential_peek, True)) diff --git a/chia/full_node/full_node_api.py b/flax/full_node/full_node_api.py similarity index 96% rename from chia/full_node/full_node_api.py rename to flax/full_node/full_node_api.py index 014710608..47f1077d8 100644 --- a/chia/full_node/full_node_api.py +++ b/flax/full_node/full_node_api.py @@ -11,20 +11,20 @@ from blspy import AugSchemeMPL, G2Element, G1Element from chiabip158 import PyBIP158 -import chia.server.ws_connection as ws -from chia.consensus.block_creation import create_unfinished_block -from chia.consensus.block_record import BlockRecord -from chia.consensus.pot_iterations import calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters -from chia.full_node.bundle_tools import best_solution_generator_from_template, simple_solution_generator -from chia.full_node.fee_estimate import FeeEstimate, FeeEstimateGroup -from chia.full_node.full_node import FullNode -from chia.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin -from chia.full_node.signage_point import SignagePoint -from chia.full_node.fee_estimator_interface import FeeEstimatorInterface -from chia.protocols import farmer_protocol, full_node_protocol, introducer_protocol, timelord_protocol, wallet_protocol -from chia.protocols.full_node_protocol import RejectBlock, RejectBlocks -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.wallet_protocol import ( +import flax.server.ws_connection as ws +from flax.consensus.block_creation import create_unfinished_block +from flax.consensus.block_record import BlockRecord +from flax.consensus.pot_iterations import calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters +from flax.full_node.bundle_tools import best_solution_generator_from_template, simple_solution_generator +from flax.full_node.fee_estimate import FeeEstimate, FeeEstimateGroup +from flax.full_node.full_node import FullNode +from flax.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin +from flax.full_node.signage_point import SignagePoint +from flax.full_node.fee_estimator_interface import FeeEstimatorInterface +from flax.protocols import farmer_protocol, full_node_protocol, introducer_protocol, timelord_protocol, wallet_protocol +from flax.protocols.full_node_protocol import RejectBlock, RejectBlocks +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.wallet_protocol import ( PuzzleSolutionResponse, RejectBlockHeaders, RejectHeaderBlocks, @@ -33,30 +33,30 @@ RespondFeeEstimates, RespondSESInfo, ) -from chia.server.server import ChiaServer +from flax.server.server import FlaxServer from concurrent.futures import ThreadPoolExecutor -from chia.types.block_protocol import BlockInfo -from chia.server.outbound_message import Message, make_msg -from chia.types.blockchain_format.coin import Coin, hash_coin_ids -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.coin_record import CoinRecord -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.mempool_item import MempoolItem -from chia.types.peer_info import PeerInfo -from chia.types.transaction_queue_entry import TransactionQueueEntry -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.api_decorators import api_request, peer_required, bytes_required, execute_task, reply_type -from chia.util.full_block_utils import header_block_from_block -from chia.util.generator_tools import get_block_header, tx_removals_and_additions -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.merkle_set import MerkleSet -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.block_protocol import BlockInfo +from flax.server.outbound_message import Message, make_msg +from flax.types.blockchain_format.coin import Coin, hash_coin_ids +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.coin_record import CoinRecord +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.mempool_item import MempoolItem +from flax.types.peer_info import PeerInfo +from flax.types.transaction_queue_entry import TransactionQueueEntry +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.api_decorators import api_request, peer_required, bytes_required, execute_task, reply_type +from flax.util.full_block_utils import header_block_from_block +from flax.util.generator_tools import get_block_header, tx_removals_and_additions +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.merkle_set import MerkleSet +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions class FullNodeAPI: @@ -68,7 +68,7 @@ def __init__(self, full_node: FullNode) -> None: self.executor = ThreadPoolExecutor(max_workers=1) @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: assert self.full_node.server is not None return self.full_node.server @@ -84,7 +84,7 @@ def api_ready(self) -> bool: @api_request @reply_type([ProtocolMessageTypes.respond_peers]) async def request_peers( - self, _request: full_node_protocol.RequestPeers, peer: ws.WSChiaConnection + self, _request: full_node_protocol.RequestPeers, peer: ws.WSFlaxConnection ) -> Optional[Message]: if peer.peer_server_port is None: return None @@ -97,7 +97,7 @@ async def request_peers( @peer_required @api_request async def respond_peers( - self, request: full_node_protocol.RespondPeers, peer: ws.WSChiaConnection + self, request: full_node_protocol.RespondPeers, peer: ws.WSFlaxConnection ) -> Optional[Message]: self.log.debug(f"Received {len(request.peer_list)} peers") if self.full_node.full_node_peers is not None: @@ -107,7 +107,7 @@ async def respond_peers( @peer_required @api_request async def respond_peers_introducer( - self, request: introducer_protocol.RespondPeersIntroducer, peer: ws.WSChiaConnection + self, request: introducer_protocol.RespondPeersIntroducer, peer: ws.WSFlaxConnection ) -> Optional[Message]: self.log.debug(f"Received {len(request.peer_list)} peers from introducer") if self.full_node.full_node_peers is not None: @@ -119,7 +119,7 @@ async def respond_peers_introducer( @execute_task @peer_required @api_request - async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaConnection) -> None: + async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSFlaxConnection) -> None: """ A peer notifies us that they have added a new peak to their blockchain. If we don't have it, we can ask for it. @@ -142,7 +142,7 @@ async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaCon @peer_required @api_request async def new_transaction( - self, transaction: full_node_protocol.NewTransaction, peer: ws.WSChiaConnection + self, transaction: full_node_protocol.NewTransaction, peer: ws.WSFlaxConnection ) -> Optional[Message]: """ A peer notifies us of a new transaction. @@ -245,7 +245,7 @@ async def request_transaction(self, request: full_node_protocol.RequestTransacti async def respond_transaction( self, tx: full_node_protocol.RespondTransaction, - peer: ws.WSChiaConnection, + peer: ws.WSFlaxConnection, tx_bytes: bytes = b"", test: bool = False, ) -> Optional[Message]: @@ -410,7 +410,7 @@ async def respond_blocks(self, request: full_node_protocol.RespondBlocks) -> Non async def respond_block( self, respond_block: full_node_protocol.RespondBlock, - peer: ws.WSChiaConnection, + peer: ws.WSFlaxConnection, ) -> Optional[Message]: """ Receive a full block from a peer full node (or ourselves). @@ -473,7 +473,7 @@ async def request_unfinished_block( async def respond_unfinished_block( self, respond_unfinished_block: full_node_protocol.RespondUnfinishedBlock, - peer: ws.WSChiaConnection, + peer: ws.WSFlaxConnection, respond_unfinished_block_bytes: bytes = b"", ) -> Optional[Message]: if self.full_node.sync_store.get_sync_mode(): @@ -486,7 +486,7 @@ async def respond_unfinished_block( @api_request @peer_required async def new_signage_point_or_end_of_sub_slot( - self, new_sp: full_node_protocol.NewSignagePointOrEndOfSubSlot, peer: ws.WSChiaConnection + self, new_sp: full_node_protocol.NewSignagePointOrEndOfSubSlot, peer: ws.WSFlaxConnection ) -> Optional[Message]: # Ignore if syncing if self.full_node.sync_store.get_sync_mode(): @@ -613,7 +613,7 @@ async def request_signage_point_or_end_of_sub_slot( @peer_required @api_request async def respond_signage_point( - self, request: full_node_protocol.RespondSignagePoint, peer: ws.WSChiaConnection + self, request: full_node_protocol.RespondSignagePoint, peer: ws.WSFlaxConnection ) -> Optional[Message]: if self.full_node.sync_store.get_sync_mode(): return None @@ -669,7 +669,7 @@ async def respond_signage_point( @peer_required @api_request async def respond_end_of_sub_slot( - self, request: full_node_protocol.RespondEndOfSubSlot, peer: ws.WSChiaConnection + self, request: full_node_protocol.RespondEndOfSubSlot, peer: ws.WSFlaxConnection ) -> Optional[Message]: if self.full_node.sync_store.get_sync_mode(): return None @@ -681,7 +681,7 @@ async def respond_end_of_sub_slot( async def request_mempool_transactions( self, request: full_node_protocol.RequestMempoolTransactions, - peer: ws.WSChiaConnection, + peer: ws.WSFlaxConnection, ) -> Optional[Message]: received_filter = PyBIP158(bytearray(request.filter)) @@ -697,7 +697,7 @@ async def request_mempool_transactions( @api_request @peer_required async def declare_proof_of_space( - self, request: farmer_protocol.DeclareProofOfSpace, peer: ws.WSChiaConnection + self, request: farmer_protocol.DeclareProofOfSpace, peer: ws.WSFlaxConnection ) -> Optional[Message]: """ Creates a block body and header, with the proof of space, coinbase, and fee targets provided @@ -987,7 +987,7 @@ def get_pool_sig(_1: PoolTarget, _2: Optional[G1Element]) -> Optional[G2Element] @api_request @peer_required async def signed_values( - self, farmer_request: farmer_protocol.SignedValues, peer: ws.WSChiaConnection + self, farmer_request: farmer_protocol.SignedValues, peer: ws.WSFlaxConnection ) -> Optional[Message]: """ Signature of header hash, by the harvester. This is enough to create an unfinished @@ -1054,7 +1054,7 @@ async def signed_values( @peer_required @api_request async def new_infusion_point_vdf( - self, request: timelord_protocol.NewInfusionPointVDF, peer: ws.WSChiaConnection + self, request: timelord_protocol.NewInfusionPointVDF, peer: ws.WSFlaxConnection ) -> Optional[Message]: if self.full_node.sync_store.get_sync_mode(): return None @@ -1065,7 +1065,7 @@ async def new_infusion_point_vdf( @peer_required @api_request async def new_signage_point_vdf( - self, request: timelord_protocol.NewSignagePointVDF, peer: ws.WSChiaConnection + self, request: timelord_protocol.NewSignagePointVDF, peer: ws.WSFlaxConnection ) -> None: if self.full_node.sync_store.get_sync_mode(): return None @@ -1082,7 +1082,7 @@ async def new_signage_point_vdf( @peer_required @api_request async def new_end_of_sub_slot_vdf( - self, request: timelord_protocol.NewEndOfSubSlotVDF, peer: ws.WSChiaConnection + self, request: timelord_protocol.NewEndOfSubSlotVDF, peer: ws.WSFlaxConnection ) -> Optional[Message]: if self.full_node.sync_store.get_sync_mode(): return None @@ -1436,7 +1436,7 @@ async def respond_compact_proof_of_time(self, request: timelord_protocol.Respond @api_request @bytes_required async def new_compact_vdf( - self, request: full_node_protocol.NewCompactVDF, peer: ws.WSChiaConnection, request_bytes: bytes = b"" + self, request: full_node_protocol.NewCompactVDF, peer: ws.WSFlaxConnection, request_bytes: bytes = b"" ) -> None: if self.full_node.sync_store.get_sync_mode(): return None @@ -1466,7 +1466,7 @@ async def new_compact_vdf( @api_request @reply_type([ProtocolMessageTypes.respond_compact_vdf]) async def request_compact_vdf( - self, request: full_node_protocol.RequestCompactVDF, peer: ws.WSChiaConnection + self, request: full_node_protocol.RequestCompactVDF, peer: ws.WSFlaxConnection ) -> None: if self.full_node.sync_store.get_sync_mode(): return None @@ -1476,7 +1476,7 @@ async def request_compact_vdf( @peer_required @api_request async def respond_compact_vdf( - self, request: full_node_protocol.RespondCompactVDF, peer: ws.WSChiaConnection + self, request: full_node_protocol.RespondCompactVDF, peer: ws.WSFlaxConnection ) -> None: if self.full_node.sync_store.get_sync_mode(): return None @@ -1486,7 +1486,7 @@ async def respond_compact_vdf( @peer_required @api_request async def register_interest_in_puzzle_hash( - self, request: wallet_protocol.RegisterForPhUpdates, peer: ws.WSChiaConnection + self, request: wallet_protocol.RegisterForPhUpdates, peer: ws.WSFlaxConnection ) -> Message: if peer.peer_node_id not in self.full_node.peer_puzzle_hash: self.full_node.peer_puzzle_hash[peer.peer_node_id] = set() @@ -1528,7 +1528,7 @@ async def register_interest_in_puzzle_hash( @peer_required @api_request async def register_interest_in_coin( - self, request: wallet_protocol.RegisterForCoinUpdates, peer: ws.WSChiaConnection + self, request: wallet_protocol.RegisterForCoinUpdates, peer: ws.WSFlaxConnection ) -> Message: if peer.peer_node_id not in self.full_node.peer_coin_ids: self.full_node.peer_coin_ids[peer.peer_node_id] = set() diff --git a/chia/full_node/full_node_store.py b/flax/full_node/full_node_store.py similarity index 96% rename from chia/full_node/full_node_store.py rename to flax/full_node/full_node_store.py index b26b60967..3fda6bf33 100644 --- a/chia/full_node/full_node_store.py +++ b/flax/full_node/full_node_store.py @@ -6,27 +6,27 @@ import time from typing import Dict, List, Optional, Set, Tuple -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.difficulty_adjustment import can_finish_sub_and_full_epoch -from chia.consensus.make_sub_epoch_summary import next_sub_epoch_summary -from chia.consensus.multiprocess_validation import PreValidationResult -from chia.consensus.pot_iterations import calculate_sp_interval_iters -from chia.full_node.signage_point import SignagePoint -from chia.protocols import timelord_protocol -from chia.server.outbound_message import Message -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.blockchain_format.vdf import VDFInfo -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.generator_types import CompressorArg -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.lru_cache import LRUCache -from chia.util.streamable import Streamable, streamable +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.difficulty_adjustment import can_finish_sub_and_full_epoch +from flax.consensus.make_sub_epoch_summary import next_sub_epoch_summary +from flax.consensus.multiprocess_validation import PreValidationResult +from flax.consensus.pot_iterations import calculate_sp_interval_iters +from flax.full_node.signage_point import SignagePoint +from flax.protocols import timelord_protocol +from flax.server.outbound_message import Message +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.vdf import VDFInfo +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.generator_types import CompressorArg +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.lru_cache import LRUCache +from flax.util.streamable import Streamable, streamable log = logging.getLogger(__name__) diff --git a/chia/full_node/generator.py b/flax/full_node/generator.py similarity index 86% rename from chia/full_node/generator.py rename to flax/full_node/generator.py index 2c6300f7b..9a030dbd9 100644 --- a/chia/full_node/generator.py +++ b/flax/full_node/generator.py @@ -1,22 +1,22 @@ import logging from typing import List, Optional, Union, Tuple -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.generator_types import BlockGenerator, GeneratorBlockCacheInterface, CompressorArg -from chia.util.ints import uint32 -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.puzzles.rom_bootstrap_generator import get_generator +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.generator_types import BlockGenerator, GeneratorBlockCacheInterface, CompressorArg +from flax.util.ints import uint32 +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.puzzles.rom_bootstrap_generator import get_generator GENERATOR_MOD = get_generator() -DECOMPRESS_BLOCK = load_clvm_maybe_recompile("block_program_zero.clvm", package_or_requirement="chia.wallet.puzzles") -DECOMPRESS_PUZZLE = load_clvm_maybe_recompile("decompress_puzzle.clvm", package_or_requirement="chia.wallet.puzzles") +DECOMPRESS_BLOCK = load_clvm_maybe_recompile("block_program_zero.clvm", package_or_requirement="flax.wallet.puzzles") +DECOMPRESS_PUZZLE = load_clvm_maybe_recompile("decompress_puzzle.clvm", package_or_requirement="flax.wallet.puzzles") # DECOMPRESS_CSE = load_clvm_maybe_recompile( # "decompress_coin_spend_entry.clvm", -# package_or_requirement="chia.wallet.puzzles", +# package_or_requirement="flax.wallet.puzzles", # ) DECOMPRESS_CSE_WITH_PREFIX = load_clvm_maybe_recompile( - "decompress_coin_spend_entry_with_prefix.clvm", package_or_requirement="chia.wallet.puzzles" + "decompress_coin_spend_entry_with_prefix.clvm", package_or_requirement="flax.wallet.puzzles" ) log = logging.getLogger(__name__) diff --git a/chia/full_node/hint_management.py b/flax/full_node/hint_management.py similarity index 92% rename from chia/full_node/hint_management.py rename to flax/full_node/hint_management.py index 261fb4b53..30cf5daa0 100644 --- a/chia/full_node/hint_management.py +++ b/flax/full_node/hint_management.py @@ -2,10 +2,10 @@ from typing import Dict, List, Optional, Set, Tuple -from chia.consensus.blockchain import StateChangeSummary -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 +from flax.consensus.blockchain import StateChangeSummary +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 def get_hints_and_subscription_coin_ids( diff --git a/chia/full_node/hint_store.py b/flax/full_node/hint_store.py similarity index 95% rename from chia/full_node/hint_store.py rename to flax/full_node/hint_store.py index 27ac5e09d..49dd3c7a4 100644 --- a/chia/full_node/hint_store.py +++ b/flax/full_node/hint_store.py @@ -5,8 +5,8 @@ import typing_extensions -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2 import logging log = logging.getLogger(__name__) diff --git a/chia/full_node/lock_queue.py b/flax/full_node/lock_queue.py similarity index 100% rename from chia/full_node/lock_queue.py rename to flax/full_node/lock_queue.py diff --git a/chia/full_node/mempool.py b/flax/full_node/mempool.py similarity index 90% rename from chia/full_node/mempool.py rename to flax/full_node/mempool.py index 7796ba642..c0d30a92d 100644 --- a/chia/full_node/mempool.py +++ b/flax/full_node/mempool.py @@ -6,15 +6,15 @@ from sortedcontainers import SortedDict -from chia.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator -from chia.full_node.fee_estimation import FeeMempoolInfo -from chia.full_node.fee_estimator_interface import FeeEstimatorInterface -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.clvm_cost import CLVMCost -from chia.types.fee_rate import FeeRate -from chia.types.mempool_item import MempoolItem -from chia.util.ints import uint64 +from flax.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator +from flax.full_node.fee_estimation import FeeMempoolInfo +from flax.full_node.fee_estimator_interface import FeeEstimatorInterface +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.clvm_cost import CLVMCost +from flax.types.fee_rate import FeeRate +from flax.types.mempool_item import MempoolItem +from flax.util.ints import uint64 class Mempool: diff --git a/chia/full_node/mempool_check_conditions.py b/flax/full_node/mempool_check_conditions.py similarity index 80% rename from chia/full_node/mempool_check_conditions.py rename to flax/full_node/mempool_check_conditions.py index 6bca8b445..2792337f6 100644 --- a/chia/full_node/mempool_check_conditions.py +++ b/flax/full_node/mempool_check_conditions.py @@ -1,27 +1,27 @@ import logging from typing import Dict, Optional, Tuple from chia_rs import MEMPOOL_MODE, NO_NEG_DIV, get_puzzle_and_solution_for_coin as get_puzzle_and_solution_for_coin_rust -from chia.types.blockchain_format.coin import Coin - -from chia.consensus.cost_calculator import NPCResult -from chia.types.spend_bundle_conditions import SpendBundleConditions -from chia.full_node.generator import setup_generator_args -from chia.types.coin_record import CoinRecord -from chia.types.generator_types import BlockGenerator -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.errors import Err -from chia.util.ints import uint32, uint64, uint16 -from chia.wallet.puzzles.rom_bootstrap_generator import get_generator -from chia.types.blockchain_format.program import SerializedProgram -from chia.wallet.puzzles.load_clvm import load_serialized_clvm_maybe_recompile -from chia.consensus.default_constants import DEFAULT_CONSTANTS - -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.coin import Coin + +from flax.consensus.cost_calculator import NPCResult +from flax.types.spend_bundle_conditions import SpendBundleConditions +from flax.full_node.generator import setup_generator_args +from flax.types.coin_record import CoinRecord +from flax.types.generator_types import BlockGenerator +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.errors import Err +from flax.util.ints import uint32, uint64, uint16 +from flax.wallet.puzzles.rom_bootstrap_generator import get_generator +from flax.types.blockchain_format.program import SerializedProgram +from flax.wallet.puzzles.load_clvm import load_serialized_clvm_maybe_recompile +from flax.consensus.default_constants import DEFAULT_CONSTANTS + +from flax.types.blockchain_format.program import Program GENERATOR_MOD = get_generator() DESERIALIZE_MOD = load_serialized_clvm_maybe_recompile( - "chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles" + "flaxlisp_deserialisation.clvm", package_or_requirement="flax.wallet.puzzles" ) log = logging.getLogger(__name__) diff --git a/chia/full_node/mempool_manager.py b/flax/full_node/mempool_manager.py similarity index 94% rename from chia/full_node/mempool_manager.py rename to flax/full_node/mempool_manager.py index 3990e87b4..2dfe9dea8 100644 --- a/chia/full_node/mempool_manager.py +++ b/flax/full_node/mempool_manager.py @@ -6,37 +6,37 @@ import time from concurrent.futures.process import ProcessPoolExecutor -from chia.full_node.fee_estimation import FeeMempoolInfo, FeeBlockInfo -from chia.types.clvm_cost import CLVMCost -from chia.types.fee_rate import FeeRate -from chia.util.inline_executor import InlineExecutor +from flax.full_node.fee_estimation import FeeMempoolInfo, FeeBlockInfo +from flax.types.clvm_cost import CLVMCost +from flax.types.fee_rate import FeeRate +from flax.util.inline_executor import InlineExecutor from typing import Dict, List, Optional, Set, Tuple from blspy import GTElement from chiabip158 import PyBIP158 -from chia.util import cached_bls -from chia.consensus.block_record import BlockRecord -from chia.consensus.constants import ConsensusConstants -from chia.consensus.cost_calculator import NPCResult -from chia.full_node.bundle_tools import simple_solution_generator -from chia.full_node.coin_store import CoinStore -from chia.full_node.mempool import Mempool -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.full_node.pending_tx_cache import PendingTxCache -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32, bytes48 -from chia.types.coin_record import CoinRecord -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.mempool_item import MempoolItem -from chia.types.spend_bundle import SpendBundle -from chia.util.cached_bls import LOCAL_CACHE -from chia.util.condition_tools import pkm_pairs -from chia.util.errors import Err, ValidationError -from chia.util.generator_tools import additions_for_npc -from chia.util.ints import uint32, uint64 -from chia.util.lru_cache import LRUCache -from chia.util.setproctitle import getproctitle, setproctitle -from chia.full_node.mempool_check_conditions import mempool_check_time_locks +from flax.util import cached_bls +from flax.consensus.block_record import BlockRecord +from flax.consensus.constants import ConsensusConstants +from flax.consensus.cost_calculator import NPCResult +from flax.full_node.bundle_tools import simple_solution_generator +from flax.full_node.coin_store import CoinStore +from flax.full_node.mempool import Mempool +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.full_node.pending_tx_cache import PendingTxCache +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32, bytes48 +from flax.types.coin_record import CoinRecord +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.mempool_item import MempoolItem +from flax.types.spend_bundle import SpendBundle +from flax.util.cached_bls import LOCAL_CACHE +from flax.util.condition_tools import pkm_pairs +from flax.util.errors import Err, ValidationError +from flax.util.generator_tools import additions_for_npc +from flax.util.ints import uint32, uint64 +from flax.util.lru_cache import LRUCache +from flax.util.setproctitle import getproctitle, setproctitle +from flax.full_node.mempool_check_conditions import mempool_check_time_locks log = logging.getLogger(__name__) @@ -99,7 +99,7 @@ def __init__( self.coin_store = coin_store # The fee per cost must be above this amount to consider the fee "nonzero", and thus able to kick out other - # transactions. This prevents spam. This is equivalent to 0.055 XCH per block, or about 0.00005 XCH for two + # transactions. This prevents spam. This is equivalent to 0.055 XFX per block, or about 0.00005 XFX for two # spends. self.nonzero_fee_minimum_fpc = 5 @@ -215,7 +215,7 @@ def remove_seen(self, bundle_hash: bytes32) -> None: @staticmethod def get_min_fee_increase() -> int: - # 0.00001 XCH + # 0.00001 XFX return 10000000 def can_replace( @@ -472,7 +472,7 @@ async def validate_spend_bundle( log.warning(f"{spend.puzzle_hash.hex()} != {coin_record.coin.puzzle_hash.hex()}") return Err.WRONG_PUZZLE_HASH, None, [] - chialisp_height = ( + flaxlisp_height = ( self.peak.prev_transaction_block_height if not self.peak.is_transaction_block else self.peak.height ) @@ -480,7 +480,7 @@ async def validate_spend_bundle( tl_error: Optional[Err] = mempool_check_time_locks( removal_record_dict, npc_result.conds, - uint32(chialisp_height), + uint32(flaxlisp_height), self.peak.timestamp, ) diff --git a/chia/full_node/pending_tx_cache.py b/flax/full_node/pending_tx_cache.py similarity index 90% rename from chia/full_node/pending_tx_cache.py rename to flax/full_node/pending_tx_cache.py index 1e84fa72e..360e1f21a 100644 --- a/chia/full_node/pending_tx_cache.py +++ b/flax/full_node/pending_tx_cache.py @@ -2,8 +2,8 @@ from typing import Dict -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.mempool_item import MempoolItem +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.mempool_item import MempoolItem class PendingTxCache: diff --git a/chia/full_node/signage_point.py b/flax/full_node/signage_point.py similarity index 71% rename from chia/full_node/signage_point.py rename to flax/full_node/signage_point.py index 31c0789ef..16ad6b683 100644 --- a/chia/full_node/signage_point.py +++ b/flax/full_node/signage_point.py @@ -3,8 +3,8 @@ from dataclasses import dataclass from typing import Optional -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/full_node/sync_store.py b/flax/full_node/sync_store.py similarity index 98% rename from chia/full_node/sync_store.py rename to flax/full_node/sync_store.py index 6fc8fd0ce..afe5f30b7 100644 --- a/chia/full_node/sync_store.py +++ b/flax/full_node/sync_store.py @@ -8,8 +8,8 @@ import typing_extensions -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32, uint128 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32, uint128 log = logging.getLogger(__name__) diff --git a/chia/full_node/weight_proof.py b/flax/full_node/weight_proof.py similarity index 98% rename from chia/full_node/weight_proof.py rename to flax/full_node/weight_proof.py index a0e576c31..cbab8e559 100644 --- a/chia/full_node/weight_proof.py +++ b/flax/full_node/weight_proof.py @@ -9,28 +9,28 @@ import tempfile from typing import Dict, IO, List, Optional, Tuple, Awaitable -from chia.consensus.block_header_validation import validate_finished_header_block -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.deficit import calculate_deficit -from chia.consensus.full_block_to_block_record import header_block_to_sub_block_record -from chia.consensus.pot_iterations import ( +from flax.consensus.block_header_validation import validate_finished_header_block +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.deficit import calculate_deficit +from flax.consensus.full_block_to_block_record import header_block_to_sub_block_record +from flax.consensus.pot_iterations import ( calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters, is_overflow_block, ) -from chia.util.chunks import chunks -from chia.consensus.vdf_info_computation import get_signage_point_vdf_info -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.slots import ChallengeChainSubSlot, RewardChainSubSlot -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.header_block import HeaderBlock -from chia.types.weight_proof import ( +from flax.util.chunks import chunks +from flax.consensus.vdf_info_computation import get_signage_point_vdf_info +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.slots import ChallengeChainSubSlot, RewardChainSubSlot +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.header_block import HeaderBlock +from flax.types.weight_proof import ( SubEpochChallengeSegment, SubEpochData, SubSlotData, @@ -38,16 +38,16 @@ SubEpochSegments, RecentChainData, ) -from chia.util.block_cache import BlockCache -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.setproctitle import getproctitle, setproctitle +from flax.util.block_cache import BlockCache +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.setproctitle import getproctitle, setproctitle log = logging.getLogger(__name__) def _create_shutdown_file() -> IO: - return tempfile.NamedTemporaryFile(prefix="chia_full_node_weight_proof_handler_executor_shutdown_trigger") + return tempfile.NamedTemporaryFile(prefix="flax_full_node_weight_proof_handler_executor_shutdown_trigger") class WeightProofHandler: diff --git a/chia/harvester/__init__.py b/flax/harvester/__init__.py similarity index 100% rename from chia/harvester/__init__.py rename to flax/harvester/__init__.py diff --git a/chia/harvester/harvester.py b/flax/harvester/harvester.py similarity index 91% rename from chia/harvester/harvester.py rename to flax/harvester/harvester.py index c2c93083d..8168e8c6b 100644 --- a/chia/harvester/harvester.py +++ b/flax/harvester/harvester.py @@ -8,11 +8,11 @@ from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Tuple -import chia.server.ws_connection as ws # lgtm [py/import-and-import-from] -from chia.consensus.constants import ConsensusConstants -from chia.plot_sync.sender import Sender -from chia.plotting.manager import PlotManager -from chia.plotting.util import ( +import flax.server.ws_connection as ws # lgtm [py/import-and-import-from] +from flax.consensus.constants import ConsensusConstants +from flax.plot_sync.sender import Sender +from flax.plotting.manager import PlotManager +from flax.plotting.util import ( PlotRefreshEvents, PlotRefreshResult, PlotsRefreshParameter, @@ -21,9 +21,9 @@ remove_plot, remove_plot_directory, ) -from chia.rpc.rpc_server import default_get_connections -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer +from flax.rpc.rpc_server import default_get_connections +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer log = logging.getLogger(__name__) @@ -39,10 +39,10 @@ class Harvester: constants: ConsensusConstants _refresh_lock: asyncio.Lock event_loop: asyncio.events.AbstractEventLoop - _server: Optional[ChiaServer] + _server: Optional[FlaxServer] @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: # This is a stop gap until the class usage is refactored such the values of # integral attributes are known at creation of the instance. if self._server is None: @@ -97,7 +97,7 @@ async def _await_closed(self): def get_connections(self, request_node_type: Optional[NodeType]) -> List[Dict[str, Any]]: return default_get_connections(server=self.server, request_node_type=request_node_type) - async def on_connect(self, connection: ws.WSChiaConnection): + async def on_connect(self, connection: ws.WSFlaxConnection): pass def _set_state_changed_callback(self, callback: Callable): @@ -123,7 +123,7 @@ def _plot_refresh_callback(self, event: PlotRefreshEvents, update_result: PlotRe if event == PlotRefreshEvents.done: self.plot_sync_sender.sync_done(update_result.removed, update_result.duration) - def on_disconnect(self, connection: ws.WSChiaConnection): + def on_disconnect(self, connection: ws.WSFlaxConnection): self.log.info(f"peer disconnected {connection.get_peer_logging()}") self.state_changed("close_connection") self.plot_sync_sender.stop() @@ -178,5 +178,5 @@ async def remove_plot_directory(self, str_path: str) -> bool: self.plot_manager.trigger_refresh() return True - def set_server(self, server: ChiaServer) -> None: + def set_server(self, server: FlaxServer) -> None: self._server = server diff --git a/chia/harvester/harvester_api.py b/flax/harvester/harvester_api.py similarity index 94% rename from chia/harvester/harvester_api.py rename to flax/harvester/harvester_api.py index 9cceb00c7..eac501938 100644 --- a/chia/harvester/harvester_api.py +++ b/flax/harvester/harvester_api.py @@ -7,20 +7,20 @@ from blspy import AugSchemeMPL, G1Element, G2Element -from chia.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters -from chia.harvester.harvester import Harvester -from chia.plotting.util import PlotInfo, parse_plot_info -from chia.protocols import harvester_protocol -from chia.protocols.farmer_protocol import FarmingInfo -from chia.protocols.harvester_protocol import Plot, PlotSyncResponse -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.server.outbound_message import make_msg -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.api_decorators import api_request, peer_required -from chia.util.ints import uint8, uint32, uint64 -from chia.wallet.derive_keys import master_sk_to_local_sk +from flax.consensus.pot_iterations import calculate_iterations_quality, calculate_sp_interval_iters +from flax.harvester.harvester import Harvester +from flax.plotting.util import PlotInfo, parse_plot_info +from flax.protocols import harvester_protocol +from flax.protocols.farmer_protocol import FarmingInfo +from flax.protocols.harvester_protocol import Plot, PlotSyncResponse +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.server.outbound_message import make_msg +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.api_decorators import api_request, peer_required +from flax.util.ints import uint8, uint32, uint64 +from flax.wallet.derive_keys import master_sk_to_local_sk class HarvesterAPI: @@ -32,7 +32,7 @@ def __init__(self, harvester: Harvester): @peer_required @api_request async def harvester_handshake( - self, harvester_handshake: harvester_protocol.HarvesterHandshake, peer: WSChiaConnection + self, harvester_handshake: harvester_protocol.HarvesterHandshake, peer: WSFlaxConnection ): """ Handshake between the harvester and farmer. The harvester receives the pool public keys, @@ -49,7 +49,7 @@ async def harvester_handshake( @peer_required @api_request async def new_signage_point_harvester( - self, new_challenge: harvester_protocol.NewSignagePointHarvester, peer: WSChiaConnection + self, new_challenge: harvester_protocol.NewSignagePointHarvester, peer: WSFlaxConnection ): """ The harvester receives a new signage point from the farmer, this happens at the start of each slot. diff --git a/chia/introducer/__init__.py b/flax/introducer/__init__.py similarity index 100% rename from chia/introducer/__init__.py rename to flax/introducer/__init__.py diff --git a/chia/introducer/introducer.py b/flax/introducer/introducer.py similarity index 88% rename from chia/introducer/introducer.py rename to flax/introducer/introducer.py index 4245a493f..786695fde 100644 --- a/chia/introducer/introducer.py +++ b/flax/introducer/introducer.py @@ -3,17 +3,17 @@ import time from typing import Any, Callable, Dict, List, Optional -from chia.rpc.rpc_server import default_get_connections -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer -from chia.server.introducer_peers import VettedPeer -from chia.server.ws_connection import WSChiaConnection -from chia.util.ints import uint64 +from flax.rpc.rpc_server import default_get_connections +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer +from flax.server.introducer_peers import VettedPeer +from flax.server.ws_connection import WSFlaxConnection +from flax.util.ints import uint64 class Introducer: @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: # This is a stop gap until the class usage is refactored such the values of # integral attributes are known at creation of the instance. if self._server is None: @@ -25,7 +25,7 @@ def __init__(self, max_peers_to_send: int, recent_peer_threshold: int): self.max_peers_to_send = max_peers_to_send self.recent_peer_threshold = recent_peer_threshold self._shut_down = False - self._server: Optional[ChiaServer] = None + self._server: Optional[FlaxServer] = None self.log = logging.getLogger(__name__) async def _start(self): @@ -39,7 +39,7 @@ async def _await_closed(self): pass # await self._vetting_task - async def on_connect(self, peer: WSChiaConnection) -> None: + async def on_connect(self, peer: WSFlaxConnection) -> None: pass def _set_state_changed_callback(self, callback: Callable): @@ -49,7 +49,7 @@ def _set_state_changed_callback(self, callback: Callable): def get_connections(self, request_node_type: Optional[NodeType]) -> List[Dict[str, Any]]: return default_get_connections(server=self.server, request_node_type=request_node_type) - def set_server(self, server: ChiaServer): + def set_server(self, server: FlaxServer): self._server = server async def _vetting_loop(self): diff --git a/chia/introducer/introducer_api.py b/flax/introducer/introducer_api.py similarity index 75% rename from chia/introducer/introducer_api.py rename to flax/introducer/introducer_api.py index 13c171bee..5381332a9 100644 --- a/chia/introducer/introducer_api.py +++ b/flax/introducer/introducer_api.py @@ -2,14 +2,14 @@ from typing import Callable, Optional -from chia.introducer.introducer import Introducer -from chia.protocols.introducer_protocol import RequestPeersIntroducer, RespondPeersIntroducer -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.server.outbound_message import Message, make_msg -from chia.server.ws_connection import WSChiaConnection -from chia.types.peer_info import TimestampedPeerInfo -from chia.util.api_decorators import api_request, peer_required -from chia.util.ints import uint64 +from flax.introducer.introducer import Introducer +from flax.protocols.introducer_protocol import RequestPeersIntroducer, RespondPeersIntroducer +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.server.outbound_message import Message, make_msg +from flax.server.ws_connection import WSFlaxConnection +from flax.types.peer_info import TimestampedPeerInfo +from flax.util.api_decorators import api_request, peer_required +from flax.util.ints import uint64 class IntroducerAPI: @@ -26,7 +26,7 @@ def _set_state_changed_callback(self, callback: Callable): async def request_peers_introducer( self, request: RequestPeersIntroducer, - peer: WSChiaConnection, + peer: WSFlaxConnection, ) -> Optional[Message]: max_peers = self.introducer.max_peers_to_send if self.introducer.server is None or self.introducer.server.introducer_peers is None: diff --git a/chia/plot_sync/__init__.py b/flax/plot_sync/__init__.py similarity index 100% rename from chia/plot_sync/__init__.py rename to flax/plot_sync/__init__.py diff --git a/chia/plot_sync/delta.py b/flax/plot_sync/delta.py similarity index 97% rename from chia/plot_sync/delta.py rename to flax/plot_sync/delta.py index ec0295b7c..bfc83033a 100644 --- a/chia/plot_sync/delta.py +++ b/flax/plot_sync/delta.py @@ -3,7 +3,7 @@ from dataclasses import dataclass, field from typing import Dict, List, Union -from chia.protocols.harvester_protocol import Plot +from flax.protocols.harvester_protocol import Plot @dataclass diff --git a/chia/plot_sync/exceptions.py b/flax/plot_sync/exceptions.py similarity index 91% rename from chia/plot_sync/exceptions.py rename to flax/plot_sync/exceptions.py index dce1bd1fb..62a6d3445 100644 --- a/chia/plot_sync/exceptions.py +++ b/flax/plot_sync/exceptions.py @@ -2,10 +2,10 @@ from typing import Any -from chia.plot_sync.util import ErrorCodes, State -from chia.protocols.harvester_protocol import PlotSyncIdentifier -from chia.server.ws_connection import NodeType -from chia.util.ints import uint64 +from flax.plot_sync.util import ErrorCodes, State +from flax.protocols.harvester_protocol import PlotSyncIdentifier +from flax.server.ws_connection import NodeType +from flax.util.ints import uint64 class PlotSyncException(Exception): diff --git a/chia/plot_sync/receiver.py b/flax/plot_sync/receiver.py similarity index 95% rename from chia/plot_sync/receiver.py rename to flax/plot_sync/receiver.py index f5eea1260..a9cd03d94 100644 --- a/chia/plot_sync/receiver.py +++ b/flax/plot_sync/receiver.py @@ -7,8 +7,8 @@ from typing_extensions import Protocol -from chia.plot_sync.delta import Delta, PathListDelta, PlotListDelta -from chia.plot_sync.exceptions import ( +from flax.plot_sync.delta import Delta, PathListDelta, PlotListDelta +from flax.plot_sync.exceptions import ( InvalidIdentifierError, InvalidLastSyncIdError, PlotAlreadyAvailableError, @@ -16,8 +16,8 @@ PlotSyncException, SyncIdsMatchError, ) -from chia.plot_sync.util import ErrorCodes, State, T_PlotSyncMessage -from chia.protocols.harvester_protocol import ( +from flax.plot_sync.util import ErrorCodes, State, T_PlotSyncMessage +from flax.protocols.harvester_protocol import ( Plot, PlotSyncDone, PlotSyncError, @@ -27,10 +27,10 @@ PlotSyncResponse, PlotSyncStart, ) -from chia.server.ws_connection import ProtocolMessageTypes, WSChiaConnection, make_msg -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import int16, uint32, uint64 -from chia.util.misc import get_list_or_len +from flax.server.ws_connection import ProtocolMessageTypes, WSFlaxConnection, make_msg +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import int16, uint32, uint64 +from flax.util.misc import get_list_or_len log = logging.getLogger(__name__) @@ -72,7 +72,7 @@ def __call__(self, peer_id: bytes32, delta: Optional[Delta]) -> Awaitable[None]: class Receiver: - _connection: WSChiaConnection + _connection: WSFlaxConnection _current_sync: Sync _last_sync: Sync _plots: Dict[str, Plot] @@ -84,7 +84,7 @@ class Receiver: def __init__( self, - connection: WSChiaConnection, + connection: WSFlaxConnection, update_callback: ReceiverUpdateCallback, ) -> None: self._connection = connection @@ -113,7 +113,7 @@ def reset(self) -> None: self._duplicates.clear() self._total_plot_size = 0 - def connection(self) -> WSChiaConnection: + def connection(self) -> WSFlaxConnection: return self._connection def current_sync(self) -> Sync: diff --git a/chia/plot_sync/sender.py b/flax/plot_sync/sender.py similarity index 96% rename from chia/plot_sync/sender.py rename to flax/plot_sync/sender.py index 0cf06c8ca..bf377ce5e 100644 --- a/chia/plot_sync/sender.py +++ b/flax/plot_sync/sender.py @@ -10,11 +10,11 @@ from typing_extensions import Protocol -from chia.plot_sync.exceptions import AlreadyStartedError, InvalidConnectionTypeError -from chia.plot_sync.util import Constants -from chia.plotting.manager import PlotManager -from chia.plotting.util import PlotInfo -from chia.protocols.harvester_protocol import ( +from flax.plot_sync.exceptions import AlreadyStartedError, InvalidConnectionTypeError +from flax.plot_sync.util import Constants +from flax.plotting.manager import PlotManager +from flax.plotting.util import PlotInfo +from flax.protocols.harvester_protocol import ( Plot, PlotSyncDone, PlotSyncIdentifier, @@ -23,9 +23,9 @@ PlotSyncResponse, PlotSyncStart, ) -from chia.server.ws_connection import NodeType, ProtocolMessageTypes, WSChiaConnection, make_msg -from chia.util.generator_tools import list_to_batches -from chia.util.ints import int16, uint32, uint64 +from flax.server.ws_connection import NodeType, ProtocolMessageTypes, WSFlaxConnection, make_msg +from flax.util.generator_tools import list_to_batches +from flax.util.ints import int16, uint32, uint64 log = logging.getLogger(__name__) @@ -88,7 +88,7 @@ def __str__(self) -> str: class Sender: _plot_manager: PlotManager - _connection: Optional[WSChiaConnection] + _connection: Optional[WSFlaxConnection] _sync_id: uint64 _next_message_id: uint64 _messages: List[MessageGenerator[PayloadType]] @@ -132,7 +132,7 @@ async def await_closed(self) -> None: self._reset() self._stop_requested = False - def set_connection(self, connection: WSChiaConnection) -> None: + def set_connection(self, connection: WSFlaxConnection) -> None: assert connection.connection_type is not None if connection.connection_type != NodeType.FARMER: raise InvalidConnectionTypeError(connection.connection_type, NodeType.HARVESTER) diff --git a/chia/plot_sync/util.py b/flax/plot_sync/util.py similarity index 92% rename from chia/plot_sync/util.py rename to flax/plot_sync/util.py index 25221ea2d..3e4eae2ba 100644 --- a/chia/plot_sync/util.py +++ b/flax/plot_sync/util.py @@ -5,7 +5,7 @@ from typing_extensions import Protocol -from chia.protocols.harvester_protocol import PlotSyncIdentifier +from flax.protocols.harvester_protocol import PlotSyncIdentifier class Constants: diff --git a/chia/plotters/__init__.py b/flax/plotters/__init__.py similarity index 100% rename from chia/plotters/__init__.py rename to flax/plotters/__init__.py diff --git a/chia/plotters/bladebit.py b/flax/plotters/bladebit.py similarity index 97% rename from chia/plotters/bladebit.py rename to flax/plotters/bladebit.py index 1662287a6..d8eea4c2e 100644 --- a/chia/plotters/bladebit.py +++ b/flax/plotters/bladebit.py @@ -7,8 +7,8 @@ from pathlib import Path from typing import Any, Dict, Optional, Tuple -from chia.plotting.create_plots import resolve_plot_keys -from chia.plotters.plotters_util import ( +from flax.plotting.create_plots import resolve_plot_keys +from flax.plotters.plotters_util import ( run_plotter, run_command, reset_loop_policy_for_windows, @@ -204,7 +204,7 @@ def get_bladebit_install_info(plotters_root_path: Path) -> Optional[Dict[str, An } -def plot_bladebit(args, chia_root_path, root_path): +def plot_bladebit(args, flax_root_path, root_path): (found, version_or_exception) = get_bladebit_version(root_path) if found is None: print(f"Error: {version_or_exception}") @@ -246,7 +246,7 @@ def plot_bladebit(args, chia_root_path, root_path): None, None if args.pool_key == b"" else args.pool_key.hex(), None if args.contract == "" else args.contract, - chia_root_path, + flax_root_path, log, args.connect_to_daemon, ) @@ -320,7 +320,7 @@ def plot_bladebit(args, chia_root_path, root_path): try: progress = progress_bladebit1 if version == 1 else progress_bladebit2 - asyncio.run(run_plotter(chia_root_path, args.plotter, call_args, progress)) + asyncio.run(run_plotter(flax_root_path, args.plotter, call_args, progress)) except Exception as e: print(f"Exception while plotting: {e} {type(e)}") print(f"Traceback: {traceback.format_exc()}") diff --git a/chia/plotters/chiapos.py b/flax/plotters/chiapos.py similarity index 82% rename from chia/plotters/chiapos.py rename to flax/plotters/chiapos.py index 7c1fce1be..1ce66736e 100644 --- a/chia/plotters/chiapos.py +++ b/flax/plotters/chiapos.py @@ -1,22 +1,22 @@ """ -NOTE: This contains duplicate code from `chia.cmds.plots`. -After `chia plots create` becomes obsolete, consider removing it from there. +NOTE: This contains duplicate code from `flax.cmds.plots`. +After `flax plots create` becomes obsolete, consider removing it from there. """ import asyncio import logging import pkg_resources -from chia.plotting.create_plots import create_plots, resolve_plot_keys +from flax.plotting.create_plots import create_plots, resolve_plot_keys from pathlib import Path from typing import Any, Dict, Optional -from chia.plotting.util import add_plot_directory, validate_plot_size +from flax.plotting.util import add_plot_directory, validate_plot_size log = logging.getLogger(__name__) def get_chiapos_install_info() -> Optional[Dict[str, Any]]: chiapos_version: str = pkg_resources.get_distribution("chiapos").version - return {"display_name": "Chia Proof of Space", "version": chiapos_version, "installed": True} + return {"display_name": "Flax Proof of Space", "version": chiapos_version, "installed": True} class Params: @@ -35,7 +35,7 @@ def __init__(self, args): self.nobitfield = args.nobitfield -def plot_chia(args, root_path): +def plot_flax(args, root_path): try: validate_plot_size(root_path, args.size, args.override) except ValueError as e: diff --git a/chia/plotters/madmax.py b/flax/plotters/madmax.py similarity index 92% rename from chia/plotters/madmax.py rename to flax/plotters/madmax.py index 525f4cc3d..59a2e5948 100644 --- a/chia/plotters/madmax.py +++ b/flax/plotters/madmax.py @@ -6,8 +6,8 @@ from pathlib import Path from typing import Any, Dict, Optional -from chia.plotting.create_plots import resolve_plot_keys -from chia.plotters.plotters_util import ( +from flax.plotting.create_plots import resolve_plot_keys +from flax.plotters.plotters_util import ( run_plotter, run_command, reset_loop_policy_for_windows, @@ -36,9 +36,9 @@ def get_madmax_exec_venv_path(ksize: int = 32) -> Optional[Path]: venv_bin_path = get_venv_bin() if not venv_bin_path: return None - madmax_exec = "chia_plot" + madmax_exec = "flax_plot" if ksize > 32: - madmax_exec += "_k34" # Use the chia_plot_k34 executable for k-sizes > 32 + madmax_exec += "_k34" # Use the flax_plot_k34 executable for k-sizes > 32 if sys.platform in ["win32", "cygwin"]: madmax_exec += ".exe" return venv_bin_path / madmax_exec @@ -46,9 +46,9 @@ def get_madmax_exec_venv_path(ksize: int = 32) -> Optional[Path]: def get_madmax_exec_src_path(plotters_root_path: Path, ksize: int = 32) -> Path: madmax_src_dir = get_madmax_src_path(plotters_root_path) / "build" - madmax_exec = "chia_plot" + madmax_exec = "flax_plot" if ksize > 32: - madmax_exec += "_k34" # Use the chia_plot_k34 executable for k-sizes > 32 + madmax_exec += "_k34" # Use the flax_plot_k34 executable for k-sizes > 32 if sys.platform in ["win32", "cygwin"]: madmax_exec += ".exe" return madmax_src_dir / madmax_exec @@ -56,9 +56,9 @@ def get_madmax_exec_src_path(plotters_root_path: Path, ksize: int = 32) -> Path: def get_madmax_exec_package_path(ksize: int = 32) -> Path: madmax_dir: Path = get_madmax_package_path() - madmax_exec: str = "chia_plot" + madmax_exec: str = "flax_plot" if ksize > 32: - madmax_exec += "_k34" # Use the chia_plot_k34 executable for k-sizes > 32 + madmax_exec += "_k34" # Use the flax_plot_k34 executable for k-sizes > 32 if sys.platform in ["win32", "cygwin"]: madmax_exec += ".exe" return madmax_dir / madmax_exec @@ -154,7 +154,7 @@ def dir_with_trailing_slash(dir: str) -> str: return dir if dir[-1] == os.path.sep else dir + os.path.sep -def plot_madmax(args, chia_root_path: Path, plotters_root_path: Path): +def plot_madmax(args, flax_root_path: Path, plotters_root_path: Path): if sys.platform != "win32" and sys.platform != "cygwin": import resource @@ -175,7 +175,7 @@ def plot_madmax(args, chia_root_path: Path, plotters_root_path: Path): None, None if args.pool_key == b"" else args.pool_key.hex(), None if args.contract == "" else args.contract, - chia_root_path, + flax_root_path, log, args.connect_to_daemon, ) @@ -216,7 +216,7 @@ def plot_madmax(args, chia_root_path: Path, plotters_root_path: Path): call_args.append("-k") call_args.append(str(args.size)) try: - asyncio.run(run_plotter(chia_root_path, args.plotter, call_args, progress)) + asyncio.run(run_plotter(flax_root_path, args.plotter, call_args, progress)) except Exception as e: print(f"Exception while plotting: {type(e)} {e}") print(f"Traceback: {traceback.format_exc()}") diff --git a/chia/plotters/plotters.py b/flax/plotters/plotters.py similarity index 94% rename from chia/plotters/plotters.py rename to flax/plotters/plotters.py index 7ddcda765..2f237e249 100644 --- a/chia/plotters/plotters.py +++ b/flax/plotters/plotters.py @@ -2,9 +2,9 @@ import binascii import os from enum import Enum -from chia.plotters.bladebit import get_bladebit_install_info, plot_bladebit -from chia.plotters.chiapos import get_chiapos_install_info, plot_chia -from chia.plotters.madmax import get_madmax_install_info, plot_madmax +from flax.plotters.bladebit import get_bladebit_install_info, plot_bladebit +from flax.plotters.chiapos import get_chiapos_install_info, plot_flax +from flax.plotters.madmax import get_madmax_install_info, plot_madmax from pathlib import Path from typing import Any, Dict, Optional @@ -48,7 +48,7 @@ class Options(Enum): BLADEBIT_NO_T2_DIRECT = 36 -chia_plotter_options = [ +flax_plotter_options = [ Options.TMP_DIR, Options.TMP_DIR2, Options.K, @@ -415,8 +415,8 @@ def build_parser(subparsers, root_path, option_list, name, plotter_desc): def call_plotters(root_path: Path, args): - # Add `plotters` section in CHIA_ROOT. - chia_root_path = root_path + # Add `plotters` section in FLAX_ROOT. + flax_root_path = root_path root_path = get_plotters_root_path(root_path) if not root_path.is_dir(): if os.path.exists(root_path): @@ -426,22 +426,22 @@ def call_plotters(root_path: Path, args): print(f"Exception deleting old root path: {type(e)} {e}.") if not os.path.exists(root_path): - print(f"Creating plotters folder within CHIA_ROOT: {root_path}") + print(f"Creating plotters folder within FLAX_ROOT: {root_path}") try: os.mkdir(root_path) except Exception as e: print(f"Cannot create plotters root path {root_path} {type(e)} {e}.") - plotters = argparse.ArgumentParser("chia plotters", description="Available options.") + plotters = argparse.ArgumentParser("flax plotters", description="Available options.") subparsers = plotters.add_subparsers(help="Available options", dest="plotter") - build_parser(subparsers, root_path, chia_plotter_options, "chiapos", "Create a plot with the default chia plotter") + build_parser(subparsers, root_path, flax_plotter_options, "chiapos", "Create a plot with the default flax plotter") build_parser(subparsers, root_path, madmax_plotter_options, "madmax", "Create a plot with madMAx") build_parser(subparsers, root_path, bladebit_plotter_options, "bladebit", "Create a plot with bladebit") build_parser(subparsers, root_path, bladebit2_plotter_options, "bladebit2", "Create a plot with bladebit2") deprecation_warning = ( - "[DEPRECATED] 'chia plotters install' is no longer available. Use install-plotter.sh/ps1 instead." + "[DEPRECATED] 'flax plotters install' is no longer available. Use install-plotter.sh/ps1 instead." ) install_parser = subparsers.add_parser("install", help=deprecation_warning) install_parser.add_argument("install_plotter", type=str, nargs="*") @@ -453,13 +453,13 @@ def call_plotters(root_path: Path, args): if args.plotter is None: plotters.print_help() elif args.plotter == "chiapos": - plot_chia(args, chia_root_path) + plot_flax(args, flax_root_path) elif args.plotter == "madmax": - plot_madmax(args, chia_root_path, root_path) + plot_madmax(args, flax_root_path, root_path) elif args.plotter.startswith("bladebit"): - plot_bladebit(args, chia_root_path, root_path) + plot_bladebit(args, flax_root_path, root_path) elif args.plotter == "version": - show_plotters_version(chia_root_path) + show_plotters_version(flax_root_path) elif args.plotter == "install": print(deprecation_warning) diff --git a/chia/plotters/plotters_util.py b/flax/plotters/plotters_util.py similarity index 95% rename from chia/plotters/plotters_util.py rename to flax/plotters/plotters_util.py index fc12fd294..397aa3575 100644 --- a/chia/plotters/plotters_util.py +++ b/flax/plotters/plotters_util.py @@ -11,8 +11,8 @@ from pathlib import Path from typing import Iterator, Optional, TextIO -from chia.cmds.init_funcs import chia_full_version_str -from chia.util.config import lock_and_load_config +from flax.cmds.init_funcs import flax_full_version_str +from flax.util.config import lock_and_load_config @contextlib.contextmanager @@ -21,7 +21,7 @@ def get_optional_beta_plot_log_file(root_path: Path, plotter: str) -> Iterator[O with lock_and_load_config(root_path, "config.yaml") as config: if config.get("beta", {}).get("enabled", False): file_name = f"{plotter}_{datetime.now().strftime('%m_%d_%Y__%H_%M_%S')}.log" - beta_log_path = Path(config["beta"]["path"]) / chia_full_version_str() / "plotting" / file_name + beta_log_path = Path(config["beta"]["path"]) / flax_full_version_str() / "plotting" / file_name beta_log_path.parent.mkdir(parents=True, exist_ok=True) if beta_log_path is not None: with open(beta_log_path, "w") as file: diff --git a/chia/plotting/__init__.py b/flax/plotting/__init__.py similarity index 100% rename from chia/plotting/__init__.py rename to flax/plotting/__init__.py diff --git a/chia/plotting/cache.py b/flax/plotting/cache.py similarity index 92% rename from chia/plotting/cache.py rename to flax/plotting/cache.py index df5046c41..44ab78786 100644 --- a/chia/plotting/cache.py +++ b/flax/plotting/cache.py @@ -11,13 +11,13 @@ from blspy import G1Element from chiapos import DiskProver -from chia.plotting.util import parse_plot_info -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint16, uint64 -from chia.util.misc import VersionedBlob -from chia.util.streamable import Streamable, streamable -from chia.wallet.derive_keys import master_sk_to_local_sk +from flax.plotting.util import parse_plot_info +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint16, uint64 +from flax.util.misc import VersionedBlob +from flax.util.streamable import Streamable, streamable +from flax.wallet.derive_keys import master_sk_to_local_sk log = logging.getLogger(__name__) @@ -149,8 +149,8 @@ def load(self) -> None: ) # TODO, drop the below entry dropping after few versions or whenever we force a cache recreation. # it's here to filter invalid cache entries coming from bladebit RAM plotting. - # Related: - https://github.com/Chia-Network/chia-blockchain/issues/13084 - # - https://github.com/Chia-Network/chiapos/pull/337 + # Related: - https://github.com/Flax-Network/flax-blockchain/issues/13084 + # - https://github.com/Flax-Network/chiapos/pull/337 k = new_entry.prover.get_size() if k not in estimated_c2_sizes: estimated_c2_sizes[k] = ceil(2**k / 100_000_000) * ceil(k / 8) @@ -159,7 +159,7 @@ def load(self) -> None: # Estimated C2 size + memo size + 2000 (static data + path) # static data: version(2) + table pointers (<=96) + id(32) + k(1) => ~130 # path: up to ~1870, all above will lead to false positive. - # See https://github.com/Chia-Network/chiapos/blob/3ee062b86315823dd775453ad320b8be892c7df3/src/prover_disk.hpp#L282-L287 # noqa: E501 + # See https://github.com/Flax-Network/chiapos/blob/3ee062b86315823dd775453ad320b8be892c7df3/src/prover_disk.hpp#L282-L287 # noqa: E501 if prover_size > (estimated_c2_sizes[k] + memo_size + 2000): log.warning( "Suspicious cache entry dropped. Recommended: stop the harvester, remove " diff --git a/chia/plotting/check_plots.py b/flax/plotting/check_plots.py similarity index 96% rename from chia/plotting/check_plots.py rename to flax/plotting/check_plots.py index e2b7cef35..74ac62243 100644 --- a/chia/plotting/check_plots.py +++ b/flax/plotting/check_plots.py @@ -9,8 +9,8 @@ from blspy import G1Element from chiapos import Verifier -from chia.plotting.manager import PlotManager -from chia.plotting.util import ( +from flax.plotting.manager import PlotManager +from flax.plotting.util import ( PlotRefreshEvents, PlotRefreshResult, PlotsRefreshParameter, @@ -18,11 +18,11 @@ get_plot_filenames, parse_plot_info, ) -from chia.util.bech32m import encode_puzzle_hash -from chia.util.config import load_config -from chia.util.hash import std_hash -from chia.util.keychain import Keychain -from chia.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_local_sk +from flax.util.bech32m import encode_puzzle_hash +from flax.util.config import load_config +from flax.util.hash import std_hash +from flax.util.keychain import Keychain +from flax.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_local_sk log = logging.getLogger(__name__) @@ -196,7 +196,7 @@ def check_plots(root_path, num, challenge_start, grep_string, list_duplicates, d log.warning( f"There are {len(plot_manager.no_key_filenames)} plots with a farmer or pool public key that " f"is not on this machine. The farmer private key must be in the keychain in order to " - f"farm them, use 'chia keys' to transfer keys. The pool public keys must be in the config.yaml" + f"farm them, use 'flax keys' to transfer keys. The pool public keys must be in the config.yaml" ) if debug_show_memo: diff --git a/chia/plotting/create_plots.py b/flax/plotting/create_plots.py similarity index 94% rename from chia/plotting/create_plots.py rename to flax/plotting/create_plots.py index 4e0de3287..07513e161 100644 --- a/chia/plotting/create_plots.py +++ b/flax/plotting/create_plots.py @@ -9,13 +9,13 @@ from blspy import AugSchemeMPL, G1Element, PrivateKey from chiapos import DiskPlotter -from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain -from chia.plotting.util import stream_plot_info_ph, stream_plot_info_pk -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.bech32m import decode_puzzle_hash -from chia.util.keychain import Keychain -from chia.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_local_sk, master_sk_to_pool_sk +from flax.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain +from flax.plotting.util import stream_plot_info_ph, stream_plot_info_pk +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.bech32m import decode_puzzle_hash +from flax.util.keychain import Keychain +from flax.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_local_sk, master_sk_to_pool_sk log = logging.getLogger(__name__) @@ -114,7 +114,7 @@ async def get_farmer_public_key(self, keychain_proxy: Optional[KeychainProxy] = sk: Optional[PrivateKey] = await self.get_sk(keychain_proxy) if sk is None: raise RuntimeError( - "No keys, please run 'chia keys add', 'chia keys generate' or provide a public key with -f" + "No keys, please run 'flax keys add', 'flax keys generate' or provide a public key with -f" ) return master_sk_to_farmer_sk(sk).get_g1() @@ -122,7 +122,7 @@ async def get_pool_public_key(self, keychain_proxy: Optional[KeychainProxy] = No sk: Optional[PrivateKey] = await self.get_sk(keychain_proxy) if sk is None: raise RuntimeError( - "No keys, please run 'chia keys add', 'chia keys generate' or provide a public key with -p" + "No keys, please run 'flax keys add', 'flax keys generate' or provide a public key with -p" ) return master_sk_to_pool_sk(sk).get_g1() diff --git a/chia/plotting/manager.py b/flax/plotting/manager.py similarity index 98% rename from chia/plotting/manager.py rename to flax/plotting/manager.py index 7620852be..2161f5f07 100644 --- a/chia/plotting/manager.py +++ b/flax/plotting/manager.py @@ -11,10 +11,10 @@ from blspy import G1Element from chiapos import DiskProver -from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR, _expected_plot_size -from chia.plotting.cache import Cache, CacheEntry -from chia.plotting.util import PlotInfo, PlotRefreshEvents, PlotRefreshResult, PlotsRefreshParameter, get_plot_filenames -from chia.util.generator_tools import list_to_batches +from flax.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR, _expected_plot_size +from flax.plotting.cache import Cache, CacheEntry +from flax.plotting.util import PlotInfo, PlotRefreshEvents, PlotRefreshResult, PlotsRefreshParameter, get_plot_filenames +from flax.util.generator_tools import list_to_batches log = logging.getLogger(__name__) diff --git a/chia/plotting/util.py b/flax/plotting/util.py similarity index 97% rename from chia/plotting/util.py rename to flax/plotting/util.py index 237c898a5..90c272ab9 100644 --- a/chia/plotting/util.py +++ b/flax/plotting/util.py @@ -9,10 +9,10 @@ from blspy import G1Element, PrivateKey from chiapos import DiskProver -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.config import load_config, lock_and_load_config, save_config -from chia.util.ints import uint32 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.config import load_config, lock_and_load_config, save_config +from flax.util.ints import uint32 +from flax.util.streamable import Streamable, streamable log = logging.getLogger(__name__) diff --git a/chia/pools/__init__.py b/flax/pools/__init__.py similarity index 100% rename from chia/pools/__init__.py rename to flax/pools/__init__.py diff --git a/chia/pools/pool_config.py b/flax/pools/pool_config.py similarity index 94% rename from chia/pools/pool_config.py rename to flax/pools/pool_config.py index 48477e32e..36d92ec2b 100644 --- a/chia/pools/pool_config.py +++ b/flax/pools/pool_config.py @@ -7,10 +7,10 @@ from blspy import G1Element -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import load_config, lock_and_load_config, save_config -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import load_config, lock_and_load_config, save_config +from flax.util.streamable import Streamable, streamable """ Config example diff --git a/chia/pools/pool_puzzles.py b/flax/pools/pool_puzzles.py similarity index 96% rename from chia/pools/pool_puzzles.py rename to flax/pools/pool_puzzles.py index 6e1532168..4a90c5bc3 100644 --- a/chia/pools/pool_puzzles.py +++ b/flax/pools/pool_puzzles.py @@ -3,20 +3,20 @@ from blspy import G1Element from clvm.casts import int_from_bytes, int_to_bytes -from chia.clvm.singleton import SINGLETON_LAUNCHER -from chia.consensus.block_rewards import calculate_pool_reward -from chia.consensus.coinbase import pool_parent_id -from chia.pools.pool_wallet_info import PoolState, LEAVING_POOL, SELF_POOLING +from flax.clvm.singleton import SINGLETON_LAUNCHER +from flax.consensus.block_rewards import calculate_pool_reward +from flax.consensus.coinbase import pool_parent_id +from flax.pools.pool_wallet_info import PoolState, LEAVING_POOL, SELF_POOLING -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.puzzles.singleton_top_layer import puzzle_for_singleton +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.puzzles.singleton_top_layer import puzzle_for_singleton -from chia.util.ints import uint32, uint64 +from flax.util.ints import uint32, uint64 log = logging.getLogger(__name__) # "Full" is the outer singleton, with the inner puzzle filled in @@ -388,7 +388,7 @@ def solution_to_pool_state(full_spend: CoinSpend) -> Optional[PoolState]: if inner_solution.rest().first().as_int() != 0: return None - # This is referred to as p1 in the chialisp code + # This is referred to as p1 in the flaxlisp code # spend_type is absorbing money if p1 is a cons box, spend_type is escape if p1 is an atom # TODO: The comment above, and in the CLVM, seems wrong extra_data = inner_solution.first() diff --git a/chia/pools/pool_wallet.py b/flax/pools/pool_wallet.py similarity index 97% rename from chia/pools/pool_wallet.py rename to flax/pools/pool_wallet.py index a34acd3ad..1b2262a7c 100644 --- a/chia/pools/pool_wallet.py +++ b/flax/pools/pool_wallet.py @@ -8,8 +8,8 @@ from blspy import PrivateKey, G2Element, G1Element -from chia.pools.pool_config import PoolWalletConfig, load_pool_config, update_pool_config -from chia.pools.pool_wallet_info import ( +from flax.pools.pool_config import PoolWalletConfig, load_pool_config, update_pool_config +from flax.pools.pool_wallet_info import ( PoolWalletInfo, PoolSingletonState, PoolState, @@ -18,18 +18,18 @@ LEAVING_POOL, create_pool_state, ) -from chia.protocols.pool_protocol import POOL_PROTOCOL_VERSION - -from chia.server.ws_connection import WSChiaConnection -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.coin_record import CoinRecord -from chia.types.coin_spend import CoinSpend -from chia.types.spend_bundle import SpendBundle - -from chia.pools.pool_puzzles import ( +from flax.protocols.pool_protocol import POOL_PROTOCOL_VERSION + +from flax.server.ws_connection import WSFlaxConnection +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.coin_record import CoinRecord +from flax.types.coin_spend import CoinSpend +from flax.types.spend_bundle import SpendBundle + +from flax.pools.pool_puzzles import ( create_waiting_room_inner_puzzle, create_full_puzzle, SINGLETON_LAUNCHER, @@ -47,18 +47,18 @@ get_delayed_puz_info_from_launcher_spend, ) -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.wallet.derive_keys import ( +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.wallet.derive_keys import ( find_owner_sk, ) -from chia.wallet.sign_coin_spends import sign_coin_spends -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.sign_coin_spends import sign_coin_spends +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_info import WalletInfo -from chia.wallet.util.transaction_type import TransactionType +from flax.wallet.wallet_info import WalletInfo +from flax.wallet.util.transaction_type import TransactionType @final @@ -419,7 +419,7 @@ async def create_new_pool_wallet_transaction( ) -> Tuple[TransactionRecord, bytes32, bytes32]: """ A "plot NFT", or pool wallet, represents the idea of a set of plots that all pay to - the same pooling puzzle. This puzzle is a `chia singleton` that is + the same pooling puzzle. This puzzle is a `flax singleton` that is parameterized with a public key controlled by the user's wallet (a `smart coin`). It contains an inner puzzle that can switch between paying block rewards to a pool, or to a user's own wallet. @@ -982,7 +982,7 @@ async def get_pending_change_balance(self) -> uint64: async def get_max_send_amount(self, records: Optional[Set[WalletCoinRecord]] = None) -> uint128: return uint128(0) - async def coin_added(self, coin: Coin, height: uint32, peer: WSChiaConnection) -> None: + async def coin_added(self, coin: Coin, height: uint32, peer: WSFlaxConnection) -> None: pass async def select_coins( @@ -1002,6 +1002,6 @@ def puzzle_hash_for_pk(self, pubkey: G1Element) -> bytes32: if TYPE_CHECKING: - from chia.wallet.wallet_protocol import WalletProtocol + from flax.wallet.wallet_protocol import WalletProtocol _dummy: WalletProtocol = cast(PoolWallet, None) diff --git a/chia/pools/pool_wallet_info.py b/flax/pools/pool_wallet_info.py similarity index 91% rename from chia/pools/pool_wallet_info.py rename to flax/pools/pool_wallet_info.py index 3fef25095..7820b9574 100644 --- a/chia/pools/pool_wallet_info.py +++ b/flax/pools/pool_wallet_info.py @@ -4,13 +4,13 @@ from blspy import G1Element -from chia.protocols.pool_protocol import POOL_PROTOCOL_VERSION -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint32, uint8 -from chia.util.streamable import streamable, Streamable +from flax.protocols.pool_protocol import POOL_PROTOCOL_VERSION +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint32, uint8 +from flax.util.streamable import streamable, Streamable class PoolSingletonState(IntEnum): diff --git a/chia/protocols/__init__.py b/flax/protocols/__init__.py similarity index 100% rename from chia/protocols/__init__.py rename to flax/protocols/__init__.py diff --git a/chia/protocols/farmer_protocol.py b/flax/protocols/farmer_protocol.py similarity index 84% rename from chia/protocols/farmer_protocol.py rename to flax/protocols/farmer_protocol.py index 5bd401e3a..e602ef751 100644 --- a/chia/protocols/farmer_protocol.py +++ b/flax/protocols/farmer_protocol.py @@ -5,11 +5,11 @@ from blspy import G2Element -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint32, uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint32, uint64 +from flax.util.streamable import Streamable, streamable """ Protocol between farmer and full node. diff --git a/chia/protocols/full_node_protocol.py b/flax/protocols/full_node_protocol.py similarity index 87% rename from chia/protocols/full_node_protocol.py rename to flax/protocols/full_node_protocol.py index c9baf051f..626f049c7 100644 --- a/chia/protocols/full_node_protocol.py +++ b/flax/protocols/full_node_protocol.py @@ -3,16 +3,16 @@ from dataclasses import dataclass from typing import List, Optional -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.peer_info import TimestampedPeerInfo -from chia.types.spend_bundle import SpendBundle -from chia.types.unfinished_block import UnfinishedBlock -from chia.types.weight_proof import WeightProof -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.peer_info import TimestampedPeerInfo +from flax.types.spend_bundle import SpendBundle +from flax.types.unfinished_block import UnfinishedBlock +from flax.types.weight_proof import WeightProof +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.streamable import Streamable, streamable """ Protocol between full nodes. diff --git a/chia/protocols/harvester_protocol.py b/flax/protocols/harvester_protocol.py similarity index 94% rename from chia/protocols/harvester_protocol.py rename to flax/protocols/harvester_protocol.py index e130839c1..2b04f6355 100644 --- a/chia/protocols/harvester_protocol.py +++ b/flax/protocols/harvester_protocol.py @@ -5,10 +5,10 @@ from blspy import G1Element, G2Element -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import int16, uint8, uint32, uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import int16, uint8, uint32, uint64 +from flax.util.streamable import Streamable, streamable """ Protocol between harvester and farmer. diff --git a/chia/protocols/introducer_protocol.py b/flax/protocols/introducer_protocol.py similarity index 81% rename from chia/protocols/introducer_protocol.py rename to flax/protocols/introducer_protocol.py index 2247bcb24..56ca1f699 100644 --- a/chia/protocols/introducer_protocol.py +++ b/flax/protocols/introducer_protocol.py @@ -3,8 +3,8 @@ from dataclasses import dataclass from typing import List -from chia.types.peer_info import TimestampedPeerInfo -from chia.util.streamable import Streamable, streamable +from flax.types.peer_info import TimestampedPeerInfo +from flax.util.streamable import Streamable, streamable """ Protocol to introducer diff --git a/chia/protocols/pool_protocol.py b/flax/protocols/pool_protocol.py similarity index 94% rename from chia/protocols/pool_protocol.py rename to flax/protocols/pool_protocol.py index b47cb123c..a46c8024b 100644 --- a/chia/protocols/pool_protocol.py +++ b/flax/protocols/pool_protocol.py @@ -5,10 +5,10 @@ from blspy import G1Element, G2Element -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint16, uint32, uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint16, uint32, uint64 +from flax.util.streamable import Streamable, streamable POOL_PROTOCOL_VERSION = uint8(1) diff --git a/chia/protocols/protocol_message_types.py b/flax/protocols/protocol_message_types.py similarity index 100% rename from chia/protocols/protocol_message_types.py rename to flax/protocols/protocol_message_types.py diff --git a/chia/protocols/protocol_state_machine.py b/flax/protocols/protocol_state_machine.py similarity index 96% rename from chia/protocols/protocol_state_machine.py rename to flax/protocols/protocol_state_machine.py index cc559f13c..e021ac6a5 100644 --- a/chia/protocols/protocol_state_machine.py +++ b/flax/protocols/protocol_state_machine.py @@ -1,4 +1,4 @@ -from chia.protocols.protocol_message_types import ProtocolMessageTypes as pmt, ProtocolMessageTypes +from flax.protocols.protocol_message_types import ProtocolMessageTypes as pmt, ProtocolMessageTypes NO_REPLY_EXPECTED = [ # full_node -> full_node messages @@ -20,7 +20,7 @@ VALID_REPLY_MESSAGE_MAP = { # messages for all services - # pmt.handshake is handled in WSChiaConnection.perform_handshake + # pmt.handshake is handled in WSFlaxConnection.perform_handshake # full_node -> full_node protocol messages pmt.request_transaction: [pmt.respond_transaction], pmt.request_proof_of_weight: [pmt.respond_proof_of_weight], diff --git a/chia/protocols/protocol_timing.py b/flax/protocols/protocol_timing.py similarity index 100% rename from chia/protocols/protocol_timing.py rename to flax/protocols/protocol_timing.py diff --git a/chia/protocols/shared_protocol.py b/flax/protocols/shared_protocol.py similarity index 89% rename from chia/protocols/shared_protocol.py rename to flax/protocols/shared_protocol.py index d192e163c..8e6ce0c8a 100644 --- a/chia/protocols/shared_protocol.py +++ b/flax/protocols/shared_protocol.py @@ -4,8 +4,8 @@ from enum import IntEnum from typing import List, Tuple -from chia.util.ints import uint8, uint16 -from chia.util.streamable import Streamable, streamable +from flax.util.ints import uint8, uint16 +from flax.util.streamable import Streamable, streamable protocol_version = "0.0.34" @@ -18,7 +18,7 @@ # Capabilities can be added here when new features are added to the protocol # These are passed in as uint16 into the Handshake class Capability(IntEnum): - BASE = 1 # Base capability just means it supports the chia protocol at mainnet + BASE = 1 # Base capability just means it supports the flax protocol at mainnet # introduces RequestBlockHeaders, which is a faster API for fetching header blocks # !! the old API is *RequestHeaderBlock* !! BLOCK_HEADERS = 2 diff --git a/chia/protocols/timelord_protocol.py b/flax/protocols/timelord_protocol.py similarity index 84% rename from chia/protocols/timelord_protocol.py rename to flax/protocols/timelord_protocol.py index 48dbfab40..3373468cf 100644 --- a/chia/protocols/timelord_protocol.py +++ b/flax/protocols/timelord_protocol.py @@ -3,14 +3,14 @@ from dataclasses import dataclass from typing import List, Optional, Tuple -from chia.types.blockchain_format.foliage import Foliage -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.foliage import Foliage +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.streamable import Streamable, streamable """ Protocol between timelord and full node. diff --git a/chia/protocols/wallet_protocol.py b/flax/protocols/wallet_protocol.py similarity index 92% rename from chia/protocols/wallet_protocol.py rename to flax/protocols/wallet_protocol.py index 4c89f4d56..bbe34fa18 100644 --- a/chia/protocols/wallet_protocol.py +++ b/flax/protocols/wallet_protocol.py @@ -5,14 +5,14 @@ from chia_rs import CoinState, RespondToPhUpdates -from chia.full_node.fee_estimate import FeeEstimateGroup -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.header_block import HeaderBlock -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.streamable import Streamable, streamable +from flax.full_node.fee_estimate import FeeEstimateGroup +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.header_block import HeaderBlock +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.streamable import Streamable, streamable """ Protocol between wallet (SPV node) and full node. diff --git a/chia/py.typed b/flax/py.typed similarity index 100% rename from chia/py.typed rename to flax/py.typed diff --git a/chia/pyinstaller.spec b/flax/pyinstaller.spec similarity index 72% rename from chia/pyinstaller.spec rename to flax/pyinstaller.spec index b2df2f126..ad7aabfb8 100644 --- a/chia/pyinstaller.spec +++ b/flax/pyinstaller.spec @@ -12,15 +12,15 @@ from PyInstaller.utils.hooks import collect_submodules, copy_metadata THIS_IS_WINDOWS = platform.system().lower().startswith("win") THIS_IS_MAC = platform.system().lower().startswith("darwin") -ROOT = pathlib.Path(importlib.import_module("chia").__file__).absolute().parent.parent +ROOT = pathlib.Path(importlib.import_module("flax").__file__).absolute().parent.parent def solve_name_collision_problem(analysis): """ - There is a collision between the `chia` file name (which is the executable) - and the `chia` directory, which contains non-code resources like `english.txt`. + There is a collision between the `flax` file name (which is the executable) + and the `flax` directory, which contains non-code resources like `english.txt`. We move all the resources in the zipped area so there is no - need to create the `chia` directory, since the names collide. + need to create the `flax` directory, since the names collide. Fetching data now requires going into a zip file, so it will be slower. It's best if files that are used frequently are cached. @@ -34,7 +34,7 @@ def solve_name_collision_problem(analysis): zipped = [] datas = [] for data in analysis.datas: - if str(data[0]).startswith("chia/"): + if str(data[0]).startswith("flax/"): zipped.append(data) else: datas.append(data) @@ -51,7 +51,7 @@ keyring_imports = collect_submodules("keyring.backends") # keyring uses entrypoints to read keyring.backends from metadata file entry_points.txt. keyring_datas = copy_metadata("keyring")[0] -version_data = copy_metadata(get_distribution("chia-blockchain"))[0] +version_data = copy_metadata(get_distribution("flax-blockchain"))[0] block_cipher = None @@ -65,9 +65,9 @@ SERVERS = [ "timelord", ] -# TODO: collapse all these entry points into one `chia_exec` entrypoint that accepts the server as a parameter +# TODO: collapse all these entry points into one `flax_exec` entrypoint that accepts the server as a parameter -entry_points = ["chia.cmds.chia"] + [f"chia.server.start_{s}" for s in SERVERS] +entry_points = ["flax.cmds.flax"] + [f"flax.server.start_{s}" for s in SERVERS] hiddenimports = [] hiddenimports.extend(entry_points) @@ -75,18 +75,18 @@ hiddenimports.extend(keyring_imports) binaries = [] -if os.path.exists(f"{ROOT}/madmax/chia_plot"): +if os.path.exists(f"{ROOT}/madmax/flax_plot"): binaries.extend([ ( - f"{ROOT}/madmax/chia_plot", + f"{ROOT}/madmax/flax_plot", "madmax" ) ]) -if os.path.exists(f"{ROOT}/madmax/chia_plot_k34",): +if os.path.exists(f"{ROOT}/madmax/flax_plot_k34",): binaries.extend([ ( - f"{ROOT}/madmax/chia_plot_k34", + f"{ROOT}/madmax/flax_plot_k34", "madmax" ) ]) @@ -104,10 +104,10 @@ if THIS_IS_WINDOWS: # this probably isn't necessary if THIS_IS_WINDOWS: - entry_points.extend(["aiohttp", "chia.util.bip39"]) + entry_points.extend(["aiohttp", "flax.util.bip39"]) if THIS_IS_WINDOWS: - chia_mod = importlib.import_module("chia") + flax_mod = importlib.import_module("flax") dll_paths = pathlib.Path(sysconfig.get_path("platlib")) / "*.dll" binaries = [ @@ -124,11 +124,11 @@ if THIS_IS_WINDOWS: ".", ), ( - f"{ROOT}\\madmax\\chia_plot.exe", + f"{ROOT}\\madmax\\flax_plot.exe", "madmax" ), ( - f"{ROOT}\\madmax\\chia_plot_k34.exe", + f"{ROOT}\\madmax\\flax_plot_k34.exe", "madmax" ), ( @@ -140,10 +140,10 @@ if THIS_IS_WINDOWS: datas = [] -datas.append((f"{ROOT}/chia/util/english.txt", "chia/util")) -datas.append((f"{ROOT}/chia/util/initial-config.yaml", "chia/util")) -datas.append((f"{ROOT}/chia/wallet/puzzles/*.hex", "chia/wallet/puzzles")) -datas.append((f"{ROOT}/chia/ssl/*", "chia/ssl")) +datas.append((f"{ROOT}/flax/util/english.txt", "flax/util")) +datas.append((f"{ROOT}/flax/util/initial-config.yaml", "flax/util")) +datas.append((f"{ROOT}/flax/wallet/puzzles/*.hex", "flax/wallet/puzzles")) +datas.append((f"{ROOT}/flax/ssl/*", "flax/ssl")) datas.append((f"{ROOT}/mozilla-ca/*", "mozilla-ca")) datas.append(version_data) @@ -193,15 +193,15 @@ def add_binary(name, path_to_script, collect_args): COLLECT_ARGS = [] -add_binary("chia", f"{ROOT}/chia/cmds/chia.py", COLLECT_ARGS) -add_binary("daemon", f"{ROOT}/chia/daemon/server.py", COLLECT_ARGS) +add_binary("flax", f"{ROOT}/flax/cmds/flax.py", COLLECT_ARGS) +add_binary("daemon", f"{ROOT}/flax/daemon/server.py", COLLECT_ARGS) for server in SERVERS: - add_binary(f"start_{server}", f"{ROOT}/chia/server/start_{server}.py", COLLECT_ARGS) + add_binary(f"start_{server}", f"{ROOT}/flax/server/start_{server}.py", COLLECT_ARGS) -add_binary("start_crawler", f"{ROOT}/chia/seeder/start_crawler.py", COLLECT_ARGS) -add_binary("start_seeder", f"{ROOT}/chia/seeder/dns_server.py", COLLECT_ARGS) -add_binary("start_data_layer_http", f"{ROOT}/chia/data_layer/data_layer_server.py", COLLECT_ARGS) +add_binary("start_crawler", f"{ROOT}/flax/seeder/start_crawler.py", COLLECT_ARGS) +add_binary("start_seeder", f"{ROOT}/flax/seeder/dns_server.py", COLLECT_ARGS) +add_binary("start_data_layer_http", f"{ROOT}/flax/data_layer/data_layer_server.py", COLLECT_ARGS) COLLECT_KWARGS = dict( strip=False, diff --git a/chia/rpc/__init__.py b/flax/rpc/__init__.py similarity index 100% rename from chia/rpc/__init__.py rename to flax/rpc/__init__.py diff --git a/chia/rpc/crawler_rpc_api.py b/flax/rpc/crawler_rpc_api.py similarity index 92% rename from chia/rpc/crawler_rpc_api.py rename to flax/rpc/crawler_rpc_api.py index 6a96dec50..e9700bd91 100644 --- a/chia/rpc/crawler_rpc_api.py +++ b/flax/rpc/crawler_rpc_api.py @@ -3,15 +3,15 @@ import ipaddress from typing import Any, Dict, List, Optional -from chia.rpc.rpc_server import Endpoint, EndpointResult -from chia.seeder.crawler import Crawler -from chia.util.ws_message import WsRpcMessage, create_payload_dict +from flax.rpc.rpc_server import Endpoint, EndpointResult +from flax.seeder.crawler import Crawler +from flax.util.ws_message import WsRpcMessage, create_payload_dict class CrawlerRpcApi: def __init__(self, crawler: Crawler): self.service = crawler - self.service_name = "chia_crawler" + self.service_name = "flax_crawler" def get_routes(self) -> Dict[str, Endpoint]: return { diff --git a/chia/rpc/data_layer_rpc_api.py b/flax/rpc/data_layer_rpc_api.py similarity index 96% rename from chia/rpc/data_layer_rpc_api.py rename to flax/rpc/data_layer_rpc_api.py index 768feb8c5..26d18ee33 100644 --- a/chia/rpc/data_layer_rpc_api.py +++ b/flax/rpc/data_layer_rpc_api.py @@ -4,8 +4,8 @@ from pathlib import Path from typing import TYPE_CHECKING, Any, Dict, List, Optional -from chia.data_layer.data_layer_errors import OfferIntegrityError -from chia.data_layer.data_layer_util import ( +from flax.data_layer.data_layer_errors import OfferIntegrityError +from flax.data_layer.data_layer_util import ( CancelOfferRequest, CancelOfferResponse, MakeOfferRequest, @@ -16,20 +16,20 @@ TakeOfferResponse, VerifyOfferResponse, ) -from chia.data_layer.data_layer_wallet import DataLayerWallet, Mirror, verify_offer -from chia.rpc.data_layer_rpc_util import marshal -from chia.rpc.rpc_server import Endpoint, EndpointResult -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes +from flax.data_layer.data_layer_wallet import DataLayerWallet, Mirror, verify_offer +from flax.rpc.data_layer_rpc_util import marshal +from flax.rpc.rpc_server import Endpoint, EndpointResult +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes # todo input assertions for all rpc's -from chia.util.ints import uint64 -from chia.util.streamable import recurse_jsonify -from chia.util.ws_message import WsRpcMessage -from chia.wallet.trading.offer import Offer as TradingOffer +from flax.util.ints import uint64 +from flax.util.streamable import recurse_jsonify +from flax.util.ws_message import WsRpcMessage +from flax.wallet.trading.offer import Offer as TradingOffer if TYPE_CHECKING: - from chia.data_layer.data_layer import DataLayer + from flax.data_layer.data_layer import DataLayer def process_change(change: Dict[str, Any]) -> Dict[str, Any]: @@ -68,7 +68,7 @@ class DataLayerRpcApi: # TODO: other RPC APIs do not accept a wallet and the service start does not expect to provide one def __init__(self, data_layer: DataLayer): # , wallet: DataLayerWallet): self.service: DataLayer = data_layer - self.service_name = "chia_data_layer" + self.service_name = "flax_data_layer" def get_routes(self) -> Dict[str, Endpoint]: return { diff --git a/chia/rpc/data_layer_rpc_client.py b/flax/rpc/data_layer_rpc_client.py similarity index 97% rename from chia/rpc/data_layer_rpc_client.py rename to flax/rpc/data_layer_rpc_client.py index d365337ea..86b613669 100644 --- a/chia/rpc/data_layer_rpc_client.py +++ b/flax/rpc/data_layer_rpc_client.py @@ -3,9 +3,9 @@ from pathlib import Path from typing import Any, Dict, List, Optional -from chia.rpc.rpc_client import RpcClient -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 +from flax.rpc.rpc_client import RpcClient +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 class DataLayerRpcClient(RpcClient): diff --git a/chia/rpc/data_layer_rpc_util.py b/flax/rpc/data_layer_rpc_util.py similarity index 100% rename from chia/rpc/data_layer_rpc_util.py rename to flax/rpc/data_layer_rpc_util.py diff --git a/chia/rpc/farmer_rpc_api.py b/flax/rpc/farmer_rpc_api.py similarity index 95% rename from chia/rpc/farmer_rpc_api.py rename to flax/rpc/farmer_rpc_api.py index d2afd05c1..d1dac5022 100644 --- a/chia/rpc/farmer_rpc_api.py +++ b/flax/rpc/farmer_rpc_api.py @@ -6,16 +6,16 @@ from typing_extensions import Protocol -from chia.farmer.farmer import Farmer -from chia.plot_sync.receiver import Receiver -from chia.protocols.harvester_protocol import Plot -from chia.rpc.rpc_server import Endpoint, EndpointResult -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint32 -from chia.util.paginator import Paginator -from chia.util.streamable import Streamable, streamable -from chia.util.ws_message import WsRpcMessage, create_payload_dict +from flax.farmer.farmer import Farmer +from flax.plot_sync.receiver import Receiver +from flax.protocols.harvester_protocol import Plot +from flax.rpc.rpc_server import Endpoint, EndpointResult +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint32 +from flax.util.paginator import Paginator +from flax.util.streamable import Streamable, streamable +from flax.util.ws_message import WsRpcMessage, create_payload_dict class PaginatedRequestData(Protocol): @@ -82,7 +82,7 @@ def plot_matches_filter(plot: Plot, filter_item: FilterItem) -> bool: class FarmerRpcApi: def __init__(self, farmer: Farmer): self.service = farmer - self.service_name = "chia_farmer" + self.service_name = "flax_farmer" def get_routes(self) -> Dict[str, Endpoint]: return { diff --git a/chia/rpc/farmer_rpc_client.py b/flax/rpc/farmer_rpc_client.py similarity index 91% rename from chia/rpc/farmer_rpc_client.py rename to flax/rpc/farmer_rpc_client.py index fdd7a31bb..9ae2da2de 100644 --- a/chia/rpc/farmer_rpc_client.py +++ b/flax/rpc/farmer_rpc_client.py @@ -2,17 +2,17 @@ from typing import Any, Dict, List, Optional -from chia.rpc.farmer_rpc_api import PlotInfoRequestData, PlotPathRequestData -from chia.rpc.rpc_client import RpcClient -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.misc import dataclass_to_json_dict +from flax.rpc.farmer_rpc_api import PlotInfoRequestData, PlotPathRequestData +from flax.rpc.rpc_client import RpcClient +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.misc import dataclass_to_json_dict class FarmerRpcClient(RpcClient): """ - Client to Chia RPC, connects to a local farmer. Uses HTTP/JSON, and converts back from + Client to Flax RPC, connects to a local farmer. Uses HTTP/JSON, and converts back from JSON into native python objects before returning. All api calls use POST requests. - Note that this is not the same as the peer protocol, or wallet protocol (which run Chia's + Note that this is not the same as the peer protocol, or wallet protocol (which run Flax's protocol on top of TCP), it's a separate protocol on top of HTTP that provides easy access to the full node. """ diff --git a/chia/rpc/full_node_rpc_api.py b/flax/rpc/full_node_rpc_api.py similarity index 96% rename from chia/rpc/full_node_rpc_api.py rename to flax/rpc/full_node_rpc_api.py index 21a811156..7b6228a75 100644 --- a/chia/rpc/full_node_rpc_api.py +++ b/flax/rpc/full_node_rpc_api.py @@ -5,29 +5,29 @@ from clvm.casts import int_from_bytes -from chia.consensus.block_record import BlockRecord -from chia.consensus.cost_calculator import NPCResult -from chia.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR -from chia.full_node.fee_estimator_interface import FeeEstimatorInterface -from chia.full_node.full_node import FullNode -from chia.full_node.generator import setup_generator_args -from chia.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin -from chia.rpc.rpc_server import Endpoint, EndpointResult -from chia.server.outbound_message import NodeType -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_record import CoinRecord -from chia.types.coin_spend import CoinSpend -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.spend_bundle import SpendBundle -from chia.types.unfinished_header_block import UnfinishedHeaderBlock -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint32, uint64, uint128 -from chia.util.log_exceptions import log_exceptions -from chia.util.ws_message import WsRpcMessage, create_payload_dict -from chia.wallet.puzzles.decompress_block_spends import DECOMPRESS_BLOCK_SPENDS +from flax.consensus.block_record import BlockRecord +from flax.consensus.cost_calculator import NPCResult +from flax.consensus.pos_quality import UI_ACTUAL_SPACE_CONSTANT_FACTOR +from flax.full_node.fee_estimator_interface import FeeEstimatorInterface +from flax.full_node.full_node import FullNode +from flax.full_node.generator import setup_generator_args +from flax.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin +from flax.rpc.rpc_server import Endpoint, EndpointResult +from flax.server.outbound_message import NodeType +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_record import CoinRecord +from flax.types.coin_spend import CoinSpend +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.spend_bundle import SpendBundle +from flax.types.unfinished_header_block import UnfinishedHeaderBlock +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint32, uint64, uint128 +from flax.util.log_exceptions import log_exceptions +from flax.util.ws_message import WsRpcMessage, create_payload_dict +from flax.wallet.puzzles.decompress_block_spends import DECOMPRESS_BLOCK_SPENDS def coin_record_dict_backwards_compat(coin_record: Dict[str, Any]): @@ -38,7 +38,7 @@ def coin_record_dict_backwards_compat(coin_record: Dict[str, Any]): class FullNodeRpcApi: def __init__(self, service: FullNode): self.service = service - self.service_name = "chia_full_node" + self.service_name = "flax_full_node" self.cached_blockchain_state: Optional[Dict] = None def get_routes(self) -> Dict[str, Endpoint]: diff --git a/chia/rpc/full_node_rpc_client.py b/flax/rpc/full_node_rpc_client.py similarity index 94% rename from chia/rpc/full_node_rpc_client.py rename to flax/rpc/full_node_rpc_client.py index 9def631c7..b7e267212 100644 --- a/chia/rpc/full_node_rpc_client.py +++ b/flax/rpc/full_node_rpc_client.py @@ -1,17 +1,17 @@ from typing import Dict, List, Optional, Tuple, Any -from chia.consensus.block_record import BlockRecord -from chia.full_node.signage_point import SignagePoint -from chia.rpc.rpc_client import RpcClient -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_record import CoinRecord -from chia.types.coin_spend import CoinSpend -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.spend_bundle import SpendBundle -from chia.types.unfinished_header_block import UnfinishedHeaderBlock -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint32, uint64 +from flax.consensus.block_record import BlockRecord +from flax.full_node.signage_point import SignagePoint +from flax.rpc.rpc_client import RpcClient +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_record import CoinRecord +from flax.types.coin_spend import CoinSpend +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.spend_bundle import SpendBundle +from flax.types.unfinished_header_block import UnfinishedHeaderBlock +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint32, uint64 def coin_record_dict_backwards_compat(coin_record: Dict[str, Any]): @@ -21,9 +21,9 @@ def coin_record_dict_backwards_compat(coin_record: Dict[str, Any]): class FullNodeRpcClient(RpcClient): """ - Client to Chia RPC, connects to a local full node. Uses HTTP/JSON, and converts back from + Client to Flax RPC, connects to a local full node. Uses HTTP/JSON, and converts back from JSON into native python objects before returning. All api calls use POST requests. - Note that this is not the same as the peer protocol, or wallet protocol (which run Chia's + Note that this is not the same as the peer protocol, or wallet protocol (which run Flax's protocol on top of TCP), it's a separate protocol on top of HTTP that provides easy access to the full node. """ diff --git a/chia/rpc/harvester_rpc_api.py b/flax/rpc/harvester_rpc_api.py similarity index 92% rename from chia/rpc/harvester_rpc_api.py rename to flax/rpc/harvester_rpc_api.py index ac42ac882..378b683ea 100644 --- a/chia/rpc/harvester_rpc_api.py +++ b/flax/rpc/harvester_rpc_api.py @@ -2,15 +2,15 @@ from typing import Any, Dict, List -from chia.harvester.harvester import Harvester -from chia.rpc.rpc_server import Endpoint, EndpointResult -from chia.util.ws_message import WsRpcMessage, create_payload_dict +from flax.harvester.harvester import Harvester +from flax.rpc.rpc_server import Endpoint, EndpointResult +from flax.util.ws_message import WsRpcMessage, create_payload_dict class HarvesterRpcApi: def __init__(self, harvester: Harvester): self.service = harvester - self.service_name = "chia_harvester" + self.service_name = "flax_harvester" def get_routes(self) -> Dict[str, Endpoint]: return { diff --git a/chia/rpc/harvester_rpc_client.py b/flax/rpc/harvester_rpc_client.py similarity index 89% rename from chia/rpc/harvester_rpc_client.py rename to flax/rpc/harvester_rpc_client.py index 2c542ed87..f032bf129 100644 --- a/chia/rpc/harvester_rpc_client.py +++ b/flax/rpc/harvester_rpc_client.py @@ -2,14 +2,14 @@ from typing import Any, Dict, List -from chia.rpc.rpc_client import RpcClient +from flax.rpc.rpc_client import RpcClient class HarvesterRpcClient(RpcClient): """ - Client to Chia RPC, connects to a local harvester. Uses HTTP/JSON, and converts back from + Client to Flax RPC, connects to a local harvester. Uses HTTP/JSON, and converts back from JSON into native python objects before returning. All api calls use POST requests. - Note that this is not the same as the peer protocol, or wallet protocol (which run Chia's + Note that this is not the same as the peer protocol, or wallet protocol (which run Flax's protocol on top of TCP), it's a separate protocol on top of HTTP that provides easy access to the full node. """ diff --git a/chia/rpc/rpc_client.py b/flax/rpc/rpc_client.py similarity index 88% rename from chia/rpc/rpc_client.py rename to flax/rpc/rpc_client.py index 90f164761..927a2ed08 100644 --- a/chia/rpc/rpc_client.py +++ b/flax/rpc/rpc_client.py @@ -4,18 +4,18 @@ import aiohttp -from chia.server.server import NodeType, ssl_context_for_client -from chia.server.ssl_context import private_ssl_ca_paths -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint16 +from flax.server.server import NodeType, ssl_context_for_client +from flax.server.ssl_context import private_ssl_ca_paths +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint16 class RpcClient: """ - Client to Chia RPC, connects to a local service. Uses HTTP/JSON, and converts back from + Client to Flax RPC, connects to a local service. Uses HTTP/JSON, and converts back from JSON into native python objects before returning. All api calls use POST requests. - Note that this is not the same as the peer protocol, or wallet protocol (which run Chia's + Note that this is not the same as the peer protocol, or wallet protocol (which run Flax's protocol on top of TCP), it's a separate protocol on top of HTTP that provides easy access to the full node. """ diff --git a/chia/rpc/rpc_server.py b/flax/rpc/rpc_server.py similarity index 94% rename from chia/rpc/rpc_server.py rename to flax/rpc/rpc_server.py index ff0ad194d..8e045c21d 100644 --- a/chia/rpc/rpc_server.py +++ b/flax/rpc/rpc_server.py @@ -12,17 +12,17 @@ from aiohttp import ClientConnectorError, ClientSession, ClientWebSocketResponse, WSMsgType, web from typing_extensions import Protocol, final -from chia.rpc.util import wrap_http_handler -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer, ssl_context_for_client, ssl_context_for_server -from chia.server.ws_connection import WSChiaConnection -from chia.types.peer_info import PeerInfo -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import str2bool -from chia.util.ints import uint16 -from chia.util.json_util import dict_to_json_str -from chia.util.network import WebServer -from chia.util.ws_message import WsRpcMessage, create_payload, create_payload_dict, format_response, pong +from flax.rpc.util import wrap_http_handler +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer, ssl_context_for_client, ssl_context_for_server +from flax.server.ws_connection import WSFlaxConnection +from flax.types.peer_info import PeerInfo +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import str2bool +from flax.util.ints import uint16 +from flax.util.json_util import dict_to_json_str +from flax.util.network import WebServer +from flax.util.ws_message import WsRpcMessage, create_payload, create_payload_dict, format_response, pong log = logging.getLogger(__name__) max_message_size = 50 * 1024 * 1024 # 50MB @@ -46,21 +46,21 @@ class RpcServiceProtocol(Protocol): """ @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: """The server object that handles the common server behavior for the RPC.""" - # a property so as to be read only which allows ChiaServer to satisfy - # Optional[ChiaServer] + # a property so as to be read only which allows FlaxServer to satisfy + # Optional[FlaxServer] ... def get_connections(self, request_node_type: Optional[NodeType]) -> List[Dict[str, Any]]: """Report the active connections for the service. A default implementation is available and can be called as - chia.rpc.rpc_server.default_get_connections() + flax.rpc.rpc_server.default_get_connections() """ ... - async def on_connect(self, peer: WSChiaConnection) -> None: + async def on_connect(self, peer: WSFlaxConnection) -> None: """Called when a new connection is established to the server.""" ... @@ -114,7 +114,7 @@ async def _state_changed(self, change: str, change_data: Optional[Dict[str, Any] ... -def default_get_connections(server: ChiaServer, request_node_type: Optional[NodeType]) -> List[Dict[str, Any]]: +def default_get_connections(server: FlaxServer, request_node_type: Optional[NodeType]) -> List[Dict[str, Any]]: connections = server.get_connections(request_node_type) con_info = [ { diff --git a/chia/rpc/timelord_rpc_api.py b/flax/rpc/timelord_rpc_api.py similarity index 77% rename from chia/rpc/timelord_rpc_api.py rename to flax/rpc/timelord_rpc_api.py index 20ad63681..7da027d72 100644 --- a/chia/rpc/timelord_rpc_api.py +++ b/flax/rpc/timelord_rpc_api.py @@ -2,15 +2,15 @@ from typing import Any, Dict, List, Optional -from chia.rpc.rpc_server import Endpoint -from chia.timelord.timelord import Timelord -from chia.util.ws_message import WsRpcMessage, create_payload_dict +from flax.rpc.rpc_server import Endpoint +from flax.timelord.timelord import Timelord +from flax.util.ws_message import WsRpcMessage, create_payload_dict class TimelordRpcApi: def __init__(self, timelord: Timelord): self.service = timelord - self.service_name = "chia_timelord" + self.service_name = "flax_timelord" def get_routes(self) -> Dict[str, Endpoint]: return {} diff --git a/chia/rpc/util.py b/flax/rpc/util.py similarity index 94% rename from chia/rpc/util.py rename to flax/rpc/util.py index ce5293801..4becc46d5 100644 --- a/chia/rpc/util.py +++ b/flax/rpc/util.py @@ -6,7 +6,7 @@ import aiohttp -from chia.util.json_util import obj_to_response +from flax.util.json_util import obj_to_response log = logging.getLogger(__name__) diff --git a/chia/rpc/wallet_rpc_api.py b/flax/rpc/wallet_rpc_api.py similarity index 96% rename from chia/rpc/wallet_rpc_api.py rename to flax/rpc/wallet_rpc_api.py index 99ffd1a91..0b0c653ad 100644 --- a/chia/rpc/wallet_rpc_api.py +++ b/flax/rpc/wallet_rpc_api.py @@ -7,58 +7,58 @@ from blspy import G1Element, G2Element, PrivateKey -from chia.consensus.block_rewards import calculate_base_farmer_reward -from chia.data_layer.data_layer_wallet import DataLayerWallet -from chia.pools.pool_wallet import PoolWallet -from chia.pools.pool_wallet_info import FARMING_TO_POOL, PoolState, PoolWalletInfo, create_pool_state -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.wallet_protocol import CoinState -from chia.rpc.rpc_server import Endpoint, EndpointResult, default_get_connections -from chia.server.outbound_message import NodeType, make_msg -from chia.server.ws_connection import WSChiaConnection -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin, coin_as_list -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.spend_bundle import SpendBundle -from chia.util.bech32m import decode_puzzle_hash, encode_puzzle_hash -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import load_config -from chia.util.errors import KeychainIsLocked -from chia.util.ints import uint8, uint32, uint64, uint16 -from chia.util.keychain import bytes_to_mnemonic, generate_mnemonic -from chia.util.path import path_from_root -from chia.util.ws_message import WsRpcMessage, create_payload_dict -from chia.wallet.cat_wallet.cat_constants import DEFAULT_CATS -from chia.wallet.cat_wallet.cat_wallet import CATWallet -from chia.wallet.derive_keys import ( +from flax.consensus.block_rewards import calculate_base_farmer_reward +from flax.data_layer.data_layer_wallet import DataLayerWallet +from flax.pools.pool_wallet import PoolWallet +from flax.pools.pool_wallet_info import FARMING_TO_POOL, PoolState, PoolWalletInfo, create_pool_state +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.wallet_protocol import CoinState +from flax.rpc.rpc_server import Endpoint, EndpointResult, default_get_connections +from flax.server.outbound_message import NodeType, make_msg +from flax.server.ws_connection import WSFlaxConnection +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin, coin_as_list +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.spend_bundle import SpendBundle +from flax.util.bech32m import decode_puzzle_hash, encode_puzzle_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import load_config +from flax.util.errors import KeychainIsLocked +from flax.util.ints import uint8, uint32, uint64, uint16 +from flax.util.keychain import bytes_to_mnemonic, generate_mnemonic +from flax.util.path import path_from_root +from flax.util.ws_message import WsRpcMessage, create_payload_dict +from flax.wallet.cat_wallet.cat_constants import DEFAULT_CATS +from flax.wallet.cat_wallet.cat_wallet import CATWallet +from flax.wallet.derive_keys import ( MAX_POOL_WALLETS, master_sk_to_farmer_sk, master_sk_to_pool_sk, master_sk_to_singleton_owner_sk, match_address_to_sk, ) -from chia.wallet.did_wallet.did_wallet import DIDWallet -from chia.wallet.nft_wallet import nft_puzzles -from chia.wallet.nft_wallet.nft_info import NFTInfo, NFTCoinInfo -from chia.wallet.nft_wallet.nft_puzzles import get_metadata_and_phs -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT -from chia.wallet.notification_store import Notification -from chia.wallet.outer_puzzles import AssetType -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.trade_record import TradeRecord -from chia.wallet.trading.offer import Offer -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.address_type import AddressType, is_valid_address -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType -from chia.wallet.wallet_info import WalletInfo -from chia.wallet.wallet_node import WalletNode -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_protocol import WalletProtocol +from flax.wallet.did_wallet.did_wallet import DIDWallet +from flax.wallet.nft_wallet import nft_puzzles +from flax.wallet.nft_wallet.nft_info import NFTInfo, NFTCoinInfo +from flax.wallet.nft_wallet.nft_puzzles import get_metadata_and_phs +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.nft_wallet.uncurry_nft import UncurriedNFT +from flax.wallet.notification_store import Notification +from flax.wallet.outer_puzzles import AssetType +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.trade_record import TradeRecord +from flax.wallet.trading.offer import Offer +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.address_type import AddressType, is_valid_address +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType +from flax.wallet.wallet_info import WalletInfo +from flax.wallet.wallet_node import WalletNode +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_protocol import WalletProtocol # Timeout for response from wallet/full node for sending a transaction TIMEOUT = 30 @@ -71,7 +71,7 @@ class WalletRpcApi: def __init__(self, wallet_node: WalletNode): assert wallet_node is not None self.service = wallet_node - self.service_name = "chia_wallet" + self.service_name = "flax_wallet" self.balance_cache: Dict[int, Any] = {} def get_routes(self) -> Dict[str, Endpoint]: @@ -365,8 +365,8 @@ async def _check_key_used_for_rewards( return False, False config: Dict = load_config(new_root, "config.yaml") - farmer_target = config["farmer"].get("xch_target_address") - pool_target = config["pool"].get("xch_target_address") + farmer_target = config["farmer"].get("xfx_target_address") + pool_target = config["pool"].get("xfx_target_address") address_to_check: List[bytes32] = [decode_puzzle_hash(farmer_target), decode_puzzle_hash(pool_target)] found_addresses: Set[bytes32] = match_address_to_sk(sk, address_to_check, max_ph_to_search) @@ -640,7 +640,7 @@ async def create_new_wallet(self, request: Dict) -> EndpointResult: owner_puzzle_hash: bytes32 = await self.service.wallet_state_manager.main_wallet.get_puzzle_hash(True) - from chia.pools.pool_wallet_info import initial_pool_state_from_dict + from flax.pools.pool_wallet_info import initial_pool_state_from_dict async with self.service.wallet_state_manager.lock: # We assign a pseudo unique id to each pool wallet, so that each one gets its own deterministic @@ -1213,8 +1213,8 @@ async def get_offer_summary(self, request) -> EndpointResult: ### # This is temporary code, delete it when we no longer care about incorrectly parsing CAT1s # There's also temp code in test_wallet_rpc.py and wallet_funcs.py - from chia.util.bech32m import bech32_decode, convertbits - from chia.wallet.util.puzzle_compression import decompress_object_with_puzzles + from flax.util.bech32m import bech32_decode, convertbits + from flax.wallet.util.puzzle_compression import decompress_object_with_puzzles hrpgot, data = bech32_decode(offer_hex, max_length=len(offer_hex)) if data is None: @@ -1244,7 +1244,7 @@ async def get_offer_summary(self, request) -> EndpointResult: async def check_offer_validity(self, request) -> EndpointResult: offer_hex: str = request["offer"] offer = Offer.from_bech32(offer_hex) - peer: Optional[WSChiaConnection] = self.service.get_full_node_peer() + peer: Optional[WSFlaxConnection] = self.service.get_full_node_peer() if peer is None: raise ValueError("No peer connected") return {"valid": (await self.service.wallet_state_manager.trade_manager.check_offer_validity(offer, peer))} @@ -1262,7 +1262,7 @@ async def take_offer(self, request) -> EndpointResult: solver = Solver(info=maybe_marshalled_solver) async with self.service.wallet_state_manager.lock: - peer: Optional[WSChiaConnection] = self.service.get_full_node_peer() + peer: Optional[WSFlaxConnection] = self.service.get_full_node_peer() if peer is None: raise ValueError("No peer connected") result = await self.service.wallet_state_manager.trade_manager.respond_to_offer( @@ -1344,7 +1344,7 @@ async def cancel_offers(self, request: Dict) -> EndpointResult: if cancel_all: asset_id = None else: - asset_id = request.get("asset_id", "xch") + asset_id = request.get("asset_id", "xfx") start: int = 0 end: int = start + batch_size @@ -1352,7 +1352,7 @@ async def cancel_offers(self, request: Dict) -> EndpointResult: log.info(f"Start cancelling offers for {'asset_id: ' + asset_id if asset_id is not None else 'all'} ...") # Traverse offers page by page key = None - if asset_id is not None and asset_id != "xch": + if asset_id is not None and asset_id != "xfx": key = bytes32.from_hexstr(asset_id) while True: records: List[TradeRecord] = [] @@ -1836,7 +1836,7 @@ async def nft_get_info(self, request: Dict) -> EndpointResult: else: coin_id = bytes32.from_hexstr(coin_id) # Get coin state - peer: Optional[WSChiaConnection] = self.service.get_full_node_peer() + peer: Optional[WSFlaxConnection] = self.service.get_full_node_peer() if peer is None: raise ValueError("No peers to get info from") coin_state_list: List[CoinState] = await self.service.wallet_state_manager.wallet_node.get_coin_state( @@ -2009,18 +2009,18 @@ async def nft_mint_bulk(self, request) -> EndpointResult: target_list.append(decode_puzzle_hash(target)) mint_number_start = request.get("mint_number_start", 1) mint_total = request.get("mint_total", None) - xch_coin_list = request.get("xch_coins", None) - xch_coins = None - if xch_coin_list: - xch_coins = set([Coin.from_json_dict(xch_coin) for xch_coin in xch_coin_list]) - xch_change_target = request.get("xch_change_target", None) - if xch_change_target is not None: - if xch_change_target[:2] == "xch": - xch_change_ph = decode_puzzle_hash(xch_change_target) + xfx_coin_list = request.get("xfx_coins", None) + xfx_coins = None + if xfx_coin_list: + xfx_coins = set([Coin.from_json_dict(xfx_coin) for xfx_coin in xfx_coin_list]) + xfx_change_target = request.get("xfx_change_target", None) + if xfx_change_target is not None: + if xfx_change_target[:2] == "xfx": + xfx_change_ph = decode_puzzle_hash(xfx_change_target) else: - xch_change_ph = bytes32(hexstr_to_bytes(xch_change_target)) + xfx_change_ph = bytes32(hexstr_to_bytes(xfx_change_target)) else: - xch_change_ph = None + xfx_change_ph = None new_innerpuzhash = request.get("new_innerpuzhash", None) new_p2_puzhash = request.get("new_p2_puzhash", None) did_coin_dict = request.get("did_coin", None) @@ -2041,8 +2041,8 @@ async def nft_mint_bulk(self, request) -> EndpointResult: mint_number_start=mint_number_start, mint_total=mint_total, target_list=target_list, - xch_coins=xch_coins, - xch_change_ph=xch_change_ph, + xfx_coins=xfx_coins, + xfx_change_ph=xfx_change_ph, new_innerpuzhash=new_innerpuzhash, new_p2_puzhash=new_p2_puzhash, did_coin=did_coin, @@ -2050,13 +2050,13 @@ async def nft_mint_bulk(self, request) -> EndpointResult: fee=fee, ) else: - sb = await nft_wallet.mint_from_xch( + sb = await nft_wallet.mint_from_xfx( metadata_list, mint_number_start=mint_number_start, mint_total=mint_total, target_list=target_list, - xch_coins=xch_coins, - xch_change_ph=xch_change_ph, + xfx_coins=xfx_coins, + xfx_change_ph=xfx_change_ph, fee=fee, ) @@ -2350,7 +2350,7 @@ async def dl_track_new(self, request) -> Dict: if self.service.wallet_state_manager is None: raise ValueError("The wallet service is not currently initialized") - peer: Optional[WSChiaConnection] = self.service.get_full_node_peer() + peer: Optional[WSFlaxConnection] = self.service.get_full_node_peer() if peer is None: raise ValueError("No peer connected") @@ -2554,7 +2554,7 @@ async def dl_delete_mirror(self, request) -> Dict: if self.service.wallet_state_manager is None: raise ValueError("The wallet service is not currently initialized") - peer: Optional[WSChiaConnection] = self.service.get_full_node_peer() + peer: Optional[WSFlaxConnection] = self.service.get_full_node_peer() if peer is None: raise ValueError("No peer connected") diff --git a/chia/rpc/wallet_rpc_client.py b/flax/rpc/wallet_rpc_client.py similarity index 97% rename from chia/rpc/wallet_rpc_client.py rename to flax/rpc/wallet_rpc_client.py index af194e2a1..ccf344240 100644 --- a/chia/rpc/wallet_rpc_client.py +++ b/flax/rpc/wallet_rpc_client.py @@ -1,18 +1,18 @@ from typing import Dict, List, Optional, Any, Tuple, Union -from chia.data_layer.data_layer_wallet import Mirror, SingletonRecord -from chia.pools.pool_wallet_info import PoolWalletInfo -from chia.rpc.rpc_client import RpcClient -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.notification_store import Notification -from chia.wallet.trade_record import TradeRecord -from chia.wallet.trading.offer import Offer -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.transaction_sorting import SortKey -from chia.wallet.util.wallet_types import WalletType +from flax.data_layer.data_layer_wallet import Mirror, SingletonRecord +from flax.pools.pool_wallet_info import PoolWalletInfo +from flax.rpc.rpc_client import RpcClient +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.notification_store import Notification +from flax.wallet.trade_record import TradeRecord +from flax.wallet.trading.offer import Offer +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.transaction_sorting import SortKey +from flax.wallet.util.wallet_types import WalletType def parse_result_transactions(result: Dict[str, Any]) -> Dict[str, Any]: @@ -24,9 +24,9 @@ def parse_result_transactions(result: Dict[str, Any]) -> Dict[str, Any]: class WalletRpcClient(RpcClient): """ - Client to Chia RPC, connects to a local wallet. Uses HTTP/JSON, and converts back from + Client to Flax RPC, connects to a local wallet. Uses HTTP/JSON, and converts back from JSON into native python objects before returning. All api calls use POST requests. - Note that this is not the same as the peer protocol, or wallet protocol (which run Chia's + Note that this is not the same as the peer protocol, or wallet protocol (which run Flax's protocol on top of TCP), it's a separate protocol on top of HTTP that provides easy access to the full node. """ @@ -775,8 +775,8 @@ async def nft_mint_bulk( target_list: Optional[List[str]] = None, mint_number_start: Optional[int] = 1, mint_total: Optional[int] = None, - xch_coins: Optional[List[Dict]] = None, - xch_change_target: Optional[str] = None, + xfx_coins: Optional[List[Dict]] = None, + xfx_change_target: Optional[str] = None, new_innerpuzhash: Optional[str] = None, did_coin: Optional[Dict] = None, did_lineage_parent: Optional[str] = None, @@ -791,8 +791,8 @@ async def nft_mint_bulk( "royalty_address": royalty_address, "mint_number_start": mint_number_start, "mint_total": mint_total, - "xch_coins": xch_coins, - "xch_change_target": xch_change_target, + "xfx_coins": xfx_coins, + "xfx_change_target": xfx_change_target, "new_innerpuzhash": new_innerpuzhash, "did_coin": did_coin, "did_lineage_parent": did_lineage_parent, diff --git a/chia/seeder/__init__.py b/flax/seeder/__init__.py similarity index 100% rename from chia/seeder/__init__.py rename to flax/seeder/__init__.py diff --git a/chia/seeder/crawl_store.py b/flax/seeder/crawl_store.py similarity index 99% rename from chia/seeder/crawl_store.py rename to flax/seeder/crawl_store.py index ccae0fc7f..7c4c930fd 100644 --- a/chia/seeder/crawl_store.py +++ b/flax/seeder/crawl_store.py @@ -8,7 +8,7 @@ import aiosqlite -from chia.seeder.peer_record import PeerRecord, PeerReliability +from flax.seeder.peer_record import PeerRecord, PeerReliability log = logging.getLogger(__name__) diff --git a/chia/seeder/crawler.py b/flax/seeder/crawler.py similarity index 95% rename from chia/seeder/crawler.py rename to flax/seeder/crawler.py index c40db1526..b27539b2c 100644 --- a/chia/seeder/crawler.py +++ b/flax/seeder/crawler.py @@ -9,18 +9,18 @@ import aiosqlite -import chia.server.ws_connection as ws -from chia.consensus.constants import ConsensusConstants -from chia.full_node.coin_store import CoinStore -from chia.protocols import full_node_protocol -from chia.rpc.rpc_server import default_get_connections -from chia.seeder.crawl_store import CrawlStore -from chia.seeder.peer_record import PeerRecord, PeerReliability -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer -from chia.types.peer_info import PeerInfo -from chia.util.path import path_from_root -from chia.util.ints import uint32, uint64 +import flax.server.ws_connection as ws +from flax.consensus.constants import ConsensusConstants +from flax.full_node.coin_store import CoinStore +from flax.protocols import full_node_protocol +from flax.rpc.rpc_server import default_get_connections +from flax.seeder.crawl_store import CrawlStore +from flax.seeder.peer_record import PeerRecord, PeerReliability +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer +from flax.types.peer_info import PeerInfo +from flax.util.path import path_from_root +from flax.util.ints import uint32, uint64 log = logging.getLogger(__name__) @@ -30,7 +30,7 @@ class Crawler: coin_store: CoinStore connection: aiosqlite.Connection config: Dict - _server: Optional[ChiaServer] + _server: Optional[FlaxServer] crawl_store: Optional[CrawlStore] log: logging.Logger constants: ConsensusConstants @@ -41,7 +41,7 @@ class Crawler: minimum_version_count: int @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: # This is a stop gap until the class usage is refactored such the values of # integral attributes are known at creation of the instance. if self._server is None: @@ -96,7 +96,7 @@ async def create_client(self, peer_info, on_connect): return await self.server.start_client(peer_info, on_connect) async def connect_task(self, peer): - async def peer_action(peer: ws.WSChiaConnection): + async def peer_action(peer: ws.WSFlaxConnection): peer_info = peer.get_peer_info() version = peer.get_version() @@ -337,14 +337,14 @@ async def crawl(self): except Exception as e: self.log.error(f"Exception: {e}. Traceback: {traceback.format_exc()}.") - def set_server(self, server: ChiaServer): + def set_server(self, server: FlaxServer): self._server = server def _state_changed(self, change: str, change_data: Optional[Dict[str, Any]] = None): if self.state_changed_callback is not None: self.state_changed_callback(change, change_data) - async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaConnection): + async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSFlaxConnection): try: peer_info = peer.get_peer_info() tls_version = peer.get_tls_version() @@ -359,7 +359,7 @@ async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaCon except Exception as e: self.log.error(f"Exception: {e}. Traceback: {traceback.format_exc()}.") - async def on_connect(self, connection: ws.WSChiaConnection): + async def on_connect(self, connection: ws.WSFlaxConnection): pass def _close(self): diff --git a/chia/seeder/crawler_api.py b/flax/seeder/crawler_api.py similarity index 85% rename from chia/seeder/crawler_api.py rename to flax/seeder/crawler_api.py index c59d3b638..1b0bb761e 100644 --- a/chia/seeder/crawler_api.py +++ b/flax/seeder/crawler_api.py @@ -2,12 +2,12 @@ from typing import Optional -import chia.server.ws_connection as ws -from chia.protocols import full_node_protocol, wallet_protocol -from chia.seeder.crawler import Crawler -from chia.server.outbound_message import Message -from chia.server.server import ChiaServer -from chia.util.api_decorators import api_request, peer_required +import flax.server.ws_connection as ws +from flax.protocols import full_node_protocol, wallet_protocol +from flax.seeder.crawler import Crawler +from flax.server.outbound_message import Message +from flax.server.server import FlaxServer +from flax.util.api_decorators import api_request, peer_required class CrawlerAPI: @@ -23,7 +23,7 @@ async def invoke(*args, **kwargs): return invoke @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: assert self.crawler.server is not None return self.crawler.server @@ -33,19 +33,19 @@ def log(self): @peer_required @api_request - async def request_peers(self, _request: full_node_protocol.RequestPeers, peer: ws.WSChiaConnection): + async def request_peers(self, _request: full_node_protocol.RequestPeers, peer: ws.WSFlaxConnection): pass @peer_required @api_request async def respond_peers( - self, request: full_node_protocol.RespondPeers, peer: ws.WSChiaConnection + self, request: full_node_protocol.RespondPeers, peer: ws.WSFlaxConnection ) -> Optional[Message]: pass @peer_required @api_request - async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSChiaConnection) -> Optional[Message]: + async def new_peak(self, request: full_node_protocol.NewPeak, peer: ws.WSFlaxConnection) -> Optional[Message]: await self.crawler.new_peak(request, peer) return None @@ -56,7 +56,7 @@ async def new_transaction(self, transaction: full_node_protocol.NewTransaction) @api_request @peer_required async def new_signage_point_or_end_of_sub_slot( - self, new_sp: full_node_protocol.NewSignagePointOrEndOfSubSlot, peer: ws.WSChiaConnection + self, new_sp: full_node_protocol.NewSignagePointOrEndOfSubSlot, peer: ws.WSFlaxConnection ) -> Optional[Message]: pass @@ -68,7 +68,7 @@ async def new_unfinished_block( @peer_required @api_request - async def new_compact_vdf(self, request: full_node_protocol.NewCompactVDF, peer: ws.WSChiaConnection): + async def new_compact_vdf(self, request: full_node_protocol.NewCompactVDF, peer: ws.WSFlaxConnection): pass @api_request @@ -104,7 +104,7 @@ async def request_signage_point_or_end_of_sub_slot( async def request_mempool_transactions( self, request: full_node_protocol.RequestMempoolTransactions, - peer: ws.WSChiaConnection, + peer: ws.WSFlaxConnection, ) -> Optional[Message]: pass diff --git a/chia/seeder/dns_server.py b/flax/seeder/dns_server.py similarity index 98% rename from chia/seeder/dns_server.py rename to flax/seeder/dns_server.py index 2f9a04c1f..80f3e4d09 100644 --- a/chia/seeder/dns_server.py +++ b/flax/seeder/dns_server.py @@ -10,10 +10,10 @@ import aiosqlite from dnslib import A, AAAA, SOA, NS, MX, CNAME, RR, DNSRecord, QTYPE, DNSHeader -from chia.util.chia_logging import initialize_logging -from chia.util.path import path_from_root -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH +from flax.util.flax_logging import initialize_logging +from flax.util.path import path_from_root +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH SERVICE_NAME = "seeder" log = logging.getLogger(__name__) diff --git a/chia/seeder/peer_record.py b/flax/seeder/peer_record.py similarity index 98% rename from chia/seeder/peer_record.py rename to flax/seeder/peer_record.py index dea905338..55b9b6fab 100644 --- a/chia/seeder/peer_record.py +++ b/flax/seeder/peer_record.py @@ -4,8 +4,8 @@ import time from dataclasses import dataclass -from chia.util.ints import uint32, uint64 -from chia.util.streamable import Streamable, streamable +from flax.util.ints import uint32, uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/seeder/start_crawler.py b/flax/seeder/start_crawler.py similarity index 80% rename from chia/seeder/start_crawler.py rename to flax/seeder/start_crawler.py index 4bcec3f17..c2a1b8d55 100644 --- a/chia/seeder/start_crawler.py +++ b/flax/seeder/start_crawler.py @@ -6,16 +6,16 @@ from multiprocessing import freeze_support from typing import Dict, Optional -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.rpc.crawler_rpc_api import CrawlerRpcApi -from chia.seeder.crawler import Crawler -from chia.seeder.crawler_api import CrawlerAPI -from chia.server.outbound_message import NodeType -from chia.server.start_service import RpcInfo, Service, async_run -from chia.util.chia_logging import initialize_service_logging -from chia.util.config import load_config, load_config_cli -from chia.util.default_root import DEFAULT_ROOT_PATH +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.rpc.crawler_rpc_api import CrawlerRpcApi +from flax.seeder.crawler import Crawler +from flax.seeder.crawler_api import CrawlerAPI +from flax.server.outbound_message import NodeType +from flax.server.start_service import RpcInfo, Service, async_run +from flax.util.flax_logging import initialize_service_logging +from flax.util.config import load_config, load_config_cli +from flax.util.default_root import DEFAULT_ROOT_PATH # See: https://bugs.python.org/issue29288 "".encode("idna") diff --git a/chia/server/__init__.py b/flax/server/__init__.py similarity index 100% rename from chia/server/__init__.py rename to flax/server/__init__.py diff --git a/chia/server/address_manager.py b/flax/server/address_manager.py similarity index 99% rename from chia/server/address_manager.py rename to flax/server/address_manager.py index 63ae96225..148ca8698 100644 --- a/chia/server/address_manager.py +++ b/flax/server/address_manager.py @@ -8,9 +8,9 @@ from secrets import randbits from typing import Dict, List, Optional, Set, Tuple -from chia.types.peer_info import PeerInfo, TimestampedPeerInfo -from chia.util.hash import std_hash -from chia.util.ints import uint16, uint64 +from flax.types.peer_info import PeerInfo, TimestampedPeerInfo +from flax.util.hash import std_hash +from flax.util.ints import uint16, uint64 TRIED_BUCKETS_PER_GROUP = 8 NEW_BUCKETS_PER_SOURCE_GROUP = 64 diff --git a/chia/server/address_manager_sqlite_store.py b/flax/server/address_manager_sqlite_store.py similarity index 95% rename from chia/server/address_manager_sqlite_store.py rename to flax/server/address_manager_sqlite_store.py index c62bd5554..16e98305f 100644 --- a/chia/server/address_manager_sqlite_store.py +++ b/flax/server/address_manager_sqlite_store.py @@ -1,6 +1,6 @@ import aiosqlite -from chia.server.address_manager import AddressManager, ExtendedPeerInfo, NEW_BUCKETS_PER_ADDRESS +from flax.server.address_manager import AddressManager, ExtendedPeerInfo, NEW_BUCKETS_PER_ADDRESS from pathlib import Path from typing import Dict, List, Optional, Tuple @@ -14,7 +14,7 @@ async def create_address_manager_from_db(db_path: Path) -> Optional[AddressManag """ async with aiosqlite.connect(db_path) as connection: await connection.execute("pragma journal_mode=wal") - await connection.execute("pragma synchronous=OFF") + pass # await connection.execute("pragma synchronous=OFF") # Prevent DB corruption by avoiding ill-advised synchronous optimization. metadata: Dict[str, str] = await get_metadata(connection) address_manager: Optional[AddressManager] = None diff --git a/chia/server/address_manager_store.py b/flax/server/address_manager_store.py similarity index 98% rename from chia/server/address_manager_store.py rename to flax/server/address_manager_store.py index 20447f746..fa9681c28 100644 --- a/chia/server/address_manager_store.py +++ b/flax/server/address_manager_store.py @@ -2,16 +2,16 @@ import asyncio import logging -from chia.server.address_manager import ( +from flax.server.address_manager import ( BUCKET_SIZE, NEW_BUCKET_COUNT, NEW_BUCKETS_PER_ADDRESS, AddressManager, ExtendedPeerInfo, ) -from chia.util.files import write_file_async -from chia.util.ints import uint64 -from chia.util.streamable import streamable, Streamable +from flax.util.files import write_file_async +from flax.util.ints import uint64 +from flax.util.streamable import streamable, Streamable from dataclasses import dataclass from pathlib import Path from timeit import default_timer as timer diff --git a/chia/server/connection_utils.py b/flax/server/connection_utils.py similarity index 80% rename from chia/server/connection_utils.py rename to flax/server/connection_utils.py index 5b270fd1c..0cff6f9e8 100644 --- a/chia/server/connection_utils.py +++ b/flax/server/connection_utils.py @@ -4,15 +4,15 @@ import random from typing import Any, List, Optional, Tuple -from chia.server.ws_connection import WSChiaConnection +from flax.server.ws_connection import WSFlaxConnection async def send_all_first_reply( - func: str, arg: Any, peers: List[WSChiaConnection], timeout=15 -) -> Optional[Tuple[Any, WSChiaConnection]]: + func: str, arg: Any, peers: List[WSFlaxConnection], timeout=15 +) -> Optional[Tuple[Any, WSFlaxConnection]]: """performs an API request to peers and returns the result of the first response and the peer that sent it.""" - async def do_func(peer_x: WSChiaConnection, func_x: str, arg_x: Any): + async def do_func(peer_x: WSFlaxConnection, func_x: str, arg_x: Any): method_to_call = getattr(peer_x, func_x) result_x = await method_to_call(arg_x) if result_x is not None: @@ -39,10 +39,10 @@ async def do_func(peer_x: WSChiaConnection, func_x: str, arg_x: Any): return None -async def send_to_random(func: str, arg: Any, peers: List[WSChiaConnection]) -> Optional[Tuple[Any, WSChiaConnection]]: +async def send_to_random(func: str, arg: Any, peers: List[WSFlaxConnection]) -> Optional[Tuple[Any, WSFlaxConnection]]: """performs an API request to peers and returns the result of the first response and the peer that sent it.""" - async def do_func(peer_x: WSChiaConnection, func_x: str, arg_x: Any): + async def do_func(peer_x: WSFlaxConnection, func_x: str, arg_x: Any): method_to_call = getattr(peer_x, func_x) result_x = await method_to_call(arg_x) if result_x is not None: diff --git a/chia/server/introducer_peers.py b/flax/server/introducer_peers.py similarity index 96% rename from chia/server/introducer_peers.py rename to flax/server/introducer_peers.py index 20743441d..08cf2d17b 100644 --- a/chia/server/introducer_peers.py +++ b/flax/server/introducer_peers.py @@ -3,8 +3,8 @@ from typing import Set, List, Optional from dataclasses import dataclass -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint64, uint16 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint64, uint16 @dataclass(frozen=False) diff --git a/chia/server/node_discovery.py b/flax/server/node_discovery.py similarity index 97% rename from chia/server/node_discovery.py rename to flax/server/node_discovery.py index ad12df134..ccb88d38d 100644 --- a/chia/server/node_discovery.py +++ b/flax/server/node_discovery.py @@ -7,25 +7,25 @@ from typing import Dict, Optional, List, Set -import chia.server.ws_connection as ws +import flax.server.ws_connection as ws import dns.asyncresolver -from chia.protocols import full_node_protocol, introducer_protocol -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.server.address_manager import AddressManager, ExtendedPeerInfo -from chia.server.address_manager_store import AddressManagerStore -from chia.server.address_manager_sqlite_store import create_address_manager_from_db -from chia.server.outbound_message import NodeType, make_msg, Message -from chia.server.peer_store_resolver import PeerStoreResolver -from chia.server.server import ChiaServer -from chia.types.peer_info import PeerInfo, TimestampedPeerInfo -from chia.util.hash import std_hash -from chia.util.ints import uint64 +from flax.protocols import full_node_protocol, introducer_protocol +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.server.address_manager import AddressManager, ExtendedPeerInfo +from flax.server.address_manager_store import AddressManagerStore +from flax.server.address_manager_sqlite_store import create_address_manager_from_db +from flax.server.outbound_message import NodeType, make_msg, Message +from flax.server.peer_store_resolver import PeerStoreResolver +from flax.server.server import FlaxServer +from flax.types.peer_info import PeerInfo, TimestampedPeerInfo +from flax.util.hash import std_hash +from flax.util.ints import uint64 MAX_PEERS_RECEIVED_PER_REQUEST = 1000 MAX_TOTAL_PEERS_RECEIVED = 3000 MAX_CONCURRENT_OUTBOUND_CONNECTIONS = 70 NETWORK_ID_DEFAULT_PORTS = { - "mainnet": 8444, + "mainnet": 6888, "testnet7": 58444, "testnet10": 58444, "testnet8": 58445, @@ -37,7 +37,7 @@ class FullNodeDiscovery: def __init__( self, - server: ChiaServer, + server: FlaxServer, target_outbound_count: int, peer_store_resolver: PeerStoreResolver, introducer_info: Optional[Dict], @@ -47,7 +47,7 @@ def __init__( default_port: Optional[int], log, ): - self.server: ChiaServer = server + self.server: FlaxServer = server self.message_queue: asyncio.Queue = asyncio.Queue() self.is_closed = False self.target_outbound_count = target_outbound_count @@ -138,7 +138,7 @@ def cancel_task_safe(self, task: Optional[asyncio.Task]): def add_message(self, message, data): self.message_queue.put_nowait((message, data)) - async def on_connect(self, peer: ws.WSChiaConnection): + async def on_connect(self, peer: ws.WSFlaxConnection): if ( peer.is_outbound is False and peer.peer_server_port is not None @@ -165,7 +165,7 @@ async def on_connect(self, peer: ws.WSChiaConnection): await peer.send_message(msg) # Updates timestamps each time we receive a message for outbound connections. - async def update_peer_timestamp_on_message(self, peer: ws.WSChiaConnection): + async def update_peer_timestamp_on_message(self, peer: ws.WSFlaxConnection): if ( peer.is_outbound and peer.peer_server_port is not None @@ -203,7 +203,7 @@ async def _introducer_client(self): if self.introducer_info is None: return None - async def on_connect(peer: ws.WSChiaConnection): + async def on_connect(peer: ws.WSFlaxConnection): msg = make_msg(ProtocolMessageTypes.request_peers_introducer, introducer_protocol.RequestPeersIntroducer()) await peer.send_message(msg) @@ -236,7 +236,7 @@ async def _query_dns(self, dns_address): except Exception as e: self.log.warning(f"querying DNS introducer failed: {e}") - async def on_connect_callback(self, peer: ws.WSChiaConnection): + async def on_connect_callback(self, peer: ws.WSFlaxConnection): if self.server.on_connect is not None: await self.server.on_connect(peer) else: diff --git a/chia/server/outbound_message.py b/flax/server/outbound_message.py similarity index 87% rename from chia/server/outbound_message.py rename to flax/server/outbound_message.py index 1cde0f0a0..6c5aee52d 100644 --- a/chia/server/outbound_message.py +++ b/flax/server/outbound_message.py @@ -4,9 +4,9 @@ from enum import IntEnum from typing import Optional, SupportsBytes, Union -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.util.ints import uint8, uint16 -from chia.util.streamable import Streamable, streamable +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.util.ints import uint8, uint16 +from flax.util.streamable import Streamable, streamable class NodeType(IntEnum): diff --git a/chia/server/peer_store_resolver.py b/flax/server/peer_store_resolver.py similarity index 100% rename from chia/server/peer_store_resolver.py rename to flax/server/peer_store_resolver.py diff --git a/chia/server/rate_limit_numbers.py b/flax/server/rate_limit_numbers.py similarity index 98% rename from chia/server/rate_limit_numbers.py rename to flax/server/rate_limit_numbers.py index fb8b67769..6655b0718 100644 --- a/chia/server/rate_limit_numbers.py +++ b/flax/server/rate_limit_numbers.py @@ -6,8 +6,8 @@ import functools from typing import Any, Dict, List, Optional -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.shared_protocol import Capability +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.shared_protocol import Capability compose_rate_limits_cache: Dict[int, Dict[str, Any]] = {} @@ -54,7 +54,7 @@ def compose_rate_limits(old_rate_limits: Dict[str, Any], new_rate_limits: Dict[s # Each number in this dict corresponds to a specific version of rate limits (1, 2, etc). -# Version 1 includes the original limits for chia software from versions 1.0 to 1.4. +# Version 1 includes the original limits for flax software from versions 1.0 to 1.4. rate_limits = { 1: { "default_settings": RLSettings(100, 1024 * 1024, 100 * 1024 * 1024), diff --git a/chia/server/rate_limits.py b/flax/server/rate_limits.py similarity index 95% rename from chia/server/rate_limits.py rename to flax/server/rate_limits.py index 1b2ab6cde..4a56d391c 100644 --- a/chia/server/rate_limits.py +++ b/flax/server/rate_limits.py @@ -6,10 +6,10 @@ from collections import Counter from typing import Dict, List -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.shared_protocol import Capability -from chia.server.outbound_message import Message -from chia.server.rate_limit_numbers import RLSettings, get_rate_limits_to_use +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.shared_protocol import Capability +from flax.server.outbound_message import Message +from flax.server.rate_limit_numbers import RLSettings, get_rate_limits_to_use log = logging.getLogger(__name__) diff --git a/chia/server/reconnect_task.py b/flax/server/reconnect_task.py similarity index 85% rename from chia/server/reconnect_task.py rename to flax/server/reconnect_task.py index f79442e8d..ec500c720 100644 --- a/chia/server/reconnect_task.py +++ b/flax/server/reconnect_task.py @@ -2,12 +2,12 @@ from typing import Optional -from chia.server.server import ChiaServer -from chia.types.peer_info import PeerInfo -from chia.util.network import get_host_addr +from flax.server.server import FlaxServer +from flax.types.peer_info import PeerInfo +from flax.util.network import get_host_addr -def start_reconnect_task(server: ChiaServer, peer_info_arg: PeerInfo, log, prefer_ipv6: Optional[bool]): +def start_reconnect_task(server: FlaxServer, peer_info_arg: PeerInfo, log, prefer_ipv6: Optional[bool]): """ Start a background task that checks connection and reconnects periodically to a peer. """ diff --git a/chia/server/server.py b/flax/server/server.py similarity index 94% rename from chia/server/server.py rename to flax/server/server.py index 0c7ec23e1..44326e749 100644 --- a/chia/server/server.py +++ b/flax/server/server.py @@ -26,21 +26,21 @@ from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes, serialization -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.protocol_state_machine import message_requires_reply -from chia.protocols.protocol_timing import API_EXCEPTION_BAN_SECONDS, INVALID_PROTOCOL_BAN_SECONDS -from chia.protocols.shared_protocol import protocol_version -from chia.server.introducer_peers import IntroducerPeers -from chia.server.outbound_message import Message, NodeType -from chia.server.ssl_context import private_ssl_paths, public_ssl_paths -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.api_decorators import get_metadata -from chia.util.errors import Err, ProtocolError -from chia.util.ints import uint16 -from chia.util.network import WebServer, is_in_network, is_localhost -from chia.util.ssl_check import verify_ssl_certs_and_keys +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.protocol_state_machine import message_requires_reply +from flax.protocols.protocol_timing import API_EXCEPTION_BAN_SECONDS, INVALID_PROTOCOL_BAN_SECONDS +from flax.protocols.shared_protocol import protocol_version +from flax.server.introducer_peers import IntroducerPeers +from flax.server.outbound_message import Message, NodeType +from flax.server.ssl_context import private_ssl_paths, public_ssl_paths +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.api_decorators import get_metadata +from flax.util.errors import Err, ProtocolError +from flax.util.ints import uint16 +from flax.util.network import WebServer, is_in_network, is_localhost +from flax.util.ssl_check import verify_ssl_certs_and_keys max_message_size = 50 * 1024 * 1024 # 50MB @@ -115,7 +115,7 @@ def calculate_node_id(cert_path: Path) -> bytes32: return bytes32(der_cert.fingerprint(hashes.SHA256())) -class ChiaServer: +class FlaxServer: def __init__( self, port: int, @@ -130,11 +130,11 @@ def __init__( root_path: Path, config: Dict, private_ca_crt_key: Tuple[Path, Path], - chia_ca_crt_key: Tuple[Path, Path], + flax_ca_crt_key: Tuple[Path, Path], name: str = None, ): # Keeps track of all connections to and from this node. - self.all_connections: Dict[bytes32, WSChiaConnection] = {} + self.all_connections: Dict[bytes32, WSFlaxConnection] = {} self._port = port # TCP port to identify our node self._local_type: NodeType = local_type @@ -160,7 +160,7 @@ def __init__( self.introducer_peers = IntroducerPeers() ca_private_crt_path, ca_private_key_path = private_ca_crt_key - chia_ca_crt_path, chia_ca_key_path = chia_ca_crt_key + flax_ca_crt_path, flax_ca_key_path = flax_ca_crt_key private_cert_path, private_key_path = None, None public_cert_path, public_key_path = None, None @@ -178,7 +178,7 @@ def __init__( # Public clients public_cert_path, public_key_path = public_ssl_paths(root_path, config) self.ssl_client_context = ssl_context_for_client( - chia_ca_crt_path, chia_ca_key_path, public_cert_path, public_key_path + flax_ca_crt_path, flax_ca_key_path, public_cert_path, public_key_path ) if self._local_type in authenticated_server_types: @@ -195,7 +195,7 @@ def __init__( # Public servers public_cert_path, public_key_path = public_ssl_paths(root_path, config) self.ssl_context = ssl_context_for_server( - chia_ca_crt_path, chia_ca_key_path, public_cert_path, public_key_path, log=self.log + flax_ca_crt_path, flax_ca_key_path, public_cert_path, public_key_path, log=self.log ) # If node has public cert use that one for id, if not use private. @@ -229,7 +229,7 @@ async def garbage_collect_connections_task(self) -> None: is_crawler = getattr(self.node, "crawl", None) while True: await asyncio.sleep(600 if is_crawler is None else 2) - to_remove: List[WSChiaConnection] = [] + to_remove: List[WSFlaxConnection] = [] for connection in self.all_connections.values(): if ( self._local_type == NodeType.FULL_NODE or self._local_type == NodeType.WALLET @@ -254,7 +254,7 @@ async def garbage_collect_connections_task(self) -> None: async def start_server(self, prefer_ipv6: bool, on_connect: Callable = None): if self.webserver is not None: - raise RuntimeError("ChiaServer already started") + raise RuntimeError("FlaxServer already started") if self.incoming_task is None: self.incoming_task = asyncio.create_task(self.incoming_api_task()) if self.gc_task is None: @@ -295,9 +295,9 @@ async def incoming_connection(self, request): peer_id = bytes32(der_cert.fingerprint(hashes.SHA256())) if peer_id == self.node_id: return ws - connection: Optional[WSChiaConnection] = None + connection: Optional[WSFlaxConnection] = None try: - connection = WSChiaConnection( + connection = WSFlaxConnection( self._local_type, ws, self._port, @@ -358,7 +358,7 @@ async def incoming_connection(self, request): await close_event.wait() return ws - async def connection_added(self, connection: WSChiaConnection, on_connect=None): + async def connection_added(self, connection: WSFlaxConnection, on_connect=None): # If we already had a connection to this peer_id, close the old one. This is secure because peer_ids are based # on TLS public keys if connection.peer_node_id in self.all_connections: @@ -400,7 +400,7 @@ async def start_client( return False session = None - connection: Optional[WSChiaConnection] = None + connection: Optional[WSFlaxConnection] = None try: # Crawler/DNS introducer usually uses a lower timeout than the default timeout_value = float(self.config.get("peer_connect_timeout", 30)) @@ -445,7 +445,7 @@ async def start_client( if peer_id == self.node_id: raise RuntimeError(f"Trying to connect to a peer ({target_node}) with the same peer_id: {peer_id}") - connection = WSChiaConnection( + connection = WSFlaxConnection( self._local_type, ws, self._port, @@ -498,7 +498,7 @@ async def start_client( return False - def connection_closed(self, connection: WSChiaConnection, ban_time: int): + def connection_closed(self, connection: WSFlaxConnection, ban_time: int): if is_localhost(connection.peer_host) and ban_time != 0: self.log.warning(f"Trying to ban localhost for {ban_time}, but will not ban") ban_time = 0 @@ -543,7 +543,7 @@ async def incoming_api_task(self) -> None: if payload_inc is None or connection_inc is None: continue - async def api_call(full_message: Message, connection: WSChiaConnection, task_id): + async def api_call(full_message: Message, connection: WSFlaxConnection, task_id): nonlocal message_types start_time = time.time() message_type = "" @@ -639,7 +639,7 @@ async def send_to_others( self, messages: List[Message], node_type: NodeType, - origin_peer: WSChiaConnection, + origin_peer: WSFlaxConnection, ): for node_id, connection in self.all_connections.items(): if node_id == origin_peer.peer_node_id: @@ -682,7 +682,7 @@ async def send_to_specific(self, messages: List[Message], node_id: bytes32): for message in messages: await connection.send_message(message) - def get_outgoing_connections(self) -> List[WSChiaConnection]: + def get_outgoing_connections(self) -> List[WSFlaxConnection]: result = [] for _, connection in self.all_connections.items(): if connection.is_outbound: @@ -690,7 +690,7 @@ def get_outgoing_connections(self) -> List[WSChiaConnection]: return result - def get_full_node_outgoing_connections(self) -> List[WSChiaConnection]: + def get_full_node_outgoing_connections(self) -> List[WSFlaxConnection]: result = [] connections = self.get_connections(NodeType.FULL_NODE) for connection in connections: @@ -698,7 +698,7 @@ def get_full_node_outgoing_connections(self) -> List[WSChiaConnection]: result.append(connection) return result - def get_connections(self, node_type: Optional[NodeType] = None) -> List[WSChiaConnection]: + def get_connections(self, node_type: Optional[NodeType] = None) -> List[WSFlaxConnection]: result = [] for _, connection in self.all_connections.items(): if node_type is None or connection.connection_type == node_type: @@ -743,11 +743,11 @@ async def get_peer_info(self) -> Optional[PeerInfo]: ip = None port = self._port - # Use chia's service first. + # Use flax's service first. try: timeout = ClientTimeout(total=15) async with ClientSession(timeout=timeout) as session: - async with session.get("https://ip.chia.net/") as resp: + async with session.get("https://ip.flaxnetwork.org/") as resp: if resp.status == 200: ip = str(await resp.text()) ip = ip.rstrip() @@ -789,7 +789,7 @@ def accept_inbound_connections(self, node_type: NodeType) -> bool: return inbound_count < self.config["max_inbound_timelord"] return True - def is_trusted_peer(self, peer: WSChiaConnection, trusted_peers: Dict) -> bool: + def is_trusted_peer(self, peer: WSFlaxConnection, trusted_peers: Dict) -> bool: if trusted_peers is None: return False if not self.config["testing"] and peer.peer_host == "127.0.0.1": diff --git a/chia/server/ssl_context.py b/flax/server/ssl_context.py similarity index 80% rename from chia/server/ssl_context.py rename to flax/server/ssl_context.py index 4491615e3..70ae2309d 100644 --- a/chia/server/ssl_context.py +++ b/flax/server/ssl_context.py @@ -25,8 +25,8 @@ def private_ssl_ca_paths(path: Path, config: Dict): ) -def chia_ssl_ca_paths(path: Path, config: Dict): +def flax_ssl_ca_paths(path: Path, config: Dict): return ( - path / config["chia_ssl_ca"]["crt"], - path / config["chia_ssl_ca"]["key"], + path / config["flax_ssl_ca"]["crt"], + path / config["flax_ssl_ca"]["key"], ) diff --git a/chia/server/start_data_layer.py b/flax/server/start_data_layer.py similarity index 82% rename from chia/server/start_data_layer.py rename to flax/server/start_data_layer.py index 007edb244..b4f6dde6e 100644 --- a/chia/server/start_data_layer.py +++ b/flax/server/start_data_layer.py @@ -5,18 +5,18 @@ import sys from typing import Any, Dict, Optional, cast -from chia.cmds.init_funcs import create_all_ssl -from chia.data_layer.data_layer import DataLayer -from chia.data_layer.data_layer_api import DataLayerAPI -from chia.rpc.data_layer_rpc_api import DataLayerRpcApi -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.server.outbound_message import NodeType -from chia.server.start_service import RpcInfo, Service, async_run -from chia.server.start_wallet import WalletNode -from chia.util.chia_logging import initialize_logging -from chia.util.config import load_config, load_config_cli -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint16 +from flax.cmds.init_funcs import create_all_ssl +from flax.data_layer.data_layer import DataLayer +from flax.data_layer.data_layer_api import DataLayerAPI +from flax.rpc.data_layer_rpc_api import DataLayerRpcApi +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.server.outbound_message import NodeType +from flax.server.start_service import RpcInfo, Service, async_run +from flax.server.start_wallet import WalletNode +from flax.util.flax_logging import initialize_logging +from flax.util.config import load_config, load_config_cli +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint16 # See: https://bugs.python.org/issue29288 "".encode("idna") diff --git a/chia/server/start_farmer.py b/flax/server/start_farmer.py similarity index 79% rename from chia/server/start_farmer.py rename to flax/server/start_farmer.py index d75cd013b..31ad9713b 100644 --- a/chia/server/start_farmer.py +++ b/flax/server/start_farmer.py @@ -4,18 +4,18 @@ import sys from typing import Dict, Optional -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.farmer.farmer import Farmer -from chia.farmer.farmer_api import FarmerAPI -from chia.rpc.farmer_rpc_api import FarmerRpcApi -from chia.server.outbound_message import NodeType -from chia.server.start_service import RpcInfo, Service, async_run -from chia.types.peer_info import PeerInfo -from chia.util.chia_logging import initialize_service_logging -from chia.util.config import load_config, load_config_cli -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.keychain import Keychain +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.farmer.farmer import Farmer +from flax.farmer.farmer_api import FarmerAPI +from flax.rpc.farmer_rpc_api import FarmerRpcApi +from flax.server.outbound_message import NodeType +from flax.server.start_service import RpcInfo, Service, async_run +from flax.types.peer_info import PeerInfo +from flax.util.flax_logging import initialize_service_logging +from flax.util.config import load_config, load_config_cli +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.keychain import Keychain # See: https://bugs.python.org/issue29288 "".encode("idna") diff --git a/chia/server/start_full_node.py b/flax/server/start_full_node.py similarity index 78% rename from chia/server/start_full_node.py rename to flax/server/start_full_node.py index 6a07dd611..2fe0389d0 100644 --- a/chia/server/start_full_node.py +++ b/flax/server/start_full_node.py @@ -7,17 +7,17 @@ from multiprocessing import freeze_support from typing import Dict, List, Optional, Tuple -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.full_node.full_node import FullNode -from chia.full_node.full_node_api import FullNodeAPI -from chia.rpc.full_node_rpc_api import FullNodeRpcApi -from chia.server.outbound_message import NodeType -from chia.server.start_service import RpcInfo, Service, async_run -from chia.util.chia_logging import initialize_service_logging -from chia.util.config import load_config, load_config_cli -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint16 +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.full_node.full_node import FullNode +from flax.full_node.full_node_api import FullNodeAPI +from flax.rpc.full_node_rpc_api import FullNodeRpcApi +from flax.server.outbound_message import NodeType +from flax.server.start_service import RpcInfo, Service, async_run +from flax.util.flax_logging import initialize_service_logging +from flax.util.config import load_config, load_config_cli +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint16 # See: https://bugs.python.org/issue29288 "".encode("idna") @@ -84,10 +84,10 @@ async def async_main() -> int: def main() -> int: freeze_support() - if os.getenv("CHIA_INSTRUMENT_NODE", 0) != 0: + if os.getenv("FLAX_INSTRUMENT_NODE", 0) != 0: import atexit - from chia.util.task_timing import start_task_instrumentation, stop_task_instrumentation + from flax.util.task_timing import start_task_instrumentation, stop_task_instrumentation start_task_instrumentation() atexit.register(stop_task_instrumentation) diff --git a/chia/server/start_harvester.py b/flax/server/start_harvester.py similarity index 78% rename from chia/server/start_harvester.py rename to flax/server/start_harvester.py index 064319c1b..35cff3667 100644 --- a/chia/server/start_harvester.py +++ b/flax/server/start_harvester.py @@ -4,17 +4,17 @@ import sys from typing import Dict, Optional -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.harvester.harvester import Harvester -from chia.harvester.harvester_api import HarvesterAPI -from chia.rpc.harvester_rpc_api import HarvesterRpcApi -from chia.server.outbound_message import NodeType -from chia.server.start_service import RpcInfo, Service, async_run -from chia.types.peer_info import PeerInfo -from chia.util.chia_logging import initialize_service_logging -from chia.util.config import load_config, load_config_cli -from chia.util.default_root import DEFAULT_ROOT_PATH +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.harvester.harvester import Harvester +from flax.harvester.harvester_api import HarvesterAPI +from flax.rpc.harvester_rpc_api import HarvesterRpcApi +from flax.server.outbound_message import NodeType +from flax.server.start_service import RpcInfo, Service, async_run +from flax.types.peer_info import PeerInfo +from flax.util.flax_logging import initialize_service_logging +from flax.util.config import load_config, load_config_cli +from flax.util.default_root import DEFAULT_ROOT_PATH # See: https://bugs.python.org/issue29288 "".encode("idna") diff --git a/chia/server/start_introducer.py b/flax/server/start_introducer.py similarity index 81% rename from chia/server/start_introducer.py rename to flax/server/start_introducer.py index da6b2c596..6703a0c27 100644 --- a/chia/server/start_introducer.py +++ b/flax/server/start_introducer.py @@ -4,13 +4,13 @@ import sys from typing import Dict, Optional -from chia.introducer.introducer import Introducer -from chia.introducer.introducer_api import IntroducerAPI -from chia.server.outbound_message import NodeType -from chia.server.start_service import Service, async_run -from chia.util.chia_logging import initialize_service_logging -from chia.util.config import load_config, load_config_cli -from chia.util.default_root import DEFAULT_ROOT_PATH +from flax.introducer.introducer import Introducer +from flax.introducer.introducer_api import IntroducerAPI +from flax.server.outbound_message import NodeType +from flax.server.start_service import Service, async_run +from flax.util.flax_logging import initialize_service_logging +from flax.util.config import load_config, load_config_cli +from flax.util.default_root import DEFAULT_ROOT_PATH # See: https://bugs.python.org/issue29288 "".encode("idna") diff --git a/chia/server/start_service.py b/flax/server/start_service.py similarity index 91% rename from chia/server/start_service.py rename to flax/server/start_service.py index 3d4d93b02..27bf4241e 100644 --- a/chia/server/start_service.py +++ b/flax/server/start_service.py @@ -7,9 +7,9 @@ import sys from typing import Any, Callable, Coroutine, Dict, Generic, List, Optional, Tuple, Type, TypeVar -from chia.daemon.server import service_launch_lock_path -from chia.util.lock import Lockfile, LockfileError -from chia.server.ssl_context import chia_ssl_ca_paths, private_ssl_ca_paths +from flax.daemon.server import service_launch_lock_path +from flax.util.lock import Lockfile, LockfileError +from flax.server.ssl_context import flax_ssl_ca_paths, private_ssl_ca_paths from ..protocols.shared_protocol import capabilities try: @@ -17,14 +17,14 @@ except ImportError: uvloop = None -from chia.cmds.init_funcs import chia_full_version_str -from chia.rpc.rpc_server import RpcApiProtocol, RpcServiceProtocol, start_rpc_server, RpcServer -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer -from chia.server.upnp import UPnP -from chia.types.peer_info import PeerInfo -from chia.util.setproctitle import setproctitle -from chia.util.ints import uint16 +from flax.cmds.init_funcs import flax_full_version_str +from flax.rpc.rpc_server import RpcApiProtocol, RpcServiceProtocol, start_rpc_server, RpcServer +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer +from flax.server.upnp import UPnP +from flax.types.peer_info import PeerInfo +from flax.util.setproctitle import setproctitle +from flax.util.ints import uint16 from .reconnect_task import start_reconnect_task @@ -79,13 +79,13 @@ def __init__( self.max_request_body_size = max_request_body_size self._log = logging.getLogger(service_name) - self._log.info(f"chia-blockchain version: {chia_full_version_str()}") + self._log.info(f"flax-blockchain version: {flax_full_version_str()}") self.service_config = self.config[service_name] self._rpc_info = rpc_info private_ca_crt, private_ca_key = private_ssl_ca_paths(root_path, self.config) - chia_ca_crt, chia_ca_key = chia_ssl_ca_paths(root_path, self.config) + flax_ca_crt, flax_ca_key = flax_ssl_ca_paths(root_path, self.config) inbound_rlp = self.config.get("inbound_rate_limit_percent") outbound_rlp = self.config.get("outbound_rate_limit_percent") if node_type == NodeType.WALLET: @@ -96,7 +96,7 @@ def __init__( capabilities_to_use = override_capabilities assert inbound_rlp and outbound_rlp - self._server = ChiaServer( + self._server = FlaxServer( advertised_port, node, peer_api, @@ -109,7 +109,7 @@ def __init__( root_path, self.service_config, (private_ca_crt, private_ca_key), - (chia_ca_crt, chia_ca_key), + (flax_ca_crt, flax_ca_key), name=f"{service_name}_server", ) f = getattr(node, "set_server", None) @@ -194,7 +194,7 @@ def add_peer(self, peer: PeerInfo) -> None: async def setup_process_global_state(self) -> None: # Being async forces this to be run from within an active event loop as is # needed for the signal handler setup. - proctitle_name = f"chia_{self._service_name}" + proctitle_name = f"flax_{self._service_name}" setproctitle(proctitle_name) global main_pid @@ -256,7 +256,7 @@ async def wait_closed(self) -> None: self._log.info("Waiting for socket to be closed (if opened)") - self._log.info("Waiting for ChiaServer to be closed") + self._log.info("Waiting for FlaxServer to be closed") await self._server.await_closed() if self.rpc_server: diff --git a/chia/server/start_timelord.py b/flax/server/start_timelord.py similarity index 77% rename from chia/server/start_timelord.py rename to flax/server/start_timelord.py index 94b11da02..63280bddc 100644 --- a/chia/server/start_timelord.py +++ b/flax/server/start_timelord.py @@ -5,17 +5,17 @@ import sys from typing import Dict, Optional -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.rpc.timelord_rpc_api import TimelordRpcApi -from chia.server.outbound_message import NodeType -from chia.server.start_service import RpcInfo, Service, async_run -from chia.timelord.timelord import Timelord -from chia.timelord.timelord_api import TimelordAPI -from chia.types.peer_info import PeerInfo -from chia.util.chia_logging import initialize_service_logging -from chia.util.config import load_config, load_config_cli -from chia.util.default_root import DEFAULT_ROOT_PATH +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.rpc.timelord_rpc_api import TimelordRpcApi +from flax.server.outbound_message import NodeType +from flax.server.start_service import RpcInfo, Service, async_run +from flax.timelord.timelord import Timelord +from flax.timelord.timelord_api import TimelordAPI +from flax.types.peer_info import PeerInfo +from flax.util.flax_logging import initialize_service_logging +from flax.util.config import load_config, load_config_cli +from flax.util.default_root import DEFAULT_ROOT_PATH # See: https://bugs.python.org/issue29288 "".encode("idna") diff --git a/chia/server/start_wallet.py b/flax/server/start_wallet.py similarity index 80% rename from chia/server/start_wallet.py rename to flax/server/start_wallet.py index c5e99bae7..4007a2903 100644 --- a/chia/server/start_wallet.py +++ b/flax/server/start_wallet.py @@ -4,20 +4,20 @@ import sys from typing import Dict, Optional -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.rpc.wallet_rpc_api import WalletRpcApi -from chia.server.outbound_message import NodeType -from chia.server.start_service import RpcInfo, Service, async_run -from chia.types.peer_info import PeerInfo -from chia.util.chia_logging import initialize_service_logging -from chia.util.config import load_config_cli, load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.keychain import Keychain -from chia.wallet.wallet_node import WalletNode +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.rpc.wallet_rpc_api import WalletRpcApi +from flax.server.outbound_message import NodeType +from flax.server.start_service import RpcInfo, Service, async_run +from flax.types.peer_info import PeerInfo +from flax.util.flax_logging import initialize_service_logging +from flax.util.config import load_config_cli, load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.keychain import Keychain +from flax.wallet.wallet_node import WalletNode # See: https://bugs.python.org/issue29288 -from chia.wallet.wallet_node_api import WalletNodeAPI +from flax.wallet.wallet_node_api import WalletNodeAPI "".encode("idna") @@ -90,7 +90,7 @@ async def async_main() -> int: # This is simulator local_test = service_config["testing"] if local_test is True: - from chia.simulator.block_tools import test_constants + from flax.simulator.block_tools import test_constants constants = test_constants current = service_config["database_path"] @@ -108,8 +108,8 @@ async def async_main() -> int: def main() -> int: freeze_support() - if os.getenv("CHIA_INSTRUMENT_WALLET", 0) != 0: - from chia.util.task_timing import start_task_instrumentation, stop_task_instrumentation + if os.getenv("FLAX_INSTRUMENT_WALLET", 0) != 0: + from flax.util.task_timing import start_task_instrumentation, stop_task_instrumentation import atexit start_task_instrumentation() diff --git a/chia/server/upnp.py b/flax/server/upnp.py similarity index 93% rename from chia/server/upnp.py rename to flax/server/upnp.py index b43a92d97..e8811a0d4 100644 --- a/chia/server/upnp.py +++ b/flax/server/upnp.py @@ -15,7 +15,7 @@ except ImportError: log.info( "importing miniupnpc failed." - " This is not required to run chia, it allows incoming connections from other peers." + " This is not required to run flax, it allows incoming connections from other peers." ) miniupnpc = None @@ -60,7 +60,7 @@ def _run(self) -> None: self._upnp.deleteportmapping(port, "TCP") except Exception as e: log.info(f"Removal of previous portmapping failed. This does not indicate an error: {e}") - self._upnp.addportmapping(port, "TCP", self._upnp.lanaddr, port, "chia", "") + self._upnp.addportmapping(port, "TCP", self._upnp.lanaddr, port, "flax", "") log.info( f"Port {port} opened with UPnP. lanaddr {self._upnp.lanaddr} " f"external: {self._upnp.externalipaddress()}" @@ -73,7 +73,7 @@ def _run(self) -> None: elif msg[0] == "shutdown": keep_going = False except Exception as e: - log.info("UPnP failed. This is not required to run chia, it allows incoming connections from other peers.") + log.info("UPnP failed. This is not required to run flax, it allows incoming connections from other peers.") log.info(e) def remap(self, port: int) -> None: diff --git a/chia/server/ws_connection.py b/flax/server/ws_connection.py similarity index 95% rename from chia/server/ws_connection.py rename to flax/server/ws_connection.py index 1e771deb9..b2b90c026 100644 --- a/chia/server/ws_connection.py +++ b/flax/server/ws_connection.py @@ -9,26 +9,26 @@ from aiohttp import WSCloseCode, WSMessage, WSMsgType -from chia.cmds.init_funcs import chia_full_version_str -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.protocol_state_machine import message_response_ok -from chia.protocols.protocol_timing import INTERNAL_PROTOCOL_ERROR_BAN_SECONDS -from chia.protocols.shared_protocol import Capability, Handshake -from chia.server.outbound_message import Message, NodeType, make_msg -from chia.server.rate_limits import RateLimiter -from chia.types.peer_info import PeerInfo -from chia.util.api_decorators import get_metadata -from chia.util.errors import Err, ProtocolError -from chia.util.ints import uint8, uint16 +from flax.cmds.init_funcs import flax_full_version_str +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.protocol_state_machine import message_response_ok +from flax.protocols.protocol_timing import INTERNAL_PROTOCOL_ERROR_BAN_SECONDS +from flax.protocols.shared_protocol import Capability, Handshake +from flax.server.outbound_message import Message, NodeType, make_msg +from flax.server.rate_limits import RateLimiter +from flax.types.peer_info import PeerInfo +from flax.util.api_decorators import get_metadata +from flax.util.errors import Err, ProtocolError +from flax.util.ints import uint8, uint16 # Each message is prepended with LENGTH_BYTES bytes specifying the length -from chia.util.network import class_for_type, is_localhost +from flax.util.network import class_for_type, is_localhost # Max size 2^(8*4) which is around 4GiB LENGTH_BYTES: int = 4 -class WSChiaConnection: +class WSFlaxConnection: """ Represents a connection to another node. Local host and port are ours, while peer host and port are the host and port of the peer that we are connected to. Node_id and connection_type are @@ -80,7 +80,7 @@ def __init__( self.is_outbound = is_outbound self.is_feeler = is_feeler - # ChiaConnection metrics + # FlaxConnection metrics self.creation_time = time.time() self.bytes_read = 0 self.bytes_written = 0 @@ -113,7 +113,7 @@ def __init__( self.outbound_rate_limiter = RateLimiter(incoming=False, percentage_of_limit=outbound_rate_limit_percent) self.inbound_rate_limiter = RateLimiter(incoming=True, percentage_of_limit=inbound_rate_limit_percent) self.peer_capabilities: List[Capability] = [] - # Used by the Chia Seeder. + # Used by the Flax Seeder. self.version = "" self.protocol_version = "" @@ -128,9 +128,9 @@ async def perform_handshake( outbound_handshake = make_msg( ProtocolMessageTypes.handshake, Handshake( - network_id, + 'flax-' + network_id, protocol_version, - chia_full_version_str(), + flax_full_version_str(), uint16(server_port), uint8(local_type.value), self.local_capabilities_for_handshake, @@ -152,7 +152,7 @@ async def perform_handshake( if message_type != ProtocolMessageTypes.handshake: raise ProtocolError(Err.INVALID_HANDSHAKE) - if inbound_handshake.network_id != network_id: + if inbound_handshake.network_id != 'flax-' + network_id: raise ProtocolError(Err.INCOMPATIBLE_NETWORK_ID) self.version = inbound_handshake.software_version @@ -180,14 +180,14 @@ async def perform_handshake( raise ProtocolError(Err.INVALID_HANDSHAKE) inbound_handshake = Handshake.from_bytes(message.data) - if inbound_handshake.network_id != network_id: + if inbound_handshake.network_id != 'flax-' + network_id: raise ProtocolError(Err.INCOMPATIBLE_NETWORK_ID) outbound_handshake = make_msg( ProtocolMessageTypes.handshake, Handshake( - network_id, + 'flax-' + network_id, protocol_version, - chia_full_version_str(), + flax_full_version_str(), uint16(server_port), uint8(local_type.value), self.local_capabilities_for_handshake, @@ -497,7 +497,7 @@ async def _read_one_message(self) -> Optional[Message]: await asyncio.sleep(3) return None - # Used by the Chia Seeder. + # Used by the Flax Seeder. def get_version(self) -> str: return self.version diff --git a/chia/simulator/__init__.py b/flax/simulator/__init__.py similarity index 100% rename from chia/simulator/__init__.py rename to flax/simulator/__init__.py diff --git a/chia/simulator/block_tools.py b/flax/simulator/block_tools.py similarity index 96% rename from chia/simulator/block_tools.py rename to flax/simulator/block_tools.py index 18a4a6621..b5edd05e4 100644 --- a/chia/simulator/block_tools.py +++ b/flax/simulator/block_tools.py @@ -20,88 +20,88 @@ from chia_rs import compute_merkle_set_root from chiabip158 import PyBIP158 -from chia.cmds.init_funcs import create_all_ssl, create_default_chia_config -from chia.consensus.block_creation import unfinished_block_to_full_block -from chia.consensus.block_record import BlockRecord -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.coinbase import create_farmer_coin, create_pool_coin, create_puzzlehash_for_pk -from chia.consensus.condition_costs import ConditionCost -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.consensus.deficit import calculate_deficit -from chia.consensus.full_block_to_block_record import block_to_block_record -from chia.consensus.make_sub_epoch_summary import next_sub_epoch_summary -from chia.consensus.pot_iterations import ( +from flax.cmds.init_funcs import create_all_ssl, create_default_flax_config +from flax.consensus.block_creation import unfinished_block_to_full_block +from flax.consensus.block_record import BlockRecord +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.coinbase import create_farmer_coin, create_pool_coin, create_puzzlehash_for_pk +from flax.consensus.condition_costs import ConditionCost +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.consensus.deficit import calculate_deficit +from flax.consensus.full_block_to_block_record import block_to_block_record +from flax.consensus.make_sub_epoch_summary import next_sub_epoch_summary +from flax.consensus.pot_iterations import ( calculate_ip_iters, calculate_iterations_quality, calculate_sp_interval_iters, calculate_sp_iters, is_overflow_block, ) -from chia.consensus.vdf_info_computation import get_signage_point_vdf_info -from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain -from chia.full_node.bundle_tools import ( +from flax.consensus.vdf_info_computation import get_signage_point_vdf_info +from flax.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain +from flax.full_node.bundle_tools import ( best_solution_generator_from_template, detect_potential_template_generator, simple_solution_generator, ) -from chia.full_node.generator import setup_generator_args -from chia.full_node.mempool_check_conditions import GENERATOR_MOD -from chia.full_node.signage_point import SignagePoint -from chia.plotting.create_plots import PlotKeys, create_plots -from chia.plotting.manager import PlotManager -from chia.plotting.util import ( +from flax.full_node.generator import setup_generator_args +from flax.full_node.mempool_check_conditions import GENERATOR_MOD +from flax.full_node.signage_point import SignagePoint +from flax.plotting.create_plots import PlotKeys, create_plots +from flax.plotting.manager import PlotManager +from flax.plotting.util import ( PlotRefreshEvents, PlotRefreshResult, PlotsRefreshParameter, add_plot_directory, parse_plot_info, ) -from chia.server.server import ssl_context_for_client -from chia.simulator.socket import find_available_listen_port -from chia.simulator.ssl_certs import ( +from flax.server.server import ssl_context_for_client +from flax.simulator.socket import find_available_listen_port +from flax.simulator.ssl_certs import ( SSLTestCACertAndPrivateKey, SSLTestCollateralWrapper, SSLTestNodeCertsAndKeys, get_next_nodes_certs_and_keys, get_next_private_ca_cert_and_key, ) -from chia.simulator.time_out_assert import time_out_assert_custom_interval -from chia.simulator.wallet_tools import WalletTool -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.coin import Coin, hash_coin_ids -from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.program import INFINITE_COST -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.slots import ( +from flax.simulator.time_out_assert import time_out_assert_custom_interval +from flax.simulator.wallet_tools import WalletTool +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.coin import Coin, hash_coin_ids +from flax.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.program import INFINITE_COST +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.slots import ( ChallengeChainSubSlot, InfusedChallengeChainSubSlot, RewardChainSubSlot, SubSlotProofs, ) -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator, CompressorArg -from chia.types.spend_bundle import SpendBundle -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.bech32m import encode_puzzle_hash -from chia.util.block_cache import BlockCache -from chia.util.config import config_path_for_filename, load_config, lock_config, override_config, save_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.errors import Err -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint16, uint32, uint64, uint128 -from chia.util.keychain import Keychain, bytes_to_mnemonic -from chia.util.prev_transaction_block import get_prev_transaction_block -from chia.util.vdf_prover import get_vdf_info_and_proof -from chia.wallet.derive_keys import ( +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator, CompressorArg +from flax.types.spend_bundle import SpendBundle +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.bech32m import encode_puzzle_hash +from flax.util.block_cache import BlockCache +from flax.util.config import config_path_for_filename, load_config, lock_config, override_config, save_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.errors import Err +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint16, uint32, uint64, uint128 +from flax.util.keychain import Keychain, bytes_to_mnemonic +from flax.util.prev_transaction_block import get_prev_transaction_block +from flax.util.vdf_prover import get_vdf_info_and_proof +from flax.wallet.derive_keys import ( master_sk_to_farmer_sk, master_sk_to_local_sk, master_sk_to_pool_sk, @@ -180,7 +180,7 @@ def __init__( self.ssl_nodes_certs_and_keys_wrapper: SSLTestCollateralWrapper[ SSLTestNodeCertsAndKeys ] = get_next_nodes_certs_and_keys() - create_default_chia_config(root_path) + create_default_flax_config(root_path) create_all_ssl( root_path, private_ca_crt_and_key=self.ssl_ca_cert_and_key_wrapper.collateral.cert_and_key, @@ -260,7 +260,7 @@ async def setup_keys(self, fingerprint: Optional[int] = None, reward_ph: Optiona keychain_proxy = await connect_to_keychain_and_validate(self.root_path, self.log) else: # if we are automated testing or if we don't have a fingerprint. keychain_proxy = await connect_to_keychain_and_validate( - self.root_path, self.log, user="testing-1.8.0", service="chia-testing-1.8.0" + self.root_path, self.log, user="testing-1.8.0", service="flax-testing-1.8.0" ) assert keychain_proxy is not None if fingerprint is None: # if we are not specifying an existing key @@ -296,7 +296,7 @@ async def setup_keys(self, fingerprint: Optional[int] = None, reward_ph: Optiona self.farmer_pubkeys: List[G1Element] = [master_sk_to_farmer_sk(sk).get_g1() for sk in self.all_sks] if len(self.pool_pubkeys) == 0 or len(self.farmer_pubkeys) == 0: - raise RuntimeError("Keys not generated. Run `chia keys generate`") + raise RuntimeError("Keys not generated. Run `flax keys generate`") self.plot_manager.set_public_keys(self.farmer_pubkeys, self.pool_pubkeys) await keychain_proxy.close() # close the keychain proxy @@ -382,7 +382,7 @@ async def new_plot( if pool_contract_puzzle_hash is None: pool_pk = self.pool_pk else: - pool_address = encode_puzzle_hash(pool_contract_puzzle_hash, "xch") + pool_address = encode_puzzle_hash(pool_contract_puzzle_hash, "xfx") plot_keys = PlotKeys(self.farmer_pk, pool_pk, pool_address) # No datetime in the filename, to get deterministic filenames and not re-plot diff --git a/chia/simulator/full_node_simulator.py b/flax/simulator/full_node_simulator.py similarity index 95% rename from chia/simulator/full_node_simulator.py rename to flax/simulator/full_node_simulator.py index 007a1cd3d..99276760c 100644 --- a/chia/simulator/full_node_simulator.py +++ b/flax/simulator/full_node_simulator.py @@ -5,25 +5,25 @@ import time from typing import Any, Collection, Dict, Iterator, List, Optional, Set, Tuple -from chia.consensus.block_record import BlockRecord -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.consensus.multiprocess_validation import PreValidationResult -from chia.full_node.full_node import FullNode -from chia.full_node.full_node_api import FullNodeAPI -from chia.protocols.full_node_protocol import RespondBlock -from chia.rpc.rpc_server import default_get_connections -from chia.server.outbound_message import NodeType -from chia.simulator.block_tools import BlockTools -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, GetAllCoinsProtocol, ReorgProtocol -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_record import CoinRecord -from chia.types.full_block import FullBlock -from chia.util.config import lock_and_load_config, save_config -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.wallet_types import AmountWithPuzzlehash -from chia.wallet.wallet import Wallet +from flax.consensus.block_record import BlockRecord +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.consensus.multiprocess_validation import PreValidationResult +from flax.full_node.full_node import FullNode +from flax.full_node.full_node_api import FullNodeAPI +from flax.protocols.full_node_protocol import RespondBlock +from flax.rpc.rpc_server import default_get_connections +from flax.server.outbound_message import NodeType +from flax.simulator.block_tools import BlockTools +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, GetAllCoinsProtocol, ReorgProtocol +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_record import CoinRecord +from flax.types.full_block import FullBlock +from flax.util.config import lock_and_load_config, save_config +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.wallet_types import AmountWithPuzzlehash +from flax.wallet.wallet import Wallet def backoff_times( @@ -288,7 +288,7 @@ async def reorg_from_index_to_new_index(self, request: ReorgProtocol): async def process_blocks(self, count: int, farm_to: bytes32 = bytes32([0] * 32)) -> int: """Process the requested number of blocks including farming to the passed puzzle hash. Note that the rewards for the last block will not have been processed. - Consider `.farm_blocks()` or `.farm_rewards()` if the goal is to receive XCH at + Consider `.farm_blocks()` or `.farm_rewards()` if the goal is to receive XFX at an address. Arguments: diff --git a/chia/simulator/simulator_constants.py b/flax/simulator/simulator_constants.py similarity index 75% rename from chia/simulator/simulator_constants.py rename to flax/simulator/simulator_constants.py index cbb987b23..c417566e5 100644 --- a/chia/simulator/simulator_constants.py +++ b/flax/simulator/simulator_constants.py @@ -1,6 +1,6 @@ if __name__ == "__main__": - from chia.util.default_root import DEFAULT_ROOT_PATH - from chia.simulator.block_tools import create_block_tools, test_constants + from flax.util.default_root import DEFAULT_ROOT_PATH + from flax.simulator.block_tools import create_block_tools, test_constants from tests.util.keyring import TempKeyring with TempKeyring() as keychain: diff --git a/chia/simulator/simulator_full_node_rpc_api.py b/flax/simulator/simulator_full_node_rpc_api.py similarity index 92% rename from chia/simulator/simulator_full_node_rpc_api.py rename to flax/simulator/simulator_full_node_rpc_api.py index 87234892e..34701a6a8 100644 --- a/chia/simulator/simulator_full_node_rpc_api.py +++ b/flax/simulator/simulator_full_node_rpc_api.py @@ -3,14 +3,14 @@ from secrets import token_bytes from typing import Dict, List -from chia.rpc.full_node_rpc_api import FullNodeRpcApi -from chia.rpc.rpc_server import Endpoint, EndpointResult -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, GetAllCoinsProtocol, ReorgProtocol -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_record import CoinRecord -from chia.types.full_block import FullBlock -from chia.util.bech32m import decode_puzzle_hash -from chia.util.ints import uint32 +from flax.rpc.full_node_rpc_api import FullNodeRpcApi +from flax.rpc.rpc_server import Endpoint, EndpointResult +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, GetAllCoinsProtocol, ReorgProtocol +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_record import CoinRecord +from flax.types.full_block import FullBlock +from flax.util.bech32m import decode_puzzle_hash +from flax.util.ints import uint32 class SimulatorFullNodeRpcApi(FullNodeRpcApi): diff --git a/chia/simulator/simulator_full_node_rpc_client.py b/flax/simulator/simulator_full_node_rpc_client.py similarity index 86% rename from chia/simulator/simulator_full_node_rpc_client.py rename to flax/simulator/simulator_full_node_rpc_client.py index c5876bc06..8e6dbebb7 100644 --- a/chia/simulator/simulator_full_node_rpc_client.py +++ b/flax/simulator/simulator_full_node_rpc_client.py @@ -2,13 +2,13 @@ from typing import Dict, List, Tuple -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_record import CoinRecord -from chia.types.full_block import FullBlock -from chia.util.bech32m import encode_puzzle_hash -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint128 +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_record import CoinRecord +from flax.types.full_block import FullBlock +from flax.util.bech32m import encode_puzzle_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint128 class SimulatorFullNodeRpcClient(FullNodeRpcClient): @@ -17,7 +17,7 @@ async def get_all_blocks(self) -> List[FullBlock]: return [FullBlock.from_json_dict(block) for block in json_blocks] async def farm_block(self, target_ph: bytes32, number_of_blocks: int = 1, guarantee_tx_block: bool = False) -> int: - address = encode_puzzle_hash(target_ph, "txch") + address = encode_puzzle_hash(target_ph, "txfx") request_args = {"address": address, "blocks": number_of_blocks, "guarantee_tx_block": guarantee_tx_block} new_height: int = (await self.fetch("farm_block", request_args))["new_peak_height"] return new_height diff --git a/chia/simulator/simulator_protocol.py b/flax/simulator/simulator_protocol.py similarity index 75% rename from chia/simulator/simulator_protocol.py rename to flax/simulator/simulator_protocol.py index 725ed8e99..8bf7bbb2c 100644 --- a/chia/simulator/simulator_protocol.py +++ b/flax/simulator/simulator_protocol.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from typing import Optional -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/simulator/simulator_test_tools.py b/flax/simulator/simulator_test_tools.py similarity index 68% rename from chia/simulator/simulator_test_tools.py rename to flax/simulator/simulator_test_tools.py index 732303fce..3be9d968f 100644 --- a/chia/simulator/simulator_test_tools.py +++ b/flax/simulator/simulator_test_tools.py @@ -8,26 +8,26 @@ from blspy import PrivateKey -from chia.cmds.init_funcs import create_all_ssl -from chia.consensus.coinbase import create_puzzlehash_for_pk -from chia.daemon.server import WebSocketServer, daemon_launch_lock_path -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.socket import find_available_listen_port -from chia.simulator.ssl_certs import ( +from flax.cmds.init_funcs import create_all_ssl +from flax.consensus.coinbase import create_puzzlehash_for_pk +from flax.daemon.server import WebSocketServer, daemon_launch_lock_path +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.socket import find_available_listen_port +from flax.simulator.ssl_certs import ( SSLTestCACertAndPrivateKey, SSLTestCollateralWrapper, SSLTestNodeCertsAndKeys, get_next_nodes_certs_and_keys, get_next_private_ca_cert_and_key, ) -from chia.simulator.start_simulator import async_main as start_simulator_main -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.bech32m import encode_puzzle_hash -from chia.util.config import create_default_chia_config, load_config, save_config -from chia.util.ints import uint32 -from chia.util.keychain import Keychain -from chia.util.lock import Lockfile -from chia.wallet.derive_keys import master_sk_to_wallet_sk +from flax.simulator.start_simulator import async_main as start_simulator_main +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.bech32m import encode_puzzle_hash +from flax.util.config import create_default_flax_config, load_config, save_config +from flax.util.ints import uint32 +from flax.util.keychain import Keychain +from flax.util.lock import Lockfile +from flax.wallet.derive_keys import master_sk_to_wallet_sk """ These functions are used to test the simulator. @@ -57,20 +57,20 @@ def get_puzzle_hash_from_key(fingerprint: int, key_id: int = 1) -> bytes32: def create_config( - chia_root: Path, + flax_root: Path, fingerprint: int, private_ca_crt_and_key: Tuple[bytes, bytes], node_certs_and_keys: Dict[str, Dict[str, Dict[str, bytes]]], ) -> Dict[str, Any]: - # create chia directories - create_default_chia_config(chia_root) + # create flax directories + create_default_flax_config(flax_root) create_all_ssl( - chia_root, + flax_root, private_ca_crt_and_key=private_ca_crt_and_key, node_certs_and_keys=node_certs_and_keys, ) # load config - config = load_config(chia_root, "config.yaml") + config = load_config(flax_root, "config.yaml") config["full_node"]["send_uncompact_interval"] = 0 config["full_node"]["target_uncompact_proofs"] = 30 config["full_node"]["peer_connect_interval"] = 50 @@ -95,16 +95,16 @@ def create_config( config["full_node"]["rpc_port"] = find_available_listen_port("Node RPC") # simulator overrides config["simulator"]["key_fingerprint"] = fingerprint - config["simulator"]["farming_address"] = encode_puzzle_hash(get_puzzle_hash_from_key(fingerprint), "txch") + config["simulator"]["farming_address"] = encode_puzzle_hash(get_puzzle_hash_from_key(fingerprint), "txfx") config["simulator"]["plot_directory"] = "test-simulator/plots" # save config - save_config(chia_root, "config.yaml", config) + save_config(flax_root, "config.yaml", config) return config -async def start_simulator(chia_root: Path, automated_testing: bool = False) -> AsyncGenerator[FullNodeSimulator, None]: +async def start_simulator(flax_root: Path, automated_testing: bool = False) -> AsyncGenerator[FullNodeSimulator, None]: sys.argv = [sys.argv[0]] # clear sys.argv to avoid issues with config.yaml - service = await start_simulator_main(True, automated_testing, root_path=chia_root) + service = await start_simulator_main(True, automated_testing, root_path=flax_root) await service.start() yield service._api @@ -113,18 +113,18 @@ async def start_simulator(chia_root: Path, automated_testing: bool = False) -> A await service.wait_closed() -async def get_full_chia_simulator( - automated_testing: bool = False, chia_root: Optional[Path] = None, config: Optional[Dict[str, Any]] = None +async def get_full_flax_simulator( + automated_testing: bool = False, flax_root: Optional[Path] = None, config: Optional[Dict[str, Any]] = None ) -> AsyncGenerator[Tuple[FullNodeSimulator, Path, Dict[str, Any], str, int], None]: """ - A chia root directory can be provided, otherwise a temporary one is created. + A flax root directory can be provided, otherwise a temporary one is created. This test can either be run in automated mode or not, which determines which mode block tools run in. - This test is fully interdependent and can be used without the rest of the chia test suite. + This test is fully interdependent and can be used without the rest of the flax test suite. Please refer to the documentation for more information. """ - # Create and setup temporary chia directories. - if chia_root is None: - chia_root = Path(tempfile.TemporaryDirectory().name) + # Create and setup temporary flax directories. + if flax_root is None: + flax_root = Path(tempfile.TemporaryDirectory().name) mnemonic, fingerprint = mnemonic_fingerprint() ssl_ca_cert_and_key_wrapper: SSLTestCollateralWrapper[ SSLTestCACertAndPrivateKey @@ -134,23 +134,23 @@ async def get_full_chia_simulator( ] = get_next_nodes_certs_and_keys() if config is None: config = create_config( - chia_root, + flax_root, fingerprint, ssl_ca_cert_and_key_wrapper.collateral.cert_and_key, ssl_nodes_certs_and_keys_wrapper.collateral.certs_and_keys, ) - crt_path = chia_root / config["daemon_ssl"]["private_crt"] - key_path = chia_root / config["daemon_ssl"]["private_key"] - ca_crt_path = chia_root / config["private_ssl_ca"]["crt"] - ca_key_path = chia_root / config["private_ssl_ca"]["key"] - with Lockfile.create(daemon_launch_lock_path(chia_root)): + crt_path = flax_root / config["daemon_ssl"]["private_crt"] + key_path = flax_root / config["daemon_ssl"]["private_key"] + ca_crt_path = flax_root / config["private_ssl_ca"]["crt"] + ca_key_path = flax_root / config["private_ssl_ca"]["key"] + with Lockfile.create(daemon_launch_lock_path(flax_root)): shutdown_event = asyncio.Event() - ws_server = WebSocketServer(chia_root, ca_crt_path, ca_key_path, crt_path, key_path, shutdown_event) + ws_server = WebSocketServer(flax_root, ca_crt_path, ca_key_path, crt_path, key_path, shutdown_event) await ws_server.setup_process_global_state() await ws_server.start() # type: ignore[no-untyped-call] - async for simulator in start_simulator(chia_root, automated_testing): - yield simulator, chia_root, config, mnemonic, fingerprint + async for simulator in start_simulator(flax_root, automated_testing): + yield simulator, flax_root, config, mnemonic, fingerprint await ws_server.stop() await shutdown_event.wait() # wait till shutdown is complete diff --git a/chia/simulator/socket.py b/flax/simulator/socket.py similarity index 100% rename from chia/simulator/socket.py rename to flax/simulator/socket.py diff --git a/chia/simulator/ssl_certs.py b/flax/simulator/ssl_certs.py similarity index 86% rename from chia/simulator/ssl_certs.py rename to flax/simulator/ssl_certs.py index 1318e2773..de7ea826b 100644 --- a/chia/simulator/ssl_certs.py +++ b/flax/simulator/ssl_certs.py @@ -4,16 +4,16 @@ from dataclasses import dataclass from typing import Dict, Generic, List, Tuple, TypeVar -from chia.simulator.ssl_certs_1 import SSL_TEST_NODE_CERTS_AND_KEYS_1, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_1 -from chia.simulator.ssl_certs_2 import SSL_TEST_NODE_CERTS_AND_KEYS_2, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_2 -from chia.simulator.ssl_certs_3 import SSL_TEST_NODE_CERTS_AND_KEYS_3, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_3 -from chia.simulator.ssl_certs_4 import SSL_TEST_NODE_CERTS_AND_KEYS_4, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_4 -from chia.simulator.ssl_certs_5 import SSL_TEST_NODE_CERTS_AND_KEYS_5, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_5 -from chia.simulator.ssl_certs_6 import SSL_TEST_NODE_CERTS_AND_KEYS_6, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_6 -from chia.simulator.ssl_certs_7 import SSL_TEST_NODE_CERTS_AND_KEYS_7, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_7 -from chia.simulator.ssl_certs_8 import SSL_TEST_NODE_CERTS_AND_KEYS_8, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_8 -from chia.simulator.ssl_certs_9 import SSL_TEST_NODE_CERTS_AND_KEYS_9, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_9 -from chia.simulator.ssl_certs_10 import SSL_TEST_NODE_CERTS_AND_KEYS_10, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_10 +from flax.simulator.ssl_certs_1 import SSL_TEST_NODE_CERTS_AND_KEYS_1, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_1 +from flax.simulator.ssl_certs_2 import SSL_TEST_NODE_CERTS_AND_KEYS_2, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_2 +from flax.simulator.ssl_certs_3 import SSL_TEST_NODE_CERTS_AND_KEYS_3, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_3 +from flax.simulator.ssl_certs_4 import SSL_TEST_NODE_CERTS_AND_KEYS_4, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_4 +from flax.simulator.ssl_certs_5 import SSL_TEST_NODE_CERTS_AND_KEYS_5, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_5 +from flax.simulator.ssl_certs_6 import SSL_TEST_NODE_CERTS_AND_KEYS_6, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_6 +from flax.simulator.ssl_certs_7 import SSL_TEST_NODE_CERTS_AND_KEYS_7, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_7 +from flax.simulator.ssl_certs_8 import SSL_TEST_NODE_CERTS_AND_KEYS_8, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_8 +from flax.simulator.ssl_certs_9 import SSL_TEST_NODE_CERTS_AND_KEYS_9, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_9 +from flax.simulator.ssl_certs_10 import SSL_TEST_NODE_CERTS_AND_KEYS_10, SSL_TEST_PRIVATE_CA_CERT_AND_KEY_10 # --------------------------------------------------------------------------- # NOTE: diff --git a/chia/simulator/ssl_certs_1.py b/flax/simulator/ssl_certs_1.py similarity index 100% rename from chia/simulator/ssl_certs_1.py rename to flax/simulator/ssl_certs_1.py diff --git a/chia/simulator/ssl_certs_10.py b/flax/simulator/ssl_certs_10.py similarity index 100% rename from chia/simulator/ssl_certs_10.py rename to flax/simulator/ssl_certs_10.py diff --git a/chia/simulator/ssl_certs_2.py b/flax/simulator/ssl_certs_2.py similarity index 100% rename from chia/simulator/ssl_certs_2.py rename to flax/simulator/ssl_certs_2.py diff --git a/chia/simulator/ssl_certs_3.py b/flax/simulator/ssl_certs_3.py similarity index 100% rename from chia/simulator/ssl_certs_3.py rename to flax/simulator/ssl_certs_3.py diff --git a/chia/simulator/ssl_certs_4.py b/flax/simulator/ssl_certs_4.py similarity index 100% rename from chia/simulator/ssl_certs_4.py rename to flax/simulator/ssl_certs_4.py diff --git a/chia/simulator/ssl_certs_5.py b/flax/simulator/ssl_certs_5.py similarity index 100% rename from chia/simulator/ssl_certs_5.py rename to flax/simulator/ssl_certs_5.py diff --git a/chia/simulator/ssl_certs_6.py b/flax/simulator/ssl_certs_6.py similarity index 100% rename from chia/simulator/ssl_certs_6.py rename to flax/simulator/ssl_certs_6.py diff --git a/chia/simulator/ssl_certs_7.py b/flax/simulator/ssl_certs_7.py similarity index 100% rename from chia/simulator/ssl_certs_7.py rename to flax/simulator/ssl_certs_7.py diff --git a/chia/simulator/ssl_certs_8.py b/flax/simulator/ssl_certs_8.py similarity index 100% rename from chia/simulator/ssl_certs_8.py rename to flax/simulator/ssl_certs_8.py diff --git a/chia/simulator/ssl_certs_9.py b/flax/simulator/ssl_certs_9.py similarity index 99% rename from chia/simulator/ssl_certs_9.py rename to flax/simulator/ssl_certs_9.py index ae431ac26..a87fad8db 100644 --- a/chia/simulator/ssl_certs_9.py +++ b/flax/simulator/ssl_certs_9.py @@ -110,7 +110,7 @@ VQQLDBhPcmdhbmljIEZhcm1pbmcgRGl2aXNpb24wggEiMA0GCSqGSIb3DQEBAQUA A4IBDwAwggEKAoIBAQDSMjjzEEqoICoK7gBXrUhkhzVLmNnPxTpod32QWSpnSR9/ R81bPlxoaWixzYfNnAntIOr6txh82sd3lPqT45zT/Ji7iTkcbmh10Kw2YMPb1+cM -GAy3x/K+ASUMP911J/4E+4jFqodY7EccfxbnZir/U7IktqxchiPZoDC5Dvf5YtJZ +GAy3x/K+ASUMP911J/4E+4jFqodY7EccfxbnZir/U7IktqxfxiPZoDC5Dvf5YtJZ ZJLITRaAnoA66OC/cUWjxbzOGGPt9bJNbQXlgHGmJx6D9vaUE3hnIm03HpO+74S0 S54b4TI0R3H+fuU1jxgMuCHACcQTKpZRi5h4QT8QQJXoL/70dDG0DNFsI5RIEgf4 KS6wowbJLdqpZpeW4Sh513/xQYeEsIWgFnV6ZM3hAgMBAAGjFzAVMBMGA1UdEQQM diff --git a/chia/simulator/start_simulator.py b/flax/simulator/start_simulator.py similarity index 86% rename from chia/simulator/start_simulator.py rename to flax/simulator/start_simulator.py index 4e4f709dd..36aa1d949 100644 --- a/chia/simulator/start_simulator.py +++ b/flax/simulator/start_simulator.py @@ -4,18 +4,18 @@ from pathlib import Path from typing import Optional, Dict, List, Tuple -from chia.full_node.full_node import FullNode -from chia.server.outbound_message import NodeType -from chia.server.start_service import Service, async_run -from chia.simulator.simulator_full_node_rpc_api import SimulatorFullNodeRpcApi -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.bech32m import decode_puzzle_hash -from chia.util.chia_logging import initialize_logging -from chia.util.config import load_config_cli, override_config, load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.simulator.block_tools import BlockTools, test_constants -from chia.util.ints import uint16 -from chia.simulator.full_node_simulator import FullNodeSimulator +from flax.full_node.full_node import FullNode +from flax.server.outbound_message import NodeType +from flax.server.start_service import Service, async_run +from flax.simulator.simulator_full_node_rpc_api import SimulatorFullNodeRpcApi +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.bech32m import decode_puzzle_hash +from flax.util.flax_logging import initialize_logging +from flax.util.config import load_config_cli, override_config, load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.simulator.block_tools import BlockTools, test_constants +from flax.util.ints import uint16 +from flax.simulator.full_node_simulator import FullNodeSimulator # See: https://bugs.python.org/issue29288 "".encode("idna") diff --git a/chia/simulator/time_out_assert.py b/flax/simulator/time_out_assert.py similarity index 96% rename from chia/simulator/time_out_assert.py rename to flax/simulator/time_out_assert.py index fef5e000a..a27b75e8c 100644 --- a/chia/simulator/time_out_assert.py +++ b/flax/simulator/time_out_assert.py @@ -5,7 +5,7 @@ import time from typing import Callable -from chia.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.protocol_message_types import ProtocolMessageTypes log = logging.getLogger(__name__) diff --git a/chia/simulator/wallet_tools.py b/flax/simulator/wallet_tools.py similarity index 92% rename from chia/simulator/wallet_tools.py rename to flax/simulator/wallet_tools.py index 5d34b194e..4165a20a2 100644 --- a/chia/simulator/wallet_tools.py +++ b/flax/simulator/wallet_tools.py @@ -5,20 +5,20 @@ from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey from clvm.casts import int_from_bytes, int_to_bytes -from chia.consensus.constants import ConsensusConstants -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.spend_bundle import SpendBundle -from chia.util.condition_tools import conditions_by_opcode, conditions_for_solution -from chia.util.hash import std_hash -from chia.util.ints import uint32, uint64 -from chia.wallet.derive_keys import master_sk_to_wallet_sk -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( +from flax.consensus.constants import ConsensusConstants +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.spend_bundle import SpendBundle +from flax.util.condition_tools import conditions_by_opcode, conditions_for_solution +from flax.util.hash import std_hash +from flax.util.ints import uint32, uint64 +from flax.wallet.derive_keys import master_sk_to_wallet_sk +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( DEFAULT_HIDDEN_PUZZLE_HASH, calculate_synthetic_secret_key, puzzle_for_pk, diff --git a/chia/ssl/__init__.py b/flax/ssl/__init__.py similarity index 100% rename from chia/ssl/__init__.py rename to flax/ssl/__init__.py diff --git a/chia/ssl/create_ssl.py b/flax/ssl/create_ssl.py similarity index 86% rename from chia/ssl/create_ssl.py rename to flax/ssl/create_ssl.py index 061e13bcf..be2b728c9 100644 --- a/chia/ssl/create_ssl.py +++ b/flax/ssl/create_ssl.py @@ -4,7 +4,7 @@ from typing import Any, List, Tuple import pkg_resources -from chia.util.ssl_check import DEFAULT_PERMISSIONS_CERT_FILE, DEFAULT_PERMISSIONS_KEY_FILE +from flax.util.ssl_check import DEFAULT_PERMISSIONS_CERT_FILE, DEFAULT_PERMISSIONS_KEY_FILE from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes, serialization @@ -13,9 +13,9 @@ from cryptography.x509.oid import NameOID -def get_chia_ca_crt_key() -> Tuple[Any, Any]: - crt = pkg_resources.resource_string(__name__, "chia_ca.crt") - key = pkg_resources.resource_string(__name__, "chia_ca.key") +def get_flax_ca_crt_key() -> Tuple[Any, Any]: + crt = pkg_resources.resource_string(__name__, "flax_ca.crt") + key = pkg_resources.resource_string(__name__, "flax_ca.key") return crt, key @@ -56,8 +56,8 @@ def generate_ca_signed_cert(ca_crt: bytes, ca_key: bytes, cert_out: Path, key_ou cert_key = rsa.generate_private_key(public_exponent=65537, key_size=2048, backend=default_backend()) new_subject = x509.Name( [ - x509.NameAttribute(NameOID.COMMON_NAME, "Chia"), - x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Chia"), + x509.NameAttribute(NameOID.COMMON_NAME, "Flax"), + x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Flax"), x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, "Organic Farming Division"), ] ) @@ -71,7 +71,7 @@ def generate_ca_signed_cert(ca_crt: bytes, ca_key: bytes, cert_out: Path, key_ou .not_valid_before(datetime.datetime.today() - one_day) .not_valid_after(datetime.datetime(2100, 8, 2)) .add_extension( - x509.SubjectAlternativeName([x509.DNSName("chia.net")]), + x509.SubjectAlternativeName([x509.DNSName("flaxnetwork.org")]), critical=False, ) .sign(root_key, hashes.SHA256(), default_backend()) @@ -91,8 +91,8 @@ def make_ca_cert(cert_path: Path, key_path: Path): root_key = rsa.generate_private_key(public_exponent=65537, key_size=2048, backend=default_backend()) subject = issuer = x509.Name( [ - x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Chia"), - x509.NameAttribute(NameOID.COMMON_NAME, "Chia CA"), + x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Flax"), + x509.NameAttribute(NameOID.COMMON_NAME, "Flax CA"), x509.NameAttribute(NameOID.ORGANIZATIONAL_UNIT_NAME, "Organic Farming Division"), ] ) @@ -119,7 +119,7 @@ def make_ca_cert(cert_path: Path, key_path: Path): def main(): - return make_ca_cert(Path("./chia_ca.crt"), Path("./chia_ca.key")) + return make_ca_cert(Path("./flax_ca.crt"), Path("./flax_ca.key")) if __name__ == "__main__": diff --git a/chia/ssl/dst_root_ca.pem b/flax/ssl/dst_root_ca.pem similarity index 100% rename from chia/ssl/dst_root_ca.pem rename to flax/ssl/dst_root_ca.pem diff --git a/flax/ssl/flax_ca.crt b/flax/ssl/flax_ca.crt new file mode 100644 index 000000000..c0c4f7f4c --- /dev/null +++ b/flax/ssl/flax_ca.crt @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDKTCCAhGgAwIBAgIUNgtAPGy+jcZhwAivtrGUIkIQ89EwDQYJKoZIhvcNAQEL +BQAwRDENMAsGA1UECgwERmxheDEQMA4GA1UEAwwHRmxheCBDQTEhMB8GA1UECwwY +T3JnYW5pYyBGYXJtaW5nIERpdmlzaW9uMB4XDTIxMDYxNTEwMDE0NloXDTMxMDYx +MzEwMDE0NlowRDENMAsGA1UECgwERmxheDEQMA4GA1UEAwwHRmxheCBDQTEhMB8G +A1UECwwYT3JnYW5pYyBGYXJtaW5nIERpdmlzaW9uMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEAmqcnpRQBo8bcIF35HuwcuuLEtOVTEM+ZW8kWy6SWyBIG +jd10AuldbSPgXoN6Gez/vVWXWpJkc5pGc4KgdMtSUalaQutJglqMEKz0B+0MLpiR +pBY7vE0aPuRAsIdtnjzrEzkeiw4GdfjBa2IOz+aheJReXlQgAxiR0lEhj7fHqCQY +gQ7TZnCnQ+rMKH5c72RYzbSitC614rqa1pgDheHSnZAF0Z6AByZCExCcz3EC0hJI +Az8ln2HVGt3xurb8JmZGRlxZtU4ei3ZIyYjKfE2ApFQkZ8NR8IMbBgODvuL+c7kH +2rDfM4mgix+1tRAYJsh/9YjXYgv/hjjXgh7WrkyA7QIDAQABoxMwETAPBgNVHRMB +Af8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQBZGE0C3YSWWZ/wxYCeZU+tgjGM +pvUxrdKZmnuf8ErK048U1y+AD4a5LwcJIcwiIL/S5EKHAbL2C+kMrUzGYI3eAqNt +fMcFvh/izpENUa86X0zLiW0H55zKCLK1CynI0uJ+JbpfuIDQkU+fLtSXhAMvu1Ow +P+F3umj1RzVVhDAYWfq5yuainceyYAZVex2B++K/L6FGP+Sp6erEamKIwbTJ6Lvb +B/GS927CXVmi/fmKDs8CvuREJB7VB70PW1ZapsBx/NKmCYEjvCr46aE3VhF2/8wp +fk4F/oveThwsZwyV2kqmx7EEFLYZrZtCGG0IX4hyqYBDEZ8m0pNoqZIM2lzv +-----END CERTIFICATE----- diff --git a/flax/ssl/flax_ca.key b/flax/ssl/flax_ca.key new file mode 100644 index 000000000..4a54a5c75 --- /dev/null +++ b/flax/ssl/flax_ca.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAmqcnpRQBo8bcIF35HuwcuuLEtOVTEM+ZW8kWy6SWyBIGjd10 +AuldbSPgXoN6Gez/vVWXWpJkc5pGc4KgdMtSUalaQutJglqMEKz0B+0MLpiRpBY7 +vE0aPuRAsIdtnjzrEzkeiw4GdfjBa2IOz+aheJReXlQgAxiR0lEhj7fHqCQYgQ7T +ZnCnQ+rMKH5c72RYzbSitC614rqa1pgDheHSnZAF0Z6AByZCExCcz3EC0hJIAz8l +n2HVGt3xurb8JmZGRlxZtU4ei3ZIyYjKfE2ApFQkZ8NR8IMbBgODvuL+c7kH2rDf +M4mgix+1tRAYJsh/9YjXYgv/hjjXgh7WrkyA7QIDAQABAoIBACroa6hyZ44QE2zr +hb3dlo8Hcboa0jQc1RjRLwDrNmZmEel0YsaYBrLMPGkco1jkF4RpZefcLACi8h8E +RA6DhuBfU0qzyx5ejvPleINmcnXPIMFc5c/1uG1wmL4hpPk9P5+CvoWoK4S5srhf +aWqnO2+gApq7TnJtc6/dkKk2PS/Z/YLrVm2dbGtR7gblKJhUPouY/r0YEh6nnuH6 +q0/iQFXFRnuzI+ucOYDAyQ+SMCZRQ5VeE0XPUKVYJQb2V2EMUTndJ+dI1TxFJIgw +wB2fA4IiJsNdYlSl5xrQtGpbUoiM5FND3CC/NsjKgDrsIbiMy1eLdmMhN1lbqJjj +EZSd56ECgYEAyXcDA5Ah9CJw4OlQcJN34ZQG7rDilahwAKsXL7M6lJVXgD4eiQ9Q +pYxt3zn5R79UggkRWTI1dFBZ50dKrlKd9PkI0xIDcfXdjOoH0RZQ0tuimFqHubyC +dHN3yNuU95rIzwyT3wMU0AS2DN4m8JGBrTYn6+15k+N0oUCX1U0XT/kCgYEAxIQy +yr2901G0zo5biFk1bOEgp3eX4edI57khjNeoUsUyHLrFkB+36sOCdbgc4eHTIfmm +ETC5O6CI72OtbdZvApVV3cf8Sd/bxGZ53CahG02XP7GMNzY84m019P3OKXvXapKO +X8N+UxSQs1YnBeysH69b/jblpjX2ks3fVLt53ZUCgYAzem+Qt4GVij9hmPxu55+Y +SmTDFPuw1gtYgF86Vwe+87IaGMVgrEMlKg7hHUUvKhqD56FBM20pPWbbjAHvLTkj +YYb5t/6dXf+whBRfPt6EIo8Xcvp/YUXMT7zp3AHiivCIx2P5diYZSTrjath0XBnQ +kqf8xv9r5JDmq0SgwkQUsQKBgQCCXLwg+Du7umD6AT/BNISXZMS3s0MjDb20UoBq +IQm9VqlGm7PBRvlHmEir9OXcBmV8DVNX5f2LC5SrUXFUAsMDcLNUe3zmOMVeBSjj +nRCUvyUNkKdWXPmIry/zBIdFx6yAOxaNem8LiAHxpb4fVQBdyIN7IUm4t+WJP17e +o7tU/QKBgBZ+ejP5SWtjtzFLMbAAgKlBp/f/ErUb7omrsyCL3e/tzveDgLorUunk +0211k7+VvueLich7grUOXjvpL30gem9HD4rpnNH3R6l3HtL3AA0/ZjUNIDvuB12y +Kzs0SeTE4Nj3k5vTexoR4WXoIy6l0leIq4rAIym1WWtC6SR8VJRg +-----END RSA PRIVATE KEY----- diff --git a/chia/timelord/__init__.py b/flax/timelord/__init__.py similarity index 100% rename from chia/timelord/__init__.py rename to flax/timelord/__init__.py diff --git a/chia/timelord/iters_from_block.py b/flax/timelord/iters_from_block.py similarity index 86% rename from chia/timelord/iters_from_block.py rename to flax/timelord/iters_from_block.py index 2fdaf26c3..23c05557c 100644 --- a/chia/timelord/iters_from_block.py +++ b/flax/timelord/iters_from_block.py @@ -2,10 +2,10 @@ from typing import Optional, Tuple, Union -from chia.consensus.pot_iterations import calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 +from flax.consensus.pot_iterations import calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock, RewardChainBlockUnfinished +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 def iters_from_block( diff --git a/chia/timelord/timelord.py b/flax/timelord/timelord.py similarity index 97% rename from chia/timelord/timelord.py rename to flax/timelord/timelord.py index 36dd29b53..8e73c44af 100644 --- a/chia/timelord/timelord.py +++ b/flax/timelord/timelord.py @@ -14,33 +14,33 @@ from chiavdf import create_discriminant, prove -import chia.server.ws_connection as ws -from chia.consensus.constants import ConsensusConstants -from chia.consensus.pot_iterations import calculate_sp_iters, is_overflow_block -from chia.protocols import timelord_protocol -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.rpc.rpc_server import default_get_connections -from chia.server.outbound_message import NodeType, make_msg -from chia.server.server import ChiaServer -from chia.timelord.iters_from_block import iters_from_block -from chia.timelord.timelord_state import LastState -from chia.timelord.types import Chain, IterationType, StateType -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.slots import ( +import flax.server.ws_connection as ws +from flax.consensus.constants import ConsensusConstants +from flax.consensus.pot_iterations import calculate_sp_iters, is_overflow_block +from flax.protocols import timelord_protocol +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.rpc.rpc_server import default_get_connections +from flax.server.outbound_message import NodeType, make_msg +from flax.server.server import FlaxServer +from flax.timelord.iters_from_block import iters_from_block +from flax.timelord.timelord_state import LastState +from flax.timelord.types import Chain, IterationType, StateType +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.slots import ( ChallengeChainSubSlot, InfusedChallengeChainSubSlot, RewardChainSubSlot, SubSlotProofs, ) -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.util.config import process_config_start_method -from chia.util.ints import uint8, uint16, uint32, uint64, uint128 -from chia.util.setproctitle import getproctitle, setproctitle -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.util.config import process_config_start_method +from flax.util.ints import uint8, uint16, uint32, uint64, uint128 +from flax.util.setproctitle import getproctitle, setproctitle +from flax.util.streamable import Streamable, streamable log = logging.getLogger(__name__) @@ -66,7 +66,7 @@ def prove_bluebox_slow(payload): class Timelord: @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: # This is a stop gap until the class usage is refactored such the values of # integral attributes are known at creation of the instance. if self._server is None: @@ -81,7 +81,7 @@ def __init__(self, root_path, config: Dict, constants: ConsensusConstants): self._shut_down = False self.free_clients: List[Tuple[str, asyncio.StreamReader, asyncio.StreamWriter]] = [] self.ip_whitelist = self.config["vdf_clients"]["ip"] - self._server: Optional[ChiaServer] = None + self._server: Optional[FlaxServer] = None self.chain_type_to_stream: Dict[Chain, Tuple[str, asyncio.StreamReader, asyncio.StreamWriter]] = {} self.chain_start_time: Dict = {} # Chains that currently don't have a vdf_client. @@ -167,7 +167,7 @@ async def _start(self): def get_connections(self, request_node_type: Optional[NodeType]) -> List[Dict[str, Any]]: return default_get_connections(server=self.server, request_node_type=request_node_type) - async def on_connect(self, connection: ws.WSChiaConnection): + async def on_connect(self, connection: ws.WSFlaxConnection): pass def get_vdf_server_port(self) -> Optional[uint16]: @@ -194,7 +194,7 @@ def state_changed(self, change: str, change_data: Optional[Dict[str, Any]] = Non if self.state_changed_callback is not None: self.state_changed_callback(change, change_data) - def set_server(self, server: ChiaServer): + def set_server(self, server: FlaxServer): self._server = server async def _handle_client(self, reader: asyncio.StreamReader, writer: asyncio.StreamWriter): diff --git a/chia/timelord/timelord_api.py b/flax/timelord/timelord_api.py similarity index 95% rename from chia/timelord/timelord_api.py rename to flax/timelord/timelord_api.py index 94a620873..ece7b5227 100644 --- a/chia/timelord/timelord_api.py +++ b/flax/timelord/timelord_api.py @@ -4,10 +4,10 @@ import time from typing import Callable, Optional -from chia.protocols import timelord_protocol -from chia.timelord.timelord import Chain, IterationType, Timelord, iters_from_block -from chia.util.api_decorators import api_request -from chia.util.ints import uint64 +from flax.protocols import timelord_protocol +from flax.timelord.timelord import Chain, IterationType, Timelord, iters_from_block +from flax.util.api_decorators import api_request +from flax.util.ints import uint64 log = logging.getLogger(__name__) diff --git a/chia/timelord/timelord_launcher.py b/flax/timelord/timelord_launcher.py similarity index 92% rename from chia/timelord/timelord_launcher.py rename to flax/timelord/timelord_launcher.py index 0dbadd589..7dabf746a 100644 --- a/chia/timelord/timelord_launcher.py +++ b/flax/timelord/timelord_launcher.py @@ -8,11 +8,11 @@ import pkg_resources -from chia.util.chia_logging import initialize_logging -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.network import get_host_addr -from chia.util.setproctitle import setproctitle +from flax.util.flax_logging import initialize_logging +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.network import get_host_addr +from flax.util.setproctitle import setproctitle active_processes: List = [] stopped = False @@ -114,7 +114,7 @@ def main(): log.info("Timelord launcher not supported on Windows.") return root_path = DEFAULT_ROOT_PATH - setproctitle("chia_timelord_launcher") + setproctitle("flax_timelord_launcher") net_config = load_config(root_path, "config.yaml") config = net_config["timelord_launcher"] initialize_logging("TLauncher", config["logging"], root_path) diff --git a/chia/timelord/timelord_state.py b/flax/timelord/timelord_state.py similarity index 95% rename from chia/timelord/timelord_state.py rename to flax/timelord/timelord_state.py index 45f44009f..c38534ec5 100644 --- a/chia/timelord/timelord_state.py +++ b/flax/timelord/timelord_state.py @@ -3,16 +3,16 @@ import logging from typing import List, Optional, Tuple, Union -from chia.consensus.constants import ConsensusConstants -from chia.protocols import timelord_protocol -from chia.timelord.iters_from_block import iters_from_block -from chia.timelord.types import Chain, StateType -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.slots import ChallengeBlockInfo -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.util.ints import uint8, uint32, uint64, uint128 +from flax.consensus.constants import ConsensusConstants +from flax.protocols import timelord_protocol +from flax.timelord.iters_from_block import iters_from_block +from flax.timelord.types import Chain, StateType +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.slots import ChallengeBlockInfo +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.util.ints import uint8, uint32, uint64, uint128 log = logging.getLogger(__name__) diff --git a/chia/timelord/types.py b/flax/timelord/types.py similarity index 100% rename from chia/timelord/types.py rename to flax/timelord/types.py diff --git a/chia/types/__init__.py b/flax/types/__init__.py similarity index 100% rename from chia/types/__init__.py rename to flax/types/__init__.py diff --git a/chia/types/announcement.py b/flax/types/announcement.py similarity index 86% rename from chia/types/announcement.py rename to flax/types/announcement.py index fb93c7884..6d7a2ea8e 100644 --- a/chia/types/announcement.py +++ b/flax/types/announcement.py @@ -3,8 +3,8 @@ from dataclasses import dataclass from typing import Optional -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash @dataclass(frozen=True) diff --git a/chia/types/block_protocol.py b/flax/types/block_protocol.py similarity index 71% rename from chia/types/block_protocol.py rename to flax/types/block_protocol.py index f57424ab6..6f8a97418 100644 --- a/chia/types/block_protocol.py +++ b/flax/types/block_protocol.py @@ -4,9 +4,9 @@ from typing_extensions import Protocol -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 class BlockInfo(Protocol): diff --git a/chia/types/blockchain_format/__init__.py b/flax/types/blockchain_format/__init__.py similarity index 100% rename from chia/types/blockchain_format/__init__.py rename to flax/types/blockchain_format/__init__.py diff --git a/chia/types/blockchain_format/classgroup.py b/flax/types/blockchain_format/classgroup.py similarity index 84% rename from chia/types/blockchain_format/classgroup.py rename to flax/types/blockchain_format/classgroup.py index 6a1ffc8d4..1afc4a720 100644 --- a/chia/types/blockchain_format/classgroup.py +++ b/flax/types/blockchain_format/classgroup.py @@ -2,9 +2,9 @@ from dataclasses import dataclass -from chia.consensus.constants import ConsensusConstants -from chia.types.blockchain_format.sized_bytes import bytes100 -from chia.util.streamable import Streamable, streamable +from flax.consensus.constants import ConsensusConstants +from flax.types.blockchain_format.sized_bytes import bytes100 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/blockchain_format/coin.py b/flax/types/blockchain_format/coin.py similarity index 81% rename from chia/types/blockchain_format/coin.py rename to flax/types/blockchain_format/coin.py index 3f5ad914e..a6233c25f 100644 --- a/chia/types/blockchain_format/coin.py +++ b/flax/types/blockchain_format/coin.py @@ -4,9 +4,9 @@ from chia_rs import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash -from chia.util.ints import uint64 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash +from flax.util.ints import uint64 __all__ = ["Coin", "coin_as_list", "hash_coin_ids"] diff --git a/chia/types/blockchain_format/foliage.py b/flax/types/blockchain_format/foliage.py similarity index 88% rename from chia/types/blockchain_format/foliage.py rename to flax/types/blockchain_format/foliage.py index b67d2afe8..de7dce9a5 100644 --- a/chia/types/blockchain_format/foliage.py +++ b/flax/types/blockchain_format/foliage.py @@ -5,11 +5,11 @@ from blspy import G2Element -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/blockchain_format/pool_target.py b/flax/types/blockchain_format/pool_target.py similarity index 60% rename from chia/types/blockchain_format/pool_target.py rename to flax/types/blockchain_format/pool_target.py index 41e1b57b8..e3b084a9a 100644 --- a/chia/types/blockchain_format/pool_target.py +++ b/flax/types/blockchain_format/pool_target.py @@ -2,9 +2,9 @@ from dataclasses import dataclass -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/blockchain_format/program.py b/flax/types/blockchain_format/program.py similarity index 98% rename from chia/types/blockchain_format/program.py rename to flax/types/blockchain_format/program.py index 145a7d557..e16135b6e 100644 --- a/chia/types/blockchain_format/program.py +++ b/flax/types/blockchain_format/program.py @@ -8,10 +8,10 @@ from clvm.serialize import sexp_from_stream, sexp_to_stream from chia_rs import MEMPOOL_MODE, run_chia_program, serialized_length, run_generator, tree_hash -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash -from chia.util.byte_types import hexstr_to_bytes -from chia.types.spend_bundle_conditions import SpendBundleConditions +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.types.spend_bundle_conditions import SpendBundleConditions from .tree_hash import sha256_treehash diff --git a/chia/types/blockchain_format/proof_of_space.py b/flax/types/blockchain_format/proof_of_space.py similarity index 94% rename from chia/types/blockchain_format/proof_of_space.py rename to flax/types/blockchain_format/proof_of_space.py index f9d1fc8bd..b5644ab09 100644 --- a/chia/types/blockchain_format/proof_of_space.py +++ b/flax/types/blockchain_format/proof_of_space.py @@ -6,11 +6,11 @@ from blspy import G1Element, AugSchemeMPL, PrivateKey from chiapos import Verifier -from chia.consensus.constants import ConsensusConstants -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash -from chia.util.ints import uint8 -from chia.util.streamable import Streamable, streamable +from flax.consensus.constants import ConsensusConstants +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash +from flax.util.ints import uint8 +from flax.util.streamable import Streamable, streamable log = logging.getLogger(__name__) diff --git a/chia/types/blockchain_format/reward_chain_block.py b/flax/types/blockchain_format/reward_chain_block.py similarity index 85% rename from chia/types/blockchain_format/reward_chain_block.py rename to flax/types/blockchain_format/reward_chain_block.py index d0ba887e3..945edc28e 100644 --- a/chia/types/blockchain_format/reward_chain_block.py +++ b/flax/types/blockchain_format/reward_chain_block.py @@ -5,11 +5,11 @@ from blspy import G2Element -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.vdf import VDFInfo -from chia.util.ints import uint8, uint32, uint128 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.vdf import VDFInfo +from flax.util.ints import uint8, uint32, uint128 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/blockchain_format/sized_bytes.py b/flax/types/blockchain_format/sized_bytes.py similarity index 88% rename from chia/types/blockchain_format/sized_bytes.py rename to flax/types/blockchain_format/sized_bytes.py index 51cd622dc..7e0e1451e 100644 --- a/chia/types/blockchain_format/sized_bytes.py +++ b/flax/types/blockchain_format/sized_bytes.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.util.byte_types import SizedBytes +from flax.util.byte_types import SizedBytes class bytes4(SizedBytes): diff --git a/chia/types/blockchain_format/slots.py b/flax/types/blockchain_format/slots.py similarity index 84% rename from chia/types/blockchain_format/slots.py rename to flax/types/blockchain_format/slots.py index 4c06d1061..599aeadd5 100644 --- a/chia/types/blockchain_format/slots.py +++ b/flax/types/blockchain_format/slots.py @@ -5,11 +5,11 @@ from blspy import G2Element -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.util.ints import uint8, uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.util.ints import uint8, uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/blockchain_format/sub_epoch_summary.py b/flax/types/blockchain_format/sub_epoch_summary.py similarity index 76% rename from chia/types/blockchain_format/sub_epoch_summary.py rename to flax/types/blockchain_format/sub_epoch_summary.py index 8eff2e113..c20516b67 100644 --- a/chia/types/blockchain_format/sub_epoch_summary.py +++ b/flax/types/blockchain_format/sub_epoch_summary.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from typing import Optional -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/blockchain_format/tree_hash.py b/flax/types/blockchain_format/tree_hash.py similarity index 94% rename from chia/types/blockchain_format/tree_hash.py rename to flax/types/blockchain_format/tree_hash.py index 844aac815..0f5907109 100644 --- a/chia/types/blockchain_format/tree_hash.py +++ b/flax/types/blockchain_format/tree_hash.py @@ -12,8 +12,8 @@ from clvm import CLVMObject -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash def sha256_treehash(sexp: CLVMObject, precalculated: Optional[Set[bytes32]] = None) -> bytes32: diff --git a/chia/types/blockchain_format/vdf.py b/flax/types/blockchain_format/vdf.py similarity index 89% rename from chia/types/blockchain_format/vdf.py rename to flax/types/blockchain_format/vdf.py index 55b47595b..fed5c9b06 100644 --- a/chia/types/blockchain_format/vdf.py +++ b/flax/types/blockchain_format/vdf.py @@ -7,11 +7,11 @@ from chiavdf import create_discriminant, verify_n_wesolowski -from chia.consensus.constants import ConsensusConstants -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.sized_bytes import bytes32, bytes100 -from chia.util.ints import uint8, uint64 -from chia.util.streamable import Streamable, streamable +from flax.consensus.constants import ConsensusConstants +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32, bytes100 +from flax.util.ints import uint8, uint64 +from flax.util.streamable import Streamable, streamable log = logging.getLogger(__name__) diff --git a/chia/types/clvm_cost.py b/flax/types/clvm_cost.py similarity index 89% rename from chia/types/clvm_cost.py rename to flax/types/clvm_cost.py index fba6fbcc9..fbbdd718c 100644 --- a/chia/types/clvm_cost.py +++ b/flax/types/clvm_cost.py @@ -2,7 +2,7 @@ from typing import NewType -from chia.util.ints import uint64 +from flax.util.ints import uint64 """ CLVM Cost is the cost to run a CLVM program on the CLVM. diff --git a/chia/types/coin_record.py b/flax/types/coin_record.py similarity index 79% rename from chia/types/coin_record.py rename to flax/types/coin_record.py index 69a6d6493..975e7898d 100644 --- a/chia/types/coin_record.py +++ b/flax/types/coin_record.py @@ -3,11 +3,11 @@ from dataclasses import dataclass from typing import Optional -from chia.protocols.wallet_protocol import CoinState -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32, uint64 -from chia.util.streamable import Streamable, streamable +from flax.protocols.wallet_protocol import CoinState +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32, uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/coin_solution.py b/flax/types/coin_solution.py similarity index 100% rename from chia/types/coin_solution.py rename to flax/types/coin_solution.py diff --git a/chia/types/coin_spend.py b/flax/types/coin_spend.py similarity index 80% rename from chia/types/coin_spend.py rename to flax/types/coin_spend.py index 9efc6aece..270dab710 100644 --- a/chia/types/coin_spend.py +++ b/flax/types/coin_spend.py @@ -1,9 +1,9 @@ from dataclasses import dataclass from typing import List -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import SerializedProgram, INFINITE_COST -from chia.util.chain_utils import additions_for_solution, fee_for_solution -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import SerializedProgram, INFINITE_COST +from flax.util.chain_utils import additions_for_solution, fee_for_solution +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/condition_opcodes.py b/flax/types/condition_opcodes.py similarity index 96% rename from chia/types/condition_opcodes.py rename to flax/types/condition_opcodes.py index 5902863c8..6fd66c238 100644 --- a/chia/types/condition_opcodes.py +++ b/flax/types/condition_opcodes.py @@ -4,7 +4,7 @@ from typing import Any -# See chia/wallet/puzzles/condition_codes.clvm +# See flax/wallet/puzzles/condition_codes.clvm class ConditionOpcode(bytes, enum.Enum): # AGG_SIG is ascii "1" diff --git a/chia/types/condition_with_args.py b/flax/types/condition_with_args.py similarity index 77% rename from chia/types/condition_with_args.py rename to flax/types/condition_with_args.py index 721ecbeca..5b94f053a 100644 --- a/chia/types/condition_with_args.py +++ b/flax/types/condition_with_args.py @@ -3,8 +3,8 @@ from dataclasses import dataclass from typing import List -from chia.types.condition_opcodes import ConditionOpcode -from chia.util.streamable import Streamable, streamable +from flax.types.condition_opcodes import ConditionOpcode +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/end_of_slot_bundle.py b/flax/types/end_of_slot_bundle.py similarity index 81% rename from chia/types/end_of_slot_bundle.py rename to flax/types/end_of_slot_bundle.py index d97a3237d..4080b82fd 100644 --- a/chia/types/end_of_slot_bundle.py +++ b/flax/types/end_of_slot_bundle.py @@ -3,13 +3,13 @@ from dataclasses import dataclass from typing import Optional -from chia.types.blockchain_format.slots import ( +from flax.types.blockchain_format.slots import ( ChallengeChainSubSlot, InfusedChallengeChainSubSlot, RewardChainSubSlot, SubSlotProofs, ) -from chia.util.streamable import Streamable, streamable +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/fee_rate.py b/flax/types/fee_rate.py similarity index 70% rename from chia/types/fee_rate.py rename to flax/types/fee_rate.py index d08db5c6f..11beb0455 100644 --- a/chia/types/fee_rate.py +++ b/flax/types/fee_rate.py @@ -5,10 +5,10 @@ import typing_extensions -from chia.types.clvm_cost import CLVMCost -from chia.types.mojos import Mojos -from chia.util.ints import uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.clvm_cost import CLVMCost +from flax.types.mojos import Mojos +from flax.util.ints import uint64 +from flax.util.streamable import Streamable, streamable @typing_extensions.final @@ -17,7 +17,7 @@ class FeeRate(Streamable): """ Represents Fee Rate in mojos divided by CLVM Cost. - Performs XCH/mojo conversion. + Performs XFX/mojo conversion. Similar to 'Fee per cost'. """ diff --git a/chia/types/full_block.py b/flax/types/full_block.py similarity index 85% rename from chia/types/full_block.py rename to flax/types/full_block.py index 086fb6ea7..8190a6588 100644 --- a/chia/types/full_block.py +++ b/flax/types/full_block.py @@ -1,14 +1,14 @@ from dataclasses import dataclass from typing import List, Optional, Set -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, TransactionsInfo -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.vdf import VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.util.ints import uint32 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, TransactionsInfo +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.vdf import VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.util.ints import uint32 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/generator_types.py b/flax/types/generator_types.py similarity index 82% rename from chia/types/generator_types.py rename to flax/types/generator_types.py index 7b86520bf..267b9c16f 100644 --- a/chia/types/generator_types.py +++ b/flax/types/generator_types.py @@ -1,8 +1,8 @@ from dataclasses import dataclass from typing import List -from chia.types.blockchain_format.program import SerializedProgram -from chia.util.ints import uint32 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.program import SerializedProgram +from flax.util.ints import uint32 +from flax.util.streamable import Streamable, streamable class GeneratorBlockCacheInterface: diff --git a/chia/types/header_block.py b/flax/types/header_block.py similarity index 86% rename from chia/types/header_block.py rename to flax/types/header_block.py index 634cb5965..a5e76b4e7 100644 --- a/chia/types/header_block.py +++ b/flax/types/header_block.py @@ -3,11 +3,11 @@ from dataclasses import dataclass from typing import List, Optional -from chia.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, TransactionsInfo -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock -from chia.types.blockchain_format.vdf import VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, TransactionsInfo +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock +from flax.types.blockchain_format.vdf import VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/mempool_inclusion_status.py b/flax/types/mempool_inclusion_status.py similarity index 100% rename from chia/types/mempool_inclusion_status.py rename to flax/types/mempool_inclusion_status.py diff --git a/chia/types/mempool_item.py b/flax/types/mempool_item.py similarity index 67% rename from chia/types/mempool_item.py rename to flax/types/mempool_item.py index 59a344e46..1a80750ec 100644 --- a/chia/types/mempool_item.py +++ b/flax/types/mempool_item.py @@ -3,12 +3,12 @@ from dataclasses import dataclass from typing import List -from chia.consensus.cost_calculator import NPCResult -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint32, uint64 -from chia.util.streamable import Streamable, streamable +from flax.consensus.cost_calculator import NPCResult +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint32, uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/mempool_submission_status.py b/flax/types/mempool_submission_status.py similarity index 85% rename from chia/types/mempool_submission_status.py rename to flax/types/mempool_submission_status.py index c72a10f79..f2ea8e0d7 100644 --- a/chia/types/mempool_submission_status.py +++ b/flax/types/mempool_submission_status.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from typing import Dict, Optional, Union -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.util.ints import uint8 -from chia.util.streamable import Streamable, streamable +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.util.ints import uint8 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/mojos.py b/flax/types/mojos.py similarity index 74% rename from chia/types/mojos.py rename to flax/types/mojos.py index 735611d26..b14de52b5 100644 --- a/chia/types/mojos.py +++ b/flax/types/mojos.py @@ -2,6 +2,6 @@ from typing import NewType -from chia.util.ints import uint64 +from flax.util.ints import uint64 Mojos = NewType("Mojos", uint64) diff --git a/chia/types/peer_info.py b/flax/types/peer_info.py similarity index 94% rename from chia/types/peer_info.py rename to flax/types/peer_info.py index 317105201..b63451d4f 100644 --- a/chia/types/peer_info.py +++ b/flax/types/peer_info.py @@ -4,8 +4,8 @@ from dataclasses import dataclass from typing import Optional, Union -from chia.util.ints import uint16, uint64 -from chia.util.streamable import Streamable, streamable +from flax.util.ints import uint16, uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/spend_bundle.py b/flax/types/spend_bundle.py similarity index 92% rename from chia/types/spend_bundle.py rename to flax/types/spend_bundle.py index 29b3af940..9b4be161d 100644 --- a/chia/types/spend_bundle.py +++ b/flax/types/spend_bundle.py @@ -6,11 +6,11 @@ from blspy import AugSchemeMPL, G2Element -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.streamable import Streamable, streamable_from_dict, recurse_jsonify, streamable -from chia.wallet.util.debug_spend_bundle import debug_spend_bundle +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.streamable import Streamable, streamable_from_dict, recurse_jsonify, streamable +from flax.wallet.util.debug_spend_bundle import debug_spend_bundle from .coin_spend import CoinSpend diff --git a/chia/types/spend_bundle_conditions.py b/flax/types/spend_bundle_conditions.py similarity index 100% rename from chia/types/spend_bundle_conditions.py rename to flax/types/spend_bundle_conditions.py diff --git a/chia/types/transaction_queue_entry.py b/flax/types/transaction_queue_entry.py similarity index 77% rename from chia/types/transaction_queue_entry.py rename to flax/types/transaction_queue_entry.py index 85ccc38f1..5054663bc 100644 --- a/chia/types/transaction_queue_entry.py +++ b/flax/types/transaction_queue_entry.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from typing import Optional -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.spend_bundle import SpendBundle +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.spend_bundle import SpendBundle @dataclass(frozen=True) @@ -17,7 +17,7 @@ class TransactionQueueEntry: transaction: SpendBundle transaction_bytes: Optional[bytes] spend_name: bytes32 - peer: Optional[WSChiaConnection] + peer: Optional[WSFlaxConnection] test: bool def __lt__(self, other): diff --git a/chia/types/unfinished_block.py b/flax/types/unfinished_block.py similarity index 78% rename from chia/types/unfinished_block.py rename to flax/types/unfinished_block.py index a26445a01..2a305b54e 100644 --- a/chia/types/unfinished_block.py +++ b/flax/types/unfinished_block.py @@ -3,13 +3,13 @@ from dataclasses import dataclass from typing import List, Optional -from chia.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, TransactionsInfo -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished -from chia.types.blockchain_format.vdf import VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.util.ints import uint32 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, TransactionsInfo +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished +from flax.types.blockchain_format.vdf import VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.util.ints import uint32 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/unfinished_header_block.py b/flax/types/unfinished_header_block.py similarity index 78% rename from chia/types/unfinished_header_block.py rename to flax/types/unfinished_header_block.py index a3831cc4d..a72acc9e7 100644 --- a/chia/types/unfinished_header_block.py +++ b/flax/types/unfinished_header_block.py @@ -3,11 +3,11 @@ from dataclasses import dataclass from typing import List, Optional -from chia.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock -from chia.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished -from chia.types.blockchain_format.vdf import VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock +from flax.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished +from flax.types.blockchain_format.vdf import VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/types/weight_proof.py b/flax/types/weight_proof.py similarity index 85% rename from chia/types/weight_proof.py rename to flax/types/weight_proof.py index 74a7df810..09311af13 100644 --- a/chia/types/weight_proof.py +++ b/flax/types/weight_proof.py @@ -3,14 +3,14 @@ from dataclasses import dataclass from typing import List, Optional -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.header_block import HeaderBlock -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.header_block import HeaderBlock +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/util/__init__.py b/flax/util/__init__.py similarity index 100% rename from chia/util/__init__.py rename to flax/util/__init__.py diff --git a/chia/util/api_decorators.py b/flax/util/api_decorators.py similarity index 91% rename from chia/util/api_decorators.py rename to flax/util/api_decorators.py index 2f727220e..7243135ce 100644 --- a/chia/util/api_decorators.py +++ b/flax/util/api_decorators.py @@ -6,26 +6,26 @@ from inspect import signature from typing import TYPE_CHECKING, Any, Callable, Coroutine, List, Optional, Union, get_type_hints -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.server.outbound_message import Message -from chia.util.streamable import Streamable, _T_Streamable +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.server.outbound_message import Message +from flax.util.streamable import Streamable, _T_Streamable log = logging.getLogger(__name__) if TYPE_CHECKING: - from chia.server.ws_connection import WSChiaConnection + from flax.server.ws_connection import WSFlaxConnection converted_api_f_type = Union[ Callable[[Union[bytes, _T_Streamable]], Coroutine[Any, Any, Optional[Message]]], - Callable[[Union[bytes, _T_Streamable], WSChiaConnection], Coroutine[Any, Any, Optional[Message]]], + Callable[[Union[bytes, _T_Streamable], WSFlaxConnection], Coroutine[Any, Any, Optional[Message]]], ] initial_api_f_type = Union[ Callable[[Any, _T_Streamable], Coroutine[Any, Any, Optional[Message]]], - Callable[[Any, _T_Streamable, WSChiaConnection], Coroutine[Any, Any, Optional[Message]]], + Callable[[Any, _T_Streamable, WSFlaxConnection], Coroutine[Any, Any, Optional[Message]]], ] -metadata_attribute_name = "_chia_api_metadata" +metadata_attribute_name = "_flax_api_metadata" @dataclass diff --git a/chia/util/bech32m.py b/flax/util/bech32m.py similarity index 98% rename from chia/util/bech32m.py rename to flax/util/bech32m.py index 9dc9c3a0f..1b0cc14d8 100644 --- a/chia/util/bech32m.py +++ b/flax/util/bech32m.py @@ -24,7 +24,7 @@ """Reference implementation for Bech32m and segwit addresses.""" from typing import List, Iterable, Optional, Tuple -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sized_bytes import bytes32 CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" diff --git a/chia/util/beta_metrics.py b/flax/util/beta_metrics.py similarity index 99% rename from chia/util/beta_metrics.py rename to flax/util/beta_metrics.py index 4ea2c998f..3e7e92408 100644 --- a/chia/util/beta_metrics.py +++ b/flax/util/beta_metrics.py @@ -10,7 +10,7 @@ import psutil -from chia.util.config import load_config +from flax.util.config import load_config log = logging.getLogger("beta") diff --git a/chia/util/block_cache.py b/flax/util/block_cache.py similarity index 89% rename from chia/util/block_cache.py rename to flax/util/block_cache.py index 1950d74eb..8095c2312 100644 --- a/chia/util/block_cache.py +++ b/flax/util/block_cache.py @@ -3,13 +3,13 @@ import logging from typing import Dict, List, Optional -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.header_block import HeaderBlock -from chia.types.weight_proof import SubEpochChallengeSegment, SubEpochSegments -from chia.util.ints import uint32 +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.header_block import HeaderBlock +from flax.types.weight_proof import SubEpochChallengeSegment, SubEpochSegments +from flax.util.ints import uint32 class BlockCache(BlockchainInterface): diff --git a/chia/util/byte_types.py b/flax/util/byte_types.py similarity index 100% rename from chia/util/byte_types.py rename to flax/util/byte_types.py diff --git a/chia/util/cached_bls.py b/flax/util/cached_bls.py similarity index 95% rename from chia/util/cached_bls.py rename to flax/util/cached_bls.py index fcbbf3ebf..1d0b2c9cc 100644 --- a/chia/util/cached_bls.py +++ b/flax/util/cached_bls.py @@ -5,9 +5,9 @@ from blspy import AugSchemeMPL, G1Element, G2Element, GTElement -from chia.types.blockchain_format.sized_bytes import bytes32, bytes48 -from chia.util.hash import std_hash -from chia.util.lru_cache import LRUCache +from flax.types.blockchain_format.sized_bytes import bytes32, bytes48 +from flax.util.hash import std_hash +from flax.util.lru_cache import LRUCache def get_pairings( diff --git a/chia/util/chain_utils.py b/flax/util/chain_utils.py similarity index 78% rename from chia/util/chain_utils.py rename to flax/util/chain_utils.py index e88a686c4..1f558a97c 100644 --- a/chia/util/chain_utils.py +++ b/flax/util/chain_utils.py @@ -2,11 +2,11 @@ from clvm.casts import int_from_bytes -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.condition_opcodes import ConditionOpcode -from chia.util.condition_tools import ( +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.condition_opcodes import ConditionOpcode +from flax.util.condition_tools import ( conditions_dict_for_solution, created_outputs_for_conditions_dict, ) diff --git a/chia/util/check_fork_next_block.py b/flax/util/check_fork_next_block.py similarity index 91% rename from chia/util/check_fork_next_block.py rename to flax/util/check_fork_next_block.py index 0a6945fcc..ff46072d8 100644 --- a/chia/util/check_fork_next_block.py +++ b/flax/util/check_fork_next_block.py @@ -1,7 +1,7 @@ from typing import List, Callable -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.util.ints import uint32 +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.util.ints import uint32 async def check_fork_next_block( diff --git a/chia/util/chunks.py b/flax/util/chunks.py similarity index 100% rename from chia/util/chunks.py rename to flax/util/chunks.py diff --git a/chia/util/condition_tools.py b/flax/util/condition_tools.py similarity index 88% rename from chia/util/condition_tools.py rename to flax/util/condition_tools.py index 8d756ccd9..51beeea2d 100644 --- a/chia/util/condition_tools.py +++ b/flax/util/condition_tools.py @@ -2,14 +2,14 @@ from clvm.casts import int_from_bytes -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32, bytes48 -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.util.errors import ConsensusError, Err -from chia.util.ints import uint64 -from chia.types.spend_bundle_conditions import SpendBundleConditions +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32, bytes48 +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.util.errors import ConsensusError, Err +from flax.util.ints import uint64 +from flax.types.spend_bundle_conditions import SpendBundleConditions # TODO: review each `assert` and consider replacing with explicit checks # since asserts can be stripped with python `-OO` flag @@ -19,7 +19,7 @@ def parse_sexp_to_condition( sexp: Program, ) -> Tuple[Optional[Err], Optional[ConditionWithArgs]]: """ - Takes a ChiaLisp sexp and returns a ConditionWithArgs. + Takes a FlaxLisp sexp and returns a ConditionWithArgs. If it fails, returns an Error """ as_atoms = sexp.as_atom_list() @@ -34,7 +34,7 @@ def parse_sexp_to_conditions( sexp: Program, ) -> Tuple[Optional[Err], Optional[List[ConditionWithArgs]]]: """ - Takes a ChiaLisp sexp (list) and returns the list of ConditionWithArgss + Takes a FlaxLisp sexp (list) and returns the list of ConditionWithArgss If it fails, returns as Error """ results: List[ConditionWithArgs] = [] diff --git a/chia/util/config.py b/flax/util/config.py similarity index 98% rename from chia/util/config.py rename to flax/util/config.py index af38e9dc6..bd79b804f 100644 --- a/chia/util/config.py +++ b/flax/util/config.py @@ -17,7 +17,7 @@ import yaml from typing_extensions import Literal -from chia.util.lock import Lockfile +from flax.util.lock import Lockfile PEER_DB_PATH_KEY_DEPRECATED = "peer_db_path" # replaced by "peers_file_path" WALLET_PEERS_PATH_KEY_DEPRECATED = "wallet_peers_path" # replaced by "wallet_peers_file_path" @@ -29,7 +29,7 @@ def initial_config_file(filename: Union[str, Path]) -> str: return pkg_resources.resource_string(__name__, f"initial-{filename}").decode() -def create_default_chia_config(root_path: Path, filenames=["config.yaml"]) -> None: +def create_default_flax_config(root_path: Path, filenames=["config.yaml"]) -> None: for filename in filenames: default_config_file_data: str = initial_config_file(filename) path: Path = config_path_for_filename(root_path, filename) @@ -122,7 +122,7 @@ def _load_config_maybe_locked( if not exit_on_error: raise ValueError("Config not found") print(f"can't find {path}") - print("** please run `chia init` to migrate or create new config files **") + print("** please run `flax init` to migrate or create new config files **") # TODO: fix this hack sys.exit(-1) # This loop should not be necessary due to the config lock, but it's kept here just in case diff --git a/chia/util/create_alert_file.py b/flax/util/create_alert_file.py similarity index 96% rename from chia/util/create_alert_file.py rename to flax/util/create_alert_file.py index a78619ae5..074cadd20 100644 --- a/chia/util/create_alert_file.py +++ b/flax/util/create_alert_file.py @@ -5,9 +5,9 @@ from blspy import AugSchemeMPL -from chia.util.ints import uint32 -from chia.util.keychain import Keychain -from chia.util.validate_alert import create_alert_file, create_not_ready_alert_file, validate_alert_file +from flax.util.ints import uint32 +from flax.util.keychain import Keychain +from flax.util.validate_alert import create_alert_file, create_not_ready_alert_file, validate_alert_file bitcoin_hash = None bram_message = None diff --git a/chia/util/db_synchronous.py b/flax/util/db_synchronous.py similarity index 100% rename from chia/util/db_synchronous.py rename to flax/util/db_synchronous.py diff --git a/chia/util/db_version.py b/flax/util/db_version.py similarity index 100% rename from chia/util/db_version.py rename to flax/util/db_version.py diff --git a/chia/util/db_wrapper.py b/flax/util/db_wrapper.py similarity index 100% rename from chia/util/db_wrapper.py rename to flax/util/db_wrapper.py diff --git a/flax/util/default_root.py b/flax/util/default_root.py new file mode 100644 index 000000000..eacda3038 --- /dev/null +++ b/flax/util/default_root.py @@ -0,0 +1,8 @@ +from __future__ import annotations + +import os +from pathlib import Path + +DEFAULT_ROOT_PATH = Path(os.path.expanduser(os.getenv("FLAX_ROOT", "~/.flax/mainnet"))).resolve() + +DEFAULT_KEYS_ROOT_PATH = Path(os.path.expanduser(os.getenv("FLAX_KEYS_ROOT", "~/.flax_keys"))).resolve() diff --git a/chia/util/dump_keyring.py b/flax/util/dump_keyring.py old mode 100755 new mode 100644 similarity index 91% rename from chia/util/dump_keyring.py rename to flax/util/dump_keyring.py index 675ee8468..d482ee817 --- a/chia/util/dump_keyring.py +++ b/flax/util/dump_keyring.py @@ -4,10 +4,10 @@ import colorama import yaml -from chia.cmds.passphrase_funcs import prompt_for_passphrase, read_passphrase_from_file -from chia.util.default_root import DEFAULT_KEYS_ROOT_PATH -from chia.util.file_keyring import FileKeyringContent -from chia.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE, KeyringWrapper +from flax.cmds.passphrase_funcs import prompt_for_passphrase, read_passphrase_from_file +from flax.util.default_root import DEFAULT_KEYS_ROOT_PATH +from flax.util.file_keyring import FileKeyringContent +from flax.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE, KeyringWrapper from cryptography.exceptions import InvalidTag from io import TextIOWrapper from pathlib import Path diff --git a/chia/util/english.txt b/flax/util/english.txt similarity index 100% rename from chia/util/english.txt rename to flax/util/english.txt diff --git a/chia/util/errors.py b/flax/util/errors.py similarity index 100% rename from chia/util/errors.py rename to flax/util/errors.py diff --git a/chia/util/file_keyring.py b/flax/util/file_keyring.py similarity index 97% rename from chia/util/file_keyring.py rename to flax/util/file_keyring.py index 25639d560..0d3e2c637 100644 --- a/chia/util/file_keyring.py +++ b/flax/util/file_keyring.py @@ -18,10 +18,10 @@ from watchdog.events import DirModifiedEvent, FileSystemEvent, FileSystemEventHandler from watchdog.observers import Observer -from chia.util.default_root import DEFAULT_KEYS_ROOT_PATH -from chia.util.errors import KeychainFingerprintNotFound, KeychainLabelExists, KeychainLabelInvalid -from chia.util.lock import Lockfile -from chia.util.streamable import convert_byte_type +from flax.util.default_root import DEFAULT_KEYS_ROOT_PATH +from flax.util.errors import KeychainFingerprintNotFound, KeychainLabelExists, KeychainLabelInvalid +from flax.util.lock import Lockfile +from flax.util.streamable import convert_byte_type SALT_BYTES = 16 # PBKDF2 param NONCE_BYTES = 12 # ChaCha20Poly1305 nonce is 12-bytes @@ -52,7 +52,7 @@ def symmetric_key_from_passphrase(passphrase: str, salt: bytes) -> bytes: def get_symmetric_key(salt: bytes) -> bytes: - from chia.cmds.passphrase_funcs import obtain_current_passphrase + from flax.cmds.passphrase_funcs import obtain_current_passphrase try: passphrase = obtain_current_passphrase(use_passphrase_cache=True) @@ -359,7 +359,7 @@ def check_passphrase(self, passphrase: str, force_reload: bool = False) -> bool: return False def load_keyring(self, passphrase: Optional[str] = None) -> None: - from chia.cmds.passphrase_funcs import obtain_current_passphrase + from flax.cmds.passphrase_funcs import obtain_current_passphrase with self.load_keyring_lock: self.needs_load_keyring = False @@ -376,8 +376,8 @@ def load_keyring(self, passphrase: Optional[str] = None) -> None: self.cached_data_dict.update(self.cached_file_content.get_decrypted_data_dict(passphrase)) def write_keyring(self, fresh_salt: bool = False) -> None: - from chia.cmds.passphrase_funcs import obtain_current_passphrase - from chia.util.keyring_wrapper import KeyringWrapper + from flax.cmds.passphrase_funcs import obtain_current_passphrase + from flax.util.keyring_wrapper import KeyringWrapper # Merge in other properties like "passphrase_hint" if "passphrase_hint" in self.file_content_properties_for_next_write: diff --git a/chia/util/files.py b/flax/util/files.py similarity index 100% rename from chia/util/files.py rename to flax/util/files.py diff --git a/chia/util/chia_logging.py b/flax/util/flax_logging.py similarity index 95% rename from chia/util/chia_logging.py rename to flax/util/flax_logging.py index 0fa8fe4f1..549136fd7 100644 --- a/chia/util/chia_logging.py +++ b/flax/util/flax_logging.py @@ -6,16 +6,16 @@ from concurrent_log_handler import ConcurrentRotatingFileHandler from logging.handlers import SysLogHandler -from chia.cmds.init_funcs import chia_full_version_str -from chia.util.path import path_from_root -from chia.util.default_root import DEFAULT_ROOT_PATH +from flax.cmds.init_funcs import flax_full_version_str +from flax.util.path import path_from_root +from flax.util.default_root import DEFAULT_ROOT_PATH default_log_level = "WARNING" def get_beta_logging_config() -> Dict[str, Any]: return { - "log_filename": f"{chia_full_version_str()}/chia-blockchain/beta.log", + "log_filename": f"{flax_full_version_str()}/flax-blockchain/beta.log", "log_level": "DEBUG", "log_stdout": False, "log_maxfilesrotation": 100, diff --git a/chia/util/full_block_utils.py b/flax/util/full_block_utils.py similarity index 97% rename from chia/util/full_block_utils.py rename to flax/util/full_block_utils.py index 3fcb51950..92b40b35b 100644 --- a/chia/util/full_block_utils.py +++ b/flax/util/full_block_utils.py @@ -8,11 +8,11 @@ from chia_rs import serialized_length from chiabip158 import PyBIP158 -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.foliage import TransactionsInfo -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.foliage import TransactionsInfo +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 def skip_list(buf: memoryview, skip_item: Callable[[memoryview], memoryview]) -> memoryview: diff --git a/chia/util/generator_tools.py b/flax/util/generator_tools.py similarity index 87% rename from chia/util/generator_tools.py rename to flax/util/generator_tools.py index 65ea769c4..feb024d98 100644 --- a/chia/util/generator_tools.py +++ b/flax/util/generator_tools.py @@ -1,13 +1,13 @@ from typing import Any, Iterator, List, Tuple, Optional from chiabip158 import PyBIP158 -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.types.header_block import HeaderBlock -from chia.types.spend_bundle_conditions import SpendBundleConditions -from chia.consensus.cost_calculator import NPCResult -from chia.util.ints import uint64 +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.types.header_block import HeaderBlock +from flax.types.spend_bundle_conditions import SpendBundleConditions +from flax.consensus.cost_calculator import NPCResult +from flax.util.ints import uint64 def get_block_header(block: FullBlock, tx_addition_coins: List[Coin], removals_names: List[bytes32]) -> HeaderBlock: diff --git a/chia/util/hash.py b/flax/util/hash.py similarity index 84% rename from chia/util/hash.py rename to flax/util/hash.py index 60304d2de..303d7bbee 100644 --- a/chia/util/hash.py +++ b/flax/util/hash.py @@ -2,7 +2,7 @@ from hashlib import sha256 -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sized_bytes import bytes32 def std_hash(b, skip_bytes_conversion: bool = False) -> bytes32: diff --git a/chia/util/initial-config.yaml b/flax/util/initial-config.yaml similarity index 76% rename from chia/util/initial-config.yaml rename to flax/util/initial-config.yaml index f46bb6dd4..59c7a1c14 100644 --- a/chia/util/initial-config.yaml +++ b/flax/util/initial-config.yaml @@ -4,7 +4,7 @@ min_mainnet_k_size: 32 ping_interval: 120 self_hostname: &self_hostname "localhost" prefer_ipv6: False -daemon_port: 55400 +daemon_port: 56600 daemon_max_message_size: 50000000 # maximum size of RPC message in bytes inbound_rate_limit_percent: 100 outbound_rate_limit_percent: 30 @@ -12,89 +12,24 @@ outbound_rate_limit_percent: 30 network_overrides: &network_overrides constants: mainnet: - GENESIS_CHALLENGE: ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc" - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af" + NETWORK_TYPE: 0 + GENESIS_CHALLENGE: 9b9ffca948750d8b41ac755da213461e9d2253ec7bfce80695d78f7fe7d55112 + GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "e8e245e2e6536e17fd7cbc2e3bd90de06f55362ee3c84cea5a68391e5bad7ef6" + GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "e8e245e2e6536e17fd7cbc2e3bd90de06f55362ee3c84cea5a68391e5bad7ef6" testnet0: - MIN_PLOT_SIZE: 18 - GENESIS_CHALLENGE: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc" - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af" - testnet2: - MIN_PLOT_SIZE: 18 - GENESIS_CHALLENGE: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc" - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af" - testnet3: - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_CHALLENGE: ca7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MIN_PLOT_SIZE: 18 - MEMPOOL_BLOCK_BUFFER: 10 - testnet4: - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_CHALLENGE: dd7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MIN_PLOT_SIZE: 18 - MEMPOOL_BLOCK_BUFFER: 10 - EPOCH_BLOCKS: 768 - DIFFICULTY_STARTING: 30 - testnet5: - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_CHALLENGE: ee7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MIN_PLOT_SIZE: 18 - MEMPOOL_BLOCK_BUFFER: 10 - EPOCH_BLOCKS: 768 - DIFFICULTY_STARTING: 30 - testnet7: - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - GENESIS_CHALLENGE: 117816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015af - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MIN_PLOT_SIZE: 18 - MEMPOOL_BLOCK_BUFFER: 50 - EPOCH_BLOCKS: 768 - DIFFICULTY_STARTING: 30 - testnet10: - AGG_SIG_ME_ADDITIONAL_DATA: ae83525ba8d1dd3f09b277de18ca3e43fc0af20d20c4b3e92ef2a48bd291ccb2 - DIFFICULTY_CONSTANT_FACTOR: 10052721566054 - DIFFICULTY_STARTING: 30 - EPOCH_BLOCKS: 768 - GENESIS_CHALLENGE: ae83525ba8d1dd3f09b277de18ca3e43fc0af20d20c4b3e92ef2a48bd291ccb2 - GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: 3d8765d3a597ec1d99663f6c9816d915b9f68613ac94009884c4addaefcce6af - GENESIS_PRE_FARM_POOL_PUZZLE_HASH: d23da14695a188ae5708dd152263c4db883eb27edeb936178d4d988b8f3ce5fc - MEMPOOL_BLOCK_BUFFER: 10 - MIN_PLOT_SIZE: 18 + GENESIS_CHALLENGE: 28a206a22e7e2060230c88ad149d81cc8e74bcf5e8e74aafcce8b8efe6181dbb + NETWORK_TYPE: 1 + GENESIS_PRE_FARM_POOL_PUZZLE_HASH: "e8e245e2e6536e17fd7cbc2e3bd90de06f55362ee3c84cea5a68391e5bad7ef6" + GENESIS_PRE_FARM_FARMER_PUZZLE_HASH: "e8e245e2e6536e17fd7cbc2e3bd90de06f55362ee3c84cea5a68391e5bad7ef6" config: mainnet: - address_prefix: "xch" - default_full_node_port: 8444 + address_prefix: "xfx" testnet0: - address_prefix: "txch" - default_full_node_port: 58444 - testnet1: - address_prefix: "txch" - testnet2: - address_prefix: "txch" - testnet3: - address_prefix: "txch" - testnet4: - address_prefix: "txch" - testnet7: - address_prefix: "txch" - default_full_node_port: 58444 - testnet10: - address_prefix: "txch" - default_full_node_port: 58444 + address_prefix: "txfx" selected_network: &selected_network "mainnet" -ALERTS_URL: https://download.chia.net/notify/mainnet_alert.txt -CHIA_ALERTS_PUBKEY: 89b7fd87cb56e926ecefb879a29aae308be01f31980569f6a75a69d2a9a69daefd71fb778d865f7c50d6c967e3025937 +ALERTS_URL: https://download.flaxnetwork.org/notify/mainnet_alert.txt +FLAX_ALERTS_PUBKEY: a88dc9b53e21088dcd53347eda53b533aec7cd5ff267c3968b1dfc0dc132e39575cf401f0d6bc9952404dbbfc30731c5 # public ssl ca is included in source code # Private ssl ca is used for trusted connections between machines user owns @@ -102,9 +37,9 @@ private_ssl_ca: crt: "config/ssl/ca/private_ca.crt" key: "config/ssl/ca/private_ca.key" -chia_ssl_ca: - crt: "config/ssl/ca/chia_ca.crt" - key: "config/ssl/ca/chia_ca.key" +flax_ssl_ca: + crt: "config/ssl/ca/flax_ca.crt" + key: "config/ssl/ca/flax_ca.key" daemon_ssl: @@ -116,7 +51,7 @@ daemon_ssl: logging: &logging log_stdout: False # If True, outputs to stdout instead of a file log_filename: "log/debug.log" - log_level: "WARNING" # Can be CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET + log_level: "INFO" # Can be CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET log_maxfilesrotation: 7 # Max files in rotation. Default value 7 if the key is not set log_maxbytesrotation: 52428800 # Max bytes logged before rotating logs log_use_gzip: False # Use gzip to compress rotated logs @@ -126,16 +61,16 @@ logging: &logging seeder: # The fake full node used for crawling will run on this port. - port: 8444 - # Most full nodes on the network run on this port. (i.e. 8444 for mainnet, 58444 for testnet). - other_peers_port: 8444 + port: 6888 + # Most full nodes on the network run on this port. (i.e. 6888 for mainnet, 56888 for testnet). + other_peers_port: 6888 # This will override the default full_node.peer_connect_timeout for the crawler full node peer_connect_timeout: 2 - # Path to crawler DB. Defaults to $CHIA_ROOT/crawler.db + # Path to crawler DB. Defaults to $FLAX_ROOT/crawler.db crawler_db_path: "crawler.db" # Peers used for the initial run. bootstrap_peers: - - "node.chia.net" + - "node.flaxnetwork.org" # Only consider nodes synced at least to this height. minimum_height: 240000 # How many of a particular version we need to see before reporting it in the logs @@ -163,14 +98,14 @@ seeder: harvester: # The harvester server (if run) will run on this port - port: 8448 + port: 6884 farmer_peer: host: *self_hostname - port: 8447 + port: 6885 # If True, starts an RPC server at the following port start_rpc_server: True - rpc_port: 8560 + rpc_port: 6760 num_threads: 30 plots_refresh_parameter: interval_seconds: 120 # The interval in seconds to refresh the plot file manager @@ -198,13 +133,13 @@ harvester: crt: "config/ssl/ca/private_ca.crt" key: "config/ssl/ca/private_ca.key" - chia_ssl_ca: - crt: "config/ssl/ca/chia_ca.crt" - key: "config/ssl/ca/chia_ca.key" + flax_ssl_ca: + crt: "config/ssl/ca/flax_ca.crt" + key: "config/ssl/ca/flax_ca.key" pool: # Replace this with a real receive address - # xch_target_address: txch102gkhhzs60grx7cfnpng5n6rjecr89r86l5s8xux2za8k820cxsq64ssdg + # xfx_target_address: txfx102gkhhzs60grx7cfnpng5n6rjecr89r86l5s8xux2za8k820cxsq64ssdg logging: *logging network_overrides: *network_overrides selected_network: *selected_network @@ -212,23 +147,23 @@ pool: farmer: # The farmer server (if run) will run on this port - port: 8447 + port: 6885 # The farmer will attempt to connect to this full node and harvester full_node_peer: host: *self_hostname - port: 8444 + port: 6888 harvester_peer: host: *self_hostname - port: 8448 + port: 6884 pool_public_keys: [] # Replace this with a real receive address - # xch_target_address: txch102gkhhzs60grx7cfnpng5n6rjecr89r86l5s8xux2za8k820cxsq64ssdg + # xfx_target_address: txfx102gkhhzs60grx7cfnpng5n6rjecr89r86l5s8xux2za8k820cxsq64ssdg # If True, starts an RPC server at the following port start_rpc_server: True - rpc_port: 8559 + rpc_port: 6759 # To send a share to a pool, a proof of space must have required_iters less than this number pool_share_threshold: 1000 @@ -246,7 +181,7 @@ farmer: timelord_launcher: # The server where the VDF clients will connect to. host: *self_hostname - port: 8000 + port: 6600 # Number of VDF client processes to keep alive in the local machine. process_count: 3 logging: *logging @@ -254,7 +189,7 @@ timelord_launcher: timelord: # The timelord server (if run) will run on this port - port: 8446 + port: 6886 # Provides a list of VDF clients expected to connect to this timelord. # For each client, an IP is provided, together with the estimated iterations per second. vdf_clients: @@ -266,13 +201,13 @@ timelord: - 150000 full_node_peer: host: *self_hostname - port: 8444 + port: 6888 # Maximum number of seconds allowed for a client to reconnect to the server. max_connection_time: 60 # The ip and port where the TCP clients will connect. vdf_server: host: *self_hostname - port: 8000 + port: 6600 logging: *logging network_overrides: *network_overrides selected_network: *selected_network @@ -312,7 +247,7 @@ timelord: full_node: # The full node server (if run) will run on this port - port: 8444 + port: 6888 # controls the sync-to-disk behavior of the database connection. Can be one of: # "on" enables syncing to disk, minimizes risk of corrupting the DB in @@ -341,7 +276,7 @@ full_node: # If True, starts an RPC server at the following port start_rpc_server: True - rpc_port: 8555 + rpc_port: 6755 # Use UPnP to attempt to allow other full nodes to reach your node behind a gateway enable_upnp: True @@ -391,7 +326,7 @@ full_node: weight_proof_timeout: &weight_proof_timeout 360 # when enabled, the full node will print a pstats profile to the root_dir/profile every second - # analyze with chia/utils/profiler.py + # analyze with flax/utils/profiler.py enable_profiler: False enable_memory_profiler: False @@ -406,19 +341,19 @@ full_node: # List of trusted DNS seeders to bootstrap from. # If you modify this, please change the hardcode as well from FullNode.set_server() dns_servers: - - "dns-introducer.chia.net" + - "dns-introducer.flaxnetwork.org" farmer_peer: host: *self_hostname - port: 8447 + port: 6885 timelord_peer: host: *self_hostname - port: 8446 + port: 6886 introducer_peer: - host: introducer.chia.net # Chia AWS introducer IPv4/IPv6 - port: 8444 + host: introducer.flaxnetwork.org # Flax AWS introducer IPv4/IPv6 + port: 6888 wallet_peer: host: *self_hostname - port: 8449 + port: 6883 logging: *logging network_overrides: *network_overrides selected_network: *selected_network @@ -431,10 +366,10 @@ full_node: ui: # The ui node server (if run) will run on this port - port: 8222 + port: 6222 # Which port to use to communicate with the full node - rpc_port: 8555 + rpc_port: 6755 # This SSH key is for the ui SSH server ssh_filename: config/ssh_host_key @@ -445,14 +380,14 @@ ui: # this is where the electron UI will find its daemon # defaults to the one running locally with its private keys daemon_host: *self_hostname - daemon_port: 55400 + daemon_port: 56600 daemon_ssl: private_crt: config/ssl/daemon/private_daemon.crt private_key: config/ssl/daemon/private_daemon.key introducer: host: *self_hostname - port: 8445 + port: 6887 max_peers_to_send: 20 # The introducer will only return peers it has seen in the last # recent_peer_threshold seconds @@ -466,8 +401,8 @@ introducer: public_key: "config/ssl/full_node/public_full_node.key" wallet: - port: 8449 - rpc_port: 9256 + port: 6883 + rpc_port: 6761 enable_profiler: False @@ -486,11 +421,11 @@ wallet: initial_num_public_keys: 425 dns_servers: - - "dns-introducer.chia.net" + - "dns-introducer.flaxnetwork.org" full_node_peer: host: *self_hostname - port: 8444 + port: 6888 # The path of NFT off-chain metadata cache nft_metadata_cache_path: "nft_cache" # The length of NFT ID prefix will be used as hash index @@ -519,8 +454,8 @@ wallet: recent_peer_threshold: 6000 introducer_peer: - host: introducer.chia.net # Chia AWS introducer IPv4/IPv6 - port: 8444 + host: introducer.flaxnetwork.org # Flax AWS introducer IPv4/IPv6 + port: 6888 ssl: private_crt: "config/ssl/wallet/private_wallet.crt" @@ -549,9 +484,9 @@ wallet: tx_resend_timeout_secs: 1800 # After n received unspent transactions, the spam filter will be enabled, which will filter out received - # coins with very small value. Any standard TX under xch_spam_amount is filtered + # coins with very small value. Any standard TX under xfx_spam_amount is filtered spam_filter_after_n_txs: 200 - xch_spam_amount: 1000000 + xfx_spam_amount: 1000000 # Accept notifications from parties on chain accept_notifications: False # The amount someone has to pay you in mojos for you to see their notification @@ -562,10 +497,10 @@ data_layer: # TODO: organize consistently with other sections # TODO: shouldn't we not need this since we have no actual public interface (yet)? - port: 8561 + port: 6761 wallet_peer: host: localhost - port: 9256 + port: 6056 database_path: "data_layer/db/data_layer_CHALLENGE.sqlite" # The location where the server files will be stored. @@ -574,14 +509,14 @@ data_layer: client_timeout: 15 # Data for running a data layer server. host_ip: 0.0.0.0 - host_port: 8575 + host_port: 6775 # Data for running a data layer client. manage_data_interval: 60 selected_network: *selected_network # If True, starts an RPC server at the following port start_rpc_server: True # TODO: what considerations are there in choosing this? - rpc_port: 8562 + rpc_port: 6762 rpc_server_max_request_body_size: 26214400 fee: 1000000000 logging: *logging @@ -606,9 +541,9 @@ simulator: farming_address: # the directory used to save plots - # for the plot directory below the final directory will be: ~/.chia/simulator/plots + # for the plot directory below the final directory will be: ~/.flax/simulator/plots plot_directory: simulator/plots # Should we use real time in the simulated chain? - # most tests don't need this, however it is pretty important when writing ChiaLisp + # most tests don't need this, however it is pretty important when writing FlaxLisp use_current_time: True diff --git a/chia/util/inline_executor.py b/flax/util/inline_executor.py similarity index 100% rename from chia/util/inline_executor.py rename to flax/util/inline_executor.py diff --git a/chia/util/ints.py b/flax/util/ints.py similarity index 93% rename from chia/util/ints.py rename to flax/util/ints.py index cbc1cd24c..9c2f54f45 100644 --- a/chia/util/ints.py +++ b/flax/util/ints.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.util.struct_stream import StructStream, parse_metadata_from_name +from flax.util.struct_stream import StructStream, parse_metadata_from_name @parse_metadata_from_name diff --git a/chia/util/json_util.py b/flax/util/json_util.py similarity index 95% rename from chia/util/json_util.py rename to flax/util/json_util.py index dc89511f3..8c7d88cba 100644 --- a/chia/util/json_util.py +++ b/flax/util/json_util.py @@ -6,7 +6,7 @@ from aiohttp import web -from chia.wallet.util.wallet_types import WalletType +from flax.wallet.util.wallet_types import WalletType class EnhancedJSONEncoder(json.JSONEncoder): diff --git a/chia/util/keychain.py b/flax/util/keychain.py similarity index 98% rename from chia/util/keychain.py rename to flax/util/keychain.py index 31b5a60c9..8a376b185 100644 --- a/chia/util/keychain.py +++ b/flax/util/keychain.py @@ -5,7 +5,7 @@ from bitstring import BitArray # pyright: reportMissingImports=false from blspy import AugSchemeMPL, G1Element, PrivateKey # pyright: reportMissingImports=false -from chia.util.errors import ( +from flax.util.errors import ( KeychainException, KeychainNotSet, KeychainKeyDataMismatch, @@ -14,10 +14,10 @@ KeychainSecretsMissing, KeychainUserNotFound, ) -from chia.util.hash import std_hash -from chia.util.ints import uint32 -from chia.util.keyring_wrapper import KeyringWrapper -from chia.util.streamable import streamable, Streamable +from flax.util.hash import std_hash +from flax.util.ints import uint32 +from flax.util.keyring_wrapper import KeyringWrapper +from flax.util.streamable import streamable, Streamable from dataclasses import dataclass from hashlib import pbkdf2_hmac from pathlib import Path @@ -27,8 +27,8 @@ from typing_extensions import final CURRENT_KEY_VERSION = "1.8" -DEFAULT_USER = f"user-chia-{CURRENT_KEY_VERSION}" # e.g. user-chia-1.8 -DEFAULT_SERVICE = f"chia-{DEFAULT_USER}" # e.g. chia-user-chia-1.8 +DEFAULT_USER = f"user-flax-{CURRENT_KEY_VERSION}" # e.g. user-flax-1.8 +DEFAULT_SERVICE = f"flax-{DEFAULT_USER}" # e.g. flax-user-flax-1.8 MAX_KEYS = 100 MIN_PASSPHRASE_LEN = 8 diff --git a/chia/util/keyring_wrapper.py b/flax/util/keyring_wrapper.py similarity index 95% rename from chia/util/keyring_wrapper.py rename to flax/util/keyring_wrapper.py index 475a0b6c6..9e2e8818e 100644 --- a/chia/util/keyring_wrapper.py +++ b/flax/util/keyring_wrapper.py @@ -1,7 +1,7 @@ from blspy import PrivateKey # pyright: reportMissingImports=false -from chia.util.default_root import DEFAULT_KEYS_ROOT_PATH -from chia.util.file_keyring import FileKeyring -from chia.util.misc import prompt_yes_no +from flax.util.default_root import DEFAULT_KEYS_ROOT_PATH +from flax.util.file_keyring import FileKeyring +from flax.util.misc import prompt_yes_no from keyrings.cryptfile.cryptfile import CryptFileKeyring # pyright: reportMissingImports=false from keyring.backends.macOS import Keyring as MacKeyring from keyring.backends.Windows import WinVaultKeyring as WinKeyring @@ -16,10 +16,10 @@ # WARNING: Changing the default passphrase will prevent passphrase-less users from accessing # their existing keys. Using a new default passphrase requires migrating existing users to # the new passphrase. -DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE = "$ chia passphrase set # all the cool kids are doing it!" +DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE = "$ flax passphrase set # all the cool kids are doing it!" -MASTER_PASSPHRASE_SERVICE_NAME = "Chia Passphrase" -MASTER_PASSPHRASE_USER_NAME = "Chia Passphrase" +MASTER_PASSPHRASE_SERVICE_NAME = "Flax Passphrase" +MASTER_PASSPHRASE_USER_NAME = "Flax Passphrase" LegacyKeyring = Union[MacKeyring, WinKeyring, CryptFileKeyring] @@ -48,7 +48,7 @@ def get_os_passphrase_store() -> Optional[OSPassphraseStore]: def check_legacy_keyring_keys_present(keyring: LegacyKeyring) -> bool: from keyring.credentials import Credential - from chia.util.keychain import default_keychain_user, default_keychain_service, get_private_key_user, MAX_KEYS + from flax.util.keychain import default_keychain_user, default_keychain_service, get_private_key_user, MAX_KEYS keychain_user: str = default_keychain_user() keychain_service: str = default_keychain_service() @@ -107,7 +107,7 @@ def __init__(self, keys_root_path: Path = DEFAULT_KEYS_ROOT_PATH, force_legacy: used CryptFileKeyring. We now use our own FileKeyring backend and migrate the data from the legacy CryptFileKeyring (on write). """ - from chia.util.errors import KeychainNotSet + from flax.util.errors import KeychainNotSet self.keys_root_path = keys_root_path if force_legacy: @@ -152,7 +152,7 @@ def _get_initial_cached_passphrase(self) -> str: Grab the saved passphrase from the OS credential store (if available), otherwise use the default passphrase """ - from chia.util.keychain import supports_os_passphrase_storage + from flax.util.keychain import supports_os_passphrase_storage passphrase: Optional[str] = None @@ -241,8 +241,8 @@ def set_master_passphrase( """ Sets a new master passphrase for the keyring """ - from chia.util.errors import KeychainRequiresMigration, KeychainCurrentPassphraseIsInvalid - from chia.util.keychain import supports_os_passphrase_storage + from flax.util.errors import KeychainRequiresMigration, KeychainCurrentPassphraseIsInvalid + from flax.util.keychain import supports_os_passphrase_storage # Require a valid current_passphrase if ( @@ -349,12 +349,12 @@ def confirm_migration(self) -> bool: "passphrase." ) print( - "Would you like to set a master passphrase now? Use 'chia passphrase set' to change the passphrase.\n" + "Would you like to set a master passphrase now? Use 'flax passphrase set' to change the passphrase.\n" ) response = prompt_yes_no("Set keyring master passphrase?") if response: - from chia.cmds.passphrase_funcs import prompt_for_new_passphrase + from flax.cmds.passphrase_funcs import prompt_for_new_passphrase # Prompt for a master passphrase and cache it new_passphrase, save_passphrase = prompt_for_new_passphrase() @@ -366,7 +366,7 @@ def confirm_migration(self) -> bool: ) else: print( - "Will skip setting a master passphrase. Use 'chia passphrase set' to set the master passphrase.\n" + "Will skip setting a master passphrase. Use 'flax passphrase set' to set the master passphrase.\n" ) else: import colorama @@ -383,7 +383,7 @@ def confirm_migration(self) -> bool: return prompt_yes_no("Begin keyring migration?") def migrate_legacy_keys(self) -> MigrationResults: - from chia.util.keychain import get_private_key_user, Keychain, MAX_KEYS + from flax.util.keychain import get_private_key_user, Keychain, MAX_KEYS print("Migrating contents from legacy keyring") @@ -415,7 +415,7 @@ def migrate_legacy_keys(self) -> MigrationResults: ) def verify_migration_results(self, migration_results: MigrationResults) -> bool: - from chia.util.keychain import Keychain + from flax.util.keychain import Keychain # Stop using the legacy keyring. This will direct subsequent reads to the new keyring. self.legacy_keyring = None @@ -490,11 +490,11 @@ async def migrate_legacy_keyring_interactive(self) -> bool: perform a before/after comparison of the keyring contents, and on success we'll prompt to cleanup the legacy keyring. """ - from chia.cmds.passphrase_funcs import async_update_daemon_migration_completed_if_running + from flax.cmds.passphrase_funcs import async_update_daemon_migration_completed_if_running # Let the user know about the migration. if not self.confirm_migration(): - print("Migration aborted, can't run any chia commands.") + print("Migration aborted, can't run any flax commands.") return False try: diff --git a/chia/util/lock.py b/flax/util/lock.py similarity index 100% rename from chia/util/lock.py rename to flax/util/lock.py diff --git a/chia/util/log_exceptions.py b/flax/util/log_exceptions.py similarity index 100% rename from chia/util/log_exceptions.py rename to flax/util/log_exceptions.py diff --git a/chia/util/lru_cache.py b/flax/util/lru_cache.py similarity index 100% rename from chia/util/lru_cache.py rename to flax/util/lru_cache.py diff --git a/chia/util/make_test_constants.py b/flax/util/make_test_constants.py similarity index 63% rename from chia/util/make_test_constants.py rename to flax/util/make_test_constants.py index bd4506356..32a7cd56a 100644 --- a/chia/util/make_test_constants.py +++ b/flax/util/make_test_constants.py @@ -2,8 +2,8 @@ from typing import Dict -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS def make_test_constants(test_constants_overrides: Dict) -> ConsensusConstants: diff --git a/chia/util/memory_profiler.py b/flax/util/memory_profiler.py similarity index 99% rename from chia/util/memory_profiler.py rename to flax/util/memory_profiler.py index 343f84e54..f51d1cd98 100644 --- a/chia/util/memory_profiler.py +++ b/flax/util/memory_profiler.py @@ -7,7 +7,7 @@ from datetime import datetime from typing import Dict, List, Optional, Set -from chia.util.path import path_from_root +from flax.util.path import path_from_root async def mem_profile_task(root_path: pathlib.Path, service: str, log: logging.Logger) -> None: diff --git a/chia/util/merkle_set.py b/flax/util/merkle_set.py similarity index 99% rename from chia/util/merkle_set.py rename to flax/util/merkle_set.py index c8faa7735..f2a134e96 100644 --- a/chia/util/merkle_set.py +++ b/flax/util/merkle_set.py @@ -4,7 +4,7 @@ from hashlib import sha256 from typing import Any, Dict, List, Tuple -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sized_bytes import bytes32 """ A simple, confidence-inspiring Merkle Set standard diff --git a/chia/util/misc.py b/flax/util/misc.py similarity index 95% rename from chia/util/misc.py rename to flax/util/misc.py index 6bcbf560d..4607713fc 100644 --- a/chia/util/misc.py +++ b/flax/util/misc.py @@ -4,9 +4,9 @@ from pathlib import Path from typing import Any, Dict, Sequence, Union -from chia.util.errors import InvalidPathError -from chia.util.ints import uint16 -from chia.util.streamable import Streamable, recurse_jsonify, streamable +from flax.util.errors import InvalidPathError +from flax.util.ints import uint16 +from flax.util.streamable import Streamable, recurse_jsonify, streamable @streamable diff --git a/chia/util/network.py b/flax/util/network.py similarity index 90% rename from chia/util/network.py rename to flax/util/network.py index 37c6d0660..6101aa4c4 100644 --- a/chia/util/network.py +++ b/flax/util/network.py @@ -11,10 +11,10 @@ from ipaddress import ip_address, IPv4Network, IPv6Network from typing import Iterable, List, Tuple, Union, Any, Optional, Dict from typing_extensions import final -from chia.server.outbound_message import NodeType -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16 +from flax.server.outbound_message import NodeType +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16 @final @@ -81,27 +81,27 @@ def is_localhost(peer_host: str) -> bool: def class_for_type(type: NodeType) -> Any: if type is NodeType.FULL_NODE: - from chia.full_node.full_node_api import FullNodeAPI + from flax.full_node.full_node_api import FullNodeAPI return FullNodeAPI elif type is NodeType.WALLET: - from chia.wallet.wallet_node_api import WalletNodeAPI + from flax.wallet.wallet_node_api import WalletNodeAPI return WalletNodeAPI elif type is NodeType.INTRODUCER: - from chia.introducer.introducer_api import IntroducerAPI + from flax.introducer.introducer_api import IntroducerAPI return IntroducerAPI elif type is NodeType.TIMELORD: - from chia.timelord.timelord_api import TimelordAPI + from flax.timelord.timelord_api import TimelordAPI return TimelordAPI elif type is NodeType.FARMER: - from chia.farmer.farmer_api import FarmerAPI + from flax.farmer.farmer_api import FarmerAPI return FarmerAPI elif type is NodeType.HARVESTER: - from chia.harvester.harvester_api import HarvesterAPI + from flax.harvester.harvester_api import HarvesterAPI return HarvesterAPI raise ValueError("No class for type") diff --git a/chia/util/paginator.py b/flax/util/paginator.py similarity index 100% rename from chia/util/paginator.py rename to flax/util/paginator.py diff --git a/chia/util/partial_func.py b/flax/util/partial_func.py similarity index 100% rename from chia/util/partial_func.py rename to flax/util/partial_func.py diff --git a/chia/util/path.py b/flax/util/path.py similarity index 100% rename from chia/util/path.py rename to flax/util/path.py diff --git a/chia/util/permissions.py b/flax/util/permissions.py similarity index 100% rename from chia/util/permissions.py rename to flax/util/permissions.py diff --git a/chia/util/pip_import.py b/flax/util/pip_import.py similarity index 100% rename from chia/util/pip_import.py rename to flax/util/pip_import.py diff --git a/chia/util/prev_transaction_block.py b/flax/util/prev_transaction_block.py similarity index 78% rename from chia/util/prev_transaction_block.py rename to flax/util/prev_transaction_block.py index c42aec02d..2693a20fb 100644 --- a/chia/util/prev_transaction_block.py +++ b/flax/util/prev_transaction_block.py @@ -2,9 +2,9 @@ from typing import Tuple -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.util.ints import uint128 +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.util.ints import uint128 def get_prev_transaction_block( diff --git a/chia/util/profiler.py b/flax/util/profiler.py similarity index 93% rename from chia/util/profiler.py rename to flax/util/profiler.py index 6b722ac7f..ecb6d3a4c 100644 --- a/chia/util/profiler.py +++ b/flax/util/profiler.py @@ -3,20 +3,20 @@ import logging import pathlib -from chia.util.path import path_from_root +from flax.util.path import path_from_root # to use the profiler, enable it config file, "enable_profiler" -# the output will be printed to your chia root path, e.g. ~/.chia/mainnet/profile/ +# the output will be printed to your flax root path, e.g. ~/.flax/mainnet/profile/ # to analyze the profile, run: -# python chia/utils/profiler.py ~/.chia/mainnet/profile | less -r +# python flax/utils/profiler.py ~/.flax/mainnet/profile | less -r -# this will print CPU usage of the chia full node main thread at 1 second increments. +# this will print CPU usage of the flax full node main thread at 1 second increments. # find a time window of interest and analyze the profile file (which are in pstats format). # for example: -# python chia/utils/profiler.py ~/.chia/mainnet/profile 10 20 +# python flax/utils/profiler.py ~/.flax/mainnet/profile 10 20 async def profile_task(root_path: pathlib.Path, service: str, log: logging.Logger) -> None: @@ -121,7 +121,7 @@ def analyze_slot_range(profile_dir: pathlib.Path, first: int, last: int): for i in range(first, last + 1): files.append(str(profile_dir / ("slot-%05d.profile" % i))) - output_file = "chia-hotspot-%d" % first + output_file = "flax-hotspot-%d" % first if first < last: output_file += "-%d" % last diff --git a/chia/util/recursive_replace.py b/flax/util/recursive_replace.py similarity index 100% rename from chia/util/recursive_replace.py rename to flax/util/recursive_replace.py diff --git a/chia/util/safe_cancel_task.py b/flax/util/safe_cancel_task.py similarity index 100% rename from chia/util/safe_cancel_task.py rename to flax/util/safe_cancel_task.py diff --git a/flax/util/service_groups.py b/flax/util/service_groups.py new file mode 100644 index 000000000..bfa562ce3 --- /dev/null +++ b/flax/util/service_groups.py @@ -0,0 +1,39 @@ +from typing import KeysView, Generator + +SERVICES_FOR_GROUP = { + "all": ( + "flax_harvester flax_timelord_launcher flax_timelord flax_farmer " + "flax_full_node flax_wallet flax_data_layer flax_data_layer_http" + ).split(), + # TODO: should this be `data_layer`? + "data": "flax_wallet flax_data_layer".split(), + "data_layer_http": "flax_data_layer_http".split(), + "node": "flax_full_node".split(), + "harvester": "flax_harvester".split(), + "farmer": "flax_harvester flax_farmer flax_full_node flax_wallet".split(), + "farmer-no-wallet": "flax_harvester flax_farmer flax_full_node".split(), + "farmer-only": "flax_farmer".split(), + "timelord": "flax_timelord_launcher flax_timelord flax_full_node".split(), + "timelord-only": "flax_timelord".split(), + "timelord-launcher-only": "flax_timelord_launcher".split(), + "wallet": "flax_wallet".split(), + "introducer": "flax_introducer".split(), + "simulator": "flax_full_node_simulator".split(), + "crawler": "flax_crawler".split(), + "seeder": "flax_crawler flax_seeder".split(), + "seeder-only": "flax_seeder".split(), +} + + +def all_groups() -> KeysView[str]: + return SERVICES_FOR_GROUP.keys() + + +def services_for_groups(groups) -> Generator[str, None, None]: + for group in groups: + for service in SERVICES_FOR_GROUP[group]: + yield service + + +def validate_service(service: str) -> bool: + return any(service in _ for _ in SERVICES_FOR_GROUP.values()) diff --git a/chia/util/setproctitle.py b/flax/util/setproctitle.py similarity index 100% rename from chia/util/setproctitle.py rename to flax/util/setproctitle.py diff --git a/chia/util/significant_bits.py b/flax/util/significant_bits.py similarity index 100% rename from chia/util/significant_bits.py rename to flax/util/significant_bits.py diff --git a/chia/util/ssl_check.py b/flax/util/ssl_check.py similarity index 95% rename from chia/util/ssl_check.py rename to flax/util/ssl_check.py index 69ec0b466..d11badc7b 100644 --- a/chia/util/ssl_check.py +++ b/flax/util/ssl_check.py @@ -1,8 +1,8 @@ import os import stat import sys -from chia.util.config import load_config, traverse_dict -from chia.util.permissions import octal_mode_string, verify_file_permissions +from flax.util.config import load_config, traverse_dict +from flax.util.permissions import octal_mode_string, verify_file_permissions from logging import Logger from pathlib import Path from typing import Dict, List, Optional, Set, Tuple @@ -17,7 +17,7 @@ ) # 0o077 CERT_CONFIG_KEY_PATHS = [ - "chia_ssl_ca:crt", + "flax_ssl_ca:crt", "daemon_ssl:private_crt", "farmer:ssl:private_crt", "farmer:ssl:public_crt", @@ -25,7 +25,7 @@ "full_node:ssl:public_crt", "data_layer:ssl:private_crt", "data_layer:ssl:public_crt", - "harvester:chia_ssl_ca:crt", + "harvester:flax_ssl_ca:crt", "harvester:private_ssl_ca:crt", "harvester:ssl:private_crt", "introducer:ssl:public_crt", @@ -37,13 +37,13 @@ "wallet:ssl:public_crt", ] KEY_CONFIG_KEY_PATHS = [ - "chia_ssl_ca:key", + "flax_ssl_ca:key", "daemon_ssl:private_key", "farmer:ssl:private_key", "farmer:ssl:public_key", "full_node:ssl:private_key", "full_node:ssl:public_key", - "harvester:chia_ssl_ca:key", + "harvester:flax_ssl_ca:key", "harvester:private_ssl_ca:key", "harvester:ssl:private_key", "introducer:ssl:public_key", @@ -62,7 +62,7 @@ def get_all_ssl_file_paths(root_path: Path) -> Tuple[List[Path], List[Path]]: """Lookup config values and append to a list of files whose permissions we need to check""" - from chia.ssl.create_ssl import get_mozilla_ca_crt + from flax.ssl.create_ssl import get_mozilla_ca_crt all_certs: List[Path] = [] all_keys: List[Path] = [] @@ -148,7 +148,7 @@ def check_ssl(root_path: Path) -> None: get_ssl_perm_warning(path, actual_permissions, expected_permissions) ) # lgtm [py/clear-text-logging-sensitive-data] print("One or more SSL files were found with permission issues.") - print("Run `chia init --fix-ssl-permissions` to fix issues.") + print("Run `flax init --fix-ssl-permissions` to fix issues.") def check_and_fix_permissions_for_ssl_file(file: Path, mask: int, updated_mode: int) -> Tuple[bool, bool]: diff --git a/chia/util/streamable.py b/flax/util/streamable.py similarity index 99% rename from chia/util/streamable.py rename to flax/util/streamable.py index 1b78c73ab..ced8918f6 100644 --- a/chia/util/streamable.py +++ b/flax/util/streamable.py @@ -25,10 +25,10 @@ from blspy import G1Element, G2Element, PrivateKey from typing_extensions import Literal, get_args, get_origin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.hash import std_hash -from chia.util.ints import uint32 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.hash import std_hash +from flax.util.ints import uint32 pp = pprint.PrettyPrinter(indent=1, width=120, compact=True) diff --git a/chia/util/struct_stream.py b/flax/util/struct_stream.py similarity index 100% rename from chia/util/struct_stream.py rename to flax/util/struct_stream.py diff --git a/chia/util/task_timing.py b/flax/util/task_timing.py similarity index 98% rename from chia/util/task_timing.py rename to flax/util/task_timing.py index ef5fe2dc6..97d21595e 100644 --- a/chia/util/task_timing.py +++ b/flax/util/task_timing.py @@ -14,15 +14,15 @@ # to enable this instrumentation, set one of the environment variables: -# CHIA_INSTRUMENT_NODE=1 -# CHIA_INSTRUMENT_WALLET=1 +# FLAX_INSTRUMENT_NODE=1 +# FLAX_INSTRUMENT_WALLET=1 # Before starting the daemon. # When exiting, profiles will be written to the `task-profile-` directory. # To generate call trees, run: -# python chia/util/task_timing.py task-profile- +# python flax/util/task_timing.py task-profile- class FrameInfo: diff --git a/chia/util/validate_alert.py b/flax/util/validate_alert.py similarity index 95% rename from chia/util/validate_alert.py rename to flax/util/validate_alert.py index e7ed7651c..b4e59b47b 100644 --- a/chia/util/validate_alert.py +++ b/flax/util/validate_alert.py @@ -5,8 +5,8 @@ from blspy import AugSchemeMPL, PublicKeyMPL, SignatureMPL -from chia.util.byte_types import hexstr_to_bytes -from chia.util.hash import std_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.util.hash import std_hash def validate_alert_file(file_path: Path, pubkey: str) -> bool: diff --git a/chia/util/vdf_prover.py b/flax/util/vdf_prover.py similarity index 72% rename from chia/util/vdf_prover.py rename to flax/util/vdf_prover.py index 455f7ad35..904d91798 100644 --- a/chia/util/vdf_prover.py +++ b/flax/util/vdf_prover.py @@ -4,11 +4,11 @@ from chiavdf import prove -from chia.consensus.constants import ConsensusConstants -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.util.ints import uint8, uint64 +from flax.consensus.constants import ConsensusConstants +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.util.ints import uint8, uint64 def get_vdf_info_and_proof( diff --git a/chia/util/ws_message.py b/flax/util/ws_message.py similarity index 97% rename from chia/util/ws_message.py rename to flax/util/ws_message.py index 70f00a897..07b0037cc 100644 --- a/chia/util/ws_message.py +++ b/flax/util/ws_message.py @@ -1,7 +1,7 @@ from secrets import token_bytes from typing import Any, Dict, Optional -from chia.util.json_util import dict_to_json_str +from flax.util.json_util import dict_to_json_str from typing_extensions import TypedDict diff --git a/chia/wallet/__init__.py b/flax/wallet/__init__.py similarity index 100% rename from chia/wallet/__init__.py rename to flax/wallet/__init__.py diff --git a/chia/wallet/block_record.py b/flax/wallet/block_record.py similarity index 84% rename from chia/wallet/block_record.py rename to flax/wallet/block_record.py index 33b6b0ea5..85044cb59 100644 --- a/chia/wallet/block_record.py +++ b/flax/wallet/block_record.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from typing import List -from chia.types.blockchain_format.coin import Coin -from chia.types.header_block import HeaderBlock -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.coin import Coin +from flax.types.header_block import HeaderBlock +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/wallet/cat_wallet/__init__.py b/flax/wallet/cat_wallet/__init__.py similarity index 100% rename from chia/wallet/cat_wallet/__init__.py rename to flax/wallet/cat_wallet/__init__.py diff --git a/flax/wallet/cat_wallet/cat_constants.py b/flax/wallet/cat_wallet/cat_constants.py new file mode 100644 index 000000000..73bab88be --- /dev/null +++ b/flax/wallet/cat_wallet/cat_constants.py @@ -0,0 +1,4 @@ +from __future__ import annotations + +DEFAULT_CATS = { +} diff --git a/chia/wallet/cat_wallet/cat_info.py b/flax/wallet/cat_wallet/cat_info.py similarity index 75% rename from chia/wallet/cat_wallet/cat_info.py rename to flax/wallet/cat_wallet/cat_info.py index 78c9fec5e..d503da5c9 100644 --- a/chia/wallet/cat_wallet/cat_info.py +++ b/flax/wallet/cat_wallet/cat_info.py @@ -1,10 +1,10 @@ from dataclasses import dataclass from typing import List, Optional, Tuple -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.wallet.lineage_proof import LineageProof -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.wallet.lineage_proof import LineageProof +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/wallet/cat_wallet/cat_outer_puzzle.py b/flax/wallet/cat_wallet/cat_outer_puzzle.py similarity index 90% rename from chia/wallet/cat_wallet/cat_outer_puzzle.py rename to flax/wallet/cat_wallet/cat_outer_puzzle.py index 3ca20b71b..45b2226d2 100644 --- a/chia/wallet/cat_wallet/cat_outer_puzzle.py +++ b/flax/wallet/cat_wallet/cat_outer_puzzle.py @@ -3,21 +3,21 @@ from dataclasses import dataclass from typing import Callable, List, Optional -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.util.ints import uint64 -from chia.wallet.cat_wallet.cat_utils import ( +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.util.ints import uint64 +from flax.wallet.cat_wallet.cat_utils import ( SpendableCAT, construct_cat_puzzle, match_cat_puzzle, unsigned_spend_bundle_for_spendable_cats, ) -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle @dataclass(frozen=True) diff --git a/chia/wallet/cat_wallet/cat_utils.py b/flax/wallet/cat_wallet/cat_utils.py similarity index 88% rename from chia/wallet/cat_wallet/cat_utils.py rename to flax/wallet/cat_wallet/cat_utils.py index c7df966ae..8dd560f47 100644 --- a/chia/wallet/cat_wallet/cat_utils.py +++ b/flax/wallet/cat_wallet/cat_utils.py @@ -3,15 +3,15 @@ from blspy import G2Element -from chia.types.blockchain_format.coin import Coin, coin_as_list -from chia.types.blockchain_format.program import Program, INFINITE_COST -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.spend_bundle import CoinSpend, SpendBundle -from chia.util.condition_tools import conditions_dict_for_solution -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.uncurried_puzzle import UncurriedPuzzle +from flax.types.blockchain_format.coin import Coin, coin_as_list +from flax.types.blockchain_format.program import Program, INFINITE_COST +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.spend_bundle import CoinSpend, SpendBundle +from flax.util.condition_tools import conditions_dict_for_solution +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.uncurried_puzzle import UncurriedPuzzle NULL_SIGNATURE = G2Element() @@ -85,7 +85,7 @@ def next_info_for_spendable_cat(spendable_cat: SpendableCAT) -> Program: c = spendable_cat.coin list = [c.parent_coin_info, spendable_cat.inner_puzzle.get_tree_hash(), c.amount] # ignoring hint error here for: - # https://github.com/Chia-Network/clvm/pull/102 + # https://github.com/Flax-Network/clvm/pull/102 return Program.to(list) # type: ignore[no-any-return] diff --git a/chia/wallet/cat_wallet/cat_wallet.py b/flax/wallet/cat_wallet/cat_wallet.py similarity index 87% rename from chia/wallet/cat_wallet/cat_wallet.py rename to flax/wallet/cat_wallet/cat_wallet.py index 219b49fe2..d33a31e78 100644 --- a/chia/wallet/cat_wallet/cat_wallet.py +++ b/flax/wallet/cat_wallet/cat_wallet.py @@ -9,55 +9,55 @@ from blspy import AugSchemeMPL, G2Element, G1Element -from chia.consensus.cost_calculator import NPCResult -from chia.full_node.bundle_tools import simple_solution_generator -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.server.ws_connection import WSChiaConnection -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.generator_types import BlockGenerator -from chia.types.spend_bundle import SpendBundle -from chia.util.byte_types import hexstr_to_bytes -from chia.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.wallet.cat_wallet.cat_constants import DEFAULT_CATS -from chia.wallet.cat_wallet.cat_info import CATInfo, LegacyCATInfo -from chia.wallet.cat_wallet.cat_utils import ( +from flax.consensus.cost_calculator import NPCResult +from flax.full_node.bundle_tools import simple_solution_generator +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.server.ws_connection import WSFlaxConnection +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.generator_types import BlockGenerator +from flax.types.spend_bundle import SpendBundle +from flax.util.byte_types import hexstr_to_bytes +from flax.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.wallet.cat_wallet.cat_constants import DEFAULT_CATS +from flax.wallet.cat_wallet.cat_info import CATInfo, LegacyCATInfo +from flax.wallet.cat_wallet.cat_utils import ( SpendableCAT, construct_cat_puzzle, match_cat_puzzle, unsigned_spend_bundle_for_spendable_cats, ) -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.cat_wallet.lineage_store import CATLineageStore -from chia.wallet.coin_selection import select_coins -from chia.wallet.derivation_record import DerivationRecord -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.outer_puzzles import AssetType -from chia.wallet.puzzle_drivers import PuzzleInfo -from chia.wallet.payment import Payment -from chia.wallet.puzzles.tails import ALL_LIMITATIONS_PROGRAMS -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.cat_wallet.lineage_store import CATLineageStore +from flax.wallet.coin_selection import select_coins +from flax.wallet.derivation_record import DerivationRecord +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.outer_puzzles import AssetType +from flax.wallet.puzzle_drivers import PuzzleInfo +from flax.wallet.payment import Payment +from flax.wallet.puzzles.tails import ALL_LIMITATIONS_PROGRAMS +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( DEFAULT_HIDDEN_PUZZLE_HASH, calculate_synthetic_secret_key, ) -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_info import WalletInfo -from chia.wallet.uncurried_puzzle import uncurry_puzzle +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_info import WalletInfo +from flax.wallet.uncurried_puzzle import uncurry_puzzle if TYPE_CHECKING: - from chia.wallet.wallet_state_manager import WalletStateManager + from flax.wallet.wallet_state_manager import WalletStateManager # This should probably not live in this file but it's for experimental right now @@ -110,7 +110,7 @@ async def create_new_cat_wallet( self.wallet_info = await wallet_state_manager.user_store.create_wallet(name, WalletType.CAT, info_as_string) try: - chia_tx, spend_bundle = await ALL_LIMITATIONS_PROGRAMS[ + flax_tx, spend_bundle = await ALL_LIMITATIONS_PROGRAMS[ cat_tail_info["identifier"] ].generate_issuance_bundle( self, @@ -168,8 +168,8 @@ async def create_new_cat_wallet( name=bytes32(token_bytes()), memos=[], ) - chia_tx = dataclasses.replace(chia_tx, spend_bundle=spend_bundle) - await self.standard_wallet.push_transaction(chia_tx) + flax_tx = dataclasses.replace(flax_tx, spend_bundle=spend_bundle) + await self.standard_wallet.push_transaction(flax_tx) await self.standard_wallet.push_transaction(cat_record) return self @@ -332,7 +332,7 @@ async def set_tail_program(self, tail_program: str) -> None: ) ) - async def coin_added(self, coin: Coin, height: uint32, peer: WSChiaConnection) -> None: + async def coin_added(self, coin: Coin, height: uint32, peer: WSFlaxConnection) -> None: """Notification from wallet state manager that wallet has been received.""" self.log.info(f"CAT wallet has been notified that {coin} was added") @@ -534,7 +534,7 @@ async def convert_puzzle_hash(self, puzzle_hash: bytes32) -> bytes32: async def get_lineage_proof_for_coin(self, coin: Coin) -> Optional[LineageProof]: return await self.lineage_store.get_lineage_proof(coin.parent_coin_info) - async def create_tandem_xch_tx( + async def create_tandem_xfx_tx( self, fee: uint64, amount_to_claim: uint64, @@ -548,21 +548,21 @@ async def create_tandem_xch_tx( """ announcement = None if fee > amount_to_claim: - chia_coins = await self.standard_wallet.select_coins(fee, min_coin_amount=min_coin_amount) - origin_id = list(chia_coins)[0].name() - chia_tx = await self.standard_wallet.generate_signed_transaction( + flax_coins = await self.standard_wallet.select_coins(fee, min_coin_amount=min_coin_amount) + origin_id = list(flax_coins)[0].name() + flax_tx = await self.standard_wallet.generate_signed_transaction( uint64(0), (await self.standard_wallet.get_new_puzzlehash()), fee=uint64(fee - amount_to_claim), - coins=chia_coins, + coins=flax_coins, origin_id=origin_id, # We specify this so that we know the coin that is making the announcement negative_change_allowed=False, coin_announcements_to_consume={announcement_to_assert} if announcement_to_assert is not None else None, ) - assert chia_tx.spend_bundle is not None + assert flax_tx.spend_bundle is not None message = None - for spend in chia_tx.spend_bundle.coin_spends: + for spend in flax_tx.spend_bundle.coin_spends: if spend.coin.name() == origin_id: conditions = spend.puzzle_reveal.to_program().run(spend.solution.to_program()).as_python() for condition in conditions: @@ -572,18 +572,18 @@ async def create_tandem_xch_tx( assert message is not None announcement = Announcement(origin_id, message) else: - chia_coins = await self.standard_wallet.select_coins(fee, min_coin_amount=min_coin_amount) - selected_amount = sum([c.amount for c in chia_coins]) - chia_tx = await self.standard_wallet.generate_signed_transaction( + flax_coins = await self.standard_wallet.select_coins(fee, min_coin_amount=min_coin_amount) + selected_amount = sum([c.amount for c in flax_coins]) + flax_tx = await self.standard_wallet.generate_signed_transaction( uint64(selected_amount + amount_to_claim - fee), (await self.standard_wallet.get_new_puzzlehash()), - coins=chia_coins, + coins=flax_coins, negative_change_allowed=True, coin_announcements_to_consume={announcement_to_assert} if announcement_to_assert is not None else None, ) - assert chia_tx.spend_bundle is not None + assert flax_tx.spend_bundle is not None - return chia_tx, announcement + return flax_tx, announcement async def generate_unsigned_spendbundle( self, @@ -620,14 +620,14 @@ async def generate_unsigned_spendbundle( selected_cat_amount = sum([c.amount for c in cat_coins]) assert selected_cat_amount >= starting_amount - # Figure out if we need to absorb/melt some XCH as part of this - regular_chia_to_claim: int = 0 + # Figure out if we need to absorb/melt some XFX as part of this + regular_flax_to_claim: int = 0 if payment_amount > starting_amount: fee = uint64(fee + payment_amount - starting_amount) elif payment_amount < starting_amount: - regular_chia_to_claim = payment_amount + regular_flax_to_claim = payment_amount - need_chia_transaction = (fee > 0 or regular_chia_to_claim > 0) and (fee - regular_chia_to_claim != 0) + need_flax_transaction = (fee > 0 or regular_flax_to_claim > 0) and (fee - regular_flax_to_claim != 0) # Calculate standard puzzle solutions change = selected_cat_amount - starting_amount @@ -647,18 +647,18 @@ async def generate_unsigned_spendbundle( # Loop through the coins we've selected and gather the information we need to spend them spendable_cat_list = [] - chia_tx = None + flax_tx = None first = True announcement: Announcement for coin in cat_coins: if first: first = False announcement = Announcement(coin.name(), std_hash(b"".join([c.name() for c in cat_coins]))) - if need_chia_transaction: - if fee > regular_chia_to_claim: - chia_tx, _ = await self.create_tandem_xch_tx( + if need_flax_transaction: + if fee > regular_flax_to_claim: + flax_tx, _ = await self.create_tandem_xfx_tx( fee, - uint64(regular_chia_to_claim), + uint64(regular_flax_to_claim), announcement_to_assert=announcement, min_coin_amount=min_coin_amount, ) @@ -668,9 +668,9 @@ async def generate_unsigned_spendbundle( coin_announcements_to_assert=coin_announcements_bytes, puzzle_announcements_to_assert=puzzle_announcements_bytes, ) - elif regular_chia_to_claim > fee: - chia_tx, _ = await self.create_tandem_xch_tx( - fee, uint64(regular_chia_to_claim), min_coin_amount=min_coin_amount + elif regular_flax_to_claim > fee: + flax_tx, _ = await self.create_tandem_xfx_tx( + fee, uint64(regular_flax_to_claim), min_coin_amount=min_coin_amount ) innersol = self.standard_wallet.make_solution( primaries=primaries, @@ -705,18 +705,18 @@ async def generate_unsigned_spendbundle( spendable_cat_list.append(new_spendable_cat) cat_spend_bundle = unsigned_spend_bundle_for_spendable_cats(CAT_MOD, spendable_cat_list) - chia_spend_bundle = SpendBundle([], G2Element()) - if chia_tx is not None and chia_tx.spend_bundle is not None: - chia_spend_bundle = chia_tx.spend_bundle + flax_spend_bundle = SpendBundle([], G2Element()) + if flax_tx is not None and flax_tx.spend_bundle is not None: + flax_spend_bundle = flax_tx.spend_bundle return ( SpendBundle.aggregate( [ cat_spend_bundle, - chia_spend_bundle, + flax_spend_bundle, ] ), - chia_tx, + flax_tx, ) async def generate_signed_transaction( @@ -748,7 +748,7 @@ async def generate_signed_transaction( max_send = await self.get_max_send_amount() if payment_sum > max_send: raise ValueError(f"Can't send more than {max_send} in a single transaction") - unsigned_spend_bundle, chia_tx = await self.generate_unsigned_spendbundle( + unsigned_spend_bundle, flax_tx = await self.generate_unsigned_spendbundle( payments, fee, coins=coins, @@ -779,24 +779,24 @@ async def generate_signed_transaction( ) ] - if chia_tx is not None: + if flax_tx is not None: tx_list.append( TransactionRecord( - confirmed_at_height=chia_tx.confirmed_at_height, - created_at_time=chia_tx.created_at_time, - to_puzzle_hash=chia_tx.to_puzzle_hash, - amount=chia_tx.amount, - fee_amount=chia_tx.fee_amount, - confirmed=chia_tx.confirmed, - sent=chia_tx.sent, + confirmed_at_height=flax_tx.confirmed_at_height, + created_at_time=flax_tx.created_at_time, + to_puzzle_hash=flax_tx.to_puzzle_hash, + amount=flax_tx.amount, + fee_amount=flax_tx.fee_amount, + confirmed=flax_tx.confirmed, + sent=flax_tx.sent, spend_bundle=None, - additions=chia_tx.additions, - removals=chia_tx.removals, - wallet_id=chia_tx.wallet_id, - sent_to=chia_tx.sent_to, - trade_id=chia_tx.trade_id, - type=chia_tx.type, - name=chia_tx.name, + additions=flax_tx.additions, + removals=flax_tx.removals, + wallet_id=flax_tx.wallet_id, + sent_to=flax_tx.sent_to, + trade_id=flax_tx.trade_id, + type=flax_tx.type, + name=flax_tx.name, memos=[], ) ) @@ -844,6 +844,6 @@ async def get_coins_to_offer( if TYPE_CHECKING: - from chia.wallet.wallet_protocol import WalletProtocol + from flax.wallet.wallet_protocol import WalletProtocol _dummy: WalletProtocol = CATWallet() diff --git a/chia/wallet/cat_wallet/lineage_store.py b/flax/wallet/cat_wallet/lineage_store.py similarity index 94% rename from chia/wallet/cat_wallet/lineage_store.py rename to flax/wallet/cat_wallet/lineage_store.py index 9a51cfa96..2b19040a2 100644 --- a/chia/wallet/cat_wallet/lineage_store.py +++ b/flax/wallet/cat_wallet/lineage_store.py @@ -3,9 +3,9 @@ import logging from typing import Dict, Optional -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2 -from chia.wallet.lineage_proof import LineageProof +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2 +from flax.wallet.lineage_proof import LineageProof log = logging.getLogger(__name__) diff --git a/chia/wallet/coin_selection.py b/flax/wallet/coin_selection.py similarity index 95% rename from chia/wallet/coin_selection.py rename to flax/wallet/coin_selection.py index aeeb7bbfb..f579ba84b 100644 --- a/chia/wallet/coin_selection.py +++ b/flax/wallet/coin_selection.py @@ -4,10 +4,10 @@ import random from typing import Dict, List, Optional, Set -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64, uint128 -from chia.wallet.wallet_coin_record import WalletCoinRecord +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64, uint128 +from flax.wallet.wallet_coin_record import WalletCoinRecord async def select_coins( diff --git a/chia/wallet/db_wallet/__init__.py b/flax/wallet/db_wallet/__init__.py similarity index 100% rename from chia/wallet/db_wallet/__init__.py rename to flax/wallet/db_wallet/__init__.py diff --git a/chia/wallet/db_wallet/db_wallet_puzzles.py b/flax/wallet/db_wallet/db_wallet_puzzles.py similarity index 89% rename from chia/wallet/db_wallet/db_wallet_puzzles.py rename to flax/wallet/db_wallet/db_wallet_puzzles.py index 992ae1725..a1d1d75b6 100644 --- a/chia/wallet/db_wallet/db_wallet_puzzles.py +++ b/flax/wallet/db_wallet/db_wallet_puzzles.py @@ -2,15 +2,15 @@ from typing import Iterator, List, Tuple, Union -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.condition_opcodes import ConditionOpcode -from chia.util.ints import uint64 -from chia.wallet.nft_wallet.nft_puzzles import NFT_STATE_LAYER_MOD, create_nft_layer_puzzle_with_curry_params -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile - -# from chia.types.condition_opcodes import ConditionOpcode -# from chia.wallet.util.merkle_tree import MerkleTree, TreeType +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.condition_opcodes import ConditionOpcode +from flax.util.ints import uint64 +from flax.wallet.nft_wallet.nft_puzzles import NFT_STATE_LAYER_MOD, create_nft_layer_puzzle_with_curry_params +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile + +# from flax.types.condition_opcodes import ConditionOpcode +# from flax.wallet.util.merkle_tree import MerkleTree, TreeType ACS_MU = Program.to(11) # returns the third argument a.k.a the full solution ACS_MU_PH = ACS_MU.get_tree_hash() diff --git a/chia/wallet/derivation_record.py b/flax/wallet/derivation_record.py similarity index 75% rename from chia/wallet/derivation_record.py rename to flax/wallet/derivation_record.py index 04ca1631c..51e57a761 100644 --- a/chia/wallet/derivation_record.py +++ b/flax/wallet/derivation_record.py @@ -4,9 +4,9 @@ from blspy import G1Element -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 -from chia.wallet.util.wallet_types import WalletType +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 +from flax.wallet.util.wallet_types import WalletType @dataclass(frozen=True) diff --git a/chia/wallet/derive_keys.py b/flax/wallet/derive_keys.py similarity index 95% rename from chia/wallet/derive_keys.py rename to flax/wallet/derive_keys.py index 5900c1c36..d0c36698a 100644 --- a/chia/wallet/derive_keys.py +++ b/flax/wallet/derive_keys.py @@ -2,14 +2,14 @@ from blspy import AugSchemeMPL, PrivateKey, G1Element -from chia.consensus.coinbase import create_puzzlehash_for_pk -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 +from flax.consensus.coinbase import create_puzzlehash_for_pk +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 # EIP 2334 bls key derivation # https://eips.ethereum.org/EIPS/eip-2334 # 12381 = bls spec number -# 8444 = Chia blockchain number and port number +# 8444 = Chia blockchain number and port number for compatibility # 0, 1, 2, 3, 4, 5, 6 farmer, pool, wallet, local, backup key, singleton, pooling authentication key numbers # Allows up to 100 pool wallets (plot NFTs) diff --git a/chia/wallet/did_wallet/__init__.py b/flax/wallet/did_wallet/__init__.py similarity index 100% rename from chia/wallet/did_wallet/__init__.py rename to flax/wallet/did_wallet/__init__.py diff --git a/chia/wallet/did_wallet/did_info.py b/flax/wallet/did_wallet/did_info.py similarity index 68% rename from chia/wallet/did_wallet/did_info.py rename to flax/wallet/did_wallet/did_info.py index cd8415301..4b8b3ba10 100644 --- a/chia/wallet/did_wallet/did_info.py +++ b/flax/wallet/did_wallet/did_info.py @@ -1,12 +1,12 @@ from dataclasses import dataclass from typing import List, Optional, Tuple -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 -from chia.util.streamable import streamable, Streamable -from chia.wallet.lineage_proof import LineageProof -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 +from flax.util.streamable import streamable, Streamable +from flax.wallet.lineage_proof import LineageProof +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.coin import Coin @streamable diff --git a/chia/wallet/did_wallet/did_wallet.py b/flax/wallet/did_wallet/did_wallet.py similarity index 95% rename from chia/wallet/did_wallet/did_wallet.py rename to flax/wallet/did_wallet/did_wallet.py index 77626a605..5e48f1eda 100644 --- a/chia/wallet/did_wallet/did_wallet.py +++ b/flax/wallet/did_wallet/did_wallet.py @@ -8,31 +8,31 @@ from blspy import AugSchemeMPL, G1Element, G2Element from secrets import token_bytes -from chia.protocols import wallet_protocol -from chia.protocols.wallet_protocol import CoinState -from chia.server.ws_connection import WSChiaConnection -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint64, uint32, uint8, uint128 -from chia.wallet.util.transaction_type import TransactionType -from chia.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict -from chia.wallet.did_wallet.did_info import DIDInfo -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_info import WalletInfo -from chia.wallet.derivation_record import DerivationRecord -from chia.wallet.did_wallet import did_wallet_puzzles -from chia.wallet.derive_keys import master_sk_to_wallet_sk_unhardened -from chia.wallet.coin_selection import select_coins -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( +from flax.protocols import wallet_protocol +from flax.protocols.wallet_protocol import CoinState +from flax.server.ws_connection import WSFlaxConnection +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint64, uint32, uint8, uint128 +from flax.wallet.util.transaction_type import TransactionType +from flax.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict +from flax.wallet.did_wallet.did_info import DIDInfo +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_info import WalletInfo +from flax.wallet.derivation_record import DerivationRecord +from flax.wallet.did_wallet import did_wallet_puzzles +from flax.wallet.derive_keys import master_sk_to_wallet_sk_unhardened +from flax.wallet.coin_selection import select_coins +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( puzzle_for_pk, puzzle_hash_for_pk, DEFAULT_HIDDEN_PUZZLE_HASH, @@ -343,7 +343,7 @@ async def select_coins( return coins # This will be used in the recovery case where we don't have the parent info already - async def coin_added(self, coin: Coin, _: uint32, peer: WSChiaConnection): + async def coin_added(self, coin: Coin, _: uint32, peer: WSFlaxConnection): """Notification from wallet state manager that wallet has been received.""" parent = self.get_parent_for_coin(coin) @@ -436,7 +436,7 @@ async def load_parent(self, did_info: DIDInfo): did_wallet_puzzles.metadata_to_program(json.loads(self.did_info.metadata)), ) wallet_node = self.wallet_state_manager.wallet_node - peer: WSChiaConnection = wallet_node.get_full_node_peer() + peer: WSFlaxConnection = wallet_node.get_full_node_peer() if peer is None: raise ValueError("Could not find any peers to request puzzle and solution from") @@ -485,19 +485,19 @@ async def load_parent(self, did_info: DIDInfo): parent_coin = child_coin assert parent_info is not None - async def create_tandem_xch_tx( + async def create_tandem_xfx_tx( self, fee: uint64, announcement_to_assert: Optional[Announcement] = None ) -> TransactionRecord: - chia_coins = await self.standard_wallet.select_coins(fee) - chia_tx = await self.standard_wallet.generate_signed_transaction( + flax_coins = await self.standard_wallet.select_coins(fee) + flax_tx = await self.standard_wallet.generate_signed_transaction( uint64(0), (await self.standard_wallet.get_new_puzzlehash()), fee=fee, - coins=chia_coins, + coins=flax_coins, coin_announcements_to_consume={announcement_to_assert} if announcement_to_assert is not None else None, ) - assert chia_tx.spend_bundle is not None - return chia_tx + assert flax_tx.spend_bundle is not None + return flax_tx def puzzle_for_pk(self, pubkey: G1Element) -> Program: if self.did_info.origin_coin is not None: @@ -586,14 +586,14 @@ async def create_update_spend(self, fee: uint64 = uint64(0)): spend_bundle = await self.sign(unsigned_spend_bundle) if fee > 0: announcement_to_make = coin.name() - chia_tx = await self.create_tandem_xch_tx(fee, Announcement(coin.name(), announcement_to_make)) + flax_tx = await self.create_tandem_xfx_tx(fee, Announcement(coin.name(), announcement_to_make)) else: announcement_to_make = None - chia_tx = None - if chia_tx is not None and chia_tx.spend_bundle is not None: - spend_bundle = SpendBundle.aggregate([spend_bundle, chia_tx.spend_bundle]) - chia_tx = dataclasses.replace(chia_tx, spend_bundle=None) - await self.wallet_state_manager.add_pending_transaction(chia_tx) + flax_tx = None + if flax_tx is not None and flax_tx.spend_bundle is not None: + spend_bundle = SpendBundle.aggregate([spend_bundle, flax_tx.spend_bundle]) + flax_tx = dataclasses.replace(flax_tx, spend_bundle=None) + await self.wallet_state_manager.add_pending_transaction(flax_tx) did_record = TransactionRecord( confirmed_at_height=uint32(0), created_at_time=uint64(int(time.time())), @@ -681,13 +681,13 @@ async def transfer_did(self, new_puzhash: bytes32, fee: uint64, with_recovery: b spend_bundle = await self.sign(unsigned_spend_bundle) if fee > 0: announcement_to_make = coin.name() - chia_tx = await self.create_tandem_xch_tx(fee, Announcement(coin.name(), announcement_to_make)) + flax_tx = await self.create_tandem_xfx_tx(fee, Announcement(coin.name(), announcement_to_make)) else: - chia_tx = None - if chia_tx is not None and chia_tx.spend_bundle is not None: - spend_bundle = SpendBundle.aggregate([spend_bundle, chia_tx.spend_bundle]) - chia_tx = dataclasses.replace(chia_tx, spend_bundle=None) - await self.wallet_state_manager.add_pending_transaction(chia_tx) + flax_tx = None + if flax_tx is not None and flax_tx.spend_bundle is not None: + spend_bundle = SpendBundle.aggregate([spend_bundle, flax_tx.spend_bundle]) + flax_tx = dataclasses.replace(flax_tx, spend_bundle=None) + await self.wallet_state_manager.add_pending_transaction(flax_tx) did_record = TransactionRecord( confirmed_at_height=uint32(0), created_at_time=uint64(int(time.time())), @@ -1110,7 +1110,7 @@ async def sign_message(self, message: str) -> Tuple[G1Element, G2Element]: pubkey, private = await self.wallet_state_manager.get_keys(puzzle_hash) synthetic_secret_key = calculate_synthetic_secret_key(private, DEFAULT_HIDDEN_PUZZLE_HASH) synthetic_pk = synthetic_secret_key.get_g1() - puzzle: Program = Program.to(("Chia Signed Message", message)) + puzzle: Program = Program.to(("Flax Signed Message", message)) return synthetic_pk, AugSchemeMPL.sign(synthetic_secret_key, puzzle.get_tree_hash()) else: raise ValueError("Invalid inner DID puzzle.") @@ -1401,6 +1401,6 @@ def require_derivation_paths(self) -> bool: if TYPE_CHECKING: - from chia.wallet.wallet_protocol import WalletProtocol + from flax.wallet.wallet_protocol import WalletProtocol _dummy: WalletProtocol = DIDWallet() diff --git a/chia/wallet/did_wallet/did_wallet_puzzles.py b/flax/wallet/did_wallet/did_wallet_puzzles.py similarity index 93% rename from chia/wallet/did_wallet/did_wallet_puzzles.py rename to flax/wallet/did_wallet/did_wallet_puzzles.py index 5627628d7..66f5938ac 100644 --- a/chia/wallet/did_wallet/did_wallet_puzzles.py +++ b/flax/wallet/did_wallet/did_wallet_puzzles.py @@ -1,13 +1,13 @@ -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.program import Program from typing import List, Optional, Tuple, Iterator, Dict from blspy import G1Element -from chia.types.blockchain_format.coin import Coin -from chia.types.coin_spend import CoinSpend -from chia.util.ints import uint64 -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.types.condition_opcodes import ConditionOpcode -from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash +from flax.types.blockchain_format.coin import Coin +from flax.types.coin_spend import CoinSpend +from flax.util.ints import uint64 +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.types.condition_opcodes import ConditionOpcode +from flax.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm") SINGLETON_TOP_LAYER_MOD_HASH = SINGLETON_TOP_LAYER_MOD.get_tree_hash() @@ -218,9 +218,9 @@ def check_is_did_puzzle(puzzle: Program) -> bool: def metadata_to_program(metadata: Dict) -> Program: """ - Convert the metadata dict to a Chialisp program + Convert the metadata dict to a Flaxlisp program :param metadata: User defined metadata - :return: Chialisp program + :return: Flaxlisp program """ kv_list = [] for key, value in metadata.items(): @@ -231,7 +231,7 @@ def metadata_to_program(metadata: Dict) -> Program: def program_to_metadata(program: Program) -> Dict: """ Convert a program to a metadata dict - :param program: Chialisp program contains the metadata + :param program: Flaxlisp program contains the metadata :return: Metadata dict """ metadata = {} diff --git a/chia/wallet/driver_protocol.py b/flax/wallet/driver_protocol.py similarity index 76% rename from chia/wallet/driver_protocol.py rename to flax/wallet/driver_protocol.py index 624400a8e..8aebf581f 100644 --- a/chia/wallet/driver_protocol.py +++ b/flax/wallet/driver_protocol.py @@ -4,10 +4,10 @@ from typing_extensions import Protocol -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.uncurried_puzzle import UncurriedPuzzle +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.uncurried_puzzle import UncurriedPuzzle class DriverProtocol(Protocol): diff --git a/chia/wallet/chialisp.py b/flax/wallet/flaxlisp.py similarity index 100% rename from chia/wallet/chialisp.py rename to flax/wallet/flaxlisp.py diff --git a/chia/wallet/key_val_store.py b/flax/wallet/key_val_store.py similarity index 97% rename from chia/wallet/key_val_store.py rename to flax/wallet/key_val_store.py index 66d9e3f36..8714e79dd 100644 --- a/chia/wallet/key_val_store.py +++ b/flax/wallet/key_val_store.py @@ -2,7 +2,7 @@ from typing import Any -from chia.util.db_wrapper import DBWrapper2 +from flax.util.db_wrapper import DBWrapper2 class KeyValStore: diff --git a/chia/wallet/lineage_proof.py b/flax/wallet/lineage_proof.py similarity index 78% rename from chia/wallet/lineage_proof.py rename to flax/wallet/lineage_proof.py index ec5d3119d..b4792a0d4 100644 --- a/chia/wallet/lineage_proof.py +++ b/flax/wallet/lineage_proof.py @@ -1,10 +1,10 @@ from dataclasses import dataclass from typing import Optional, Any, List -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.program import Program -from chia.util.ints import uint64 -from chia.util.streamable import Streamable, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.program import Program +from flax.util.ints import uint64 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/wallet/nft_wallet/__init__.py b/flax/wallet/nft_wallet/__init__.py similarity index 100% rename from chia/wallet/nft_wallet/__init__.py rename to flax/wallet/nft_wallet/__init__.py diff --git a/chia/wallet/nft_wallet/metadata_outer_puzzle.py b/flax/wallet/nft_wallet/metadata_outer_puzzle.py similarity index 91% rename from chia/wallet/nft_wallet/metadata_outer_puzzle.py rename to flax/wallet/nft_wallet/metadata_outer_puzzle.py index 80b934853..f9177a967 100644 --- a/chia/wallet/nft_wallet/metadata_outer_puzzle.py +++ b/flax/wallet/nft_wallet/metadata_outer_puzzle.py @@ -5,13 +5,13 @@ from clvm_tools.binutils import disassemble -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle NFT_STATE_LAYER_MOD = load_clvm_maybe_recompile("nft_state_layer.clvm") NFT_STATE_LAYER_MOD_HASH = NFT_STATE_LAYER_MOD.get_tree_hash() diff --git a/chia/wallet/nft_wallet/nft_info.py b/flax/wallet/nft_wallet/nft_info.py similarity index 87% rename from chia/wallet/nft_wallet/nft_info.py rename to flax/wallet/nft_wallet/nft_info.py index 1017bc5a2..37ef0ed01 100644 --- a/chia/wallet/nft_wallet/nft_info.py +++ b/flax/wallet/nft_wallet/nft_info.py @@ -3,13 +3,13 @@ from dataclasses import dataclass from typing import List, Optional -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint16, uint32, uint64 -from chia.util.streamable import Streamable, streamable -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint16, uint32, uint64 +from flax.util.streamable import Streamable, streamable +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile LAUNCHER_PUZZLE = load_clvm_maybe_recompile("singleton_launcher.clvm") IN_TRANSACTION_STATUS = "IN_TRANSACTION" diff --git a/chia/wallet/nft_wallet/nft_puzzles.py b/flax/wallet/nft_wallet/nft_puzzles.py similarity index 95% rename from chia/wallet/nft_wallet/nft_puzzles.py rename to flax/wallet/nft_wallet/nft_puzzles.py index f1dbef46a..982135a0d 100644 --- a/chia/wallet/nft_wallet/nft_puzzles.py +++ b/flax/wallet/nft_wallet/nft_puzzles.py @@ -6,13 +6,13 @@ from clvm.casts import int_from_bytes from clvm_tools.binutils import disassemble -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint16, uint64 -from chia.wallet.nft_wallet.nft_info import NFTCoinInfo, NFTInfo -from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import solution_for_conditions +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint16, uint64 +from flax.wallet.nft_wallet.nft_info import NFTCoinInfo, NFTInfo +from flax.wallet.nft_wallet.uncurry_nft import UncurriedNFT +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import solution_for_conditions log = logging.getLogger(__name__) SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm") @@ -130,9 +130,9 @@ async def get_nft_info_from_puzzle( def metadata_to_program(metadata: Dict[bytes, Any]) -> Program: """ - Convert the metadata dict to a Chialisp program + Convert the metadata dict to a Flaxlisp program :param metadata: User defined metadata - :return: Chialisp program + :return: Flaxlisp program """ kv_list = [] for key, value in metadata.items(): @@ -144,7 +144,7 @@ def metadata_to_program(metadata: Dict[bytes, Any]) -> Program: def program_to_metadata(program: Program) -> Dict[bytes, Any]: """ Convert a program to a metadata dict - :param program: Chialisp program contains the metadata + :param program: Flaxlisp program contains the metadata :return: Metadata dict """ metadata = {} diff --git a/chia/wallet/nft_wallet/nft_wallet.py b/flax/wallet/nft_wallet/nft_wallet.py similarity index 91% rename from chia/wallet/nft_wallet/nft_wallet.py rename to flax/wallet/nft_wallet/nft_wallet.py index 90409b7b7..571d5109b 100644 --- a/chia/wallet/nft_wallet/nft_wallet.py +++ b/flax/wallet/nft_wallet/nft_wallet.py @@ -10,43 +10,43 @@ from blspy import AugSchemeMPL, G1Element, G2Element from clvm.casts import int_from_bytes, int_to_bytes -from chia.protocols.wallet_protocol import CoinState -from chia.server.ws_connection import WSChiaConnection -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.spend_bundle import SpendBundle -from chia.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint16, uint32, uint64, uint128 -from chia.wallet.derivation_record import DerivationRecord -from chia.wallet.did_wallet import did_wallet_puzzles -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.nft_wallet import nft_puzzles -from chia.wallet.nft_wallet.nft_info import NFTCoinInfo, NFTWalletInfo -from chia.wallet.nft_wallet.nft_puzzles import NFT_METADATA_UPDATER, create_ownership_layer_puzzle, get_metadata_and_phs -from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT -from chia.wallet.outer_puzzles import AssetType, construct_puzzle, match_puzzle, solve_puzzle -from chia.wallet.payment import Payment -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( +from flax.protocols.wallet_protocol import CoinState +from flax.server.ws_connection import WSFlaxConnection +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.spend_bundle import SpendBundle +from flax.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint16, uint32, uint64, uint128 +from flax.wallet.derivation_record import DerivationRecord +from flax.wallet.did_wallet import did_wallet_puzzles +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.nft_wallet import nft_puzzles +from flax.wallet.nft_wallet.nft_info import NFTCoinInfo, NFTWalletInfo +from flax.wallet.nft_wallet.nft_puzzles import NFT_METADATA_UPDATER, create_ownership_layer_puzzle, get_metadata_and_phs +from flax.wallet.nft_wallet.uncurry_nft import UncurriedNFT +from flax.wallet.outer_puzzles import AssetType, construct_puzzle, match_puzzle, solve_puzzle +from flax.wallet.payment import Payment +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( DEFAULT_HIDDEN_PUZZLE_HASH, calculate_synthetic_secret_key, puzzle_for_pk, ) -from chia.wallet.trading.offer import OFFER_MOD, OFFER_MOD_HASH, NotarizedPayment, Offer -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.uncurried_puzzle import uncurry_puzzle -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.util.debug_spend_bundle import disassemble -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_info import WalletInfo -from chia.wallet.wallet_nft_store import WalletNftStore +from flax.wallet.trading.offer import OFFER_MOD, OFFER_MOD_HASH, NotarizedPayment, Offer +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.uncurried_puzzle import uncurry_puzzle +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.util.debug_spend_bundle import disassemble +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_info import WalletInfo +from flax.wallet.wallet_nft_store import WalletNftStore _T_NFTWallet = TypeVar("_T_NFTWallet", bound="NFTWallet") @@ -148,7 +148,7 @@ async def get_nft_coin_by_id(self, nft_coin_id: bytes32) -> NFTCoinInfo: raise KeyError(f"Couldn't find coin with id: {nft_coin_id}") return nft_coin - async def coin_added(self, coin: Coin, height: uint32, peer: WSChiaConnection) -> None: + async def coin_added(self, coin: Coin, height: uint32, peer: WSFlaxConnection) -> None: """Notification from wallet state manager that wallet has been received.""" self.log.info(f"NFT wallet %s has been notified that {coin} was added", self.wallet_info.name) if await self.nft_store.exists(coin.name()): @@ -166,7 +166,7 @@ async def coin_added(self, coin: Coin, height: uint32, peer: WSChiaConnection) - assert cs is not None await self.puzzle_solution_received(cs, peer) - async def puzzle_solution_received(self, coin_spend: CoinSpend, peer: WSChiaConnection) -> None: + async def puzzle_solution_received(self, coin_spend: CoinSpend, peer: WSFlaxConnection) -> None: self.log.debug("Puzzle solution received to wallet: %s", self.wallet_info) coin_name = coin_spend.coin.name() puzzle: Program = Program.from_bytes(bytes(coin_spend.puzzle_reveal)) @@ -520,7 +520,7 @@ async def sign_message(self, message: str, nft: NFTCoinInfo) -> Tuple[G1Element, pubkey, private = await self.wallet_state_manager.get_keys(puzzle_hash) synthetic_secret_key = calculate_synthetic_secret_key(private, DEFAULT_HIDDEN_PUZZLE_HASH) synthetic_pk = synthetic_secret_key.get_g1() - puzzle: Program = Program.to(("Chia Signed Message", message)) + puzzle: Program = Program.to(("Flax Signed Message", message)) return synthetic_pk, AugSchemeMPL.sign(synthetic_secret_key, puzzle.get_tree_hash()) else: raise ValueError("Invalid NFT puzzle.") @@ -563,19 +563,19 @@ async def create_from_puzzle_info( name, ) - async def create_tandem_xch_tx( + async def create_tandem_xfx_tx( self, fee: uint64, announcement_to_assert: Optional[Announcement] = None ) -> TransactionRecord: - chia_coins = await self.standard_wallet.select_coins(fee) - chia_tx = await self.standard_wallet.generate_signed_transaction( + flax_coins = await self.standard_wallet.select_coins(fee) + flax_tx = await self.standard_wallet.generate_signed_transaction( uint64(0), (await self.standard_wallet.get_new_puzzlehash()), fee=fee, - coins=chia_coins, + coins=flax_coins, coin_announcements_to_consume={announcement_to_assert} if announcement_to_assert is not None else None, ) - assert chia_tx.spend_bundle is not None - return chia_tx + assert flax_tx.spend_bundle is not None + return flax_tx async def generate_signed_transaction( self, @@ -608,7 +608,7 @@ async def generate_signed_transaction( payment_sum = sum([p.amount for p in payments]) - unsigned_spend_bundle, chia_tx = await self.generate_unsigned_spendbundle( + unsigned_spend_bundle, flax_tx = await self.generate_unsigned_spendbundle( payments, fee, coins=coins, @@ -622,9 +622,9 @@ async def generate_signed_transaction( ) spend_bundle = await self.sign(unsigned_spend_bundle) spend_bundle = SpendBundle.aggregate([spend_bundle] + additional_bundles) - if chia_tx is not None and chia_tx.spend_bundle is not None: - spend_bundle = SpendBundle.aggregate([spend_bundle, chia_tx.spend_bundle]) - chia_tx = dataclasses.replace(chia_tx, spend_bundle=None) + if flax_tx is not None and flax_tx.spend_bundle is not None: + spend_bundle = SpendBundle.aggregate([spend_bundle, flax_tx.spend_bundle]) + flax_tx = dataclasses.replace(flax_tx, spend_bundle=None) tx_list = [ TransactionRecord( @@ -647,8 +647,8 @@ async def generate_signed_transaction( ), ] - if chia_tx is not None: - tx_list.append(chia_tx) + if flax_tx is not None: + tx_list.append(flax_tx) return tx_list @@ -690,10 +690,10 @@ async def generate_unsigned_spendbundle( if fee > 0: announcement_to_make = nft_coin.coin.name() - chia_tx = await self.create_tandem_xch_tx(fee, Announcement(nft_coin.coin.name(), announcement_to_make)) + flax_tx = await self.create_tandem_xfx_tx(fee, Announcement(nft_coin.coin.name(), announcement_to_make)) else: announcement_to_make = None - chia_tx = None + flax_tx = None innersol: Program = self.standard_wallet.make_solution( primaries=primaries, @@ -732,7 +732,7 @@ async def generate_unsigned_spendbundle( nft_spend_bundle = SpendBundle([coin_spend], G2Element()) - return nft_spend_bundle, chia_tx + return nft_spend_bundle, flax_tx @staticmethod def royalty_calculation( @@ -850,7 +850,7 @@ async def make_nft1_offer( coin_amount_needed = abs(amount) + royalty_amount offered_coins: Set[Coin] = await wallet.get_coins_to_offer(asset, coin_amount_needed, min_coin_amount) if len(offered_coins) == 0: - raise ValueError(f"Did not have asset ID {asset.hex() if asset is not None else 'XCH'} to offer") + raise ValueError(f"Did not have asset ID {asset.hex() if asset is not None else 'XFX'} to offer") offered_coins_by_asset[asset] = offered_coins all_offered_coins.update(offered_coins) @@ -860,7 +860,7 @@ async def make_nft1_offer( ) announcements_to_assert = Offer.calculate_announcements(notarized_payments, driver_dict) for asset, payments in royalty_payments.items(): - if asset is None: # xch offer + if asset is None: # xfx offer offer_puzzle = OFFER_MOD royalty_ph = OFFER_MOD_HASH else: @@ -928,7 +928,7 @@ async def make_nft1_offer( # Create a coin_spend for the royalty payout from OFFER MOD # ((nft_launcher_id . ((ROYALTY_ADDRESS, royalty_amount, memos)))) inner_royalty_sol = Program.to([(launcher_id, [payment.as_condition_args()])]) - if asset is None: # xch offer + if asset is None: # xfx offer offer_puzzle = OFFER_MOD royalty_ph = OFFER_MOD_HASH else: @@ -946,7 +946,7 @@ async def make_nft1_offer( if cs.coin.name() == royalty_coin.parent_coin_info ) break - if asset is None: # If XCH + if asset is None: # If XFX royalty_sol = inner_royalty_sol else: # call our drivers to solve the puzzle @@ -1014,8 +1014,8 @@ async def mint_from_did( target_list: Optional[List[bytes32]] = [], mint_number_start: Optional[int] = 1, mint_total: Optional[int] = None, - xch_coins: Optional[Set[Coin]] = None, - xch_change_ph: Optional[bytes32] = None, + xfx_coins: Optional[Set[Coin]] = None, + xfx_change_ph: Optional[bytes32] = None, new_innerpuzhash: Optional[bytes32] = None, new_p2_puzhash: Optional[bytes32] = None, did_coin: Optional[Coin] = None, @@ -1029,7 +1029,7 @@ async def mint_from_did( mint_number and mint_total for each NFT being minted. These intermediate coins then create the launcher coins for the list of NFTs - The launcher coins are then spent along with the created eve spend - and an xch spend that funds the transactions and pays fees. + and an xfx spend that funds the transactions and pays fees. - There is also an option to pass in a list of target puzzlehashes. If provided this method will create an additional transaction transfering the minted NFTs to the row-matched target. @@ -1038,9 +1038,9 @@ async def mint_from_did( :param mint_number_start: [Optional] The starting point for mint number used in intermediate launcher puzzle. Default: 1 :param mint_total: [Optional] The total number of NFTs being minted - :param xch_coins: [Optional] For use with bulk minting to provide the coin used for funding the minting spend. + :param xfx_coins: [Optional] For use with bulk minting to provide the coin used for funding the minting spend. This coin can be one that will be created in the future - :param xch_change_ph: [Optional] For use with bulk minting, so we can specify the puzzle hash that the change + :param xfx_change_ph: [Optional] For use with bulk minting, so we can specify the puzzle hash that the change from the funding transaction goes to. :param new_innerpuzhash: [Optional] The new inner puzzle hash for the DID once it is spent. For bulk minting we generally don't provide this as the default behaviour is to re-use the existing inner puzzle hash @@ -1050,7 +1050,7 @@ async def mint_from_did( be created in the future :param did_lineage_parent: [Optional] The parent coin to use for the lineage proof in the DID spend. Needed for bulk minting when the coin will be created in the future - :param fee: A fee amount, taken out of the xch spend. + :param fee: A fee amount, taken out of the xfx spend. """ # get DID Wallet for wallet_id in self.wallet_state_manager.wallets: @@ -1091,12 +1091,12 @@ async def mint_from_did( ) ] - # Ensure we have an xch coin of high enough amount + # Ensure we have an xfx coin of high enough amount assert isinstance(fee, uint64) total_amount = len(metadata_list) + fee - if xch_coins is None: - xch_coins = await self.standard_wallet.select_coins(uint64(total_amount)) - assert len(xch_coins) > 0 + if xfx_coins is None: + xfx_coins = await self.standard_wallet.select_coins(uint64(total_amount)) + assert len(xfx_coins) > 0 # set the chunk size for the spend bundle we're going to create chunk_size = len(metadata_list) @@ -1218,38 +1218,38 @@ async def mint_from_did( puzzle_assertions.add(assertion) # We've now created all the intermediate, launcher, eve and transfer spends. - # Create the xch spend to fund the minting. - spend_value = sum([coin.amount for coin in xch_coins]) + # Create the xfx spend to fund the minting. + spend_value = sum([coin.amount for coin in xfx_coins]) change: uint64 = uint64(spend_value - total_amount) - xch_spends = [] - if xch_change_ph is None: - xch_change_ph = await self.standard_wallet.get_new_puzzlehash() - xch_primaries = [ - AmountWithPuzzlehash({"puzzlehash": xch_change_ph, "amount": change, "memos": [xch_change_ph]}) + xfx_spends = [] + if xfx_change_ph is None: + xfx_change_ph = await self.standard_wallet.get_new_puzzlehash() + xfx_primaries = [ + AmountWithPuzzlehash({"puzzlehash": xfx_change_ph, "amount": change, "memos": [xfx_change_ph]}) ] first = True - for xch_coin in xch_coins: - puzzle: Program = await self.standard_wallet.puzzle_for_puzzle_hash(xch_coin.puzzle_hash) + for xfx_coin in xfx_coins: + puzzle: Program = await self.standard_wallet.puzzle_for_puzzle_hash(xfx_coin.puzzle_hash) if first: - message_list: List[bytes32] = [c.name() for c in xch_coins] + message_list: List[bytes32] = [c.name() for c in xfx_coins] message_list.append( - Coin(xch_coin.name(), xch_primaries[0]["puzzlehash"], xch_primaries[0]["amount"]).name() + Coin(xfx_coin.name(), xfx_primaries[0]["puzzlehash"], xfx_primaries[0]["amount"]).name() ) message: bytes32 = std_hash(b"".join(message_list)) - if len(xch_coins) > 1: - xch_announcement: Optional[Set[bytes]] = {message} + if len(xfx_coins) > 1: + xfx_announcement: Optional[Set[bytes]] = {message} else: - xch_announcement = None + xfx_announcement = None solution: Program = self.standard_wallet.make_solution( - primaries=xch_primaries, + primaries=xfx_primaries, fee=fee, - coin_announcements=xch_announcement, + coin_announcements=xfx_announcement, coin_announcements_to_assert={Announcement(did_coin.name(), message).name()}, ) - primary_announcement_hash = Announcement(xch_coin.name(), message).name() + primary_announcement_hash = Announcement(xfx_coin.name(), message).name() # connect this coin assertion to the DID announcement did_coin_announcement = {bytes(message)} first = False @@ -1257,8 +1257,8 @@ async def mint_from_did( solution = self.standard_wallet.make_solution( primaries=[], coin_announcements_to_assert={primary_announcement_hash} ) - xch_spends.append(CoinSpend(xch_coin, puzzle, solution)) - xch_spend = await self.standard_wallet.sign_transaction(xch_spends) + xfx_spends.append(CoinSpend(xfx_coin, puzzle, solution)) + xfx_spend = await self.standard_wallet.sign_transaction(xfx_spends) # Create the DID spend using the announcements collected when making the intermediate launcher coins did_p2_solution = self.standard_wallet.make_solution( @@ -1302,31 +1302,31 @@ async def mint_from_did( signed_spend_bundle = await did_wallet.sign(unsigned_spend_bundle) # Aggregate everything into a single spend bundle - total_spend = SpendBundle.aggregate([signed_spend_bundle, xch_spend, *eve_spends]) + total_spend = SpendBundle.aggregate([signed_spend_bundle, xfx_spend, *eve_spends]) return total_spend - async def mint_from_xch( + async def mint_from_xfx( self, metadata_list: List[Dict[str, Any]], target_list: Optional[List[bytes32]] = [], mint_number_start: Optional[int] = 1, mint_total: Optional[int] = None, - xch_coins: Optional[Set[Coin]] = None, - xch_change_ph: Optional[bytes32] = None, + xfx_coins: Optional[Set[Coin]] = None, + xfx_change_ph: Optional[bytes32] = None, fee: Optional[uint64] = uint64(0), ) -> SpendBundle: """ - Minting NFTs from a single XCH spend using intermediate launcher puzzle + Minting NFTs from a single XFX spend using intermediate launcher puzzle :param metadata_list: A list of dicts containing the metadata for each NFT to be minted :param target_list: [Optional] a list of targets for transfering minted NFTs (aka airdrop) :param mint_number_start: [Optional] The starting point for mint number used in intermediate launcher puzzle. Default: 1 :param mint_total: [Optional] The total number of NFTs being minted - :param xch_coins: [Optional] For use with bulk minting to provide the coin used for funding the minting spend. + :param xfx_coins: [Optional] For use with bulk minting to provide the coin used for funding the minting spend. This coin can be one that will be created in the future - :param xch_change_ph: [Optional] For use with bulk minting, so we can specify the puzzle hash that the change + :param xfx_change_ph: [Optional] For use with bulk minting, so we can specify the puzzle hash that the change from the funding transaction goes to. - :param fee: A fee amount, taken out of the xch spend. + :param fee: A fee amount, taken out of the xfx spend. """ # Ensure we have an mint_total value @@ -1335,14 +1335,14 @@ async def mint_from_xch( assert isinstance(mint_number_start, int) assert len(metadata_list) <= mint_total + 1 - mint_number_start - # Ensure we have an xch coin of high enough amount + # Ensure we have an xfx coin of high enough amount assert isinstance(fee, uint64) total_amount = len(metadata_list) + fee - if xch_coins is None: - xch_coins = await self.standard_wallet.select_coins(uint64(total_amount)) - assert len(xch_coins) > 0 + if xfx_coins is None: + xfx_coins = await self.standard_wallet.select_coins(uint64(total_amount)) + assert len(xfx_coins) > 0 - funding_coin = xch_coins.copy().pop() + funding_coin = xfx_coins.copy().pop() # set the chunk size for the spend bundle we're going to create chunk_size = len(metadata_list) @@ -1353,7 +1353,7 @@ async def mint_from_xch( # chunk going into this spend bundle mint_number_end = mint_number_start + chunk_size - # Empty set to load with the announcements we will assert from XCH to + # Empty set to load with the announcements we will assert from XFX to # match the announcements from the intermediate launcher puzzle coin_announcements: Set[Any] = set() puzzle_assertions: Set[Any] = set() @@ -1389,13 +1389,13 @@ async def mint_from_xch( ) intermediate_coin_spends.append(intermediate_launcher_coin_spend) - # create an ASSERT_COIN_ANNOUNCEMENT for the XCH spend. The + # create an ASSERT_COIN_ANNOUNCEMENT for the XFX spend. The # intermediate launcher coin issues a CREATE_COIN_ANNOUNCEMENT of # the mint_number and mint_total for the launcher coin it creates intermediate_announcement_message = std_hash(int_to_bytes(mint_number) + int_to_bytes(mint_total)) coin_announcements.add(std_hash(intermediate_launcher_coin.name() + intermediate_announcement_message)) - # Create the launcher coin, and add its id to a list to be asserted in the XCH spend + # Create the launcher coin, and add its id to a list to be asserted in the XFX spend launcher_coin = Coin(intermediate_launcher_coin.name(), nft_puzzles.LAUNCHER_PUZZLE_HASH, amount) launcher_ids.append(launcher_coin.name()) @@ -1416,7 +1416,7 @@ async def mint_from_xch( launcher_coin.name(), metadata["program"], NFT_METADATA_UPDATER.get_tree_hash(), inner_puzzle ) - # Annnouncements for eve spend. These are asserted by the xch spend + # Annnouncements for eve spend. These are asserted by the xfx spend announcement_message = Program.to([eve_fullpuz.get_tree_hash(), amount, []]).get_tree_hash() coin_announcements.add(std_hash(launcher_coin.name() + announcement_message)) @@ -1464,46 +1464,46 @@ async def mint_from_xch( puzzle_assertions.add(assertion) # We've now created all the intermediate, launcher, eve and transfer spends. - # Create the xch spend to fund the minting. - spend_value = sum([coin.amount for coin in xch_coins]) + # Create the xfx spend to fund the minting. + spend_value = sum([coin.amount for coin in xfx_coins]) change: uint64 = uint64(spend_value - total_amount) - xch_spends = [] - if xch_change_ph is None: - xch_change_ph = await self.standard_wallet.get_new_puzzlehash() - xch_primaries = [ - AmountWithPuzzlehash({"puzzlehash": xch_change_ph, "amount": change, "memos": [xch_change_ph]}) + xfx_spends = [] + if xfx_change_ph is None: + xfx_change_ph = await self.standard_wallet.get_new_puzzlehash() + xfx_primaries = [ + AmountWithPuzzlehash({"puzzlehash": xfx_change_ph, "amount": change, "memos": [xfx_change_ph]}) ] first = True - for xch_coin in xch_coins: - puzzle: Program = await self.standard_wallet.puzzle_for_puzzle_hash(xch_coin.puzzle_hash) + for xfx_coin in xfx_coins: + puzzle: Program = await self.standard_wallet.puzzle_for_puzzle_hash(xfx_coin.puzzle_hash) if first: - message_list: List[bytes32] = [c.name() for c in xch_coins] + message_list: List[bytes32] = [c.name() for c in xfx_coins] message_list.append( - Coin(xch_coin.name(), xch_primaries[0]["puzzlehash"], xch_primaries[0]["amount"]).name() + Coin(xfx_coin.name(), xfx_primaries[0]["puzzlehash"], xfx_primaries[0]["amount"]).name() ) message: bytes32 = std_hash(b"".join(message_list)) - if len(xch_coins) > 1: - xch_announcement: Optional[Set[bytes]] = {message} + if len(xfx_coins) > 1: + xfx_announcement: Optional[Set[bytes]] = {message} else: - xch_announcement = None + xfx_announcement = None solution: Program = self.standard_wallet.make_solution( - primaries=xch_primaries + primaries, + primaries=xfx_primaries + primaries, fee=fee, - coin_announcements=xch_announcement if len(xch_coins) > 1 else None, + coin_announcements=xfx_announcement if len(xfx_coins) > 1 else None, coin_announcements_to_assert=coin_announcements, puzzle_announcements_to_assert=puzzle_assertions, ) - primary_announcement_hash = Announcement(xch_coin.name(), message).name() + primary_announcement_hash = Announcement(xfx_coin.name(), message).name() first = False else: solution = self.standard_wallet.make_solution( primaries=[], coin_announcements_to_assert={primary_announcement_hash} ) - xch_spends.append(CoinSpend(xch_coin, puzzle, solution)) - xch_spend = await self.standard_wallet.sign_transaction(xch_spends) + xfx_spends.append(CoinSpend(xfx_coin, puzzle, solution)) + xfx_spend = await self.standard_wallet.sign_transaction(xfx_spends) # Collect up all the coin spends and sign them list_of_coinspends = intermediate_coin_spends + launcher_spends @@ -1511,7 +1511,7 @@ async def mint_from_xch( signed_spend_bundle = await self.sign(unsigned_spend_bundle) # Aggregate everything into a single spend bundle - total_spend = SpendBundle.aggregate([signed_spend_bundle, xch_spend, *eve_spends]) + total_spend = SpendBundle.aggregate([signed_spend_bundle, xfx_spend, *eve_spends]) return total_spend async def select_coins( @@ -1531,6 +1531,6 @@ def puzzle_hash_for_pk(self, pubkey: G1Element) -> bytes32: if TYPE_CHECKING: - from chia.wallet.wallet_protocol import WalletProtocol + from flax.wallet.wallet_protocol import WalletProtocol _dummy: WalletProtocol = NFTWallet() diff --git a/chia/wallet/nft_wallet/ownership_outer_puzzle.py b/flax/wallet/nft_wallet/ownership_outer_puzzle.py similarity index 93% rename from chia/wallet/nft_wallet/ownership_outer_puzzle.py rename to flax/wallet/nft_wallet/ownership_outer_puzzle.py index 62b297a11..3c746a53b 100644 --- a/chia/wallet/nft_wallet/ownership_outer_puzzle.py +++ b/flax/wallet/nft_wallet/ownership_outer_puzzle.py @@ -5,11 +5,11 @@ from clvm_tools.binutils import disassemble -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle OWNERSHIP_LAYER_MOD = load_clvm_maybe_recompile("nft_ownership_layer.clvm") diff --git a/chia/wallet/nft_wallet/singleton_outer_puzzle.py b/flax/wallet/nft_wallet/singleton_outer_puzzle.py similarity index 89% rename from chia/wallet/nft_wallet/singleton_outer_puzzle.py rename to flax/wallet/nft_wallet/singleton_outer_puzzle.py index 60adaf81f..d1f444071 100644 --- a/chia/wallet/nft_wallet/singleton_outer_puzzle.py +++ b/flax/wallet/nft_wallet/singleton_outer_puzzle.py @@ -3,20 +3,20 @@ from dataclasses import dataclass from typing import Callable, Optional -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.util.ints import uint64 -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.singleton_top_layer_v1_1 import ( +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.util.ints import uint64 +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.singleton_top_layer_v1_1 import ( SINGLETON_LAUNCHER_HASH, match_singleton_puzzle, puzzle_for_singleton, solution_for_singleton, ) -from chia.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle +from flax.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle @dataclass(frozen=True) diff --git a/chia/wallet/nft_wallet/transfer_program_puzzle.py b/flax/wallet/nft_wallet/transfer_program_puzzle.py similarity index 88% rename from chia/wallet/nft_wallet/transfer_program_puzzle.py rename to flax/wallet/nft_wallet/transfer_program_puzzle.py index bb4db84e4..6fc8f73f9 100644 --- a/chia/wallet/nft_wallet/transfer_program_puzzle.py +++ b/flax/wallet/nft_wallet/transfer_program_puzzle.py @@ -3,13 +3,13 @@ from dataclasses import dataclass from typing import Callable, List, Optional, Tuple -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint16 -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.puzzles.singleton_top_layer_v1_1 import SINGLETON_LAUNCHER_HASH, SINGLETON_MOD_HASH -from chia.wallet.uncurried_puzzle import UncurriedPuzzle +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint16 +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.puzzles.singleton_top_layer_v1_1 import SINGLETON_LAUNCHER_HASH, SINGLETON_MOD_HASH +from flax.wallet.uncurried_puzzle import UncurriedPuzzle TRANSFER_PROGRAM_MOD = load_clvm_maybe_recompile("nft_ownership_transfer_program_one_way_claim_with_royalties.clvm") diff --git a/chia/wallet/nft_wallet/uncurry_nft.py b/flax/wallet/nft_wallet/uncurry_nft.py similarity index 96% rename from chia/wallet/nft_wallet/uncurry_nft.py rename to flax/wallet/nft_wallet/uncurry_nft.py index f244ba3d3..7fbce984f 100644 --- a/chia/wallet/nft_wallet/uncurry_nft.py +++ b/flax/wallet/nft_wallet/uncurry_nft.py @@ -4,10 +4,10 @@ from dataclasses import dataclass from typing import Optional, Type, TypeVar -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint16 -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint16 +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile log = logging.getLogger(__name__) SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm") @@ -22,7 +22,7 @@ class UncurriedNFT: """ A simple solution for uncurry NFT puzzle. Initial the class with a full NFT puzzle, it will do a deep uncurry. - This is the only place you need to change after modified the Chialisp curried parameters. + This is the only place you need to change after modified the Flaxlisp curried parameters. """ nft_mod_hash: bytes32 diff --git a/chia/wallet/notification_manager.py b/flax/wallet/notification_manager.py similarity index 79% rename from chia/wallet/notification_manager.py rename to flax/wallet/notification_manager.py index 22eaad314..a5f715b4c 100644 --- a/chia/wallet/notification_manager.py +++ b/flax/wallet/notification_manager.py @@ -6,19 +6,19 @@ from blspy import G2Element -from chia.protocols.wallet_protocol import CoinState -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.spend_bundle import SpendBundle -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint64 -from chia.wallet.notification_store import Notification, NotificationStore -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.compute_memos import compute_memos_for_spend -from chia.wallet.util.notifications import construct_notification +from flax.protocols.wallet_protocol import CoinState +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.spend_bundle import SpendBundle +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint64 +from flax.wallet.notification_store import Notification, NotificationStore +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.compute_memos import compute_memos_for_spend +from flax.wallet.util.notifications import construct_notification class NotificationManager: @@ -82,7 +82,7 @@ async def send_new_notification( Program.to(None), ) extra_spend_bundle = SpendBundle([notification_spend], G2Element()) - chia_tx = await self.wallet_state_manager.main_wallet.generate_signed_transaction( + flax_tx = await self.wallet_state_manager.main_wallet.generate_signed_transaction( amount, notification_hash, fee, @@ -92,6 +92,6 @@ async def send_new_notification( memos=[target, msg], ) full_tx: TransactionRecord = dataclasses.replace( - chia_tx, spend_bundle=SpendBundle.aggregate([chia_tx.spend_bundle, extra_spend_bundle]) + flax_tx, spend_bundle=SpendBundle.aggregate([flax_tx.spend_bundle, extra_spend_bundle]) ) return full_tx diff --git a/chia/wallet/notification_store.py b/flax/wallet/notification_store.py similarity index 96% rename from chia/wallet/notification_store.py rename to flax/wallet/notification_store.py index 100cc56e0..cd9d25f86 100644 --- a/chia/wallet/notification_store.py +++ b/flax/wallet/notification_store.py @@ -4,9 +4,9 @@ import logging from typing import List, Optional, Tuple -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint32, uint64 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint32, uint64 @dataclasses.dataclass(frozen=True) diff --git a/chia/wallet/outer_puzzles.py b/flax/wallet/outer_puzzles.py similarity index 84% rename from chia/wallet/outer_puzzles.py rename to flax/wallet/outer_puzzles.py index 61ba4dd41..f11fdb462 100644 --- a/chia/wallet/outer_puzzles.py +++ b/flax/wallet/outer_puzzles.py @@ -3,16 +3,16 @@ from enum import Enum from typing import Dict, Optional -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.wallet.cat_wallet.cat_outer_puzzle import CATOuterPuzzle -from chia.wallet.driver_protocol import DriverProtocol -from chia.wallet.nft_wallet.metadata_outer_puzzle import MetadataOuterPuzzle -from chia.wallet.nft_wallet.ownership_outer_puzzle import OwnershipOuterPuzzle -from chia.wallet.nft_wallet.singleton_outer_puzzle import SingletonOuterPuzzle -from chia.wallet.nft_wallet.transfer_program_puzzle import TransferProgramPuzzle -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.uncurried_puzzle import UncurriedPuzzle +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.wallet.cat_wallet.cat_outer_puzzle import CATOuterPuzzle +from flax.wallet.driver_protocol import DriverProtocol +from flax.wallet.nft_wallet.metadata_outer_puzzle import MetadataOuterPuzzle +from flax.wallet.nft_wallet.ownership_outer_puzzle import OwnershipOuterPuzzle +from flax.wallet.nft_wallet.singleton_outer_puzzle import SingletonOuterPuzzle +from flax.wallet.nft_wallet.transfer_program_puzzle import TransferProgramPuzzle +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.uncurried_puzzle import UncurriedPuzzle """ This file provides a central location for acquiring drivers for outer puzzles like CATs, NFTs, etc. diff --git a/chia/wallet/payment.py b/flax/wallet/payment.py similarity index 85% rename from chia/wallet/payment.py rename to flax/wallet/payment.py index 3293376a8..93258c517 100644 --- a/chia/wallet/payment.py +++ b/flax/wallet/payment.py @@ -2,9 +2,9 @@ from typing import List -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.program import Program -from chia.util.ints import uint64 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.program import Program +from flax.util.ints import uint64 # This class is supposed to correspond to a CREATE_COIN condition diff --git a/chia/wallet/puzzle_drivers.py b/flax/wallet/puzzle_drivers.py similarity index 98% rename from chia/wallet/puzzle_drivers.py rename to flax/wallet/puzzle_drivers.py index 1c3c99093..428b3f58a 100644 --- a/chia/wallet/puzzle_drivers.py +++ b/flax/wallet/puzzle_drivers.py @@ -8,7 +8,7 @@ from clvm_tools.binutils import assemble, type_for_atom from ir.Type import Type -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.program import Program """ The following two classes act as wrapper classes around dictionaries of strings. diff --git a/chia/wallet/puzzles/__init__.py b/flax/wallet/puzzles/__init__.py similarity index 100% rename from chia/wallet/puzzles/__init__.py rename to flax/wallet/puzzles/__init__.py diff --git a/chia/wallet/puzzles/block_program_zero.clvm b/flax/wallet/puzzles/block_program_zero.clvm similarity index 100% rename from chia/wallet/puzzles/block_program_zero.clvm rename to flax/wallet/puzzles/block_program_zero.clvm diff --git a/chia/wallet/puzzles/block_program_zero.clvm.hex b/flax/wallet/puzzles/block_program_zero.clvm.hex similarity index 100% rename from chia/wallet/puzzles/block_program_zero.clvm.hex rename to flax/wallet/puzzles/block_program_zero.clvm.hex diff --git a/chia/wallet/puzzles/block_program_zero.clvm.hex.sha256tree b/flax/wallet/puzzles/block_program_zero.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/block_program_zero.clvm.hex.sha256tree rename to flax/wallet/puzzles/block_program_zero.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/calculate_synthetic_public_key.clvm b/flax/wallet/puzzles/calculate_synthetic_public_key.clvm similarity index 100% rename from chia/wallet/puzzles/calculate_synthetic_public_key.clvm rename to flax/wallet/puzzles/calculate_synthetic_public_key.clvm diff --git a/chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex b/flax/wallet/puzzles/calculate_synthetic_public_key.clvm.hex similarity index 100% rename from chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex rename to flax/wallet/puzzles/calculate_synthetic_public_key.clvm.hex diff --git a/chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree b/flax/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree rename to flax/wallet/puzzles/calculate_synthetic_public_key.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/cat_loader.py b/flax/wallet/puzzles/cat_loader.py similarity index 80% rename from chia/wallet/puzzles/cat_loader.py rename to flax/wallet/puzzles/cat_loader.py index e89af5d54..a4b0e2897 100644 --- a/chia/wallet/puzzles/cat_loader.py +++ b/flax/wallet/puzzles/cat_loader.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile CAT_MOD = load_clvm_maybe_recompile("cat_v2.clvm", package_or_requirement=__name__) LOCK_INNER_PUZZLE = load_clvm_maybe_recompile("lock.inner.puzzle.clvm", package_or_requirement=__name__) diff --git a/chia/wallet/puzzles/cat_truths.clib b/flax/wallet/puzzles/cat_truths.clib similarity index 100% rename from chia/wallet/puzzles/cat_truths.clib rename to flax/wallet/puzzles/cat_truths.clib diff --git a/chia/wallet/puzzles/cat_v2.clvm b/flax/wallet/puzzles/cat_v2.clvm similarity index 100% rename from chia/wallet/puzzles/cat_v2.clvm rename to flax/wallet/puzzles/cat_v2.clvm diff --git a/chia/wallet/puzzles/cat_v2.clvm.hex b/flax/wallet/puzzles/cat_v2.clvm.hex similarity index 100% rename from chia/wallet/puzzles/cat_v2.clvm.hex rename to flax/wallet/puzzles/cat_v2.clvm.hex diff --git a/chia/wallet/puzzles/cat_v2.clvm.hex.sha256tree b/flax/wallet/puzzles/cat_v2.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/cat_v2.clvm.hex.sha256tree rename to flax/wallet/puzzles/cat_v2.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/condition_codes.clvm b/flax/wallet/puzzles/condition_codes.clvm similarity index 96% rename from chia/wallet/puzzles/condition_codes.clvm rename to flax/wallet/puzzles/condition_codes.clvm index 45f3265da..42b2f5fb4 100644 --- a/chia/wallet/puzzles/condition_codes.clvm +++ b/flax/wallet/puzzles/condition_codes.clvm @@ -1,4 +1,4 @@ -; See chia/types/condition_opcodes.py +; See flax/types/condition_opcodes.py ( (defconstant AGG_SIG_UNSAFE 49) diff --git a/chia/wallet/puzzles/create-lock-puzzlehash.clvm b/flax/wallet/puzzles/create-lock-puzzlehash.clvm similarity index 100% rename from chia/wallet/puzzles/create-lock-puzzlehash.clvm rename to flax/wallet/puzzles/create-lock-puzzlehash.clvm diff --git a/chia/wallet/puzzles/create_nft_launcher_from_did.clvm b/flax/wallet/puzzles/create_nft_launcher_from_did.clvm similarity index 100% rename from chia/wallet/puzzles/create_nft_launcher_from_did.clvm rename to flax/wallet/puzzles/create_nft_launcher_from_did.clvm diff --git a/chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex b/flax/wallet/puzzles/create_nft_launcher_from_did.clvm.hex similarity index 100% rename from chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex rename to flax/wallet/puzzles/create_nft_launcher_from_did.clvm.hex diff --git a/chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex.sha256tree b/flax/wallet/puzzles/create_nft_launcher_from_did.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/create_nft_launcher_from_did.clvm.hex.sha256tree rename to flax/wallet/puzzles/create_nft_launcher_from_did.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/curry-and-treehash.clinc b/flax/wallet/puzzles/curry-and-treehash.clinc similarity index 100% rename from chia/wallet/puzzles/curry-and-treehash.clinc rename to flax/wallet/puzzles/curry-and-treehash.clinc diff --git a/chia/wallet/puzzles/decompress_block_spends.clvm b/flax/wallet/puzzles/decompress_block_spends.clvm similarity index 94% rename from chia/wallet/puzzles/decompress_block_spends.clvm rename to flax/wallet/puzzles/decompress_block_spends.clvm index 93bb5f9b3..ac2587081 100644 --- a/chia/wallet/puzzles/decompress_block_spends.clvm +++ b/flax/wallet/puzzles/decompress_block_spends.clvm @@ -1,7 +1,7 @@ (mod (block_program (block_ref)) (defconstant local_deserialize_mod - ;; this monstrosity is the assembly output of `chialisp_deserialisation.clvm` + ;; this monstrosity is the assembly output of `flaxlisp_deserialisation.clvm` ;; it's pasted in here because the compiler doesn't yet support nested `mod` ;; my apologies -- RK diff --git a/chia/wallet/puzzles/decompress_block_spends.clvm.hex b/flax/wallet/puzzles/decompress_block_spends.clvm.hex similarity index 100% rename from chia/wallet/puzzles/decompress_block_spends.clvm.hex rename to flax/wallet/puzzles/decompress_block_spends.clvm.hex diff --git a/chia/wallet/puzzles/decompress_block_spends.clvm.hex.sha256tree b/flax/wallet/puzzles/decompress_block_spends.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/decompress_block_spends.clvm.hex.sha256tree rename to flax/wallet/puzzles/decompress_block_spends.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/decompress_block_spends.py b/flax/wallet/puzzles/decompress_block_spends.py similarity index 74% rename from chia/wallet/puzzles/decompress_block_spends.py rename to flax/wallet/puzzles/decompress_block_spends.py index b4e6e63d8..f0110c7f5 100644 --- a/chia/wallet/puzzles/decompress_block_spends.py +++ b/flax/wallet/puzzles/decompress_block_spends.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.wallet.puzzles.load_clvm import load_serialized_clvm_maybe_recompile +from flax.wallet.puzzles.load_clvm import load_serialized_clvm_maybe_recompile DECOMPRESS_BLOCK_SPENDS = load_serialized_clvm_maybe_recompile( "decompress_block_spends.clvm", package_or_requirement=__name__ diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry.clvm b/flax/wallet/puzzles/decompress_coin_spend_entry.clvm similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry.clvm rename to flax/wallet/puzzles/decompress_coin_spend_entry.clvm diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex b/flax/wallet/puzzles/decompress_coin_spend_entry.clvm.hex similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex rename to flax/wallet/puzzles/decompress_coin_spend_entry.clvm.hex diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex.sha256tree b/flax/wallet/puzzles/decompress_coin_spend_entry.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry.clvm.hex.sha256tree rename to flax/wallet/puzzles/decompress_coin_spend_entry.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm b/flax/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm rename to flax/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex b/flax/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex rename to flax/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex diff --git a/chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex.sha256tree b/flax/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex.sha256tree rename to flax/wallet/puzzles/decompress_coin_spend_entry_with_prefix.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/decompress_puzzle.clvm b/flax/wallet/puzzles/decompress_puzzle.clvm similarity index 100% rename from chia/wallet/puzzles/decompress_puzzle.clvm rename to flax/wallet/puzzles/decompress_puzzle.clvm diff --git a/chia/wallet/puzzles/decompress_puzzle.clvm.hex b/flax/wallet/puzzles/decompress_puzzle.clvm.hex similarity index 100% rename from chia/wallet/puzzles/decompress_puzzle.clvm.hex rename to flax/wallet/puzzles/decompress_puzzle.clvm.hex diff --git a/chia/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree b/flax/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree rename to flax/wallet/puzzles/decompress_puzzle.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/delegated_tail.clvm b/flax/wallet/puzzles/delegated_tail.clvm similarity index 100% rename from chia/wallet/puzzles/delegated_tail.clvm rename to flax/wallet/puzzles/delegated_tail.clvm diff --git a/chia/wallet/puzzles/delegated_tail.clvm.hex b/flax/wallet/puzzles/delegated_tail.clvm.hex similarity index 100% rename from chia/wallet/puzzles/delegated_tail.clvm.hex rename to flax/wallet/puzzles/delegated_tail.clvm.hex diff --git a/chia/wallet/puzzles/delegated_tail.clvm.hex.sha256tree b/flax/wallet/puzzles/delegated_tail.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/delegated_tail.clvm.hex.sha256tree rename to flax/wallet/puzzles/delegated_tail.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/did_innerpuz.clvm b/flax/wallet/puzzles/did_innerpuz.clvm similarity index 100% rename from chia/wallet/puzzles/did_innerpuz.clvm rename to flax/wallet/puzzles/did_innerpuz.clvm diff --git a/chia/wallet/puzzles/did_innerpuz.clvm.hex b/flax/wallet/puzzles/did_innerpuz.clvm.hex similarity index 100% rename from chia/wallet/puzzles/did_innerpuz.clvm.hex rename to flax/wallet/puzzles/did_innerpuz.clvm.hex diff --git a/chia/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree b/flax/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree rename to flax/wallet/puzzles/did_innerpuz.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/everything_with_signature.clvm b/flax/wallet/puzzles/everything_with_signature.clvm similarity index 100% rename from chia/wallet/puzzles/everything_with_signature.clvm rename to flax/wallet/puzzles/everything_with_signature.clvm diff --git a/chia/wallet/puzzles/everything_with_signature.clvm.hex b/flax/wallet/puzzles/everything_with_signature.clvm.hex similarity index 100% rename from chia/wallet/puzzles/everything_with_signature.clvm.hex rename to flax/wallet/puzzles/everything_with_signature.clvm.hex diff --git a/chia/wallet/puzzles/everything_with_signature.clvm.hex.sha256tree b/flax/wallet/puzzles/everything_with_signature.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/everything_with_signature.clvm.hex.sha256tree rename to flax/wallet/puzzles/everything_with_signature.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/chialisp_deserialisation.clvm b/flax/wallet/puzzles/flaxlisp_deserialisation.clvm similarity index 100% rename from chia/wallet/puzzles/chialisp_deserialisation.clvm rename to flax/wallet/puzzles/flaxlisp_deserialisation.clvm diff --git a/chia/wallet/puzzles/chialisp_deserialisation.clvm.hex b/flax/wallet/puzzles/flaxlisp_deserialisation.clvm.hex similarity index 100% rename from chia/wallet/puzzles/chialisp_deserialisation.clvm.hex rename to flax/wallet/puzzles/flaxlisp_deserialisation.clvm.hex diff --git a/chia/wallet/puzzles/chialisp_deserialisation.clvm.hex.sha256tree b/flax/wallet/puzzles/flaxlisp_deserialisation.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/chialisp_deserialisation.clvm.hex.sha256tree rename to flax/wallet/puzzles/flaxlisp_deserialisation.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/genesis_by_coin_id.clvm b/flax/wallet/puzzles/genesis_by_coin_id.clvm similarity index 100% rename from chia/wallet/puzzles/genesis_by_coin_id.clvm rename to flax/wallet/puzzles/genesis_by_coin_id.clvm diff --git a/chia/wallet/puzzles/genesis_by_coin_id.clvm.hex b/flax/wallet/puzzles/genesis_by_coin_id.clvm.hex similarity index 100% rename from chia/wallet/puzzles/genesis_by_coin_id.clvm.hex rename to flax/wallet/puzzles/genesis_by_coin_id.clvm.hex diff --git a/chia/wallet/puzzles/genesis_by_coin_id.clvm.hex.sha256tree b/flax/wallet/puzzles/genesis_by_coin_id.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/genesis_by_coin_id.clvm.hex.sha256tree rename to flax/wallet/puzzles/genesis_by_coin_id.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm b/flax/wallet/puzzles/genesis_by_puzzle_hash.clvm similarity index 100% rename from chia/wallet/puzzles/genesis_by_puzzle_hash.clvm rename to flax/wallet/puzzles/genesis_by_puzzle_hash.clvm diff --git a/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex b/flax/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex similarity index 100% rename from chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex rename to flax/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex diff --git a/chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex.sha256tree b/flax/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex.sha256tree rename to flax/wallet/puzzles/genesis_by_puzzle_hash.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/graftroot_dl_offers.clvm b/flax/wallet/puzzles/graftroot_dl_offers.clvm similarity index 100% rename from chia/wallet/puzzles/graftroot_dl_offers.clvm rename to flax/wallet/puzzles/graftroot_dl_offers.clvm diff --git a/chia/wallet/puzzles/graftroot_dl_offers.clvm.hex b/flax/wallet/puzzles/graftroot_dl_offers.clvm.hex similarity index 100% rename from chia/wallet/puzzles/graftroot_dl_offers.clvm.hex rename to flax/wallet/puzzles/graftroot_dl_offers.clvm.hex diff --git a/chia/wallet/puzzles/graftroot_dl_offers.clvm.hex.sha256tree b/flax/wallet/puzzles/graftroot_dl_offers.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/graftroot_dl_offers.clvm.hex.sha256tree rename to flax/wallet/puzzles/graftroot_dl_offers.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/json.clib b/flax/wallet/puzzles/json.clib similarity index 100% rename from chia/wallet/puzzles/json.clib rename to flax/wallet/puzzles/json.clib diff --git a/chia/wallet/puzzles/load_clvm.py b/flax/wallet/puzzles/load_clvm.py similarity index 92% rename from chia/wallet/puzzles/load_clvm.py rename to flax/wallet/puzzles/load_clvm.py index 3c06b68df..f17944e61 100644 --- a/chia/wallet/puzzles/load_clvm.py +++ b/flax/wallet/puzzles/load_clvm.py @@ -8,14 +8,14 @@ from typing import List import pkg_resources -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.util.lock import Lockfile +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.util.lock import Lockfile from clvm_tools_rs import compile_clvm as compile_clvm_rust compile_clvm_py = None -recompile_requested = (os.environ.get("CHIA_DEV_COMPILE_CLVM_ON_IMPORT", "") != "") or ("pytest" in sys.modules) +recompile_requested = (os.environ.get("FLAX_DEV_COMPILE_CLVM_ON_IMPORT", "") != "") or ("pytest" in sys.modules) def translate_path(p_): @@ -72,7 +72,7 @@ def sha256file(f): def compile_clvm(full_path: pathlib.Path, output: pathlib.Path, search_paths: List[pathlib.Path] = []): - with Lockfile.create(pathlib.Path(tempfile.gettempdir()) / "clvm_compile" / full_path.name): + with Lockfile.create(pathlib.Path(tempfile.gettempdir()) / "flvm_compile" / full_path.name): compile_clvm_in_lock(full_path, output, search_paths) @@ -89,8 +89,8 @@ def load_serialized_clvm( """ hex_filename = f"{clvm_filename}.hex" - # Set the CHIA_DEV_COMPILE_CLVM_ON_IMPORT environment variable to anything except - # "" or "0" to trigger automatic recompilation of the Chialisp on load. + # Set the FLAX_DEV_COMPILE_CLVM_ON_IMPORT environment variable to anything except + # "" or "0" to trigger automatic recompilation of the Flaxlisp on load. if recompile: try: if pkg_resources.resource_exists(package_or_requirement, clvm_filename): @@ -100,8 +100,8 @@ def load_serialized_clvm( search_paths = [full_path.parent] if include_standard_libraries: # we can't get the dir, but we can get a file then get its parent. - chia_puzzles_path = pathlib.Path(pkg_resources.resource_filename(__name__, "__init__.py")).parent - search_paths.append(chia_puzzles_path) + flax_puzzles_path = pathlib.Path(pkg_resources.resource_filename(__name__, "__init__.py")).parent + search_paths.append(flax_puzzles_path) compile_clvm(full_path, output, search_paths=search_paths) except NotImplementedError: diff --git a/chia/wallet/puzzles/lock.inner.puzzle.clvm b/flax/wallet/puzzles/lock.inner.puzzle.clvm similarity index 100% rename from chia/wallet/puzzles/lock.inner.puzzle.clvm rename to flax/wallet/puzzles/lock.inner.puzzle.clvm diff --git a/chia/wallet/puzzles/lock.inner.puzzle.clvm.hex b/flax/wallet/puzzles/lock.inner.puzzle.clvm.hex similarity index 100% rename from chia/wallet/puzzles/lock.inner.puzzle.clvm.hex rename to flax/wallet/puzzles/lock.inner.puzzle.clvm.hex diff --git a/chia/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree b/flax/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree rename to flax/wallet/puzzles/lock.inner.puzzle.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/merkle_utils.clib b/flax/wallet/puzzles/merkle_utils.clib similarity index 100% rename from chia/wallet/puzzles/merkle_utils.clib rename to flax/wallet/puzzles/merkle_utils.clib diff --git a/chia/wallet/puzzles/nft_intermediate_launcher.clvm b/flax/wallet/puzzles/nft_intermediate_launcher.clvm similarity index 100% rename from chia/wallet/puzzles/nft_intermediate_launcher.clvm rename to flax/wallet/puzzles/nft_intermediate_launcher.clvm diff --git a/chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex b/flax/wallet/puzzles/nft_intermediate_launcher.clvm.hex similarity index 100% rename from chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex rename to flax/wallet/puzzles/nft_intermediate_launcher.clvm.hex diff --git a/chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex.sha256tree b/flax/wallet/puzzles/nft_intermediate_launcher.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/nft_intermediate_launcher.clvm.hex.sha256tree rename to flax/wallet/puzzles/nft_intermediate_launcher.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/nft_metadata_updater_default.clvm b/flax/wallet/puzzles/nft_metadata_updater_default.clvm similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_default.clvm rename to flax/wallet/puzzles/nft_metadata_updater_default.clvm diff --git a/chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex b/flax/wallet/puzzles/nft_metadata_updater_default.clvm.hex similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex rename to flax/wallet/puzzles/nft_metadata_updater_default.clvm.hex diff --git a/chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex.sha256tree b/flax/wallet/puzzles/nft_metadata_updater_default.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_default.clvm.hex.sha256tree rename to flax/wallet/puzzles/nft_metadata_updater_default.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/nft_metadata_updater_updateable.clvm b/flax/wallet/puzzles/nft_metadata_updater_updateable.clvm similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_updateable.clvm rename to flax/wallet/puzzles/nft_metadata_updater_updateable.clvm diff --git a/chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex b/flax/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex rename to flax/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex diff --git a/chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex.sha256tree b/flax/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex.sha256tree rename to flax/wallet/puzzles/nft_metadata_updater_updateable.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/nft_ownership_layer.clvm b/flax/wallet/puzzles/nft_ownership_layer.clvm similarity index 100% rename from chia/wallet/puzzles/nft_ownership_layer.clvm rename to flax/wallet/puzzles/nft_ownership_layer.clvm diff --git a/chia/wallet/puzzles/nft_ownership_layer.clvm.hex b/flax/wallet/puzzles/nft_ownership_layer.clvm.hex similarity index 100% rename from chia/wallet/puzzles/nft_ownership_layer.clvm.hex rename to flax/wallet/puzzles/nft_ownership_layer.clvm.hex diff --git a/chia/wallet/puzzles/nft_ownership_layer.clvm.hex.sha256tree b/flax/wallet/puzzles/nft_ownership_layer.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/nft_ownership_layer.clvm.hex.sha256tree rename to flax/wallet/puzzles/nft_ownership_layer.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm b/flax/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm similarity index 99% rename from chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm rename to flax/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm index a297a00f3..5daac4a53 100644 --- a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm +++ b/flax/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm @@ -33,7 +33,7 @@ (f (divmod (* amount percentage) TEN_THOUSAND)) ) - ; Loop of the trade prices list and either assert a puzzle announcement or generate xch + ; Loop of the trade prices list and either assert a puzzle announcement or generate xfx (defun parse_trade_prices_list (ROYALTY_ADDRESS TRADE_PRICE_PERCENTAGE trade_prices_list my_nft_id) (if trade_prices_list (c diff --git a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex b/flax/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex similarity index 100% rename from chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex rename to flax/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex diff --git a/chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex.sha256tree b/flax/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex.sha256tree rename to flax/wallet/puzzles/nft_ownership_transfer_program_one_way_claim_with_royalties.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/nft_state_layer.clvm b/flax/wallet/puzzles/nft_state_layer.clvm similarity index 100% rename from chia/wallet/puzzles/nft_state_layer.clvm rename to flax/wallet/puzzles/nft_state_layer.clvm diff --git a/chia/wallet/puzzles/nft_state_layer.clvm.hex b/flax/wallet/puzzles/nft_state_layer.clvm.hex similarity index 100% rename from chia/wallet/puzzles/nft_state_layer.clvm.hex rename to flax/wallet/puzzles/nft_state_layer.clvm.hex diff --git a/chia/wallet/puzzles/nft_state_layer.clvm.hex.sha256tree b/flax/wallet/puzzles/nft_state_layer.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/nft_state_layer.clvm.hex.sha256tree rename to flax/wallet/puzzles/nft_state_layer.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/notification.clvm b/flax/wallet/puzzles/notification.clvm similarity index 100% rename from chia/wallet/puzzles/notification.clvm rename to flax/wallet/puzzles/notification.clvm diff --git a/chia/wallet/puzzles/notification.clvm.hex b/flax/wallet/puzzles/notification.clvm.hex similarity index 100% rename from chia/wallet/puzzles/notification.clvm.hex rename to flax/wallet/puzzles/notification.clvm.hex diff --git a/chia/wallet/puzzles/notification.clvm.hex.sha256tree b/flax/wallet/puzzles/notification.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/notification.clvm.hex.sha256tree rename to flax/wallet/puzzles/notification.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_conditions.clvm b/flax/wallet/puzzles/p2_conditions.clvm similarity index 100% rename from chia/wallet/puzzles/p2_conditions.clvm rename to flax/wallet/puzzles/p2_conditions.clvm diff --git a/chia/wallet/puzzles/p2_conditions.clvm.hex b/flax/wallet/puzzles/p2_conditions.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_conditions.clvm.hex rename to flax/wallet/puzzles/p2_conditions.clvm.hex diff --git a/chia/wallet/puzzles/p2_conditions.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_conditions.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_conditions.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_conditions.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_conditions.py b/flax/wallet/puzzles/p2_conditions.py similarity index 92% rename from chia/wallet/puzzles/p2_conditions.py rename to flax/wallet/puzzles/p2_conditions.py index ae649bcad..c1cf0ccae 100644 --- a/chia/wallet/puzzles/p2_conditions.py +++ b/flax/wallet/puzzles/p2_conditions.py @@ -12,7 +12,7 @@ from __future__ import annotations -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.program import Program from .load_clvm import load_clvm_maybe_recompile diff --git a/chia/wallet/puzzles/p2_delegated_conditions.clvm b/flax/wallet/puzzles/p2_delegated_conditions.clvm similarity index 100% rename from chia/wallet/puzzles/p2_delegated_conditions.clvm rename to flax/wallet/puzzles/p2_delegated_conditions.clvm diff --git a/chia/wallet/puzzles/p2_delegated_conditions.clvm.hex b/flax/wallet/puzzles/p2_delegated_conditions.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_delegated_conditions.clvm.hex rename to flax/wallet/puzzles/p2_delegated_conditions.clvm.hex diff --git a/chia/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_delegated_conditions.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_delegated_conditions.py b/flax/wallet/puzzles/p2_delegated_conditions.py similarity index 89% rename from chia/wallet/puzzles/p2_delegated_conditions.py rename to flax/wallet/puzzles/p2_delegated_conditions.py index a382c3fa1..a40509731 100644 --- a/chia/wallet/puzzles/p2_delegated_conditions.py +++ b/flax/wallet/puzzles/p2_delegated_conditions.py @@ -8,7 +8,7 @@ from __future__ import annotations -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.program import Program from .load_clvm import load_clvm_maybe_recompile diff --git a/chia/wallet/puzzles/p2_delegated_puzzle.clvm b/flax/wallet/puzzles/p2_delegated_puzzle.clvm similarity index 100% rename from chia/wallet/puzzles/p2_delegated_puzzle.clvm rename to flax/wallet/puzzles/p2_delegated_puzzle.clvm diff --git a/chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex b/flax/wallet/puzzles/p2_delegated_puzzle.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex rename to flax/wallet/puzzles/p2_delegated_puzzle.clvm.hex diff --git a/chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_delegated_puzzle.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_delegated_puzzle.py b/flax/wallet/puzzles/p2_delegated_puzzle.py similarity index 95% rename from chia/wallet/puzzles/p2_delegated_puzzle.py rename to flax/wallet/puzzles/p2_delegated_puzzle.py index 7ae342a65..27a0e3a9f 100644 --- a/chia/wallet/puzzles/p2_delegated_puzzle.py +++ b/flax/wallet/puzzles/p2_delegated_puzzle.py @@ -14,7 +14,7 @@ from __future__ import annotations -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.program import Program from . import p2_conditions from .load_clvm import load_clvm_maybe_recompile diff --git a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm b/flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm similarity index 100% rename from chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm rename to flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm diff --git a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex b/flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex rename to flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex diff --git a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py b/flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py similarity index 94% rename from chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py rename to flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py index 5738cb904..fca12db4f 100644 --- a/chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +++ b/flax/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py @@ -15,7 +15,7 @@ Note: -p2_delegated_puzzle_or_hidden_puzzle is essentially the "standard coin" in chia. +p2_delegated_puzzle_or_hidden_puzzle is essentially the "standard coin" in flax. DEFAULT_HIDDEN_PUZZLE_HASH from this puzzle is used with calculate_synthetic_secret_key in the wallet's standard pk_to_sk finder. @@ -28,7 +28,7 @@ level a set of auxiliary sk/pk pairs which are used for specific coins. These can be used for signing in AGG_SIG_ME, but the standard coin uses a key further derived from one of these via calculate_synthetic_secret_key as described in - https://chialisp.com/docs/standard_transaction. Therefore, when a wallet needs + https://flaxlisp.com/docs/standard_transaction. Therefore, when a wallet needs to find a secret key for signing based on a public key, it needs to try repeating this derivation as well and see if the G1Element (pk) associated with any of the derived secret keys matches the pk requested by the coin. @@ -38,7 +38,7 @@ delegated_puzzle_solution = Program.to((1, condition_args)) solutions = Program.to([[], delgated_puzzle_solution, []]) - In context, delegated_puzzle_solution here is any *chialisp program*, here one + In context, delegated_puzzle_solution here is any *flaxlisp program*, here one simply quoting a list of conditions, and the following argument is the arguments to this program, which here are unused. Secondly, the actual arguments to the p2_delegated_puzzle_or_hidden_puzzle are given. The first argument determines @@ -48,7 +48,7 @@ In most cases, the puzzle will be revealed, and this argument will be the nil object, () (represented here by an empty python list). - The second and third arguments are a chialisp program and its corresponding + The second and third arguments are a flaxlisp program and its corresponding arguments, which will be run inside the standard coin puzzle. This interacts with sign_coin_spend in that the AGG_SIG_ME condition added by the inner puzzle asks the surrounding system to provide a signature over the provided program with a synthetic @@ -63,9 +63,9 @@ from blspy import G1Element, PrivateKey from clvm.casts import int_from_bytes -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash from .load_clvm import load_clvm_maybe_recompile from .p2_conditions import puzzle_for_conditions diff --git a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm b/flax/wallet/puzzles/p2_m_of_n_delegate_direct.clvm similarity index 100% rename from chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm rename to flax/wallet/puzzles/p2_m_of_n_delegate_direct.clvm diff --git a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex b/flax/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex rename to flax/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex diff --git a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_m_of_n_delegate_direct.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.py b/flax/wallet/puzzles/p2_m_of_n_delegate_direct.py similarity index 91% rename from chia/wallet/puzzles/p2_m_of_n_delegate_direct.py rename to flax/wallet/puzzles/p2_m_of_n_delegate_direct.py index 10cbfd2d3..136665d17 100644 --- a/chia/wallet/puzzles/p2_m_of_n_delegate_direct.py +++ b/flax/wallet/puzzles/p2_m_of_n_delegate_direct.py @@ -7,7 +7,7 @@ from __future__ import annotations -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.program import Program from .load_clvm import load_clvm_maybe_recompile diff --git a/chia/wallet/puzzles/p2_parent.clvm b/flax/wallet/puzzles/p2_parent.clvm similarity index 100% rename from chia/wallet/puzzles/p2_parent.clvm rename to flax/wallet/puzzles/p2_parent.clvm diff --git a/chia/wallet/puzzles/p2_parent.clvm.hex b/flax/wallet/puzzles/p2_parent.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_parent.clvm.hex rename to flax/wallet/puzzles/p2_parent.clvm.hex diff --git a/chia/wallet/puzzles/p2_parent.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_parent.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_parent.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_parent.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_puzzle_hash.clvm b/flax/wallet/puzzles/p2_puzzle_hash.clvm similarity index 100% rename from chia/wallet/puzzles/p2_puzzle_hash.clvm rename to flax/wallet/puzzles/p2_puzzle_hash.clvm diff --git a/chia/wallet/puzzles/p2_puzzle_hash.clvm.hex b/flax/wallet/puzzles/p2_puzzle_hash.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_puzzle_hash.clvm.hex rename to flax/wallet/puzzles/p2_puzzle_hash.clvm.hex diff --git a/chia/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_puzzle_hash.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_puzzle_hash.py b/flax/wallet/puzzles/p2_puzzle_hash.py similarity index 86% rename from chia/wallet/puzzles/p2_puzzle_hash.py rename to flax/wallet/puzzles/p2_puzzle_hash.py index 5fe18d65d..f54ccc27c 100644 --- a/chia/wallet/puzzles/p2_puzzle_hash.py +++ b/flax/wallet/puzzles/p2_puzzle_hash.py @@ -7,8 +7,8 @@ from __future__ import annotations -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 from .load_clvm import load_clvm_maybe_recompile diff --git a/chia/wallet/puzzles/p2_singleton.clvm b/flax/wallet/puzzles/p2_singleton.clvm similarity index 100% rename from chia/wallet/puzzles/p2_singleton.clvm rename to flax/wallet/puzzles/p2_singleton.clvm diff --git a/chia/wallet/puzzles/p2_singleton.clvm.hex b/flax/wallet/puzzles/p2_singleton.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_singleton.clvm.hex rename to flax/wallet/puzzles/p2_singleton.clvm.hex diff --git a/chia/wallet/puzzles/p2_singleton.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_singleton.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_singleton.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_singleton.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm b/flax/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm similarity index 100% rename from chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm rename to flax/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm diff --git a/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex b/flax/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex similarity index 100% rename from chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex rename to flax/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex diff --git a/chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree b/flax/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree rename to flax/wallet/puzzles/p2_singleton_or_delayed_puzhash.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/pool_member_innerpuz.clvm b/flax/wallet/puzzles/pool_member_innerpuz.clvm similarity index 100% rename from chia/wallet/puzzles/pool_member_innerpuz.clvm rename to flax/wallet/puzzles/pool_member_innerpuz.clvm diff --git a/chia/wallet/puzzles/pool_member_innerpuz.clvm.hex b/flax/wallet/puzzles/pool_member_innerpuz.clvm.hex similarity index 100% rename from chia/wallet/puzzles/pool_member_innerpuz.clvm.hex rename to flax/wallet/puzzles/pool_member_innerpuz.clvm.hex diff --git a/chia/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree b/flax/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree rename to flax/wallet/puzzles/pool_member_innerpuz.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm b/flax/wallet/puzzles/pool_waitingroom_innerpuz.clvm similarity index 100% rename from chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm rename to flax/wallet/puzzles/pool_waitingroom_innerpuz.clvm diff --git a/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex b/flax/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex similarity index 100% rename from chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex rename to flax/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex diff --git a/chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree b/flax/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree rename to flax/wallet/puzzles/pool_waitingroom_innerpuz.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/prefarm/__init__.py b/flax/wallet/puzzles/prefarm/__init__.py similarity index 100% rename from chia/wallet/puzzles/prefarm/__init__.py rename to flax/wallet/puzzles/prefarm/__init__.py diff --git a/chia/wallet/puzzles/prefarm/make_prefarm_ph.py b/flax/wallet/puzzles/prefarm/make_prefarm_ph.py similarity index 66% rename from chia/wallet/puzzles/prefarm/make_prefarm_ph.py rename to flax/wallet/puzzles/prefarm/make_prefarm_ph.py index f393bc69c..32ec15340 100644 --- a/chia/wallet/puzzles/prefarm/make_prefarm_ph.py +++ b/flax/wallet/puzzles/prefarm/make_prefarm_ph.py @@ -1,16 +1,16 @@ from clvm.casts import int_from_bytes from clvm_tools import binutils -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.types.blockchain_format.program import Program -from chia.types.condition_opcodes import ConditionOpcode -from chia.util.bech32m import decode_puzzle_hash, encode_puzzle_hash -from chia.util.condition_tools import parse_sexp_to_conditions -from chia.util.ints import uint32 -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.types.blockchain_format.program import Program +from flax.types.condition_opcodes import ConditionOpcode +from flax.util.bech32m import decode_puzzle_hash, encode_puzzle_hash +from flax.util.condition_tools import parse_sexp_to_conditions +from flax.util.ints import uint32 +from flax.types.blockchain_format.sized_bytes import bytes32 -address1 = "txch15gx26ndmacfaqlq8m0yajeggzceu7cvmaz4df0hahkukes695rss6lej7h" # Gene wallet (m/12381/8444/2/42): -address2 = "txch1c2cguswhvmdyz9hr3q6hak2h6p9dw4rz82g4707k2xy2sarv705qcce4pn" # Mariano address (m/12381/8444/2/0) +address1 = "txfx15gx26ndmacfaqlq8m0yajeggzceu7cvmaz4df0hahkukes695rss6lej7h" # Gene wallet (m/12381/8444/2/42): +address2 = "txfx1c2cguswhvmdyz9hr3q6hak2h6p9dw4rz82g4707k2xy2sarv705qcce4pn" # Mariano address (m/12381/8444/2/0) ph1 = decode_puzzle_hash(address1) ph2 = decode_puzzle_hash(address2) @@ -33,32 +33,32 @@ def make_puzzle(amount: int) -> int: puzzle_hash = puzzle_prog.get_tree_hash() solution = "()" - prefix = "xch" + prefix = "xfx" print("PH", puzzle_hash) print(f"Address: {encode_puzzle_hash(puzzle_hash, prefix)}") result = puzzle_prog.run(solution) error, result_human = parse_sexp_to_conditions(result) - total_chia = 0 + total_flax = 0 if error: print(f"Error: {error}") else: assert result_human is not None for cvp in result_human: assert len(cvp.vars) == 2 - total_chia += int_from_bytes(cvp.vars[1]) + total_flax += int_from_bytes(cvp.vars[1]) print( f"{ConditionOpcode(cvp.opcode).name}: {encode_puzzle_hash(bytes32(cvp.vars[0]), prefix)}," f" amount: {int_from_bytes(cvp.vars[1])}" ) - return total_chia + return total_flax -total_chia = 0 +total_flax = 0 print("Pool address: ") -total_chia += make_puzzle(pool_amounts) +total_flax += make_puzzle(pool_amounts) print("\nFarmer address: ") -total_chia += make_puzzle(farmer_amounts) +total_flax += make_puzzle(farmer_amounts) -assert total_chia == calculate_base_farmer_reward(uint32(0)) + calculate_pool_reward(uint32(0)) +assert total_flax == calculate_base_farmer_reward(uint32(0)) + calculate_pool_reward(uint32(0)) diff --git a/chia/wallet/puzzles/prefarm/spend_prefarm.py b/flax/wallet/puzzles/prefarm/spend_prefarm.py similarity index 80% rename from chia/wallet/puzzles/prefarm/spend_prefarm.py rename to flax/wallet/puzzles/prefarm/spend_prefarm.py index 060376592..5e4f90f1d 100644 --- a/chia/wallet/puzzles/prefarm/spend_prefarm.py +++ b/flax/wallet/puzzles/prefarm/spend_prefarm.py @@ -3,17 +3,17 @@ from blspy import G2Element from clvm_tools import binutils -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.types.blockchain_format.program import Program -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.spend_bundle import SpendBundle -from chia.util.bech32m import decode_puzzle_hash -from chia.util.condition_tools import parse_sexp_to_conditions -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint32, uint16 +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.types.blockchain_format.program import Program +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.spend_bundle import SpendBundle +from flax.util.bech32m import decode_puzzle_hash +from flax.util.condition_tools import parse_sexp_to_conditions +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint32, uint16 def print_conditions(spend_bundle: SpendBundle): @@ -43,8 +43,8 @@ async def main() -> None: print(farmer_prefarm.amount, farmer_amounts) assert farmer_amounts == farmer_prefarm.amount // 2 assert pool_amounts == pool_prefarm.amount // 2 - address1 = "xch1rdatypul5c642jkeh4yp933zu3hw8vv8tfup8ta6zfampnyhjnusxdgns6" # Key 1 - address2 = "xch1duvy5ur5eyj7lp5geetfg84cj2d7xgpxt7pya3lr2y6ke3696w9qvda66e" # Key 2 + address1 = "xfx1rdatypul5c642jkeh4yp933zu3hw8vv8tfup8ta6zfampnyhjnusxdgns6" # Key 1 + address2 = "xfx1duvy5ur5eyj7lp5geetfg84cj2d7xgpxt7pya3lr2y6ke3696w9qvda66e" # Key 2 ph1 = decode_puzzle_hash(address1) ph2 = decode_puzzle_hash(address2) diff --git a/chia/wallet/puzzles/puzzle_utils.py b/flax/wallet/puzzles/puzzle_utils.py similarity index 97% rename from chia/wallet/puzzles/puzzle_utils.py rename to flax/wallet/puzzles/puzzle_utils.py index cc863e092..0862b1a38 100644 --- a/chia/wallet/puzzles/puzzle_utils.py +++ b/flax/wallet/puzzles/puzzle_utils.py @@ -1,6 +1,6 @@ from typing import Optional, List -from chia.types.condition_opcodes import ConditionOpcode +from flax.types.condition_opcodes import ConditionOpcode def make_create_coin_condition(puzzle_hash, amount, memos: Optional[List[bytes]]) -> List: diff --git a/chia/wallet/puzzles/recompile-all.sh b/flax/wallet/puzzles/recompile-all.sh old mode 100755 new mode 100644 similarity index 100% rename from chia/wallet/puzzles/recompile-all.sh rename to flax/wallet/puzzles/recompile-all.sh diff --git a/chia/wallet/puzzles/rom_bootstrap_generator.clvm b/flax/wallet/puzzles/rom_bootstrap_generator.clvm similarity index 96% rename from chia/wallet/puzzles/rom_bootstrap_generator.clvm rename to flax/wallet/puzzles/rom_bootstrap_generator.clvm index 5e3881598..efd3a4e11 100644 --- a/chia/wallet/puzzles/rom_bootstrap_generator.clvm +++ b/flax/wallet/puzzles/rom_bootstrap_generator.clvm @@ -1,7 +1,7 @@ (mod (block_decompresser_program (historical_blocks_tree)) (defconstant local_deserialize_mod - ;; this monstrosity is the assembly output of `chialisp_deserialisation.clvm` + ;; this monstrosity is the assembly output of `flaxlisp_deserialisation.clvm` ;; it's pasted in here because the compiler doesn't yet support nested `mod` ;; my apologies -- RK diff --git a/chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex b/flax/wallet/puzzles/rom_bootstrap_generator.clvm.hex similarity index 100% rename from chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex rename to flax/wallet/puzzles/rom_bootstrap_generator.clvm.hex diff --git a/chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree b/flax/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree rename to flax/wallet/puzzles/rom_bootstrap_generator.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/rom_bootstrap_generator.py b/flax/wallet/puzzles/rom_bootstrap_generator.py similarity index 78% rename from chia/wallet/puzzles/rom_bootstrap_generator.py rename to flax/wallet/puzzles/rom_bootstrap_generator.py index 17643d10e..adce7f2e2 100644 --- a/chia/wallet/puzzles/rom_bootstrap_generator.py +++ b/flax/wallet/puzzles/rom_bootstrap_generator.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.program import SerializedProgram from .load_clvm import load_serialized_clvm_maybe_recompile diff --git a/chia/wallet/puzzles/settlement_payments.clvm b/flax/wallet/puzzles/settlement_payments.clvm similarity index 100% rename from chia/wallet/puzzles/settlement_payments.clvm rename to flax/wallet/puzzles/settlement_payments.clvm diff --git a/chia/wallet/puzzles/settlement_payments.clvm.hex b/flax/wallet/puzzles/settlement_payments.clvm.hex similarity index 100% rename from chia/wallet/puzzles/settlement_payments.clvm.hex rename to flax/wallet/puzzles/settlement_payments.clvm.hex diff --git a/chia/wallet/puzzles/settlement_payments.clvm.hex.sha256tree b/flax/wallet/puzzles/settlement_payments.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/settlement_payments.clvm.hex.sha256tree rename to flax/wallet/puzzles/settlement_payments.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/settlement_payments_old.clvm b/flax/wallet/puzzles/settlement_payments_old.clvm similarity index 100% rename from chia/wallet/puzzles/settlement_payments_old.clvm rename to flax/wallet/puzzles/settlement_payments_old.clvm diff --git a/chia/wallet/puzzles/settlement_payments_old.clvm.hex b/flax/wallet/puzzles/settlement_payments_old.clvm.hex similarity index 100% rename from chia/wallet/puzzles/settlement_payments_old.clvm.hex rename to flax/wallet/puzzles/settlement_payments_old.clvm.hex diff --git a/chia/wallet/puzzles/settlement_payments_old.clvm.hex.sha256tree b/flax/wallet/puzzles/settlement_payments_old.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/settlement_payments_old.clvm.hex.sha256tree rename to flax/wallet/puzzles/settlement_payments_old.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/sha256tree.clib b/flax/wallet/puzzles/sha256tree.clib similarity index 100% rename from chia/wallet/puzzles/sha256tree.clib rename to flax/wallet/puzzles/sha256tree.clib diff --git a/chia/wallet/puzzles/sha256tree_module.clvm b/flax/wallet/puzzles/sha256tree_module.clvm similarity index 100% rename from chia/wallet/puzzles/sha256tree_module.clvm rename to flax/wallet/puzzles/sha256tree_module.clvm diff --git a/chia/wallet/puzzles/sha256tree_module.clvm.hex b/flax/wallet/puzzles/sha256tree_module.clvm.hex similarity index 100% rename from chia/wallet/puzzles/sha256tree_module.clvm.hex rename to flax/wallet/puzzles/sha256tree_module.clvm.hex diff --git a/chia/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree b/flax/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree rename to flax/wallet/puzzles/sha256tree_module.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/singleton_launcher.clvm b/flax/wallet/puzzles/singleton_launcher.clvm similarity index 100% rename from chia/wallet/puzzles/singleton_launcher.clvm rename to flax/wallet/puzzles/singleton_launcher.clvm diff --git a/chia/wallet/puzzles/singleton_launcher.clvm.hex b/flax/wallet/puzzles/singleton_launcher.clvm.hex similarity index 100% rename from chia/wallet/puzzles/singleton_launcher.clvm.hex rename to flax/wallet/puzzles/singleton_launcher.clvm.hex diff --git a/chia/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree b/flax/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree rename to flax/wallet/puzzles/singleton_launcher.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/singleton_top_layer.clvm b/flax/wallet/puzzles/singleton_top_layer.clvm similarity index 100% rename from chia/wallet/puzzles/singleton_top_layer.clvm rename to flax/wallet/puzzles/singleton_top_layer.clvm diff --git a/chia/wallet/puzzles/singleton_top_layer.clvm.hex b/flax/wallet/puzzles/singleton_top_layer.clvm.hex similarity index 100% rename from chia/wallet/puzzles/singleton_top_layer.clvm.hex rename to flax/wallet/puzzles/singleton_top_layer.clvm.hex diff --git a/chia/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree b/flax/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree rename to flax/wallet/puzzles/singleton_top_layer.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/singleton_top_layer.py b/flax/wallet/puzzles/singleton_top_layer.py similarity index 96% rename from chia/wallet/puzzles/singleton_top_layer.py rename to flax/wallet/puzzles/singleton_top_layer.py index 0e9898e23..7b68f4f6a 100644 --- a/chia/wallet/puzzles/singleton_top_layer.py +++ b/flax/wallet/puzzles/singleton_top_layer.py @@ -1,14 +1,14 @@ from typing import Iterator, List, Tuple, Optional -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.coin_spend import CoinSpend -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.lineage_proof import LineageProof -from chia.util.ints import uint64 -from chia.util.hash import std_hash +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.coin_spend import CoinSpend +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.lineage_proof import LineageProof +from flax.util.ints import uint64 +from flax.util.hash import std_hash SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer.clvm") SINGLETON_MOD_HASH = SINGLETON_MOD.get_tree_hash() diff --git a/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm b/flax/wallet/puzzles/singleton_top_layer_v1_1.clvm similarity index 100% rename from chia/wallet/puzzles/singleton_top_layer_v1_1.clvm rename to flax/wallet/puzzles/singleton_top_layer_v1_1.clvm diff --git a/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex b/flax/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex similarity index 100% rename from chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex rename to flax/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex diff --git a/chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex.sha256tree b/flax/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex.sha256tree rename to flax/wallet/puzzles/singleton_top_layer_v1_1.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/singleton_top_layer_v1_1.py b/flax/wallet/puzzles/singleton_top_layer_v1_1.py similarity index 95% rename from chia/wallet/puzzles/singleton_top_layer_v1_1.py rename to flax/wallet/puzzles/singleton_top_layer_v1_1.py index c4d43bff8..e62460452 100644 --- a/chia/wallet/puzzles/singleton_top_layer_v1_1.py +++ b/flax/wallet/puzzles/singleton_top_layer_v1_1.py @@ -2,16 +2,16 @@ from typing import Iterator, List, Optional, Tuple -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.util.hash import std_hash -from chia.util.ints import uint64 -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.uncurried_puzzle import UncurriedPuzzle +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.util.hash import std_hash +from flax.util.ints import uint64 +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.uncurried_puzzle import UncurriedPuzzle SINGLETON_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm") SINGLETON_MOD_HASH = SINGLETON_MOD.get_tree_hash() diff --git a/chia/wallet/puzzles/singleton_truths.clib b/flax/wallet/puzzles/singleton_truths.clib similarity index 100% rename from chia/wallet/puzzles/singleton_truths.clib rename to flax/wallet/puzzles/singleton_truths.clib diff --git a/chia/wallet/puzzles/tails.py b/flax/wallet/puzzles/tails.py similarity index 92% rename from chia/wallet/puzzles/tails.py rename to flax/wallet/puzzles/tails.py index 7d85afea8..164b5a7e6 100644 --- a/chia/wallet/puzzles/tails.py +++ b/flax/wallet/puzzles/tails.py @@ -1,21 +1,21 @@ from typing import Tuple, Dict, List, Optional, Any -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint64 -from chia.util.byte_types import hexstr_to_bytes -from chia.wallet.cat_wallet.lineage_store import CATLineageStore -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.cat_wallet.cat_utils import ( +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint64 +from flax.util.byte_types import hexstr_to_bytes +from flax.wallet.cat_wallet.lineage_store import CATLineageStore +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.cat_wallet.cat_utils import ( construct_cat_puzzle, unsigned_spend_bundle_for_spendable_cats, SpendableCAT, ) -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.cat_wallet.cat_info import CATInfo -from chia.wallet.transaction_record import TransactionRecord +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.cat_wallet.cat_info import CATInfo +from flax.wallet.transaction_record import TransactionRecord GENESIS_BY_ID_MOD = load_clvm_maybe_recompile("genesis_by_coin_id.clvm") GENESIS_BY_PUZHASH_MOD = load_clvm_maybe_recompile("genesis_by_puzzle_hash.clvm") diff --git a/chia/wallet/puzzles/test_generator_deserialize.clvm b/flax/wallet/puzzles/test_generator_deserialize.clvm similarity index 100% rename from chia/wallet/puzzles/test_generator_deserialize.clvm rename to flax/wallet/puzzles/test_generator_deserialize.clvm diff --git a/chia/wallet/puzzles/test_generator_deserialize.clvm.hex b/flax/wallet/puzzles/test_generator_deserialize.clvm.hex similarity index 100% rename from chia/wallet/puzzles/test_generator_deserialize.clvm.hex rename to flax/wallet/puzzles/test_generator_deserialize.clvm.hex diff --git a/chia/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree b/flax/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree rename to flax/wallet/puzzles/test_generator_deserialize.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm b/flax/wallet/puzzles/test_multiple_generator_input_arguments.clvm similarity index 100% rename from chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm rename to flax/wallet/puzzles/test_multiple_generator_input_arguments.clvm diff --git a/chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex b/flax/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex similarity index 100% rename from chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex rename to flax/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex diff --git a/chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree b/flax/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree similarity index 100% rename from chia/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree rename to flax/wallet/puzzles/test_multiple_generator_input_arguments.clvm.hex.sha256tree diff --git a/chia/wallet/puzzles/utility_macros.clib b/flax/wallet/puzzles/utility_macros.clib similarity index 100% rename from chia/wallet/puzzles/utility_macros.clib rename to flax/wallet/puzzles/utility_macros.clib diff --git a/chia/wallet/secret_key_store.py b/flax/wallet/secret_key_store.py similarity index 100% rename from chia/wallet/secret_key_store.py rename to flax/wallet/secret_key_store.py diff --git a/chia/wallet/settings/__init__.py b/flax/wallet/settings/__init__.py similarity index 100% rename from chia/wallet/settings/__init__.py rename to flax/wallet/settings/__init__.py diff --git a/chia/wallet/settings/default_settings.py b/flax/wallet/settings/default_settings.py similarity index 75% rename from chia/wallet/settings/default_settings.py rename to flax/wallet/settings/default_settings.py index 80b8b1b6f..790fa0b80 100644 --- a/chia/wallet/settings/default_settings.py +++ b/flax/wallet/settings/default_settings.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.wallet.settings.settings_objects import BackupInitialized +from flax.wallet.settings.settings_objects import BackupInitialized default_backup_initialized = BackupInitialized(False, False, False, True) diff --git a/chia/wallet/settings/settings_objects.py b/flax/wallet/settings/settings_objects.py similarity index 90% rename from chia/wallet/settings/settings_objects.py rename to flax/wallet/settings/settings_objects.py index 7de564b2d..14c3920cb 100644 --- a/chia/wallet/settings/settings_objects.py +++ b/flax/wallet/settings/settings_objects.py @@ -2,7 +2,7 @@ from dataclasses import dataclass -from chia.util.streamable import Streamable, streamable +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/wallet/settings/user_settings.py b/flax/wallet/settings/user_settings.py similarity index 85% rename from chia/wallet/settings/user_settings.py rename to flax/wallet/settings/user_settings.py index 0cfafc590..b5e37655e 100644 --- a/chia/wallet/settings/user_settings.py +++ b/flax/wallet/settings/user_settings.py @@ -2,9 +2,9 @@ from typing import Any, Dict -from chia.wallet.key_val_store import KeyValStore -from chia.wallet.settings.default_settings import default_settings -from chia.wallet.settings.settings_objects import BackupInitialized +from flax.wallet.key_val_store import KeyValStore +from flax.wallet.settings.default_settings import default_settings +from flax.wallet.settings.settings_objects import BackupInitialized class UserSettings: diff --git a/chia/wallet/sign_coin_spends.py b/flax/wallet/sign_coin_spends.py similarity index 94% rename from chia/wallet/sign_coin_spends.py rename to flax/wallet/sign_coin_spends.py index 2da07799d..0f5ed2ad1 100644 --- a/chia/wallet/sign_coin_spends.py +++ b/flax/wallet/sign_coin_spends.py @@ -4,9 +4,9 @@ import blspy from blspy import AugSchemeMPL -from chia.types.coin_spend import CoinSpend -from chia.types.spend_bundle import SpendBundle -from chia.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict +from flax.types.coin_spend import CoinSpend +from flax.types.spend_bundle import SpendBundle +from flax.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict async def sign_coin_spends( diff --git a/chia/wallet/trade_manager.py b/flax/wallet/trade_manager.py similarity index 95% rename from chia/wallet/trade_manager.py rename to flax/wallet/trade_manager.py index 1a9f70884..e231aff91 100644 --- a/chia/wallet/trade_manager.py +++ b/flax/wallet/trade_manager.py @@ -8,31 +8,31 @@ from typing_extensions import Literal -from chia.data_layer.data_layer_wallet import DataLayerWallet -from chia.protocols.wallet_protocol import CoinState -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.coin import Coin, coin_as_list -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.spend_bundle import SpendBundle -from chia.util.db_wrapper import DBWrapper2 -from chia.util.hash import std_hash -from chia.util.ints import uint32, uint64 -from chia.wallet.db_wallet.db_wallet_puzzles import ACS_MU_PH -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.outer_puzzles import AssetType -from chia.wallet.payment import Payment -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.trade_record import TradeRecord -from chia.wallet.trading.offer import NotarizedPayment, Offer -from chia.wallet.trading.trade_status import TradeStatus -from chia.wallet.trading.trade_store import TradeStore -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_coin_record import WalletCoinRecord +from flax.data_layer.data_layer_wallet import DataLayerWallet +from flax.protocols.wallet_protocol import CoinState +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.coin import Coin, coin_as_list +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.spend_bundle import SpendBundle +from flax.util.db_wrapper import DBWrapper2 +from flax.util.hash import std_hash +from flax.util.ints import uint32, uint64 +from flax.wallet.db_wallet.db_wallet_puzzles import ACS_MU_PH +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.outer_puzzles import AssetType +from flax.wallet.payment import Payment +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.trade_record import TradeRecord +from flax.wallet.trading.offer import NotarizedPayment, Offer +from flax.wallet.trading.trade_status import TradeStatus +from flax.wallet.trading.trade_store import TradeStore +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_coin_record import WalletCoinRecord OFFER_MOD = load_clvm_maybe_recompile("settlement_payments.clvm") @@ -41,12 +41,12 @@ class TradeManager: """ This class is a driver for creating and accepting settlement_payments.clvm style offers. - By default, standard XCH is supported but to support other types of assets you must implement certain functions on + By default, standard XFX is supported but to support other types of assets you must implement certain functions on the asset's wallet as well as create a driver for its puzzle(s). Here is a guide to integrating a new types of assets with this trade manager: Puzzle Drivers: - - See chia/wallet/outer_puzzles.py for a full description of how to build these + - See flax/wallet/outer_puzzles.py for a full description of how to build these - The `solve` method must be able to be solved by a Solver that looks like this: Solver( { @@ -120,7 +120,7 @@ async def get_trade_by_coin(self, coin: Coin) -> Optional[TradeRecord]: return None async def coins_of_interest_farmed( - self, coin_state: CoinState, fork_height: Optional[uint32], peer: WSChiaConnection + self, coin_state: CoinState, fork_height: Optional[uint32], peer: WSFlaxConnection ) -> None: """ If both our coins and other coins in trade got removed that means that trade was successfully executed @@ -234,7 +234,7 @@ async def cancel_pending_offer_safely( new_ph = await wallet.wallet_state_manager.main_wallet.get_new_puzzlehash() else: new_ph = await wallet.get_new_puzzlehash() - # This should probably not switch on whether or not we're spending a XCH but it has to for now + # This should probably not switch on whether or not we're spending a XFX but it has to for now if wallet.type() == WalletType.STANDARD_WALLET: if fee_to_pay > coin.amount: selected_coins: Set[Coin] = await wallet.select_coins( @@ -313,7 +313,7 @@ async def cancel_pending_offers( new_ph = await wallet.wallet_state_manager.main_wallet.get_new_puzzlehash() else: new_ph = await wallet.get_new_puzzlehash() - # This should probably not switch on whether or not we're spending a XCH but it has to for now + # This should probably not switch on whether or not we're spending a XFX but it has to for now if wallet.type() == WalletType.STANDARD_WALLET: if fee_to_pay > coin.amount: selected_coins: Set[Coin] = await wallet.select_coins( @@ -446,7 +446,7 @@ async def _create_offer_for_ids( offer_dict_no_ints: Dict[Optional[bytes32], int] = {} for id, amount in offer_dict.items(): asset_id: Optional[bytes32] = None - # asset_id can either be none if asset is XCH or + # asset_id can either be none if asset is XFX or # bytes32 if another asset (e.g. NFT, CAT) if amount > 0: # this is what we are receiving in the trade @@ -493,7 +493,7 @@ async def _create_offer_for_ids( offer_dict_no_ints[asset_id] = amount - if asset_id is not None and wallet is not None: # if this asset is not XCH + if asset_id is not None and wallet is not None: # if this asset is not XFX if callable(getattr(wallet, "get_puzzle_info", None)): puzzle_driver: PuzzleInfo = await wallet.get_puzzle_info(asset_id) if asset_id in driver_dict and driver_dict[asset_id] != puzzle_driver: @@ -529,7 +529,7 @@ async def _create_offer_for_ids( wallet = self.wallet_state_manager.wallets[id] else: wallet = await self.wallet_state_manager.get_wallet_for_asset_id(id.hex()) - # This should probably not switch on whether or not we're spending XCH but it has to for now + # This should probably not switch on whether or not we're spending XFX but it has to for now if wallet.type() == WalletType.STANDARD_WALLET: tx = await wallet.generate_signed_transaction( abs(offer_dict[id]), @@ -588,7 +588,7 @@ async def maybe_create_wallets_for_offer(self, offer: Offer) -> None: if exists is None: await wsm.create_wallet_for_puzzle_info(offer.driver_dict[key]) - async def check_offer_validity(self, offer: Offer, peer: WSChiaConnection) -> bool: + async def check_offer_validity(self, offer: Offer, peer: WSFlaxConnection) -> bool: all_removals: List[Coin] = offer.bundle.removals() all_removal_names: List[bytes32] = [c.name() for c in all_removals] non_ephemeral_removals: List[Coin] = list( @@ -692,7 +692,7 @@ async def calculate_tx_records_for_offer(self, offer: Offer, validate: bool) -> async def respond_to_offer( self, offer: Offer, - peer: WSChiaConnection, + peer: WSFlaxConnection, solver: Optional[Solver] = None, fee: uint64 = uint64(0), min_coin_amount: Optional[uint64] = None, diff --git a/chia/wallet/trade_record.py b/flax/wallet/trade_record.py similarity index 83% rename from chia/wallet/trade_record.py rename to flax/wallet/trade_record.py index c2ea1f3f1..55a18c338 100644 --- a/chia/wallet/trade_record.py +++ b/flax/wallet/trade_record.py @@ -1,12 +1,12 @@ from dataclasses import dataclass from typing import List, Optional, Tuple, Dict, Any -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint32, uint64 -from chia.util.streamable import Streamable, streamable -from chia.wallet.trading.offer import Offer -from chia.wallet.trading.trade_status import TradeStatus +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint32, uint64 +from flax.util.streamable import Streamable, streamable +from flax.wallet.trading.offer import Offer +from flax.wallet.trading.trade_status import TradeStatus @streamable diff --git a/chia/wallet/trading/__init__.py b/flax/wallet/trading/__init__.py similarity index 100% rename from chia/wallet/trading/__init__.py rename to flax/wallet/trading/__init__.py diff --git a/chia/wallet/trading/offer.py b/flax/wallet/trading/offer.py similarity index 96% rename from chia/wallet/trading/offer.py rename to flax/wallet/trading/offer.py index ec278daab..96c81191f 100644 --- a/chia/wallet/trading/offer.py +++ b/flax/wallet/trading/offer.py @@ -5,15 +5,15 @@ from blspy import G2Element from clvm_tools.binutils import disassemble -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.coin import Coin, coin_as_list -from chia.types.blockchain_format.program import Program, INFINITE_COST -from chia.types.announcement import Announcement -from chia.types.coin_spend import CoinSpend -from chia.types.spend_bundle import SpendBundle -from chia.util.bech32m import bech32_decode, bech32_encode, convertbits -from chia.util.ints import uint64 -from chia.wallet.outer_puzzles import ( +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.coin import Coin, coin_as_list +from flax.types.blockchain_format.program import Program, INFINITE_COST +from flax.types.announcement import Announcement +from flax.types.coin_spend import CoinSpend +from flax.types.spend_bundle import SpendBundle +from flax.util.bech32m import bech32_decode, bech32_encode, convertbits +from flax.util.ints import uint64 +from flax.wallet.outer_puzzles import ( construct_puzzle, create_asset_id, match_puzzle, @@ -21,15 +21,15 @@ get_inner_puzzle, get_inner_solution, ) -from chia.wallet.payment import Payment -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.util.puzzle_compression import ( +from flax.wallet.payment import Payment +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.util.puzzle_compression import ( compress_object_with_puzzles, decompress_object_with_puzzles, lowest_best_version, ) -from chia.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle +from flax.wallet.uncurried_puzzle import UncurriedPuzzle, uncurry_puzzle OFFER_MOD_OLD = load_clvm_maybe_recompile("settlement_payments_old.clvm") OFFER_MOD = load_clvm_maybe_recompile("settlement_payments_old.clvm") @@ -77,7 +77,7 @@ def ph() -> bytes32: @staticmethod def notarize_payments( - requested_payments: Dict[Optional[bytes32], List[Payment]], # `None` means you are requesting XCH + requested_payments: Dict[Optional[bytes32], List[Payment]], # `None` means you are requesting XFX coins: List[Coin], ) -> Dict[Optional[bytes32], List[NotarizedPayment]]: # This sort should be reproducible in CLVM with `>s` @@ -241,7 +241,7 @@ def keys_to_strings(dic: Dict[Optional[bytes32], Any]) -> Dict[str, Any]: new_dic: Dict[str, Any] = {} for key in dic: if key is None: - new_dic["xch"] = dic[key] + new_dic["xfx"] = dic[key] else: new_dic[key.hex()] = dic[key] return new_dic @@ -262,7 +262,7 @@ def get_pending_amounts(self) -> Dict[str, int]: pending_dict: Dict[str, int] = {} # First we add up the amounts of all coins that share an ancestor with the offered coins (i.e. a primary coin) for asset_id, coins in self.get_offered_coins().items(): - name = "xch" if asset_id is None else asset_id.hex() + name = "xfx" if asset_id is None else asset_id.hex() pending_dict[name] = 0 for coin in coins: root_removal: Coin = self.get_root_removal(coin) diff --git a/chia/wallet/trading/trade_status.py b/flax/wallet/trading/trade_status.py similarity index 100% rename from chia/wallet/trading/trade_status.py rename to flax/wallet/trading/trade_status.py diff --git a/chia/wallet/trading/trade_store.py b/flax/wallet/trading/trade_store.py similarity index 98% rename from chia/wallet/trading/trade_store.py rename to flax/wallet/trading/trade_store.py index a0b2ba289..0c0c9ffc2 100644 --- a/chia/wallet/trading/trade_store.py +++ b/flax/wallet/trading/trade_store.py @@ -4,13 +4,13 @@ import aiosqlite -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.util.db_wrapper import DBWrapper2 -from chia.util.errors import Err -from chia.util.ints import uint8, uint32 -from chia.wallet.trade_record import TradeRecord -from chia.wallet.trading.trade_status import TradeStatus +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.util.db_wrapper import DBWrapper2 +from flax.util.errors import Err +from flax.util.ints import uint8, uint32 +from flax.wallet.trade_record import TradeRecord +from flax.wallet.trading.trade_status import TradeStatus async def migrate_coin_of_interest(log: logging.Logger, db: aiosqlite.Connection) -> None: diff --git a/chia/wallet/transaction_record.py b/flax/wallet/transaction_record.py similarity index 88% rename from chia/wallet/transaction_record.py rename to flax/wallet/transaction_record.py index 5d6b58094..3ef05802c 100644 --- a/chia/wallet/transaction_record.py +++ b/flax/wallet/transaction_record.py @@ -1,15 +1,15 @@ from dataclasses import dataclass from typing import Generic, List, Optional, Tuple, TypeVar, Dict -from chia.consensus.coinbase import pool_parent_id, farmer_parent_id -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.spend_bundle import SpendBundle -from chia.util.bech32m import encode_puzzle_hash, decode_puzzle_hash -from chia.util.ints import uint8, uint32, uint64 -from chia.util.streamable import Streamable, streamable -from chia.wallet.util.transaction_type import TransactionType +from flax.consensus.coinbase import pool_parent_id, farmer_parent_id +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.spend_bundle import SpendBundle +from flax.util.bech32m import encode_puzzle_hash, decode_puzzle_hash +from flax.util.ints import uint8, uint32, uint64 +from flax.util.streamable import Streamable, streamable +from flax.wallet.util.transaction_type import TransactionType T = TypeVar("T") diff --git a/chia/wallet/transaction_sorting.py b/flax/wallet/transaction_sorting.py similarity index 100% rename from chia/wallet/transaction_sorting.py rename to flax/wallet/transaction_sorting.py diff --git a/chia/wallet/uncurried_puzzle.py b/flax/wallet/uncurried_puzzle.py similarity index 81% rename from chia/wallet/uncurried_puzzle.py rename to flax/wallet/uncurried_puzzle.py index a00c0f670..a0caeb27a 100644 --- a/chia/wallet/uncurried_puzzle.py +++ b/flax/wallet/uncurried_puzzle.py @@ -2,7 +2,7 @@ from dataclasses import dataclass -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.program import Program @dataclass(frozen=True) diff --git a/chia/wallet/util/__init__.py b/flax/wallet/util/__init__.py similarity index 100% rename from chia/wallet/util/__init__.py rename to flax/wallet/util/__init__.py diff --git a/chia/wallet/util/address_type.py b/flax/wallet/util/address_type.py similarity index 87% rename from chia/wallet/util/address_type.py rename to flax/wallet/util/address_type.py index a9e908e02..a3c59b75c 100644 --- a/chia/wallet/util/address_type.py +++ b/flax/wallet/util/address_type.py @@ -3,18 +3,18 @@ from enum import Enum from typing import Any, Dict, Set -from chia.util.bech32m import bech32_decode, convertbits -from chia.util.config import selected_network_address_prefix +from flax.util.bech32m import bech32_decode, convertbits +from flax.util.config import selected_network_address_prefix class AddressType(Enum): - XCH = "xch" + XFX = "xfx" NFT = "nft" - DID = "did:chia:" + DID = "did:flax:" def hrp(self, config: Dict[str, Any]) -> str: - if self == AddressType.XCH: - # Special case to map XCH to the current network's address prefix + if self == AddressType.XFX: + # Special case to map XFX to the current network's address prefix return selected_network_address_prefix(config) return self.value diff --git a/chia/wallet/util/compute_hints.py b/flax/wallet/util/compute_hints.py similarity index 71% rename from chia/wallet/util/compute_hints.py rename to flax/wallet/util/compute_hints.py index 36d35ebd1..cd171c683 100644 --- a/chia/wallet/util/compute_hints.py +++ b/flax/wallet/util/compute_hints.py @@ -1,9 +1,9 @@ from typing import List -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.blockchain_format.program import INFINITE_COST -from chia.types.coin_spend import CoinSpend +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.blockchain_format.program import INFINITE_COST +from flax.types.coin_spend import CoinSpend def compute_coin_hints(cs: CoinSpend) -> List[bytes32]: diff --git a/chia/wallet/util/compute_memos.py b/flax/wallet/util/compute_memos.py similarity index 83% rename from chia/wallet/util/compute_memos.py rename to flax/wallet/util/compute_memos.py index b11250071..8c9eceff2 100644 --- a/chia/wallet/util/compute_memos.py +++ b/flax/wallet/util/compute_memos.py @@ -2,12 +2,12 @@ from clvm.casts import int_from_bytes -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import INFINITE_COST -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.spend_bundle import SpendBundle +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import INFINITE_COST +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.spend_bundle import SpendBundle def compute_memos_for_spend(coin_spend: CoinSpend) -> Dict[bytes32, List[bytes]]: diff --git a/chia/wallet/util/curry_and_treehash.py b/flax/wallet/util/curry_and_treehash.py similarity index 97% rename from chia/wallet/util/curry_and_treehash.py rename to flax/wallet/util/curry_and_treehash.py index dd6d16c99..a2d9f286a 100644 --- a/chia/wallet/util/curry_and_treehash.py +++ b/flax/wallet/util/curry_and_treehash.py @@ -3,7 +3,7 @@ from hashlib import sha256 from typing import Callable, List -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sized_bytes import bytes32 CurryHashFunction = Callable[..., bytes32] diff --git a/chia/wallet/util/debug_spend_bundle.py b/flax/wallet/util/debug_spend_bundle.py similarity index 95% rename from chia/wallet/util/debug_spend_bundle.py rename to flax/wallet/util/debug_spend_bundle.py index cf31b3b81..0577f0faf 100644 --- a/chia/wallet/util/debug_spend_bundle.py +++ b/flax/wallet/util/debug_spend_bundle.py @@ -4,12 +4,12 @@ from clvm import KEYWORD_FROM_ATOM from clvm_tools.binutils import disassemble as bu_disassemble -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program, INFINITE_COST -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.condition_opcodes import ConditionOpcode -from chia.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict -from chia.util.hash import std_hash +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program, INFINITE_COST +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.condition_opcodes import ConditionOpcode +from flax.util.condition_tools import conditions_dict_for_solution, pkm_pairs_for_conditions_dict +from flax.util.hash import std_hash CONDITIONS = dict((k, bytes(v)[0]) for k, v in ConditionOpcode.__members__.items()) # pylint: disable=E1101 KFA = {v: k for k, v in CONDITIONS.items()} diff --git a/flax/wallet/util/json_clvm_utils.py b/flax/wallet/util/json_clvm_utils.py new file mode 100644 index 000000000..1ec023deb --- /dev/null +++ b/flax/wallet/util/json_clvm_utils.py @@ -0,0 +1,19 @@ +from __future__ import annotations + +from typing import Any + +from flax.types.blockchain_format.program import Program + + +def json_to_flaxlisp(json_data: Any) -> Any: + list_for_flaxlisp = [] + if isinstance(json_data, list): + for value in json_data: + list_for_flaxlisp.append(json_to_flaxlisp(value)) + else: + if isinstance(json_data, dict): + for key, value in json_data: + list_for_flaxlisp.append((key, json_to_flaxlisp(value))) + else: + list_for_flaxlisp = json_data + return Program.to(list_for_flaxlisp) diff --git a/chia/wallet/util/merkle_tree.py b/flax/wallet/util/merkle_tree.py similarity index 97% rename from chia/wallet/util/merkle_tree.py rename to flax/wallet/util/merkle_tree.py index d8905c708..eea00e752 100644 --- a/chia/wallet/util/merkle_tree.py +++ b/flax/wallet/util/merkle_tree.py @@ -6,8 +6,8 @@ from clvm.casts import int_to_bytes -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash ONE = int_to_bytes(1) TWO = int_to_bytes(2) diff --git a/chia/wallet/util/merkle_utils.py b/flax/wallet/util/merkle_utils.py similarity index 98% rename from chia/wallet/util/merkle_utils.py rename to flax/wallet/util/merkle_utils.py index 598ed52b9..24db4a969 100644 --- a/chia/wallet/util/merkle_utils.py +++ b/flax/wallet/util/merkle_utils.py @@ -3,7 +3,7 @@ import hashlib from typing import Any, Dict, List, Tuple -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sized_bytes import bytes32 TupleTree = Any # Union[bytes32, Tuple["TupleTree", "TupleTree"]] Proof_Tree_Type = Any # Union[bytes32, Tuple[bytes32, "Proof_Tree_Type"]] diff --git a/chia/wallet/util/new_peak_queue.py b/flax/wallet/util/new_peak_queue.py similarity index 93% rename from chia/wallet/util/new_peak_queue.py rename to flax/wallet/util/new_peak_queue.py index a6109dfd3..60aa063cc 100644 --- a/chia/wallet/util/new_peak_queue.py +++ b/flax/wallet/util/new_peak_queue.py @@ -5,9 +5,9 @@ from enum import IntEnum from typing import Any, List -from chia.protocols.wallet_protocol import CoinStateUpdate, NewPeakWallet -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.protocols.wallet_protocol import CoinStateUpdate, NewPeakWallet +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.sized_bytes import bytes32 class NewPeakQueueTypes(IntEnum): @@ -65,11 +65,11 @@ async def subscribe_to_puzzle_hashes(self, puzzle_hashes: List[bytes32]): self._pending_data_process_items += 1 await self._inner_queue.put(NewPeakItem(NewPeakQueueTypes.PUZZLE_HASH_SUBSCRIPTION, puzzle_hashes)) - async def full_node_state_updated(self, coin_state_update: CoinStateUpdate, peer: WSChiaConnection): + async def full_node_state_updated(self, coin_state_update: CoinStateUpdate, peer: WSFlaxConnection): self._pending_data_process_items += 1 await self._inner_queue.put(NewPeakItem(NewPeakQueueTypes.FULL_NODE_STATE_UPDATED, (coin_state_update, peer))) - async def new_peak_wallet(self, new_peak: NewPeakWallet, peer: WSChiaConnection): + async def new_peak_wallet(self, new_peak: NewPeakWallet, peer: WSFlaxConnection): await self._inner_queue.put(NewPeakItem(NewPeakQueueTypes.NEW_PEAK_WALLET, (new_peak, peer))) async def get(self) -> NewPeakItem: diff --git a/chia/wallet/util/notifications.py b/flax/wallet/util/notifications.py similarity index 51% rename from chia/wallet/util/notifications.py rename to flax/wallet/util/notifications.py index 5c93302be..c0401c2b8 100644 --- a/chia/wallet/util/notifications.py +++ b/flax/wallet/util/notifications.py @@ -1,9 +1,9 @@ from __future__ import annotations -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile NOTIFICATION_MOD = load_clvm_maybe_recompile("notification.clvm") diff --git a/chia/wallet/util/peer_request_cache.py b/flax/wallet/util/peer_request_cache.py similarity index 96% rename from chia/wallet/util/peer_request_cache.py rename to flax/wallet/util/peer_request_cache.py index 6440766f6..f006e8919 100644 --- a/chia/wallet/util/peer_request_cache.py +++ b/flax/wallet/util/peer_request_cache.py @@ -3,12 +3,12 @@ import asyncio from typing import Any, Optional, Tuple -from chia.protocols.wallet_protocol import CoinState -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.header_block import HeaderBlock -from chia.util.hash import std_hash -from chia.util.ints import uint32, uint64 -from chia.util.lru_cache import LRUCache +from flax.protocols.wallet_protocol import CoinState +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.header_block import HeaderBlock +from flax.util.hash import std_hash +from flax.util.ints import uint32, uint64 +from flax.util.lru_cache import LRUCache class PeerRequestCache: diff --git a/chia/wallet/util/puzzle_compression.py b/flax/wallet/util/puzzle_compression.py similarity index 95% rename from chia/wallet/util/puzzle_compression.py rename to flax/wallet/util/puzzle_compression.py index 1c48767a6..3b818d051 100644 --- a/chia/wallet/util/puzzle_compression.py +++ b/flax/wallet/util/puzzle_compression.py @@ -2,11 +2,11 @@ from typing import List -from chia.types.blockchain_format.program import Program -from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile -from chia.wallet.puzzles import p2_delegated_puzzle_or_hidden_puzzle as standard_puzzle -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.nft_wallet.nft_puzzles import ( +from flax.types.blockchain_format.program import Program +from flax.wallet.puzzles.load_clvm import load_clvm_maybe_recompile +from flax.wallet.puzzles import p2_delegated_puzzle_or_hidden_puzzle as standard_puzzle +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.nft_wallet.nft_puzzles import ( SINGLETON_TOP_LAYER_MOD, NFT_STATE_LAYER_MOD, NFT_OWNERSHIP_LAYER, diff --git a/chia/wallet/util/transaction_type.py b/flax/wallet/util/transaction_type.py similarity index 100% rename from chia/wallet/util/transaction_type.py rename to flax/wallet/util/transaction_type.py diff --git a/chia/wallet/util/wallet_sync_utils.py b/flax/wallet/util/wallet_sync_utils.py similarity index 93% rename from chia/wallet/util/wallet_sync_utils.py rename to flax/wallet/util/wallet_sync_utils.py index 2113b9c67..5d069acdb 100644 --- a/chia/wallet/util/wallet_sync_utils.py +++ b/flax/wallet/util/wallet_sync_utils.py @@ -1,15 +1,15 @@ import asyncio -from chia.protocols.shared_protocol import Capability +from flax.protocols.shared_protocol import Capability import logging import random from typing import List, Optional, Tuple, Union, Dict from chia_rs import compute_merkle_set_root -from chia.consensus.constants import ConsensusConstants -from chia.protocols import wallet_protocol -from chia.protocols.wallet_protocol import ( +from flax.consensus.constants import ConsensusConstants +from flax.protocols import wallet_protocol +from flax.protocols.wallet_protocol import ( RequestAdditions, RequestBlockHeaders, RespondAdditions, @@ -26,14 +26,14 @@ RejectHeaderBlocks, RejectBlockHeaders, ) -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.coin import hash_coin_ids, Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.types.header_block import HeaderBlock -from chia.util.ints import uint32 -from chia.util.merkle_set import confirm_not_included_already_hashed, confirm_included_already_hashed, MerkleSet -from chia.wallet.util.peer_request_cache import PeerRequestCache +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.coin import hash_coin_ids, Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.types.header_block import HeaderBlock +from flax.util.ints import uint32 +from flax.util.merkle_set import confirm_not_included_already_hashed, confirm_included_already_hashed, MerkleSet +from flax.wallet.util.peer_request_cache import PeerRequestCache log = logging.getLogger(__name__) @@ -42,7 +42,7 @@ class PeerRequestException(Exception): pass -async def fetch_last_tx_from_peer(height: uint32, peer: WSChiaConnection) -> Optional[HeaderBlock]: +async def fetch_last_tx_from_peer(height: uint32, peer: WSFlaxConnection) -> Optional[HeaderBlock]: request_height: int = height while True: if request_height == -1: @@ -62,7 +62,7 @@ async def fetch_last_tx_from_peer(height: uint32, peer: WSChiaConnection) -> Opt async def subscribe_to_phs( puzzle_hashes: List[bytes32], - peer: WSChiaConnection, + peer: WSFlaxConnection, min_height: int, ) -> List[CoinState]: """ @@ -77,7 +77,7 @@ async def subscribe_to_phs( async def subscribe_to_coin_updates( coin_names: List[bytes32], - peer: WSChiaConnection, + peer: WSFlaxConnection, min_height: int, ) -> List[CoinState]: """ @@ -203,7 +203,7 @@ def validate_removals( async def request_and_validate_removals( - peer: WSChiaConnection, height: uint32, header_hash: bytes32, coin_name: bytes32, removals_root: bytes32 + peer: WSFlaxConnection, height: uint32, header_hash: bytes32, coin_name: bytes32, removals_root: bytes32 ) -> bool: removals_request = RequestRemovals(height, header_hash, [coin_name]) @@ -217,7 +217,7 @@ async def request_and_validate_removals( async def request_and_validate_additions( - peer: WSChiaConnection, + peer: WSFlaxConnection, peer_request_cache: PeerRequestCache, height: uint32, header_hash: bytes32, @@ -325,7 +325,7 @@ def get_block_header(block): async def request_header_blocks( - peer: WSChiaConnection, start_height: uint32, end_height: uint32 + peer: WSFlaxConnection, start_height: uint32, end_height: uint32 ) -> Optional[List[HeaderBlock]]: if Capability.BLOCK_HEADERS in peer.peer_capabilities: response = await peer.request_block_headers(RequestBlockHeaders(start_height, end_height, False)) @@ -337,7 +337,7 @@ async def request_header_blocks( async def _fetch_header_blocks_inner( - all_peers: List[Tuple[WSChiaConnection, bool]], + all_peers: List[Tuple[WSFlaxConnection, bool]], request_start: uint32, request_end: uint32, ) -> Optional[Union[RespondHeaderBlocks, RespondBlockHeaders]]: @@ -369,7 +369,7 @@ async def fetch_header_blocks_in_range( start: uint32, end: uint32, peer_request_cache: PeerRequestCache, - all_peers: List[Tuple[WSChiaConnection, bool]], + all_peers: List[Tuple[WSFlaxConnection, bool]], ) -> Optional[List[HeaderBlock]]: blocks: List[HeaderBlock] = [] for i in range(start - (start % 32), end + 1, 32): diff --git a/chia/wallet/util/wallet_types.py b/flax/wallet/util/wallet_types.py similarity index 84% rename from chia/wallet/util/wallet_types.py rename to flax/wallet/util/wallet_types.py index 23f3e36ca..9813fbbab 100644 --- a/chia/wallet/util/wallet_types.py +++ b/flax/wallet/util/wallet_types.py @@ -5,8 +5,8 @@ from typing_extensions import TypedDict -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 class WalletType(IntEnum): diff --git a/chia/wallet/wallet.py b/flax/wallet/wallet.py similarity index 92% rename from chia/wallet/wallet.py rename to flax/wallet/wallet.py index f872810a5..85130e042 100644 --- a/chia/wallet/wallet.py +++ b/flax/wallet/wallet.py @@ -5,28 +5,28 @@ from blspy import G1Element, G2Element, AugSchemeMPL -from chia.consensus.cost_calculator import NPCResult -from chia.full_node.bundle_tools import simple_solution_generator -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.generator_types import BlockGenerator -from chia.types.spend_bundle import SpendBundle -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.wallet.coin_selection import select_coins -from chia.wallet.derivation_record import DerivationRecord -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( +from flax.consensus.cost_calculator import NPCResult +from flax.full_node.bundle_tools import simple_solution_generator +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.generator_types import BlockGenerator +from flax.types.spend_bundle import SpendBundle +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.wallet.coin_selection import select_coins +from flax.wallet.derivation_record import DerivationRecord +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( DEFAULT_HIDDEN_PUZZLE_HASH, calculate_synthetic_secret_key, puzzle_for_pk, puzzle_hash_for_pk, solution_for_conditions, ) -from chia.wallet.puzzles.puzzle_utils import ( +from flax.wallet.puzzles.puzzle_utils import ( make_assert_absolute_seconds_exceeds_condition, make_assert_coin_announcement, make_assert_my_coin_id_condition, @@ -36,17 +36,17 @@ make_create_puzzle_announcement, make_reserve_fee_condition, ) -from chia.wallet.secret_key_store import SecretKeyStore -from chia.wallet.sign_coin_spends import sign_coin_spends -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_info import WalletInfo +from flax.wallet.secret_key_store import SecretKeyStore +from flax.wallet.sign_coin_spends import sign_coin_spends +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_types import AmountWithPuzzlehash, WalletType +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_info import WalletInfo if TYPE_CHECKING: - from chia.server.ws_connection import WSChiaConnection + from flax.server.ws_connection import WSFlaxConnection class Wallet: @@ -436,7 +436,7 @@ async def sign_message(self, message: str, puzzle_hash: bytes32) -> Tuple[G1Elem pubkey, private = await self.wallet_state_manager.get_keys(puzzle_hash) synthetic_secret_key = calculate_synthetic_secret_key(private, DEFAULT_HIDDEN_PUZZLE_HASH) synthetic_pk = synthetic_secret_key.get_g1() - puzzle: Program = Program.to(("Chia Signed Message", message)) + puzzle: Program = Program.to(("Flax Signed Message", message)) return synthetic_pk, AugSchemeMPL.sign(synthetic_secret_key, puzzle.get_tree_hash()) async def generate_signed_transaction( @@ -527,14 +527,14 @@ async def push_transaction(self, tx: TransactionRecord) -> None: await self.wallet_state_manager.wallet_node.update_ui() # This is to be aggregated together with a CAT offer to ensure that the trade happens - async def create_spend_bundle_relative_chia(self, chia_amount: int, exclude: List[Coin] = []) -> SpendBundle: + async def create_spend_bundle_relative_flax(self, flax_amount: int, exclude: List[Coin] = []) -> SpendBundle: list_of_solutions = [] utxos = None # If we're losing value then get coins with at least that much value # If we're gaining value then our amount doesn't matter - if chia_amount < 0: - utxos = await self.select_coins(uint64(abs(chia_amount)), exclude) + if flax_amount < 0: + utxos = await self.select_coins(uint64(abs(flax_amount)), exclude) else: utxos = await self.select_coins(uint64(0), exclude) @@ -542,7 +542,7 @@ async def create_spend_bundle_relative_chia(self, chia_amount: int, exclude: Lis # Calculate output amount given sum of utxos spend_value = sum([coin.amount for coin in utxos]) - chia_amount = spend_value + chia_amount + flax_amount = spend_value + flax_amount # Create coin solutions for each utxo output_created = None @@ -551,7 +551,7 @@ async def create_spend_bundle_relative_chia(self, chia_amount: int, exclude: Lis if output_created is None: newpuzhash = await self.get_new_puzzlehash() primaries: List[AmountWithPuzzlehash] = [ - {"puzzlehash": newpuzhash, "amount": uint64(chia_amount), "memos": []} + {"puzzlehash": newpuzhash, "amount": uint64(flax_amount), "memos": []} ] solution = self.make_solution(primaries=primaries) output_created = coin @@ -576,14 +576,14 @@ async def get_coins_to_offer( raise Exception(f"insufficient funds in wallet {self.id()}") return await self.select_coins(amount, min_coin_amount=min_coin_amount) - # WSChiaConnection is only imported for type checking + # WSFlaxConnection is only imported for type checking async def coin_added( - self, coin: Coin, height: uint32, peer: WSChiaConnection + self, coin: Coin, height: uint32, peer: WSFlaxConnection ) -> None: # pylint: disable=used-before-assignment pass if TYPE_CHECKING: - from chia.wallet.wallet_protocol import WalletProtocol + from flax.wallet.wallet_protocol import WalletProtocol _dummy: WalletProtocol = Wallet() diff --git a/chia/wallet/wallet_action.py b/flax/wallet/wallet_action.py similarity index 93% rename from chia/wallet/wallet_action.py rename to flax/wallet/wallet_action.py index cf6e3bf12..7b7767ba5 100644 --- a/chia/wallet/wallet_action.py +++ b/flax/wallet/wallet_action.py @@ -3,8 +3,8 @@ from dataclasses import dataclass from typing import Optional -from chia.util.ints import uint32 -from chia.wallet.util.wallet_types import WalletType +from flax.util.ints import uint32 +from flax.wallet.util.wallet_types import WalletType @dataclass(frozen=True) diff --git a/chia/wallet/wallet_blockchain.py b/flax/wallet/wallet_blockchain.py similarity index 92% rename from chia/wallet/wallet_blockchain.py rename to flax/wallet/wallet_blockchain.py index 3a9d9a40f..9cf8463fa 100644 --- a/chia/wallet/wallet_blockchain.py +++ b/flax/wallet/wallet_blockchain.py @@ -1,19 +1,19 @@ import logging from typing import Dict, Optional, Tuple, List -from chia.consensus.block_header_validation import validate_finished_header_block -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain import ReceiveBlockResult -from chia.consensus.blockchain_interface import BlockchainInterface -from chia.consensus.constants import ConsensusConstants -from chia.consensus.find_fork_point import find_fork_point_in_chain -from chia.consensus.full_block_to_block_record import block_to_block_record -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.header_block import HeaderBlock -from chia.types.weight_proof import WeightProof -from chia.util.errors import Err -from chia.util.ints import uint32, uint64 -from chia.wallet.key_val_store import KeyValStore -from chia.wallet.wallet_weight_proof_handler import WalletWeightProofHandler +from flax.consensus.block_header_validation import validate_finished_header_block +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain import ReceiveBlockResult +from flax.consensus.blockchain_interface import BlockchainInterface +from flax.consensus.constants import ConsensusConstants +from flax.consensus.find_fork_point import find_fork_point_in_chain +from flax.consensus.full_block_to_block_record import block_to_block_record +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.header_block import HeaderBlock +from flax.types.weight_proof import WeightProof +from flax.util.errors import Err +from flax.util.ints import uint32, uint64 +from flax.wallet.key_val_store import KeyValStore +from flax.wallet.wallet_weight_proof_handler import WalletWeightProofHandler log = logging.getLogger(__name__) diff --git a/chia/wallet/wallet_coin_record.py b/flax/wallet/wallet_coin_record.py similarity index 70% rename from chia/wallet/wallet_coin_record.py rename to flax/wallet/wallet_coin_record.py index ec076ffe1..61196c489 100644 --- a/chia/wallet/wallet_coin_record.py +++ b/flax/wallet/wallet_coin_record.py @@ -2,10 +2,10 @@ from dataclasses import dataclass -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 -from chia.wallet.util.wallet_types import WalletType +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 +from flax.wallet.util.wallet_types import WalletType @dataclass(frozen=True) diff --git a/chia/wallet/wallet_coin_store.py b/flax/wallet/wallet_coin_store.py similarity index 96% rename from chia/wallet/wallet_coin_store.py rename to flax/wallet/wallet_coin_store.py index 2850f80bd..1986bedfd 100644 --- a/chia/wallet/wallet_coin_store.py +++ b/flax/wallet/wallet_coin_store.py @@ -2,12 +2,12 @@ import sqlite3 -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2, execute_fetchone -from chia.util.ints import uint32, uint64 -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet_coin_record import WalletCoinRecord +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2, execute_fetchone +from flax.util.ints import uint32, uint64 +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet_coin_record import WalletCoinRecord class WalletCoinStore: diff --git a/chia/wallet/wallet_info.py b/flax/wallet/wallet_info.py similarity index 91% rename from chia/wallet/wallet_info.py rename to flax/wallet/wallet_info.py index 7cb1fb9f4..ecd653523 100644 --- a/chia/wallet/wallet_info.py +++ b/flax/wallet/wallet_info.py @@ -3,8 +3,8 @@ from dataclasses import dataclass from typing import List -from chia.util.ints import uint8, uint32 -from chia.util.streamable import Streamable, streamable +from flax.util.ints import uint8, uint32 +from flax.util.streamable import Streamable, streamable @streamable diff --git a/chia/wallet/wallet_interested_store.py b/flax/wallet/wallet_interested_store.py similarity index 97% rename from chia/wallet/wallet_interested_store.py rename to flax/wallet/wallet_interested_store.py index 233091341..3eacaa8de 100644 --- a/chia/wallet/wallet_interested_store.py +++ b/flax/wallet/wallet_interested_store.py @@ -1,8 +1,8 @@ from typing import List, Tuple, Optional -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint32 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint32 class WalletInterestedStore: diff --git a/chia/wallet/wallet_nft_store.py b/flax/wallet/wallet_nft_store.py similarity index 96% rename from chia/wallet/wallet_nft_store.py rename to flax/wallet/wallet_nft_store.py index 9fd1dba68..2ec795eb4 100644 --- a/chia/wallet/wallet_nft_store.py +++ b/flax/wallet/wallet_nft_store.py @@ -5,13 +5,13 @@ from sqlite3 import Row from typing import List, Optional, Type, TypeVar, Union -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2, execute_fetchone -from chia.util.ints import uint32 -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.nft_wallet.nft_info import DEFAULT_STATUS, IN_TRANSACTION_STATUS, NFTCoinInfo +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2, execute_fetchone +from flax.util.ints import uint32 +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.nft_wallet.nft_info import DEFAULT_STATUS, IN_TRANSACTION_STATUS, NFTCoinInfo log = logging.getLogger(__name__) _T_WalletNftStore = TypeVar("_T_WalletNftStore", bound="WalletNftStore") diff --git a/chia/wallet/wallet_node.py b/flax/wallet/wallet_node.py similarity index 95% rename from chia/wallet/wallet_node.py rename to flax/wallet/wallet_node.py index 2c080dbb3..b05c2f607 100644 --- a/chia/wallet/wallet_node.py +++ b/flax/wallet/wallet_node.py @@ -12,49 +12,49 @@ from blspy import AugSchemeMPL, PrivateKey, G2Element, G1Element from packaging.version import Version -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain import ReceiveBlockResult -from chia.consensus.constants import ConsensusConstants -from chia.daemon.keychain_proxy import ( +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain import ReceiveBlockResult +from flax.consensus.constants import ConsensusConstants +from flax.daemon.keychain_proxy import ( KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain, ) -from chia.protocols import wallet_protocol -from chia.protocols.full_node_protocol import RequestProofOfWeight, RespondProofOfWeight -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.wallet_protocol import ( +from flax.protocols import wallet_protocol +from flax.protocols.full_node_protocol import RequestProofOfWeight, RespondProofOfWeight +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.wallet_protocol import ( CoinState, RespondBlockHeader, RespondToCoinUpdates, RespondToPhUpdates, ) -from chia.rpc.rpc_server import default_get_connections -from chia.server.node_discovery import WalletPeers -from chia.server.outbound_message import Message, NodeType, make_msg -from chia.server.peer_store_resolver import PeerStoreResolver -from chia.server.server import ChiaServer -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.coin_spend import CoinSpend -from chia.types.header_block import HeaderBlock -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.peer_info import PeerInfo -from chia.types.weight_proof import WeightProof -from chia.util.chunks import chunks -from chia.util.config import WALLET_PEERS_PATH_KEY_DEPRECATED, process_config_start_method -from chia.util.errors import KeychainIsLocked, KeychainProxyConnectionFailure, KeychainIsEmpty, KeychainKeyNotFound -from chia.util.ints import uint32, uint64 -from chia.util.keychain import Keychain -from chia.util.path import path_from_root -from chia.util.profiler import profile_task -from chia.util.memory_profiler import mem_profile_task -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.new_peak_queue import NewPeakItem, NewPeakQueue, NewPeakQueueTypes -from chia.wallet.util.peer_request_cache import PeerRequestCache, can_use_peer_request_cache -from chia.wallet.util.wallet_sync_utils import ( +from flax.rpc.rpc_server import default_get_connections +from flax.server.node_discovery import WalletPeers +from flax.server.outbound_message import Message, NodeType, make_msg +from flax.server.peer_store_resolver import PeerStoreResolver +from flax.server.server import FlaxServer +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.coin_spend import CoinSpend +from flax.types.header_block import HeaderBlock +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.peer_info import PeerInfo +from flax.types.weight_proof import WeightProof +from flax.util.chunks import chunks +from flax.util.config import WALLET_PEERS_PATH_KEY_DEPRECATED, process_config_start_method +from flax.util.errors import KeychainIsLocked, KeychainProxyConnectionFailure, KeychainIsEmpty, KeychainKeyNotFound +from flax.util.ints import uint32, uint64 +from flax.util.keychain import Keychain +from flax.util.path import path_from_root +from flax.util.profiler import profile_task +from flax.util.memory_profiler import mem_profile_task +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.new_peak_queue import NewPeakItem, NewPeakQueue, NewPeakQueueTypes +from flax.wallet.util.peer_request_cache import PeerRequestCache, can_use_peer_request_cache +from flax.wallet.util.wallet_sync_utils import ( fetch_header_blocks_in_range, fetch_last_tx_from_peer, last_change_height_cs, @@ -65,8 +65,8 @@ subscribe_to_coin_updates, subscribe_to_phs, ) -from chia.wallet.wallet_state_manager import WalletStateManager -from chia.wallet.wallet_weight_proof_handler import get_wp_fork_point, WalletWeightProofHandler +from flax.wallet.wallet_state_manager import WalletStateManager +from flax.wallet.wallet_weight_proof_handler import get_wp_fork_point, WalletWeightProofHandler def get_wallet_db_path(root_path: Path, config: Dict[str, Any], key_fingerprint: str) -> Path: @@ -104,7 +104,7 @@ class WalletNode: state_changed_callback: Optional[Callable] = None _wallet_state_manager: Optional[WalletStateManager] = None _weight_proof_handler: Optional[WalletWeightProofHandler] = None - _server: Optional[ChiaServer] = None + _server: Optional[FlaxServer] = None wsm_close_task: Optional[asyncio.Task] = None sync_task: Optional[asyncio.Task] = None logged_in_fingerprint: Optional[int] = None @@ -156,7 +156,7 @@ def wallet_state_manager(self) -> WalletStateManager: return self._wallet_state_manager @property - def server(self) -> ChiaServer: + def server(self) -> FlaxServer: # This is a stop gap until the class usage is refactored such the values of # integral attributes are known at creation of the instance. if self._server is None: @@ -202,7 +202,7 @@ async def get_key_for_fingerprint(self, fingerprint: Optional[int]) -> Optional[ # Returns first private key if fingerprint is None key = await keychain_proxy.get_key_for_fingerprint(fingerprint) except KeychainIsEmpty: - self.log.warning("No keys present. Create keys with the UI, or with the 'chia keys' program.") + self.log.warning("No keys present. Create keys with the UI, or with the 'flax keys' program.") return None except KeychainKeyNotFound: self.log.warning(f"Key not found for fingerprint {fingerprint}") @@ -437,7 +437,7 @@ async def _process_new_subscriptions(self): while not self._shut_down: # Here we process four types of messages in the queue, where the first one has higher priority (lower # number in the queue), and priority decreases for each type. - peer: Optional[WSChiaConnection] = None + peer: Optional[WSFlaxConnection] = None item: Optional[NewPeakItem] = None try: peer, item = None, None @@ -523,7 +523,7 @@ def get_last_used_fingerprint_path(self) -> Path: fingerprint_path = db_path.parent / "last_used_fingerprint" return fingerprint_path - def set_server(self, server: ChiaServer): + def set_server(self, server: FlaxServer): self._server = server self.initialize_wallet_peers() @@ -546,7 +546,7 @@ def initialize_wallet_peers(self): default_peers_file_path="wallet/db/wallet_peers.dat", ), self.config["introducer_peer"], - self.config.get("dns_servers", ["dns-introducer.chia.net"]), + self.config.get("dns_servers", ["dns-introducer.flaxnetwork.org"]), self.config["peer_connect_interval"], network_name, None, @@ -554,7 +554,7 @@ def initialize_wallet_peers(self): ) asyncio.create_task(self.wallet_peers.start()) - def on_disconnect(self, peer: WSChiaConnection): + def on_disconnect(self, peer: WSFlaxConnection): if self.is_trusted(peer): self.local_node_synced = False self.initialize_wallet_peers() @@ -566,7 +566,7 @@ def on_disconnect(self, peer: WSChiaConnection): if peer.peer_node_id in self.node_peaks: self.node_peaks.pop(peer.peer_node_id) - async def on_connect(self, peer: WSChiaConnection): + async def on_connect(self, peer: WSFlaxConnection): if self._wallet_state_manager is None: return None @@ -621,7 +621,7 @@ async def perform_atomic_rollback(self, fork_height: int, cache: Optional[PeerRe async def long_sync( self, target_height: uint32, - full_node: WSChiaConnection, + full_node: WSFlaxConnection, fork_height: int, *, rollback: bool, @@ -723,7 +723,7 @@ def is_new_state_update(cs: CoinState) -> bool: async def receive_state_from_peer( self, items_input: List[CoinState], - peer: WSChiaConnection, + peer: WSFlaxConnection, fork_height: Optional[uint32] = None, height: Optional[uint32] = None, header_hash: Optional[bytes32] = None, @@ -877,7 +877,7 @@ async def get_coins_with_puzzle_hash(self, puzzle_hash) -> List[CoinState]: return coin_state.coin_states async def is_peer_synced( - self, peer: WSChiaConnection, header_block: HeaderBlock, request_time: uint64 + self, peer: WSFlaxConnection, header_block: HeaderBlock, request_time: uint64 ) -> Optional[uint64]: # Get last timestamp last_tx: Optional[HeaderBlock] = await fetch_last_tx_from_peer(header_block.height, peer) @@ -908,7 +908,7 @@ def add_state_to_race_cache(self, header_hash: bytes32, height: uint32, coin_sta self.race_cache[header_hash] = set() self.race_cache[header_hash].add(coin_state) - async def state_update_received(self, request: wallet_protocol.CoinStateUpdate, peer: WSChiaConnection) -> None: + async def state_update_received(self, request: wallet_protocol.CoinStateUpdate, peer: WSFlaxConnection) -> None: # This gets called every time there is a new coin or puzzle hash change in the DB # that is of interest to this wallet. It is not guaranteed to come for every height. This message is guaranteed # to come before the corresponding new_peak for each height. We handle this differently for trusted and @@ -925,16 +925,16 @@ async def state_update_received(self, request: wallet_protocol.CoinStateUpdate, request.peak_hash, ) - def get_full_node_peer(self) -> Optional[WSChiaConnection]: + def get_full_node_peer(self) -> Optional[WSFlaxConnection]: """ Get a full node, preferring synced & trusted > synced & untrusted > unsynced & trusted > unsynced & untrusted """ - full_nodes: List[WSChiaConnection] = self.get_full_node_peers_in_order() + full_nodes: List[WSFlaxConnection] = self.get_full_node_peers_in_order() if len(full_nodes) == 0: return None return full_nodes[0] - def get_full_node_peers_in_order(self) -> List[WSChiaConnection]: + def get_full_node_peers_in_order(self) -> List[WSFlaxConnection]: """ Get all full nodes sorted: preferring synced & trusted > synced & untrusted > unsynced & trusted > unsynced & untrusted @@ -942,11 +942,11 @@ def get_full_node_peers_in_order(self) -> List[WSChiaConnection]: if self._server is None: return [] - synced_and_trusted: List[WSChiaConnection] = [] - synced: List[WSChiaConnection] = [] - trusted: List[WSChiaConnection] = [] - neither: List[WSChiaConnection] = [] - all_nodes: List[WSChiaConnection] = self.server.get_connections(NodeType.FULL_NODE) + synced_and_trusted: List[WSFlaxConnection] = [] + synced: List[WSFlaxConnection] = [] + trusted: List[WSFlaxConnection] = [] + neither: List[WSFlaxConnection] = [] + all_nodes: List[WSFlaxConnection] = self.server.get_connections(NodeType.FULL_NODE) random.shuffle(all_nodes) for node in all_nodes: we_synced_to_it = node.peer_node_id in self.synced_peers @@ -997,7 +997,7 @@ async def get_timestamp_for_height(self, height: uint32) -> uint64: if cache_ts is not None: return cache_ts - peers: List[WSChiaConnection] = self.get_full_node_peers_in_order() + peers: List[WSFlaxConnection] = self.get_full_node_peers_in_order() last_tx_block: Optional[HeaderBlock] = None for peer in peers: last_tx_block = await fetch_last_tx_from_peer(height, peer) @@ -1010,7 +1010,7 @@ async def get_timestamp_for_height(self, height: uint32) -> uint64: raise PeerRequestException("Error fetching timestamp from all peers") - async def new_peak_wallet(self, new_peak: wallet_protocol.NewPeakWallet, peer: WSChiaConnection): + async def new_peak_wallet(self, new_peak: wallet_protocol.NewPeakWallet, peer: WSFlaxConnection): if self._wallet_state_manager is None: # When logging out of wallet return @@ -1203,7 +1203,7 @@ async def new_peak_wallet(self, new_peak: wallet_protocol.NewPeakWallet, peer: W async with self.wallet_state_manager.lock: await self.wallet_state_manager.new_peak(new_peak) - async def wallet_short_sync_backtrack(self, header_block: HeaderBlock, peer: WSChiaConnection) -> int: + async def wallet_short_sync_backtrack(self, header_block: HeaderBlock, peer: WSFlaxConnection) -> int: peak: Optional[HeaderBlock] = await self.wallet_state_manager.blockchain.get_peak_block() top = header_block @@ -1249,7 +1249,7 @@ async def update_ui(self): self.wallet_state_manager.state_changed("coin_added", wallet_id) async def fetch_and_validate_the_weight_proof( - self, peer: WSChiaConnection, peak: HeaderBlock + self, peer: WSFlaxConnection, peak: HeaderBlock ) -> Tuple[bool, Optional[WeightProof], List[SubEpochSummary], List[BlockRecord]]: assert self._weight_proof_handler is not None @@ -1308,7 +1308,7 @@ async def get_coin_ids_to_subscribe(self, min_height: int) -> List[bytes32]: async def validate_received_state_from_peer( self, coin_state: CoinState, - peer: WSChiaConnection, + peer: WSFlaxConnection, peer_request_cache: PeerRequestCache, fork_height: Optional[uint32], ) -> bool: @@ -1451,7 +1451,7 @@ async def validate_received_state_from_peer( return True async def validate_block_inclusion( - self, block: HeaderBlock, peer: WSChiaConnection, peer_request_cache: PeerRequestCache + self, block: HeaderBlock, peer: WSFlaxConnection, peer_request_cache: PeerRequestCache ) -> bool: if self.wallet_state_manager.blockchain.contains_height(block.height): stored_hash = self.wallet_state_manager.blockchain.height_to_hash(block.height) @@ -1601,7 +1601,7 @@ async def validate_block_inclusion( peer_request_cache.add_to_blocks_validated(reward_chain_hash, height) return True - async def fetch_puzzle_solution(self, height: uint32, coin: Coin, peer: WSChiaConnection) -> CoinSpend: + async def fetch_puzzle_solution(self, height: uint32, coin: Coin, peer: WSFlaxConnection) -> CoinSpend: solution_response = await peer.request_puzzle_solution( wallet_protocol.RequestPuzzleSolution(coin.name(), height) ) @@ -1617,7 +1617,7 @@ async def fetch_puzzle_solution(self, height: uint32, coin: Coin, peer: WSChiaCo ) async def get_coin_state( - self, coin_names: List[bytes32], peer: WSChiaConnection, fork_height: Optional[uint32] = None + self, coin_names: List[bytes32], peer: WSFlaxConnection, fork_height: Optional[uint32] = None ) -> List[CoinState]: msg = wallet_protocol.RegisterForCoinUpdates(coin_names, uint32(0)) coin_state: Optional[RespondToCoinUpdates] = await peer.register_interest_in_coin(msg) @@ -1637,7 +1637,7 @@ async def get_coin_state( return coin_state.coin_states async def fetch_children( - self, coin_name: bytes32, peer: WSChiaConnection, fork_height: Optional[uint32] = None + self, coin_name: bytes32, peer: WSFlaxConnection, fork_height: Optional[uint32] = None ) -> List[CoinState]: response: Optional[wallet_protocol.RespondChildren] = await peer.request_children( diff --git a/chia/wallet/wallet_node_api.py b/flax/wallet/wallet_node_api.py similarity index 89% rename from chia/wallet/wallet_node_api.py rename to flax/wallet/wallet_node_api.py index 2666ea545..1b6c41e34 100644 --- a/chia/wallet/wallet_node_api.py +++ b/flax/wallet/wallet_node_api.py @@ -1,10 +1,10 @@ -from chia.protocols import full_node_protocol, introducer_protocol, wallet_protocol -from chia.server.outbound_message import NodeType -from chia.server.ws_connection import WSChiaConnection -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.util.api_decorators import api_request, peer_required, execute_task -from chia.util.errors import Err -from chia.wallet.wallet_node import WalletNode +from flax.protocols import full_node_protocol, introducer_protocol, wallet_protocol +from flax.server.outbound_message import NodeType +from flax.server.ws_connection import WSFlaxConnection +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.util.api_decorators import api_request, peer_required, execute_task +from flax.util.errors import Err +from flax.wallet.wallet_node import WalletNode class WalletNodeAPI: @@ -23,10 +23,10 @@ def api_ready(self): @peer_required @api_request - async def respond_removals(self, response: wallet_protocol.RespondRemovals, peer: WSChiaConnection): + async def respond_removals(self, response: wallet_protocol.RespondRemovals, peer: WSFlaxConnection): pass - async def reject_removals_request(self, response: wallet_protocol.RejectRemovalsRequest, peer: WSChiaConnection): + async def reject_removals_request(self, response: wallet_protocol.RejectRemovalsRequest, peer: WSFlaxConnection): """ The full node has rejected our request for removals. """ @@ -42,7 +42,7 @@ async def reject_additions_request(self, response: wallet_protocol.RejectAdditio @execute_task @peer_required @api_request - async def new_peak_wallet(self, peak: wallet_protocol.NewPeakWallet, peer: WSChiaConnection): + async def new_peak_wallet(self, peak: wallet_protocol.NewPeakWallet, peer: WSFlaxConnection): """ The full node sent as a new peak """ @@ -62,7 +62,7 @@ async def respond_block_header(self, response: wallet_protocol.RespondBlockHeade @peer_required @api_request - async def respond_additions(self, response: wallet_protocol.RespondAdditions, peer: WSChiaConnection): + async def respond_additions(self, response: wallet_protocol.RespondAdditions, peer: WSFlaxConnection): pass @api_request @@ -71,7 +71,7 @@ async def respond_proof_of_weight(self, response: full_node_protocol.RespondProo @peer_required @api_request - async def transaction_ack(self, ack: wallet_protocol.TransactionAck, peer: WSChiaConnection): + async def transaction_ack(self, ack: wallet_protocol.TransactionAck, peer: WSFlaxConnection): """ This is an ack for our previous SendTransaction call. This removes the transaction from the send queue if we have sent it to enough nodes. @@ -107,7 +107,7 @@ async def transaction_ack(self, ack: wallet_protocol.TransactionAck, peer: WSChi @peer_required @api_request async def respond_peers_introducer( - self, request: introducer_protocol.RespondPeersIntroducer, peer: WSChiaConnection + self, request: introducer_protocol.RespondPeersIntroducer, peer: WSFlaxConnection ): if self.wallet_node.wallet_peers is not None: await self.wallet_node.wallet_peers.respond_peers(request, peer.get_peer_info(), False) @@ -117,7 +117,7 @@ async def respond_peers_introducer( @peer_required @api_request - async def respond_peers(self, request: full_node_protocol.RespondPeers, peer: WSChiaConnection): + async def respond_peers(self, request: full_node_protocol.RespondPeers, peer: WSFlaxConnection): if self.wallet_node.wallet_peers is None: return None @@ -154,7 +154,7 @@ async def reject_block_headers(self, request: wallet_protocol.RejectBlockHeaders @execute_task @peer_required @api_request - async def coin_state_update(self, request: wallet_protocol.CoinStateUpdate, peer: WSChiaConnection): + async def coin_state_update(self, request: wallet_protocol.CoinStateUpdate, peer: WSFlaxConnection): await self.wallet_node.new_peak_queue.full_node_state_updated(request, peer) @api_request diff --git a/chia/wallet/wallet_pool_store.py b/flax/wallet/wallet_pool_store.py similarity index 97% rename from chia/wallet/wallet_pool_store.py rename to flax/wallet/wallet_pool_store.py index 6df9f81c2..709e2972b 100644 --- a/chia/wallet/wallet_pool_store.py +++ b/flax/wallet/wallet_pool_store.py @@ -1,9 +1,9 @@ import logging from typing import List, Tuple -from chia.types.coin_spend import CoinSpend -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint32 +from flax.types.coin_spend import CoinSpend +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint32 log = logging.getLogger(__name__) diff --git a/chia/wallet/wallet_protocol.py b/flax/wallet/wallet_protocol.py similarity index 81% rename from chia/wallet/wallet_protocol.py rename to flax/wallet/wallet_protocol.py index 5594010f9..80be162a9 100644 --- a/chia/wallet/wallet_protocol.py +++ b/flax/wallet/wallet_protocol.py @@ -5,14 +5,14 @@ from blspy import G1Element from typing_extensions import Protocol -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.wallet.wallet_coin_record import WalletCoinRecord +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.wallet.wallet_coin_record import WalletCoinRecord if TYPE_CHECKING: - from chia.wallet.wallet_state_manager import WalletStateManager + from flax.wallet.wallet_state_manager import WalletStateManager class WalletProtocol(Protocol): @@ -25,7 +25,7 @@ def type(cls) -> uint8: def id(self) -> uint32: ... - async def coin_added(self, coin: Coin, height: uint32, peer: WSChiaConnection) -> None: + async def coin_added(self, coin: Coin, height: uint32, peer: WSFlaxConnection) -> None: ... async def select_coins( diff --git a/chia/wallet/wallet_puzzle_store.py b/flax/wallet/wallet_puzzle_store.py similarity index 97% rename from chia/wallet/wallet_puzzle_store.py rename to flax/wallet/wallet_puzzle_store.py index 6701754d7..265590e0d 100644 --- a/chia/wallet/wallet_puzzle_store.py +++ b/flax/wallet/wallet_puzzle_store.py @@ -6,12 +6,12 @@ from blspy import G1Element -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2, execute_fetchone -from chia.util.ints import uint32 -from chia.util.lru_cache import LRUCache -from chia.wallet.derivation_record import DerivationRecord -from chia.wallet.util.wallet_types import WalletType +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2, execute_fetchone +from flax.util.ints import uint32 +from flax.util.lru_cache import LRUCache +from flax.wallet.derivation_record import DerivationRecord +from flax.wallet.util.wallet_types import WalletType log = logging.getLogger(__name__) diff --git a/chia/wallet/wallet_retry_store.py b/flax/wallet/wallet_retry_store.py similarity index 93% rename from chia/wallet/wallet_retry_store.py rename to flax/wallet/wallet_retry_store.py index ea3b2f447..e269bca34 100644 --- a/chia/wallet/wallet_retry_store.py +++ b/flax/wallet/wallet_retry_store.py @@ -4,9 +4,9 @@ from chia_rs import CoinState -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint32 +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint32 class WalletRetryStore: diff --git a/chia/wallet/wallet_state_manager.py b/flax/wallet/wallet_state_manager.py similarity index 95% rename from chia/wallet/wallet_state_manager.py rename to flax/wallet/wallet_state_manager.py index 4f3baeae7..0eeaeef55 100644 --- a/chia/wallet/wallet_state_manager.py +++ b/flax/wallet/wallet_state_manager.py @@ -11,37 +11,37 @@ from blspy import G1Element, PrivateKey -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.consensus.coinbase import farmer_parent_id, pool_parent_id -from chia.consensus.constants import ConsensusConstants -from chia.data_layer.data_layer_wallet import DataLayerWallet -from chia.data_layer.dl_wallet_store import DataLayerStore -from chia.pools.pool_puzzles import SINGLETON_LAUNCHER_HASH, solution_to_pool_state -from chia.pools.pool_wallet import PoolWallet -from chia.protocols import wallet_protocol -from chia.protocols.wallet_protocol import CoinState -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer -from chia.server.ws_connection import WSChiaConnection -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.full_block import FullBlock -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.util.bech32m import encode_puzzle_hash -from chia.util.db_synchronous import db_synchronous_on -from chia.util.db_wrapper import DBWrapper2 -from chia.util.errors import Err -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.util.lru_cache import LRUCache -from chia.util.path import path_from_root -from chia.wallet.cat_wallet.cat_constants import DEFAULT_CATS -from chia.wallet.cat_wallet.cat_utils import construct_cat_puzzle, match_cat_puzzle -from chia.wallet.cat_wallet.cat_wallet import CATWallet -from chia.wallet.db_wallet.db_wallet_puzzles import MIRROR_PUZZLE_HASH -from chia.wallet.derivation_record import DerivationRecord -from chia.wallet.derive_keys import ( +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.consensus.coinbase import farmer_parent_id, pool_parent_id +from flax.consensus.constants import ConsensusConstants +from flax.data_layer.data_layer_wallet import DataLayerWallet +from flax.data_layer.dl_wallet_store import DataLayerStore +from flax.pools.pool_puzzles import SINGLETON_LAUNCHER_HASH, solution_to_pool_state +from flax.pools.pool_wallet import PoolWallet +from flax.protocols import wallet_protocol +from flax.protocols.wallet_protocol import CoinState +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer +from flax.server.ws_connection import WSFlaxConnection +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.full_block import FullBlock +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.util.bech32m import encode_puzzle_hash +from flax.util.db_synchronous import db_synchronous_on +from flax.util.db_wrapper import DBWrapper2 +from flax.util.errors import Err +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.util.lru_cache import LRUCache +from flax.util.path import path_from_root +from flax.wallet.cat_wallet.cat_constants import DEFAULT_CATS +from flax.wallet.cat_wallet.cat_utils import construct_cat_puzzle, match_cat_puzzle +from flax.wallet.cat_wallet.cat_wallet import CATWallet +from flax.wallet.db_wallet.db_wallet_puzzles import MIRROR_PUZZLE_HASH +from flax.wallet.derivation_record import DerivationRecord +from flax.wallet.derive_keys import ( master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened, master_sk_to_wallet_sk_intermediate, @@ -49,39 +49,39 @@ master_sk_to_wallet_sk_unhardened_intermediate, _derive_path_unhardened, ) -from chia.wallet.wallet_protocol import WalletProtocol -from chia.wallet.did_wallet.did_wallet import DIDWallet -from chia.wallet.did_wallet.did_wallet_puzzles import DID_INNERPUZ_MOD, create_fullpuz, match_did_puzzle -from chia.wallet.key_val_store import KeyValStore -from chia.wallet.nft_wallet.nft_info import NFTWalletInfo -from chia.wallet.nft_wallet.nft_puzzles import get_metadata_and_phs, get_new_owner_did -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT -from chia.wallet.notification_manager import NotificationManager -from chia.wallet.outer_puzzles import AssetType -from chia.wallet.puzzle_drivers import PuzzleInfo -from chia.wallet.puzzles.cat_loader import CAT_MOD, CAT_MOD_HASH -from chia.wallet.settings.user_settings import UserSettings -from chia.wallet.trade_manager import TradeManager -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.address_type import AddressType -from chia.wallet.util.compute_hints import compute_coin_hints -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_sync_utils import last_change_height_cs, PeerRequestException -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_blockchain import WalletBlockchain -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_coin_store import WalletCoinStore -from chia.wallet.wallet_info import WalletInfo -from chia.wallet.wallet_interested_store import WalletInterestedStore -from chia.wallet.wallet_nft_store import WalletNftStore -from chia.wallet.wallet_pool_store import WalletPoolStore -from chia.wallet.wallet_puzzle_store import WalletPuzzleStore -from chia.wallet.wallet_retry_store import WalletRetryStore -from chia.wallet.wallet_transaction_store import WalletTransactionStore -from chia.wallet.wallet_user_store import WalletUserStore -from chia.wallet.uncurried_puzzle import uncurry_puzzle +from flax.wallet.wallet_protocol import WalletProtocol +from flax.wallet.did_wallet.did_wallet import DIDWallet +from flax.wallet.did_wallet.did_wallet_puzzles import DID_INNERPUZ_MOD, create_fullpuz, match_did_puzzle +from flax.wallet.key_val_store import KeyValStore +from flax.wallet.nft_wallet.nft_info import NFTWalletInfo +from flax.wallet.nft_wallet.nft_puzzles import get_metadata_and_phs, get_new_owner_did +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.nft_wallet.uncurry_nft import UncurriedNFT +from flax.wallet.notification_manager import NotificationManager +from flax.wallet.outer_puzzles import AssetType +from flax.wallet.puzzle_drivers import PuzzleInfo +from flax.wallet.puzzles.cat_loader import CAT_MOD, CAT_MOD_HASH +from flax.wallet.settings.user_settings import UserSettings +from flax.wallet.trade_manager import TradeManager +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.address_type import AddressType +from flax.wallet.util.compute_hints import compute_coin_hints +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_sync_utils import last_change_height_cs, PeerRequestException +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_blockchain import WalletBlockchain +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_coin_store import WalletCoinStore +from flax.wallet.wallet_info import WalletInfo +from flax.wallet.wallet_interested_store import WalletInterestedStore +from flax.wallet.wallet_nft_store import WalletNftStore +from flax.wallet.wallet_pool_store import WalletPoolStore +from flax.wallet.wallet_puzzle_store import WalletPuzzleStore +from flax.wallet.wallet_retry_store import WalletRetryStore +from flax.wallet.wallet_transaction_store import WalletTransactionStore +from flax.wallet.wallet_user_store import WalletUserStore +from flax.wallet.uncurried_puzzle import uncurry_puzzle class WalletStateManager: @@ -124,7 +124,7 @@ class WalletStateManager: interested_store: WalletInterestedStore retry_store: WalletRetryStore multiprocessing_context: multiprocessing.context.BaseContext - server: ChiaServer + server: FlaxServer root_path: Path wallet_node: Any pool_store: WalletPoolStore @@ -139,7 +139,7 @@ async def create( config: Dict, db_path: Path, constants: ConsensusConstants, - server: ChiaServer, + server: FlaxServer, root_path: Path, wallet_node, name: str = None, @@ -163,7 +163,8 @@ async def create( database=db_path, reader_count=self.config.get("db_readers", 4), log_path=sql_log_path, - synchronous=db_synchronous_on(self.config.get("db_sync", "auto")), + # Never use pragma synchronous=OFF in Flax. + synchronous="FULL", ) self.initial_num_public_keys = config["initial_num_public_keys"] @@ -601,7 +602,7 @@ async def unconfirmed_removals_for_wallet(self, wallet_id: int) -> Dict[bytes32, return removals async def determine_coin_type( - self, peer: WSChiaConnection, coin_state: CoinState, fork_height: Optional[uint32] + self, peer: WSFlaxConnection, coin_state: CoinState, fork_height: Optional[uint32] ) -> Tuple[Optional[uint32], Optional[WalletType]]: if coin_state.created_height is not None and ( self.is_pool_reward(uint32(coin_state.created_height), coin_state.coin) @@ -650,14 +651,14 @@ async def determine_coin_type( return None, None async def filter_spam(self, new_coin_state: List[CoinState]) -> List[CoinState]: - xch_spam_amount = self.config.get("xch_spam_amount", 1000000) + xfx_spam_amount = self.config.get("xfx_spam_amount", 1000000) # No need to filter anything if the filter is set to 1 or 0 mojos - if xch_spam_amount <= 1: + if xfx_spam_amount <= 1: return new_coin_state spam_filter_after_n_txs = self.config.get("spam_filter_after_n_txs", 200) - small_unspent_count = await self.coin_store.count_small_unspent(xch_spam_amount) + small_unspent_count = await self.coin_store.count_small_unspent(xfx_spam_amount) # if small_unspent_count > spam_filter_after_n_txs: filtered_cs: List[CoinState] = [] @@ -668,7 +669,7 @@ async def filter_spam(self, new_coin_state: List[CoinState]) -> List[CoinState]: if ( cs.created_height is not None and cs.spent_height is None - and cs.coin.amount < xch_spam_amount + and cs.coin.amount < xfx_spam_amount and (cs.coin.puzzle_hash in is_standard_wallet_phs or await self.is_standard_wallet_tx(cs)) ): is_standard_wallet_phs.add(cs.coin.puzzle_hash) @@ -745,7 +746,7 @@ async def handle_did( parent_coin_state: CoinState, coin_state: CoinState, coin_spend: CoinSpend, - peer: WSChiaConnection, + peer: WSFlaxConnection, ) -> Tuple[Optional[uint32], Optional[WalletType]]: """ Handle the new coin when it is a DID @@ -817,7 +818,7 @@ async def handle_did( self.state_changed("wallet_created", wallet_id, {"did_id": did_wallet.get_my_DID()}) return wallet_id, wallet_type - async def get_minter_did(self, launcher_coin: Coin, peer: WSChiaConnection) -> Optional[bytes32]: + async def get_minter_did(self, launcher_coin: Coin, peer: WSFlaxConnection) -> Optional[bytes32]: # Get minter DID eve_coin = (await self.wallet_node.fetch_children(launcher_coin.name(), peer=peer))[0] eve_coin_spend: CoinSpend = await self.wallet_node.fetch_puzzle_solution( @@ -948,7 +949,7 @@ async def handle_nft( async def new_coin_state( self, coin_states: List[CoinState], - peer: WSChiaConnection, + peer: WSFlaxConnection, fork_height: Optional[uint32], ) -> None: # TODO: add comment about what this method does @@ -1395,7 +1396,7 @@ async def coin_added( all_unconfirmed_transaction_records: List[TransactionRecord], wallet_id: uint32, wallet_type: WalletType, - peer: WSChiaConnection, + peer: WSFlaxConnection, coin_name: bytes32, ) -> None: """ diff --git a/chia/wallet/wallet_transaction_store.py b/flax/wallet/wallet_transaction_store.py similarity index 97% rename from chia/wallet/wallet_transaction_store.py rename to flax/wallet/wallet_transaction_store.py index 6afe6a17c..57fc92889 100644 --- a/chia/wallet/wallet_transaction_store.py +++ b/flax/wallet/wallet_transaction_store.py @@ -4,14 +4,14 @@ import time from typing import Dict, List, Optional, Tuple -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.util.db_wrapper import DBWrapper2 -from chia.util.errors import Err -from chia.util.ints import uint8, uint32 -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.transaction_sorting import SortKey -from chia.wallet.util.transaction_type import TransactionType +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.util.db_wrapper import DBWrapper2 +from flax.util.errors import Err +from flax.util.ints import uint8, uint32 +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.transaction_sorting import SortKey +from flax.wallet.util.transaction_type import TransactionType def filter_ok_mempool_status(sent_to: List[Tuple[str, uint8, Optional[str]]]) -> List[Tuple[str, uint8, Optional[str]]]: diff --git a/chia/wallet/wallet_user_store.py b/flax/wallet/wallet_user_store.py similarity index 93% rename from chia/wallet/wallet_user_store.py rename to flax/wallet/wallet_user_store.py index 68a5df268..6e659181d 100644 --- a/chia/wallet/wallet_user_store.py +++ b/flax/wallet/wallet_user_store.py @@ -2,10 +2,10 @@ from typing import List, Optional -from chia.util.db_wrapper import DBWrapper2, execute_fetchone -from chia.util.ints import uint32 -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet_info import WalletInfo +from flax.util.db_wrapper import DBWrapper2, execute_fetchone +from flax.util.ints import uint32 +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet_info import WalletInfo class WalletUserStore: @@ -44,7 +44,7 @@ async def create(cls, db_wrapper: DBWrapper2): async def init_wallet(self): all_wallets = await self.get_all_wallet_info_entries() if len(all_wallets) == 0: - await self.create_wallet("Chia Wallet", WalletType.STANDARD_WALLET, "") + await self.create_wallet("Flax Wallet", WalletType.STANDARD_WALLET, "") async def create_wallet( self, diff --git a/chia/wallet/wallet_weight_proof_handler.py b/flax/wallet/wallet_weight_proof_handler.py similarity index 92% rename from chia/wallet/wallet_weight_proof_handler.py rename to flax/wallet/wallet_weight_proof_handler.py index af5b09777..d9f1b9bba 100644 --- a/chia/wallet/wallet_weight_proof_handler.py +++ b/flax/wallet/wallet_weight_proof_handler.py @@ -5,26 +5,26 @@ from multiprocessing.context import BaseContext from typing import IO, List, Tuple, Optional -from chia.consensus.block_record import BlockRecord -from chia.consensus.constants import ConsensusConstants -from chia.full_node.weight_proof import ( +from flax.consensus.block_record import BlockRecord +from flax.consensus.constants import ConsensusConstants +from flax.full_node.weight_proof import ( _validate_sub_epoch_summaries, validate_weight_proof_inner, ) -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.weight_proof import ( +from flax.types.weight_proof import ( WeightProof, ) -from chia.util.ints import uint32 -from chia.util.setproctitle import getproctitle, setproctitle +from flax.util.ints import uint32 +from flax.util.setproctitle import getproctitle, setproctitle log = logging.getLogger(__name__) def _create_shutdown_file() -> IO: - return tempfile.NamedTemporaryFile(prefix="chia_wallet_weight_proof_handler_executor_shutdown_trigger") + return tempfile.NamedTemporaryFile(prefix="flax_wallet_weight_proof_handler_executor_shutdown_trigger") class WalletWeightProofHandler: diff --git a/install-gui.sh b/install-gui.sh index 278d156ca..a5fc2360d 100755 --- a/install-gui.sh +++ b/install-gui.sh @@ -13,17 +13,17 @@ if [ "${SCRIPT_DIR}" != "$(pwd)" ]; then fi if [ -z "$VIRTUAL_ENV" ]; then - echo "This requires the chia python virtual environment." + echo "This requires the flax python virtual environment." echo "Execute '. ./activate' before running." exit 1 fi if [ "$(id -u)" = 0 ]; then - echo "The Chia Blockchain GUI can not be installed or run by the root user." + echo "The Flax Blockchain GUI can not be installed or run by the root user." exit 1 fi -# Allows overriding the branch or commit to build in chia-blockchain-gui +# Allows overriding the branch or commit to build in flax-blockchain-gui SUBMODULE_BRANCH=$1 nodejs_is_installed(){ @@ -57,12 +57,12 @@ do_install_npm_locally(){ cd "${NPM_GLOBAL}" if [ "$NPM_VERSION" -lt "6" ]; then # Ubuntu image of Amazon ec2 instance surprisingly uses nodejs@3.5.2 - # which doesn't support `npm ci` as of 27th Jan, 2022 + # which doesn't support `npm install` as of 27th Jan, 2022 echo "npm install" npm install else - echo "npm ci" - npm ci + echo "npm install" + npm install fi export N_PREFIX=${SCRIPT_DIR}/.n PATH="${N_PREFIX}/bin:$(npm bin):${PATH}" @@ -88,7 +88,7 @@ do_install_npm_locally(){ } # Work around for inconsistent `npm` exec path issue -# https://github.com/Chia-Network/chia-blockchain/pull/10460#issuecomment-1054492495 +# https://github.com/Flax-Network/flax-blockchain/pull/10460#issuecomment-1054492495 patch_inconsistent_npm_issue(){ node_module_dir=$1 if [ ! -d "$node_module_dir" ]; then @@ -182,7 +182,7 @@ if [ ! "$CI" ]; then echo "Running git submodule update." echo "" git submodule update - cd chia-blockchain-gui + cd flax-blockchain-gui if [ "$SUBMODULE_BRANCH" ]; then @@ -194,20 +194,20 @@ if [ ! "$CI" ]; then fi # Work around for inconsistent `npm` exec path issue - # https://github.com/Chia-Network/chia-blockchain/pull/10460#issuecomment-1054492495 + # https://github.com/Flax-Network/flax-blockchain/pull/10460#issuecomment-1054492495 patch_inconsistent_npm_issue "../node_modules" - npm ci + npm install npm audit fix || true npm run build - # Set modified output of `chia version` to version property of GUI's package.json + # Set modified output of `flax version` to version property of GUI's package.json python ../installhelper.py else echo "Skipping node.js in install.sh on MacOS ci." fi echo "" -echo "Chia blockchain install-gui.sh completed." +echo "Flax blockchain install-gui.sh completed." echo "" echo "Type 'bash start-gui.sh &' to start the GUI." diff --git a/install-plotter.sh b/install-plotter.sh index 2189c15c0..3a80dec0d 100755 --- a/install-plotter.sh +++ b/install-plotter.sh @@ -38,9 +38,9 @@ get_madmax_filename() { OS="$3" # "macos", others ARCH="$4" # "arm64", "x86-64" - CHIA_PLOT="chia_plot" + FLAX_PLOT="flax_plot" if [ "$KSIZE" = "k34" ]; then - CHIA_PLOT="chia_plot_k34" + FLAX_PLOT="flax_plot_k34" fi SUFFIX="" if [ "$OS" = "macos" ]; then @@ -54,7 +54,7 @@ get_madmax_filename() { SUFFIX="${ARCH}" fi - echo "${CHIA_PLOT}-${MADMAX_VER}-${SUFFIX}" + echo "${FLAX_PLOT}-${MADMAX_VER}-${SUFFIX}" } get_madmax_url() { @@ -100,7 +100,7 @@ if [ "${SCRIPT_DIR}" != "$(pwd)" ]; then fi if [ -z "$VIRTUAL_ENV" ]; then - echo "This requires the chia python virtual environment." + echo "This requires the flax python virtual environment." echo "Execute '. ./activate' before running." exit 1 fi @@ -178,9 +178,9 @@ elif [ "$PLOTTER" = "madmax" ]; then fi echo "Successfully downloaded: ${URL}" madmax_filename="$(get_madmax_filename "k32" "${VERSION}" "${OS}" "${ARCH}")" - mv -f "${madmax_filename}" chia_plot - chmod 755 chia_plot - echo "Successfully installed madmax to $(pwd)/chia_plot" + mv -f "${madmax_filename}" flax_plot + chmod 755 flax_plot + echo "Successfully installed madmax to $(pwd)/flax_plot" URL="$(get_madmax_url k34 "${VERSION}" "${OS}" "${ARCH}")" echo "Fetching binary from: ${URL}" @@ -190,9 +190,9 @@ elif [ "$PLOTTER" = "madmax" ]; then fi echo "Successfully downloaded: ${URL}" madmax_filename="$(get_madmax_filename "k34" "${VERSION}" "${OS}" "${ARCH}")" - mv -f "${madmax_filename}" chia_plot_k34 - chmod 755 chia_plot_k34 - echo "Successfully installed madmax for k34 to $(pwd)/chia_plot_k34" + mv -f "${madmax_filename}" flax_plot_k34 + chmod 755 flax_plot_k34 + echo "Successfully installed madmax for k34 to $(pwd)/flax_plot_k34" else usage fi diff --git a/install-timelord.sh b/install-timelord.sh old mode 100644 new mode 100755 index 9e0722f9c..e9bfca043 --- a/install-timelord.sh +++ b/install-timelord.sh @@ -26,7 +26,7 @@ do done if [ -z "$VIRTUAL_ENV" ]; then - echo "This requires the chia python virtual environment." + echo "This requires the flax python virtual environment." echo "Execute '. ./activate' before running." exit 1 fi @@ -44,7 +44,7 @@ fi export BUILD_VDF_BENCH=Y # Installs the useful vdf_bench test of CPU squaring speed THE_PATH=$(python -c 'import pkg_resources; print( pkg_resources.get_distribution("chiavdf").location)' 2>/dev/null)/vdf_client -CHIAVDF_VERSION=$(python -c 'import os; os.environ["CHIA_SKIP_SETUP"] = "1"; from setup import dependencies; t = [_ for _ in dependencies if _.startswith("chiavdf")][0]; print(t)') +FLAXVDF_VERSION=$(python -c 'import os; os.environ["FLAX_SKIP_SETUP"] = "1"; from setup import dependencies; t = [_ for _ in dependencies if _.startswith("chiavdf")][0]; print(t)') ubuntu_cmake_install() { UBUNTU_PRE_2004=$(python -c 'import subprocess; process = subprocess.run(["lsb_release", "-rs"], stdout=subprocess.PIPE); print(float(process.stdout) < float(20.04))') @@ -95,8 +95,8 @@ else echo "apt-get install libgmp-dev libboost-python-dev $PYTHON_DEV_DEPENDENCY libboost-system-dev build-essential -y" sudo apt-get install libgmp-dev libboost-python-dev "$PYTHON_DEV_DEPENDENCY" libboost-system-dev build-essential -y echo "Installing chiavdf from source on Ubuntu/Debian" - echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" - venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" + echo venv/bin/python -m pip install --force --no-binary chiavdf "$FLAXVDF_VERSION" + venv/bin/python -m pip install --force --no-binary chiavdf "$FLAXVDF_VERSION" symlink_vdf_bench "$PYTHON_VERSION" elif [ -e venv/bin/python ] && test $RHEL_BASED; then echo "Installing chiavdf dependencies on RedHat/CentOS/Fedora" @@ -104,22 +104,22 @@ else echo "yum install gcc gcc-c++ gmp-devel $PYTHON_DEV_DEPENDENCY libtool make autoconf automake openssl-devel libevent-devel boost-devel python3 cmake -y" sudo yum install gcc gcc-c++ gmp-devel "$PYTHON_DEV_DEPENDENCY" libtool make autoconf automake openssl-devel libevent-devel boost-devel python3 cmake -y echo "Installing chiavdf from source on RedHat/CentOS/Fedora" - echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" - venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" + echo venv/bin/python -m pip install --force --no-binary chiavdf "$FLAXVDF_VERSION" + venv/bin/python -m pip install --force --no-binary chiavdf "$FLAXVDF_VERSION" symlink_vdf_bench "$PYTHON_VERSION" elif [ -e venv/bin/python ] && test $MACOS; then echo "Installing chiavdf dependencies for MacOS." brew install boost cmake gmp echo "Installing chiavdf from source." # User needs to provide required packages - echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" - venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" + echo venv/bin/python -m pip install --force --no-binary chiavdf "$FLAXVDF_VERSION" + venv/bin/python -m pip install --force --no-binary chiavdf "$FLAXVDF_VERSION" symlink_vdf_bench "$PYTHON_VERSION" elif [ -e venv/bin/python ]; then echo "Installing chiavdf from source." # User needs to provide required packages - echo venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" - venv/bin/python -m pip install --force --no-binary chiavdf "$CHIAVDF_VERSION" + echo venv/bin/python -m pip install --force --no-binary chiavdf "$FLAXVDF_VERSION" + venv/bin/python -m pip install --force --no-binary chiavdf "$FLAXVDF_VERSION" symlink_vdf_bench "$PYTHON_VERSION" else echo "No venv created yet, please run install.sh." diff --git a/install.sh b/install.sh index 4c1909d51..5350e3d72 100755 --- a/install.sh +++ b/install.sh @@ -54,9 +54,9 @@ fi if [ "$(uname -m)" = "armv7l" ]; then echo "" echo "WARNING:" - echo "The Chia Blockchain requires a 64 bit OS and this is 32 bit armv7l" + echo "The Flax Blockchain requires a 64 bit OS and this is 32 bit armv7l" echo "For more information, see" - echo "https://github.com/Chia-Network/chia-blockchain/wiki/Raspberry-Pi" + echo "https://github.com/Flax-Network/flax-blockchain/wiki/Raspberry-Pi" echo "Exiting." exit 1 fi @@ -99,7 +99,7 @@ install_python3_and_sqlite3_from_source_with_yum() { echo "cd $TMP_PATH" cd "$TMP_PATH" # Install sqlite>=3.37 - # yum install sqlite-devel brings sqlite3.7 which is not compatible with chia + # yum install sqlite-devel brings sqlite3.7 which is not compatible with flax echo "wget https://www.sqlite.org/2022/sqlite-autoconf-3370200.tar.gz" wget https://www.sqlite.org/2022/sqlite-autoconf-3370200.tar.gz tar xf sqlite-autoconf-3370200.tar.gz @@ -112,7 +112,7 @@ install_python3_and_sqlite3_from_source_with_yum() { make -j"$(nproc)" | stdbuf -o0 cut -b1-"$(tput cols)" | sed -u 'i\\o033[2K' | stdbuf -o0 tr '\n' '\r'; echo echo "sudo make install" sudo make install | stdbuf -o0 cut -b1-"$(tput cols)" | sed -u 'i\\o033[2K' | stdbuf -o0 tr '\n' '\r'; echo - # yum install python3 brings Python3.6 which is not supported by chia + # yum install python3 brings Python3.6 which is not supported by flax cd .. echo "wget https://www.python.org/ftp/python/3.9.11/Python-3.9.11.tgz" wget https://www.python.org/ftp/python/3.9.11/Python-3.9.11.tgz @@ -282,7 +282,7 @@ if ! command -v "$INSTALL_PYTHON_PATH" >/dev/null; then fi if [ "$PYTHON_MAJOR_VER" -ne "3" ] || [ "$PYTHON_MINOR_VER" -lt "7" ] || [ "$PYTHON_MINOR_VER" -ge "11" ]; then - echo "Chia requires Python version >= 3.7 and < 3.11.0" >&2 + echo "Flax requires Python version >= 3.7 and < 3.11.0" >&2 echo "Current Python version = $INSTALL_PYTHON_VERSION" >&2 # If Arch, direct to Arch Wiki if type pacman >/dev/null 2>&1 && [ -f "/etc/arch-release" ]; then @@ -352,13 +352,13 @@ if [ -n "$PLOTTER_INSTALL" ]; then fi echo "" -echo "Chia blockchain install.sh complete." -echo "For assistance join us on Keybase in the #support chat channel:" -echo "https://keybase.io/team/chia_network.public" +echo "Flax blockchain install.sh complete." +echo "For assistance join us on Discord in the #support chat channel:" +echo "https://discord.gg/yEWaF6CQcA" echo "" -echo "Try the Quick Start Guide to running chia-blockchain:" -echo "https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide" +echo "Try the Quick Start Guide to running flax-blockchain:" +echo "https://github.com/Flax-Network/flax-blockchain/wiki/Quick-Start-Guide" echo "" echo "To install the GUI type 'sh install-gui.sh' after '. ./activate'." echo "" -echo "Type '. ./activate' and then 'chia init' to begin." +echo "Type '. ./activate' and then 'flax init' to begin." diff --git a/installhelper.py b/installhelper.py index c075862cb..21158af83 100644 --- a/installhelper.py +++ b/installhelper.py @@ -1,6 +1,6 @@ # # Install helper code to manage inserting the correct version for the GUI -# Gets the version from the result of "chia version" +# Gets the version from the result of "flax version" # Converts to proper symver format so NPM doesn't complain # Adds the version info to the package.json file # @@ -49,9 +49,9 @@ def make_semver(version_str: str) -> str: return version -def get_chia_version() -> str: +def get_flax_version() -> str: version: str = "0.0" - output = subprocess.run(["chia", "version"], capture_output=True) + output = subprocess.run(["flax", "version"], capture_output=True) if output.returncode == 0: version = str(output.stdout.strip(), "utf-8").splitlines()[-1] return make_semver(version) @@ -64,12 +64,12 @@ def update_version(package_json_path: str): with open(package_json_path) as f: data = json.load(f) - data["version"] = get_chia_version() + data["version"] = get_flax_version() with open(package_json_path, "w") as w: json.dump(data, indent=4, fp=w) if __name__ == "__main__": - update_version(f"{os.path.dirname(__file__)}/chia-blockchain-gui/package.json") - update_version(f"{os.path.dirname(__file__)}/chia-blockchain-gui/packages/gui/package.json") + update_version(f"{os.path.dirname(__file__)}/flax-blockchain-gui/package.json") + update_version(f"{os.path.dirname(__file__)}/flax-blockchain-gui/packages/gui/package.json") diff --git a/lgtm.yml b/lgtm.yml index 413554587..f22f39112 100644 --- a/lgtm.yml +++ b/lgtm.yml @@ -8,4 +8,4 @@ extraction: javascript: index: include: - - chia-blockchain-gui + - flax-blockchain-gui diff --git a/mypy.ini b/mypy.ini index dc9dd7cd0..298b3339a 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,5 +1,5 @@ [mypy] -files = benchmarks,build_scripts,chia,tests,tools,*.py +files = benchmarks,build_scripts,flax,tests,tools,*.py ignore_missing_imports = True show_error_codes = True warn_unused_ignores = True @@ -17,7 +17,7 @@ no_implicit_reexport = True strict_equality = True # list created by: venv/bin/mypy | sed -n 's/.py:.*//p' | sort | uniq | tr '/' '.' | tr '\n' ',' -[mypy-benchmarks.block_ref,benchmarks.block_store,benchmarks.coin_store,benchmarks.utils,build_scripts.installer-version,chia.cmds.configure,chia.cmds.db,chia.cmds.db_upgrade_func,chia.cmds.farm_funcs,chia.cmds.init,chia.cmds.init_funcs,chia.cmds.keys,chia.cmds.keys_funcs,chia.cmds.passphrase,chia.cmds.passphrase_funcs,chia.cmds.plotnft,chia.cmds.plotnft_funcs,chia.cmds.plots,chia.cmds.plotters,chia.cmds.show,chia.cmds.start_funcs,chia.cmds.wallet,chia.cmds.wallet_funcs,chia.daemon.keychain_server,chia.daemon.server,chia.farmer.farmer,chia.farmer.farmer_api,chia.full_node.weight_proof,chia.harvester.harvester,chia.harvester.harvester_api,chia.introducer.introducer,chia.introducer.introducer_api,chia.plotters.bladebit,chia.plotters.chiapos,chia.plotters.madmax,chia.plotters.plotters,chia.plotters.plotters_util,chia.plotting.check_plots,chia.plotting.create_plots,chia.plotting.manager,chia.plotting.util,chia.pools.pool_config,chia.pools.pool_puzzles,chia.pools.pool_wallet,chia.pools.pool_wallet_info,chia.protocols.pool_protocol,chia.rpc.crawler_rpc_api,chia.rpc.farmer_rpc_api,chia.rpc.farmer_rpc_client,chia.rpc.full_node_rpc_api,chia.rpc.full_node_rpc_client,chia.rpc.harvester_rpc_api,chia.rpc.harvester_rpc_client,chia.rpc.rpc_client,chia.rpc.timelord_rpc_api,chia.rpc.util,chia.rpc.wallet_rpc_api,chia.rpc.wallet_rpc_client,chia.seeder.crawler,chia.seeder.crawler_api,chia.seeder.crawl_store,chia.seeder.dns_server,chia.seeder.peer_record,chia.seeder.start_crawler,chia.server.address_manager,chia.server.address_manager_store,chia.server.connection_utils,chia.server.introducer_peers,chia.server.node_discovery,chia.server.peer_store_resolver,chia.server.rate_limits,chia.server.reconnect_task,chia.server.server,chia.server.ssl_context,chia.server.start_farmer,chia.server.start_full_node,chia.server.start_harvester,chia.server.start_introducer,chia.server.start_service,chia.server.start_timelord,chia.server.start_wallet,chia.server.ws_connection,chia.simulator.full_node_simulator,chia.simulator.start_simulator,chia.ssl.create_ssl,chia.timelord.iters_from_block,chia.timelord.timelord,chia.timelord.timelord_api,chia.timelord.timelord_launcher,chia.timelord.timelord_state,chia.types.announcement,chia.types.blockchain_format.classgroup,chia.types.blockchain_format.coin,chia.types.blockchain_format.program,chia.types.blockchain_format.proof_of_space,chia.types.blockchain_format.tree_hash,chia.types.blockchain_format.vdf,chia.types.full_block,chia.types.header_block,chia.types.mempool_item,chia.types.name_puzzle_condition,chia.types.peer_info,chia.types.spend_bundle,chia.types.transaction_queue_entry,chia.types.unfinished_block,chia.types.unfinished_header_block,chia.util.block_cache,chia.util.check_fork_next_block,chia.util.chia_logging,chia.util.config,chia.util.db_wrapper,chia.util.dump_keyring,chia.util.files,chia.util.hash,chia.util.json_util,chia.util.keychain,chia.util.keyring_wrapper,chia.util.log_exceptions,chia.util.make_test_constants,chia.util.merkle_set,chia.util.network,chia.util.partial_func,chia.util.pip_import,chia.util.profiler,chia.util.safe_cancel_task,chia.util.service_groups,chia.util.ssl_check,chia.util.validate_alert,chia.wallet.block_record,chia.wallet.chialisp,chia.wallet.did_wallet.did_wallet,chia.wallet.did_wallet.did_wallet_puzzles,chia.wallet.key_val_store,chia.wallet.lineage_proof,chia.wallet.payment,chia.wallet.puzzles.load_clvm,chia.wallet.puzzles.p2_conditions,chia.wallet.puzzles.p2_delegated_conditions,chia.wallet.puzzles.p2_delegated_puzzle,chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle,chia.wallet.puzzles.p2_m_of_n_delegate_direct,chia.wallet.puzzles.p2_puzzle_hash,chia.wallet.puzzles.prefarm.spend_prefarm,chia.wallet.puzzles.puzzle_utils,chia.wallet.puzzles.singleton_top_layer,chia.wallet.puzzles.tails,chia.wallet.secret_key_store,chia.wallet.settings.user_settings,chia.wallet.trade_record,chia.wallet.trading.trade_store,chia.wallet.transaction_record,chia.wallet.util.debug_spend_bundle,chia.wallet.util.new_peak_queue,chia.wallet.util.wallet_sync_utils,chia.wallet.wallet,chia.wallet.wallet_blockchain,chia.wallet.wallet_coin_store,chia.wallet.wallet_interested_store,chia.wallet.wallet_node,chia.wallet.wallet_node_api,chia.wallet.wallet_pool_store,chia.wallet.wallet_puzzle_store,chia.wallet.wallet_state_manager,chia.wallet.wallet_sync_store,chia.wallet.wallet_transaction_store,chia.wallet.wallet_user_store,chia.wallet.wallet_weight_proof_handler,installhelper,tests.blockchain.blockchain_test_utils,tests.blockchain.test_blockchain,tests.blockchain.test_blockchain_transactions,chia.simulator.block_tools,tests.build-init-files,tests.build-workflows,tests.clvm.coin_store,tests.clvm.test_chialisp_deserialization,tests.clvm.test_clvm_compilation,tests.clvm.test_program,tests.clvm.test_puzzle_compression,tests.clvm.test_puzzles,tests.clvm.test_serialized_program,tests.clvm.test_singletons,tests.clvm.test_spend_sim,tests.conftest,tests.connection_utils,tests.core.cmds.test_keys,tests.core.consensus.test_pot_iterations,tests.core.custom_types.test_coin,tests.core.custom_types.test_proof_of_space,tests.core.custom_types.test_spend_bundle,tests.core.daemon.test_daemon,tests.core.full_node.full_sync.test_full_sync,tests.core.full_node.stores.test_block_store,tests.core.full_node.stores.test_coin_store,tests.core.full_node.stores.test_full_node_store,tests.core.full_node.stores.test_hint_store,tests.core.full_node.stores.test_sync_store,tests.core.full_node.test_address_manager,tests.core.full_node.test_block_height_map,tests.core.full_node.test_conditions,tests.core.full_node.test_full_node,tests.core.full_node.test_mempool,tests.core.full_node.test_mempool_performance,tests.core.full_node.test_node_load,tests.core.full_node.test_peer_store_resolver,tests.core.full_node.test_performance,tests.core.full_node.test_transactions,tests.core.make_block_generator,tests.core.node_height,tests.core.server.test_dos,tests.core.server.test_rate_limits,tests.core.ssl.test_ssl,tests.core.test_cost_calculation,tests.core.test_crawler_rpc,tests.core.test_daemon_rpc,tests.core.test_db_conversion,tests.core.test_db_validation,tests.core.test_farmer_harvester_rpc,tests.core.test_filter,tests.core.test_full_node_rpc,tests.core.test_merkle_set,tests.core.test_setproctitle,tests.core.util.test_cached_bls,tests.core.util.test_config,tests.core.util.test_file_keyring_synchronization,tests.core.util.test_files,tests.core.util.test_keychain,tests.core.util.test_keyring_wrapper,tests.core.util.test_lru_cache,tests.core.util.test_significant_bits,tests.farmer_harvester.test_farmer_harvester,tests.generator.test_compression,tests.generator.test_generator_types,tests.generator.test_list_to_batches,tests.generator.test_rom,tests.generator.test_scan,tests.plotting.test_plot_manager,tests.pools.test_pool_cmdline,tests.pools.test_pool_config,tests.pools.test_pool_puzzles_lifecycle,tests.pools.test_pool_rpc,tests.pools.test_wallet_pool_store,tests.setup_nodes,tests.setup_services,tests.simulation.test_simulation,chia.simulator.time_out_assert,tests.tools.test_full_sync,tests.tools.test_run_block,tests.util.alert_server,tests.util.benchmark_cost,tests.util.blockchain,tests.util.build_network_protocol_files,tests.util.db_connection,tests.util.generator_tools_testing,tests.util.keyring,tests.util.key_tool,tests.util.test_full_block_utils,tests.util.test_lock_queue,tests.util.test_misc,tests.util.test_network,tests.util.test_network_protocol_files,tests.wallet.cat_wallet.test_cat_lifecycle,tests.wallet.cat_wallet.test_cat_wallet,tests.wallet.cat_wallet.test_offer_lifecycle,tests.wallet.cat_wallet.test_trades,tests.wallet.did_wallet.test_did,tests.wallet.did_wallet.test_did_rpc,tests.wallet.did_wallet.test_nft_rpc,tests.wallet.did_wallet.test_nft_wallet,tests.wallet.rpc.test_wallet_rpc,tests.wallet.simple_sync.test_simple_sync_protocol,tests.wallet.sync.test_wallet_sync,tests.wallet.test_bech32m,tests.wallet.test_chialisp,tests.wallet.test_puzzle_store,tests.wallet.test_singleton,tests.wallet.test_singleton_lifecycle,tests.wallet.test_singleton_lifecycle_fast,tests.wallet.test_taproot,tests.wallet.test_wallet_blockchain,tests.wallet.test_wallet_interested_store,tests.wallet.test_wallet_key_val_store,tests.wallet.test_wallet_user_store,chia.simulator.wallet_tools,tests.weight_proof.test_weight_proof,tools.analyze-chain,tools.run_block,tools.test_full_sync,tests.wallet.nft_wallet.test_nft_wallet,chia.wallet.nft_wallet.nft_puzzles,tests.wallet.nft_wallet.test_nft_puzzles] +[mypy-benchmarks.block_ref,benchmarks.block_store,benchmarks.coin_store,benchmarks.utils,build_scripts.installer-version,flax.cmds.configure,flax.cmds.db,flax.cmds.db_upgrade_func,flax.cmds.farm_funcs,flax.cmds.init,flax.cmds.init_funcs,flax.cmds.keys,flax.cmds.keys_funcs,flax.cmds.passphrase,flax.cmds.passphrase_funcs,flax.cmds.plotnft,flax.cmds.plotnft_funcs,flax.cmds.plots,flax.cmds.plotters,flax.cmds.show,flax.cmds.start_funcs,flax.cmds.wallet,flax.cmds.wallet_funcs,flax.daemon.keychain_server,flax.daemon.server,flax.farmer.farmer,flax.farmer.farmer_api,flax.full_node.weight_proof,flax.harvester.harvester,flax.harvester.harvester_api,flax.introducer.introducer,flax.introducer.introducer_api,flax.plotters.bladebit,flax.plotters.chiapos,flax.plotters.madmax,flax.plotters.plotters,flax.plotters.plotters_util,flax.plotting.check_plots,flax.plotting.create_plots,flax.plotting.manager,flax.plotting.util,flax.pools.pool_config,flax.pools.pool_puzzles,flax.pools.pool_wallet,flax.pools.pool_wallet_info,flax.protocols.pool_protocol,flax.rpc.crawler_rpc_api,flax.rpc.farmer_rpc_api,flax.rpc.farmer_rpc_client,flax.rpc.full_node_rpc_api,flax.rpc.full_node_rpc_client,flax.rpc.harvester_rpc_api,flax.rpc.harvester_rpc_client,flax.rpc.rpc_client,flax.rpc.timelord_rpc_api,flax.rpc.util,flax.rpc.wallet_rpc_api,flax.rpc.wallet_rpc_client,flax.seeder.crawler,flax.seeder.crawler_api,flax.seeder.crawl_store,flax.seeder.dns_server,flax.seeder.peer_record,flax.seeder.start_crawler,flax.server.address_manager,flax.server.address_manager_store,flax.server.connection_utils,flax.server.introducer_peers,flax.server.node_discovery,flax.server.peer_store_resolver,flax.server.rate_limits,flax.server.reconnect_task,flax.server.server,flax.server.ssl_context,flax.server.start_farmer,flax.server.start_full_node,flax.server.start_harvester,flax.server.start_introducer,flax.server.start_service,flax.server.start_timelord,flax.server.start_wallet,flax.server.ws_connection,flax.simulator.full_node_simulator,flax.simulator.start_simulator,flax.ssl.create_ssl,flax.timelord.iters_from_block,flax.timelord.timelord,flax.timelord.timelord_api,flax.timelord.timelord_launcher,flax.timelord.timelord_state,flax.types.announcement,flax.types.blockchain_format.classgroup,flax.types.blockchain_format.coin,flax.types.blockchain_format.program,flax.types.blockchain_format.proof_of_space,flax.types.blockchain_format.tree_hash,flax.types.blockchain_format.vdf,flax.types.full_block,flax.types.header_block,flax.types.mempool_item,flax.types.name_puzzle_condition,flax.types.peer_info,flax.types.spend_bundle,flax.types.transaction_queue_entry,flax.types.unfinished_block,flax.types.unfinished_header_block,flax.util.block_cache,flax.util.check_fork_next_block,flax.util.flax_logging,flax.util.config,flax.util.db_wrapper,flax.util.dump_keyring,flax.util.files,flax.util.hash,flax.util.json_util,flax.util.keychain,flax.util.keyring_wrapper,flax.util.log_exceptions,flax.util.make_test_constants,flax.util.merkle_set,flax.util.network,flax.util.partial_func,flax.util.pip_import,flax.util.profiler,flax.util.safe_cancel_task,flax.util.service_groups,flax.util.ssl_check,flax.util.validate_alert,flax.wallet.block_record,flax.wallet.flaxlisp,flax.wallet.did_wallet.did_wallet,flax.wallet.did_wallet.did_wallet_puzzles,flax.wallet.key_val_store,flax.wallet.lineage_proof,flax.wallet.payment,flax.wallet.puzzles.load_clvm,flax.wallet.puzzles.p2_conditions,flax.wallet.puzzles.p2_delegated_conditions,flax.wallet.puzzles.p2_delegated_puzzle,flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle,flax.wallet.puzzles.p2_m_of_n_delegate_direct,flax.wallet.puzzles.p2_puzzle_hash,flax.wallet.puzzles.prefarm.spend_prefarm,flax.wallet.puzzles.puzzle_utils,flax.wallet.puzzles.singleton_top_layer,flax.wallet.puzzles.tails,flax.wallet.secret_key_store,flax.wallet.settings.user_settings,flax.wallet.trade_record,flax.wallet.trading.trade_store,flax.wallet.transaction_record,flax.wallet.util.debug_spend_bundle,flax.wallet.util.new_peak_queue,flax.wallet.util.wallet_sync_utils,flax.wallet.wallet,flax.wallet.wallet_blockchain,flax.wallet.wallet_coin_store,flax.wallet.wallet_interested_store,flax.wallet.wallet_node,flax.wallet.wallet_node_api,flax.wallet.wallet_pool_store,flax.wallet.wallet_puzzle_store,flax.wallet.wallet_state_manager,flax.wallet.wallet_sync_store,flax.wallet.wallet_transaction_store,flax.wallet.wallet_user_store,flax.wallet.wallet_weight_proof_handler,installhelper,tests.blockchain.blockchain_test_utils,tests.blockchain.test_blockchain,tests.blockchain.test_blockchain_transactions,flax.simulator.block_tools,tests.build-init-files,tests.build-workflows,tests.clvm.coin_store,tests.clvm.test_flaxlisp_deserialization,tests.clvm.test_clvm_compilation,tests.clvm.test_program,tests.clvm.test_puzzle_compression,tests.clvm.test_puzzles,tests.clvm.test_serialized_program,tests.clvm.test_singletons,tests.clvm.test_spend_sim,tests.conftest,tests.connection_utils,tests.core.cmds.test_keys,tests.core.consensus.test_pot_iterations,tests.core.custom_types.test_coin,tests.core.custom_types.test_proof_of_space,tests.core.custom_types.test_spend_bundle,tests.core.daemon.test_daemon,tests.core.full_node.full_sync.test_full_sync,tests.core.full_node.stores.test_block_store,tests.core.full_node.stores.test_coin_store,tests.core.full_node.stores.test_full_node_store,tests.core.full_node.stores.test_hint_store,tests.core.full_node.stores.test_sync_store,tests.core.full_node.test_address_manager,tests.core.full_node.test_block_height_map,tests.core.full_node.test_conditions,tests.core.full_node.test_full_node,tests.core.full_node.test_mempool,tests.core.full_node.test_mempool_performance,tests.core.full_node.test_node_load,tests.core.full_node.test_peer_store_resolver,tests.core.full_node.test_performance,tests.core.full_node.test_transactions,tests.core.make_block_generator,tests.core.node_height,tests.core.server.test_dos,tests.core.server.test_rate_limits,tests.core.ssl.test_ssl,tests.core.test_cost_calculation,tests.core.test_crawler_rpc,tests.core.test_daemon_rpc,tests.core.test_db_conversion,tests.core.test_db_validation,tests.core.test_farmer_harvester_rpc,tests.core.test_filter,tests.core.test_full_node_rpc,tests.core.test_merkle_set,tests.core.test_setproctitle,tests.core.util.test_cached_bls,tests.core.util.test_config,tests.core.util.test_file_keyring_synchronization,tests.core.util.test_files,tests.core.util.test_keychain,tests.core.util.test_keyring_wrapper,tests.core.util.test_lru_cache,tests.core.util.test_significant_bits,tests.farmer_harvester.test_farmer_harvester,tests.generator.test_compression,tests.generator.test_generator_types,tests.generator.test_list_to_batches,tests.generator.test_rom,tests.generator.test_scan,tests.plotting.test_plot_manager,tests.pools.test_pool_cmdline,tests.pools.test_pool_config,tests.pools.test_pool_puzzles_lifecycle,tests.pools.test_pool_rpc,tests.pools.test_wallet_pool_store,tests.setup_nodes,tests.setup_services,tests.simulation.test_simulation,flax.simulator.time_out_assert,tests.tools.test_full_sync,tests.tools.test_run_block,tests.util.alert_server,tests.util.benchmark_cost,tests.util.blockchain,tests.util.build_network_protocol_files,tests.util.db_connection,tests.util.generator_tools_testing,tests.util.keyring,tests.util.key_tool,tests.util.test_full_block_utils,tests.util.test_lock_queue,tests.util.test_misc,tests.util.test_network,tests.util.test_network_protocol_files,tests.wallet.cat_wallet.test_cat_lifecycle,tests.wallet.cat_wallet.test_cat_wallet,tests.wallet.cat_wallet.test_offer_lifecycle,tests.wallet.cat_wallet.test_trades,tests.wallet.did_wallet.test_did,tests.wallet.did_wallet.test_did_rpc,tests.wallet.did_wallet.test_nft_rpc,tests.wallet.did_wallet.test_nft_wallet,tests.wallet.rpc.test_wallet_rpc,tests.wallet.simple_sync.test_simple_sync_protocol,tests.wallet.sync.test_wallet_sync,tests.wallet.test_bech32m,tests.wallet.test_flaxlisp,tests.wallet.test_puzzle_store,tests.wallet.test_singleton,tests.wallet.test_singleton_lifecycle,tests.wallet.test_singleton_lifecycle_fast,tests.wallet.test_taproot,tests.wallet.test_wallet_blockchain,tests.wallet.test_wallet_interested_store,tests.wallet.test_wallet_key_val_store,tests.wallet.test_wallet_user_store,flax.simulator.wallet_tools,tests.weight_proof.test_weight_proof,tools.analyze-chain,tools.run_block,tools.test_full_sync,tests.wallet.nft_wallet.test_nft_wallet,flax.wallet.nft_wallet.nft_puzzles,tests.wallet.nft_wallet.test_nft_puzzles] disallow_any_generics = False disallow_subclassing_any = False disallow_untyped_calls = False diff --git a/pyproject.toml b/pyproject.toml index b6d308171..cde70339e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ target-version = ['py37', 'py38', 'py39'] include = ''' ^/( [^/]*.py - | (benchmarks|build_scripts|chia|tests|tools)/.*\.pyi? + | (benchmarks|build_scripts|flax|tests|tools)/.*\.pyi? )$ ''' exclude = '' diff --git a/run-py-tests.sh b/run-py-tests.sh old mode 100755 new mode 100644 diff --git a/setup.py b/setup.py index c5f9f5601..22dca40b8 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ # "keyrings.cryptfile==1.3.8", # Secure storage for keys on Linux (Will be replaced) # See https://github.com/frispete/keyrings.cryptfile/issues/15 "PyYAML==6.0", # Used for config file format - "setproctitle==1.2.3", # Gives the chia processes readable names + "setproctitle==1.2.3", # Gives the flax processes readable names "sortedcontainers==2.4.0", # For maintaining sorted mempools "click==8.1.3", # For the CLI "dnspython==2.2.1", # Query DNS seeds @@ -71,14 +71,12 @@ ] kwargs = dict( - name="chia-blockchain", - author="Mariano Sorgente", - author_email="mariano@chia.net", - description="Chia blockchain full node, farmer, timelord, and wallet.", - url="https://chia.net/", + name="flax-blockchain", + description="Flax blockchain full node, farmer, timelord, and wallet.", + url="https://flaxnetwork.org/", license="Apache License", python_requires=">=3.7, <4", - keywords="chia blockchain node", + keywords="flax blockchain node", install_requires=dependencies, extras_require=dict( uvloop=["uvloop"], @@ -87,75 +85,75 @@ ), packages=[ "build_scripts", - "chia", - "chia.cmds", - "chia.clvm", - "chia.consensus", - "chia.daemon", - "chia.data_layer", - "chia.full_node", - "chia.timelord", - "chia.farmer", - "chia.harvester", - "chia.introducer", - "chia.plot_sync", - "chia.plotters", - "chia.plotting", - "chia.pools", - "chia.protocols", - "chia.rpc", - "chia.seeder", - "chia.server", - "chia.simulator", - "chia.types.blockchain_format", - "chia.types", - "chia.util", - "chia.wallet", - "chia.wallet.db_wallet", - "chia.wallet.puzzles", - "chia.wallet.cat_wallet", - "chia.wallet.did_wallet", - "chia.wallet.nft_wallet", - "chia.wallet.settings", - "chia.wallet.trading", - "chia.wallet.util", - "chia.ssl", + "flax", + "flax.cmds", + "flax.clvm", + "flax.consensus", + "flax.daemon", + "flax.data_layer", + "flax.full_node", + "flax.timelord", + "flax.farmer", + "flax.harvester", + "flax.introducer", + "flax.plot_sync", + "flax.plotters", + "flax.plotting", + "flax.pools", + "flax.protocols", + "flax.rpc", + "flax.seeder", + "flax.server", + "flax.simulator", + "flax.types.blockchain_format", + "flax.types", + "flax.util", + "flax.wallet", + "flax.wallet.db_wallet", + "flax.wallet.puzzles", + "flax.wallet.cat_wallet", + "flax.wallet.did_wallet", + "flax.wallet.nft_wallet", + "flax.wallet.settings", + "flax.wallet.trading", + "flax.wallet.util", + "flax.ssl", "mozilla-ca", ], entry_points={ "console_scripts": [ - "chia = chia.cmds.chia:main", - "chia_daemon = chia.daemon.server:main", - "chia_wallet = chia.server.start_wallet:main", - "chia_full_node = chia.server.start_full_node:main", - "chia_harvester = chia.server.start_harvester:main", - "chia_farmer = chia.server.start_farmer:main", - "chia_introducer = chia.server.start_introducer:main", - "chia_crawler = chia.seeder.start_crawler:main", - "chia_seeder = chia.seeder.dns_server:main", - "chia_timelord = chia.server.start_timelord:main", - "chia_timelord_launcher = chia.timelord.timelord_launcher:main", - "chia_full_node_simulator = chia.simulator.start_simulator:main", - "chia_data_layer = chia.server.start_data_layer:main", - "chia_data_layer_http = chia.data_layer.data_layer_server:main", + "flax = flax.cmds.flax:main", + "flax_daemon = flax.daemon.server:main", + "flax_wallet = flax.server.start_wallet:main", + "flax_full_node = flax.server.start_full_node:main", + "flax_harvester = flax.server.start_harvester:main", + "flax_farmer = flax.server.start_farmer:main", + "flax_introducer = flax.server.start_introducer:main", + "flax_crawler = flax.seeder.start_crawler:main", + "flax_seeder = flax.seeder.dns_server:main", + "flax_timelord = flax.server.start_timelord:main", + "flax_timelord_launcher = flax.timelord.timelord_launcher:main", + "flax_full_node_simulator = flax.simulator.start_simulator:main", + "flax_data_layer = flax.server.start_data_layer:main", + "flax_data_layer_http = flax.data_layer.data_layer_server:main", ] }, package_data={ - "chia": ["pyinstaller.spec"], + "flax": ["pyinstaller.spec"], "": ["*.clvm", "*.clvm.hex", "*.clib", "*.clinc", "*.clsp", "py.typed"], - "chia.util": ["initial-*.yaml", "english.txt"], - "chia.ssl": ["chia_ca.crt", "chia_ca.key", "dst_root_ca.pem"], + "flax.util": ["initial-*.yaml", "english.txt"], + "flax.ssl": ["flax_ca.crt", "flax_ca.key", "dst_root_ca.pem"], "mozilla-ca": ["cacert.pem"], }, long_description=open("README.md").read(), long_description_content_type="text/markdown", zip_safe=False, project_urls={ - "Source": "https://github.com/Chia-Network/chia-blockchain/", - "Changelog": "https://github.com/Chia-Network/chia-blockchain/blob/main/CHANGELOG.md", + "Source": "https://github.com/Flax-Network/flax-blockchain/", + "Changelog": "https://github.com/Flax-Network/flax-blockchain/blob/main/CHANGELOG.md", }, ) -if len(os.environ.get("CHIA_SKIP_SETUP", "")) < 1: +if len(os.environ.get("FLAX_SKIP_SETUP", "")) < 1: setup(**kwargs) # type: ignore diff --git a/start-gui.sh b/start-gui.sh index 1ff9101ca..6bc4851b5 100755 --- a/start-gui.sh +++ b/start-gui.sh @@ -16,7 +16,7 @@ if [ -d "${SCRIPT_DIR}/.n" ]; then fi if [ -z "$VIRTUAL_ENV" ]; then - echo "This requires the chia python virtual environment." + echo "This requires the flax python virtual environment." echo "Execute '. ./activate' before running." exit 1 fi @@ -37,7 +37,7 @@ else fi echo "### Checking GUI build" -GUI_BUILD_PATH="${SCRIPT_DIR}/chia-blockchain-gui/packages/gui/build/electron/main.js" +GUI_BUILD_PATH="${SCRIPT_DIR}/flax-blockchain-gui/packages/gui/build/electron/main.js" if [ ! -e "$GUI_BUILD_PATH" ]; then echo "Error: GUI build was not found" echo "It is expected at $GUI_BUILD_PATH" @@ -49,6 +49,6 @@ else fi echo "### Starting GUI" -cd "${SCRIPT_DIR}/chia-blockchain-gui/" +cd "${SCRIPT_DIR}/flax-blockchain-gui/" echo "npm run electron" npm run electron diff --git a/tests/README.md b/tests/README.md index 089536efb..2dc9b115f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -7,7 +7,7 @@ Tests are recognized by the file glob `test_*.py`. Changing the contents of a file does not require running `build-workflows.py`. We currently use github actions. Default runners have two vcpus. -The workflows are located in [../.github/workflows/](https://github.com/Chia-Network/chia-blockchain/tree/main/.github/workflows). +The workflows are located in [../.github/workflows/](https://github.com/Flax-Network/flax-blockchain/tree/main/.github/workflows). The inputs to `build-workflows.py` are the templates in `runner-templates`, the file `testconfig.py` in this directory, and the optional `config.py` files in some test subdirectories. Files in the template directory ending in `include.yml` are included in jobs based on the per-directory settings. @@ -21,7 +21,7 @@ The subdirectory jobs do not include the tests from their parents. ## testconfig.py -In the top tests directory, [testconfig.py](https://github.com/Chia-Network/chia-blockchain/tree/main/tests/testconfig.py) +In the top tests directory, [testconfig.py](https://github.com/Flax-Network/flax-blockchain/tree/main/tests/testconfig.py) contains the application settings and the per-directory default settings. ## config.py @@ -43,7 +43,7 @@ If you are certain that all the tests in a directory can run in parallel, set `p ### Optional job stages -Set `checkout_blocks_and_plots` to `False` to omit checking out the [test-cache](https://github.com/Chia-Network/test-cache) repo. +Set `checkout_blocks_and_plots` to `False` to omit checking out the [test-cache](https://github.com/Flax-Network/test-cache) repo. Set `install_timelord` to `False` to omit the step of installing a Time Lord for your directory's job. diff --git a/tests/blockchain/blockchain_test_utils.py b/tests/blockchain/blockchain_test_utils.py index ccb8838c3..a411a811a 100644 --- a/tests/blockchain/blockchain_test_utils.py +++ b/tests/blockchain/blockchain_test_utils.py @@ -1,10 +1,10 @@ from typing import Optional, List -from chia.consensus.blockchain import Blockchain, ReceiveBlockResult -from chia.consensus.multiprocess_validation import PreValidationResult -from chia.types.full_block import FullBlock -from chia.util.errors import Err -from chia.util.ints import uint64, uint32 +from flax.consensus.blockchain import Blockchain, ReceiveBlockResult +from flax.consensus.multiprocess_validation import PreValidationResult +from flax.types.full_block import FullBlock +from flax.util.errors import Err +from flax.util.ints import uint64, uint32 async def check_block_store_invariant(bc: Blockchain): diff --git a/tests/blockchain/test_blockchain.py b/tests/blockchain/test_blockchain.py index ea3a92596..84d3c2fe4 100644 --- a/tests/blockchain/test_blockchain.py +++ b/tests/blockchain/test_blockchain.py @@ -9,47 +9,47 @@ from blspy import AugSchemeMPL, G2Element from clvm.casts import int_to_bytes -from chia.consensus.block_header_validation import validate_finished_header_block -from chia.consensus.block_rewards import calculate_base_farmer_reward -from chia.consensus.blockchain import ReceiveBlockResult -from chia.consensus.coinbase import create_farmer_coin -from chia.consensus.multiprocess_validation import PreValidationResult -from chia.consensus.pot_iterations import is_overflow_block -from chia.full_node.bundle_tools import detect_potential_template_generator -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.foliage import TransactionsInfo -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.slots import InfusedChallengeChainSubSlot -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.types.spend_bundle import SpendBundle -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.generator_tools import get_block_header -from chia.util.vdf_prover import get_vdf_info_and_proof -from chia.simulator.block_tools import create_block_tools_async -from chia.util.errors import Err -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint64, uint32 -from chia.util.merkle_set import MerkleSet -from chia.util.recursive_replace import recursive_replace +from flax.consensus.block_header_validation import validate_finished_header_block +from flax.consensus.block_rewards import calculate_base_farmer_reward +from flax.consensus.blockchain import ReceiveBlockResult +from flax.consensus.coinbase import create_farmer_coin +from flax.consensus.multiprocess_validation import PreValidationResult +from flax.consensus.pot_iterations import is_overflow_block +from flax.full_node.bundle_tools import detect_potential_template_generator +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.foliage import TransactionsInfo +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.slots import InfusedChallengeChainSubSlot +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.types.spend_bundle import SpendBundle +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.generator_tools import get_block_header +from flax.util.vdf_prover import get_vdf_info_and_proof +from flax.simulator.block_tools import create_block_tools_async +from flax.util.errors import Err +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint64, uint32 +from flax.util.merkle_set import MerkleSet +from flax.util.recursive_replace import recursive_replace from tests.blockchain.blockchain_test_utils import ( _validate_and_add_block, _validate_and_add_block_multi_error, _validate_and_add_block_multi_result, _validate_and_add_block_no_error, ) -from chia.simulator.wallet_tools import WalletTool +from flax.simulator.wallet_tools import WalletTool from tests.setup_nodes import test_constants from tests.util.blockchain import create_blockchain from tests.util.keyring import TempKeyring -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( DEFAULT_HIDDEN_PUZZLE_HASH, calculate_synthetic_secret_key, ) diff --git a/tests/blockchain/test_blockchain_transactions.py b/tests/blockchain/test_blockchain_transactions.py index d01350755..5055ee311 100644 --- a/tests/blockchain/test_blockchain_transactions.py +++ b/tests/blockchain/test_blockchain_transactions.py @@ -3,17 +3,17 @@ import pytest from clvm.casts import int_to_bytes -from chia.protocols import full_node_protocol, wallet_protocol -from chia.types.announcement import Announcement -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.spend_bundle import SpendBundle -from chia.util.errors import ConsensusError, Err -from chia.util.ints import uint64 +from flax.protocols import full_node_protocol, wallet_protocol +from flax.types.announcement import Announcement +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.spend_bundle import SpendBundle +from flax.util.errors import ConsensusError, Err +from flax.util.ints import uint64 from tests.blockchain.blockchain_test_utils import _validate_and_add_block from tests.setup_nodes import test_constants from tests.util.generator_tools_testing import run_and_get_removals_and_additions -from chia.simulator.wallet_tools import WalletTool +from flax.simulator.wallet_tools import WalletTool BURN_PUZZLE_HASH = b"0" * 32 diff --git a/tests/build-init-files.py b/tests/build-init-files.py old mode 100755 new mode 100644 index 61eacf8a9..45b60df4e --- a/tests/build-init-files.py +++ b/tests/build-init-files.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Create missing `__init__.py` files in the source code folders (in "chia/" and "tests/"). +# Create missing `__init__.py` files in the source code folders (in "flax/" and "tests/"). # # They are required by the python interpreter to properly identify modules/packages so that tools like `mypy` or an IDE # can work with their full capabilities. @@ -38,7 +38,7 @@ def command(verbose, root_str): stream_handler = logging.StreamHandler() logger.addHandler(stream_handler) - tree_roots = ["benchmarks", "build_scripts", "chia", "tests", "tools"] + tree_roots = ["benchmarks", "build_scripts", "flax", "tests", "tools"] failed = False root = pathlib.Path(root_str).resolve() directories = sorted( diff --git a/tests/check_pytest_monitor_output.py b/tests/check_pytest_monitor_output.py old mode 100755 new mode 100644 diff --git a/tests/check_sql_statements.py b/tests/check_sql_statements.py old mode 100755 new mode 100644 index 3130a8d01..86b882f30 --- a/tests/check_sql_statements.py +++ b/tests/check_sql_statements.py @@ -43,10 +43,10 @@ def check_create(sql_type: str, cwd: str, exemptions: Set[Tuple[str, str]] = set ret = 0 -ret += check_create("INDEX", "chia/wallet") +ret += check_create("INDEX", "flax/wallet") ret += check_create( "INDEX", - "chia/full_node", + "flax/full_node", set( [ ("block_store.py", "is_fully_compactified"), @@ -54,10 +54,10 @@ def check_create(sql_type: str, cwd: str, exemptions: Set[Tuple[str, str]] = set ] ), ) -ret += check_create("TABLE", "chia/wallet") +ret += check_create("TABLE", "flax/wallet") ret += check_create( "TABLE", - "chia/full_node", + "flax/full_node", set( [ ("block_store.py", "sub_epoch_segments_v3"), diff --git a/tests/clvm/benchmark_costs.py b/tests/clvm/benchmark_costs.py index ccf1e44ad..b29b972c4 100644 --- a/tests/clvm/benchmark_costs.py +++ b/tests/clvm/benchmark_costs.py @@ -1,10 +1,10 @@ -from chia.types.blockchain_format.program import INFINITE_COST -from chia.types.spend_bundle import SpendBundle -from chia.types.generator_types import BlockGenerator -from chia.consensus.cost_calculator import NPCResult -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.full_node.bundle_tools import simple_solution_generator -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.blockchain_format.program import INFINITE_COST +from flax.types.spend_bundle import SpendBundle +from flax.types.generator_types import BlockGenerator +from flax.consensus.cost_calculator import NPCResult +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.full_node.bundle_tools import simple_solution_generator +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions def cost_of_spend_bundle(spend_bundle: SpendBundle) -> int: diff --git a/tests/clvm/coin_store.py b/tests/clvm/coin_store.py index 925cffb51..9be5304c6 100644 --- a/tests/clvm/coin_store.py +++ b/tests/clvm/coin_store.py @@ -2,15 +2,15 @@ from dataclasses import dataclass, replace from typing import Dict, Iterator, Optional -from chia.full_node.mempool_check_conditions import mempool_check_time_locks, get_name_puzzle_conditions -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_record import CoinRecord -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint32, uint64 -from chia.full_node.bundle_tools import simple_solution_generator -from chia.util.errors import Err -from chia.consensus.cost_calculator import NPCResult +from flax.full_node.mempool_check_conditions import mempool_check_time_locks, get_name_puzzle_conditions +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_record import CoinRecord +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint32, uint64 +from flax.full_node.bundle_tools import simple_solution_generator +from flax.util.errors import Err +from flax.consensus.cost_calculator import NPCResult MAX_COST = 11000000000 diff --git a/tests/clvm/test_curry_and_treehash.py b/tests/clvm/test_curry_and_treehash.py index b3fd0df99..c01a6ff5b 100644 --- a/tests/clvm/test_curry_and_treehash.py +++ b/tests/clvm/test_curry_and_treehash.py @@ -1,8 +1,8 @@ from __future__ import annotations -from chia.types.blockchain_format.program import Program -from chia.wallet.puzzles import p2_delegated_puzzle_or_hidden_puzzle # import (puzzle_for_pk, puzzle_hash_for_pk, MOD) -from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash +from flax.types.blockchain_format.program import Program +from flax.wallet.puzzles import p2_delegated_puzzle_or_hidden_puzzle # import (puzzle_for_pk, puzzle_hash_for_pk, MOD) +from flax.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash def test_curry_and_treehash() -> None: diff --git a/tests/clvm/test_chialisp_deserialization.py b/tests/clvm/test_flaxlisp_deserialization.py similarity index 93% rename from tests/clvm/test_chialisp_deserialization.py rename to tests/clvm/test_flaxlisp_deserialization.py index 7c1909b4f..f4cbeaf92 100644 --- a/tests/clvm/test_chialisp_deserialization.py +++ b/tests/clvm/test_flaxlisp_deserialization.py @@ -1,10 +1,10 @@ from unittest import TestCase -from chia.types.blockchain_format.program import Program, INFINITE_COST -from chia.util.byte_types import hexstr_to_bytes -from chia.wallet.puzzles.load_clvm import load_clvm +from flax.types.blockchain_format.program import Program, INFINITE_COST +from flax.util.byte_types import hexstr_to_bytes +from flax.wallet.puzzles.load_clvm import load_clvm -DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles") +DESERIALIZE_MOD = load_clvm("flaxlisp_deserialisation.clvm", package_or_requirement="flax.wallet.puzzles") def serialized_atom_overflow(size): diff --git a/tests/clvm/test_program.py b/tests/clvm/test_program.py index 5fb0870ac..313658bc1 100644 --- a/tests/clvm/test_program.py +++ b/tests/clvm/test_program.py @@ -1,6 +1,6 @@ from unittest import TestCase -from chia.types.blockchain_format.program import Program +from flax.types.blockchain_format.program import Program from clvm.EvalError import EvalError from clvm.operators import KEYWORD_TO_ATOM from clvm_tools.binutils import assemble, disassemble diff --git a/tests/clvm/test_puzzle_compression.py b/tests/clvm/test_puzzle_compression.py index de0a4b33d..2aa27231e 100644 --- a/tests/clvm/test_puzzle_compression.py +++ b/tests/clvm/test_puzzle_compression.py @@ -1,22 +1,22 @@ from blspy import G1Element, G2Element from typing import Dict -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.coin import Coin -from chia.types.spend_bundle import SpendBundle -from chia.types.coin_spend import CoinSpend -from chia.util.ints import uint64 -from chia.wallet.trading.offer import OFFER_MOD -from chia.wallet.util.puzzle_compression import ( +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.coin import Coin +from flax.types.spend_bundle import SpendBundle +from flax.types.coin_spend import CoinSpend +from flax.util.ints import uint64 +from flax.wallet.trading.offer import OFFER_MOD +from flax.wallet.util.puzzle_compression import ( LATEST_VERSION, lowest_best_version, compress_object_with_puzzles, decompress_object_with_puzzles, ) -from chia.wallet.cat_wallet.cat_utils import construct_cat_puzzle -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk +from flax.wallet.cat_wallet.cat_utils import construct_cat_puzzle +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk ZERO_32 = bytes32([0] * 32) ONE_32 = bytes32([17] * 32) diff --git a/tests/clvm/test_puzzle_drivers.py b/tests/clvm/test_puzzle_drivers.py index 2ac99d96d..952752863 100644 --- a/tests/clvm/test_puzzle_drivers.py +++ b/tests/clvm/test_puzzle_drivers.py @@ -4,8 +4,8 @@ import pytest -from chia.types.blockchain_format.program import Program -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.types.blockchain_format.program import Program +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver def test_puzzle_info() -> None: diff --git a/tests/clvm/test_puzzles.py b/tests/clvm/test_puzzles.py index 03ace5f0b..d841a5b3d 100644 --- a/tests/clvm/test_puzzles.py +++ b/tests/clvm/test_puzzles.py @@ -5,13 +5,13 @@ from blspy import AugSchemeMPL, BasicSchemeMPL, G1Element, G2Element -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.spend_bundle import SpendBundle -from chia.util.hash import std_hash -from chia.wallet.puzzles import ( +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.spend_bundle import SpendBundle +from flax.util.hash import std_hash +from flax.wallet.puzzles import ( p2_conditions, p2_delegated_conditions, p2_delegated_puzzle, diff --git a/tests/clvm/test_serialized_program.py b/tests/clvm/test_serialized_program.py index e6345c2df..dca1ee565 100644 --- a/tests/clvm/test_serialized_program.py +++ b/tests/clvm/test_serialized_program.py @@ -1,7 +1,7 @@ from unittest import TestCase -from chia.types.blockchain_format.program import Program, SerializedProgram, INFINITE_COST -from chia.wallet.puzzles.load_clvm import load_clvm +from flax.types.blockchain_format.program import Program, SerializedProgram, INFINITE_COST +from flax.wallet.puzzles.load_clvm import load_clvm SHA256TREE_MOD = load_clvm("sha256tree_module.clvm") diff --git a/tests/clvm/test_singletons.py b/tests/clvm/test_singletons.py index 99f50483d..cc0e44eb6 100644 --- a/tests/clvm/test_singletons.py +++ b/tests/clvm/test_singletons.py @@ -4,33 +4,33 @@ from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.coin import Coin -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.spend_bundle import SpendBundle -from chia.util.errors import Err -from chia.util.ints import uint64 -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.puzzles import p2_conditions, p2_delegated_puzzle_or_hidden_puzzle +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.coin import Coin +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.spend_bundle import SpendBundle +from flax.util.errors import Err +from flax.util.ints import uint64 +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.puzzles import p2_conditions, p2_delegated_puzzle_or_hidden_puzzle from tests.util.key_tool import KeyTool from tests.clvm.test_puzzles import ( public_key_for_index, secret_exponent_for_index, ) -from chia.clvm.spend_sim import SpendSim, SimClient +from flax.clvm.spend_sim import SpendSim, SimClient """ This test suite aims to test: - - chia.wallet.puzzles.singleton_top_layer.py - - chia.wallet.puzzles.singleton_top_layer.clvm - - chia.wallet.puzzles.singleton_top_layer_v1_1.py - - chia.wallet.puzzles.singleton_top_layer_v1_1.clvm - - chia.wallet.puzzles.p2_singleton.clvm - - chia.wallet.puzzles.p2_singleton_or_delayed_puzhash.clvm + - flax.wallet.puzzles.singleton_top_layer.py + - flax.wallet.puzzles.singleton_top_layer.clvm + - flax.wallet.puzzles.singleton_top_layer_v1_1.py + - flax.wallet.puzzles.singleton_top_layer_v1_1.clvm + - flax.wallet.puzzles.p2_singleton.clvm + - flax.wallet.puzzles.p2_singleton_or_delayed_puzhash.clvm """ @@ -91,11 +91,11 @@ async def test_singleton_top_layer(self, version): starting_puzzle: Program = p2_delegated_puzzle_or_hidden_puzzle.puzzle_for_pk(pk) # noqa if version == 0: - from chia.wallet.puzzles import singleton_top_layer + from flax.wallet.puzzles import singleton_top_layer adapted_puzzle: Program = singleton_top_layer.adapt_inner_to_singleton(starting_puzzle) # noqa else: - from chia.wallet.puzzles import singleton_top_layer_v1_1 as singleton_top_layer + from flax.wallet.puzzles import singleton_top_layer_v1_1 as singleton_top_layer adapted_puzzle = starting_puzzle adapted_puzzle_hash: bytes32 = adapted_puzzle.get_tree_hash() diff --git a/tests/clvm/test_spend_sim.py b/tests/clvm/test_spend_sim.py index 99fa83d08..ca6664375 100644 --- a/tests/clvm/test_spend_sim.py +++ b/tests/clvm/test_spend_sim.py @@ -2,11 +2,11 @@ from blspy import G2Element -from chia.clvm.spend_sim import SpendSim, SimClient -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.program import Program -from chia.types.spend_bundle import SpendBundle -from chia.types.coin_spend import CoinSpend +from flax.clvm.spend_sim import SpendSim, SimClient +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.program import Program +from flax.types.spend_bundle import SpendBundle +from flax.types.coin_spend import CoinSpend class TestSpendSim: diff --git a/tests/conftest.py b/tests/conftest.py index b13bd4362..22b0bd14a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,25 +8,25 @@ import pytest_asyncio import tempfile -from chia.full_node.full_node_api import FullNodeAPI -from chia.server.server import ChiaServer -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.wallet.wallet import Wallet +from flax.full_node.full_node_api import FullNodeAPI +from flax.server.server import FlaxServer +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.wallet.wallet import Wallet from typing import Any, AsyncIterator, Dict, List, Tuple, Union -from chia.server.start_service import Service +from flax.server.start_service import Service # Set spawn after stdlib imports, but before other imports -from chia.clvm.spend_sim import SimClient, SpendSim -from chia.full_node.full_node_api import FullNodeAPI -from chia.protocols import full_node_protocol -from chia.server.server import ChiaServer -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol - -from chia.types.peer_info import PeerInfo -from chia.util.config import create_default_chia_config, lock_and_load_config -from chia.util.ints import uint16 -from chia.wallet.wallet import Wallet +from flax.clvm.spend_sim import SimClient, SpendSim +from flax.full_node.full_node_api import FullNodeAPI +from flax.protocols import full_node_protocol +from flax.server.server import FlaxServer +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol + +from flax.types.peer_info import PeerInfo +from flax.util.config import create_default_flax_config, lock_and_load_config +from flax.util.ints import uint16 +from flax.wallet.wallet import Wallet from tests.core.node_height import node_height_at_least from tests.setup_nodes import ( setup_simulators_and_wallets, @@ -39,15 +39,15 @@ setup_two_nodes, ) from tests.simulation.test_simulation import test_constants_modified -from chia.simulator.time_out_assert import time_out_assert -from chia.simulator.wallet_tools import WalletTool +from flax.simulator.time_out_assert import time_out_assert +from flax.simulator.wallet_tools import WalletTool from tests.util.wallet_is_synced import wallet_is_synced multiprocessing.set_start_method("spawn") from pathlib import Path -from chia.util.keyring_wrapper import KeyringWrapper -from chia.simulator.block_tools import BlockTools, test_constants, create_block_tools, create_block_tools_async +from flax.util.keyring_wrapper import KeyringWrapper +from flax.simulator.block_tools import BlockTools, test_constants, create_block_tools, create_block_tools_async from tests.util.keyring import TempKeyring from tests.setup_nodes import setup_farmer_multi_harvester @@ -74,7 +74,7 @@ def self_hostname(): # NOTE: -# Instantiating the bt fixture results in an attempt to create the chia root directory +# Instantiating the bt fixture results in an attempt to create the flax root directory # which the build scripts symlink to a sometimes-not-there directory. # When not there, Python complains since, well, the symlink is not a directory nor points to a directory. # @@ -307,7 +307,7 @@ async def two_nodes_sim_and_wallets_services(): @pytest_asyncio.fixture(scope="function") async def wallet_node_sim_and_wallet() -> AsyncIterator[ - Tuple[List[Union[FullNodeAPI, FullNodeSimulator]], List[Tuple[Wallet, ChiaServer]], BlockTools], + Tuple[List[Union[FullNodeAPI, FullNodeSimulator]], List[Tuple[Wallet, FlaxServer]], BlockTools], ]: async for _ in setup_simulators_and_wallets(1, 1, {}): yield _ @@ -341,8 +341,8 @@ async def two_wallet_nodes_services() -> AsyncIterator[Tuple[List[Service], List @pytest_asyncio.fixture(scope="function") -async def two_wallet_nodes_custom_spam_filtering(spam_filter_after_n_txs, xch_spam_amount): - async for _ in setup_simulators_and_wallets(1, 2, {}, spam_filter_after_n_txs, xch_spam_amount): +async def two_wallet_nodes_custom_spam_filtering(spam_filter_after_n_txs, xfx_spam_amount): + async for _ in setup_simulators_and_wallets(1, 2, {}, spam_filter_after_n_txs, xfx_spam_amount): yield _ @@ -440,7 +440,7 @@ async def wallet_and_node(): @pytest_asyncio.fixture(scope="function") -async def one_node_one_block() -> AsyncIterator[Tuple[Union[FullNodeAPI, FullNodeSimulator], ChiaServer, BlockTools]]: +async def one_node_one_block() -> AsyncIterator[Tuple[Union[FullNodeAPI, FullNodeSimulator], FlaxServer, BlockTools]]: async_gen = setup_simulators_and_wallets(1, 0, {}) nodes, _, bt = await async_gen.__anext__() full_node_1 = nodes[0] @@ -662,23 +662,23 @@ async def setup_sim(): @pytest.fixture(scope="function") -def tmp_chia_root(tmp_path): +def tmp_flax_root(tmp_path): """ - Create a temp directory and populate it with an empty chia_root directory. + Create a temp directory and populate it with an empty flax_root directory. """ - path: Path = tmp_path / "chia_root" + path: Path = tmp_path / "flax_root" path.mkdir(parents=True, exist_ok=True) return path @pytest.fixture(scope="function") -def root_path_populated_with_config(tmp_chia_root) -> Path: +def root_path_populated_with_config(tmp_flax_root) -> Path: """ - Create a temp chia_root directory and populate it with a default config.yaml. - Returns the chia_root path. + Create a temp flax_root directory and populate it with a default config.yaml. + Returns the flax_root path. """ - root_path: Path = tmp_chia_root - create_default_chia_config(root_path) + root_path: Path = tmp_flax_root + create_default_flax_config(root_path) return root_path diff --git a/tests/connection_utils.py b/tests/connection_utils.py index f09933d81..0b37a6d61 100644 --- a/tests/connection_utils.py +++ b/tests/connection_utils.py @@ -9,52 +9,52 @@ from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes, serialization -from chia.protocols.shared_protocol import capabilities, protocol_version -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer, ssl_context_for_client -from chia.server.ssl_context import chia_ssl_ca_paths -from chia.server.ws_connection import WSChiaConnection -from chia.simulator.time_out_assert import time_out_assert -from chia.ssl.create_ssl import generate_ca_signed_cert -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.config import load_config -from chia.util.ints import uint16 +from flax.protocols.shared_protocol import capabilities, protocol_version +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer, ssl_context_for_client +from flax.server.ssl_context import flax_ssl_ca_paths +from flax.server.ws_connection import WSFlaxConnection +from flax.simulator.time_out_assert import time_out_assert +from flax.ssl.create_ssl import generate_ca_signed_cert +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.config import load_config +from flax.util.ints import uint16 log = logging.getLogger(__name__) -async def disconnect_all(server: ChiaServer) -> None: +async def disconnect_all(server: FlaxServer) -> None: cons = list(server.all_connections.values())[:] for con in cons: await con.close() -async def disconnect_all_and_reconnect(server: ChiaServer, reconnect_to: ChiaServer, self_hostname: str) -> bool: +async def disconnect_all_and_reconnect(server: FlaxServer, reconnect_to: FlaxServer, self_hostname: str) -> bool: await disconnect_all(server) return await server.start_client(PeerInfo(self_hostname, uint16(reconnect_to._port)), None) async def add_dummy_connection( - server: ChiaServer, self_hostname: str, dummy_port: int, type: NodeType = NodeType.FULL_NODE + server: FlaxServer, self_hostname: str, dummy_port: int, type: NodeType = NodeType.FULL_NODE ) -> Tuple[asyncio.Queue, bytes32]: timeout = aiohttp.ClientTimeout(total=10) session = aiohttp.ClientSession(timeout=timeout) incoming_queue: asyncio.Queue = asyncio.Queue() config = load_config(server.root_path, "config.yaml") - chia_ca_crt_path, chia_ca_key_path = chia_ssl_ca_paths(server.root_path, config) + flax_ca_crt_path, flax_ca_key_path = flax_ssl_ca_paths(server.root_path, config) dummy_crt_path = server.root_path / "dummy.crt" dummy_key_path = server.root_path / "dummy.key" generate_ca_signed_cert( - chia_ca_crt_path.read_bytes(), chia_ca_key_path.read_bytes(), dummy_crt_path, dummy_key_path + flax_ca_crt_path.read_bytes(), flax_ca_key_path.read_bytes(), dummy_crt_path, dummy_key_path ) - ssl_context = ssl_context_for_client(chia_ca_crt_path, chia_ca_key_path, dummy_crt_path, dummy_key_path) + ssl_context = ssl_context_for_client(flax_ca_crt_path, flax_ca_key_path, dummy_crt_path, dummy_key_path) pem_cert = x509.load_pem_x509_certificate(dummy_crt_path.read_bytes(), default_backend()) der_cert = x509.load_der_x509_certificate(pem_cert.public_bytes(serialization.Encoding.DER), default_backend()) peer_id = bytes32(der_cert.fingerprint(hashes.SHA256())) url = f"wss://{self_hostname}:{server._port}/ws" ws = await session.ws_connect(url, autoclose=True, autoping=True, ssl=ssl_context) - wsc = WSChiaConnection( + wsc = WSFlaxConnection( type, ws, server._port, @@ -73,7 +73,7 @@ async def add_dummy_connection( return incoming_queue, peer_id -async def connect_and_get_peer(server_1: ChiaServer, server_2: ChiaServer, self_hostname: str) -> WSChiaConnection: +async def connect_and_get_peer(server_1: FlaxServer, server_2: FlaxServer, self_hostname: str) -> WSFlaxConnection: """ Connect server_2 to server_1, and get return the connection in server_1. """ diff --git a/tests/core/cmds/test_beta.py b/tests/core/cmds/test_beta.py index 981a9e35e..8688e1e8b 100644 --- a/tests/core/cmds/test_beta.py +++ b/tests/core/cmds/test_beta.py @@ -7,10 +7,10 @@ import pytest from click.testing import CliRunner, Result -from chia.cmds.beta_funcs import default_beta_root_path -from chia.cmds.chia import cli -from chia.util.beta_metrics import metrics_log_interval_default, metrics_log_interval_max, metrics_log_interval_min -from chia.util.config import lock_and_load_config, save_config +from flax.cmds.beta_funcs import default_beta_root_path +from flax.cmds.flax import cli +from flax.util.beta_metrics import metrics_log_interval_default, metrics_log_interval_max, metrics_log_interval_min +from flax.util.config import lock_and_load_config, save_config def configure(root_path: Path, *args: str) -> Result: @@ -83,14 +83,14 @@ def generate_example_submission_data(beta_root_path: Path, versions: int, logs: for version in range(versions): version_path = beta_root_path / str(version) version_path.mkdir() - chia_blockchain_logs = version_path / "chia-blockchain" + flax_blockchain_logs = version_path / "flax-blockchain" plotting_logs = version_path / "plotting" - chia_blockchain_logs.mkdir() + flax_blockchain_logs.mkdir() plotting_logs.mkdir() for i in range(logs): - with open(chia_blockchain_logs / f"beta_{i}.log", "w"): + with open(flax_blockchain_logs / f"beta_{i}.log", "w"): pass - with open(chia_blockchain_logs / f"beta_{i + 10}.gz", "w"): + with open(flax_blockchain_logs / f"beta_{i + 10}.gz", "w"): pass with open(plotting_logs / f"plot_{i}.log", "w"): pass @@ -136,7 +136,7 @@ def test_configure_no_beta_config(root_path_populated_with_config: Path) -> None result = configure(root_path, "--path", str(beta_path)) assert result.exit_code == 1 - assert "beta test mode is not enabled, enable it first with `chia beta enable`" in result.output + assert "beta test mode is not enabled, enable it first with `flax beta enable`" in result.output @pytest.mark.parametrize("accept_existing_interval", [True, False]) @@ -347,11 +347,11 @@ def test_prepare_submission( with zipfile.ZipFile(submission_file) as zip_file: all_files = [Path(info.filename) for info in zip_file.filelist] for version in range(versions): - chia_blockchain_logs = Path("chia-blockchain") + flax_blockchain_logs = Path("flax-blockchain") plotting_logs = Path("plotting") for i in range(logs): - assert chia_blockchain_logs / f"beta_{i}.log" in all_files - assert chia_blockchain_logs / f"beta_{i + 10}.gz" in all_files + assert flax_blockchain_logs / f"beta_{i}.log" in all_files + assert flax_blockchain_logs / f"beta_{i + 10}.gz" in all_files assert plotting_logs / f"plot_{i}.log" in all_files diff --git a/tests/core/cmds/test_keys.py b/tests/core/cmds/test_keys.py index b6e5fc983..9e27422e9 100644 --- a/tests/core/cmds/test_keys.py +++ b/tests/core/cmds/test_keys.py @@ -2,12 +2,12 @@ import pytest import re -from chia.cmds.chia import cli -from chia.cmds.keys import delete_all_cmd, generate_and_print_cmd, show_cmd, sign_cmd, verify_cmd -from chia.util.config import load_config -from chia.util.file_keyring import FileKeyring -from chia.util.keychain import KeyData, DEFAULT_USER, DEFAULT_SERVICE, Keychain, generate_mnemonic -from chia.util.keyring_wrapper import DEFAULT_KEYS_ROOT_PATH, KeyringWrapper, LegacyKeyring +from flax.cmds.flax import cli +from flax.cmds.keys import delete_all_cmd, generate_and_print_cmd, show_cmd, sign_cmd, verify_cmd +from flax.util.config import load_config +from flax.util.file_keyring import FileKeyring +from flax.util.keychain import KeyData, DEFAULT_USER, DEFAULT_SERVICE, Keychain, generate_mnemonic +from flax.util.keyring_wrapper import DEFAULT_KEYS_ROOT_PATH, KeyringWrapper, LegacyKeyring from click.testing import CliRunner, Result from keyring.backend import KeyringBackend from pathlib import Path @@ -65,7 +65,7 @@ def delete_password(self, service, username): @pytest.fixture(scope="function") def empty_keyring(): - with TempKeyring(user="user-chia-1.8", service="chia-user-chia-1.8") as keychain: + with TempKeyring(user="user-flax-1.8", service="flax-user-flax-1.8") as keychain: yield keychain KeyringWrapper.cleanup_shared_instance() @@ -121,7 +121,7 @@ class TestKeysCommands: def test_generate_with_new_config(self, tmp_path, empty_keyring): """ Generate a new config and a new key. Verify that the config has - the correct xch_target_address entries. + the correct xfx_target_address entries. """ keychain = empty_keyring @@ -155,19 +155,19 @@ def test_generate_with_new_config(self, tmp_path, empty_keyring): assert result.exit_code == 0 assert len(keychain.get_all_private_keys()) == 1 - # Verify that the config has the correct xch_target_address entries - address_matches = re.findall(r"xch1[^\n]+", result.output) + # Verify that the config has the correct xfx_target_address entries + address_matches = re.findall(r"xfx1[^\n]+", result.output) assert len(address_matches) > 1 address = address_matches[0] config: Dict = load_config(tmp_path, "config.yaml") - assert config["farmer"]["xch_target_address"] == address - assert config["pool"]["xch_target_address"] == address + assert config["farmer"]["xfx_target_address"] == address + assert config["pool"]["xfx_target_address"] == address def test_generate_with_existing_config(self, tmp_path, empty_keyring): """ Generate a new key using an existing config. Verify that the config has - the original xch_target_address entries. + the original xfx_target_address entries. """ keychain = empty_keyring @@ -201,14 +201,14 @@ def test_generate_with_existing_config(self, tmp_path, empty_keyring): assert generate_result.exit_code == 0 assert len(keychain.get_all_private_keys()) == 1 - # Verify that the config has the correct xch_target_address entries - address_matches = re.findall(r"xch1[^\n]+", generate_result.output) + # Verify that the config has the correct xfx_target_address entries + address_matches = re.findall(r"xfx1[^\n]+", generate_result.output) assert len(address_matches) > 1 address = address_matches[0] existing_config: Dict = load_config(tmp_path, "config.yaml") - assert existing_config["farmer"]["xch_target_address"] == address - assert existing_config["pool"]["xch_target_address"] == address + assert existing_config["farmer"]["xfx_target_address"] == address + assert existing_config["pool"]["xfx_target_address"] == address # Generate the second key runner = CliRunner() @@ -229,10 +229,10 @@ def test_generate_with_existing_config(self, tmp_path, empty_keyring): assert result.exit_code == 0 assert len(keychain.get_all_private_keys()) == 2 - # Verify that the config's xch_target_address entries have not changed + # Verify that the config's xfx_target_address entries have not changed config: Dict = load_config(tmp_path, "config.yaml") - assert config["farmer"]["xch_target_address"] == existing_config["farmer"]["xch_target_address"] - assert config["pool"]["xch_target_address"] == existing_config["pool"]["xch_target_address"] + assert config["farmer"]["xfx_target_address"] == existing_config["farmer"]["xfx_target_address"] + assert config["pool"]["xfx_target_address"] == existing_config["pool"]["xfx_target_address"] @pytest.mark.parametrize( "cmd_params, label, input_str", @@ -339,7 +339,7 @@ def test_show_labels(self, empty_keyring, tmp_path): assert runner.invoke(cli, [*base_params, "init"]).exit_code == 0 # Make sure the command works with no keys result = runner.invoke(cli, [*base_params, *cmd_params]) - assert result.output == "No keys are present in the keychain. Generate them with 'chia keys generate'\n" + assert result.output == "No keys are present in the keychain. Generate them with 'flax keys generate'\n" # Add 10 keys to the keychain, give every other a label keys = [KeyData.generate(f"key_{i}" if i % 2 == 0 else None) for i in range(10)] for key in keys: @@ -360,7 +360,7 @@ def test_show_labels(self, empty_keyring, tmp_path): def test_show(self, keyring_with_one_key): """ - Test that the `chia keys show` command shows the correct key. + Test that the `flax keys show` command shows the correct key. """ keychain = keyring_with_one_key @@ -375,7 +375,7 @@ def test_show(self, keyring_with_one_key): def test_show_mnemonic(self, keyring_with_one_key): """ - Test that the `chia keys show --show-mnemonic-seed` command shows the key's mnemonic seed. + Test that the `flax keys show --show-mnemonic-seed` command shows the key's mnemonic seed. """ keychain = keyring_with_one_key @@ -538,7 +538,7 @@ def test_delete_all(self, empty_keyring): def test_generate_and_print(self): """ - Test the `chia keys generate_and_print` command. + Test the `flax keys generate_and_print` command. """ runner = CliRunner() @@ -549,7 +549,7 @@ def test_generate_and_print(self): def test_sign(self, keyring_with_one_key): """ - Test the `chia keys sign` command. + Test the `flax keys sign` command. """ message: str = "hello world" @@ -582,7 +582,7 @@ def test_sign(self, keyring_with_one_key): def test_sign_non_observer(self, keyring_with_one_key): """ - Test the `chia keys sign` command with a non-observer key. + Test the `flax keys sign` command with a non-observer key. """ message: str = "hello world" @@ -654,7 +654,7 @@ def test_sign_mnemonic_seed_file(self, empty_keyring, mnemonic_seed_file): def test_verify(self): """ - Test the `chia keys verify` command. + Test the `flax keys verify` command. """ message: str = "hello world" @@ -675,7 +675,7 @@ def test_verify(self): def test_derive_search(self, tmp_path, keyring_with_one_key): """ - Test the `chia keys derive search` command, searching a public and private key + Test the `flax keys derive search` command, searching a public and private key """ keychain = keyring_with_one_key @@ -734,7 +734,7 @@ def test_derive_search(self, tmp_path, keyring_with_one_key): def test_derive_search_wallet_address(self, tmp_path, keyring_with_one_key): """ - Test the `chia keys derive search` command, searching for a wallet address + Test the `flax keys derive search` command, searching for a wallet address """ keychain = keyring_with_one_key @@ -766,7 +766,7 @@ def test_derive_search_wallet_address(self, tmp_path, keyring_with_one_key): "40", "--search-type", "address", - "xch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd", + "xfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd", ], ) @@ -775,7 +775,7 @@ def test_derive_search_wallet_address(self, tmp_path, keyring_with_one_key): result.output.find( ( "Found wallet address: " - "xch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd (HD path: m/12381/8444/2/30)" + "xfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd (HD path: m/12381/8444/2/30)" ) ) != -1 @@ -783,7 +783,7 @@ def test_derive_search_wallet_address(self, tmp_path, keyring_with_one_key): def test_derive_search_wallet_testnet_address(self, tmp_path, keyring_with_one_key): """ - Test the `chia keys derive search` command, searching for a testnet wallet address + Test the `flax keys derive search` command, searching for a testnet wallet address """ keychain = keyring_with_one_key @@ -815,9 +815,9 @@ def test_derive_search_wallet_testnet_address(self, tmp_path, keyring_with_one_k "40", "--search-type", "address", - "txch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7", + "txfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7", "--prefix", - "txch", + "txfx", ], ) @@ -826,7 +826,7 @@ def test_derive_search_wallet_testnet_address(self, tmp_path, keyring_with_one_k result.output.find( ( "Found wallet address: " - "txch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7 (HD path: m/12381/8444/2/30)" + "txfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7 (HD path: m/12381/8444/2/30)" ) ) != -1 @@ -834,7 +834,7 @@ def test_derive_search_wallet_testnet_address(self, tmp_path, keyring_with_one_k def test_derive_search_failure(self, tmp_path, keyring_with_one_key): """ - Test the `chia keys derive search` command with a failing search. + Test the `flax keys derive search` command with a failing search. """ keychain = keyring_with_one_key @@ -873,7 +873,7 @@ def test_derive_search_failure(self, tmp_path, keyring_with_one_key): def test_derive_search_hd_path(self, tmp_path, empty_keyring, mnemonic_seed_file): """ - Test the `chia keys derive search` command, searching under a provided HD path. + Test the `flax keys derive search` command, searching under a provided HD path. """ keychain = empty_keyring @@ -924,7 +924,7 @@ def test_derive_search_hd_path(self, tmp_path, empty_keyring, mnemonic_seed_file def test_derive_wallet_address(self, tmp_path, keyring_with_one_key): """ - Test the `chia keys derive wallet-address` command, generating a couple of wallet addresses. + Test the `flax keys derive wallet-address` command, generating a couple of wallet addresses. """ keychain = keyring_with_one_key @@ -966,7 +966,7 @@ def test_derive_wallet_address(self, tmp_path, keyring_with_one_key): result.output.find( ( "Wallet address 50 (m/12381n/8444n/2n/50n): " - "xch1jp2u7an0mn9hdlw2x05nmje49gwgzmqyvh0qmh6008yksetuvkfs6wrfdq" + "xfx1jp2u7an0mn9hdlw2x05nmje49gwgzmqyvh0qmh6008yksetuvkfs6wrfdq" ) ) != -1 @@ -975,7 +975,7 @@ def test_derive_wallet_address(self, tmp_path, keyring_with_one_key): result.output.find( ( "Wallet address 51 (m/12381n/8444n/2n/51n): " - "xch1006n6l3x5e8exar8mlj004znjl5pq0tq73h76kz0yergswnjzn8sumvfmt" + "xfx1006n6l3x5e8exar8mlj004znjl5pq0tq73h76kz0yergswnjzn8sumvfmt" ) ) != -1 @@ -983,7 +983,7 @@ def test_derive_wallet_address(self, tmp_path, keyring_with_one_key): def test_derive_wallet_testnet_address(self, tmp_path, keyring_with_one_key): """ - Test the `chia keys derive wallet-address` command, generating a couple of testnet wallet addresses. + Test the `flax keys derive wallet-address` command, generating a couple of testnet wallet addresses. """ keychain = keyring_with_one_key @@ -1018,7 +1018,7 @@ def test_derive_wallet_testnet_address(self, tmp_path, keyring_with_one_key): "--non-observer-derivation", "--show-hd-path", "--prefix", - "txch", + "txfx", ], ) @@ -1027,7 +1027,7 @@ def test_derive_wallet_testnet_address(self, tmp_path, keyring_with_one_key): result.output.find( ( "Wallet address 50 (m/12381n/8444n/2n/50n): " - "txch1jp2u7an0mn9hdlw2x05nmje49gwgzmqyvh0qmh6008yksetuvkfshfylvn" + "txfx1jp2u7an0mn9hdlw2x05nmje49gwgzmqyvh0qmh6008yksetuvkfshfylvn" ) ) != -1 @@ -1036,7 +1036,7 @@ def test_derive_wallet_testnet_address(self, tmp_path, keyring_with_one_key): result.output.find( ( "Wallet address 51 (m/12381n/8444n/2n/51n): " - "txch1006n6l3x5e8exar8mlj004znjl5pq0tq73h76kz0yergswnjzn8s3utl6c" + "txfx1006n6l3x5e8exar8mlj004znjl5pq0tq73h76kz0yergswnjzn8s3utl6c" ) ) != -1 @@ -1044,7 +1044,7 @@ def test_derive_wallet_testnet_address(self, tmp_path, keyring_with_one_key): def test_derive_child_keys(self, tmp_path, keyring_with_one_key): """ - Test the `chia keys derive child-keys` command, generating a couple of derived keys. + Test the `flax keys derive child-keys` command, generating a couple of derived keys. """ keychain = keyring_with_one_key @@ -1123,7 +1123,7 @@ def test_derive_child_keys(self, tmp_path, keyring_with_one_key): def test_migration_not_needed(self, tmp_path, setup_keyringwrapper, monkeypatch): """ - Test the `chia keys migrate` command when no migration is necessary + Test the `flax keys migrate` command when no migration is necessary """ keys_root_path = KeyringWrapper.get_shared_instance().keys_root_path runner = CliRunner() @@ -1153,7 +1153,7 @@ def mock_keychain_needs_migration() -> bool: def test_migration_full(self, tmp_path, setup_legacy_keyringwrapper): """ - Test the `chia keys migrate` command when a full migration is needed + Test the `flax keys migrate` command when a full migration is needed """ legacy_keyring = KeyringWrapper.get_shared_instance().legacy_keyring @@ -1198,7 +1198,7 @@ def mock_get_legacy_keyring_instance() -> Optional[LegacyKeyring]: nonlocal legacy_keyring return legacy_keyring - from chia.util import keyring_wrapper + from flax.util import keyring_wrapper monkeypatch.setattr(keyring_wrapper, "get_legacy_keyring_instance", mock_get_legacy_keyring_instance) diff --git a/tests/core/cmds/test_wallet.py b/tests/core/cmds/test_wallet.py index e60b774ab..53b8acbcb 100644 --- a/tests/core/cmds/test_wallet.py +++ b/tests/core/cmds/test_wallet.py @@ -4,9 +4,9 @@ import pytest -from chia.cmds.wallet_funcs import print_offer_summary -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 +from flax.cmds.wallet_funcs import print_offer_summary +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 TEST_DUCKSAUCE_ASSET_ID = "1000000000000000000000000000000000000000000000000000000000000001" TEST_CRUNCHBERRIES_ASSET_ID = "1000000000000000000000000000000000000000000000000000000000000002" @@ -24,14 +24,14 @@ async def cat_name_resolver(asset_id: bytes32) -> Optional[Tuple[Optional[uint32 @pytest.mark.asyncio -async def test_print_offer_summary_xch(capsys: Any) -> None: - summary_dict = {"xch": 1_000_000_000_000} +async def test_print_offer_summary_xfx(capsys: Any) -> None: + summary_dict = {"xfx": 1_000_000_000_000} await print_offer_summary(cat_name_resolver, summary_dict) captured = capsys.readouterr() - assert "XCH (Wallet ID: 1): 1.0 (1000000000000 mojos)" in captured.out + assert "XFX (Wallet ID: 1): 1.0 (1000000000000 mojos)" in captured.out @pytest.mark.asyncio @@ -63,9 +63,9 @@ async def test_print_offer_summary_multiple_cats(capsys: Any) -> None: @pytest.mark.asyncio -async def test_print_offer_summary_xch_and_cats(capsys: Any) -> None: +async def test_print_offer_summary_xfx_and_cats(capsys: Any) -> None: summary_dict = { - "xch": 2_500_000_000_000, + "xfx": 2_500_000_000_000, TEST_DUCKSAUCE_ASSET_ID: 1_111, TEST_CRUNCHBERRIES_ASSET_ID: 2_222, TEST_UNICORNTEARS_ASSET_ID: 3_333, @@ -75,16 +75,16 @@ async def test_print_offer_summary_xch_and_cats(capsys: Any) -> None: captured = capsys.readouterr() - assert "XCH (Wallet ID: 1): 2.5 (2500000000000 mojos)" in captured.out + assert "XFX (Wallet ID: 1): 2.5 (2500000000000 mojos)" in captured.out assert "DuckSauce (Wallet ID: 2): 1.111 (1111 mojos)" in captured.out assert "CrunchBerries (Wallet ID: 3): 2.222 (2222 mojos)" in captured.out assert "UnicornTears (Wallet ID: 4): 3.333 (3333 mojos)" in captured.out @pytest.mark.asyncio -async def test_print_offer_summary_xch_and_cats_with_zero_values(capsys: Any) -> None: +async def test_print_offer_summary_xfx_and_cats_with_zero_values(capsys: Any) -> None: summary_dict = { - "xch": 0, + "xfx": 0, TEST_DUCKSAUCE_ASSET_ID: 0, TEST_CRUNCHBERRIES_ASSET_ID: 0, TEST_UNICORNTEARS_ASSET_ID: 0, @@ -94,7 +94,7 @@ async def test_print_offer_summary_xch_and_cats_with_zero_values(capsys: Any) -> captured = capsys.readouterr() - assert "XCH (Wallet ID: 1): 0.0 (0 mojos)" in captured.out + assert "XFX (Wallet ID: 1): 0.0 (0 mojos)" in captured.out assert "DuckSauce (Wallet ID: 2): 0.0 (0 mojos)" in captured.out assert "CrunchBerries (Wallet ID: 3): 0.0 (0 mojos)" in captured.out assert "UnicornTears (Wallet ID: 4): 0.0 (0 mojos)" in captured.out @@ -116,11 +116,11 @@ async def test_print_offer_summary_cat_with_fee_and_change(capsys: Any) -> None: @pytest.mark.asyncio -async def test_print_offer_summary_xch_with_one_mojo(capsys: Any) -> None: - summary_dict = {"xch": 1} +async def test_print_offer_summary_xfx_with_one_mojo(capsys: Any) -> None: + summary_dict = {"xfx": 1} await print_offer_summary(cat_name_resolver, summary_dict) captured = capsys.readouterr() - assert "XCH (Wallet ID: 1): 1e-12 (1 mojo)" in captured.out + assert "XFX (Wallet ID: 1): 1e-12 (1 mojo)" in captured.out diff --git a/tests/core/consensus/test_pot_iterations.py b/tests/core/consensus/test_pot_iterations.py index 910538a67..414397845 100644 --- a/tests/core/consensus/test_pot_iterations.py +++ b/tests/core/consensus/test_pot_iterations.py @@ -2,16 +2,16 @@ from pytest import raises -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.consensus.pos_quality import _expected_plot_size -from chia.consensus.pot_iterations import ( +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.consensus.pos_quality import _expected_plot_size +from flax.consensus.pot_iterations import ( calculate_ip_iters, calculate_iterations_quality, calculate_sp_iters, is_overflow_block, ) -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint64 +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint64 test_constants = DEFAULT_CONSTANTS.replace(**{"NUM_SPS_SUB_SLOT": 32, "SUB_SLOT_TIME_TARGET": 300}) diff --git a/tests/core/custom_types/test_coin.py b/tests/core/custom_types/test_coin.py index ca714d133..314300440 100644 --- a/tests/core/custom_types/test_coin.py +++ b/tests/core/custom_types/test_coin.py @@ -1,8 +1,8 @@ from typing import List -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 -from chia.util.hash import std_hash +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 +from flax.util.hash import std_hash import pytest diff --git a/tests/core/custom_types/test_proof_of_space.py b/tests/core/custom_types/test_proof_of_space.py index c201c77fe..d81794793 100644 --- a/tests/core/custom_types/test_proof_of_space.py +++ b/tests/core/custom_types/test_proof_of_space.py @@ -2,8 +2,8 @@ from secrets import token_bytes -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.blockchain_format.proof_of_space import ProofOfSpace # pylint: disable=E0401 +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.blockchain_format.proof_of_space import ProofOfSpace # pylint: disable=E0401 class TestProofOfSpace: diff --git a/tests/core/custom_types/test_spend_bundle.py b/tests/core/custom_types/test_spend_bundle.py index 405ad1dd2..02201b291 100644 --- a/tests/core/custom_types/test_spend_bundle.py +++ b/tests/core/custom_types/test_spend_bundle.py @@ -3,7 +3,7 @@ from blspy import G2Element -from chia.types.spend_bundle import SpendBundle +from flax.types.spend_bundle import SpendBundle BLANK_SPEND_BUNDLE = SpendBundle(coin_spends=[], aggregated_signature=G2Element()) diff --git a/tests/core/daemon/test_daemon.py b/tests/core/daemon/test_daemon.py index 40e021bca..bd7370172 100644 --- a/tests/core/daemon/test_daemon.py +++ b/tests/core/daemon/test_daemon.py @@ -7,17 +7,17 @@ from dataclasses import dataclass, replace from typing import Any, Dict, List, Optional, Type, Union, cast -from chia.daemon.keychain_server import DeleteLabelRequest, SetLabelRequest -from chia.daemon.server import WebSocketServer, service_plotter -from chia.server.outbound_message import NodeType -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16 -from chia.util.keychain import KeyData -from chia.daemon.keychain_server import GetKeyRequest, GetKeyResponse, GetKeysResponse -from chia.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE -from chia.util.ws_message import create_payload +from flax.daemon.keychain_server import DeleteLabelRequest, SetLabelRequest +from flax.daemon.server import WebSocketServer, service_plotter +from flax.server.outbound_message import NodeType +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16 +from flax.util.keychain import KeyData +from flax.daemon.keychain_server import GetKeyRequest, GetKeyResponse, GetKeysResponse +from flax.util.keyring_wrapper import DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE +from flax.util.ws_message import create_payload from tests.core.node_height import node_height_at_least -from chia.simulator.time_out_assert import time_out_assert_custom_interval, time_out_assert +from flax.simulator.time_out_assert import time_out_assert_custom_interval, time_out_assert # Simple class that responds to a poll() call used by WebSocketServer.is_running() @@ -154,7 +154,7 @@ def mock_daemon_with_services(): "my_refrigerator": Service(True), "the_river": Service(True), "your_nose": Service(False), - "chia_plotter": [Service(True), Service(True)], + "flax_plotter": [Service(True), Service(True)], }, connections={}, ) @@ -166,7 +166,7 @@ def mock_daemon_with_services_and_connections(): return Daemon( services={ "my_refrigerator": Service(True), - "chia_plotter": [Service(True), Service(True)], + "flax_plotter": [Service(True), Service(True)], "apple": Service(True), }, connections={ @@ -228,7 +228,7 @@ async def reader(ws, queue): read_handler = asyncio.create_task(reader(ws, message_queue)) data = {} - payload = create_payload("get_blockchain_state", data, service_name, "chia_full_node") + payload = create_payload("get_blockchain_state", data, service_name, "flax_full_node") await ws.send_str(payload) await asyncio.sleep(5) diff --git a/tests/core/data_layer/conftest.py b/tests/core/data_layer/conftest.py index d1b60614a..d783bf109 100644 --- a/tests/core/data_layer/conftest.py +++ b/tests/core/data_layer/conftest.py @@ -16,11 +16,11 @@ # https://github.com/pytest-dev/pytest/issues/7469 from _pytest.fixtures import SubRequest -from chia.data_layer.data_layer_util import NodeType, Status -from chia.data_layer.data_store import DataStore -from chia.types.blockchain_format.tree_hash import bytes32 +from flax.data_layer.data_layer_util import NodeType, Status +from flax.data_layer.data_store import DataStore +from flax.types.blockchain_format.tree_hash import bytes32 from tests.core.data_layer.util import ( - ChiaRoot, + FlaxRoot, Example, add_0123_example, add_01234567_example, @@ -41,9 +41,9 @@ def scripts_path_fixture() -> pathlib.Path: return pathlib.Path(scripts_string) -@pytest.fixture(name="chia_root", scope="function") -def chia_root_fixture(tmp_path: pathlib.Path, scripts_path: pathlib.Path) -> ChiaRoot: - root = ChiaRoot(path=tmp_path.joinpath("chia_root"), scripts_path=scripts_path) +@pytest.fixture(name="flax_root", scope="function") +def flax_root_fixture(tmp_path: pathlib.Path, scripts_path: pathlib.Path) -> FlaxRoot: + root = FlaxRoot(path=tmp_path.joinpath("flax_root"), scripts_path=scripts_path) root.run(args=["init"]) root.run(args=["configure", "--set-log-level", "INFO"]) @@ -51,8 +51,8 @@ def chia_root_fixture(tmp_path: pathlib.Path, scripts_path: pathlib.Path) -> Chi @contextlib.contextmanager -def closing_chia_root_popen(chia_root: ChiaRoot, args: List[str]) -> Iterator[None]: - environment = {**os.environ, "CHIA_ROOT": os.fspath(chia_root.path)} +def closing_flax_root_popen(flax_root: FlaxRoot, args: List[str]) -> Iterator[None]: + environment = {**os.environ, "FLAX_ROOT": os.fspath(flax_root.path)} with subprocess.Popen(args=args, env=environment) as process: try: @@ -65,18 +65,18 @@ def closing_chia_root_popen(chia_root: ChiaRoot, args: List[str]) -> Iterator[No process.kill() -@pytest.fixture(name="chia_daemon", scope="function") -def chia_daemon_fixture(chia_root: ChiaRoot) -> Iterator[None]: - with closing_chia_root_popen(chia_root=chia_root, args=[sys.executable, "-m", "chia.daemon.server"]): +@pytest.fixture(name="flax_daemon", scope="function") +def flax_daemon_fixture(flax_root: FlaxRoot) -> Iterator[None]: + with closing_flax_root_popen(flax_root=flax_root, args=[sys.executable, "-m", "flax.daemon.server"]): # TODO: this is not pretty as a hard coded time # let it settle time.sleep(5) yield -@pytest.fixture(name="chia_data", scope="function") -def chia_data_fixture(chia_root: ChiaRoot, chia_daemon: None, scripts_path: pathlib.Path) -> Iterator[None]: - with closing_chia_root_popen(chia_root=chia_root, args=[os.fspath(scripts_path.joinpath("chia_data_layer"))]): +@pytest.fixture(name="flax_data", scope="function") +def flax_data_fixture(flax_root: FlaxRoot, flax_daemon: None, scripts_path: pathlib.Path) -> Iterator[None]: + with closing_flax_root_popen(flax_root=flax_root, args=[os.fspath(scripts_path.joinpath("flax_data_layer"))]): # TODO: this is not pretty as a hard coded time # let it settle time.sleep(5) diff --git a/tests/core/data_layer/test_data_cli.py b/tests/core/data_layer/test_data_cli.py index 28e58fe4a..ce752ea46 100644 --- a/tests/core/data_layer/test_data_cli.py +++ b/tests/core/data_layer/test_data_cli.py @@ -5,27 +5,27 @@ import pytest -from tests.core.data_layer.util import ChiaRoot +from tests.core.data_layer.util import FlaxRoot pytestmark = pytest.mark.data_layer @pytest.mark.asyncio -async def test_help(chia_root: ChiaRoot) -> None: +async def test_help(flax_root: FlaxRoot) -> None: """Just a trivial test to make sure the subprocessing is at least working and the data executable does run. """ - completed_process = chia_root.run(args=["data", "--help"]) + completed_process = flax_root.run(args=["data", "--help"]) assert "Show this message and exit" in completed_process.stdout @pytest.mark.xfail(strict=True) @pytest.mark.asyncio -def test_round_trip(chia_root: ChiaRoot, chia_daemon: None, chia_data: None) -> None: +def test_round_trip(flax_root: FlaxRoot, flax_daemon: None, flax_data: None) -> None: """Create a table, insert a row, get the row by its hash.""" - with chia_root.print_log_after(): - create = chia_root.run(args=["data", "create_data_store"]) + with flax_root.print_log_after(): + create = flax_root.run(args=["data", "create_data_store"]) print(f"create_data_store: {create}") dic = json.loads(create.stdout) assert dic["success"] @@ -34,24 +34,24 @@ def test_round_trip(chia_root: ChiaRoot, chia_daemon: None, chia_data: None) -> value = "ffff8353594d8083616263" changelist: List[Dict[str, str]] = [{"action": "insert", "key": key, "value": value}] print(json.dumps(changelist)) - update = chia_root.run( + update = flax_root.run( args=["data", "update_data_store", "--id", tree_id, "--changelist", json.dumps(changelist)] ) dic = json.loads(create.stdout) assert dic["success"] print(f"update_data_store: {update}") - completed_process = chia_root.run(args=["data", "get_value", "--id", tree_id, "--key", key]) + completed_process = flax_root.run(args=["data", "get_value", "--id", tree_id, "--key", key]) parsed = json.loads(completed_process.stdout) expected = {"value": value, "success": True} assert parsed == expected - get_keys_values = chia_root.run(args=["data", "get_keys_values", "--id", tree_id]) + get_keys_values = flax_root.run(args=["data", "get_keys_values", "--id", tree_id]) print(f"get_keys_values: {get_keys_values}") changelist = [{"action": "delete", "key": key}] - update = chia_root.run( + update = flax_root.run( args=["data", "update_data_store", "--id", tree_id, "--changelist", json.dumps(changelist)] ) print(f"update_data_store: {update}") - completed_process = chia_root.run(args=["data", "get_value", "--id", tree_id, "--key", key]) + completed_process = flax_root.run(args=["data", "get_value", "--id", tree_id, "--key", key]) parsed = json.loads(completed_process.stdout) expected = {"data": None, "success": True} assert parsed == expected diff --git a/tests/core/data_layer/test_data_layer_util.py b/tests/core/data_layer/test_data_layer_util.py index 8689d4a27..8aa7d79d4 100644 --- a/tests/core/data_layer/test_data_layer_util.py +++ b/tests/core/data_layer/test_data_layer_util.py @@ -8,8 +8,8 @@ # TODO: update after resolution in https://github.com/pytest-dev/pytest/issues/7469 from _pytest.fixtures import SubRequest -from chia.data_layer.data_layer_util import ProofOfInclusion, ProofOfInclusionLayer, Side -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.data_layer.data_layer_util import ProofOfInclusion, ProofOfInclusionLayer, Side +from flax.types.blockchain_format.sized_bytes import bytes32 pytestmark = pytest.mark.data_layer diff --git a/tests/core/data_layer/test_data_rpc.py b/tests/core/data_layer/test_data_rpc.py index 69579f2b8..846e1053e 100644 --- a/tests/core/data_layer/test_data_rpc.py +++ b/tests/core/data_layer/test_data_rpc.py @@ -10,28 +10,28 @@ import pytest import pytest_asyncio -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.data_layer.data_layer import DataLayer -from chia.data_layer.data_layer_errors import OfferIntegrityError -from chia.data_layer.data_layer_util import OfferStore, StoreProofs -from chia.data_layer.data_layer_wallet import DataLayerWallet, verify_offer -from chia.rpc.data_layer_rpc_api import DataLayerRpcApi -from chia.rpc.wallet_rpc_api import WalletRpcApi -from chia.server.start_data_layer import create_data_layer_service -from chia.server.start_service import Service -from chia.simulator.block_tools import BlockTools -from chia.simulator.full_node_simulator import FullNodeSimulator, backoff_times -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import save_config -from chia.util.ints import uint16, uint32 -from chia.wallet.trading.offer import Offer as TradingOffer -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_node import WalletNode +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.data_layer.data_layer import DataLayer +from flax.data_layer.data_layer_errors import OfferIntegrityError +from flax.data_layer.data_layer_util import OfferStore, StoreProofs +from flax.data_layer.data_layer_wallet import DataLayerWallet, verify_offer +from flax.rpc.data_layer_rpc_api import DataLayerRpcApi +from flax.rpc.wallet_rpc_api import WalletRpcApi +from flax.server.start_data_layer import create_data_layer_service +from flax.server.start_service import Service +from flax.simulator.block_tools import BlockTools +from flax.simulator.full_node_simulator import FullNodeSimulator, backoff_times +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import save_config +from flax.util.ints import uint16, uint32 +from flax.wallet.trading.offer import Offer as TradingOffer +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_node import WalletNode from tests.setup_nodes import SimulatorsAndWalletsServices from tests.util.wallet_is_synced import wallet_is_synced diff --git a/tests/core/data_layer/test_data_store.py b/tests/core/data_layer/test_data_store.py index 6d5342322..670186e6e 100644 --- a/tests/core/data_layer/test_data_store.py +++ b/tests/core/data_layer/test_data_store.py @@ -9,8 +9,8 @@ import pytest -from chia.data_layer.data_layer_errors import NodeHashError, TreeGenerationIncrementingError -from chia.data_layer.data_layer_util import ( +from flax.data_layer.data_layer_errors import NodeHashError, TreeGenerationIncrementingError +from flax.data_layer.data_layer_util import ( DiffData, InternalNode, NodeType, @@ -26,18 +26,18 @@ _debug_dump, leaf_hash, ) -from chia.data_layer.data_store import DataStore -from chia.data_layer.download_data import ( +from flax.data_layer.data_store import DataStore +from flax.data_layer.download_data import ( get_delta_filename, get_full_tree_filename, insert_into_data_store_from_file, is_filename_valid, write_files_for_root, ) -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.tree_hash import bytes32 -from chia.util.byte_types import hexstr_to_bytes -from chia.util.db_wrapper import DBWrapper2 +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.tree_hash import bytes32 +from flax.util.byte_types import hexstr_to_bytes +from flax.util.db_wrapper import DBWrapper2 from tests.core.data_layer.util import Example, add_0123_example, add_01234567_example log = logging.getLogger(__name__) diff --git a/tests/core/data_layer/test_data_store_schema.py b/tests/core/data_layer/test_data_store_schema.py index 705c28745..21c84aad9 100644 --- a/tests/core/data_layer/test_data_store_schema.py +++ b/tests/core/data_layer/test_data_store_schema.py @@ -5,9 +5,9 @@ import pytest -from chia.data_layer.data_layer_util import NodeType, Side, Status -from chia.data_layer.data_store import DataStore -from chia.types.blockchain_format.tree_hash import bytes32 +from flax.data_layer.data_layer_util import NodeType, Side, Status +from flax.data_layer.data_store import DataStore +from flax.types.blockchain_format.tree_hash import bytes32 from tests.core.data_layer.util import add_01234567_example, create_valid_node_values pytestmark = pytest.mark.data_layer diff --git a/tests/core/data_layer/util.py b/tests/core/data_layer/util.py index 62543e232..9c42529db 100644 --- a/tests/core/data_layer/util.py +++ b/tests/core/data_layer/util.py @@ -8,10 +8,10 @@ from dataclasses import dataclass from typing import IO, TYPE_CHECKING, Any, Dict, Iterator, List, Optional, Union -from chia.data_layer.data_layer_util import NodeType, Side, Status -from chia.data_layer.data_store import DataStore -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.tree_hash import bytes32 +from flax.data_layer.data_layer_util import NodeType, Side, Status +from flax.data_layer.data_store import DataStore +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.tree_hash import bytes32 # from subprocess.pyi _FILE = Union[None, int, IO[Any]] @@ -117,7 +117,7 @@ async def add_01234567_example(data_store: DataStore, tree_id: bytes32) -> Examp @dataclass -class ChiaRoot: +class FlaxRoot: path: pathlib.Path scripts_path: pathlib.Path @@ -133,15 +133,15 @@ def run( ) -> subprocess_CompletedProcess_str: # TODO: --root-path doesn't seem to work here... kwargs.setdefault("env", {}) - kwargs["env"]["CHIA_ROOT"] = os.fspath(self.path) - kwargs["env"]["CHIA_KEYS_ROOT"] = os.fspath(self.path) + kwargs["env"]["FLAX_ROOT"] = os.fspath(self.path) + kwargs["env"]["FLAX_KEYS_ROOT"] = os.fspath(self.path) # This is for windows if "SYSTEMROOT" in os.environ: kwargs["env"]["SYSTEMROOT"] = os.environ["SYSTEMROOT"] modified_args: List[Union[str, os_PathLike_str]] = [ - self.scripts_path.joinpath("chia"), + self.scripts_path.joinpath("flax"), "--root-path", self.path, *args, diff --git a/tests/core/full_node/full_sync/test_full_sync.py b/tests/core/full_node/full_sync/test_full_sync.py index c74c782d2..be8b4999d 100644 --- a/tests/core/full_node/full_sync/test_full_sync.py +++ b/tests/core/full_node/full_sync/test_full_sync.py @@ -7,15 +7,15 @@ import pytest -from chia.protocols import full_node_protocol -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.full_block import FullBlock -from chia.types.peer_info import PeerInfo -from chia.util.hash import std_hash -from chia.util.ints import uint16 +from flax.protocols import full_node_protocol +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.full_block import FullBlock +from flax.types.peer_info import PeerInfo +from flax.util.hash import std_hash +from flax.util.ints import uint16 from tests.core.node_height import node_height_exactly, node_height_between from tests.setup_nodes import test_constants -from chia.simulator.time_out_assert import time_out_assert +from flax.simulator.time_out_assert import time_out_assert log = logging.getLogger(__name__) diff --git a/tests/core/full_node/ram_db.py b/tests/core/full_node/ram_db.py index de5aca5f9..affa25aa4 100644 --- a/tests/core/full_node/ram_db.py +++ b/tests/core/full_node/ram_db.py @@ -3,11 +3,11 @@ import random -from chia.consensus.blockchain import Blockchain -from chia.consensus.constants import ConsensusConstants -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.util.db_wrapper import DBWrapper2 +from flax.consensus.blockchain import Blockchain +from flax.consensus.constants import ConsensusConstants +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.util.db_wrapper import DBWrapper2 async def create_ram_blockchain(consensus_constants: ConsensusConstants) -> Tuple[DBWrapper2, Blockchain]: diff --git a/tests/core/full_node/stores/test_block_store.py b/tests/core/full_node/stores/test_block_store.py index c4ee53155..57a67f9fa 100644 --- a/tests/core/full_node/stores/test_block_store.py +++ b/tests/core/full_node/stores/test_block_store.py @@ -1,6 +1,6 @@ import asyncio -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock import logging import random import sqlite3 @@ -9,14 +9,14 @@ import pytest from clvm.casts import int_to_bytes -from chia.consensus.blockchain import Blockchain -from chia.consensus.full_block_to_block_record import header_block_to_sub_block_record -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.util.ints import uint8 -from chia.types.blockchain_format.vdf import VDFProof -from chia.types.blockchain_format.program import SerializedProgram +from flax.consensus.blockchain import Blockchain +from flax.consensus.full_block_to_block_record import header_block_to_sub_block_record +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.util.ints import uint8 +from flax.types.blockchain_format.vdf import VDFProof +from flax.types.blockchain_format.program import SerializedProgram from tests.blockchain.blockchain_test_utils import _validate_and_add_block from tests.util.db_connection import DBConnection from tests.setup_nodes import test_constants diff --git a/tests/core/full_node/stores/test_coin_store.py b/tests/core/full_node/stores/test_coin_store.py index 53e798007..9ef7c19be 100644 --- a/tests/core/full_node/stores/test_coin_store.py +++ b/tests/core/full_node/stores/test_coin_store.py @@ -3,23 +3,23 @@ import pytest -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.consensus.blockchain import Blockchain, ReceiveBlockResult -from chia.consensus.coinbase import create_farmer_coin, create_pool_coin -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.types.blockchain_format.coin import Coin -from chia.types.coin_record import CoinRecord -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.util.generator_tools import tx_removals_and_additions -from chia.util.hash import std_hash -from chia.util.ints import uint64, uint32 +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.consensus.blockchain import Blockchain, ReceiveBlockResult +from flax.consensus.coinbase import create_farmer_coin, create_pool_coin +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.blockchain_format.coin import Coin +from flax.types.coin_record import CoinRecord +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.util.generator_tools import tx_removals_and_additions +from flax.util.hash import std_hash +from flax.util.ints import uint64, uint32 from tests.blockchain.blockchain_test_utils import _validate_and_add_block -from chia.simulator.wallet_tools import WalletTool +from flax.simulator.wallet_tools import WalletTool from tests.setup_nodes import test_constants -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sized_bytes import bytes32 from tests.util.db_connection import DBConnection constants = test_constants diff --git a/tests/core/full_node/stores/test_full_node_store.py b/tests/core/full_node/stores/test_full_node_store.py index 10be349f9..2ddbf637a 100644 --- a/tests/core/full_node/stores/test_full_node_store.py +++ b/tests/core/full_node/stores/test_full_node_store.py @@ -5,20 +5,20 @@ import pytest import pytest_asyncio -from chia.consensus.blockchain import ReceiveBlockResult -from chia.consensus.find_fork_point import find_fork_point_in_chain -from chia.consensus.multiprocess_validation import PreValidationResult -from chia.consensus.pot_iterations import is_overflow_block -from chia.full_node.full_node_store import FullNodeStore -from chia.full_node.signage_point import SignagePoint -from chia.protocols import timelord_protocol -from chia.protocols.timelord_protocol import NewInfusionPointVDF -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.block_cache import BlockCache -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint32, uint64, uint128 -from chia.simulator.block_tools import get_signage_point, create_block_tools_async +from flax.consensus.blockchain import ReceiveBlockResult +from flax.consensus.find_fork_point import find_fork_point_in_chain +from flax.consensus.multiprocess_validation import PreValidationResult +from flax.consensus.pot_iterations import is_overflow_block +from flax.full_node.full_node_store import FullNodeStore +from flax.full_node.signage_point import SignagePoint +from flax.protocols import timelord_protocol +from flax.protocols.timelord_protocol import NewInfusionPointVDF +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.block_cache import BlockCache +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint32, uint64, uint128 +from flax.simulator.block_tools import get_signage_point, create_block_tools_async from tests.blockchain.blockchain_test_utils import ( _validate_and_add_block, _validate_and_add_block_no_error, diff --git a/tests/core/full_node/stores/test_hint_store.py b/tests/core/full_node/stores/test_hint_store.py index acb1dc23f..33569b637 100644 --- a/tests/core/full_node/stores/test_hint_store.py +++ b/tests/core/full_node/stores/test_hint_store.py @@ -2,16 +2,16 @@ import pytest from clvm.casts import int_to_bytes -from chia.full_node.hint_store import HintStore -from chia.protocols.full_node_protocol import RespondBlock -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint64 +from flax.full_node.hint_store import HintStore +from flax.protocols.full_node_protocol import RespondBlock +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint64 from tests.util.db_connection import DBConnection -from chia.simulator.wallet_tools import WalletTool +from flax.simulator.wallet_tools import WalletTool log = logging.getLogger(__name__) diff --git a/tests/core/full_node/stores/test_sync_store.py b/tests/core/full_node/stores/test_sync_store.py index e9ea0f27c..61010af24 100644 --- a/tests/core/full_node/stores/test_sync_store.py +++ b/tests/core/full_node/stores/test_sync_store.py @@ -2,8 +2,8 @@ import pytest -from chia.full_node.sync_store import SyncStore -from chia.util.hash import std_hash +from flax.full_node.sync_store import SyncStore +from flax.util.hash import std_hash class TestStore: diff --git a/tests/core/full_node/test_address_manager.py b/tests/core/full_node/test_address_manager.py index 3dd311ce4..013d8a545 100644 --- a/tests/core/full_node/test_address_manager.py +++ b/tests/core/full_node/test_address_manager.py @@ -6,10 +6,10 @@ import pytest -from chia.server.address_manager import AddressManager, ExtendedPeerInfo -from chia.server.address_manager_store import AddressManagerStore -from chia.types.peer_info import PeerInfo, TimestampedPeerInfo -from chia.util.ints import uint16, uint64 +from flax.server.address_manager import AddressManager, ExtendedPeerInfo +from flax.server.address_manager_store import AddressManagerStore +from flax.types.peer_info import PeerInfo, TimestampedPeerInfo +from flax.util.ints import uint16, uint64 class AddressManagerTest(AddressManager): diff --git a/tests/core/full_node/test_block_height_map.py b/tests/core/full_node/test_block_height_map.py index 55d98ad24..e06cbcfae 100644 --- a/tests/core/full_node/test_block_height_map.py +++ b/tests/core/full_node/test_block_height_map.py @@ -1,14 +1,14 @@ import pytest import struct -from chia.full_node.block_height_map import BlockHeightMap, SesCache -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.util.db_wrapper import DBWrapper2 +from flax.full_node.block_height_map import BlockHeightMap, SesCache +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.util.db_wrapper import DBWrapper2 from tests.util.db_connection import DBConnection -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sized_bytes import bytes32 from typing import Optional -from chia.util.ints import uint8 -from chia.util.files import write_file_async +from flax.util.ints import uint8 +from flax.util.files import write_file_async def gen_block_hash(height: int) -> bytes32: diff --git a/tests/core/full_node/test_conditions.py b/tests/core/full_node/test_conditions.py index 97e88cac5..628abd3ae 100644 --- a/tests/core/full_node/test_conditions.py +++ b/tests/core/full_node/test_conditions.py @@ -14,16 +14,16 @@ from clvm_tools.binutils import assemble -from chia.types.announcement import Announcement -from chia.types.blockchain_format.program import Program -from chia.types.coin_record import CoinRecord -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.full_block import FullBlock -from chia.types.spend_bundle import SpendBundle -from chia.util.errors import Err -from chia.util.ints import uint32 -from chia.simulator.block_tools import BlockTools +from flax.types.announcement import Announcement +from flax.types.blockchain_format.program import Program +from flax.types.coin_record import CoinRecord +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.full_block import FullBlock +from flax.types.spend_bundle import SpendBundle +from flax.util.errors import Err +from flax.util.ints import uint32 +from flax.simulator.block_tools import BlockTools from tests.util.keyring import TempKeyring from .ram_db import create_ram_blockchain diff --git a/tests/core/full_node/test_full_node.py b/tests/core/full_node/test_full_node.py index 33bf90c1d..3cc63d2b9 100644 --- a/tests/core/full_node/test_full_node.py +++ b/tests/core/full_node/test_full_node.py @@ -9,37 +9,37 @@ from blspy import G2Element, AugSchemeMPL, PrivateKey from clvm.casts import int_to_bytes -from chia.consensus.pot_iterations import is_overflow_block -from chia.full_node.bundle_tools import detect_potential_template_generator -from chia.full_node.full_node_api import FullNodeAPI -from chia.full_node.signage_point import SignagePoint -from chia.protocols import full_node_protocol as fnp, full_node_protocol, wallet_protocol -from chia.protocols import timelord_protocol -from chia.protocols.full_node_protocol import RespondTransaction -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.wallet_protocol import SendTransaction, TransactionAck -from chia.server.address_manager import AddressManager -from chia.server.outbound_message import Message, NodeType -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.types.blockchain_format.classgroup import ClassgroupElement -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.vdf import CompressibleVDFField, VDFProof -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.full_block import FullBlock -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.peer_info import PeerInfo, TimestampedPeerInfo -from chia.types.spend_bundle import SpendBundle -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.errors import Err -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint16, uint32, uint64 -from chia.util.recursive_replace import recursive_replace -from chia.util.vdf_prover import get_vdf_info_and_proof -from chia.util.errors import ConsensusError -from chia.wallet.transaction_record import TransactionRecord -from chia.simulator.block_tools import get_signage_point +from flax.consensus.pot_iterations import is_overflow_block +from flax.full_node.bundle_tools import detect_potential_template_generator +from flax.full_node.full_node_api import FullNodeAPI +from flax.full_node.signage_point import SignagePoint +from flax.protocols import full_node_protocol as fnp, full_node_protocol, wallet_protocol +from flax.protocols import timelord_protocol +from flax.protocols.full_node_protocol import RespondTransaction +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.wallet_protocol import SendTransaction, TransactionAck +from flax.server.address_manager import AddressManager +from flax.server.outbound_message import Message, NodeType +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.vdf import CompressibleVDFField, VDFProof +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.full_block import FullBlock +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.peer_info import PeerInfo, TimestampedPeerInfo +from flax.types.spend_bundle import SpendBundle +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.errors import Err +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint16, uint32, uint64 +from flax.util.recursive_replace import recursive_replace +from flax.util.vdf_prover import get_vdf_info_and_proof +from flax.util.errors import ConsensusError +from flax.wallet.transaction_record import TransactionRecord +from flax.simulator.block_tools import get_signage_point from tests.blockchain.blockchain_test_utils import ( _validate_and_add_block, _validate_and_add_block_no_error, @@ -51,10 +51,10 @@ from tests.core.make_block_generator import make_spend_bundle from tests.core.node_height import node_height_at_least from tests.setup_nodes import test_constants -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_custom_interval, time_out_messages -from chia.types.blockchain_format.foliage import Foliage, TransactionsInfo, FoliageTransactionBlock -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_custom_interval, time_out_messages +from flax.types.blockchain_format.foliage import Foliage, TransactionsInfo, FoliageTransactionBlock +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished async def new_transaction_not_requested(incoming, new_spend): diff --git a/tests/core/full_node/test_generator_tools.py b/tests/core/full_node/test_generator_tools.py index 00acd867b..d82883351 100644 --- a/tests/core/full_node/test_generator_tools.py +++ b/tests/core/full_node/test_generator_tools.py @@ -2,12 +2,12 @@ from typing import List -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.spend_bundle_conditions import Spend, SpendBundleConditions -from chia.util.generator_tools import tx_removals_and_additions -from chia.util.hash import std_hash -from chia.util.ints import uint32, uint64 +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.spend_bundle_conditions import Spend, SpendBundleConditions +from flax.util.generator_tools import tx_removals_and_additions +from flax.util.hash import std_hash +from flax.util.ints import uint32, uint64 coin_ids = [std_hash(i.to_bytes(4, "big")) for i in range(10)] phs = [std_hash(i.to_bytes(4, "big")) for i in range(10)] diff --git a/tests/core/full_node/test_hint_management.py b/tests/core/full_node/test_hint_management.py index 1be25e054..fc1f741c7 100644 --- a/tests/core/full_node/test_hint_management.py +++ b/tests/core/full_node/test_hint_management.py @@ -4,16 +4,16 @@ import pytest -from chia.consensus.block_record import BlockRecord -from chia.consensus.blockchain import Blockchain, StateChangeSummary -from chia.consensus.cost_calculator import NPCResult -from chia.full_node.hint_management import get_hints_and_subscription_coin_ids -from chia.simulator.block_tools import BlockTools -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.spend_bundle_conditions import Spend, SpendBundleConditions -from chia.util.hash import std_hash -from chia.util.ints import uint32, uint64 +from flax.consensus.block_record import BlockRecord +from flax.consensus.blockchain import Blockchain, StateChangeSummary +from flax.consensus.cost_calculator import NPCResult +from flax.full_node.hint_management import get_hints_and_subscription_coin_ids +from flax.simulator.block_tools import BlockTools +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.spend_bundle_conditions import Spend, SpendBundleConditions +from flax.util.hash import std_hash +from flax.util.ints import uint32, uint64 from tests.blockchain.blockchain_test_utils import _validate_and_add_block coin_ids = [std_hash(i.to_bytes(4, "big")) for i in range(10)] diff --git a/tests/core/full_node/test_mempool.py b/tests/core/full_node/test_mempool.py index 8d4fb8ab4..f6e1b1e59 100644 --- a/tests/core/full_node/test_mempool.py +++ b/tests/core/full_node/test_mempool.py @@ -6,48 +6,48 @@ from clvm.casts import int_to_bytes import pytest -import chia.server.ws_connection as ws - -from chia.full_node.mempool import Mempool -from chia.full_node.full_node_api import FullNodeAPI -from chia.protocols import full_node_protocol, wallet_protocol -from chia.protocols.wallet_protocol import TransactionAck -from chia.server.outbound_message import Message -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32, bytes48 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.spend_bundle import SpendBundle -from chia.types.mempool_item import MempoolItem -from chia.util.condition_tools import conditions_for_solution, pkm_pairs -from chia.util.errors import Err -from chia.util.ints import uint64, uint32 -from chia.util.hash import std_hash -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.util.api_decorators import api_request, peer_required, bytes_required -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.full_node.pending_tx_cache import PendingTxCache +import flax.server.ws_connection as ws + +from flax.full_node.mempool import Mempool +from flax.full_node.full_node_api import FullNodeAPI +from flax.protocols import full_node_protocol, wallet_protocol +from flax.protocols.wallet_protocol import TransactionAck +from flax.server.outbound_message import Message +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32, bytes48 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.spend_bundle import SpendBundle +from flax.types.mempool_item import MempoolItem +from flax.util.condition_tools import conditions_for_solution, pkm_pairs +from flax.util.errors import Err +from flax.util.ints import uint64, uint32 +from flax.util.hash import std_hash +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.util.api_decorators import api_request, peer_required, bytes_required +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.full_node.pending_tx_cache import PendingTxCache from blspy import G2Element -from chia.util.recursive_replace import recursive_replace +from flax.util.recursive_replace import recursive_replace from tests.blockchain.blockchain_test_utils import _validate_and_add_block from tests.connection_utils import connect_and_get_peer, add_dummy_connection from tests.core.node_height import node_height_at_least -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.program import Program, INFINITE_COST -from chia.consensus.cost_calculator import NPCResult -from chia.consensus.condition_costs import ConditionCost -from chia.types.blockchain_format.program import SerializedProgram +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.program import Program, INFINITE_COST +from flax.consensus.cost_calculator import NPCResult +from flax.consensus.condition_costs import ConditionCost +from flax.types.blockchain_format.program import SerializedProgram from clvm_tools import binutils -from chia.types.generator_types import BlockGenerator +from flax.types.generator_types import BlockGenerator from blspy import G1Element -from chia.types.spend_bundle_conditions import SpendBundleConditions, Spend +from flax.types.spend_bundle_conditions import SpendBundleConditions, Spend from tests.util.misc import assert_runtime -from chia.simulator.wallet_tools import WalletTool +from flax.simulator.wallet_tools import WalletTool BURN_PUZZLE_HASH = bytes32(b"0" * 32) BURN_PUZZLE_HASH_2 = bytes32(b"1" * 32) @@ -169,7 +169,7 @@ async def test_basic_mempool(self, one_node_one_block, wallet_a): async def respond_transaction( node: FullNodeAPI, tx: full_node_protocol.RespondTransaction, - peer: ws.WSChiaConnection, + peer: ws.WSFlaxConnection, tx_bytes: bytes = b"", test: bool = False, ) -> Tuple[MempoolInclusionStatus, Optional[Err]]: diff --git a/tests/core/full_node/test_mempool_fee_protocol.py b/tests/core/full_node/test_mempool_fee_protocol.py index 21e3dad3d..823ef0fe6 100644 --- a/tests/core/full_node/test_mempool_fee_protocol.py +++ b/tests/core/full_node/test_mempool_fee_protocol.py @@ -5,23 +5,23 @@ import pytest -from chia.full_node.full_node_api import FullNodeAPI -from chia.protocols import full_node_protocol, wallet_protocol -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.wallet_protocol import RespondFeeEstimates -from chia.server.server import ChiaServer -from chia.simulator.block_tools import BlockTools -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.time_out_assert import time_out_assert -from chia.util.ints import uint64 -from chia.wallet.wallet import Wallet +from flax.full_node.full_node_api import FullNodeAPI +from flax.protocols import full_node_protocol, wallet_protocol +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.wallet_protocol import RespondFeeEstimates +from flax.server.server import FlaxServer +from flax.simulator.block_tools import BlockTools +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.time_out_assert import time_out_assert +from flax.util.ints import uint64 +from flax.wallet.wallet import Wallet from tests.core.node_height import node_height_at_least @pytest.mark.asyncio async def test_protocol_messages( wallet_node_sim_and_wallet: Tuple[ - List[Union[FullNodeAPI, FullNodeSimulator]], List[Tuple[Wallet, ChiaServer]], BlockTools + List[Union[FullNodeAPI, FullNodeSimulator]], List[Tuple[Wallet, FlaxServer]], BlockTools ] ) -> None: full_nodes, wallets, bt = wallet_node_sim_and_wallet diff --git a/tests/core/full_node/test_mempool_performance.py b/tests/core/full_node/test_mempool_performance.py index 20cca8f5a..a2e04cca0 100644 --- a/tests/core/full_node/test_mempool_performance.py +++ b/tests/core/full_node/test_mempool_performance.py @@ -4,13 +4,13 @@ import pytest -from chia.protocols import full_node_protocol -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16 -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.wallet_node import WalletNode +from flax.protocols import full_node_protocol +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16 +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.wallet_node import WalletNode from tests.connection_utils import connect_and_get_peer -from chia.simulator.time_out_assert import time_out_assert +from flax.simulator.time_out_assert import time_out_assert from tests.util.misc import assert_runtime diff --git a/tests/core/full_node/test_node_load.py b/tests/core/full_node/test_node_load.py index dc385507e..2aba1e4c7 100644 --- a/tests/core/full_node/test_node_load.py +++ b/tests/core/full_node/test_node_load.py @@ -2,10 +2,10 @@ import pytest -from chia.protocols import full_node_protocol -from chia.simulator.time_out_assert import time_out_assert -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16 +from flax.protocols import full_node_protocol +from flax.simulator.time_out_assert import time_out_assert +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16 from tests.connection_utils import connect_and_get_peer from tests.util.misc import assert_runtime diff --git a/tests/core/full_node/test_peer_store_resolver.py b/tests/core/full_node/test_peer_store_resolver.py index 5be8c3fe9..521acad14 100644 --- a/tests/core/full_node/test_peer_store_resolver.py +++ b/tests/core/full_node/test_peer_store_resolver.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import Dict -from chia.server.peer_store_resolver import PeerStoreResolver +from flax.server.peer_store_resolver import PeerStoreResolver class TestPeerStoreResolver: diff --git a/tests/core/full_node/test_performance.py b/tests/core/full_node/test_performance.py index 442564046..494201ec7 100644 --- a/tests/core/full_node/test_performance.py +++ b/tests/core/full_node/test_performance.py @@ -8,18 +8,18 @@ import pytest from clvm.casts import int_to_bytes -from chia.consensus.block_record import BlockRecord -from chia.consensus.pot_iterations import is_overflow_block -from chia.full_node.full_node_api import FullNodeAPI -from chia.protocols import full_node_protocol as fnp -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.ints import uint64 +from flax.consensus.block_record import BlockRecord +from flax.consensus.pot_iterations import is_overflow_block +from flax.full_node.full_node_api import FullNodeAPI +from flax.protocols import full_node_protocol as fnp +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.ints import uint64 from tests.connection_utils import add_dummy_connection from tests.core.full_node.stores.test_coin_store import get_future_reward_coins from tests.core.node_height import node_height_at_least -from chia.simulator.time_out_assert import time_out_assert +from flax.simulator.time_out_assert import time_out_assert from tests.util.misc import assert_runtime log = logging.getLogger(__name__) diff --git a/tests/core/full_node/test_transactions.py b/tests/core/full_node/test_transactions.py index 464efab1b..b21e6de3e 100644 --- a/tests/core/full_node/test_transactions.py +++ b/tests/core/full_node/test_transactions.py @@ -6,14 +6,14 @@ import pytest -from chia.consensus.block_record import BlockRecord -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.full_node.full_node_api import FullNodeAPI -from chia.protocols import full_node_protocol -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16, uint32 +from flax.consensus.block_record import BlockRecord +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.full_node.full_node_api import FullNodeAPI +from flax.protocols import full_node_protocol +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16, uint32 class TestTransactions: diff --git a/tests/core/large_block.py b/tests/core/large_block.py index afa8e90b4..62fa6131e 100644 --- a/tests/core/large_block.py +++ b/tests/core/large_block.py @@ -2,7 +2,7 @@ import zstd -from chia.types.full_block import FullBlock +from flax.types.full_block import FullBlock LARGE_BLOCK: FullBlock = FullBlock.from_bytes( zstd.decompress( diff --git a/tests/core/make_block_generator.py b/tests/core/make_block_generator.py index 1ccc9be1c..7c2e67530 100644 --- a/tests/core/make_block_generator.py +++ b/tests/core/make_block_generator.py @@ -4,16 +4,16 @@ import blspy -from chia.full_node.bundle_tools import simple_solution_generator -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.generator_types import BlockGenerator -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint64 -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk, solution_for_conditions +from flax.full_node.bundle_tools import simple_solution_generator +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.generator_types import BlockGenerator +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint64 +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk, solution_for_conditions GROUP_ORDER = 0x73EDA753299D7D483339D80809A1D80553BDA402FFFE5BFEFFFFFFFF00000001 diff --git a/tests/core/mempool/test_mempool_fee_estimator.py b/tests/core/mempool/test_mempool_fee_estimator.py index a56636b4a..4f95dd176 100644 --- a/tests/core/mempool/test_mempool_fee_estimator.py +++ b/tests/core/mempool/test_mempool_fee_estimator.py @@ -5,17 +5,17 @@ import pytest -from chia.consensus.cost_calculator import NPCResult -from chia.full_node.bitcoin_fee_estimator import BitcoinFeeEstimator -from chia.full_node.coin_store import CoinStore -from chia.full_node.fee_estimate_store import FeeStore -from chia.full_node.fee_estimator import SmartFeeEstimator -from chia.full_node.fee_tracker import FeeTracker -from chia.full_node.mempool_manager import MempoolManager -from chia.simulator.wallet_tools import WalletTool -from chia.types.blockchain_format.coin import Coin -from chia.types.mempool_item import MempoolItem -from chia.util.ints import uint32, uint64 +from flax.consensus.cost_calculator import NPCResult +from flax.full_node.bitcoin_fee_estimator import BitcoinFeeEstimator +from flax.full_node.coin_store import CoinStore +from flax.full_node.fee_estimate_store import FeeStore +from flax.full_node.fee_estimator import SmartFeeEstimator +from flax.full_node.fee_tracker import FeeTracker +from flax.full_node.mempool_manager import MempoolManager +from flax.simulator.wallet_tools import WalletTool +from flax.types.blockchain_format.coin import Coin +from flax.types.mempool_item import MempoolItem +from flax.util.ints import uint32, uint64 from tests.core.consensus.test_pot_iterations import test_constants from tests.util.db_connection import DBConnection diff --git a/tests/core/server/test_dos.py b/tests/core/server/test_dos.py index 74dec0ad7..7006c7c0c 100644 --- a/tests/core/server/test_dos.py +++ b/tests/core/server/test_dos.py @@ -5,17 +5,17 @@ import pytest from aiohttp import ClientSession, ClientTimeout, ServerDisconnectedError, WSCloseCode, WSMessage, WSMsgType -from chia.full_node.full_node_api import FullNodeAPI -from chia.protocols import full_node_protocol -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.shared_protocol import Handshake -from chia.server.outbound_message import make_msg, Message -from chia.server.rate_limits import RateLimiter -from chia.server.ws_connection import WSChiaConnection -from chia.types.peer_info import PeerInfo -from chia.util.errors import Err -from chia.util.ints import uint16, uint64 -from chia.simulator.time_out_assert import time_out_assert +from flax.full_node.full_node_api import FullNodeAPI +from flax.protocols import full_node_protocol +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.shared_protocol import Handshake +from flax.server.outbound_message import make_msg, Message +from flax.server.rate_limits import RateLimiter +from flax.server.ws_connection import WSFlaxConnection +from flax.types.peer_info import PeerInfo +from flax.util.errors import Err +from flax.util.ints import uint16, uint64 +from flax.simulator.time_out_assert import time_out_assert log = logging.getLogger(__name__) @@ -168,8 +168,8 @@ async def test_spam_tx(self, setup_two_nodes_fixture, self_hostname): assert len(server_1.all_connections) == 1 - ws_con: WSChiaConnection = list(server_1.all_connections.values())[0] - ws_con_2: WSChiaConnection = list(server_2.all_connections.values())[0] + ws_con: WSFlaxConnection = list(server_1.all_connections.values())[0] + ws_con_2: WSFlaxConnection = list(server_2.all_connections.values())[0] ws_con.peer_host = "1.2.3.4" ws_con_2.peer_host = "1.2.3.4" @@ -223,8 +223,8 @@ async def test_spam_message_non_tx(self, setup_two_nodes_fixture, self_hostname) assert len(server_1.all_connections) == 1 - ws_con: WSChiaConnection = list(server_1.all_connections.values())[0] - ws_con_2: WSChiaConnection = list(server_2.all_connections.values())[0] + ws_con: WSFlaxConnection = list(server_1.all_connections.values())[0] + ws_con_2: WSFlaxConnection = list(server_2.all_connections.values())[0] ws_con.peer_host = "1.2.3.4" ws_con_2.peer_host = "1.2.3.4" @@ -272,8 +272,8 @@ async def test_spam_message_too_large(self, setup_two_nodes_fixture, self_hostna assert len(server_1.all_connections) == 1 - ws_con: WSChiaConnection = list(server_1.all_connections.values())[0] - ws_con_2: WSChiaConnection = list(server_2.all_connections.values())[0] + ws_con: WSFlaxConnection = list(server_1.all_connections.values())[0] + ws_con_2: WSFlaxConnection = list(server_2.all_connections.values())[0] ws_con.peer_host = "1.2.3.4" ws_con_2.peer_host = "1.2.3.4" diff --git a/tests/core/server/test_rate_limits.py b/tests/core/server/test_rate_limits.py index 67b586252..0a4ea174f 100644 --- a/tests/core/server/test_rate_limits.py +++ b/tests/core/server/test_rate_limits.py @@ -3,15 +3,15 @@ import pytest -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.shared_protocol import Capability -from chia.server.outbound_message import make_msg -from chia.server.rate_limit_numbers import get_rate_limits_to_use, rate_limits as rl_numbers, compose_rate_limits -from chia.server.rate_limits import RateLimiter -from chia.server.server import ChiaServer -from chia.server.ws_connection import WSChiaConnection -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16 +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.shared_protocol import Capability +from flax.server.outbound_message import make_msg +from flax.server.rate_limit_numbers import get_rate_limits_to_use, rate_limits as rl_numbers, compose_rate_limits +from flax.server.rate_limits import RateLimiter +from flax.server.server import FlaxServer +from flax.server.ws_connection import WSFlaxConnection +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16 from tests.conftest import node_with_params from tests.setup_nodes import test_constants @@ -304,16 +304,16 @@ async def test_different_versions(self, node_with_params, node_with_params_b, se node_a = node_with_params node_b = node_with_params_b - full_node_server_a: ChiaServer = node_a.full_node.server - full_node_server_b: ChiaServer = node_b.full_node.server + full_node_server_a: FlaxServer = node_a.full_node.server + full_node_server_b: FlaxServer = node_b.full_node.server await full_node_server_b.start_client(PeerInfo(self_hostname, uint16(full_node_server_a._port)), None) assert len(full_node_server_b.get_connections()) == 1 assert len(full_node_server_a.get_connections()) == 1 - a_con: WSChiaConnection = full_node_server_a.get_connections()[0] - b_con: WSChiaConnection = full_node_server_b.get_connections()[0] + a_con: WSFlaxConnection = full_node_server_a.get_connections()[0] + b_con: WSFlaxConnection = full_node_server_b.get_connections()[0] print(a_con.local_capabilities, a_con.peer_capabilities) print(b_con.local_capabilities, b_con.peer_capabilities) diff --git a/tests/core/ssl/test_ssl.py b/tests/core/ssl/test_ssl.py index 1ca4273a4..ec156cd8d 100644 --- a/tests/core/ssl/test_ssl.py +++ b/tests/core/ssl/test_ssl.py @@ -3,24 +3,24 @@ import aiohttp import pytest -from chia.protocols.shared_protocol import protocol_version, capabilities -from chia.server.outbound_message import NodeType -from chia.server.server import ChiaServer, ssl_context_for_client -from chia.server.ssl_context import chia_ssl_ca_paths, private_ssl_ca_paths -from chia.server.ws_connection import WSChiaConnection -from chia.ssl.create_ssl import generate_ca_signed_cert -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16 +from flax.protocols.shared_protocol import protocol_version, capabilities +from flax.server.outbound_message import NodeType +from flax.server.server import FlaxServer, ssl_context_for_client +from flax.server.ssl_context import flax_ssl_ca_paths, private_ssl_ca_paths +from flax.server.ws_connection import WSFlaxConnection +from flax.ssl.create_ssl import generate_ca_signed_cert +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16 -async def establish_connection(server: ChiaServer, self_hostname: str, ssl_context) -> None: +async def establish_connection(server: FlaxServer, self_hostname: str, ssl_context) -> None: timeout = aiohttp.ClientTimeout(total=10) dummy_port = 5 # this does not matter async with aiohttp.ClientSession(timeout=timeout) as session: incoming_queue: asyncio.Queue = asyncio.Queue() url = f"wss://{self_hostname}:{server._port}/ws" ws = await session.ws_connect(url, autoclose=False, autoping=True, ssl=ssl_context) - wsc = WSChiaConnection( + wsc = WSFlaxConnection( NodeType.FULL_NODE, ws, server._port, @@ -43,7 +43,7 @@ class TestSSL: async def test_public_connections(self, wallet_node_sim_and_wallet, self_hostname): full_nodes, wallets, _ = wallet_node_sim_and_wallet full_node_api = full_nodes[0] - server_1: ChiaServer = full_node_api.full_node.server + server_1: FlaxServer = full_node_api.full_node.server wallet_node, server_2 = wallets[0] success = await server_2.start_client(PeerInfo(self_hostname, uint16(server_1._port)), None) @@ -56,7 +56,7 @@ async def test_farmer(self, farmer_one_harvester, self_hostname): farmer_server = farmer_api.farmer.server ca_private_crt_path, ca_private_key_path = private_ssl_ca_paths(bt.root_path, bt.config) - chia_ca_crt_path, chia_ca_key_path = chia_ssl_ca_paths(bt.root_path, bt.config) + flax_ca_crt_path, flax_ca_key_path = flax_ssl_ca_paths(bt.root_path, bt.config) # Create valid cert (valid meaning signed with private CA) priv_crt = farmer_server.root_path / "valid.crt" priv_key = farmer_server.root_path / "valid.key" @@ -72,8 +72,8 @@ async def test_farmer(self, farmer_one_harvester, self_hostname): # Create not authenticated cert pub_crt = farmer_server.root_path / "non_valid.crt" pub_key = farmer_server.root_path / "non_valid.key" - generate_ca_signed_cert(chia_ca_crt_path.read_bytes(), chia_ca_key_path.read_bytes(), pub_crt, pub_key) - ssl_context = ssl_context_for_client(chia_ca_crt_path, chia_ca_key_path, pub_crt, pub_key) + generate_ca_signed_cert(flax_ca_crt_path.read_bytes(), flax_ca_key_path.read_bytes(), pub_crt, pub_key) + ssl_context = ssl_context_for_client(flax_ca_crt_path, flax_ca_key_path, pub_crt, pub_key) with pytest.raises(aiohttp.ClientConnectorCertificateError): await establish_connection(farmer_server, self_hostname, ssl_context) ssl_context = ssl_context_for_client(ca_private_crt_path, ca_private_key_path, pub_crt, pub_key) @@ -85,18 +85,18 @@ async def test_full_node(self, wallet_node_sim_and_wallet, self_hostname): full_nodes, wallets, bt = wallet_node_sim_and_wallet full_node_api = full_nodes[0] full_node_server = full_node_api.full_node.server - chia_ca_crt_path, chia_ca_key_path = chia_ssl_ca_paths(bt.root_path, bt.config) + flax_ca_crt_path, flax_ca_key_path = flax_ssl_ca_paths(bt.root_path, bt.config) # Create not authenticated cert pub_crt = full_node_server.root_path / "p2p.crt" pub_key = full_node_server.root_path / "p2p.key" generate_ca_signed_cert( - chia_ca_crt_path.read_bytes(), - chia_ca_key_path.read_bytes(), + flax_ca_crt_path.read_bytes(), + flax_ca_key_path.read_bytes(), pub_crt, pub_key, ) - ssl_context = ssl_context_for_client(chia_ca_crt_path, chia_ca_key_path, pub_crt, pub_key) + ssl_context = ssl_context_for_client(flax_ca_crt_path, flax_ca_key_path, pub_crt, pub_key) await establish_connection(full_node_server, self_hostname, ssl_context) @pytest.mark.asyncio @@ -104,13 +104,13 @@ async def test_wallet(self, wallet_node_sim_and_wallet, self_hostname): full_nodes, wallets, bt = wallet_node_sim_and_wallet wallet_node, wallet_server = wallets[0] ca_private_crt_path, ca_private_key_path = private_ssl_ca_paths(bt.root_path, bt.config) - chia_ca_crt_path, chia_ca_key_path = chia_ssl_ca_paths(bt.root_path, bt.config) + flax_ca_crt_path, flax_ca_key_path = flax_ssl_ca_paths(bt.root_path, bt.config) # Wallet should not accept incoming connections pub_crt = wallet_server.root_path / "p2p.crt" pub_key = wallet_server.root_path / "p2p.key" - generate_ca_signed_cert(chia_ca_crt_path.read_bytes(), chia_ca_key_path.read_bytes(), pub_crt, pub_key) - ssl_context = ssl_context_for_client(chia_ca_crt_path, chia_ca_key_path, pub_crt, pub_key) + generate_ca_signed_cert(flax_ca_crt_path.read_bytes(), flax_ca_key_path.read_bytes(), pub_crt, pub_key) + ssl_context = ssl_context_for_client(flax_ca_crt_path, flax_ca_key_path, pub_crt, pub_key) with pytest.raises(aiohttp.ClientConnectorError): await establish_connection(wallet_server, self_hostname, ssl_context) @@ -132,18 +132,18 @@ async def test_harvester(self, farmer_one_harvester, self_hostname): harvesters, _, bt = farmer_one_harvester harvester_server = harvesters[0]._server ca_private_crt_path, ca_private_key_path = private_ssl_ca_paths(bt.root_path, bt.config) - chia_ca_crt_path, chia_ca_key_path = chia_ssl_ca_paths(bt.root_path, bt.config) + flax_ca_crt_path, flax_ca_key_path = flax_ssl_ca_paths(bt.root_path, bt.config) # harvester should not accept incoming connections pub_crt = harvester_server.root_path / "p2p.crt" pub_key = harvester_server.root_path / "p2p.key" generate_ca_signed_cert( - chia_ca_crt_path.read_bytes(), - chia_ca_key_path.read_bytes(), + flax_ca_crt_path.read_bytes(), + flax_ca_key_path.read_bytes(), pub_crt, pub_key, ) - ssl_context = ssl_context_for_client(chia_ca_crt_path, chia_ca_key_path, pub_crt, pub_key) + ssl_context = ssl_context_for_client(flax_ca_crt_path, flax_ca_key_path, pub_crt, pub_key) with pytest.raises(aiohttp.ClientConnectorError): await establish_connection(harvester_server, self_hostname, ssl_context) @@ -163,18 +163,18 @@ async def test_harvester(self, farmer_one_harvester, self_hostname): @pytest.mark.asyncio async def test_introducer(self, introducer_service, self_hostname): introducer_server = introducer_service._node.server - chia_ca_crt_path, chia_ca_key_path = chia_ssl_ca_paths(introducer_service.root_path, introducer_service.config) + flax_ca_crt_path, flax_ca_key_path = flax_ssl_ca_paths(introducer_service.root_path, introducer_service.config) # Create not authenticated cert pub_crt = introducer_server.root_path / "p2p.crt" pub_key = introducer_server.root_path / "p2p.key" generate_ca_signed_cert( - chia_ca_crt_path.read_bytes(), - chia_ca_key_path.read_bytes(), + flax_ca_crt_path.read_bytes(), + flax_ca_key_path.read_bytes(), pub_crt, pub_key, ) - ssl_context = ssl_context_for_client(chia_ca_crt_path, chia_ca_key_path, pub_crt, pub_key) + ssl_context = ssl_context_for_client(flax_ca_crt_path, flax_ca_key_path, pub_crt, pub_key) await establish_connection(introducer_server, self_hostname, ssl_context) @pytest.mark.asyncio @@ -183,18 +183,18 @@ async def test_timelord(self, timelord_service, self_hostname): ca_private_crt_path, ca_private_key_path = private_ssl_ca_paths( timelord_service.root_path, timelord_service.config ) - chia_ca_crt_path, chia_ca_key_path = chia_ssl_ca_paths(timelord_service.root_path, timelord_service.config) + flax_ca_crt_path, flax_ca_key_path = flax_ssl_ca_paths(timelord_service.root_path, timelord_service.config) # timelord should not accept incoming connections pub_crt = timelord_server.root_path / "p2p.crt" pub_key = timelord_server.root_path / "p2p.key" generate_ca_signed_cert( - chia_ca_crt_path.read_bytes(), - chia_ca_key_path.read_bytes(), + flax_ca_crt_path.read_bytes(), + flax_ca_key_path.read_bytes(), pub_crt, pub_key, ) - ssl_context = ssl_context_for_client(chia_ca_crt_path, chia_ca_key_path, pub_crt, pub_key) + ssl_context = ssl_context_for_client(flax_ca_crt_path, flax_ca_key_path, pub_crt, pub_key) with pytest.raises(aiohttp.ClientConnectorError): await establish_connection(timelord_server, self_hostname, ssl_context) diff --git a/tests/core/test_coins.py b/tests/core/test_coins.py index b41549851..324e81489 100644 --- a/tests/core/test_coins.py +++ b/tests/core/test_coins.py @@ -3,9 +3,9 @@ from itertools import permutations from benchmarks.utils import rand_hash -from chia.types.blockchain_format.coin import hash_coin_ids -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash +from flax.types.blockchain_format.coin import hash_coin_ids +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash def test_hash_coin_ids_empty() -> None: diff --git a/tests/core/test_cost_calculation.py b/tests/core/test_cost_calculation.py index a7088ab26..286aa4c16 100644 --- a/tests/core/test_cost_calculation.py +++ b/tests/core/test_cost_calculation.py @@ -8,16 +8,16 @@ from blspy import G1Element from clvm_tools import binutils -from chia.consensus.condition_costs import ConditionCost -from chia.consensus.cost_calculator import NPCResult -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.full_node.bundle_tools import simple_solution_generator -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions, get_puzzle_and_solution_for_coin -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.generator_types import BlockGenerator -from chia.wallet.puzzles import p2_delegated_puzzle_or_hidden_puzzle +from flax.consensus.condition_costs import ConditionCost +from flax.consensus.cost_calculator import NPCResult +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.full_node.bundle_tools import simple_solution_generator +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions, get_puzzle_and_solution_for_coin +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.generator_types import BlockGenerator +from flax.wallet.puzzles import p2_delegated_puzzle_or_hidden_puzzle from tests.setup_nodes import test_constants from tests.util.misc import assert_runtime @@ -46,7 +46,7 @@ def large_block_generator(size): except FileNotFoundError: generator = make_block_generator(size) blob = bytes(generator.program) - # TODO: Re-enable large-block*.hex but cache in ~/.chia/subdir + # TODO: Re-enable large-block*.hex but cache in ~/.flax/subdir # with open(hex_path, "w") as f: # f.write(blob.hex()) return blob @@ -278,7 +278,7 @@ async def test_get_puzzle_and_solution_for_coin_performance(): from clvm.casts import int_from_bytes - from chia.full_node.mempool_check_conditions import DESERIALIZE_MOD + from flax.full_node.mempool_check_conditions import DESERIALIZE_MOD from tests.core.large_block import LARGE_BLOCK spends: List[Coin] = [] diff --git a/tests/core/test_crawler_rpc.py b/tests/core/test_crawler_rpc.py index 701d9e547..ac2fbb89e 100644 --- a/tests/core/test_crawler_rpc.py +++ b/tests/core/test_crawler_rpc.py @@ -2,8 +2,8 @@ import pytest -from chia.rpc.crawler_rpc_api import CrawlerRpcApi -from chia.seeder.crawler import Crawler +from flax.rpc.crawler_rpc_api import CrawlerRpcApi +from flax.seeder.crawler import Crawler class TestCrawlerRpc: diff --git a/tests/core/test_daemon_rpc.py b/tests/core/test_daemon_rpc.py index cec32ef33..5d750d623 100644 --- a/tests/core/test_daemon_rpc.py +++ b/tests/core/test_daemon_rpc.py @@ -1,7 +1,7 @@ import pytest -from chia import __version__ -from chia.daemon.client import connect_to_daemon +from flax import __version__ +from flax.daemon.client import connect_to_daemon class TestDaemonRpc: diff --git a/tests/core/test_db_conversion.py b/tests/core/test_db_conversion.py index 66755895e..87c5dddc0 100644 --- a/tests/core/test_db_conversion.py +++ b/tests/core/test_db_conversion.py @@ -6,15 +6,15 @@ from tests.setup_nodes import test_constants from tests.util.temp_file import TempFile -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 -from chia.cmds.db_upgrade_func import convert_v1_to_v2 -from chia.util.db_wrapper import DBWrapper2 -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.full_node.hint_store import HintStore -from chia.consensus.blockchain import Blockchain -from chia.consensus.multiprocess_validation import PreValidationResult +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 +from flax.cmds.db_upgrade_func import convert_v1_to_v2 +from flax.util.db_wrapper import DBWrapper2 +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.full_node.hint_store import HintStore +from flax.consensus.blockchain import Blockchain +from flax.consensus.multiprocess_validation import PreValidationResult def rand_bytes(num) -> bytes: diff --git a/tests/core/test_db_validation.py b/tests/core/test_db_validation.py index 7665cff99..42f53b373 100644 --- a/tests/core/test_db_validation.py +++ b/tests/core/test_db_validation.py @@ -8,16 +8,16 @@ import pytest -from chia.cmds.db_validate_func import validate_v2 -from chia.consensus.blockchain import Blockchain -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.consensus.multiprocess_validation import PreValidationResult -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.util.db_wrapper import DBWrapper2 -from chia.util.ints import uint64 +from flax.cmds.db_validate_func import validate_v2 +from flax.consensus.blockchain import Blockchain +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.consensus.multiprocess_validation import PreValidationResult +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.util.db_wrapper import DBWrapper2 +from flax.util.ints import uint64 from tests.setup_nodes import test_constants from tests.util.temp_file import TempFile @@ -132,7 +132,7 @@ async def make_db(db_file: Path, blocks: List[FullBlock]) -> None: db_wrapper = await DBWrapper2.create(database=db_file, reader_count=1, db_version=2) try: async with db_wrapper.writer_maybe_transaction() as conn: - # this is done by chia init normally + # this is done by flax init normally await conn.execute("CREATE TABLE database_version(version int)") await conn.execute("INSERT INTO database_version VALUES (2)") diff --git a/tests/core/test_farmer_harvester_rpc.py b/tests/core/test_farmer_harvester_rpc.py index 55df4897d..71b37bff4 100644 --- a/tests/core/test_farmer_harvester_rpc.py +++ b/tests/core/test_farmer_harvester_rpc.py @@ -14,31 +14,31 @@ import pytest import pytest_asyncio -from chia.consensus.coinbase import create_puzzlehash_for_pk -from chia.farmer.farmer import Farmer -from chia.plot_sync.receiver import Receiver -from chia.plotting.util import add_plot_directory -from chia.protocols import farmer_protocol -from chia.protocols.harvester_protocol import Plot -from chia.rpc.farmer_rpc_api import ( +from flax.consensus.coinbase import create_puzzlehash_for_pk +from flax.farmer.farmer import Farmer +from flax.plot_sync.receiver import Receiver +from flax.plotting.util import add_plot_directory +from flax.protocols import farmer_protocol +from flax.protocols.harvester_protocol import Plot +from flax.rpc.farmer_rpc_api import ( FilterItem, PaginatedRequestData, PlotInfoRequestData, PlotPathRequestData, plot_matches_filter, ) -from chia.rpc.farmer_rpc_client import FarmerRpcClient -from chia.rpc.harvester_rpc_client import HarvesterRpcClient -from chia.simulator.block_tools import get_plot_dir -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_custom_interval -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.bech32m import decode_puzzle_hash, encode_puzzle_hash -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import load_config, lock_and_load_config, save_config -from chia.util.hash import std_hash -from chia.util.ints import uint8, uint32, uint64 -from chia.util.misc import get_list_or_len -from chia.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened +from flax.rpc.farmer_rpc_client import FarmerRpcClient +from flax.rpc.harvester_rpc_client import HarvesterRpcClient +from flax.simulator.block_tools import get_plot_dir +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_custom_interval +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.bech32m import decode_puzzle_hash, encode_puzzle_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import load_config, lock_and_load_config, save_config +from flax.util.hash import std_hash +from flax.util.ints import uint8, uint32, uint64 +from flax.util.misc import get_list_or_len +from flax.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened from tests.plot_sync.test_delta import dummy_plot from tests.util.misc import assert_rpc_error from tests.util.rpc import validate_get_routes @@ -200,7 +200,7 @@ async def test_farmer_reward_target_endpoints(harvester_farmer_environment): new_ph: bytes32 = create_puzzlehash_for_pk(master_sk_to_wallet_sk(bt.farmer_master_sk, uint32(2)).get_g1()) new_ph_2: bytes32 = create_puzzlehash_for_pk(master_sk_to_wallet_sk(bt.pool_master_sk, uint32(7)).get_g1()) - await farmer_rpc_client.set_reward_targets(encode_puzzle_hash(new_ph, "xch"), encode_puzzle_hash(new_ph_2, "xch")) + await farmer_rpc_client.set_reward_targets(encode_puzzle_hash(new_ph, "xfx"), encode_puzzle_hash(new_ph_2, "xfx")) targets_3 = await farmer_rpc_client.get_reward_targets(True, 10) assert decode_puzzle_hash(targets_3["farmer_target"]) == new_ph assert decode_puzzle_hash(targets_3["pool_target"]) == new_ph_2 @@ -218,7 +218,7 @@ async def test_farmer_reward_target_endpoints(harvester_farmer_environment): master_sk_to_wallet_sk_unhardened(bt.pool_master_sk, uint32(7)).get_g1() ) await farmer_rpc_client.set_reward_targets( - encode_puzzle_hash(observer_farmer, "xch"), encode_puzzle_hash(observer_pool, "xch") + encode_puzzle_hash(observer_farmer, "xfx"), encode_puzzle_hash(observer_pool, "xfx") ) targets = await farmer_rpc_client.get_reward_targets(True, 10) assert decode_puzzle_hash(targets["farmer_target"]) == observer_farmer @@ -227,10 +227,10 @@ async def test_farmer_reward_target_endpoints(harvester_farmer_environment): root_path = farmer_api.farmer._root_path config = load_config(root_path, "config.yaml") - assert config["farmer"]["xch_target_address"] == encode_puzzle_hash(observer_farmer, "xch") - assert config["pool"]["xch_target_address"] == encode_puzzle_hash(observer_pool, "xch") + assert config["farmer"]["xfx_target_address"] == encode_puzzle_hash(observer_farmer, "xfx") + assert config["pool"]["xfx_target_address"] == encode_puzzle_hash(observer_pool, "xfx") - new_ph_2_encoded = encode_puzzle_hash(new_ph_2, "xch") + new_ph_2_encoded = encode_puzzle_hash(new_ph_2, "xfx") added_char = new_ph_2_encoded + "a" with pytest.raises(ValueError): await farmer_rpc_client.set_reward_targets(None, added_char) diff --git a/tests/core/test_full_node_rpc.py b/tests/core/test_full_node_rpc.py index f3aee2252..55ce674ae 100644 --- a/tests/core/test_full_node_rpc.py +++ b/tests/core/test_full_node_rpc.py @@ -4,24 +4,24 @@ import pytest from blspy import AugSchemeMPL -from chia.consensus.pot_iterations import is_overflow_block -from chia.full_node.signage_point import SignagePoint -from chia.protocols import full_node_protocol -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.server.outbound_message import NodeType -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol -from chia.types.full_block import FullBlock -from chia.types.spend_bundle import SpendBundle -from chia.types.unfinished_block import UnfinishedBlock -from chia.util.hash import std_hash -from chia.util.ints import uint8 -from chia.simulator.block_tools import get_signage_point +from flax.consensus.pot_iterations import is_overflow_block +from flax.full_node.signage_point import SignagePoint +from flax.protocols import full_node_protocol +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.server.outbound_message import NodeType +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol +from flax.types.full_block import FullBlock +from flax.types.spend_bundle import SpendBundle +from flax.types.unfinished_block import UnfinishedBlock +from flax.util.hash import std_hash +from flax.util.ints import uint8 +from flax.simulator.block_tools import get_signage_point from tests.blockchain.blockchain_test_utils import _validate_and_add_block from tests.connection_utils import connect_and_get_peer from tests.setup_nodes import test_constants -from chia.simulator.time_out_assert import time_out_assert +from flax.simulator.time_out_assert import time_out_assert from tests.util.rpc import validate_get_routes -from chia.simulator.wallet_tools import WalletTool +from flax.simulator.wallet_tools import WalletTool class TestRpc: diff --git a/tests/core/test_merkle_set.py b/tests/core/test_merkle_set.py index 85965a0e3..a3c629b8f 100644 --- a/tests/core/test_merkle_set.py +++ b/tests/core/test_merkle_set.py @@ -9,8 +9,8 @@ import pytest from chia_rs import compute_merkle_set_root -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.merkle_set import MerkleSet, confirm_included_already_hashed +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.merkle_set import MerkleSet, confirm_included_already_hashed class TestMerkleSet: diff --git a/tests/core/test_setproctitle.py b/tests/core/test_setproctitle.py index 8ab74a0d9..c12f4ed8f 100644 --- a/tests/core/test_setproctitle.py +++ b/tests/core/test_setproctitle.py @@ -2,7 +2,7 @@ import pytest -from chia.util.setproctitle import setproctitle +from flax.util.setproctitle import setproctitle pytestmark = pytest.mark.skip( reason="this test ends up hanging frequently and needs to be rewritten with a subprocess and a title check", @@ -10,4 +10,4 @@ def test_does_not_crash(): - setproctitle("chia test title") + setproctitle("flax test title") diff --git a/tests/core/util/test_cached_bls.py b/tests/core/util/test_cached_bls.py index f85a665f9..8e09ff542 100644 --- a/tests/core/util/test_cached_bls.py +++ b/tests/core/util/test_cached_bls.py @@ -1,7 +1,7 @@ from blspy import AugSchemeMPL, G1Element -from chia.util import cached_bls -from chia.util.hash import std_hash -from chia.util.lru_cache import LRUCache +from flax.util import cached_bls +from flax.util.hash import std_hash +from flax.util.lru_cache import LRUCache def test_cached_bls(): diff --git a/tests/core/util/test_config.py b/tests/core/util/test_config.py index 899df2fbe..2ca4f1c90 100644 --- a/tests/core/util/test_config.py +++ b/tests/core/util/test_config.py @@ -8,9 +8,9 @@ import random import yaml -from chia.util.config import ( +from flax.util.config import ( config_path_for_filename, - create_default_chia_config, + create_default_flax_config, initial_config_file, load_config, lock_and_load_config, @@ -154,7 +154,7 @@ def default_config_dict() -> Dict: class TestConfig: def test_create_config_new(self, tmpdir): """ - Test create_default_chia_config() as in a first run scenario + Test create_default_flax_config() as in a first run scenario """ # When: using a clean directory root_path: Path = Path(tmpdir) @@ -162,7 +162,7 @@ def test_create_config_new(self, tmpdir): # Expect: config.yaml doesn't exist assert config_file_path.exists() is False # When: creating a new config - create_default_chia_config(root_path) + create_default_flax_config(root_path) # Expect: config.yaml exists assert config_file_path.exists() is True @@ -176,7 +176,7 @@ def test_create_config_new(self, tmpdir): def test_create_config_overwrite(self, tmpdir): """ - Test create_default_chia_config() when overwriting an existing config.yaml + Test create_default_flax_config() when overwriting an existing config.yaml """ # When: using a clean directory root_path: Path = Path(tmpdir) @@ -188,7 +188,7 @@ def test_create_config_overwrite(self, tmpdir): # Expect: config.yaml exists assert config_file_path.exists() is True # When: creating a new config - create_default_chia_config(root_path) + create_default_flax_config(root_path) # Expect: config.yaml exists assert config_file_path.exists() is True @@ -209,7 +209,7 @@ def test_load_config(self, root_path_populated_with_config, default_config_dict) config: Dict = load_config(root_path=root_path, filename="config.yaml") assert config is not None # Expect: config values should match the defaults (from a small sampling) - assert config["daemon_port"] == default_config_dict["daemon_port"] == 55400 + assert config["daemon_port"] == default_config_dict["daemon_port"] == 56600 assert config["self_hostname"] == default_config_dict["self_hostname"] == "localhost" assert ( config["farmer"]["network_overrides"]["constants"]["mainnet"]["GENESIS_CHALLENGE"] @@ -307,26 +307,26 @@ async def test_non_atomic_writes(self, root_path_populated_with_config, default_ @pytest.mark.parametrize("prefix", [None]) def test_selected_network_address_prefix_default_config(self, config_with_address_prefix: Dict[str, Any]) -> None: """ - Temp config.yaml created using a default config. address_prefix is defaulted to "xch" + Temp config.yaml created using a default config. address_prefix is defaulted to "xfx" """ config = config_with_address_prefix prefix = selected_network_address_prefix(config) - assert prefix == "xch" + assert prefix == "xfx" - @pytest.mark.parametrize("prefix", ["txch"]) + @pytest.mark.parametrize("prefix", ["txfx"]) def test_selected_network_address_prefix_testnet_config(self, config_with_address_prefix: Dict[str, Any]) -> None: """ - Temp config.yaml created using a modified config. address_prefix is set to "txch" + Temp config.yaml created using a modified config. address_prefix is set to "txfx" """ config = config_with_address_prefix prefix = selected_network_address_prefix(config) - assert prefix == "txch" + assert prefix == "txfx" def test_selected_network_address_prefix_config_dict(self, default_config_dict: Dict[str, Any]) -> None: """ - Modified config dictionary has address_prefix set to "customxch" + Modified config dictionary has address_prefix set to "customxfx" """ config = default_config_dict - config["network_overrides"]["config"][config["selected_network"]]["address_prefix"] = "customxch" + config["network_overrides"]["config"][config["selected_network"]]["address_prefix"] = "customxfx" prefix = selected_network_address_prefix(config) - assert prefix == "customxch" + assert prefix == "customxfx" diff --git a/tests/core/util/test_file_keyring_synchronization.py b/tests/core/util/test_file_keyring_synchronization.py index 26f867ecf..0302b8176 100644 --- a/tests/core/util/test_file_keyring_synchronization.py +++ b/tests/core/util/test_file_keyring_synchronization.py @@ -1,7 +1,7 @@ import logging import os -from chia.util.keyring_wrapper import KeyringWrapper +from flax.util.keyring_wrapper import KeyringWrapper from multiprocessing import Pool from pathlib import Path from sys import platform diff --git a/tests/core/util/test_files.py b/tests/core/util/test_files.py index 5b5c6a44c..321a2df71 100644 --- a/tests/core/util/test_files.py +++ b/tests/core/util/test_files.py @@ -3,8 +3,8 @@ import shutil import sys -from chia.util import files -from chia.util.files import move_file, move_file_async, write_file_async +from flax.util import files +from flax.util.files import move_file, move_file_async, write_file_async from pathlib import Path diff --git a/tests/core/util/test_jsonify.py b/tests/core/util/test_jsonify.py index 291dce7eb..074e6bed9 100644 --- a/tests/core/util/test_jsonify.py +++ b/tests/core/util/test_jsonify.py @@ -3,9 +3,9 @@ from dataclasses import dataclass from typing import Any, Dict, List, Optional, Tuple -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32 -from chia.util.streamable import Streamable, recurse_jsonify, streamable +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32 +from flax.util.streamable import Streamable, recurse_jsonify, streamable def dict_with_types(d: Dict[str, Any]) -> Dict[str, Any]: diff --git a/tests/core/util/test_keychain.py b/tests/core/util/test_keychain.py index 139e3cd97..4130950ea 100644 --- a/tests/core/util/test_keychain.py +++ b/tests/core/util/test_keychain.py @@ -8,7 +8,7 @@ from blspy import AugSchemeMPL, G1Element, PrivateKey from tests.util.keyring import using_temp_file_keyring -from chia.util.errors import ( +from flax.util.errors import ( KeychainFingerprintExists, KeychainKeyDataMismatch, KeychainSecretsMissing, @@ -16,8 +16,8 @@ KeychainLabelExists, KeychainLabelInvalid, ) -from chia.util.ints import uint32 -from chia.util.keychain import ( +from flax.util.ints import uint32 +from flax.util.keychain import ( Keychain, KeyData, KeyDataSecrets, @@ -42,7 +42,7 @@ class TestKeychain(unittest.TestCase): @using_temp_file_keyring() def test_basic_add_delete(self): - kc: Keychain = Keychain(user="testing-1.8.0", service="chia-testing-1.8.0") + kc: Keychain = Keychain(user="testing-1.8.0", service="flax-testing-1.8.0") kc.delete_all_keys() assert kc._get_free_private_key_index() == 0 @@ -110,7 +110,7 @@ def test_basic_add_delete(self): @using_temp_file_keyring() def test_add_private_key_label(self): - keychain: Keychain = Keychain(user="testing-1.8.0", service="chia-testing-1.8.0") + keychain: Keychain = Keychain(user="testing-1.8.0", service="flax-testing-1.8.0") key_data_0 = KeyData.generate(label="key_0") key_data_1 = KeyData.generate(label="key_1") @@ -145,7 +145,7 @@ def test_add_private_key_label(self): @using_temp_file_keyring() def test_bip39_eip2333_test_vector(self): - kc: Keychain = Keychain(user="testing-1.8.0", service="chia-testing-1.8.0") + kc: Keychain = Keychain(user="testing-1.8.0", service="flax-testing-1.8.0") kc.delete_all_keys() mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" diff --git a/tests/core/util/test_keyring_wrapper.py b/tests/core/util/test_keyring_wrapper.py index de0b43653..4bc1b4bbc 100644 --- a/tests/core/util/test_keyring_wrapper.py +++ b/tests/core/util/test_keyring_wrapper.py @@ -1,8 +1,8 @@ import logging import pytest -from chia.util.errors import KeychainLabelError, KeychainLabelExists, KeychainFingerprintNotFound, KeychainLabelInvalid -from chia.util.keyring_wrapper import KeyringWrapper, DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE +from flax.util.errors import KeychainLabelError, KeychainLabelExists, KeychainFingerprintNotFound, KeychainLabelInvalid +from flax.util.keyring_wrapper import KeyringWrapper, DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE from pathlib import Path from typing import Type from sys import platform diff --git a/tests/core/util/test_lockfile.py b/tests/core/util/test_lockfile.py index 92f093521..e7e9981da 100644 --- a/tests/core/util/test_lockfile.py +++ b/tests/core/util/test_lockfile.py @@ -10,7 +10,7 @@ import pytest -from chia.util.lock import Lockfile, LockfileError +from flax.util.lock import Lockfile, LockfileError log = logging.getLogger(__name__) diff --git a/tests/core/util/test_lru_cache.py b/tests/core/util/test_lru_cache.py index 905529cc2..5933a27a7 100644 --- a/tests/core/util/test_lru_cache.py +++ b/tests/core/util/test_lru_cache.py @@ -2,7 +2,7 @@ import unittest -from chia.util.lru_cache import LRUCache +from flax.util.lru_cache import LRUCache class TestLRUCache(unittest.TestCase): diff --git a/tests/core/util/test_significant_bits.py b/tests/core/util/test_significant_bits.py index 96c0e03f3..accb91302 100644 --- a/tests/core/util/test_significant_bits.py +++ b/tests/core/util/test_significant_bits.py @@ -2,7 +2,7 @@ import unittest -from chia.util.significant_bits import count_significant_bits, truncate_to_significant_bits +from flax.util.significant_bits import count_significant_bits, truncate_to_significant_bits class TestSignificantBits(unittest.TestCase): diff --git a/tests/core/util/test_streamable.py b/tests/core/util/test_streamable.py index d251dda47..088f335b8 100644 --- a/tests/core/util/test_streamable.py +++ b/tests/core/util/test_streamable.py @@ -10,15 +10,15 @@ from clvm_tools import binutils from typing_extensions import Literal, get_args -from chia.protocols.wallet_protocol import RespondRemovals -from chia.simulator.block_tools import BlockTools -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes4, bytes32 -from chia.types.full_block import FullBlock -from chia.types.weight_proof import SubEpochChallengeSegment -from chia.util.ints import uint8, uint32, uint64 -from chia.util.streamable import ( +from flax.protocols.wallet_protocol import RespondRemovals +from flax.simulator.block_tools import BlockTools +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes4, bytes32 +from flax.types.full_block import FullBlock +from flax.types.weight_proof import SubEpochChallengeSegment +from flax.util.ints import uint8, uint32, uint64 +from flax.util.streamable import ( ConversionError, DefinitionError, InvalidSizeError, diff --git a/tests/db/test_db_wrapper.py b/tests/db/test_db_wrapper.py index 146776ca5..4c01b7f78 100644 --- a/tests/db/test_db_wrapper.py +++ b/tests/db/test_db_wrapper.py @@ -10,7 +10,7 @@ # TODO: update after resolution in https://github.com/pytest-dev/pytest/issues/7469 from _pytest.fixtures import SubRequest -from chia.util.db_wrapper import DBWrapper2 +from flax.util.db_wrapper import DBWrapper2 from tests.util.db_connection import DBConnection if TYPE_CHECKING: diff --git a/tests/farmer_harvester/test_farmer_harvester.py b/tests/farmer_harvester/test_farmer_harvester.py index 43fba5c79..540ed9cb3 100644 --- a/tests/farmer_harvester/test_farmer_harvester.py +++ b/tests/farmer_harvester/test_farmer_harvester.py @@ -4,10 +4,10 @@ import pytest -from chia.farmer.farmer import Farmer -from chia.simulator.time_out_assert import time_out_assert -from chia.types.peer_info import PeerInfo -from chia.util.keychain import generate_mnemonic +from flax.farmer.farmer import Farmer +from flax.simulator.time_out_assert import time_out_assert +from flax.types.peer_info import PeerInfo +from flax.util.keychain import generate_mnemonic def farmer_is_started(farmer): diff --git a/tests/fee_estimation/cmdline_test.py b/tests/fee_estimation/cmdline_test.py index fa0ffb831..5323607ae 100644 --- a/tests/fee_estimation/cmdline_test.py +++ b/tests/fee_estimation/cmdline_test.py @@ -7,23 +7,23 @@ from click.testing import CliRunner -from chia.cmds.chia import cli -from chia.full_node.full_node_api import FullNodeAPI -from chia.server.server import ChiaServer -from chia.simulator.block_tools import BlockTools -from chia.simulator.full_node_simulator import FullNodeSimulator +from flax.cmds.flax import cli +from flax.full_node.full_node_api import FullNodeAPI +from flax.server.server import FlaxServer +from flax.simulator.block_tools import BlockTools +from flax.simulator.full_node_simulator import FullNodeSimulator def test_print_fee_info_cmd( - one_node_one_block: Tuple[Union[FullNodeAPI, FullNodeSimulator], ChiaServer, BlockTools] + one_node_one_block: Tuple[Union[FullNodeAPI, FullNodeSimulator], FlaxServer, BlockTools] ) -> None: _, _, _ = one_node_one_block scripts_path = Path(sysconfig.get_path("scripts")) - subprocess.run([scripts_path.joinpath("chia"), "show", "-f"], check=True) + subprocess.run([scripts_path.joinpath("flax"), "show", "-f"], check=True) def test_show_fee_info( - one_node_one_block: Tuple[Union[FullNodeAPI, FullNodeSimulator], ChiaServer, BlockTools] + one_node_one_block: Tuple[Union[FullNodeAPI, FullNodeSimulator], FlaxServer, BlockTools] ) -> None: _, _, _ = one_node_one_block runner = CliRunner() diff --git a/tests/fee_estimation/test_fee_estimation_rpc.py b/tests/fee_estimation/test_fee_estimation_rpc.py index 99457d0d4..9dc2a8337 100644 --- a/tests/fee_estimation/test_fee_estimation_rpc.py +++ b/tests/fee_estimation/test_fee_estimation_rpc.py @@ -5,17 +5,17 @@ import pytest import pytest_asyncio -from chia.full_node.full_node import FullNode -from chia.rpc.full_node_rpc_api import FullNodeRpcApi -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.server.start_service import Service -from chia.simulator.block_tools import BlockTools -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.wallet_tools import WalletTool -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 -from chia.wallet.wallet_node import WalletNode +from flax.full_node.full_node import FullNode +from flax.rpc.full_node_rpc_api import FullNodeRpcApi +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.server.start_service import Service +from flax.simulator.block_tools import BlockTools +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.wallet_tools import WalletTool +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 +from flax.wallet.wallet_node import WalletNode @pytest_asyncio.fixture(scope="function") diff --git a/tests/fee_estimation/test_fee_estimation_unit_tests.py b/tests/fee_estimation/test_fee_estimation_unit_tests.py index 84b4f228e..96bc61668 100644 --- a/tests/fee_estimation/test_fee_estimation_unit_tests.py +++ b/tests/fee_estimation/test_fee_estimation_unit_tests.py @@ -5,17 +5,17 @@ from chia_rs import Coin -from chia.consensus.cost_calculator import NPCResult -from chia.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator -from chia.full_node.fee_estimation import FeeBlockInfo -from chia.full_node.fee_estimator_interface import FeeEstimatorInterface -from chia.simulator.block_tools import test_constants -from chia.simulator.wallet_tools import WalletTool -from chia.types.clvm_cost import CLVMCost -from chia.types.fee_rate import FeeRate -from chia.types.mempool_item import MempoolItem -from chia.types.mojos import Mojos -from chia.util.ints import uint32, uint64 +from flax.consensus.cost_calculator import NPCResult +from flax.full_node.bitcoin_fee_estimator import create_bitcoin_fee_estimator +from flax.full_node.fee_estimation import FeeBlockInfo +from flax.full_node.fee_estimator_interface import FeeEstimatorInterface +from flax.simulator.block_tools import test_constants +from flax.simulator.wallet_tools import WalletTool +from flax.types.clvm_cost import CLVMCost +from flax.types.fee_rate import FeeRate +from flax.types.mempool_item import MempoolItem +from flax.types.mojos import Mojos +from flax.util.ints import uint32, uint64 log = logging.getLogger(__name__) diff --git a/tests/chia-start-sim b/tests/flax-start-sim old mode 100755 new mode 100644 similarity index 65% rename from tests/chia-start-sim rename to tests/flax-start-sim index 656d1af9d..c9e60ce72 --- a/tests/chia-start-sim +++ b/tests/flax-start-sim @@ -1,5 +1,5 @@ _kill_servers() { - PROCS=`ps -e | grep -E 'chia|vdf_client' -v "chia-start-sim" | awk '!/grep/' | awk '{print $1}'` + PROCS=`ps -e | grep -E 'flax|vdf_client' -v "flax-start-sim" | awk '!/grep/' | awk '{print $1}'` if [ -n "$PROCS" ]; then echo "$PROCS" | xargs -L1 kill -KILL fi @@ -22,21 +22,21 @@ _term() { _kill_servers } -echo "Starting local blockchain simulation. Runs a local introducer and chia system." +echo "Starting local blockchain simulation. Runs a local introducer and flax system." echo "Note that this simulation will not work if connected to external nodes." # Starts a harvester, farmer, timelord, introducer, and 3 full nodes, locally. # Please note that the simulation is meant to be run locally and not connected to external nodes. # NOTE: you must run install.sh when changing this file - _run_bg_cmd chia_farmer --logging.log_stdout=True --logging.log_level=INFO - _run_bg_cmd chia_harvester --logging.log_stdout=True --logging.log_level=INFO - _run_bg_cmd chia_timelord --logging.log_stdout=True --logging.log_level=INFO - _run_bg_cmd chia_timelord_launcher --logging.log_stdout=True --logging.log_level=INFO -_run_bg_cmd chia_introducer --logging.log_stdout=True --logging.log_level=INFO -_run_bg_cmd chia_full_node --port=8444 --database_path="simulation_1.db" --rpc_port=8555 --introducer_peer.host="127.0.0.1" --introducer_peer.port=8445 --logging.log_stdout=True --logging.log_level=INFO --logging.log_level=INFO + _run_bg_cmd flax_farmer --logging.log_stdout=True --logging.log_level=INFO + _run_bg_cmd flax_harvester --logging.log_stdout=True --logging.log_level=INFO + _run_bg_cmd flax_timelord --logging.log_stdout=True --logging.log_level=INFO + _run_bg_cmd flax_timelord_launcher --logging.log_stdout=True --logging.log_level=INFO +_run_bg_cmd flax_introducer --logging.log_stdout=True --logging.log_level=INFO +_run_bg_cmd flax_full_node --port=8444 --database_path="simulation_1.db" --rpc_port=8555 --introducer_peer.host="127.0.0.1" --introducer_peer.port=8445 --logging.log_stdout=True --logging.log_level=INFO --logging.log_level=INFO sleep 1 -_run_bg_cmd chia_full_node --port=8002 --database_path="simulation_2.db" --rpc_port=8556 --introducer_peer.host="127.0.0.1" --introducer_peer.port=8445 --logging.log_stdout=True --logging.log_level=INFO - _run_bg_cmd python -m chia.daemon.server --logging.log_stdout=True --logging.log_level=INFO +_run_bg_cmd flax_full_node --port=8002 --database_path="simulation_2.db" --rpc_port=8556 --introducer_peer.host="127.0.0.1" --introducer_peer.port=8445 --logging.log_stdout=True --logging.log_level=INFO + _run_bg_cmd python -m flax.daemon.server --logging.log_stdout=True --logging.log_level=INFO wait diff --git a/tests/generator/test_compression.py b/tests/generator/test_compression.py index 851010b69..79d2ef8a0 100644 --- a/tests/generator/test_compression.py +++ b/tests/generator/test_compression.py @@ -3,7 +3,7 @@ from typing import List, Any from unittest import TestCase -from chia.full_node.bundle_tools import ( +from flax.full_node.bundle_tools import ( bundle_suitable_for_compression, compressed_coin_spend_entry_list, compressed_spend_bundle_solution, @@ -11,14 +11,14 @@ simple_solution_generator, spend_bundle_to_serialized_coin_spend_entry_list, ) -from chia.full_node.generator import run_generator_unsafe, create_generator_args -from chia.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin -from chia.types.blockchain_format.program import Program, SerializedProgram, INFINITE_COST -from chia.types.generator_types import BlockGenerator, CompressorArg -from chia.types.spend_bundle import SpendBundle -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint32 -from chia.wallet.puzzles.load_clvm import load_clvm +from flax.full_node.generator import run_generator_unsafe, create_generator_args +from flax.full_node.mempool_check_conditions import get_puzzle_and_solution_for_coin +from flax.types.blockchain_format.program import Program, SerializedProgram, INFINITE_COST +from flax.types.generator_types import BlockGenerator, CompressorArg +from flax.types.spend_bundle import SpendBundle +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint32 +from flax.wallet.puzzles.load_clvm import load_clvm from tests.core.make_block_generator import make_spend_bundle @@ -28,17 +28,17 @@ from clvm_tools import binutils -TEST_GEN_DESERIALIZE = load_clvm("test_generator_deserialize.clvm", package_or_requirement="chia.wallet.puzzles") -DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles") +TEST_GEN_DESERIALIZE = load_clvm("test_generator_deserialize.clvm", package_or_requirement="flax.wallet.puzzles") +DESERIALIZE_MOD = load_clvm("flaxlisp_deserialisation.clvm", package_or_requirement="flax.wallet.puzzles") -DECOMPRESS_PUZZLE = load_clvm("decompress_puzzle.clvm", package_or_requirement="chia.wallet.puzzles") -DECOMPRESS_CSE = load_clvm("decompress_coin_spend_entry.clvm", package_or_requirement="chia.wallet.puzzles") +DECOMPRESS_PUZZLE = load_clvm("decompress_puzzle.clvm", package_or_requirement="flax.wallet.puzzles") +DECOMPRESS_CSE = load_clvm("decompress_coin_spend_entry.clvm", package_or_requirement="flax.wallet.puzzles") DECOMPRESS_CSE_WITH_PREFIX = load_clvm( - "decompress_coin_spend_entry_with_prefix.clvm", package_or_requirement="chia.wallet.puzzles" + "decompress_coin_spend_entry_with_prefix.clvm", package_or_requirement="flax.wallet.puzzles" ) -DECOMPRESS_BLOCK = load_clvm("block_program_zero.clvm", package_or_requirement="chia.wallet.puzzles") -TEST_MULTIPLE = load_clvm("test_multiple_generator_input_arguments.clvm", package_or_requirement="chia.wallet.puzzles") +DECOMPRESS_BLOCK = load_clvm("block_program_zero.clvm", package_or_requirement="flax.wallet.puzzles") +TEST_MULTIPLE = load_clvm("test_multiple_generator_input_arguments.clvm", package_or_requirement="flax.wallet.puzzles") Nil = Program.from_bytes(b"\x80") diff --git a/tests/generator/test_generator_types.py b/tests/generator/test_generator_types.py index 3cf219982..b834d3dcc 100644 --- a/tests/generator/test_generator_types.py +++ b/tests/generator/test_generator_types.py @@ -1,10 +1,10 @@ from typing import Dict from unittest import TestCase -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.generator_types import GeneratorBlockCacheInterface -from chia.full_node.generator import create_block_generator, create_generator_args -from chia.util.ints import uint32 +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.generator_types import GeneratorBlockCacheInterface +from flax.full_node.generator import create_block_generator, create_generator_args +from flax.util.ints import uint32 gen0 = SerializedProgram.from_bytes( bytes.fromhex( diff --git a/tests/generator/test_list_to_batches.py b/tests/generator/test_list_to_batches.py index 2f98ee170..a7837e37f 100644 --- a/tests/generator/test_list_to_batches.py +++ b/tests/generator/test_list_to_batches.py @@ -1,5 +1,5 @@ import pytest -from chia.util.generator_tools import list_to_batches +from flax.util.generator_tools import list_to_batches def test_empty_lists(): diff --git a/tests/generator/test_rom.py b/tests/generator/test_rom.py index 5a9fabe41..f9eb0647e 100644 --- a/tests/generator/test_rom.py +++ b/tests/generator/test_rom.py @@ -1,21 +1,21 @@ from clvm_tools import binutils from clvm_tools.clvmc import compile_clvm_text -from chia.full_node.generator import run_generator_unsafe -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.generator_types import BlockGenerator -from chia.util.ints import uint32 -from chia.wallet.puzzles.load_clvm import load_clvm -from chia.consensus.condition_costs import ConditionCost -from chia.types.spend_bundle_conditions import Spend +from flax.full_node.generator import run_generator_unsafe +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.generator_types import BlockGenerator +from flax.util.ints import uint32 +from flax.wallet.puzzles.load_clvm import load_clvm +from flax.consensus.condition_costs import ConditionCost +from flax.types.spend_bundle_conditions import Spend MAX_COST = int(1e15) COST_PER_BYTE = int(12000) -DESERIALIZE_MOD = load_clvm("chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles") +DESERIALIZE_MOD = load_clvm("flaxlisp_deserialisation.clvm", package_or_requirement="flax.wallet.puzzles") GENERATOR_CODE = """ diff --git a/tests/generator/test_scan.py b/tests/generator/test_scan.py index 0a35d57e3..d34e49787 100644 --- a/tests/generator/test_scan.py +++ b/tests/generator/test_scan.py @@ -1,9 +1,9 @@ from unittest import TestCase -from chia.full_node.bundle_tools import ( +from flax.full_node.bundle_tools import ( match_standard_transaction_at_any_index, match_standard_transaction_exactly_and_return_pubkey, ) -from chia.util.byte_types import hexstr_to_bytes +from flax.util.byte_types import hexstr_to_bytes gen1 = hexstr_to_bytes( diff --git a/tests/plot_sync/test_delta.py b/tests/plot_sync/test_delta.py index 8f7779abb..d452c650f 100644 --- a/tests/plot_sync/test_delta.py +++ b/tests/plot_sync/test_delta.py @@ -6,10 +6,10 @@ import pytest from blspy import G1Element -from chia.plot_sync.delta import Delta, DeltaType, PathListDelta, PlotListDelta -from chia.protocols.harvester_protocol import Plot -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint64 +from flax.plot_sync.delta import Delta, DeltaType, PathListDelta, PlotListDelta +from flax.protocols.harvester_protocol import Plot +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint64 log = logging.getLogger(__name__) diff --git a/tests/plot_sync/test_plot_sync.py b/tests/plot_sync/test_plot_sync.py index 05e8c755e..87d1f168c 100644 --- a/tests/plot_sync/test_plot_sync.py +++ b/tests/plot_sync/test_plot_sync.py @@ -11,23 +11,23 @@ import pytest_asyncio from blspy import G1Element -from chia.farmer.farmer_api import Farmer -from chia.harvester.harvester_api import Harvester -from chia.plot_sync.delta import Delta, PathListDelta, PlotListDelta -from chia.plot_sync.receiver import Receiver -from chia.plot_sync.sender import Sender -from chia.plot_sync.util import Constants, State -from chia.plotting.manager import PlotManager -from chia.plotting.util import add_plot_directory, remove_plot_directory -from chia.protocols.harvester_protocol import Plot -from chia.server.start_service import Service -from chia.server.ws_connection import ProtocolMessageTypes -from chia.simulator.block_tools import BlockTools -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.config import create_default_chia_config, lock_and_load_config, save_config -from chia.util.ints import uint8, uint32, uint64 -from chia.util.streamable import _T_Streamable +from flax.farmer.farmer_api import Farmer +from flax.harvester.harvester_api import Harvester +from flax.plot_sync.delta import Delta, PathListDelta, PlotListDelta +from flax.plot_sync.receiver import Receiver +from flax.plot_sync.sender import Sender +from flax.plot_sync.util import Constants, State +from flax.plotting.manager import PlotManager +from flax.plotting.util import add_plot_directory, remove_plot_directory +from flax.protocols.harvester_protocol import Plot +from flax.server.start_service import Service +from flax.server.ws_connection import ProtocolMessageTypes +from flax.simulator.block_tools import BlockTools +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.config import create_default_flax_config, lock_and_load_config, save_config +from flax.util.ints import uint8, uint32, uint64 +from flax.util.streamable import _T_Streamable from tests.plot_sync.util import start_harvester_service from tests.plotting.test_plot_manager import Directory, MockPlotInfo from tests.plotting.util import get_test_plots @@ -291,7 +291,7 @@ def new_test_dir(name: str, plot_list: List[Path]) -> Directory: dir_invalid: Directory = new_test_dir("invalid", plots_invalid) dir_keys_missing: Directory = new_test_dir("keys_missing", plots_keys_missing) dir_duplicates: Directory = new_test_dir("duplicates", directories[3].plots) - create_default_chia_config(tmp_path) + create_default_flax_config(tmp_path) # Invalidate the plots in `dir_invalid` for path in dir_invalid.path_list(): diff --git a/tests/plot_sync/test_receiver.py b/tests/plot_sync/test_receiver.py index b29114652..ce4e371ae 100644 --- a/tests/plot_sync/test_receiver.py +++ b/tests/plot_sync/test_receiver.py @@ -10,10 +10,10 @@ import pytest from blspy import G1Element -from chia.plot_sync.delta import Delta -from chia.plot_sync.receiver import Receiver, Sync -from chia.plot_sync.util import ErrorCodes, State -from chia.protocols.harvester_protocol import ( +from flax.plot_sync.delta import Delta +from flax.plot_sync.receiver import Receiver, Sync +from flax.plot_sync.util import ErrorCodes, State +from flax.protocols.harvester_protocol import ( Plot, PlotSyncDone, PlotSyncIdentifier, @@ -22,11 +22,11 @@ PlotSyncResponse, PlotSyncStart, ) -from chia.server.ws_connection import NodeType -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint32, uint64 -from chia.util.misc import get_list_or_len -from chia.util.streamable import _T_Streamable +from flax.server.ws_connection import NodeType +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint32, uint64 +from flax.util.misc import get_list_or_len +from flax.util.streamable import _T_Streamable from tests.plot_sync.util import get_dummy_connection log = logging.getLogger(__name__) diff --git a/tests/plot_sync/test_sender.py b/tests/plot_sync/test_sender.py index a8c1fb346..ae3668744 100644 --- a/tests/plot_sync/test_sender.py +++ b/tests/plot_sync/test_sender.py @@ -2,13 +2,13 @@ import pytest -from chia.plot_sync.exceptions import AlreadyStartedError, InvalidConnectionTypeError -from chia.plot_sync.sender import ExpectedResponse, Sender -from chia.plot_sync.util import Constants -from chia.protocols.harvester_protocol import PlotSyncIdentifier, PlotSyncResponse -from chia.server.ws_connection import NodeType, ProtocolMessageTypes -from chia.simulator.block_tools import BlockTools -from chia.util.ints import int16, uint64 +from flax.plot_sync.exceptions import AlreadyStartedError, InvalidConnectionTypeError +from flax.plot_sync.sender import ExpectedResponse, Sender +from flax.plot_sync.util import Constants +from flax.protocols.harvester_protocol import PlotSyncIdentifier, PlotSyncResponse +from flax.server.ws_connection import NodeType, ProtocolMessageTypes +from flax.simulator.block_tools import BlockTools +from flax.util.ints import int16, uint64 from tests.plot_sync.util import get_dummy_connection, plot_sync_identifier diff --git a/tests/plot_sync/test_sync_simulated.py b/tests/plot_sync/test_sync_simulated.py index 581d3ea62..084142edb 100644 --- a/tests/plot_sync/test_sync_simulated.py +++ b/tests/plot_sync/test_sync_simulated.py @@ -13,21 +13,21 @@ import pytest from blspy import G1Element -from chia.farmer.farmer_api import Farmer -from chia.harvester.harvester_api import Harvester -from chia.plot_sync.receiver import Receiver -from chia.plot_sync.sender import Sender -from chia.plot_sync.util import Constants -from chia.plotting.manager import PlotManager -from chia.plotting.util import PlotInfo -from chia.protocols.harvester_protocol import PlotSyncError, PlotSyncResponse -from chia.server.start_service import Service -from chia.server.ws_connection import ProtocolMessageTypes, WSChiaConnection, make_msg -from chia.simulator.block_tools import BlockTools -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.generator_tools import list_to_batches -from chia.util.ints import int16, uint64 +from flax.farmer.farmer_api import Farmer +from flax.harvester.harvester_api import Harvester +from flax.plot_sync.receiver import Receiver +from flax.plot_sync.sender import Sender +from flax.plot_sync.util import Constants +from flax.plotting.manager import PlotManager +from flax.plotting.util import PlotInfo +from flax.protocols.harvester_protocol import PlotSyncError, PlotSyncResponse +from flax.server.start_service import Service +from flax.server.ws_connection import ProtocolMessageTypes, WSFlaxConnection, make_msg +from flax.simulator.block_tools import BlockTools +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.generator_tools import list_to_batches +from flax.util.ints import int16, uint64 from tests.plot_sync.util import start_harvester_service log = logging.getLogger(__name__) @@ -195,7 +195,7 @@ async def run( data.validate_plot_sync() -async def skip_processing(self: Any, _: WSChiaConnection, message_type: ProtocolMessageTypes, message: Any) -> bool: +async def skip_processing(self: Any, _: WSFlaxConnection, message_type: ProtocolMessageTypes, message: Any) -> bool: self.message_counter += 1 if self.simulate_error == ErrorSimulation.DropEveryFourthMessage: if self.message_counter % 4 == 0: @@ -229,7 +229,7 @@ async def skip_processing(self: Any, _: WSChiaConnection, message_type: Protocol async def _testable_process( - self: Any, peer: WSChiaConnection, message_type: ProtocolMessageTypes, message: Any + self: Any, peer: WSFlaxConnection, message_type: ProtocolMessageTypes, message: Any ) -> None: if await skip_processing(self, peer, message_type, message): return diff --git a/tests/plot_sync/util.py b/tests/plot_sync/util.py index c56de2b5c..81ea4945b 100644 --- a/tests/plot_sync/util.py +++ b/tests/plot_sync/util.py @@ -5,20 +5,20 @@ from secrets import token_bytes from typing import Optional -from chia.farmer.farmer import Farmer -from chia.harvester.harvester import Harvester -from chia.plot_sync.sender import Sender -from chia.protocols.harvester_protocol import PlotSyncIdentifier -from chia.server.start_service import Service -from chia.server.ws_connection import Message, NodeType -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint64 +from flax.farmer.farmer import Farmer +from flax.harvester.harvester import Harvester +from flax.plot_sync.sender import Sender +from flax.protocols.harvester_protocol import PlotSyncIdentifier +from flax.server.start_service import Service +from flax.server.ws_connection import Message, NodeType +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint64 @dataclass -class WSChiaConnectionDummy: +class WSFlaxConnectionDummy: connection_type: NodeType peer_node_id: bytes32 peer_host: str = "localhost" @@ -29,8 +29,8 @@ async def send_message(self, message: Message) -> None: self.last_sent_message = message -def get_dummy_connection(node_type: NodeType, peer_id: Optional[bytes32] = None) -> WSChiaConnectionDummy: - return WSChiaConnectionDummy(node_type, bytes32(token_bytes(32)) if peer_id is None else peer_id) +def get_dummy_connection(node_type: NodeType, peer_id: Optional[bytes32] = None) -> WSFlaxConnectionDummy: + return WSFlaxConnectionDummy(node_type, bytes32(token_bytes(32)) if peer_id is None else peer_id) def plot_sync_identifier(current_sync_id: uint64, message_id: uint64) -> PlotSyncIdentifier: diff --git a/tests/plotting/test_plot_manager.py b/tests/plotting/test_plot_manager.py index 27adea53c..b5b04802f 100644 --- a/tests/plotting/test_plot_manager.py +++ b/tests/plotting/test_plot_manager.py @@ -12,9 +12,9 @@ import pytest from blspy import G1Element -from chia.plotting.cache import CURRENT_VERSION, CacheDataV1 -from chia.plotting.manager import Cache, PlotManager -from chia.plotting.util import ( +from flax.plotting.cache import CURRENT_VERSION, CacheDataV1 +from flax.plotting.manager import Cache, PlotManager +from flax.plotting.util import ( PlotInfo, PlotRefreshEvents, PlotRefreshResult, @@ -23,11 +23,11 @@ remove_plot, remove_plot_directory, ) -from chia.simulator.block_tools import get_plot_dir -from chia.simulator.time_out_assert import time_out_assert -from chia.util.config import create_default_chia_config, lock_and_load_config, save_config -from chia.util.ints import uint16, uint32 -from chia.util.misc import VersionedBlob +from flax.simulator.block_tools import get_plot_dir +from flax.simulator.time_out_assert import time_out_assert +from flax.util.config import create_default_flax_config, lock_and_load_config, save_config +from flax.util.ints import uint16, uint32 +from flax.util.misc import VersionedBlob from tests.plotting.util import get_test_plots log = logging.getLogger(__name__) @@ -154,7 +154,7 @@ def environment(tmp_path, bt) -> Iterator[Environment]: dir_1: Directory = Directory(tmp_path / "plots" / "1", plots[0:dir_1_count]) dir_2: Directory = Directory(tmp_path / "plots" / "2", plots[dir_1_count : dir_1_count + dir_2_count]) - create_default_chia_config(tmp_path) + create_default_flax_config(tmp_path) refresh_tester = PlotRefreshTester(tmp_path) refresh_tester.plot_manager.set_public_keys(bt.plot_manager.farmer_public_keys, bt.plot_manager.pool_public_keys) diff --git a/tests/plotting/util.py b/tests/plotting/util.py index ba32d24f1..18b60e13a 100644 --- a/tests/plotting/util.py +++ b/tests/plotting/util.py @@ -3,7 +3,7 @@ from pathlib import Path from typing import List -from chia.simulator.block_tools import get_plot_dir +from flax.simulator.block_tools import get_plot_dir def get_test_plots(sub_dir: str = "") -> List[Path]: diff --git a/tests/pools/test_pool_cmdline.py b/tests/pools/test_pool_cmdline.py index 835ac4d95..c4e0c1b3c 100644 --- a/tests/pools/test_pool_cmdline.py +++ b/tests/pools/test_pool_cmdline.py @@ -4,8 +4,8 @@ import pytest from click.testing import CliRunner, Result -from chia.cmds.plotnft import validate_fee -from chia.cmds.plotnft import create_cmd, show_cmd +from flax.cmds.plotnft import validate_fee +from flax.cmds.plotnft import create_cmd, show_cmd pytestmark = pytest.mark.skip("TODO: Works locally but fails on CI, needs to be fixed!") diff --git a/tests/pools/test_pool_config.py b/tests/pools/test_pool_config.py index b114eaf38..fbb2f49ed 100644 --- a/tests/pools/test_pool_config.py +++ b/tests/pools/test_pool_config.py @@ -1,8 +1,8 @@ # flake8: noqa: E501 from blspy import AugSchemeMPL, PrivateKey -from chia.pools.pool_config import PoolWalletConfig -from chia.util.config import create_default_chia_config, load_config, lock_config, save_config +from flax.pools.pool_config import PoolWalletConfig +from flax.util.config import create_default_flax_config, load_config, lock_config, save_config def test_pool_config(tmp_path): @@ -11,7 +11,7 @@ def test_pool_config(tmp_path): eg_config = test_path / "config.yaml" to_config = test_path / "test_pool_config.yaml" - create_default_chia_config(test_root, ["config.yaml"]) + create_default_flax_config(test_root, ["config.yaml"]) assert eg_config.exists() eg_config.rename(to_config) config = load_config(test_root, "test_pool_config.yaml") diff --git a/tests/pools/test_pool_puzzles_lifecycle.py b/tests/pools/test_pool_puzzles_lifecycle.py index 80b19483b..7499a8d9e 100644 --- a/tests/pools/test_pool_puzzles_lifecycle.py +++ b/tests/pools/test_pool_puzzles_lifecycle.py @@ -5,23 +5,23 @@ from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.coin import Coin -from chia.types.coin_spend import CoinSpend -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint64, uint32 -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.coin import Coin +from flax.types.coin_spend import CoinSpend +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint64, uint32 +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( puzzle_for_pk, solution_for_conditions, calculate_synthetic_secret_key, DEFAULT_HIDDEN_PUZZLE_HASH, ) -from chia.wallet.puzzles.p2_conditions import puzzle_for_conditions -from chia.wallet.puzzles import singleton_top_layer -from chia.pools.pool_wallet_info import PoolState -from chia.pools.pool_puzzles import ( +from flax.wallet.puzzles.p2_conditions import puzzle_for_conditions +from flax.wallet.puzzles import singleton_top_layer +from flax.pools.pool_wallet_info import PoolState +from flax.pools.pool_puzzles import ( create_waiting_room_inner_puzzle, create_pooling_inner_puzzle, create_p2_singleton_puzzle, @@ -47,9 +47,9 @@ """ This test suite aims to test: - - chia.pools.pool_puzzles.py - - chia.wallet.puzzles.pool_member_innerpuz.clvm - - chia.wallet.puzzles.pool_waiting_room_innerpuz.clvm + - flax.pools.pool_puzzles.py + - flax.wallet.puzzles.pool_member_innerpuz.clvm + - flax.wallet.puzzles.pool_waiting_room_innerpuz.clvm """ diff --git a/tests/pools/test_pool_rpc.py b/tests/pools/test_pool_rpc.py index afdd884d3..b900f36e8 100644 --- a/tests/pools/test_pool_rpc.py +++ b/tests/pools/test_pool_rpc.py @@ -10,27 +10,27 @@ import pytest_asyncio from blspy import G1Element -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.full_node.full_node_api import FullNodeAPI -from chia.pools.pool_puzzles import SINGLETON_LAUNCHER_HASH -from chia.pools.pool_wallet_info import PoolSingletonState, PoolWalletInfo -from chia.protocols import full_node_protocol -from chia.protocols.full_node_protocol import RespondBlock -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.bech32m import encode_puzzle_hash -from chia.util.byte_types import hexstr_to_bytes -from chia.util.config import load_config -from chia.util.ints import uint16, uint32 -from chia.wallet.derive_keys import find_authentication_sk, find_owner_sk -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.wallet_types import WalletType -from chia.simulator.block_tools import BlockTools, get_plot_dir +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.full_node.full_node_api import FullNodeAPI +from flax.pools.pool_puzzles import SINGLETON_LAUNCHER_HASH +from flax.pools.pool_wallet_info import PoolSingletonState, PoolWalletInfo +from flax.protocols import full_node_protocol +from flax.protocols.full_node_protocol import RespondBlock +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.bech32m import encode_puzzle_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.util.config import load_config +from flax.util.ints import uint16, uint32 +from flax.wallet.derive_keys import find_authentication_sk, find_owner_sk +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.wallet_types import WalletType +from flax.simulator.block_tools import BlockTools, get_plot_dir from tests.util.wallet_is_synced import wallet_is_synced from tests.setup_nodes import setup_simulators_and_wallets -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none # TODO: Compare deducted fees in all tests against reported total_fee @@ -521,7 +521,7 @@ async def test_absorb_self(self, one_wallet_node_and_rpc, trusted_and_fee, self_ assert len(await wallet_node_0.wallet_state_manager.tx_store.get_unconfirmed_for_wallet(2)) == 0 tr: TransactionRecord = await client.send_transaction( - 1, 100, encode_puzzle_hash(status.p2_singleton_puzzle_hash, "txch") + 1, 100, encode_puzzle_hash(status.p2_singleton_puzzle_hash, "txfx") ) await time_out_assert( @@ -656,7 +656,7 @@ async def test_absorb_pooling(self, one_wallet_node_and_rpc, trusted_and_fee, se await time_out_assert(20, wallet_is_synced, True, wallet_node_0, full_node_api) our_ph = await wallet_0.get_new_puzzlehash() assert len(await client.get_wallets(WalletType.POOLING_WALLET)) == 0 - # Balance stars at 6 XCH + # Balance stars at 6 XFX assert (await wallet_0.get_confirmed_balance()) == 6000000000000 creation_tx: TransactionRecord = await client.create_new_pool_wallet( our_ph, "http://123.45.67.89", 10, f"{self_hostname}:5000", "new", "FARMING_TO_POOL", fee @@ -744,7 +744,7 @@ async def status_updated() -> bool: await wallet_node_0.wallet_state_manager.blockchain.get_finished_sync_up_to() == full_node_api.full_node.blockchain.get_peak().height ) - # Balance stars at 6 XCH and 5 more blocks are farmed, total 22 XCH + # Balance stars at 6 XFX and 5 more blocks are farmed, total 22 XFX assert (await wallet_0.get_confirmed_balance()) == 21999999999999 num_trials = 3 @@ -949,10 +949,10 @@ async def test_leave_pool(self, setup, trusted_and_fee, self_hostname): await farm_blocks(full_node_api, our_ph, 3) - async def have_chia(): + async def have_flax(): return (await wallets[0].get_confirmed_balance()) > FEE_AMOUNT - await time_out_assert(timeout=MAX_WAIT_SECS, function=have_chia) + await time_out_assert(timeout=MAX_WAIT_SECS, function=have_flax) await time_out_assert(20, wallet_is_synced, True, wallet_nodes[0], full_node_api) creation_tx: TransactionRecord = await client.create_new_pool_wallet( @@ -1086,10 +1086,10 @@ async def test_change_pools(self, setup, trusted_and_fee, self_hostname): await farm_blocks(full_node_api, our_ph, 3) - async def have_chia(): + async def have_flax(): return (await wallets[0].get_confirmed_balance()) > FEE_AMOUNT - await time_out_assert(timeout=WAIT_SECS, function=have_chia) + await time_out_assert(timeout=WAIT_SECS, function=have_flax) await time_out_assert(20, wallet_is_synced, True, wallet_nodes[0], full_node_api) creation_tx: TransactionRecord = await client.create_new_pool_wallet( @@ -1185,10 +1185,10 @@ async def test_change_pools_reorg(self, setup, trusted_and_fee, self_hostname): await farm_blocks(full_node_api, our_ph, 3) - async def have_chia(): + async def have_flax(): return (await wallets[0].get_confirmed_balance()) > FEE_AMOUNT - await time_out_assert(timeout=WAIT_SECS, function=have_chia) + await time_out_assert(timeout=WAIT_SECS, function=have_flax) await time_out_assert(20, wallet_is_synced, True, wallet_nodes[0], full_node_api) creation_tx: TransactionRecord = await client.create_new_pool_wallet( diff --git a/tests/pools/test_pool_wallet.py b/tests/pools/test_pool_wallet.py index 3d57d9ae5..1e3e38648 100644 --- a/tests/pools/test_pool_wallet.py +++ b/tests/pools/test_pool_wallet.py @@ -9,8 +9,8 @@ from blspy import G1Element from benchmarks.utils import rand_g1, rand_hash -from chia.pools.pool_wallet import PoolWallet -from chia.types.blockchain_format.sized_bytes import bytes32 +from flax.pools.pool_wallet import PoolWallet +from flax.types.blockchain_format.sized_bytes import bytes32 @dataclass @@ -78,7 +78,7 @@ async def test_update_pool_config_new_config(monkeypatch: Any) -> None: def mock_load_pool_config(root_path: Path) -> List[MockPoolWalletConfig]: return [] - monkeypatch.setattr("chia.pools.pool_wallet.load_pool_config", mock_load_pool_config) + monkeypatch.setattr("flax.pools.pool_wallet.load_pool_config", mock_load_pool_config) # Mock pool_config.update_pool_config to capture the updated configs async def mock_pool_config_update_pool_config( @@ -87,7 +87,7 @@ async def mock_pool_config_update_pool_config( nonlocal updated_configs updated_configs = pool_config_list - monkeypatch.setattr("chia.pools.pool_wallet.update_pool_config", mock_pool_config_update_pool_config) + monkeypatch.setattr("flax.pools.pool_wallet.update_pool_config", mock_pool_config_update_pool_config) # Mock PoolWallet.get_current_state to return our canned state async def mock_get_current_state(self: Any) -> Any: @@ -161,7 +161,7 @@ def mock_load_pool_config(root_path: Path) -> List[MockPoolWalletConfig]: nonlocal existing_config return [existing_config] - monkeypatch.setattr("chia.pools.pool_wallet.load_pool_config", mock_load_pool_config) + monkeypatch.setattr("flax.pools.pool_wallet.load_pool_config", mock_load_pool_config) # Mock pool_config.update_pool_config to capture the updated configs async def mock_pool_config_update_pool_config( @@ -170,7 +170,7 @@ async def mock_pool_config_update_pool_config( nonlocal updated_configs updated_configs = pool_config_list - monkeypatch.setattr("chia.pools.pool_wallet.update_pool_config", mock_pool_config_update_pool_config) + monkeypatch.setattr("flax.pools.pool_wallet.update_pool_config", mock_pool_config_update_pool_config) # Mock PoolWallet.get_current_state to return our canned state async def mock_get_current_state(self: Any) -> Any: diff --git a/tests/pools/test_wallet_pool_store.py b/tests/pools/test_wallet_pool_store.py index 5010f18a1..0e02113e7 100644 --- a/tests/pools/test_wallet_pool_store.py +++ b/tests/pools/test_wallet_pool_store.py @@ -4,13 +4,13 @@ import pytest from clvm_tools import binutils -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.util.ints import uint64 +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.util.ints import uint64 -from chia.wallet.wallet_pool_store import WalletPoolStore +from flax.wallet.wallet_pool_store import WalletPoolStore from tests.util.db_connection import DBConnection diff --git a/tests/setup_nodes.py b/tests/setup_nodes.py index abb5d8c52..b0499b053 100644 --- a/tests/setup_nodes.py +++ b/tests/setup_nodes.py @@ -3,19 +3,19 @@ from typing import AsyncIterator, Dict, List, Tuple, Optional, Union from pathlib import Path -from chia.consensus.constants import ConsensusConstants -from chia.full_node.full_node import FullNode -from chia.full_node.full_node_api import FullNodeAPI -from chia.protocols.shared_protocol import Capability -from chia.server.server import ChiaServer -from chia.server.start_data_layer import create_data_layer_service -from chia.server.start_service import Service -from chia.simulator.block_tools import BlockTools, create_block_tools_async, test_constants -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.types.peer_info import PeerInfo -from chia.util.hash import std_hash -from chia.util.ints import uint16, uint32 -from chia.wallet.wallet_node import WalletNode +from flax.consensus.constants import ConsensusConstants +from flax.full_node.full_node import FullNode +from flax.full_node.full_node_api import FullNodeAPI +from flax.protocols.shared_protocol import Capability +from flax.server.server import FlaxServer +from flax.server.start_data_layer import create_data_layer_service +from flax.server.start_service import Service +from flax.simulator.block_tools import BlockTools, create_block_tools_async, test_constants +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.types.peer_info import PeerInfo +from flax.util.hash import std_hash +from flax.util.ints import uint16, uint32 +from flax.wallet.wallet_node import WalletNode from tests.setup_services import ( setup_daemon, setup_farmer, @@ -27,12 +27,12 @@ setup_vdf_clients, setup_wallet_node, ) -from chia.simulator.time_out_assert import time_out_assert_custom_interval +from flax.simulator.time_out_assert import time_out_assert_custom_interval from tests.util.keyring import TempKeyring -from chia.simulator.socket import find_available_listen_port +from flax.simulator.socket import find_available_listen_port -SimulatorsAndWallets = Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools] +SimulatorsAndWallets = Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools] SimulatorsAndWalletsServices = Tuple[List[Service[FullNode]], List[Service[WalletNode]], BlockTools] @@ -192,7 +192,7 @@ async def setup_simulators_and_wallets( wallet_count: int, dic: Dict, spam_filter_after_n_txs=200, - xch_spam_amount=1000000, + xfx_spam_amount=1000000, *, key_seed=None, initial_num_public_keys=5, @@ -243,7 +243,7 @@ async def setup_simulators_and_wallets( wallet_bt_tools.constants, wallet_bt_tools, spam_filter_after_n_txs, - xch_spam_amount, + xfx_spam_amount, None, key_seed=seed, initial_num_public_keys=initial_num_public_keys, diff --git a/tests/setup_services.py b/tests/setup_services.py index 06f1c3f48..4479b2ea0 100644 --- a/tests/setup_services.py +++ b/tests/setup_services.py @@ -8,25 +8,25 @@ from secrets import token_bytes from typing import AsyncGenerator, List, Optional, Tuple -from chia.cmds.init_funcs import init -from chia.consensus.constants import ConsensusConstants -from chia.daemon.server import WebSocketServer, daemon_launch_lock_path -from chia.protocols.shared_protocol import Capability, capabilities -from chia.server.start_farmer import create_farmer_service -from chia.server.start_full_node import create_full_node_service -from chia.server.start_harvester import create_harvester_service -from chia.server.start_introducer import create_introducer_service -from chia.server.start_timelord import create_timelord_service -from chia.server.start_wallet import create_wallet_service -from chia.simulator.block_tools import BlockTools -from chia.simulator.start_simulator import create_full_node_simulator_service -from chia.timelord.timelord_launcher import kill_processes, spawn_process -from chia.types.peer_info import PeerInfo -from chia.util.bech32m import encode_puzzle_hash -from chia.util.config import lock_and_load_config, save_config -from chia.util.ints import uint16 -from chia.util.keychain import bytes_to_mnemonic -from chia.util.lock import Lockfile +from flax.cmds.init_funcs import init +from flax.consensus.constants import ConsensusConstants +from flax.daemon.server import WebSocketServer, daemon_launch_lock_path +from flax.protocols.shared_protocol import Capability, capabilities +from flax.server.start_farmer import create_farmer_service +from flax.server.start_full_node import create_full_node_service +from flax.server.start_harvester import create_harvester_service +from flax.server.start_introducer import create_introducer_service +from flax.server.start_timelord import create_timelord_service +from flax.server.start_wallet import create_wallet_service +from flax.simulator.block_tools import BlockTools +from flax.simulator.start_simulator import create_full_node_simulator_service +from flax.timelord.timelord_launcher import kill_processes, spawn_process +from flax.types.peer_info import PeerInfo +from flax.util.bech32m import encode_puzzle_hash +from flax.util.config import lock_and_load_config, save_config +from flax.util.ints import uint16 +from flax.util.keychain import bytes_to_mnemonic +from flax.util.lock import Lockfile from tests.util.keyring import TempKeyring log = logging.getLogger(__name__) @@ -154,7 +154,7 @@ async def setup_wallet_node( consensus_constants: ConsensusConstants, local_bt: BlockTools, spam_filter_after_n_txs=200, - xch_spam_amount=1000000, + xfx_spam_amount=1000000, full_node_port=None, introducer_port=None, key_seed=None, @@ -168,7 +168,7 @@ async def setup_wallet_node( service_config["rpc_port"] = 0 service_config["initial_num_public_keys"] = initial_num_public_keys service_config["spam_filter_after_n_txs"] = spam_filter_after_n_txs - service_config["xch_spam_amount"] = xch_spam_amount + service_config["xfx_spam_amount"] = xfx_spam_amount entropy = token_bytes(32) if key_seed is None: @@ -276,11 +276,11 @@ async def setup_farmer( service_config = root_config["farmer"] config_pool = root_config["pool"] - service_config["xch_target_address"] = encode_puzzle_hash(b_tools.farmer_ph, "xch") + service_config["xfx_target_address"] = encode_puzzle_hash(b_tools.farmer_ph, "xfx") service_config["pool_public_keys"] = [bytes(pk).hex() for pk in b_tools.pool_pubkeys] service_config["port"] = port service_config["rpc_port"] = uint16(0) - config_pool["xch_target_address"] = encode_puzzle_hash(b_tools.pool_ph, "xch") + config_pool["xfx_target_address"] = encode_puzzle_hash(b_tools.pool_ph, "xfx") if full_node_port: service_config["full_node_peer"]["host"] = self_hostname diff --git a/tests/simulation/test_simulation.py b/tests/simulation/test_simulation.py index 9bcbd6e8e..d35116426 100644 --- a/tests/simulation/test_simulation.py +++ b/tests/simulation/test_simulation.py @@ -3,16 +3,16 @@ import pytest import pytest_asyncio -from chia.cmds.units import units -from chia.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward -from chia.server.server import ChiaServer -from chia.simulator.block_tools import create_block_tools_async, BlockTools -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, GetAllCoinsProtocol, ReorgProtocol -from chia.simulator.time_out_assert import time_out_assert -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.wallet_node import WalletNode +from flax.cmds.units import units +from flax.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward +from flax.server.server import FlaxServer +from flax.simulator.block_tools import create_block_tools_async, BlockTools +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, GetAllCoinsProtocol, ReorgProtocol +from flax.simulator.time_out_assert import time_out_assert +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.wallet_node import WalletNode from tests.core.node_height import node_height_at_least from tests.setup_nodes import ( SimulatorsAndWallets, @@ -131,7 +131,7 @@ async def has_compact(node1, node2): @pytest.mark.asyncio async def test_simulator_auto_farm_and_get_coins( self, - two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], self_hostname: str, ) -> None: num_blocks = 2 @@ -253,11 +253,11 @@ async def test_simulation_farm_blocks( argvalues=[ [0, 0], [1, 2], - [(2 * units["chia"]) - 1, 2], - [2 * units["chia"], 2], - [(2 * units["chia"]) + 1, 4], - [3 * units["chia"], 4], - [10 * units["chia"], 10], + [(2 * units["flax"]) - 1, 2], + [2 * units["flax"], 2], + [(2 * units["flax"]) + 1, 4], + [3 * units["flax"], 4], + [10 * units["flax"], 10], ], ) async def test_simulation_farm_rewards( diff --git a/tests/simulation/test_start_simulator.py b/tests/simulation/test_start_simulator.py index e5492c243..4994b307c 100644 --- a/tests/simulation/test_start_simulator.py +++ b/tests/simulation/test_start_simulator.py @@ -7,13 +7,13 @@ import pytest import pytest_asyncio -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_full_node_rpc_client import SimulatorFullNodeRpcClient -from chia.simulator.simulator_test_tools import get_full_chia_simulator, get_puzzle_hash_from_key -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash -from chia.util.ints import uint16 +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_full_node_rpc_client import SimulatorFullNodeRpcClient +from flax.simulator.simulator_test_tools import get_full_flax_simulator, get_puzzle_hash_from_key +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash +from flax.util.ints import uint16 async def get_num_coins_for_ph(simulator_client: SimulatorFullNodeRpcClient, ph: bytes32) -> int: @@ -26,17 +26,17 @@ class TestStartSimulator: """ @pytest_asyncio.fixture(scope="function") - async def get_chia_simulator( - self, automated_testing: bool = False, chia_root: Optional[Path] = None, config: Optional[Dict[str, Any]] = None + async def get_flax_simulator( + self, automated_testing: bool = False, flax_root: Optional[Path] = None, config: Optional[Dict[str, Any]] = None ) -> AsyncGenerator[Tuple[FullNodeSimulator, Path, Dict[str, Any], str, int], None]: - async for simulator_args in get_full_chia_simulator(automated_testing, chia_root, config): + async for simulator_args in get_full_flax_simulator(automated_testing, flax_root, config): yield simulator_args @pytest.mark.asyncio async def test_start_simulator( - self, get_chia_simulator: Tuple[FullNodeSimulator, Path, Dict[str, Any], str, int] + self, get_flax_simulator: Tuple[FullNodeSimulator, Path, Dict[str, Any], str, int] ) -> None: - simulator, root_path, config, mnemonic, fingerprint = get_chia_simulator + simulator, root_path, config, mnemonic, fingerprint = get_flax_simulator ph_1 = get_puzzle_hash_from_key(fingerprint, key_id=1) ph_2 = get_puzzle_hash_from_key(fingerprint, key_id=2) dummy_hash = std_hash(b"test") diff --git a/tests/tools/test_run_block.py b/tests/tools/test_run_block.py index 37b684cf1..3aae0da14 100644 --- a/tests/tools/test_run_block.py +++ b/tests/tools/test_run_block.py @@ -4,9 +4,9 @@ from pathlib import Path from typing import List -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs from tools.run_block import run_json_block testnet10 = { diff --git a/tests/util/alert_server.py b/tests/util/alert_server.py index 74e326ac3..82b4e5091 100644 --- a/tests/util/alert_server.py +++ b/tests/util/alert_server.py @@ -75,7 +75,7 @@ def main(): if port is None or file_path is None: print( "Missing arguments, example usage:\n\n" - "python chia/util/alert_server.py -p 4000 -file_path /home/user/alert.txt\n" + "python flax/util/alert_server.py -p 4000 -file_path /home/user/alert.txt\n" ) quit() diff --git a/tests/util/benchmark_cost.py b/tests/util/benchmark_cost.py index 4c06772c0..f934e907c 100644 --- a/tests/util/benchmark_cost.py +++ b/tests/util/benchmark_cost.py @@ -4,14 +4,14 @@ from blspy import AugSchemeMPL, PrivateKey from clvm_tools import binutils -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.blockchain_format.program import Program, INFINITE_COST -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.util.ints import uint32 -from chia.simulator.wallet_tools import WalletTool -from chia.wallet.derive_keys import master_sk_to_wallet_sk -from chia.wallet.puzzles.p2_delegated_puzzle import puzzle_for_pk +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.blockchain_format.program import Program, INFINITE_COST +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.util.ints import uint32 +from flax.simulator.wallet_tools import WalletTool +from flax.wallet.derive_keys import master_sk_to_wallet_sk +from flax.wallet.puzzles.p2_delegated_puzzle import puzzle_for_pk def float_to_str(f): @@ -29,7 +29,7 @@ def float_to_str(f): return float_string -def run_and_return_cost_time(chialisp): +def run_and_return_cost_time(flaxlisp): start = time.time() clvm_loop = "((c (q ((c (f (a)) (c (f (a)) (c (f (r (a))) (c (f (r (r (a))))" @@ -37,7 +37,7 @@ def run_and_return_cost_time(chialisp): " (c (- (f (r (a))) (q 1)) (c (f (r (r (a)))) (q ()))))))" " ((c (f (r (r (a)))) (q ()))))) (q (q ()))) (a)))) (a))))" loop_program = Program.to(binutils.assemble(clvm_loop)) - clvm_loop_solution = f"(1000 {chialisp})" + clvm_loop_solution = f"(1000 {flaxlisp})" solution_program = Program.to(binutils.assemble(clvm_loop_solution)) cost, sexp = loop_program.run_with_cost(solution_program, INFINITE_COST) diff --git a/tests/util/blockchain.py b/tests/util/blockchain.py index 517d353b6..e2199fa3f 100644 --- a/tests/util/blockchain.py +++ b/tests/util/blockchain.py @@ -5,14 +5,14 @@ import tempfile -from chia.consensus.blockchain import Blockchain -from chia.consensus.constants import ConsensusConstants -from chia.full_node.block_store import BlockStore -from chia.full_node.coin_store import CoinStore -from chia.types.full_block import FullBlock -from chia.util.db_wrapper import DBWrapper2 -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.simulator.block_tools import BlockTools +from flax.consensus.blockchain import Blockchain +from flax.consensus.constants import ConsensusConstants +from flax.full_node.block_store import BlockStore +from flax.full_node.coin_store import CoinStore +from flax.types.full_block import FullBlock +from flax.util.db_wrapper import DBWrapper2 +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.simulator.block_tools import BlockTools async def create_blockchain(constants: ConsensusConstants, db_version: int): diff --git a/tests/util/build_network_protocol_files.py b/tests/util/build_network_protocol_files.py index 207b99383..f207eaa78 100644 --- a/tests/util/build_network_protocol_files.py +++ b/tests/util/build_network_protocol_files.py @@ -4,7 +4,7 @@ from typing import Callable, Any from pathlib import Path from tests.util.network_protocol_data import * # noqa: F403 -from chia.util.ints import uint32 +from flax.util.ints import uint32 version = "1.0" diff --git a/tests/util/db_connection.py b/tests/util/db_connection.py index 5173ee2dc..e7fe6a1a4 100644 --- a/tests/util/db_connection.py +++ b/tests/util/db_connection.py @@ -1,5 +1,5 @@ from pathlib import Path -from chia.util.db_wrapper import DBWrapper2 +from flax.util.db_wrapper import DBWrapper2 import tempfile diff --git a/tests/util/gen_ssl_certs.py b/tests/util/gen_ssl_certs.py index 7c3b8576a..f0f22efa9 100644 --- a/tests/util/gen_ssl_certs.py +++ b/tests/util/gen_ssl_certs.py @@ -6,7 +6,7 @@ import click from pytest import MonkeyPatch -from chia.ssl.create_ssl import generate_ca_signed_cert, get_chia_ca_crt_key, make_ca_cert +from flax.ssl.create_ssl import generate_ca_signed_cert, get_flax_ca_crt_key, make_ca_cert # NOTE: This is a standalone tool that can be used to generate a CA cert/key as well as node certs/keys. @@ -37,7 +37,7 @@ def patched_write_ssl_cert_and_key(cert_path: Path, cert_data: bytes, key_path: print() patch = MonkeyPatch() - patch.setattr("chia.ssl.create_ssl.write_ssl_cert_and_key", patched_write_ssl_cert_and_key) + patch.setattr("flax.ssl.create_ssl.write_ssl_cert_and_key", patched_write_ssl_cert_and_key) private_ca_crt: Optional[bytes] = None private_ca_key: Optional[bytes] = None @@ -77,14 +77,14 @@ def patched_write_ssl_cert_and_key(cert_path: Path, cert_data: bytes, key_path: }, } - chia_ca_crt, chia_ca_key = get_chia_ca_crt_key() + flax_ca_crt, flax_ca_key = get_flax_ca_crt_key() for node_name, cert_type_dict in node_certs_and_keys.items(): for cert_type, cert_dict in cert_type_dict.items(): crt = cert_dict["crt"] key = cert_dict["key"] - ca_crt = chia_ca_crt if cert_type == "public" else private_ca_crt - ca_key = chia_ca_key if cert_type == "public" else private_ca_key + ca_crt = flax_ca_crt if cert_type == "public" else private_ca_crt + ca_key = flax_ca_key if cert_type == "public" else private_ca_key generate_ca_signed_cert(ca_crt, ca_key, Path(crt), Path(key)) diff --git a/tests/util/generator_tools_testing.py b/tests/util/generator_tools_testing.py index 9fecf6969..00e3992b7 100644 --- a/tests/util/generator_tools_testing.py +++ b/tests/util/generator_tools_testing.py @@ -2,12 +2,12 @@ from typing import List, Tuple -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.types.generator_types import BlockGenerator -from chia.util.generator_tools import tx_removals_and_additions +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.types.generator_types import BlockGenerator +from flax.util.generator_tools import tx_removals_and_additions def run_and_get_removals_and_additions( diff --git a/tests/util/key_tool.py b/tests/util/key_tool.py index 4f504ef76..df31d39b9 100644 --- a/tests/util/key_tool.py +++ b/tests/util/key_tool.py @@ -2,10 +2,10 @@ from blspy import AugSchemeMPL, G2Element, PrivateKey -from chia.types.coin_spend import CoinSpend -from chia.util.condition_tools import conditions_by_opcode, conditions_for_solution, pkm_pairs_for_conditions_dict +from flax.types.coin_spend import CoinSpend +from flax.util.condition_tools import conditions_by_opcode, conditions_for_solution, pkm_pairs_for_conditions_dict from tests.core.make_block_generator import GROUP_ORDER, int_to_public_key -from chia.simulator.block_tools import test_constants +from flax.simulator.block_tools import test_constants class KeyTool(dict): diff --git a/tests/util/keyring.py b/tests/util/keyring.py index 349f84d0b..1983acfb9 100644 --- a/tests/util/keyring.py +++ b/tests/util/keyring.py @@ -2,9 +2,9 @@ import shutil import tempfile -from chia.util.file_keyring import FileKeyring, keyring_path_from_root -from chia.util.keychain import Keychain, default_keychain_service, default_keychain_user, get_private_key_user -from chia.util.keyring_wrapper import KeyringWrapper +from flax.util.file_keyring import FileKeyring, keyring_path_from_root +from flax.util.keychain import Keychain, default_keychain_service, default_keychain_user, get_private_key_user +from flax.util.keyring_wrapper import KeyringWrapper from functools import wraps from keyring.util import platform_ from keyrings.cryptfile.cryptfile import CryptFileKeyring # pyright: reportMissingImports=false @@ -100,7 +100,7 @@ def __init__( self, *, user: str = "testing-1.8.0", - service: str = "testing-chia-1.8.0", + service: str = "testing-flax-1.8.0", populate: bool = False, setup_cryptfilekeyring: bool = False, existing_keyring_path: str = None, @@ -132,7 +132,7 @@ def _patch_and_create_keychain( existing_keyring_dir = Path(existing_keyring_path).parent if existing_keyring_path else None temp_dir = existing_keyring_dir or tempfile.mkdtemp(prefix="test_keyring_wrapper") - mock_supports_os_passphrase_storage_patch = patch("chia.util.keychain.supports_os_passphrase_storage") + mock_supports_os_passphrase_storage_patch = patch("flax.util.keychain.supports_os_passphrase_storage") mock_supports_os_passphrase_storage = mock_supports_os_passphrase_storage_patch.start() # Patch supports_os_passphrase_storage() to return use_os_credential_store diff --git a/tests/util/misc.py b/tests/util/misc.py index d8999b01c..522fda31e 100644 --- a/tests/util/misc.py +++ b/tests/util/misc.py @@ -206,7 +206,7 @@ class _AssertRuntime: Produces output of the following form. Asserting maximum duration: full block - /home/altendky/repos/chia-blockchain/tests/core/full_node/test_performance.py:187 + /home/altendky/repos/flax-blockchain/tests/core/full_node/test_performance.py:187 run time: 0.027789528900002837 allowed: 0.1 percent: 28 % diff --git a/tests/util/network_protocol_data.py b/tests/util/network_protocol_data.py index 7316b64fa..29c29bbca 100644 --- a/tests/util/network_protocol_data.py +++ b/tests/util/network_protocol_data.py @@ -1,33 +1,33 @@ # flake8: noqa -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint8, uint16, uint32, uint64, uint128 -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.coin_spend import CoinSpend -from chia.types.blockchain_format.coin import Coin -from chia.types.spend_bundle import SpendBundle -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.types.weight_proof import WeightProof, SubEpochData, SubEpochChallengeSegment, SubSlotData, RecentChainData -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.blockchain_format.classgroup import ClassgroupElement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint8, uint16, uint32, uint64, uint128 +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.coin_spend import CoinSpend +from flax.types.blockchain_format.coin import Coin +from flax.types.spend_bundle import SpendBundle +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.types.weight_proof import WeightProof, SubEpochData, SubEpochChallengeSegment, SubSlotData, RecentChainData +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.blockchain_format.classgroup import ClassgroupElement from blspy import G1Element, G2Element -from chia.types.header_block import HeaderBlock -from chia.types.full_block import FullBlock -from chia.types.unfinished_block import UnfinishedBlock -from chia.types.blockchain_format.slots import ( +from flax.types.header_block import HeaderBlock +from flax.types.full_block import FullBlock +from flax.types.unfinished_block import UnfinishedBlock +from flax.types.blockchain_format.slots import ( ChallengeChainSubSlot, InfusedChallengeChainSubSlot, RewardChainSubSlot, SubSlotProofs, ) -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.peer_info import TimestampedPeerInfo -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock -from chia.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, FoliageBlockData, TransactionsInfo +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.peer_info import TimestampedPeerInfo +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock +from flax.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, FoliageBlockData, TransactionsInfo -from chia.protocols import ( +from flax.protocols import ( farmer_protocol, full_node_protocol, harvester_protocol, diff --git a/tests/util/rpc.py b/tests/util/rpc.py index 16a0525fe..39e59c409 100644 --- a/tests/util/rpc.py +++ b/tests/util/rpc.py @@ -1,7 +1,7 @@ from __future__ import annotations -from chia.rpc.rpc_client import RpcClient -from chia.rpc.rpc_server import RpcApiProtocol +from flax.rpc.rpc_client import RpcClient +from flax.rpc.rpc_server import RpcApiProtocol async def validate_get_routes(client: RpcClient, api: RpcApiProtocol) -> None: diff --git a/tests/util/test_chunks.py b/tests/util/test_chunks.py index 0ee081fd1..6dc111cc3 100644 --- a/tests/util/test_chunks.py +++ b/tests/util/test_chunks.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.util.chunks import chunks +from flax.util.chunks import chunks def test_chunks() -> None: diff --git a/tests/util/test_full_block_utils.py b/tests/util/test_full_block_utils.py index 05c5f15ef..d5d0a55a1 100644 --- a/tests/util/test_full_block_utils.py +++ b/tests/util/test_full_block_utils.py @@ -7,25 +7,25 @@ from blspy import G1Element, G2Element from benchmarks.utils import rand_bytes, rand_g1, rand_g2, rand_hash, rand_vdf, rand_vdf_proof, rewards -from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo -from chia.types.blockchain_format.pool_target import PoolTarget -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.proof_of_space import ProofOfSpace -from chia.types.blockchain_format.reward_chain_block import RewardChainBlock -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.slots import ( +from flax.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo +from flax.types.blockchain_format.pool_target import PoolTarget +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.proof_of_space import ProofOfSpace +from flax.types.blockchain_format.reward_chain_block import RewardChainBlock +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.slots import ( ChallengeChainSubSlot, InfusedChallengeChainSubSlot, RewardChainSubSlot, SubSlotProofs, ) -from chia.types.blockchain_format.vdf import VDFInfo, VDFProof -from chia.types.end_of_slot_bundle import EndOfSubSlotBundle -from chia.types.full_block import FullBlock -from chia.types.header_block import HeaderBlock -from chia.util.full_block_utils import block_info_from_block, generator_from_block, header_block_from_block -from chia.util.generator_tools import get_block_header -from chia.util.ints import uint8, uint32, uint64, uint128 +from flax.types.blockchain_format.vdf import VDFInfo, VDFProof +from flax.types.end_of_slot_bundle import EndOfSubSlotBundle +from flax.types.full_block import FullBlock +from flax.types.header_block import HeaderBlock +from flax.util.full_block_utils import block_info_from_block, generator_from_block, header_block_from_block +from flax.util.generator_tools import get_block_header +from flax.util.ints import uint8, uint32, uint64, uint128 test_g2s: List[G2Element] = [rand_g2() for _ in range(10)] test_g1s: List[G1Element] = [rand_g1() for _ in range(10)] diff --git a/tests/util/test_lock_queue.py b/tests/util/test_lock_queue.py index e725b7507..fc42a0cbb 100644 --- a/tests/util/test_lock_queue.py +++ b/tests/util/test_lock_queue.py @@ -5,7 +5,7 @@ import pytest -from chia.full_node.lock_queue import LockQueue, LockClient +from flax.full_node.lock_queue import LockQueue, LockClient log = logging.getLogger(__name__) diff --git a/tests/util/test_misc.py b/tests/util/test_misc.py index 2a038a942..987574b21 100644 --- a/tests/util/test_misc.py +++ b/tests/util/test_misc.py @@ -1,7 +1,7 @@ import pytest -from chia.util.errors import InvalidPathError -from chia.util.misc import format_bytes, validate_directory_writable -from chia.util.misc import format_minutes +from flax.util.errors import InvalidPathError +from flax.util.misc import format_bytes, validate_directory_writable +from flax.util.misc import format_minutes class TestMisc: diff --git a/tests/util/test_network.py b/tests/util/test_network.py index 27757c5db..ca2af0a86 100644 --- a/tests/util/test_network.py +++ b/tests/util/test_network.py @@ -2,7 +2,7 @@ import sys import pytest -from chia.util.network import get_host_addr +from flax.util.network import get_host_addr class TestNetwork: diff --git a/tests/util/test_network_protocol_test.py b/tests/util/test_network_protocol_test.py index 59ed21dc3..0e2effd0c 100644 --- a/tests/util/test_network_protocol_test.py +++ b/tests/util/test_network_protocol_test.py @@ -3,7 +3,7 @@ from typing import Any, List, Set -from chia.protocols import ( +from flax.protocols import ( farmer_protocol, full_node_protocol, harvester_protocol, @@ -32,7 +32,7 @@ def types_in_module(mod: Any) -> Set[str]: def test_missing_messages_state_machine() -> None: - from chia.protocols.protocol_state_machine import NO_REPLY_EXPECTED, VALID_REPLY_MESSAGE_MAP + from flax.protocols.protocol_state_machine import NO_REPLY_EXPECTED, VALID_REPLY_MESSAGE_MAP # if these asserts fail, make sure to add the new network protocol messages # to the visitor in build_network_protocol_files.py and rerun it. Then diff --git a/tests/util/test_paginator.py b/tests/util/test_paginator.py index 1277d41d2..009660435 100644 --- a/tests/util/test_paginator.py +++ b/tests/util/test_paginator.py @@ -5,7 +5,7 @@ import pytest -from chia.util.paginator import InvalidPageSizeError, InvalidPageSizeLimit, PageOutOfBoundsError, Paginator +from flax.util.paginator import InvalidPageSizeError, InvalidPageSizeLimit, PageOutOfBoundsError, Paginator @pytest.mark.parametrize( diff --git a/tests/util/test_struct_stream.py b/tests/util/test_struct_stream.py index 7ae56d862..d3f2997f9 100644 --- a/tests/util/test_struct_stream.py +++ b/tests/util/test_struct_stream.py @@ -15,8 +15,8 @@ from _pytest.fixtures import SubRequest from typing_extensions import final -from chia.util.ints import int8, uint8, int16, uint16, int32, uint32, int64, uint64, uint128, int512 -from chia.util.struct_stream import StructStream, parse_metadata_from_name +from flax.util.ints import int8, uint8, int16, uint16, int32, uint32, int64, uint64, uint128, int512 +from flax.util.struct_stream import StructStream, parse_metadata_from_name def dataclass_parameter(instance: object) -> ParameterSet: diff --git a/tests/util/wallet_is_synced.py b/tests/util/wallet_is_synced.py index 535fe73f9..49455b9b6 100644 --- a/tests/util/wallet_is_synced.py +++ b/tests/util/wallet_is_synced.py @@ -2,8 +2,8 @@ from typing import List -from chia.full_node.full_node_api import FullNodeAPI -from chia.wallet.wallet_node import WalletNode +from flax.full_node.full_node_api import FullNodeAPI +from flax.wallet.wallet_node import WalletNode async def wallet_is_synced(wallet_node: WalletNode, full_node_api: FullNodeAPI) -> bool: diff --git a/tests/wallet/cat_wallet/test_cat_lifecycle.py b/tests/wallet/cat_wallet/test_cat_lifecycle.py index 09bfeb167..186853019 100644 --- a/tests/wallet/cat_wallet/test_cat_lifecycle.py +++ b/tests/wallet/cat_wallet/test_cat_lifecycle.py @@ -4,23 +4,23 @@ from blspy import PrivateKey, AugSchemeMPL, G2Element from clvm.casts import int_to_bytes -from chia.clvm.spend_sim import SpendSim, SimClient -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.spend_bundle import SpendBundle -from chia.util.errors import Err -from chia.util.ints import uint64 -from chia.wallet.cat_wallet.cat_utils import ( +from flax.clvm.spend_sim import SpendSim, SimClient +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.spend_bundle import SpendBundle +from flax.util.errors import Err +from flax.util.ints import uint64 +from flax.wallet.cat_wallet.cat_utils import ( SpendableCAT, construct_cat_puzzle, unsigned_spend_bundle_for_spendable_cats, ) -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.puzzles.tails import ( +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.puzzles.tails import ( GenesisById, GenesisByPuzhash, EverythingWithSig, diff --git a/tests/wallet/cat_wallet/test_cat_outer_puzzle.py b/tests/wallet/cat_wallet/test_cat_outer_puzzle.py index 4e67300d5..954465a32 100644 --- a/tests/wallet/cat_wallet/test_cat_outer_puzzle.py +++ b/tests/wallet/cat_wallet/test_cat_outer_puzzle.py @@ -5,16 +5,16 @@ import pytest from clvm_tools.binutils import disassemble -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.util.ints import uint64 -from chia.wallet.cat_wallet.cat_utils import construct_cat_puzzle -from chia.wallet.outer_puzzles import construct_puzzle, get_inner_puzzle, get_inner_solution, match_puzzle, solve_puzzle -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.uncurried_puzzle import uncurry_puzzle +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.util.ints import uint64 +from flax.wallet.cat_wallet.cat_utils import construct_cat_puzzle +from flax.wallet.outer_puzzles import construct_puzzle, get_inner_puzzle, get_inner_solution, match_puzzle, solve_puzzle +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.uncurried_puzzle import uncurry_puzzle def test_cat_outer_puzzle() -> None: diff --git a/tests/wallet/cat_wallet/test_cat_wallet.py b/tests/wallet/cat_wallet/test_cat_wallet.py index d4b9988d9..261a69c70 100644 --- a/tests/wallet/cat_wallet/test_cat_wallet.py +++ b/tests/wallet/cat_wallet/test_cat_wallet.py @@ -3,21 +3,21 @@ import pytest -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.full_node.mempool_manager import MempoolManager -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.cat_wallet.cat_constants import DEFAULT_CATS -from chia.wallet.cat_wallet.cat_info import LegacyCATInfo -from chia.wallet.cat_wallet.cat_utils import construct_cat_puzzle -from chia.wallet.cat_wallet.cat_wallet import CATWallet -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.wallet_info import WalletInfo -from chia.simulator.time_out_assert import time_out_assert +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.full_node.mempool_manager import MempoolManager +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.cat_wallet.cat_constants import DEFAULT_CATS +from flax.wallet.cat_wallet.cat_info import LegacyCATInfo +from flax.wallet.cat_wallet.cat_utils import construct_cat_puzzle +from flax.wallet.cat_wallet.cat_wallet import CATWallet +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.wallet_info import WalletInfo +from flax.simulator.time_out_assert import time_out_assert from tests.util.wallet_is_synced import wallet_is_synced diff --git a/tests/wallet/cat_wallet/test_offer_lifecycle.py b/tests/wallet/cat_wallet/test_offer_lifecycle.py index c4492656f..c9b70023d 100644 --- a/tests/wallet/cat_wallet/test_offer_lifecycle.py +++ b/tests/wallet/cat_wallet/test_offer_lifecycle.py @@ -3,24 +3,24 @@ import pytest from blspy import G2Element -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint64 -from chia.wallet.cat_wallet.cat_utils import ( +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint64 +from flax.wallet.cat_wallet.cat_utils import ( construct_cat_puzzle, SpendableCAT, unsigned_spend_bundle_for_spendable_cats, ) -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.outer_puzzles import AssetType -from chia.wallet.puzzle_drivers import PuzzleInfo -from chia.wallet.payment import Payment -from chia.wallet.trading.offer import Offer, NotarizedPayment +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.outer_puzzles import AssetType +from flax.wallet.puzzle_drivers import PuzzleInfo +from flax.wallet.payment import Payment +from flax.wallet.trading.offer import Offer, NotarizedPayment from tests.clvm.benchmark_costs import cost_of_spend_bundle acs = Program.to(1) @@ -40,7 +40,7 @@ def str_to_cat_hash(tail_str: str) -> bytes32: return construct_cat_puzzle(CAT_MOD, str_to_tail_hash(tail_str), acs).get_tree_hash() -# This method takes a dictionary of strings mapping to amounts and generates the appropriate CAT/XCH coins +# This method takes a dictionary of strings mapping to amounts and generates the appropriate CAT/XFX coins async def generate_coins( sim, sim_client, @@ -176,7 +176,7 @@ async def test_complex_offer(self, setup_sim): "blue": [3000], } all_coins: Dict[Optional[str], List[Coin]] = await generate_coins(sim, sim_client, coins_needed) - chia_coins: List[Coin] = all_coins[None] + flax_coins: List[Coin] = all_coins[None] red_coins: List[Coin] = all_coins["red"] blue_coins: List[Coin] = all_coins["blue"] @@ -193,23 +193,23 @@ async def test_complex_offer(self, setup_sim): for key, value in driver_dict.items(): driver_dict_as_infos[key.hex()] = value.info - # Create an XCH Offer for RED - chia_requested_payments: Dict[Optional[bytes32], List[Payment]] = { + # Create an XFX Offer for RED + flax_requested_payments: Dict[Optional[bytes32], List[Payment]] = { str_to_tail_hash("red"): [ Payment(acs_ph, 100, [b"memo"]), Payment(acs_ph, 200, [b"memo"]), ] } - chia_requested_payments: Dict[Optional[bytes32], List[NotarizedPayment]] = Offer.notarize_payments( - chia_requested_payments, chia_coins + flax_requested_payments: Dict[Optional[bytes32], List[NotarizedPayment]] = Offer.notarize_payments( + flax_requested_payments, flax_coins ) - chia_announcements: List[Announcement] = Offer.calculate_announcements(chia_requested_payments, driver_dict) - chia_secured_bundle: SpendBundle = generate_secure_bundle(chia_coins, chia_announcements, 1000) - chia_offer = Offer(chia_requested_payments, chia_secured_bundle, driver_dict) - assert not chia_offer.is_valid() + flax_announcements: List[Announcement] = Offer.calculate_announcements(flax_requested_payments, driver_dict) + flax_secured_bundle: SpendBundle = generate_secure_bundle(flax_coins, flax_announcements, 1000) + flax_offer = Offer(flax_requested_payments, flax_secured_bundle, driver_dict) + assert not flax_offer.is_valid() - # Create a RED Offer for XCH + # Create a RED Offer for XFX red_coins_1 = red_coins[0:1] red_coins_2 = red_coins[1:] red_requested_payments: Dict[Optional[bytes32], List[Payment]] = { @@ -248,12 +248,12 @@ async def test_complex_offer(self, setup_sim): assert not red_offer_2.is_valid() # Test aggregation of offers - new_offer = Offer.aggregate([chia_offer, red_offer, red_offer_2]) + new_offer = Offer.aggregate([flax_offer, red_offer, red_offer_2]) assert new_offer.get_offered_amounts() == {None: 1000, str_to_tail_hash("red"): 350} assert new_offer.get_requested_amounts() == {None: 700, str_to_tail_hash("red"): 300} assert new_offer.is_valid() - # Create yet another offer of BLUE for XCH and RED + # Create yet another offer of BLUE for XFX and RED blue_requested_payments: Dict[Optional[bytes32], List[Payment]] = { None: [ Payment(acs_ph, 200, [b"blue memo"]), @@ -283,15 +283,15 @@ async def test_complex_offer(self, setup_sim): assert new_offer.get_requested_amounts() == {None: 900, str_to_tail_hash("red"): 350} assert new_offer.summary() == ( { - "xch": 1000, + "xfx": 1000, str_to_tail_hash("red").hex(): 350, str_to_tail_hash("blue").hex(): 2000, }, - {"xch": 900, str_to_tail_hash("red").hex(): 350}, + {"xfx": 900, str_to_tail_hash("red").hex(): 350}, driver_dict_as_infos, ) assert new_offer.get_pending_amounts() == { - "xch": 1200, + "xfx": 1200, str_to_tail_hash("red").hex(): 350, str_to_tail_hash("blue").hex(): 3000, } diff --git a/tests/wallet/cat_wallet/test_trades.py b/tests/wallet/cat_wallet/test_trades.py index bb389f29e..c0fff3c52 100644 --- a/tests/wallet/cat_wallet/test_trades.py +++ b/tests/wallet/cat_wallet/test_trades.py @@ -6,21 +6,21 @@ import pytest -from chia.consensus.cost_calculator import NPCResult -from chia.full_node.bundle_tools import simple_solution_generator -from chia.full_node.mempool_check_conditions import get_name_puzzle_conditions -from chia.full_node.mempool_manager import MempoolManager -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.program import INFINITE_COST -from chia.util.ints import uint64 -from chia.wallet.cat_wallet.cat_wallet import CATWallet -from chia.wallet.outer_puzzles import AssetType -from chia.wallet.puzzle_drivers import PuzzleInfo -from chia.wallet.trading.offer import Offer -from chia.wallet.trading.trade_status import TradeStatus -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.transaction_type import TransactionType +from flax.consensus.cost_calculator import NPCResult +from flax.full_node.bundle_tools import simple_solution_generator +from flax.full_node.mempool_check_conditions import get_name_puzzle_conditions +from flax.full_node.mempool_manager import MempoolManager +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.program import INFINITE_COST +from flax.util.ints import uint64 +from flax.wallet.cat_wallet.cat_wallet import CATWallet +from flax.wallet.outer_puzzles import AssetType +from flax.wallet.puzzle_drivers import PuzzleInfo +from flax.wallet.trading.offer import Offer +from flax.wallet.trading.trade_status import TradeStatus +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.transaction_type import TransactionType async def tx_in_pool(mempool: MempoolManager, tx_id): @@ -76,20 +76,20 @@ async def test_cat_trades(self, wallets_prefarm): ) # Create the trade parameters - MAKER_CHIA_BALANCE = initial_maker_balance - 100 - TAKER_CHIA_BALANCE = initial_taker_balance - 100 - await time_out_assert(25, wallet_maker.get_confirmed_balance, MAKER_CHIA_BALANCE) - await time_out_assert(25, wallet_taker.get_unconfirmed_balance, TAKER_CHIA_BALANCE) + MAKER_FLAX_BALANCE = initial_maker_balance - 100 + TAKER_FLAX_BALANCE = initial_taker_balance - 100 + await time_out_assert(25, wallet_maker.get_confirmed_balance, MAKER_FLAX_BALANCE) + await time_out_assert(25, wallet_taker.get_unconfirmed_balance, TAKER_FLAX_BALANCE) MAKER_CAT_BALANCE = 100 MAKER_NEW_CAT_BALANCE = 0 TAKER_CAT_BALANCE = 0 TAKER_NEW_CAT_BALANCE = 100 - chia_for_cat = { + flax_for_cat = { wallet_maker.id(): -1, bytes.fromhex(new_cat_wallet_maker.get_asset_id()): 2, # This is the CAT that the taker made } - cat_for_chia = { + cat_for_flax = { wallet_maker.id(): 3, cat_wallet_maker.id(): -4, # The taker has no knowledge of this CAT yet } @@ -97,17 +97,17 @@ async def test_cat_trades(self, wallets_prefarm): bytes.fromhex(cat_wallet_maker.get_asset_id()): -5, new_cat_wallet_maker.id(): 6, } - chia_for_multiple_cat = { + flax_for_multiple_cat = { wallet_maker.id(): -7, cat_wallet_maker.id(): 8, new_cat_wallet_maker.id(): 9, } - multiple_cat_for_chia = { + multiple_cat_for_flax = { wallet_maker.id(): 10, cat_wallet_maker.id(): -11, new_cat_wallet_maker.id(): -12, } - chia_and_cat_for_cat = { + flax_and_cat_for_cat = { wallet_maker.id(): -13, cat_wallet_maker.id(): -14, new_cat_wallet_maker.id(): 15, @@ -127,8 +127,8 @@ async def test_cat_trades(self, wallets_prefarm): trade_manager_taker = wallet_node_taker.wallet_state_manager.trade_manager # Execute all of the trades - # chia_for_cat - success, trade_make, error = await trade_manager_maker.create_offer_for_ids(chia_for_cat, fee=uint64(1)) + # flax_for_cat + success, trade_make, error = await trade_manager_maker.create_offer_for_ids(flax_for_cat, fee=uint64(1)) await asyncio.sleep(1) assert error is None assert success is True @@ -146,23 +146,23 @@ async def test_cat_trades(self, wallets_prefarm): first_offer = Offer.from_bytes(trade_take.offer) - MAKER_CHIA_BALANCE -= 2 # -1 and -1 for fee + MAKER_FLAX_BALANCE -= 2 # -1 and -1 for fee MAKER_NEW_CAT_BALANCE += 2 - TAKER_CHIA_BALANCE += 0 # +1 and -1 for fee + TAKER_FLAX_BALANCE += 0 # +1 and -1 for fee TAKER_NEW_CAT_BALANCE -= 2 - await time_out_assert(15, wallet_taker.get_unconfirmed_balance, TAKER_CHIA_BALANCE) + await time_out_assert(15, wallet_taker.get_unconfirmed_balance, TAKER_FLAX_BALANCE) await time_out_assert(15, new_cat_wallet_taker.get_unconfirmed_balance, TAKER_NEW_CAT_BALANCE) for i in range(0, buffer_blocks): await full_node.farm_new_transaction_block(FarmNewBlockProtocol(token_bytes())) - await time_out_assert(15, wallet_maker.get_confirmed_balance, MAKER_CHIA_BALANCE) - await time_out_assert(15, wallet_maker.get_unconfirmed_balance, MAKER_CHIA_BALANCE) + await time_out_assert(15, wallet_maker.get_confirmed_balance, MAKER_FLAX_BALANCE) + await time_out_assert(15, wallet_maker.get_unconfirmed_balance, MAKER_FLAX_BALANCE) await time_out_assert(15, new_cat_wallet_maker.get_confirmed_balance, MAKER_NEW_CAT_BALANCE) await time_out_assert(15, new_cat_wallet_maker.get_unconfirmed_balance, MAKER_NEW_CAT_BALANCE) - await time_out_assert(15, wallet_taker.get_confirmed_balance, TAKER_CHIA_BALANCE) - await time_out_assert(15, wallet_taker.get_unconfirmed_balance, TAKER_CHIA_BALANCE) + await time_out_assert(15, wallet_taker.get_confirmed_balance, TAKER_FLAX_BALANCE) + await time_out_assert(15, wallet_taker.get_unconfirmed_balance, TAKER_FLAX_BALANCE) await time_out_assert(15, new_cat_wallet_taker.get_confirmed_balance, TAKER_NEW_CAT_BALANCE) await time_out_assert(15, new_cat_wallet_taker.get_unconfirmed_balance, TAKER_NEW_CAT_BALANCE) @@ -180,8 +180,8 @@ async def assert_trade_tx_number(wallet_node, trade_id, number): await time_out_assert(15, assert_trade_tx_number, True, wallet_node_maker, trade_make.trade_id, 1) await time_out_assert(15, assert_trade_tx_number, True, wallet_node_taker, trade_take.trade_id, 3) - # cat_for_chia - success, trade_make, error = await trade_manager_maker.create_offer_for_ids(cat_for_chia) + # cat_for_flax + success, trade_make, error = await trade_manager_maker.create_offer_for_ids(cat_for_flax) await asyncio.sleep(1) assert error is None assert success is True @@ -196,26 +196,26 @@ async def assert_trade_tx_number(wallet_node, trade_id, number): assert trade_take is not None MAKER_CAT_BALANCE -= 4 - MAKER_CHIA_BALANCE += 3 + MAKER_FLAX_BALANCE += 3 TAKER_CAT_BALANCE += 4 - TAKER_CHIA_BALANCE -= 3 + TAKER_FLAX_BALANCE -= 3 cat_wallet_taker: CATWallet = await wallet_node_taker.wallet_state_manager.get_wallet_for_asset_id( cat_wallet_maker.get_asset_id() ) - await time_out_assert(15, wallet_taker.get_unconfirmed_balance, TAKER_CHIA_BALANCE) + await time_out_assert(15, wallet_taker.get_unconfirmed_balance, TAKER_FLAX_BALANCE) await time_out_assert(15, cat_wallet_taker.get_unconfirmed_balance, TAKER_CAT_BALANCE) for i in range(0, buffer_blocks): await full_node.farm_new_transaction_block(FarmNewBlockProtocol(token_bytes())) - await time_out_assert(15, wallet_maker.get_confirmed_balance, MAKER_CHIA_BALANCE) - await time_out_assert(15, wallet_maker.get_unconfirmed_balance, MAKER_CHIA_BALANCE) + await time_out_assert(15, wallet_maker.get_confirmed_balance, MAKER_FLAX_BALANCE) + await time_out_assert(15, wallet_maker.get_unconfirmed_balance, MAKER_FLAX_BALANCE) await time_out_assert(15, cat_wallet_maker.get_confirmed_balance, MAKER_CAT_BALANCE) await time_out_assert(15, cat_wallet_maker.get_unconfirmed_balance, MAKER_CAT_BALANCE) - await time_out_assert(15, wallet_taker.get_confirmed_balance, TAKER_CHIA_BALANCE) - await time_out_assert(15, wallet_taker.get_unconfirmed_balance, TAKER_CHIA_BALANCE) + await time_out_assert(15, wallet_taker.get_confirmed_balance, TAKER_FLAX_BALANCE) + await time_out_assert(15, wallet_taker.get_unconfirmed_balance, TAKER_FLAX_BALANCE) await time_out_assert(15, cat_wallet_taker.get_confirmed_balance, TAKER_CAT_BALANCE) await time_out_assert(15, cat_wallet_taker.get_unconfirmed_balance, TAKER_CAT_BALANCE) await time_out_assert(15, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_maker, trade_make) @@ -261,9 +261,9 @@ async def assert_trade_tx_number(wallet_node, trade_id, number): await time_out_assert(15, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_maker, trade_make) await time_out_assert(15, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_taker, trade_take) - # chia_for_multiple_cat + # flax_for_multiple_cat success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - chia_for_multiple_cat, driver_dict=driver_dict + flax_for_multiple_cat, driver_dict=driver_dict ) await asyncio.sleep(1) assert error is None @@ -279,10 +279,10 @@ async def assert_trade_tx_number(wallet_node, trade_id, number): third_offer = Offer.from_bytes(trade_take.offer) - MAKER_CHIA_BALANCE -= 7 + MAKER_FLAX_BALANCE -= 7 MAKER_CAT_BALANCE += 8 MAKER_NEW_CAT_BALANCE += 9 - TAKER_CHIA_BALANCE += 7 + TAKER_FLAX_BALANCE += 7 TAKER_CAT_BALANCE -= 8 TAKER_NEW_CAT_BALANCE -= 9 @@ -303,8 +303,8 @@ async def assert_trade_tx_number(wallet_node, trade_id, number): await time_out_assert(15, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_maker, trade_make) await time_out_assert(15, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_taker, trade_take) - # multiple_cat_for_chia - success, trade_make, error = await trade_manager_maker.create_offer_for_ids(multiple_cat_for_chia) + # multiple_cat_for_flax + success, trade_make, error = await trade_manager_maker.create_offer_for_ids(multiple_cat_for_flax) await asyncio.sleep(1) assert error is None assert success is True @@ -321,10 +321,10 @@ async def assert_trade_tx_number(wallet_node, trade_id, number): MAKER_CAT_BALANCE -= 11 MAKER_NEW_CAT_BALANCE -= 12 - MAKER_CHIA_BALANCE += 10 + MAKER_FLAX_BALANCE += 10 TAKER_CAT_BALANCE += 11 TAKER_NEW_CAT_BALANCE += 12 - TAKER_CHIA_BALANCE -= 10 + TAKER_FLAX_BALANCE -= 10 await time_out_assert(15, new_cat_wallet_taker.get_unconfirmed_balance, TAKER_NEW_CAT_BALANCE) await time_out_assert(15, cat_wallet_taker.get_unconfirmed_balance, TAKER_CAT_BALANCE) @@ -343,8 +343,8 @@ async def assert_trade_tx_number(wallet_node, trade_id, number): await time_out_assert(15, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_maker, trade_make) await time_out_assert(15, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_taker, trade_take) - # chia_and_cat_for_cat - success, trade_make, error = await trade_manager_maker.create_offer_for_ids(chia_and_cat_for_cat) + # flax_and_cat_for_cat + success, trade_make, error = await trade_manager_maker.create_offer_for_ids(flax_and_cat_for_cat) await asyncio.sleep(1) assert error is None assert success is True @@ -359,10 +359,10 @@ async def assert_trade_tx_number(wallet_node, trade_id, number): fifth_offer = Offer.from_bytes(trade_take.offer) - MAKER_CHIA_BALANCE -= 13 + MAKER_FLAX_BALANCE -= 13 MAKER_CAT_BALANCE -= 14 MAKER_NEW_CAT_BALANCE += 15 - TAKER_CHIA_BALANCE += 13 + TAKER_FLAX_BALANCE += 13 TAKER_CAT_BALANCE += 14 TAKER_NEW_CAT_BALANCE -= 15 @@ -400,11 +400,11 @@ async def test_trade_cancellation(self, wallets_prefarm): wallet_maker = wallet_node_maker.wallet_state_manager.main_wallet wallet_taker = wallet_node_taker.wallet_state_manager.main_wallet - xch_to_cat_amount = uint64(100) + xfx_to_cat_amount = uint64(100) async with wallet_node_maker.wallet_state_manager.lock: cat_wallet_maker: CATWallet = await CATWallet.create_new_cat_wallet( - wallet_node_maker.wallet_state_manager, wallet_maker, {"identifier": "genesis_by_id"}, xch_to_cat_amount + wallet_node_maker.wallet_state_manager, wallet_maker, {"identifier": "genesis_by_id"}, xfx_to_cat_amount ) tx_queue: List[TransactionRecord] = await wallet_node_maker.wallet_state_manager.tx_store.get_not_sent() @@ -415,17 +415,17 @@ async def test_trade_cancellation(self, wallets_prefarm): for i in range(1, buffer_blocks): await full_node.farm_new_transaction_block(FarmNewBlockProtocol(token_bytes())) - await time_out_assert(15, cat_wallet_maker.get_confirmed_balance, xch_to_cat_amount) - await time_out_assert(15, cat_wallet_maker.get_unconfirmed_balance, xch_to_cat_amount) - maker_funds -= xch_to_cat_amount + await time_out_assert(15, cat_wallet_maker.get_confirmed_balance, xfx_to_cat_amount) + await time_out_assert(15, cat_wallet_maker.get_unconfirmed_balance, xfx_to_cat_amount) + maker_funds -= xfx_to_cat_amount await time_out_assert(15, wallet_maker.get_confirmed_balance, maker_funds) - cat_for_chia = { + cat_for_flax = { wallet_maker.id(): 1, cat_wallet_maker.id(): -2, } - chia_for_cat = { + flax_for_cat = { wallet_maker.id(): -3, cat_wallet_maker.id(): 4, } @@ -437,7 +437,7 @@ async def get_trade_and_status(trade_manager, trade) -> TradeStatus: trade_rec = await trade_manager.get_trade_by_id(trade.trade_id) return TradeStatus(trade_rec.status) - success, trade_make, error = await trade_manager_maker.create_offer_for_ids(cat_for_chia) + success, trade_make, error = await trade_manager_maker.create_offer_for_ids(cat_for_flax) await asyncio.sleep(1) assert error is None assert success is True @@ -488,7 +488,7 @@ async def get_trade_and_status(trade_manager, trade) -> TradeStatus: await time_out_assert(15, wallet_maker.get_pending_change_balance, 0) await time_out_assert(15, wallet_maker.get_confirmed_balance, maker_funds - fee) - await time_out_assert(15, cat_wallet_maker.get_confirmed_balance, xch_to_cat_amount) + await time_out_assert(15, cat_wallet_maker.get_confirmed_balance, xfx_to_cat_amount) await time_out_assert(15, wallet_taker.get_confirmed_balance, taker_funds) peer = wallet_node_taker.get_full_node_peer() @@ -502,7 +502,7 @@ async def get_trade_and_status(trade_manager, trade) -> TradeStatus: assert trade_take is None # Now we're going to create the other way around for test coverage sake - success, trade_make, error = await trade_manager_maker.create_offer_for_ids(chia_for_cat) + success, trade_make, error = await trade_manager_maker.create_offer_for_ids(flax_for_cat) await asyncio.sleep(1) assert error is None assert success is True diff --git a/tests/wallet/db_wallet/test_db_graftroot.py b/tests/wallet/db_wallet/test_db_graftroot.py index 82b2867cc..def2065d0 100644 --- a/tests/wallet/db_wallet/test_db_graftroot.py +++ b/tests/wallet/db_wallet/test_db_graftroot.py @@ -5,16 +5,16 @@ import pytest from blspy import G2Element -from chia.clvm.spend_sim import SimClient, SpendSim -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.spend_bundle import SpendBundle -from chia.util.errors import Err -from chia.wallet.puzzles.load_clvm import load_clvm -from chia.wallet.util.merkle_utils import build_merkle_tree, build_merkle_tree_from_binary_tree, simplify_merkle_proof +from flax.clvm.spend_sim import SimClient, SpendSim +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.spend_bundle import SpendBundle +from flax.util.errors import Err +from flax.wallet.puzzles.load_clvm import load_clvm +from flax.wallet.util.merkle_utils import build_merkle_tree, build_merkle_tree_from_binary_tree, simplify_merkle_proof GRAFTROOT_MOD = load_clvm("graftroot_dl_offers.clvm") diff --git a/tests/wallet/db_wallet/test_dl_offers.py b/tests/wallet/db_wallet/test_dl_offers.py index c02edb476..6badef1c2 100644 --- a/tests/wallet/db_wallet/test_dl_offers.py +++ b/tests/wallet/db_wallet/test_dl_offers.py @@ -5,15 +5,15 @@ import pytest -from chia.data_layer.data_layer_wallet import DataLayerWallet -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint64 -from chia.wallet.puzzle_drivers import Solver -from chia.wallet.trade_record import TradeRecord -from chia.wallet.trading.offer import Offer -from chia.wallet.trading.trade_status import TradeStatus -from chia.wallet.util.merkle_utils import build_merkle_tree, simplify_merkle_proof +from flax.data_layer.data_layer_wallet import DataLayerWallet +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint64 +from flax.wallet.puzzle_drivers import Solver +from flax.wallet.trade_record import TradeRecord +from flax.wallet.trading.offer import Offer +from flax.wallet.trading.trade_status import TradeStatus +from flax.wallet.util.merkle_utils import build_merkle_tree, simplify_merkle_proof async def is_singleton_confirmed_and_root(dl_wallet: DataLayerWallet, lid: bytes32, root: bytes32) -> bool: diff --git a/tests/wallet/db_wallet/test_dl_wallet.py b/tests/wallet/db_wallet/test_dl_wallet.py index 5bf9b9f83..d3cb7ee5b 100644 --- a/tests/wallet/db_wallet/test_dl_wallet.py +++ b/tests/wallet/db_wallet/test_dl_wallet.py @@ -7,16 +7,16 @@ import pytest import pytest_asyncio -from chia.data_layer.data_layer_wallet import DataLayerWallet, Mirror -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.db_wallet.db_wallet_puzzles import create_mirror_puzzle -from chia.wallet.util.merkle_tree import MerkleTree +from flax.data_layer.data_layer_wallet import DataLayerWallet, Mirror +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.db_wallet.db_wallet_puzzles import create_mirror_puzzle +from flax.wallet.util.merkle_tree import MerkleTree from tests.setup_nodes import SimulatorsAndWallets, setup_simulators_and_wallets pytestmark = pytest.mark.data_layer diff --git a/tests/wallet/did_wallet/test_did.py b/tests/wallet/did_wallet/test_did.py index 54b76a1eb..67bb15df1 100644 --- a/tests/wallet/did_wallet/test_did.py +++ b/tests/wallet/did_wallet/test_did.py @@ -4,19 +4,19 @@ import pytest from blspy import AugSchemeMPL, G1Element, G2Element -from chia.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward -from chia.rpc.wallet_rpc_api import WalletRpcApi -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.types.blockchain_format.program import Program -from chia.types.peer_info import PeerInfo -from chia.types.spend_bundle import SpendBundle -from chia.util.bech32m import encode_puzzle_hash -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.util.address_type import AddressType - -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.did_wallet.did_wallet import DIDWallet -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward +from flax.rpc.wallet_rpc_api import WalletRpcApi +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.types.blockchain_format.program import Program +from flax.types.peer_info import PeerInfo +from flax.types.spend_bundle import SpendBundle +from flax.util.bech32m import encode_puzzle_hash +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.util.address_type import AddressType + +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.did_wallet.did_wallet import DIDWallet +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none # pytestmark = pytest.mark.skip("TODO: Fix tests") @@ -906,7 +906,7 @@ async def test_did_sign_message(self, two_wallet_nodes, trusted): "message": message, } ) - puzzle: Program = Program.to(("Chia Signed Message", message)) + puzzle: Program = Program.to(("Flax Signed Message", message)) assert AugSchemeMPL.verify( G1Element.from_bytes(bytes.fromhex(response["pubkey"])), puzzle.get_tree_hash(), diff --git a/tests/wallet/nft_wallet/test_nft_1_offers.py b/tests/wallet/nft_wallet/test_nft_1_offers.py index 59509ad0e..515014989 100644 --- a/tests/wallet/nft_wallet/test_nft_1_offers.py +++ b/tests/wallet/nft_wallet/test_nft_1_offers.py @@ -7,24 +7,24 @@ import pytest -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.full_node.mempool_manager import MempoolManager -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16, uint32, uint64, uint128 -from chia.wallet.cat_wallet.cat_wallet import CATWallet -from chia.wallet.did_wallet.did_wallet import DIDWallet -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.outer_puzzles import create_asset_id, match_puzzle -from chia.wallet.puzzle_drivers import PuzzleInfo -from chia.wallet.trading.offer import Offer -from chia.wallet.trading.trade_status import TradeStatus -from chia.wallet.uncurried_puzzle import uncurry_puzzle -from chia.wallet.util.compute_memos import compute_memos +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.full_node.mempool_manager import MempoolManager +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16, uint32, uint64, uint128 +from flax.wallet.cat_wallet.cat_wallet import CATWallet +from flax.wallet.did_wallet.did_wallet import DIDWallet +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.outer_puzzles import create_asset_id, match_puzzle +from flax.wallet.puzzle_drivers import PuzzleInfo +from flax.wallet.trading.offer import Offer +from flax.wallet.trading.trade_status import TradeStatus +from flax.wallet.uncurried_puzzle import uncurry_puzzle +from flax.wallet.util.compute_memos import compute_memos # from clvm_tools.binutils import disassemble from tests.util.wallet_is_synced import wallets_are_synced @@ -131,7 +131,7 @@ async def test_nft_offer_sell_nft(two_wallet_nodes: Any, trusted: Any) -> None: ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -158,7 +158,7 @@ async def test_nft_offer_sell_nft(two_wallet_nodes: Any, trusted: Any) -> None: wallet_node_taker.wallet_state_manager, wallet_taker, name="NFT WALLET TAKER" ) - # maker create offer: NFT for xch + # maker create offer: NFT for xfx trade_manager_maker = wallet_maker.wallet_state_manager.trade_manager trade_manager_taker = wallet_taker.wallet_state_manager.trade_manager @@ -170,13 +170,13 @@ async def test_nft_offer_sell_nft(two_wallet_nodes: Any, trusted: Any) -> None: nft_to_offer = coins_maker[0] nft_to_offer_info: Optional[PuzzleInfo] = match_puzzle(uncurry_puzzle(nft_to_offer.full_puzzle)) nft_to_offer_asset_id: bytes32 = create_asset_id(nft_to_offer_info) # type: ignore - xch_requested = 1000 + xfx_requested = 1000 maker_fee = uint64(433) - offer_did_nft_for_xch = {nft_to_offer_asset_id: -1, wallet_maker.id(): xch_requested} + offer_did_nft_for_xfx = {nft_to_offer_asset_id: -1, wallet_maker.id(): xfx_requested} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_did_nft_for_xch, {}, fee=maker_fee + offer_did_nft_for_xfx, {}, fee=maker_fee ) assert success is True @@ -210,9 +210,9 @@ async def maker_0_taker_1() -> bool: await time_out_assert(20, get_nft_count, 1, nft_wallet_taker) # assert payments and royalties - expected_royalty = uint64(xch_requested * royalty_basis_pts / 10000) - expected_maker_balance = funds - 2 - maker_fee + xch_requested + expected_royalty - expected_taker_balance = funds - taker_fee - xch_requested - expected_royalty + expected_royalty = uint64(xfx_requested * royalty_basis_pts / 10000) + expected_maker_balance = funds - 2 - maker_fee + xfx_requested + expected_royalty + expected_taker_balance = funds - taker_fee - xfx_requested - expected_royalty await time_out_assert(20, wallet_maker.get_confirmed_balance, expected_maker_balance) await time_out_assert(20, wallet_taker.get_confirmed_balance, expected_taker_balance) @@ -288,7 +288,7 @@ async def test_nft_offer_request_nft(two_wallet_nodes: Any, trusted: Any) -> Non ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -317,7 +317,7 @@ async def test_nft_offer_request_nft(two_wallet_nodes: Any, trusted: Any) -> Non wallet_node_maker.wallet_state_manager, wallet_maker, name="NFT WALLET MAKER" ) - # maker create offer: NFT for xch + # maker create offer: NFT for xfx trade_manager_maker = wallet_maker.wallet_state_manager.trade_manager trade_manager_taker = wallet_taker.wallet_state_manager.trade_manager @@ -331,11 +331,11 @@ async def test_nft_offer_request_nft(two_wallet_nodes: Any, trusted: Any) -> Non assert isinstance(nft_to_request_info, PuzzleInfo) nft_to_request_asset_id = create_asset_id(nft_to_request_info) - xch_offered = 1000 + xfx_offered = 1000 maker_fee = 10 driver_dict = {nft_to_request_asset_id: nft_to_request_info} - offer_dict = {nft_to_request_asset_id: 1, wallet_maker.id(): -xch_offered} + offer_dict = {nft_to_request_asset_id: 1, wallet_maker.id(): -xfx_offered} success, trade_make, error = await trade_manager_maker.create_offer_for_ids(offer_dict, driver_dict, fee=maker_fee) @@ -366,9 +366,9 @@ async def maker_1_taker_0() -> bool: await farm_blocks_until(maker_1_taker_0, full_node_api, ph_token) # assert payments and royalties - expected_royalty = uint64(xch_offered * royalty_basis_pts / 10000) - expected_maker_balance = funds - maker_fee - xch_offered - expected_royalty - expected_taker_balance = funds - 2 - taker_fee + xch_offered + expected_royalty + expected_royalty = uint64(xfx_offered * royalty_basis_pts / 10000) + expected_maker_balance = funds - maker_fee - xfx_offered - expected_royalty + expected_taker_balance = funds - 2 - taker_fee + xfx_offered + expected_royalty await time_out_assert(20, wallet_maker.get_confirmed_balance, expected_maker_balance) await time_out_assert(20, wallet_taker.get_confirmed_balance, expected_taker_balance) @@ -444,7 +444,7 @@ async def test_nft_offer_sell_did_to_did(two_wallet_nodes: Any, trusted: Any) -> ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -494,7 +494,7 @@ async def test_nft_offer_sell_did_to_did(two_wallet_nodes: Any, trusted: Any) -> wallet_node_taker.wallet_state_manager, wallet_taker, name="NFT WALLET TAKER", did_id=did_id_taker ) - # maker create offer: NFT for xch + # maker create offer: NFT for xfx trade_manager_maker = wallet_maker.wallet_state_manager.trade_manager trade_manager_taker = wallet_taker.wallet_state_manager.trade_manager @@ -506,13 +506,13 @@ async def test_nft_offer_sell_did_to_did(two_wallet_nodes: Any, trusted: Any) -> nft_to_offer = coins_maker[0] nft_to_offer_info: Optional[PuzzleInfo] = match_puzzle(uncurry_puzzle(nft_to_offer.full_puzzle)) nft_to_offer_asset_id: bytes32 = create_asset_id(nft_to_offer_info) # type: ignore - xch_requested = 1000 + xfx_requested = 1000 maker_fee = uint64(433) - offer_did_nft_for_xch = {nft_to_offer_asset_id: -1, wallet_maker.id(): xch_requested} + offer_did_nft_for_xfx = {nft_to_offer_asset_id: -1, wallet_maker.id(): xfx_requested} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_did_nft_for_xch, {}, fee=maker_fee + offer_did_nft_for_xfx, {}, fee=maker_fee ) assert success is True @@ -546,9 +546,9 @@ async def maker_0_taker_1() -> bool: await time_out_assert(20, get_nft_count, 1, wallet_taker.wallet_state_manager.wallets[4]) assert (await wallet_taker.wallet_state_manager.wallets[4].get_current_nfts())[0].nft_id == nft_to_offer_asset_id # assert payments and royalties - expected_royalty = uint64(xch_requested * royalty_basis_pts / 10000) - expected_maker_balance = funds - 2 - maker_fee + xch_requested + expected_royalty - expected_taker_balance = funds - 1 - taker_fee - xch_requested - expected_royalty + expected_royalty = uint64(xfx_requested * royalty_basis_pts / 10000) + expected_maker_balance = funds - 2 - maker_fee + xfx_requested + expected_royalty + expected_taker_balance = funds - 1 - taker_fee - xfx_requested - expected_royalty await time_out_assert(20, wallet_maker.get_confirmed_balance, expected_maker_balance) await time_out_assert(20, wallet_taker.get_confirmed_balance, expected_taker_balance) @@ -626,7 +626,7 @@ async def test_nft_offer_sell_nft_for_cat(two_wallet_nodes: Any, trusted: Any) - ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -653,7 +653,7 @@ async def test_nft_offer_sell_nft_for_cat(two_wallet_nodes: Any, trusted: Any) - wallet_node_taker.wallet_state_manager, wallet_taker, name="NFT WALLET TAKER" ) - # maker create offer: NFT for xch + # maker create offer: NFT for xfx trade_manager_maker = wallet_maker.wallet_state_manager.trade_manager trade_manager_taker = wallet_taker.wallet_state_manager.trade_manager @@ -708,10 +708,10 @@ async def test_nft_offer_sell_nft_for_cat(two_wallet_nodes: Any, trusted: Any) - cats_requested = 1000 maker_fee = uint64(433) - offer_did_nft_for_xch = {nft_to_offer_asset_id: -1, cat_wallet_maker.id(): cats_requested} + offer_did_nft_for_xfx = {nft_to_offer_asset_id: -1, cat_wallet_maker.id(): cats_requested} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_did_nft_for_xch, {}, fee=maker_fee + offer_did_nft_for_xfx, {}, fee=maker_fee ) assert success is True @@ -820,7 +820,7 @@ async def test_nft_offer_request_nft_for_cat(two_wallet_nodes: Any, trusted: boo ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -1015,7 +1015,7 @@ async def test_nft_offer_sell_cancel(two_wallet_nodes: Any, trusted: Any) -> Non ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -1036,7 +1036,7 @@ async def test_nft_offer_sell_cancel(two_wallet_nodes: Any, trusted: Any) -> Non await time_out_assert(20, get_nft_count, 1, nft_wallet_maker) - # maker create offer: NFT for xch + # maker create offer: NFT for xfx trade_manager_maker = wallet_maker.wallet_state_manager.trade_manager coins_maker = await nft_wallet_maker.get_current_nfts() @@ -1045,13 +1045,13 @@ async def test_nft_offer_sell_cancel(two_wallet_nodes: Any, trusted: Any) -> Non nft_to_offer = coins_maker[0] nft_to_offer_info: Optional[PuzzleInfo] = match_puzzle(uncurry_puzzle(nft_to_offer.full_puzzle)) nft_to_offer_asset_id: bytes32 = create_asset_id(nft_to_offer_info) # type: ignore - xch_requested = 1000 + xfx_requested = 1000 maker_fee = uint64(433) - offer_did_nft_for_xch = {nft_to_offer_asset_id: -1, wallet_maker.id(): xch_requested} + offer_did_nft_for_xfx = {nft_to_offer_asset_id: -1, wallet_maker.id(): xfx_requested} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_did_nft_for_xch, {}, fee=maker_fee + offer_did_nft_for_xfx, {}, fee=maker_fee ) FEE = uint64(2000000000000) @@ -1135,7 +1135,7 @@ async def test_nft_offer_sell_cancel_in_batch(two_wallet_nodes: Any, trusted: An ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -1157,7 +1157,7 @@ async def test_nft_offer_sell_cancel_in_batch(two_wallet_nodes: Any, trusted: An await time_out_assert(10, get_nft_count, 1, nft_wallet_maker) - # maker create offer: NFT for xch + # maker create offer: NFT for xfx trade_manager_maker = wallet_maker.wallet_state_manager.trade_manager coins_maker = await nft_wallet_maker.get_current_nfts() @@ -1166,13 +1166,13 @@ async def test_nft_offer_sell_cancel_in_batch(two_wallet_nodes: Any, trusted: An nft_to_offer = coins_maker[0] nft_to_offer_info: Optional[PuzzleInfo] = match_puzzle(uncurry_puzzle(nft_to_offer.full_puzzle)) nft_to_offer_asset_id: bytes32 = create_asset_id(nft_to_offer_info) # type: ignore - xch_requested = 1000 + xfx_requested = 1000 maker_fee = uint64(433) - offer_did_nft_for_xch = {nft_to_offer_asset_id: -1, wallet_maker.id(): xch_requested} + offer_did_nft_for_xfx = {nft_to_offer_asset_id: -1, wallet_maker.id(): xfx_requested} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_did_nft_for_xch, {}, fee=maker_fee + offer_did_nft_for_xfx, {}, fee=maker_fee ) FEE = uint64(2000000000000) @@ -1201,7 +1201,7 @@ async def get_trade_and_status(trade_manager: Any, trade: Any) -> TradeStatus: # @pytest.mark.skip async def test_complex_nft_offer(two_wallet_nodes: Any, trusted: Any) -> None: """ - This test is going to create an offer where the maker offers 1 NFT and 1 CAT for 2 NFTs, an XCH and a CAT + This test is going to create an offer where the maker offers 1 NFT and 1 CAT for 2 NFTs, an XFX and a CAT """ full_nodes, wallets, _ = two_wallet_nodes full_node_api: FullNodeSimulator = full_nodes[0] @@ -1323,7 +1323,7 @@ async def test_complex_nft_offer(two_wallet_nodes: Any, trusted: Any) -> None: ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -1445,14 +1445,14 @@ async def test_complex_nft_offer(two_wallet_nodes: Any, trusted: Any) -> None: bytes32.from_hexstr(cat_wallet_maker.get_asset_id()): uint64(CAT_REQUESTED), }, ) - maker_xch_royalties_expected = maker_royalty_summary[nft_to_offer_asset_id_maker][0]["amount"] + maker_xfx_royalties_expected = maker_royalty_summary[nft_to_offer_asset_id_maker][0]["amount"] maker_cat_royalties_expected = maker_royalty_summary[nft_to_offer_asset_id_maker][1]["amount"] taker_cat_royalties_expected = ( taker_royalty_summary[nft_to_offer_asset_id_taker_1][0]["amount"] + taker_royalty_summary[nft_to_offer_asset_id_taker_2][0]["amount"] ) - funds_maker = int(funds_maker - FEE + XCH_REQUESTED + maker_xch_royalties_expected) - funds_taker = int(funds_taker - FEE - XCH_REQUESTED - maker_xch_royalties_expected) + funds_maker = int(funds_maker - FEE + XCH_REQUESTED + maker_xfx_royalties_expected) + funds_taker = int(funds_taker - FEE - XCH_REQUESTED - maker_xfx_royalties_expected) await time_out_assert(30, wallet_maker.get_unconfirmed_balance, funds_maker) await time_out_assert(30, wallet_maker.get_confirmed_balance, funds_maker) diff --git a/tests/wallet/nft_wallet/test_nft_bulk_mint.py b/tests/wallet/nft_wallet/test_nft_bulk_mint.py index 4f4c24801..56bbf613e 100644 --- a/tests/wallet/nft_wallet/test_nft_bulk_mint.py +++ b/tests/wallet/nft_wallet/test_nft_bulk_mint.py @@ -6,24 +6,24 @@ import pytest -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.rpc.full_node_rpc_api import FullNodeRpcApi -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.rpc.rpc_server import start_rpc_server -from chia.rpc.wallet_rpc_api import WalletRpcApi -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.types.spend_bundle import SpendBundle -from chia.util.bech32m import encode_puzzle_hash -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.did_wallet.did_wallet import DIDWallet -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.util.address_type import AddressType +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.rpc.full_node_rpc_api import FullNodeRpcApi +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.rpc.rpc_server import start_rpc_server +from flax.rpc.wallet_rpc_api import WalletRpcApi +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.types.spend_bundle import SpendBundle +from flax.util.bech32m import encode_puzzle_hash +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.did_wallet.did_wallet import DIDWallet +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.util.address_type import AddressType async def nft_count(wallet: NFTWallet) -> int: @@ -97,7 +97,7 @@ async def test_nft_mint_from_did(two_wallet_nodes: Any, trusted: Any) -> None: # construct sample metadata metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -124,8 +124,8 @@ async def test_nft_mint_from_did(two_wallet_nodes: Any, trusted: Any) -> None: await time_out_assert(30, nft_count, mint_total, nft_wallet_taker) await time_out_assert(30, nft_count, 0, nft_wallet_maker) - expected_xch_bal = funds - fee - mint_total - 1 - await time_out_assert(30, wallet_0.get_confirmed_balance, expected_xch_bal) + expected_xfx_bal = funds - fee - mint_total - 1 + await time_out_assert(30, wallet_0.get_confirmed_balance, expected_xfx_bal) assert (await nft_wallet_taker.get_current_nfts())[0].minter_did == did_id @@ -251,15 +251,15 @@ def stop_node_cb() -> None: } for i in range(n) ] - target_list = [encode_puzzle_hash((ph_taker), "xch") for x in range(n)] - royalty_address = encode_puzzle_hash(bytes32(token_bytes(32)), "xch") + target_list = [encode_puzzle_hash((ph_taker), "xfx") for x in range(n)] + royalty_address = encode_puzzle_hash(bytes32(token_bytes(32)), "xfx") royalty_percentage = 300 fee = 100 required_amount = n + (fee * n) - xch_coins = await client.select_coins(amount=required_amount, wallet_id=wallet_maker.id()) - funding_coin = xch_coins[0] + xfx_coins = await client.select_coins(amount=required_amount, wallet_id=wallet_maker.id()) + funding_coin = xfx_coins[0] assert funding_coin.amount >= required_amount - funding_coin_dict = xch_coins[0].to_json_dict() + funding_coin_dict = xfx_coins[0].to_json_dict() chunk = 5 next_coin = funding_coin did_coin = (await client.select_coins(amount=1, wallet_id=2))[0] @@ -275,8 +275,8 @@ def stop_node_cb() -> None: royalty_address=royalty_address, mint_number_start=i + 1, mint_total=n, - xch_coins=[next_coin.to_json_dict()], - xch_change_target=funding_coin_dict["puzzle_hash"], + xfx_coins=[next_coin.to_json_dict()], + xfx_change_target=funding_coin_dict["puzzle_hash"], did_coin=did_coin.to_json_dict(), did_lineage_parent=did_lineage_parent, mint_from_did=True, @@ -287,9 +287,9 @@ def stop_node_cb() -> None: did_lineage_parent = [cn for cn in sb.removals() if cn.name() == did_coin.name()][0].parent_coin_info.hex() did_coin = [cn for cn in sb.additions() if (cn.parent_coin_info == did_coin.name()) and (cn.amount == 1)][0] spends.append(sb) - xch_adds = [c for c in sb.additions() if c.puzzle_hash == funding_coin.puzzle_hash] - assert len(xch_adds) == 1 - next_coin = xch_adds[0] + xfx_adds = [c for c in sb.additions() if c.puzzle_hash == funding_coin.puzzle_hash] + assert len(xfx_adds) == 1 + next_coin = xfx_adds[0] for sb in spends: resp = await client_node.push_tx(sb) @@ -453,14 +453,14 @@ def stop_node_cb() -> None: } for i in range(n) ] - target_list = [encode_puzzle_hash((ph_taker), "xch") for x in range(n)] + target_list = [encode_puzzle_hash((ph_taker), "xfx") for x in range(n)] royalty_address = None royalty_percentage = None required_amount = n - xch_coins = await client.select_coins(amount=required_amount, wallet_id=wallet_maker.id()) - funding_coin = xch_coins[0] + xfx_coins = await client.select_coins(amount=required_amount, wallet_id=wallet_maker.id()) + funding_coin = xfx_coins[0] assert funding_coin.amount >= required_amount - funding_coin_dict = xch_coins[0].to_json_dict() + funding_coin_dict = xfx_coins[0].to_json_dict() chunk = 5 next_coin = funding_coin did_coin = (await client.select_coins(amount=1, wallet_id=2))[0] @@ -476,8 +476,8 @@ def stop_node_cb() -> None: royalty_address=royalty_address, mint_number_start=i + 1, mint_total=n, - xch_coins=[next_coin.to_json_dict()], - xch_change_target=funding_coin_dict["puzzle_hash"], + xfx_coins=[next_coin.to_json_dict()], + xfx_change_target=funding_coin_dict["puzzle_hash"], did_coin=did_coin.to_json_dict(), did_lineage_parent=did_lineage_parent, mint_from_did=True, @@ -487,9 +487,9 @@ def stop_node_cb() -> None: did_lineage_parent = [cn for cn in sb.removals() if cn.name() == did_coin.name()][0].parent_coin_info.hex() did_coin = [cn for cn in sb.additions() if (cn.parent_coin_info == did_coin.name()) and (cn.amount == 1)][0] spends.append(sb) - xch_adds = [c for c in sb.additions() if c.puzzle_hash == funding_coin.puzzle_hash] - assert len(xch_adds) == 1 - next_coin = xch_adds[0] + xfx_adds = [c for c in sb.additions() if c.puzzle_hash == funding_coin.puzzle_hash] + assert len(xfx_adds) == 1 + next_coin = xfx_adds[0] for sb in spends: resp = await client_node.push_tx(sb) @@ -521,7 +521,7 @@ async def get_taker_nfts() -> int: [True, False], ) @pytest.mark.asyncio -async def test_nft_mint_from_did_multiple_xch(two_wallet_nodes: Any, trusted: Any) -> None: +async def test_nft_mint_from_did_multiple_xfx(two_wallet_nodes: Any, trusted: Any) -> None: full_nodes, wallets, _ = two_wallet_nodes full_node_api: FullNodeSimulator = full_nodes[0] full_node_server = full_node_api.server @@ -582,7 +582,7 @@ async def test_nft_mint_from_did_multiple_xch(two_wallet_nodes: Any, trusted: An # construct sample metadata metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -595,10 +595,10 @@ async def test_nft_mint_from_did_multiple_xch(two_wallet_nodes: Any, trusted: An {"program": metadata, "royalty_pc": royalty_pc, "royalty_ph": royalty_addr} for x in range(mint_total) ] - # Grab two coins for testing that we can create a bulk minting with more than 1 xch coin - xch_coins_1 = await wallet_maker.select_coins(amount=10000) - xch_coins_2 = await wallet_maker.select_coins(amount=10000, exclude=xch_coins_1) - xch_coins = xch_coins_1.union(xch_coins_2) + # Grab two coins for testing that we can create a bulk minting with more than 1 xfx coin + xfx_coins_1 = await wallet_maker.select_coins(amount=10000) + xfx_coins_2 = await wallet_maker.select_coins(amount=10000, exclude=xfx_coins_1) + xfx_coins = xfx_coins_1.union(xfx_coins_2) target_list = [ph_taker for x in range(mint_total)] @@ -607,7 +607,7 @@ async def test_nft_mint_from_did_multiple_xch(two_wallet_nodes: Any, trusted: An target_list=target_list, mint_number_start=1, mint_total=mint_total, - xch_coins=xch_coins, + xfx_coins=xfx_coins, fee=fee, ) @@ -619,9 +619,9 @@ async def test_nft_mint_from_did_multiple_xch(two_wallet_nodes: Any, trusted: An await time_out_assert(30, nft_count, mint_total, nft_wallet_taker) await time_out_assert(30, nft_count, 0, nft_wallet_maker) - # confirm that the spend uses the right amount of xch - expected_xch_bal = funds - fee - mint_total - 1 - await time_out_assert(30, wallet_maker.get_confirmed_balance, expected_xch_bal) + # confirm that the spend uses the right amount of xfx + expected_xfx_bal = funds - fee - mint_total - 1 + await time_out_assert(30, wallet_maker.get_confirmed_balance, expected_xfx_bal) @pytest.mark.parametrize( @@ -629,7 +629,7 @@ async def test_nft_mint_from_did_multiple_xch(two_wallet_nodes: Any, trusted: An [True, False], ) @pytest.mark.asyncio -async def test_nft_mint_from_xch(two_wallet_nodes: Any, trusted: Any) -> None: +async def test_nft_mint_from_xfx(two_wallet_nodes: Any, trusted: Any) -> None: full_nodes, wallets, _ = two_wallet_nodes full_node_api: FullNodeSimulator = full_nodes[0] full_node_server = full_node_api.server @@ -690,7 +690,7 @@ async def test_nft_mint_from_xch(two_wallet_nodes: Any, trusted: Any) -> None: # construct sample metadata metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -705,7 +705,7 @@ async def test_nft_mint_from_xch(two_wallet_nodes: Any, trusted: Any) -> None: target_list = [ph_taker for x in range(mint_total)] - sb = await nft_wallet_maker.mint_from_xch( + sb = await nft_wallet_maker.mint_from_xfx( metadata_list, target_list=target_list, mint_number_start=1, mint_total=mint_total, fee=fee ) @@ -717,8 +717,8 @@ async def test_nft_mint_from_xch(two_wallet_nodes: Any, trusted: Any) -> None: await time_out_assert(30, nft_count, mint_total, nft_wallet_taker) await time_out_assert(30, nft_count, 0, nft_wallet_maker) - expected_xch_bal = funds - fee - mint_total - 1 - await time_out_assert(30, wallet_0.get_confirmed_balance, expected_xch_bal) + expected_xfx_bal = funds - fee - mint_total - 1 + await time_out_assert(30, wallet_0.get_confirmed_balance, expected_xfx_bal) @pytest.mark.parametrize( @@ -726,7 +726,7 @@ async def test_nft_mint_from_xch(two_wallet_nodes: Any, trusted: Any) -> None: [True, False], ) @pytest.mark.asyncio -async def test_nft_mint_from_xch_rpc(two_wallet_nodes: Any, trusted: Any, self_hostname: str) -> None: +async def test_nft_mint_from_xfx_rpc(two_wallet_nodes: Any, trusted: Any, self_hostname: str) -> None: full_nodes, wallets, _ = two_wallet_nodes full_node_api: FullNodeSimulator = full_nodes[0] bt = full_node_api.bt @@ -843,15 +843,15 @@ def stop_node_cb() -> None: } for i in range(n) ] - target_list = [encode_puzzle_hash((ph_taker), "xch") for x in range(n)] - royalty_address = encode_puzzle_hash(bytes32(token_bytes(32)), "xch") + target_list = [encode_puzzle_hash((ph_taker), "xfx") for x in range(n)] + royalty_address = encode_puzzle_hash(bytes32(token_bytes(32)), "xfx") royalty_percentage = 300 fee = 100 required_amount = n + (fee * n) - xch_coins = await client.select_coins(amount=required_amount, wallet_id=wallet_maker.id()) - funding_coin = xch_coins[0] + xfx_coins = await client.select_coins(amount=required_amount, wallet_id=wallet_maker.id()) + funding_coin = xfx_coins[0] assert funding_coin.amount >= required_amount - funding_coin_dict = xch_coins[0].to_json_dict() + funding_coin_dict = xfx_coins[0].to_json_dict() chunk = 5 next_coin = funding_coin spends = [] @@ -865,17 +865,17 @@ def stop_node_cb() -> None: royalty_address=royalty_address, mint_number_start=i + 1, mint_total=n, - xch_coins=[next_coin.to_json_dict()], - xch_change_target=funding_coin_dict["puzzle_hash"], + xfx_coins=[next_coin.to_json_dict()], + xfx_change_target=funding_coin_dict["puzzle_hash"], mint_from_did=False, fee=fee, ) assert resp["success"] sb: SpendBundle = SpendBundle.from_json_dict(resp["spend_bundle"]) spends.append(sb) - xch_adds = [c for c in sb.additions() if c.puzzle_hash == funding_coin.puzzle_hash] - assert len(xch_adds) == 1 - next_coin = xch_adds[0] + xfx_adds = [c for c in sb.additions() if c.puzzle_hash == funding_coin.puzzle_hash] + assert len(xfx_adds) == 1 + next_coin = xfx_adds[0] for sb in spends: resp = await client_node.push_tx(sb) @@ -923,7 +923,7 @@ async def get_taker_nfts() -> int: [True, False], ) @pytest.mark.asyncio -async def test_nft_mint_from_xch_multiple_xch(two_wallet_nodes: Any, trusted: Any) -> None: +async def test_nft_mint_from_xfx_multiple_xfx(two_wallet_nodes: Any, trusted: Any) -> None: full_nodes, wallets, _ = two_wallet_nodes full_node_api: FullNodeSimulator = full_nodes[0] full_node_server = full_node_api.server @@ -984,7 +984,7 @@ async def test_nft_mint_from_xch_multiple_xch(two_wallet_nodes: Any, trusted: An # construct sample metadata metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -997,19 +997,19 @@ async def test_nft_mint_from_xch_multiple_xch(two_wallet_nodes: Any, trusted: An {"program": metadata, "royalty_pc": royalty_pc, "royalty_ph": royalty_addr} for x in range(mint_total) ] - # Grab two coins for testing that we can create a bulk minting with more than 1 xch coin - xch_coins_1 = await wallet_maker.select_coins(amount=10000) - xch_coins_2 = await wallet_maker.select_coins(amount=10000, exclude=xch_coins_1) - xch_coins = xch_coins_1.union(xch_coins_2) + # Grab two coins for testing that we can create a bulk minting with more than 1 xfx coin + xfx_coins_1 = await wallet_maker.select_coins(amount=10000) + xfx_coins_2 = await wallet_maker.select_coins(amount=10000, exclude=xfx_coins_1) + xfx_coins = xfx_coins_1.union(xfx_coins_2) target_list = [ph_taker for x in range(mint_total)] - sb = await nft_wallet_maker.mint_from_xch( + sb = await nft_wallet_maker.mint_from_xfx( metadata_list, target_list=target_list, mint_number_start=1, mint_total=mint_total, - xch_coins=xch_coins, + xfx_coins=xfx_coins, fee=fee, ) @@ -1021,6 +1021,6 @@ async def test_nft_mint_from_xch_multiple_xch(two_wallet_nodes: Any, trusted: An await time_out_assert(30, nft_count, mint_total, nft_wallet_taker) await time_out_assert(30, nft_count, 0, nft_wallet_maker) - # confirm that the spend uses the right amount of xch - expected_xch_bal = funds - fee - mint_total - 1 - await time_out_assert(30, wallet_maker.get_confirmed_balance, expected_xch_bal) + # confirm that the spend uses the right amount of xfx + expected_xfx_bal = funds - fee - mint_total - 1 + await time_out_assert(30, wallet_maker.get_confirmed_balance, expected_xfx_bal) diff --git a/tests/wallet/nft_wallet/test_nft_lifecycle.py b/tests/wallet/nft_wallet/test_nft_lifecycle.py index 5056f6276..490e23176 100644 --- a/tests/wallet/nft_wallet/test_nft_lifecycle.py +++ b/tests/wallet/nft_wallet/test_nft_lifecycle.py @@ -6,15 +6,15 @@ import pytest from blspy import G2Element -from chia.clvm.spend_sim import SimClient, SpendSim -from chia.types.announcement import Announcement -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.types.spend_bundle import SpendBundle -from chia.util.errors import Err -from chia.wallet.nft_wallet.nft_puzzles import ( +from flax.clvm.spend_sim import SimClient, SpendSim +from flax.types.announcement import Announcement +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.types.spend_bundle import SpendBundle +from flax.util.errors import Err +from flax.wallet.nft_wallet.nft_puzzles import ( NFT_METADATA_UPDATER, NFT_TRANSFER_PROGRAM_DEFAULT, construct_ownership_layer, @@ -300,7 +300,7 @@ async def test_default_transfer_program(setup_sim: Tuple[SpendSim, SimClient]) - cat_coin = ( await sim_client.get_coin_records_by_puzzle_hash(FAKE_CAT.get_tree_hash(), include_spent_coins=False) )[0].coin - xch_coin = (await sim_client.get_coin_records_by_puzzle_hash(ACS_PH, include_spent_coins=False))[0].coin + xfx_coin = (await sim_client.get_coin_records_by_puzzle_hash(ACS_PH, include_spent_coins=False))[0].coin ownership_spend = CoinSpend( ownership_coin, @@ -319,8 +319,8 @@ async def test_default_transfer_program(setup_sim: Tuple[SpendSim, SimClient]) - expected_announcement_data = Program.to( (FAKE_LAUNCHER_ID, [[ROYALTY_ADDRESS, 50, [ROYALTY_ADDRESS]]]) ).get_tree_hash() - xch_announcement_spend = CoinSpend( - xch_coin, + xfx_announcement_spend = CoinSpend( + xfx_coin, ACS, Program.to([[62, expected_announcement_data]]), ) @@ -330,14 +330,14 @@ async def test_default_transfer_program(setup_sim: Tuple[SpendSim, SimClient]) - # Make sure every combo except all of them work for i in range(1, 3): for announcement_combo in itertools.combinations( - [did_announcement_spend, xch_announcement_spend, cat_announcement_spend], i + [did_announcement_spend, xfx_announcement_spend, cat_announcement_spend], i ): result = await sim_client.push_tx(SpendBundle([ownership_spend, *announcement_combo], G2Element())) assert result == (MempoolInclusionStatus.FAILED, Err.ASSERT_ANNOUNCE_CONSUMED_FAILED) # Make sure all of them together pass full_bundle = SpendBundle( - [ownership_spend, did_announcement_spend, xch_announcement_spend, cat_announcement_spend], G2Element() + [ownership_spend, did_announcement_spend, xfx_announcement_spend, cat_announcement_spend], G2Element() ) result = await sim_client.push_tx(full_bundle) assert result == (MempoolInclusionStatus.SUCCESS, None) diff --git a/tests/wallet/nft_wallet/test_nft_offers.py b/tests/wallet/nft_wallet/test_nft_offers.py index 4372be9d0..3f1a12fbd 100644 --- a/tests/wallet/nft_wallet/test_nft_offers.py +++ b/tests/wallet/nft_wallet/test_nft_offers.py @@ -5,22 +5,22 @@ import pytest -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.full_node.mempool_manager import MempoolManager -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.cat_wallet.cat_wallet import CATWallet -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.outer_puzzles import create_asset_id, match_puzzle -from chia.wallet.puzzle_drivers import PuzzleInfo -from chia.wallet.trading.offer import Offer -from chia.wallet.trading.trade_status import TradeStatus -from chia.wallet.uncurried_puzzle import uncurry_puzzle +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.full_node.mempool_manager import MempoolManager +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.cat_wallet.cat_wallet import CATWallet +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.outer_puzzles import create_asset_id, match_puzzle +from flax.wallet.puzzle_drivers import PuzzleInfo +from flax.wallet.trading.offer import Offer +from flax.wallet.trading.trade_status import TradeStatus +from flax.wallet.uncurried_puzzle import uncurry_puzzle from tests.util.wallet_is_synced import wallets_are_synced from tests.wallet.nft_wallet.test_nft_1_offers import mempool_not_empty @@ -95,7 +95,7 @@ async def test_nft_offer_with_fee(two_wallet_nodes: Any, trusted: Any) -> None: metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -112,7 +112,7 @@ async def test_nft_offer_with_fee(two_wallet_nodes: Any, trusted: Any) -> None: coins_taker = await nft_wallet_taker.get_current_nfts() assert len(coins_taker) == 0 - # MAKE FIRST TRADE: 1 NFT for 100 xch + # MAKE FIRST TRADE: 1 NFT for 100 xfx maker_balance_pre = await wallet_maker.get_confirmed_balance() taker_balance_pre = await wallet_taker.get_confirmed_balance() @@ -121,12 +121,12 @@ async def test_nft_offer_with_fee(two_wallet_nodes: Any, trusted: Any) -> None: nft_asset_id: bytes32 = create_asset_id(nft_info) # type: ignore driver_dict: Dict[bytes32, Optional[PuzzleInfo]] = {nft_asset_id: nft_info} - xch_request = 100 + xfx_request = 100 maker_fee = uint64(10) - offer_nft_for_xch = {wallet_maker.id(): xch_request, nft_asset_id: -1} + offer_nft_for_xfx = {wallet_maker.id(): xfx_request, nft_asset_id: -1} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_nft_for_xch, driver_dict, fee=maker_fee + offer_nft_for_xfx, driver_dict, fee=maker_fee ) assert success is True assert error is None @@ -152,15 +152,15 @@ async def test_nft_offer_with_fee(two_wallet_nodes: Any, trusted: Any) -> None: await time_out_assert(20, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_maker, trade_make) await time_out_assert(20, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_taker, trade_take) - await time_out_assert(20, wallet_maker.get_confirmed_balance, maker_balance_pre + xch_request - maker_fee) - await time_out_assert(20, wallet_taker.get_confirmed_balance, taker_balance_pre - xch_request - taker_fee) + await time_out_assert(20, wallet_maker.get_confirmed_balance, maker_balance_pre + xfx_request - maker_fee) + await time_out_assert(20, wallet_taker.get_confirmed_balance, taker_balance_pre - xfx_request - taker_fee) coins_maker = await nft_wallet_maker.get_current_nfts() coins_taker = await nft_wallet_taker.get_current_nfts() assert len(coins_maker) == 0 assert len(coins_taker) == 1 - # MAKE SECOND TRADE: 100 xch for 1 NFT + # MAKE SECOND TRADE: 100 xfx for 1 NFT maker_balance_pre = await wallet_maker.get_confirmed_balance() taker_balance_pre = await wallet_taker.get_confirmed_balance() @@ -170,11 +170,11 @@ async def test_nft_offer_with_fee(two_wallet_nodes: Any, trusted: Any) -> None: nft_to_buy_asset_id: bytes32 = create_asset_id(nft_to_buy_info) # type: ignore driver_dict_to_buy: Dict[bytes32, Optional[PuzzleInfo]] = {nft_to_buy_asset_id: nft_to_buy_info} - xch_offered = 1000 + xfx_offered = 1000 maker_fee = uint64(10) - offer_xch_for_nft = {wallet_maker.id(): -xch_offered, nft_to_buy_asset_id: 1} + offer_xfx_for_nft = {wallet_maker.id(): -xfx_offered, nft_to_buy_asset_id: 1} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_xch_for_nft, driver_dict_to_buy, fee=maker_fee + offer_xfx_for_nft, driver_dict_to_buy, fee=maker_fee ) assert success is True assert error is None @@ -198,8 +198,8 @@ async def test_nft_offer_with_fee(two_wallet_nodes: Any, trusted: Any) -> None: await time_out_assert(20, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_maker, trade_make) await time_out_assert(20, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_taker, trade_take) - await time_out_assert(20, wallet_maker.get_confirmed_balance, maker_balance_pre - xch_offered - maker_fee) - await time_out_assert(20, wallet_taker.get_confirmed_balance, taker_balance_pre + xch_offered - taker_fee) + await time_out_assert(20, wallet_maker.get_confirmed_balance, maker_balance_pre - xfx_offered - maker_fee) + await time_out_assert(20, wallet_taker.get_confirmed_balance, taker_balance_pre + xfx_offered - taker_fee) coins_maker = await nft_wallet_maker.get_current_nfts() coins_taker = await nft_wallet_taker.get_current_nfts() @@ -264,7 +264,7 @@ async def test_nft_offer_cancellations(two_wallet_nodes: Any, trusted: Any) -> N metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -290,12 +290,12 @@ async def test_nft_offer_cancellations(two_wallet_nodes: Any, trusted: Any) -> N nft_asset_id: bytes32 = create_asset_id(nft_info) # type: ignore driver_dict: Dict[bytes32, Optional[PuzzleInfo]] = {nft_asset_id: nft_info} - xch_request = 100 + xfx_request = 100 maker_fee = uint64(10) - offer_nft_for_xch = {wallet_maker.id(): xch_request, nft_asset_id: -1} + offer_nft_for_xfx = {wallet_maker.id(): xfx_request, nft_asset_id: -1} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_nft_for_xch, driver_dict, fee=maker_fee + offer_nft_for_xfx, driver_dict, fee=maker_fee ) assert success is True assert error is None @@ -381,7 +381,7 @@ async def test_nft_offer_with_metadata_update(two_wallet_nodes: Any, trusted: An metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ("mu", []), ("lu", []), @@ -420,7 +420,7 @@ async def test_nft_offer_with_metadata_update(two_wallet_nodes: Any, trusted: An assert url_to_add in updated_nft_info.also().info["metadata"] # type: ignore - # MAKE FIRST TRADE: 1 NFT for 100 xch + # MAKE FIRST TRADE: 1 NFT for 100 xfx maker_balance_pre = await wallet_maker.get_confirmed_balance() taker_balance_pre = await wallet_taker.get_confirmed_balance() @@ -429,12 +429,12 @@ async def test_nft_offer_with_metadata_update(two_wallet_nodes: Any, trusted: An nft_asset_id: bytes32 = create_asset_id(nft_info) # type: ignore driver_dict: Dict[bytes32, Optional[PuzzleInfo]] = {nft_asset_id: nft_info} - xch_request = 100 + xfx_request = 100 maker_fee = uint64(10) - offer_nft_for_xch = {wallet_maker.id(): xch_request, nft_asset_id: -1} + offer_nft_for_xfx = {wallet_maker.id(): xfx_request, nft_asset_id: -1} success, trade_make, error = await trade_manager_maker.create_offer_for_ids( - offer_nft_for_xch, driver_dict, fee=maker_fee + offer_nft_for_xfx, driver_dict, fee=maker_fee ) assert success is True assert error is None @@ -458,8 +458,8 @@ async def test_nft_offer_with_metadata_update(two_wallet_nodes: Any, trusted: An await time_out_assert(20, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_maker, trade_make) await time_out_assert(20, get_trade_and_status, TradeStatus.CONFIRMED, trade_manager_taker, trade_take) - await time_out_assert(20, wallet_maker.get_confirmed_balance, maker_balance_pre + xch_request - maker_fee) - await time_out_assert(20, wallet_taker.get_confirmed_balance, taker_balance_pre - xch_request - taker_fee) + await time_out_assert(20, wallet_maker.get_confirmed_balance, maker_balance_pre + xfx_request - maker_fee) + await time_out_assert(20, wallet_taker.get_confirmed_balance, taker_balance_pre - xfx_request - taker_fee) coins_maker = await nft_wallet_maker.get_current_nfts() coins_taker = await nft_wallet_taker.get_current_nfts() @@ -525,7 +525,7 @@ async def test_nft_offer_nft_for_cat(two_wallet_nodes: Any, trusted: Any) -> Non metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -745,7 +745,7 @@ async def test_nft_offer_nft_for_nft(two_wallet_nodes: Any, trusted: Any) -> Non metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -756,7 +756,7 @@ async def test_nft_offer_nft_for_nft(two_wallet_nodes: Any, trusted: Any) -> Non metadata_2 = Program.to( [ - ("u", ["https://www.chia.net/image2.html"]), + ("u", ["https://www.flaxnetwork.org/image2.html"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F183"), ] ) diff --git a/tests/wallet/nft_wallet/test_nft_puzzles.py b/tests/wallet/nft_wallet/test_nft_puzzles.py index f750ef8fd..f15a1e532 100644 --- a/tests/wallet/nft_wallet/test_nft_puzzles.py +++ b/tests/wallet/nft_wallet/test_nft_puzzles.py @@ -5,19 +5,19 @@ from clvm.casts import int_from_bytes -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.wallet.nft_wallet import uncurry_nft -from chia.wallet.nft_wallet.nft_puzzles import ( +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.wallet.nft_wallet import uncurry_nft +from flax.wallet.nft_wallet.nft_puzzles import ( construct_ownership_layer, create_full_puzzle, create_nft_layer_puzzle_with_curry_params, recurry_nft_puzzle, ) -from chia.wallet.outer_puzzles import match_puzzle -from chia.wallet.puzzles.load_clvm import load_clvm -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk, solution_for_conditions -from chia.wallet.uncurried_puzzle import uncurry_puzzle +from flax.wallet.outer_puzzles import match_puzzle +from flax.wallet.puzzles.load_clvm import load_clvm +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk, solution_for_conditions +from flax.wallet.uncurried_puzzle import uncurry_puzzle from tests.core.make_block_generator import int_to_public_key SINGLETON_MOD = load_clvm("singleton_top_layer_v1_1.clvm") @@ -42,7 +42,7 @@ def test_nft_transfer_puzzle_hashes(): maker_did = Program.to("maker did").get_tree_hash() # maker_did_inner_hash = Program.to("maker did inner hash").get_tree_hash() metadata = [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", 0xD4584AD463139FA8C0D9F68F4B59F185), ] metadata_updater_hash = NFT_METADATA_UPDATER_DEFAULT.get_tree_hash() @@ -171,7 +171,7 @@ def get_updated_nft_puzzle(puzzle: Program, solution: Program) -> bytes32: def test_transfer_puzzle_builder() -> None: metadata = [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", 0xD4584AD463139FA8C0D9F68F4B59F185), ] sp2_puzzle, solution = make_a_new_solution() diff --git a/tests/wallet/nft_wallet/test_nft_wallet.py b/tests/wallet/nft_wallet/test_nft_wallet.py index 74535e213..b4e35e1cf 100644 --- a/tests/wallet/nft_wallet/test_nft_wallet.py +++ b/tests/wallet/nft_wallet/test_nft_wallet.py @@ -8,25 +8,25 @@ from blspy import AugSchemeMPL, G1Element, G2Element from clvm_tools.binutils import disassemble -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.full_node.mempool_manager import MempoolManager -from chia.rpc.wallet_rpc_api import WalletRpcApi -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.types.spend_bundle import SpendBundle -from chia.util.bech32m import encode_puzzle_hash -from chia.util.byte_types import hexstr_to_bytes -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.did_wallet.did_wallet import DIDWallet -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.util.address_type import AddressType -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet_state_manager import WalletStateManager +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.full_node.mempool_manager import MempoolManager +from flax.rpc.wallet_rpc_api import WalletRpcApi +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.types.spend_bundle import SpendBundle +from flax.util.bech32m import encode_puzzle_hash +from flax.util.byte_types import hexstr_to_bytes +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.did_wallet.did_wallet import DIDWallet +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.util.address_type import AddressType +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet_state_manager import WalletStateManager from tests.util.wallet_is_synced import wallet_is_synced @@ -133,7 +133,7 @@ async def test_nft_wallet_creation_automatically(two_wallet_nodes: Any, trusted: ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -228,7 +228,7 @@ async def test_nft_wallet_creation_and_transfer(two_wallet_nodes: Any, trusted: ) metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) @@ -384,7 +384,7 @@ async def test_nft_wallet_rpc_creation_and_list(two_wallet_nodes: Any, trusted: "wallet_id": nft_wallet_0_id, "artist_address": ph, "hash": "0xD4584AD463139FA8C0D9F68F4B59F185", - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], } ) @@ -402,7 +402,7 @@ async def test_nft_wallet_rpc_creation_and_list(two_wallet_nodes: Any, trusted: "wallet_id": nft_wallet_0_id, "artist_address": ph, "hash": "0xD4584AD463139FA8C0D9F68F4B59F184", - "uris": ["https://chialisp.com/img/logo.svg"], + "uris": ["https://flaxlisp.com/img/logo.svg"], "meta_uris": [ "https://bafybeigzcazxeu7epmm4vtkuadrvysv74lbzzbl2evphtae6k57yhgynp4.ipfs.nftstorage.link/6590.json" ], @@ -428,7 +428,7 @@ async def test_nft_wallet_rpc_creation_and_list(two_wallet_nodes: Any, trusted: uris.append(coin.data_uris[0]) assert coin.mint_height > 0 assert len(uris) == 2 - assert "https://chialisp.com/img/logo.svg" in uris + assert "https://flaxlisp.com/img/logo.svg" in uris assert bytes32.fromhex(coins[1].to_json_dict()["nft_coin_id"][2:]) in [x.name() for x in sb.additions()] coins_response = await wait_rpc_state_condition( @@ -448,7 +448,7 @@ async def test_nft_wallet_rpc_creation_and_list(two_wallet_nodes: Any, trusted: ) @pytest.mark.asyncio async def test_nft_wallet_rpc_update_metadata(two_wallet_nodes: Any, trusted: Any) -> None: - from chia.types.blockchain_format.sized_bytes import bytes32 + from flax.types.blockchain_format.sized_bytes import bytes32 num_blocks = 3 full_nodes, wallets, _ = two_wallet_nodes @@ -501,7 +501,7 @@ async def test_nft_wallet_rpc_update_metadata(two_wallet_nodes: Any, trusted: An "wallet_id": nft_wallet_0_id, "artist_address": ph, "hash": "0xD4584AD463139FA8C0D9F68F4B59F185", - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], } ) @@ -523,7 +523,7 @@ async def test_nft_wallet_rpc_update_metadata(two_wallet_nodes: Any, trusted: An assert coin["chain_info"] == disassemble( Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", hexstr_to_bytes("0xD4584AD463139FA8C0D9F68F4B59F185")), ("mu", []), ("lu", []), @@ -562,7 +562,7 @@ async def test_nft_wallet_rpc_update_metadata(two_wallet_nodes: Any, trusted: An assert coin["mint_height"] > 0 uris = coin["data_uris"] assert len(uris) == 1 - assert "https://www.chia.net/img/branding/chia-logo.svg" in uris + assert "https://www.flaxnetwork.org/img/branding/flax-logo.svg" in uris assert len(coin["metadata_uris"]) == 1 assert "http://metadata" == coin["metadata_uris"][0] assert len(coin["license_uris"]) == 0 @@ -691,8 +691,8 @@ async def test_nft_with_did_wallet_creation(two_wallet_nodes: Any, trusted: Any) { "wallet_id": nft_wallet_0_id, "hash": "0xD4584AD463139FA8C0D9F68F4B59F185", - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], - "target_address": encode_puzzle_hash(nft_ph, "txch"), + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], + "target_address": encode_puzzle_hash(nft_ph, "txfx"), } ) assert resp.get("success") @@ -744,7 +744,7 @@ async def test_nft_with_did_wallet_creation(two_wallet_nodes: Any, trusted: Any) did_nft = coins[0].to_json_dict() assert did_nft["mint_height"] > 0 assert did_nft["supports_did"] - assert did_nft["data_uris"][0] == "https://www.chia.net/img/branding/chia-logo.svg" + assert did_nft["data_uris"][0] == "https://www.flaxnetwork.org/img/branding/flax-logo.svg" assert did_nft["data_hash"] == "0xD4584AD463139FA8C0D9F68F4B59F185".lower() assert did_nft["owner_did"][2:] == hex_did_id # Check unassigned NFT @@ -841,7 +841,7 @@ async def test_nft_rpc_mint(two_wallet_nodes: Any, trusted: Any) -> None: { "wallet_id": nft_wallet_0_id, "hash": data_hash_param, - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], "license_uris": license_uris, "license_hash": license_hash, "meta_hash": meta_hash, @@ -952,7 +952,7 @@ async def test_nft_transfer_nft_with_did(two_wallet_nodes: Any, trusted: Any) -> { "wallet_id": nft_wallet_0_id, "hash": "0xD4584AD463139FA8C0D9F68F4B59F185", - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], "fee": fee, "did_id": hmr_did_id, } @@ -973,7 +973,7 @@ async def test_nft_transfer_nft_with_did(two_wallet_nodes: Any, trusted: Any) -> resp = await api_0.nft_transfer_nft( dict( wallet_id=nft_wallet_0_id, - target_address=encode_puzzle_hash(ph1, "xch"), + target_address=encode_puzzle_hash(ph1, "xfx"), nft_coin_id=coins[0].nft_coin_id.hex(), fee=fee, ) @@ -1103,8 +1103,8 @@ async def test_update_metadata_for_nft_did(two_wallet_nodes: Any, trusted: Any) { "wallet_id": nft_wallet_0_id, "hash": "0xD4584AD463139FA8C0D9F68F4B59F185", - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], - "mu": ["https://www.chia.net/img/branding/chia-logo.svg"], + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], + "mu": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], "did": hex_did_id, } ) @@ -1162,7 +1162,7 @@ async def test_update_metadata_for_nft_did(two_wallet_nodes: Any, trusted: Any) assert coin["mint_height"] > 0 uris = coin["data_uris"] assert len(uris) == 1 - assert "https://www.chia.net/img/branding/chia-logo.svg" in uris + assert "https://www.flaxnetwork.org/img/branding/flax-logo.svg" in uris assert len(coin["metadata_uris"]) == 1 assert "http://metadata" == coin["metadata_uris"][0] assert len(coin["license_uris"]) == 0 @@ -1233,8 +1233,8 @@ async def test_nft_set_did(two_wallet_nodes: Any, trusted: Any) -> None: { "wallet_id": nft_wallet_0_id, "hash": "0xD4584AD463139FA8C0D9F68F4B59F185", - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], - "mu": ["https://www.chia.net/img/branding/chia-logo.svg"], + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], + "mu": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], "did_id": "", } ) @@ -1385,8 +1385,8 @@ async def test_set_nft_status(two_wallet_nodes: Any, trusted: Any) -> None: { "wallet_id": nft_wallet_0_id, "hash": "0xD4584AD463139FA8C0D9F68F4B59F185", - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], - "mu": ["https://www.chia.net/img/branding/chia-logo.svg"], + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], + "mu": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], } ) assert resp.get("success") @@ -1470,8 +1470,8 @@ async def test_nft_sign_message(two_wallet_nodes: Any, trusted: Any) -> None: { "wallet_id": nft_wallet_0_id, "hash": "0xD4584AD463139FA8C0D9F68F4B59F185", - "uris": ["https://www.chia.net/img/branding/chia-logo.svg"], - "mu": ["https://www.chia.net/img/branding/chia-logo.svg"], + "uris": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], + "mu": ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], } ) assert resp.get("success") @@ -1496,7 +1496,7 @@ async def test_nft_sign_message(two_wallet_nodes: Any, trusted: Any) -> None: response = await api_0.sign_message_by_id( {"id": encode_puzzle_hash(coins[0].launcher_id, AddressType.NFT.value), "message": message} ) - puzzle: Program = Program.to(("Chia Signed Message", message)) + puzzle: Program = Program.to(("Flax Signed Message", message)) assert AugSchemeMPL.verify( G1Element.from_bytes(bytes.fromhex(response["pubkey"])), puzzle.get_tree_hash(), diff --git a/tests/wallet/nft_wallet/test_ownership_outer_puzzle.py b/tests/wallet/nft_wallet/test_ownership_outer_puzzle.py index 0a5a3ff4b..f5102286a 100644 --- a/tests/wallet/nft_wallet/test_ownership_outer_puzzle.py +++ b/tests/wallet/nft_wallet/test_ownership_outer_puzzle.py @@ -4,14 +4,14 @@ from clvm_tools.binutils import assemble -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint16 -from chia.wallet.nft_wallet.ownership_outer_puzzle import puzzle_for_ownership_layer -from chia.wallet.nft_wallet.transfer_program_puzzle import puzzle_for_transfer_program -from chia.wallet.outer_puzzles import construct_puzzle, get_inner_puzzle, get_inner_solution, match_puzzle, solve_puzzle -from chia.wallet.puzzle_drivers import PuzzleInfo, Solver -from chia.wallet.uncurried_puzzle import uncurry_puzzle +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint16 +from flax.wallet.nft_wallet.ownership_outer_puzzle import puzzle_for_ownership_layer +from flax.wallet.nft_wallet.transfer_program_puzzle import puzzle_for_transfer_program +from flax.wallet.outer_puzzles import construct_puzzle, get_inner_puzzle, get_inner_solution, match_puzzle, solve_puzzle +from flax.wallet.puzzle_drivers import PuzzleInfo, Solver +from flax.wallet.uncurried_puzzle import uncurry_puzzle def test_ownership_outer_puzzle() -> None: diff --git a/tests/wallet/rpc/test_dl_wallet_rpc.py b/tests/wallet/rpc/test_dl_wallet_rpc.py index eb0e7fbf7..70da55760 100644 --- a/tests/wallet/rpc/test_dl_wallet_rpc.py +++ b/tests/wallet/rpc/test_dl_wallet_rpc.py @@ -5,15 +5,15 @@ import pytest -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.data_layer.data_layer_wallet import Mirror, SingletonRecord -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.db_wallet.db_wallet_puzzles import create_mirror_puzzle +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.data_layer.data_layer_wallet import Mirror, SingletonRecord +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.db_wallet.db_wallet_puzzles import create_mirror_puzzle from tests.setup_nodes import SimulatorsAndWalletsServices from tests.util.rpc import validate_get_routes diff --git a/tests/wallet/rpc/test_wallet_rpc.py b/tests/wallet/rpc/test_wallet_rpc.py index 2c8b99a67..c1b05a096 100644 --- a/tests/wallet/rpc/test_wallet_rpc.py +++ b/tests/wallet/rpc/test_wallet_rpc.py @@ -10,42 +10,42 @@ import pytest_asyncio from blspy import G2Element -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.consensus.coinbase import create_puzzlehash_for_pk -from chia.rpc.full_node_rpc_client import FullNodeRpcClient -from chia.rpc.wallet_rpc_client import WalletRpcClient -from chia.server.server import ChiaServer -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_record import CoinRecord -from chia.types.coin_spend import CoinSpend -from chia.types.peer_info import PeerInfo -from chia.types.spend_bundle import SpendBundle -from chia.util.bech32m import decode_puzzle_hash, encode_puzzle_hash -from chia.util.config import lock_and_load_config, save_config -from chia.util.hash import std_hash -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.cat_wallet.cat_constants import DEFAULT_CATS -from chia.wallet.cat_wallet.cat_wallet import CATWallet -from chia.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened -from chia.wallet.did_wallet.did_wallet import DIDWallet -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.puzzles.cat_loader import CAT_MOD -from chia.wallet.trading.trade_status import TradeStatus -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.transaction_sorting import SortKey -from chia.wallet.uncurried_puzzle import uncurry_puzzle -from chia.wallet.util.address_type import AddressType -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_node import WalletNode -from chia.wallet.wallet_protocol import WalletProtocol +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.consensus.coinbase import create_puzzlehash_for_pk +from flax.rpc.full_node_rpc_client import FullNodeRpcClient +from flax.rpc.wallet_rpc_client import WalletRpcClient +from flax.server.server import FlaxServer +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_record import CoinRecord +from flax.types.coin_spend import CoinSpend +from flax.types.peer_info import PeerInfo +from flax.types.spend_bundle import SpendBundle +from flax.util.bech32m import decode_puzzle_hash, encode_puzzle_hash +from flax.util.config import lock_and_load_config, save_config +from flax.util.hash import std_hash +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.cat_wallet.cat_constants import DEFAULT_CATS +from flax.wallet.cat_wallet.cat_wallet import CATWallet +from flax.wallet.derive_keys import master_sk_to_wallet_sk, master_sk_to_wallet_sk_unhardened +from flax.wallet.did_wallet.did_wallet import DIDWallet +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.puzzles.cat_loader import CAT_MOD +from flax.wallet.trading.trade_status import TradeStatus +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.transaction_sorting import SortKey +from flax.wallet.uncurried_puzzle import uncurry_puzzle +from flax.wallet.util.address_type import AddressType +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_node import WalletNode +from flax.wallet.wallet_protocol import WalletProtocol from tests.util.wallet_is_synced import wallet_is_synced log = logging.getLogger(__name__) @@ -60,7 +60,7 @@ class WalletBundle: @dataclasses.dataclass class FullNodeBundle: - server: ChiaServer + server: FlaxServer api: FullNodeSimulator rpc_client: FullNodeRpcClient @@ -241,7 +241,7 @@ async def test_send_transaction(wallet_rpc_environment: WalletRpcTestEnvironment generated_funds = await generate_funds(full_node_api, env.wallet_1) - addr = encode_puzzle_hash(await wallet_2.get_new_puzzlehash(), "txch") + addr = encode_puzzle_hash(await wallet_2.get_new_puzzlehash(), "txfx") tx_amount = uint64(15600000) with pytest.raises(ValueError): await client.send_transaction("1", uint64(100000000000000001), addr) @@ -554,7 +554,7 @@ async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment # Test RELEVANCE await client.send_transaction( - "1", uint64(1), encode_puzzle_hash(await wallet.get_new_puzzlehash(), "txch") + "1", uint64(1), encode_puzzle_hash(await wallet.get_new_puzzlehash(), "txfx") ) # Create a pending tx all_transactions = await client.get_transactions("1", sort_key=SortKey.RELEVANCE) @@ -571,10 +571,10 @@ async def test_get_transactions(wallet_rpc_environment: WalletRpcTestEnvironment # Test get_transactions to address ph_by_addr = await wallet.get_new_puzzlehash() - await client.send_transaction("1", uint64(1), encode_puzzle_hash(ph_by_addr, "txch")) - await client.farm_block(encode_puzzle_hash(ph_by_addr, "txch")) + await client.send_transaction("1", uint64(1), encode_puzzle_hash(ph_by_addr, "txfx")) + await client.farm_block(encode_puzzle_hash(ph_by_addr, "txfx")) await time_out_assert(20, wallet_is_synced, True, wallet_node, full_node_api) - tx_for_address = await client.get_transactions("1", to_address=encode_puzzle_hash(ph_by_addr, "txch")) + tx_for_address = await client.get_transactions("1", to_address=encode_puzzle_hash(ph_by_addr, "txfx")) assert len(tx_for_address) == 1 assert tx_for_address[0].to_puzzle_hash == ph_by_addr @@ -742,7 +742,7 @@ async def test_offer_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment) await farm_transaction(full_node_api, wallet_node, spend_bundle) await time_out_assert(5, get_confirmed_balance, 4, wallet_2_rpc, cat_wallet_id) - # Create an offer of 5 chia for one CAT + # Create an offer of 5 flax for one CAT offer, trade_record = await wallet_1_rpc.create_offer_for_ids( {uint32(1): -5, cat_asset_id.hex(): 1}, validate_only=True ) @@ -761,7 +761,7 @@ async def test_offer_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment) summary = await wallet_1_rpc.get_offer_summary(offer) advanced_summary = await wallet_1_rpc.get_offer_summary(offer, advanced=True) - assert summary == {"offered": {"xch": 5}, "requested": {cat_asset_id.hex(): 1}, "infos": driver_dict, "fees": 1} + assert summary == {"offered": {"xfx": 5}, "requested": {cat_asset_id.hex(): 1}, "infos": driver_dict, "fees": 1} assert advanced_summary == summary assert await wallet_1_rpc.check_offer_validity(offer) @@ -920,7 +920,7 @@ async def test_did_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment): await farm_transaction_block(full_node_api, wallet_1_node) # Transfer DID - addr = encode_puzzle_hash(await wallet_2.get_new_puzzlehash(), "txch") + addr = encode_puzzle_hash(await wallet_2.get_new_puzzlehash(), "txfx") res = await wallet_1_rpc.did_transfer_did(did_wallet_id_0, addr, 0, True) assert res["success"] @@ -967,7 +967,7 @@ async def test_nft_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment): None, None, "0xD4584AD463139FA8C0D9F68F4B59F185", - ["https://www.chia.net/img/branding/chia-logo.svg"], + ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"], ) assert res["success"] @@ -995,7 +995,7 @@ async def have_nfts(): nft_info = (await wallet_1_rpc.get_nft_info(hmr_nft_id))["nft_info"] assert nft_info["nft_coin_id"][2:] == (await nft_wallet.get_current_nfts())[0].coin.name().hex() - addr = encode_puzzle_hash(await wallet_2.get_new_puzzlehash(), "txch") + addr = encode_puzzle_hash(await wallet_2.get_new_puzzlehash(), "txfx") res = await wallet_1_rpc.transfer_nft(nft_wallet_id, nft_id, addr, 0) assert res["success"] await time_out_assert(5, check_mempool_spend_count, True, full_node_api, 1) @@ -1055,7 +1055,7 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn assert (await client.get_height_info()) > 0 ph = await wallet.get_new_puzzlehash() - addr = encode_puzzle_hash(ph, "txch") + addr = encode_puzzle_hash(ph, "txfx") tx_amount = uint64(15600000) created_tx = await client.send_transaction("1", tx_amount, addr) @@ -1088,11 +1088,11 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn sk = await wallet_node.get_key_for_fingerprint(pks[0]) test_ph = create_puzzlehash_for_pk(master_sk_to_wallet_sk(sk, uint32(0)).get_g1()) with lock_and_load_config(wallet_node.root_path, "config.yaml") as test_config: - test_config["farmer"]["xch_target_address"] = encode_puzzle_hash(test_ph, "txch") + test_config["farmer"]["xfx_target_address"] = encode_puzzle_hash(test_ph, "txfx") # set pool to second private key sk = await wallet_node.get_key_for_fingerprint(pks[1]) test_ph = create_puzzlehash_for_pk(master_sk_to_wallet_sk(sk, uint32(0)).get_g1()) - test_config["pool"]["xch_target_address"] = encode_puzzle_hash(test_ph, "txch") + test_config["pool"]["xfx_target_address"] = encode_puzzle_hash(test_ph, "txfx") save_config(wallet_node.root_path, "config.yaml", test_config) # Check first key @@ -1118,11 +1118,11 @@ async def test_key_and_address_endpoints(wallet_rpc_environment: WalletRpcTestEn sk = await wallet_node.get_key_for_fingerprint(pks[0]) test_ph = create_puzzlehash_for_pk(master_sk_to_wallet_sk_unhardened(sk, uint32(0)).get_g1()) with lock_and_load_config(wallet_node.root_path, "config.yaml") as test_config: - test_config["farmer"]["xch_target_address"] = encode_puzzle_hash(test_ph, "txch") + test_config["farmer"]["xfx_target_address"] = encode_puzzle_hash(test_ph, "txfx") # set pool to second private key sk = await wallet_node.get_key_for_fingerprint(pks[1]) test_ph = create_puzzlehash_for_pk(master_sk_to_wallet_sk_unhardened(sk, uint32(0)).get_g1()) - test_config["pool"]["xch_target_address"] = encode_puzzle_hash(test_ph, "txch") + test_config["pool"]["xfx_target_address"] = encode_puzzle_hash(test_ph, "txfx") save_config(wallet_node.root_path, "config.yaml", test_config) # Check first key @@ -1173,7 +1173,7 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment funds = await generate_funds(full_node_api, env.wallet_1) - addr = encode_puzzle_hash(await wallet_2.get_new_puzzlehash(), "txch") + addr = encode_puzzle_hash(await wallet_2.get_new_puzzlehash(), "txfx") coin_300: List[Coin] for tx_amount in [uint64(1000), uint64(300), uint64(1000), uint64(1000), uint64(10000)]: funds -= tx_amount diff --git a/tests/wallet/simple_sync/test_simple_sync_protocol.py b/tests/wallet/simple_sync/test_simple_sync_protocol.py index 8c07b1f56..a6c07c399 100644 --- a/tests/wallet/simple_sync/test_simple_sync_protocol.py +++ b/tests/wallet/simple_sync/test_simple_sync_protocol.py @@ -6,27 +6,27 @@ from clvm.casts import int_to_bytes from colorlog import getLogger -from chia.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward -from chia.protocols import wallet_protocol -from chia.protocols.full_node_protocol import RespondTransaction -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.wallet_protocol import RespondToCoinUpdates, CoinStateUpdate, RespondToPhUpdates -from chia.server.outbound_message import NodeType -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol -from chia.types.blockchain_format.coin import Coin -from chia.types.coin_record import CoinRecord -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.peer_info import PeerInfo -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.wallet import Wallet -from chia.wallet.wallet_state_manager import WalletStateManager +from flax.consensus.block_rewards import calculate_pool_reward, calculate_base_farmer_reward +from flax.protocols import wallet_protocol +from flax.protocols.full_node_protocol import RespondTransaction +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.wallet_protocol import RespondToCoinUpdates, CoinStateUpdate, RespondToPhUpdates +from flax.server.outbound_message import NodeType +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol +from flax.types.blockchain_format.coin import Coin +from flax.types.coin_record import CoinRecord +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.peer_info import PeerInfo +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.wallet import Wallet +from flax.wallet.wallet_state_manager import WalletStateManager from tests.util.wallet_is_synced import wallet_is_synced from tests.connection_utils import add_dummy_connection -from chia.simulator.time_out_assert import time_out_assert +from flax.simulator.time_out_assert import time_out_assert from tests.wallet.cat_wallet.test_cat_wallet import tx_in_pool -from chia.simulator.wallet_tools import WalletTool +from flax.simulator.wallet_tools import WalletTool def wallet_height_at_least(wallet_node, h): @@ -196,7 +196,7 @@ async def test_subscribe_for_ph(self, wallet_node_simulator, self_hostname): await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(puzzle_hash)) # Let's make sure the wallet can handle a non ephemeral launcher - from chia.wallet.puzzles.singleton_top_layer import SINGLETON_LAUNCHER_HASH + from flax.wallet.puzzles.singleton_top_layer import SINGLETON_LAUNCHER_HASH await time_out_assert(20, wallet_is_synced, True, wallet_node, full_node_api) tx_record = await wallet.generate_signed_transaction(uint64(10), SINGLETON_LAUNCHER_HASH, uint64(0)) diff --git a/tests/wallet/sync/test_wallet_sync.py b/tests/wallet/sync/test_wallet_sync.py index ffc421154..50bf2f738 100644 --- a/tests/wallet/sync/test_wallet_sync.py +++ b/tests/wallet/sync/test_wallet_sync.py @@ -6,31 +6,31 @@ from aiosqlite import Error as AIOSqliteError from colorlog import getLogger -from chia.consensus.block_record import BlockRecord -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.full_node.full_node_api import FullNodeAPI -from chia.full_node.mempool_manager import MempoolManager -from chia.full_node.weight_proof import WeightProofHandler -from chia.protocols import full_node_protocol, wallet_protocol -from chia.protocols.protocol_message_types import ProtocolMessageTypes -from chia.protocols.shared_protocol import Capability -from chia.protocols.wallet_protocol import RequestAdditions, RespondAdditions, RespondBlockHeaders, SendTransaction -from chia.server.outbound_message import Message -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.block_cache import BlockCache -from chia.util.hash import std_hash -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.nft_wallet.nft_wallet import NFTWallet -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.util.wallet_sync_utils import PeerRequestException -from chia.wallet.util.wallet_types import AmountWithPuzzlehash -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_weight_proof_handler import get_wp_fork_point +from flax.consensus.block_record import BlockRecord +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.full_node.full_node_api import FullNodeAPI +from flax.full_node.mempool_manager import MempoolManager +from flax.full_node.weight_proof import WeightProofHandler +from flax.protocols import full_node_protocol, wallet_protocol +from flax.protocols.protocol_message_types import ProtocolMessageTypes +from flax.protocols.shared_protocol import Capability +from flax.protocols.wallet_protocol import RequestAdditions, RespondAdditions, RespondBlockHeaders, SendTransaction +from flax.server.outbound_message import Message +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.block_cache import BlockCache +from flax.util.hash import std_hash +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.nft_wallet.nft_wallet import NFTWallet +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.util.wallet_sync_utils import PeerRequestException +from flax.wallet.util.wallet_types import AmountWithPuzzlehash +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_weight_proof_handler import get_wp_fork_point from tests.connection_utils import disconnect_all, disconnect_all_and_reconnect from tests.setup_nodes import test_constants from tests.util.wallet_is_synced import wallet_is_synced @@ -645,8 +645,8 @@ async def test_get_wp_fork_point(self, default_10000_blocks): 5. Create 5 coins below the threshold and 5 at or above. Those below the threshold should get filtered, and those above should not. 6. Clear all coins from the dust wallet. - Send to the dust wallet "spam_filter_after_n_txs" coins that are equal in value to "xch_spam_amount". - Send 1 mojo from the dust wallet. The dust wallet should receive a change coin valued at "xch_spam_amount-1". + Send to the dust wallet "spam_filter_after_n_txs" coins that are equal in value to "xfx_spam_amount". + Send 1 mojo from the dust wallet. The dust wallet should receive a change coin valued at "xfx_spam_amount-1". 7: Create an NFT wallet for the farmer wallet, and generate an NFT in that wallet. Create an NFT wallet for the dust wallet. Send the NFT to the dust wallet. The NFT should not be filtered. @@ -654,7 +654,7 @@ async def test_get_wp_fork_point(self, default_10000_blocks): @pytest.mark.asyncio @pytest.mark.parametrize( - "spam_filter_after_n_txs, xch_spam_amount, dust_value", + "spam_filter_after_n_txs, xfx_spam_amount, dust_value", [ # In the following tests, the filter is run right away: (0, 1, 1), # nothing is filtered @@ -670,7 +670,7 @@ async def test_dusted_wallet( self_hostname, two_wallet_nodes_custom_spam_filtering, spam_filter_after_n_txs, - xch_spam_amount, + xfx_spam_amount, dust_value, ): @@ -686,20 +686,20 @@ async def test_dusted_wallet( full_node_api = full_nodes[0] - # It's also possible to obtain the current settings for spam_filter_after_n_txs and xch_spam_amount + # It's also possible to obtain the current settings for spam_filter_after_n_txs and xfx_spam_amount # spam_filter_after_n_txs = wallets[0][0].config["spam_filter_after_n_txs"] - # xch_spam_amount = wallets[0][0].config["xch_spam_amount"] + # xfx_spam_amount = wallets[0][0].config["xfx_spam_amount"] # dust_value=1 # Verify legal values for the settings to be tested # If spam_filter_after_n_txs is greater than 250, this test will take a long time to run. - # Current max value for xch_spam_amount is 0.01 XCH. + # Current max value for xfx_spam_amount is 0.01 XFX. # If needed, this could be increased but we would need to farm more blocks. # The max dust_value could be increased, but would require farming more blocks. assert spam_filter_after_n_txs >= 0 assert spam_filter_after_n_txs <= 250 - assert xch_spam_amount >= 1 - assert xch_spam_amount <= 10000000000 + assert xfx_spam_amount >= 1 + assert xfx_spam_amount <= 10000000000 assert dust_value >= 1 assert dust_value <= 10000000000 @@ -735,12 +735,12 @@ async def test_dusted_wallet( await time_out_assert(20, wallet_is_synced, True, farm_wallet_node, full_node_api) await time_out_assert(20, wallet_is_synced, True, dust_wallet_node, full_node_api) - # The dust is only filtered at this point if spam_filter_after_n_txs is 0 and xch_spam_amount is > dust_value. + # The dust is only filtered at this point if spam_filter_after_n_txs is 0 and xfx_spam_amount is > dust_value. if spam_filter_after_n_txs > 0: dust_coins = 1 large_dust_coins = 0 large_dust_balance = 0 - elif xch_spam_amount <= dust_value: + elif xfx_spam_amount <= dust_value: dust_coins = 0 large_dust_coins = 1 large_dust_balance = dust_value @@ -754,7 +754,7 @@ async def test_dusted_wallet( WalletCoinRecord ] = await dust_wallet_node.wallet_state_manager.coin_store.get_all_unspent_coins() log.info(f"all_unspent is {all_unspent}") - small_unspent_count = len([r for r in all_unspent if r.coin.amount < xch_spam_amount]) + small_unspent_count = len([r for r in all_unspent if r.coin.amount < xfx_spam_amount]) balance: Optional[Message] = await dust_wallet.get_confirmed_balance() num_coins: Optional[Message] = len(await dust_wallet.select_coins(balance)) @@ -763,7 +763,7 @@ async def test_dusted_wallet( log.info(f"Number of coins is {num_coins}") log.info(f"spam_filter_after_n_txs {spam_filter_after_n_txs}") - log.info(f"xch_spam_amount {xch_spam_amount}") + log.info(f"xfx_spam_amount {xfx_spam_amount}") log.info(f"dust_value {dust_value}") # Verify balance and number of coins not filtered. @@ -813,7 +813,7 @@ async def test_dusted_wallet( all_unspent: Set[ WalletCoinRecord ] = await dust_wallet_node.wallet_state_manager.coin_store.get_all_unspent_coins() - small_unspent_count = len([r for r in all_unspent if r.coin.amount < xch_spam_amount]) + small_unspent_count = len([r for r in all_unspent if r.coin.amount < xfx_spam_amount]) balance: Optional[Message] = await dust_wallet.get_confirmed_balance() # Selecting coins by using the wallet's coin selection algorithm won't work for large # numbers of coins, so we'll use the state manager for the rest of the test @@ -844,7 +844,7 @@ async def test_dusted_wallet( for i in range(large_coins): payee_ph = await dust_wallet.get_new_puzzlehash() - payees.append({"amount": uint64(xch_spam_amount), "puzzlehash": payee_ph, "memos": []}) + payees.append({"amount": uint64(xfx_spam_amount), "puzzlehash": payee_ph, "memos": []}) # construct and send tx tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees) @@ -861,7 +861,7 @@ async def test_dusted_wallet( all_unspent: Set[ WalletCoinRecord ] = await dust_wallet_node.wallet_state_manager.coin_store.get_all_unspent_coins() - small_unspent_count = len([r for r in all_unspent if r.coin.amount < xch_spam_amount]) + small_unspent_count = len([r for r in all_unspent if r.coin.amount < xfx_spam_amount]) balance: Optional[Message] = await dust_wallet.get_confirmed_balance() num_coins: Optional[Message] = len( list(await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1)) @@ -871,13 +871,13 @@ async def test_dusted_wallet( log.info(f"Wallet balance is {balance}") log.info(f"Number of coins is {num_coins}") - large_coin_balance = large_coins * xch_spam_amount + large_coin_balance = large_coins * xfx_spam_amount # Determine whether the filter should have been activated. # Make sure the number of coins matches the expected number. # At this point, nothing should be getting filtered unless spam_filter_after_n_txs is 0. assert dust_coins == spam_filter_after_n_txs - assert balance == dust_coins * dust_value + large_coins * xch_spam_amount + large_dust_balance + assert balance == dust_coins * dust_value + large_coins * xfx_spam_amount + large_dust_balance assert num_coins == dust_coins + large_coins + large_dust_coins # Part 4: Create one more dust coin to test the threshold @@ -901,7 +901,7 @@ async def test_dusted_wallet( all_unspent: Set[ WalletCoinRecord ] = await dust_wallet_node.wallet_state_manager.coin_store.get_all_unspent_coins() - small_unspent_count = len([r for r in all_unspent if r.coin.amount < xch_spam_amount]) + small_unspent_count = len([r for r in all_unspent if r.coin.amount < xfx_spam_amount]) balance: Optional[Message] = await dust_wallet.get_confirmed_balance() num_coins: Optional[Message] = len( list(await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1)) @@ -913,12 +913,12 @@ async def test_dusted_wallet( # In the edge case where the new "dust" is larger than the threshold, # then it is actually a large dust coin that won't get filtered. - if dust_value >= xch_spam_amount: + if dust_value >= xfx_spam_amount: large_dust_coins += 1 large_dust_balance += dust_value assert dust_coins == spam_filter_after_n_txs - assert balance == dust_coins * dust_value + large_coins * xch_spam_amount + large_dust_balance + assert balance == dust_coins * dust_value + large_coins * xfx_spam_amount + large_dust_balance assert num_coins == dust_coins + large_dust_coins + large_coins # Part 5: Create 5 coins below the threshold and 5 at or above. @@ -929,20 +929,20 @@ async def test_dusted_wallet( payee_ph = await dust_wallet.get_new_puzzlehash() # Create a large coin and add on the appropriate balance. - payees.append({"amount": uint64(xch_spam_amount + i), "puzzlehash": payee_ph, "memos": []}) + payees.append({"amount": uint64(xfx_spam_amount + i), "puzzlehash": payee_ph, "memos": []}) large_coins += 1 - large_coin_balance += xch_spam_amount + i + large_coin_balance += xfx_spam_amount + i payee_ph = await dust_wallet.get_new_puzzlehash() # Make sure we are always creating coins with a positive value. - if xch_spam_amount - dust_value - i > 0: - payees.append({"amount": uint64(xch_spam_amount - dust_value - i), "puzzlehash": payee_ph, "memos": []}) + if xfx_spam_amount - dust_value - i > 0: + payees.append({"amount": uint64(xfx_spam_amount - dust_value - i), "puzzlehash": payee_ph, "memos": []}) else: payees.append({"amount": uint64(dust_value), "puzzlehash": payee_ph, "memos": []}) - # In cases where xch_spam_amount is sufficiently low, + # In cases where xfx_spam_amount is sufficiently low, # the new dust should be considered a large coina and not be filtered. - if xch_spam_amount <= dust_value: + if xfx_spam_amount <= dust_value: large_dust_coins += 1 large_dust_balance += dust_value @@ -961,7 +961,7 @@ async def test_dusted_wallet( all_unspent: Set[ WalletCoinRecord ] = await dust_wallet_node.wallet_state_manager.coin_store.get_all_unspent_coins() - small_unspent_count = len([r for r in all_unspent if r.coin.amount < xch_spam_amount]) + small_unspent_count = len([r for r in all_unspent if r.coin.amount < xfx_spam_amount]) balance: Optional[Message] = await dust_wallet.get_confirmed_balance() num_coins: Optional[Message] = len( list(await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1)) @@ -977,8 +977,8 @@ async def test_dusted_wallet( assert num_coins == dust_coins + large_dust_coins + large_coins # Part 6: Clear all coins from the dust wallet. - # Send to the dust wallet "spam_filter_after_n_txs" coins that are equal in value to "xch_spam_amount". - # Send 1 mojo from the dust wallet. The dust wallet should receive a change coin valued at "xch_spam_amount-1". + # Send to the dust wallet "spam_filter_after_n_txs" coins that are equal in value to "xfx_spam_amount". + # Send 1 mojo from the dust wallet. The dust wallet should receive a change coin valued at "xfx_spam_amount-1". payee_ph = await farm_wallet.get_new_puzzlehash() payees: List[AmountWithPuzzlehash] = [{"amount": uint64(balance), "puzzlehash": payee_ph, "memos": []}] @@ -1012,9 +1012,9 @@ async def test_dusted_wallet( # in the edge case, create one coin coins_remaining = 1 - # The size of the coin to send the dust wallet is the same as xch_spam_amount - if xch_spam_amount > 1: - coin_value = xch_spam_amount + # The size of the coin to send the dust wallet is the same as xfx_spam_amount + if xfx_spam_amount > 1: + coin_value = xfx_spam_amount else: # Handle the edge case to make sure the coin is at least 2 mojos # This is needed to receive change @@ -1114,7 +1114,7 @@ async def test_dusted_wallet( # Create a new NFT and send it to the farmer's NFT wallet metadata = Program.to( [ - ("u", ["https://www.chia.net/img/branding/chia-logo.svg"]), + ("u", ["https://www.flaxnetwork.org/img/branding/flax-logo.svg"]), ("h", "0xD4584AD463139FA8C0D9F68F4B59F185"), ] ) diff --git a/tests/wallet/test_address_type.py b/tests/wallet/test_address_type.py index 1cf9529f7..5a7202f8e 100644 --- a/tests/wallet/test_address_type.py +++ b/tests/wallet/test_address_type.py @@ -4,47 +4,47 @@ import pytest -from chia.wallet.util.address_type import AddressType, ensure_valid_address, is_valid_address +from flax.wallet.util.address_type import AddressType, ensure_valid_address, is_valid_address @pytest.mark.parametrize("prefix", [None]) -def test_xch_hrp_for_default_config(config_with_address_prefix: Dict[str, Any]) -> None: +def test_xfx_hrp_for_default_config(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix - assert AddressType.XCH.hrp(config) == "xch" + assert AddressType.XFX.hrp(config) == "xfx" -@pytest.mark.parametrize("prefix", ["txch"]) -def test_txch_hrp_for_testnet(config_with_address_prefix: Dict[str, Any]) -> None: +@pytest.mark.parametrize("prefix", ["txfx"]) +def test_txfx_hrp_for_testnet(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix - assert AddressType.XCH.hrp(config) == "txch" + assert AddressType.XFX.hrp(config) == "txfx" @pytest.mark.parametrize("prefix", [None]) -def test_is_valid_address_xch(config_with_address_prefix: Dict[str, Any]) -> None: +def test_is_valid_address_xfx(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix valid = is_valid_address( - "xch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd", allowed_types={AddressType.XCH}, config=config + "xfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd", allowed_types={AddressType.XFX}, config=config ) assert valid is True -@pytest.mark.parametrize("prefix", ["txch"]) -def test_is_valid_address_txch(config_with_address_prefix: Dict[str, Any]) -> None: +@pytest.mark.parametrize("prefix", ["txfx"]) +def test_is_valid_address_txfx(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix - # TXCH address validation requires a config + # TXFX address validation requires a config valid = is_valid_address( - "txch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7", - allowed_types={AddressType.XCH}, + "txfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7", + allowed_types={AddressType.XFX}, config=config, ) assert valid is True @pytest.mark.parametrize("prefix", [None]) -def test_is_valid_address_xch_bad_address(config_with_address_prefix: Dict[str, Any]) -> None: +def test_is_valid_address_xfx_bad_address(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix valid = is_valid_address( - "xch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8xxxxx", allowed_types={AddressType.XCH}, config=config + "xfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8xxxxx", allowed_types={AddressType.XFX}, config=config ) assert valid is False @@ -58,7 +58,7 @@ def test_is_valid_address_nft(config_with_address_prefix: Dict[str, Any]) -> Non assert valid is True -@pytest.mark.parametrize("prefix", ["txch"]) +@pytest.mark.parametrize("prefix", ["txfx"]) def test_is_valid_address_nft_with_testnet(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix valid = is_valid_address( @@ -80,18 +80,18 @@ def test_is_valid_address_nft_bad_address(config_with_address_prefix: Dict[str, def test_is_valid_address_did(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix valid = is_valid_address( - "did:chia:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsr9gsr7", + "did:flax:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsr9gsr7", allowed_types={AddressType.DID}, config=config, ) assert valid is True -@pytest.mark.parametrize("prefix", ["txch"]) +@pytest.mark.parametrize("prefix", ["txfx"]) def test_is_valid_address_did_with_testnet(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix valid = is_valid_address( - "did:chia:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsr9gsr7", + "did:flax:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsr9gsr7", allowed_types={AddressType.DID}, config=config, ) @@ -102,7 +102,7 @@ def test_is_valid_address_did_with_testnet(config_with_address_prefix: Dict[str, def test_is_valid_address_did_bad_address(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix valid = is_valid_address( - "did:chia:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsrxxxxx", + "did:flax:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsrxxxxx", allowed_types={AddressType.DID}, config=config, ) @@ -110,32 +110,32 @@ def test_is_valid_address_did_bad_address(config_with_address_prefix: Dict[str, @pytest.mark.parametrize("prefix", [None]) -def test_ensure_valid_address_xch(config_with_address_prefix: Dict[str, Any]) -> None: +def test_ensure_valid_address_xfx(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix address = ensure_valid_address( - "xch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd", allowed_types={AddressType.XCH}, config=config + "xfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd", allowed_types={AddressType.XFX}, config=config ) - assert address == "xch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd" + assert address == "xfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8taffd" -@pytest.mark.parametrize("prefix", ["txch"]) -def test_ensure_valid_address_txch(config_with_address_prefix: Dict[str, Any]) -> None: +@pytest.mark.parametrize("prefix", ["txfx"]) +def test_ensure_valid_address_txfx(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix address = ensure_valid_address( - "txch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7", - allowed_types={AddressType.XCH}, + "txfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7", + allowed_types={AddressType.XFX}, config=config, ) - assert address == "txch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7" + assert address == "txfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs2v6lg7" @pytest.mark.parametrize("prefix", [None]) -def test_ensure_valid_address_xch_bad_address(config_with_address_prefix: Dict[str, Any]) -> None: +def test_ensure_valid_address_xfx_bad_address(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix with pytest.raises(ValueError): ensure_valid_address( - "xch1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8xxxxx", - allowed_types={AddressType.XCH}, + "xfx1mnr0ygu7lvmk3nfgzmncfk39fwu0dv933yrcv97nd6pmrt7fzmhs8xxxxx", + allowed_types={AddressType.XFX}, config=config, ) @@ -164,11 +164,11 @@ def test_ensure_valid_address_nft_bad_address(config_with_address_prefix: Dict[s def test_ensure_valid_address_did(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix address = ensure_valid_address( - "did:chia:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsr9gsr7", + "did:flax:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsr9gsr7", allowed_types={AddressType.DID}, config=config, ) - assert address == "did:chia:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsr9gsr7" + assert address == "did:flax:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsr9gsr7" @pytest.mark.parametrize("prefix", [None]) @@ -176,7 +176,7 @@ def test_ensure_valid_address_did_bad_address(config_with_address_prefix: Dict[s config = config_with_address_prefix with pytest.raises(ValueError): ensure_valid_address( - "did:chia:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsrxxxxx", + "did:flax:14jxdtqcyp3gk8ka0678eq8mmtnktgpmp2vuqq3vtsl2e5qr7fyrsrxxxxx", allowed_types={AddressType.DID}, config=config, ) @@ -186,4 +186,4 @@ def test_ensure_valid_address_did_bad_address(config_with_address_prefix: Dict[s def test_ensure_valid_address_bad_length(config_with_address_prefix: Dict[str, Any]) -> None: config = config_with_address_prefix with pytest.raises(ValueError): - ensure_valid_address("xch1qqqqqqqqqqqqqqqqwygzk5", allowed_types={AddressType.XCH}, config=config) + ensure_valid_address("xfx1qqqqqqqqqqqqqqqqwygzk5", allowed_types={AddressType.XFX}, config=config) diff --git a/tests/wallet/test_bech32m.py b/tests/wallet/test_bech32m.py index 3af3e51f5..499073025 100644 --- a/tests/wallet/test_bech32m.py +++ b/tests/wallet/test_bech32m.py @@ -3,7 +3,7 @@ from __future__ import annotations -from chia.util.bech32m import bech32_decode +from flax.util.bech32m import bech32_decode def test_valid_imports(): diff --git a/tests/wallet/test_coin_selection.py b/tests/wallet/test_coin_selection.py index 754197713..6c7c9cc31 100644 --- a/tests/wallet/test_coin_selection.py +++ b/tests/wallet/test_coin_selection.py @@ -7,20 +7,20 @@ import pytest -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.hash import std_hash -from chia.util.ints import uint32, uint64, uint128 -from chia.wallet.coin_selection import ( +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.hash import std_hash +from flax.util.ints import uint32, uint64, uint128 +from flax.wallet.coin_selection import ( check_for_exact_match, knapsack_coin_algorithm, select_coins, select_smallest_coin_over_target, sum_largest_coins, ) -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet_coin_record import WalletCoinRecord log = logging.getLogger(__name__) diff --git a/tests/wallet/test_chialisp.py b/tests/wallet/test_flaxlisp.py similarity index 97% rename from tests/wallet/test_chialisp.py rename to tests/wallet/test_flaxlisp.py index 8629e689d..eb71bbb8d 100644 --- a/tests/wallet/test_chialisp.py +++ b/tests/wallet/test_flaxlisp.py @@ -2,7 +2,7 @@ import pytest -from chia.wallet.chialisp import ( +from flax.wallet.flaxlisp import ( apply, args, cons, @@ -19,7 +19,7 @@ ) -class TestChialisp: +class TestFlaxlisp: def test_sexp(self): assert sexp() == "()" assert sexp(1) == "(1)" diff --git a/tests/wallet/test_nft_store.py b/tests/wallet/test_nft_store.py index bc61490fc..9be2ffa70 100644 --- a/tests/wallet/test_nft_store.py +++ b/tests/wallet/test_nft_store.py @@ -2,13 +2,13 @@ import pytest -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32, uint64 -from chia.wallet.lineage_proof import LineageProof -from chia.wallet.nft_wallet.nft_info import NFTCoinInfo -from chia.wallet.wallet_nft_store import WalletNftStore +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32, uint64 +from flax.wallet.lineage_proof import LineageProof +from flax.wallet.nft_wallet.nft_info import NFTCoinInfo +from flax.wallet.wallet_nft_store import WalletNftStore from tests.util.db_connection import DBConnection diff --git a/tests/wallet/test_notifications.py b/tests/wallet/test_notifications.py index d76c42331..ad62898fd 100644 --- a/tests/wallet/test_notifications.py +++ b/tests/wallet/test_notifications.py @@ -5,13 +5,13 @@ import pytest -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.ints import uint16, uint32, uint64 +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.ints import uint16, uint32, uint64 # from clvm_tools.binutils import disassemble from tests.util.wallet_is_synced import wallets_are_synced diff --git a/tests/wallet/test_offer_parsing_performance.py b/tests/wallet/test_offer_parsing_performance.py index 3a5f735b0..5f693ddf5 100644 --- a/tests/wallet/test_offer_parsing_performance.py +++ b/tests/wallet/test_offer_parsing_performance.py @@ -6,7 +6,7 @@ import pytest -from chia.wallet.trading.offer import Offer +from flax.wallet.trading.offer import Offer from tests.util.misc import assert_runtime with_profile = False diff --git a/tests/wallet/test_puzzle_store.py b/tests/wallet/test_puzzle_store.py index 561a8aa11..099ca78dd 100644 --- a/tests/wallet/test_puzzle_store.py +++ b/tests/wallet/test_puzzle_store.py @@ -5,10 +5,10 @@ import pytest from blspy import AugSchemeMPL -from chia.util.ints import uint32 -from chia.wallet.derivation_record import DerivationRecord -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet_puzzle_store import WalletPuzzleStore +from flax.util.ints import uint32 +from flax.wallet.derivation_record import DerivationRecord +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet_puzzle_store import WalletPuzzleStore from tests.util.db_connection import DBConnection diff --git a/tests/wallet/test_singleton.py b/tests/wallet/test_singleton.py index 8f806e71c..4a6299b74 100644 --- a/tests/wallet/test_singleton.py +++ b/tests/wallet/test_singleton.py @@ -1,10 +1,10 @@ from clvm_tools import binutils -from chia.types.blockchain_format.program import Program, INFINITE_COST -from chia.types.announcement import Announcement -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.condition_tools import parse_sexp_to_conditions -from chia.wallet.puzzles.load_clvm import load_clvm +from flax.types.blockchain_format.program import Program, INFINITE_COST +from flax.types.announcement import Announcement +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.condition_tools import parse_sexp_to_conditions +from flax.wallet.puzzles.load_clvm import load_clvm SINGLETON_MOD = load_clvm("singleton_top_layer.clvm") LAUNCHER_PUZZLE = load_clvm("singleton_launcher.clvm") diff --git a/tests/wallet/test_singleton_lifecycle.py b/tests/wallet/test_singleton_lifecycle.py index 11a1b004a..d3d677d7b 100644 --- a/tests/wallet/test_singleton_lifecycle.py +++ b/tests/wallet/test_singleton_lifecycle.py @@ -4,16 +4,16 @@ from blspy import G2Element from clvm_tools import binutils -from chia.types.blockchain_format.program import Program, INFINITE_COST -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.spend_bundle import SpendBundle - -from chia.util.ints import uint64 -from chia.wallet.puzzles.load_clvm import load_clvm +from flax.types.blockchain_format.program import Program, INFINITE_COST +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.spend_bundle import SpendBundle + +from flax.util.ints import uint64 +from flax.wallet.puzzles.load_clvm import load_clvm from tests.core.full_node.test_conditions import check_spend_bundle_validity, initial_blocks diff --git a/tests/wallet/test_singleton_lifecycle_fast.py b/tests/wallet/test_singleton_lifecycle_fast.py index 469fa2a7e..ef9f37ca9 100644 --- a/tests/wallet/test_singleton_lifecycle_fast.py +++ b/tests/wallet/test_singleton_lifecycle_fast.py @@ -4,15 +4,15 @@ from blspy import G1Element, G2Element from clvm_tools import binutils -from chia.types.blockchain_format.program import Program, SerializedProgram -from chia.types.announcement import Announcement -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.coin_spend import CoinSpend -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint64 -from chia.wallet.puzzles.load_clvm import load_clvm +from flax.types.blockchain_format.program import Program, SerializedProgram +from flax.types.announcement import Announcement +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.coin_spend import CoinSpend +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint64 +from flax.wallet.puzzles.load_clvm import load_clvm from tests.clvm.coin_store import BadSpendBundleError, CoinStore, CoinTimestamp diff --git a/tests/wallet/test_taproot.py b/tests/wallet/test_taproot.py index d0b251dce..f5ad48be6 100644 --- a/tests/wallet/test_taproot.py +++ b/tests/wallet/test_taproot.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( +from flax.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import ( DEFAULT_HIDDEN_PUZZLE, calculate_synthetic_offset, calculate_synthetic_public_key, diff --git a/tests/wallet/test_transaction_store.py b/tests/wallet/test_transaction_store.py index bc0a3cef0..10353d327 100644 --- a/tests/wallet/test_transaction_store.py +++ b/tests/wallet/test_transaction_store.py @@ -6,14 +6,14 @@ import pytest -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.mempool_inclusion_status import MempoolInclusionStatus -from chia.util.errors import Err -from chia.util.ints import uint8, uint32, uint64 -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.wallet_transaction_store import WalletTransactionStore, filter_ok_mempool_status +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.mempool_inclusion_status import MempoolInclusionStatus +from flax.util.errors import Err +from flax.util.ints import uint8, uint32, uint64 +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.wallet_transaction_store import WalletTransactionStore, filter_ok_mempool_status from tests.util.db_connection import DBConnection coin_1 = Coin(token_bytes(32), token_bytes(32), uint64(12312)) diff --git a/tests/wallet/test_wallet.py b/tests/wallet/test_wallet.py index c45b9a80f..17173d5f6 100644 --- a/tests/wallet/test_wallet.py +++ b/tests/wallet/test_wallet.py @@ -5,26 +5,26 @@ import pytest from blspy import AugSchemeMPL, G1Element, G2Element -from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward -from chia.protocols.full_node_protocol import RespondBlock -from chia.rpc.wallet_rpc_api import WalletRpcApi -from chia.server.server import ChiaServer -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol -from chia.types.blockchain_format.program import Program -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.peer_info import PeerInfo -from chia.util.bech32m import encode_puzzle_hash -from chia.util.ints import uint16, uint32, uint64 -from chia.wallet.derive_keys import master_sk_to_wallet_sk -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.util.compute_memos import compute_memos -from chia.wallet.util.transaction_type import TransactionType -from chia.wallet.util.wallet_types import AmountWithPuzzlehash -from chia.wallet.wallet_node import WalletNode, get_wallet_db_path -from chia.wallet.wallet_state_manager import WalletStateManager -from chia.simulator.block_tools import BlockTools -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_not_none +from flax.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward +from flax.protocols.full_node_protocol import RespondBlock +from flax.rpc.wallet_rpc_api import WalletRpcApi +from flax.server.server import FlaxServer +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.simulator_protocol import FarmNewBlockProtocol, ReorgProtocol +from flax.types.blockchain_format.program import Program +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.peer_info import PeerInfo +from flax.util.bech32m import encode_puzzle_hash +from flax.util.ints import uint16, uint32, uint64 +from flax.wallet.derive_keys import master_sk_to_wallet_sk +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.util.compute_memos import compute_memos +from flax.wallet.util.transaction_type import TransactionType +from flax.wallet.util.wallet_types import AmountWithPuzzlehash +from flax.wallet.wallet_node import WalletNode, get_wallet_db_path +from flax.wallet.wallet_state_manager import WalletStateManager +from flax.simulator.block_tools import BlockTools +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_not_none from tests.util.wallet_is_synced import wallet_is_synced from tests.wallet.cat_wallet.test_cat_wallet import tx_in_pool @@ -37,14 +37,14 @@ class TestWalletSimulator: @pytest.mark.asyncio async def test_wallet_coinbase( self, - wallet_node_sim_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + wallet_node_sim_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: num_blocks = 10 full_nodes, wallets, _ = wallet_node_sim_and_wallet full_node_api = full_nodes[0] - server_1: ChiaServer = full_node_api.full_node.server + server_1: FlaxServer = full_node_api.full_node.server wallet_node, server_2 = wallets[0] wallet = wallet_node.wallet_state_manager.main_wallet @@ -98,7 +98,7 @@ async def check_tx_are_pool_farm_rewards() -> bool: @pytest.mark.asyncio async def test_wallet_make_transaction( self, - two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -161,7 +161,7 @@ async def test_wallet_make_transaction( @pytest.mark.asyncio async def test_wallet_coinbase_reorg( self, - wallet_node_sim_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + wallet_node_sim_and_wallet: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -207,7 +207,7 @@ async def test_wallet_coinbase_reorg( @pytest.mark.asyncio async def test_wallet_send_to_three_peers( self, - three_sim_two_wallets: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + three_sim_two_wallets: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -282,7 +282,7 @@ async def test_wallet_send_to_three_peers( @pytest.mark.asyncio async def test_wallet_make_transaction_hop( self, - two_wallet_nodes_five_freeze: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes_five_freeze: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -389,7 +389,7 @@ async def test_wallet_make_transaction_hop( # introducer, introducer_server = await node_iters[2].__anext__() # # async def has_full_node(): - # outbound: List[WSChiaConnection] = wallet.server.get_outgoing_connections() + # outbound: List[WSFlaxConnection] = wallet.server.get_outgoing_connections() # for connection in outbound: # if connection.connection_type is NodeType.FULL_NODE: # return True @@ -408,7 +408,7 @@ async def test_wallet_make_transaction_hop( @pytest.mark.asyncio async def test_wallet_make_transaction_with_fee( self, - two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -483,7 +483,7 @@ async def test_wallet_make_transaction_with_fee( @pytest.mark.asyncio async def test_wallet_create_hit_max_send_amount( self, - two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -587,7 +587,7 @@ async def test_wallet_create_hit_max_send_amount( @pytest.mark.asyncio async def test_wallet_prevent_fee_theft( self, - two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -680,7 +680,7 @@ async def test_wallet_prevent_fee_theft( @pytest.mark.asyncio async def test_wallet_tx_reorg( self, - two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -787,13 +787,13 @@ async def test_wallet_tx_reorg( @pytest.mark.asyncio async def test_address_sliding_window( self, - wallet_node_100_pk: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + wallet_node_100_pk: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: full_nodes, wallets, _ = wallet_node_100_pk full_node_api = full_nodes[0] - server_1: ChiaServer = full_node_api.full_node.server + server_1: FlaxServer = full_node_api.full_node.server wallet_node, server_2 = wallets[0] if trusted: wallet_node.config["trusted_peers"] = {server_1.node_id.hex(): server_1.node_id.hex()} @@ -835,7 +835,7 @@ async def test_address_sliding_window( @pytest.mark.asyncio async def test_sign_message( self, - two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -857,8 +857,8 @@ async def test_sign_message( await server_2.start_client(PeerInfo(self_hostname, uint16(server_1._port)), None) message = "Hello World" - response = await api_0.sign_message_by_address({"address": encode_puzzle_hash(ph, "xch"), "message": message}) - puzzle: Program = Program.to(("Chia Signed Message", message)) + response = await api_0.sign_message_by_address({"address": encode_puzzle_hash(ph, "xfx"), "message": message}) + puzzle: Program = Program.to(("Flax Signed Message", message)) assert AugSchemeMPL.verify( G1Element.from_bytes(bytes.fromhex(response["pubkey"])), @@ -873,7 +873,7 @@ async def test_sign_message( @pytest.mark.asyncio async def test_wallet_transaction_options( self, - two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, ChiaServer]], BlockTools], + two_wallet_nodes: Tuple[List[FullNodeSimulator], List[Tuple[WalletNode, FlaxServer]], BlockTools], trusted: bool, self_hostname: str, ) -> None: @@ -938,7 +938,7 @@ async def test_wallet_transaction_options( def test_get_wallet_db_path_v2_r1() -> None: - root_path: Path = Path("/x/y/z/.chia/mainnet").resolve() + root_path: Path = Path("/x/y/z/.flax/mainnet").resolve() config: Dict[str, Any] = { "database_path": "wallet/db/blockchain_wallet_v2_r1_CHALLENGE_KEY.sqlite", "selected_network": "mainnet", @@ -950,7 +950,7 @@ def test_get_wallet_db_path_v2_r1() -> None: def test_get_wallet_db_path_v2() -> None: - root_path: Path = Path("/x/y/z/.chia/mainnet").resolve() + root_path: Path = Path("/x/y/z/.flax/mainnet").resolve() config: Dict[str, Any] = { "database_path": "wallet/db/blockchain_wallet_v2_CHALLENGE_KEY.sqlite", "selected_network": "mainnet", @@ -962,7 +962,7 @@ def test_get_wallet_db_path_v2() -> None: def test_get_wallet_db_path_v1() -> None: - root_path: Path = Path("/x/y/z/.chia/mainnet").resolve() + root_path: Path = Path("/x/y/z/.flax/mainnet").resolve() config: Dict[str, Any] = { "database_path": "wallet/db/blockchain_wallet_v1_CHALLENGE_KEY.sqlite", "selected_network": "mainnet", @@ -974,7 +974,7 @@ def test_get_wallet_db_path_v1() -> None: def test_get_wallet_db_path_testnet() -> None: - root_path: Path = Path("/x/y/z/.chia/testnet").resolve() + root_path: Path = Path("/x/y/z/.flax/testnet").resolve() config: Dict[str, Any] = { "database_path": "wallet/db/blockchain_wallet_v2_CHALLENGE_KEY.sqlite", "selected_network": "testnet", diff --git a/tests/wallet/test_wallet_blockchain.py b/tests/wallet/test_wallet_blockchain.py index ca7c0ea4c..b9f14e496 100644 --- a/tests/wallet/test_wallet_blockchain.py +++ b/tests/wallet/test_wallet_blockchain.py @@ -1,13 +1,13 @@ import dataclasses import pytest -from chia.consensus.blockchain import ReceiveBlockResult -from chia.protocols import full_node_protocol -from chia.types.blockchain_format.vdf import VDFProof -from chia.types.weight_proof import WeightProof -from chia.util.generator_tools import get_block_header -from chia.wallet.key_val_store import KeyValStore -from chia.wallet.wallet_blockchain import WalletBlockchain +from flax.consensus.blockchain import ReceiveBlockResult +from flax.protocols import full_node_protocol +from flax.types.blockchain_format.vdf import VDFProof +from flax.types.weight_proof import WeightProof +from flax.util.generator_tools import get_block_header +from flax.wallet.key_val_store import KeyValStore +from flax.wallet.wallet_blockchain import WalletBlockchain from tests.setup_nodes import test_constants from tests.util.db_connection import DBConnection diff --git a/tests/wallet/test_wallet_coin_store.py b/tests/wallet/test_wallet_coin_store.py index f2bbf0313..95190e16b 100644 --- a/tests/wallet/test_wallet_coin_store.py +++ b/tests/wallet/test_wallet_coin_store.py @@ -4,11 +4,11 @@ import pytest -from chia.types.blockchain_format.coin import Coin -from chia.util.ints import uint32, uint64 -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_coin_store import WalletCoinStore +from flax.types.blockchain_format.coin import Coin +from flax.util.ints import uint32, uint64 +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_coin_store import WalletCoinStore from tests.util.db_connection import DBConnection coin_1 = Coin(token_bytes(32), token_bytes(32), uint64(12312)) diff --git a/tests/wallet/test_wallet_interested_store.py b/tests/wallet/test_wallet_interested_store.py index 9a6916fb2..c8ba0756d 100644 --- a/tests/wallet/test_wallet_interested_store.py +++ b/tests/wallet/test_wallet_interested_store.py @@ -1,10 +1,10 @@ from secrets import token_bytes import pytest -from chia.types.blockchain_format.coin import Coin -from chia.util.ints import uint64 +from flax.types.blockchain_format.coin import Coin +from flax.util.ints import uint64 -from chia.wallet.wallet_interested_store import WalletInterestedStore +from flax.wallet.wallet_interested_store import WalletInterestedStore from tests.util.db_connection import DBConnection diff --git a/tests/wallet/test_wallet_key_val_store.py b/tests/wallet/test_wallet_key_val_store.py index 2ab8dee1e..346412b65 100644 --- a/tests/wallet/test_wallet_key_val_store.py +++ b/tests/wallet/test_wallet_key_val_store.py @@ -1,8 +1,8 @@ import pytest -from chia.types.full_block import FullBlock -from chia.types.header_block import HeaderBlock -from chia.wallet.key_val_store import KeyValStore +from flax.types.full_block import FullBlock +from flax.types.header_block import HeaderBlock +from flax.wallet.key_val_store import KeyValStore from tests.util.db_connection import DBConnection diff --git a/tests/wallet/test_wallet_node.py b/tests/wallet/test_wallet_node.py index 3f82ebdae..28d7eb15e 100644 --- a/tests/wallet/test_wallet_node.py +++ b/tests/wallet/test_wallet_node.py @@ -7,9 +7,9 @@ import pytest from blspy import PrivateKey -from chia.util.config import load_config -from chia.util.keychain import Keychain, generate_mnemonic -from chia.wallet.wallet_node import WalletNode +from flax.util.config import load_config +from flax.util.keychain import Keychain, generate_mnemonic +from flax.wallet.wallet_node import WalletNode from tests.setup_nodes import test_constants diff --git a/tests/wallet/test_wallet_retry.py b/tests/wallet/test_wallet_retry.py index 7ce0762e7..0be41dcd2 100644 --- a/tests/wallet/test_wallet_retry.py +++ b/tests/wallet/test_wallet_retry.py @@ -5,15 +5,15 @@ import pytest -from chia.full_node.full_node_api import FullNodeAPI -from chia.simulator.block_tools import BlockTools -from chia.simulator.full_node_simulator import FullNodeSimulator -from chia.simulator.time_out_assert import time_out_assert, time_out_assert_custom_interval -from chia.types.peer_info import PeerInfo -from chia.types.spend_bundle import SpendBundle -from chia.util.ints import uint16, uint64 -from chia.wallet.transaction_record import TransactionRecord -from chia.wallet.wallet_node import WalletNode +from flax.full_node.full_node_api import FullNodeAPI +from flax.simulator.block_tools import BlockTools +from flax.simulator.full_node_simulator import FullNodeSimulator +from flax.simulator.time_out_assert import time_out_assert, time_out_assert_custom_interval +from flax.types.peer_info import PeerInfo +from flax.types.spend_bundle import SpendBundle +from flax.util.ints import uint16, uint64 +from flax.wallet.transaction_record import TransactionRecord +from flax.wallet.wallet_node import WalletNode from tests.pools.test_pool_rpc import farm_blocks from tests.util.wallet_is_synced import wallet_is_synced diff --git a/tests/wallet/test_wallet_trade_store.py b/tests/wallet/test_wallet_trade_store.py index f64e8d0a7..0e86c7b7d 100644 --- a/tests/wallet/test_wallet_trade_store.py +++ b/tests/wallet/test_wallet_trade_store.py @@ -5,15 +5,15 @@ import pytest -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.util.ints import uint32, uint64 -from chia.wallet.trade_record import TradeRecord -from chia.wallet.trading.trade_status import TradeStatus -from chia.wallet.trading.trade_store import TradeStore, migrate_coin_of_interest -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet_coin_record import WalletCoinRecord -from chia.wallet.wallet_coin_store import WalletCoinStore +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.util.ints import uint32, uint64 +from flax.wallet.trade_record import TradeRecord +from flax.wallet.trading.trade_status import TradeStatus +from flax.wallet.trading.trade_store import TradeStore, migrate_coin_of_interest +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet_coin_record import WalletCoinRecord +from flax.wallet.wallet_coin_store import WalletCoinStore from tests.util.db_connection import DBConnection coin_1 = Coin(token_bytes(32), token_bytes(32), uint64(12311)) diff --git a/tests/wallet/test_wallet_user_store.py b/tests/wallet/test_wallet_user_store.py index ff938f63a..4d8fc7245 100644 --- a/tests/wallet/test_wallet_user_store.py +++ b/tests/wallet/test_wallet_user_store.py @@ -2,8 +2,8 @@ import pytest -from chia.wallet.util.wallet_types import WalletType -from chia.wallet.wallet_user_store import WalletUserStore +from flax.wallet.util.wallet_types import WalletType +from flax.wallet.wallet_user_store import WalletUserStore from tests.util.db_connection import DBConnection diff --git a/tests/weight_proof/test_weight_proof.py b/tests/weight_proof/test_weight_proof.py index d8e608732..736560efa 100644 --- a/tests/weight_proof/test_weight_proof.py +++ b/tests/weight_proof/test_weight_proof.py @@ -4,25 +4,25 @@ import aiosqlite import pytest -from chia.consensus.block_record import BlockRecord -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.consensus.full_block_to_block_record import block_to_block_record -from chia.full_node.block_store import BlockStore -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary -from chia.util.block_cache import BlockCache -from chia.simulator.block_tools import test_constants -from chia.util.generator_tools import get_block_header - -from chia.consensus.pot_iterations import calculate_iterations_quality -from chia.full_node.weight_proof import ( +from flax.consensus.block_record import BlockRecord +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.consensus.full_block_to_block_record import block_to_block_record +from flax.full_node.block_store import BlockStore +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.blockchain_format.sub_epoch_summary import SubEpochSummary +from flax.util.block_cache import BlockCache +from flax.simulator.block_tools import test_constants +from flax.util.generator_tools import get_block_header + +from flax.consensus.pot_iterations import calculate_iterations_quality +from flax.full_node.weight_proof import ( WeightProofHandler, _map_sub_epoch_summaries, _validate_summaries_weight, ) -from chia.types.full_block import FullBlock -from chia.types.header_block import HeaderBlock -from chia.util.ints import uint32, uint64 +from flax.types.full_block import FullBlock +from flax.types.header_block import HeaderBlock +from flax.util.ints import uint32, uint64 def count_sub_epochs(blockchain, last_hash) -> int: diff --git a/tools/analyze-chain.py b/tools/analyze-chain.py old mode 100755 new mode 100644 index 347b538c9..1f3a1014e --- a/tools/analyze-chain.py +++ b/tools/analyze-chain.py @@ -12,10 +12,10 @@ from chia_rs import run_generator, MEMPOOL_MODE -from chia.types.blockchain_format.program import Program -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.wallet.puzzles.rom_bootstrap_generator import get_generator -from chia.util.full_block_utils import block_info_from_block, generator_from_block +from flax.types.blockchain_format.program import Program +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.wallet.puzzles.rom_bootstrap_generator import get_generator +from flax.util.full_block_utils import block_info_from_block, generator_from_block GENERATOR_ROM = bytes(get_generator()) diff --git a/tools/generate_chain.py b/tools/generate_chain.py index 34e2d7515..5d20c2a40 100644 --- a/tools/generate_chain.py +++ b/tools/generate_chain.py @@ -12,11 +12,11 @@ import click import zstd -from chia.simulator.block_tools import create_block_tools -from chia.types.blockchain_format.coin import Coin -from chia.types.spend_bundle import SpendBundle -from chia.util.chia_logging import initialize_logging -from chia.util.ints import uint32, uint64 +from flax.simulator.block_tools import create_block_tools +from flax.types.blockchain_format.coin import Coin +from flax.types.spend_bundle import SpendBundle +from flax.util.flax_logging import initialize_logging +from flax.util.ints import uint32, uint64 from tests.util.keyring import TempKeyring from tools.test_constants import test_constants diff --git a/tools/manage_clvm.py b/tools/manage_clvm.py index 5bd668a09..7e73b2630 100644 --- a/tools/manage_clvm.py +++ b/tools/manage_clvm.py @@ -24,14 +24,14 @@ from clvm_tools_rs import compile_clvm # noqa: E402 -from chia.types.blockchain_format.program import SerializedProgram # noqa: E402 +from flax.types.blockchain_format.program import SerializedProgram # noqa: E402 clvm_suffix = ".clvm" hex_suffix = ".clvm.hex" hash_suffix = ".clvm.hex.sha256tree" all_suffixes = {"clvm": clvm_suffix, "hex": hex_suffix, "hash": hash_suffix} # TODO: could be cli options -top_levels = {"chia"} +top_levels = {"flax"} def generate_hash_bytes(hex_bytes: bytes) -> bytes: diff --git a/tools/run_benchmark.sh b/tools/run_benchmark.sh old mode 100755 new mode 100644 index 541de3c6d..150245dd2 --- a/tools/run_benchmark.sh +++ b/tools/run_benchmark.sh @@ -9,7 +9,7 @@ run_benchmark() { mv test-full-sync.log cpu.png cpu-usage.log plot-cpu.gnuplot "$2" python ./tools/test_full_sync.py analyze mv slow-batch-*.profile slow-batch-*.png "$2" - python ./chia/util/profiler.py profile-node >"$2/node-profile.txt" + python ./flax/util/profiler.py profile-node >"$2/node-profile.txt" mv profile-node "$2" } diff --git a/tools/run_block.py b/tools/run_block.py index 62dd2dc79..d762fd474 100644 --- a/tools/run_block.py +++ b/tools/run_block.py @@ -1,9 +1,9 @@ #!/usr/bin/env python """ -run_block: Convert an encoded FullBlock from the Chia blockchain into a list of transactions +run_block: Convert an encoded FullBlock from the Flax blockchain into a list of transactions -As input, takes a file containing a [FullBlock](../chia/types/full_block.py) in json format +As input, takes a file containing a [FullBlock](../flax/types/full_block.py) in json format ``` curl --insecure --cert $config_root/config/ssl/full_node/private_full_node.crt \ @@ -11,8 +11,8 @@ -d '{ "header_hash": "'$hash'" }' -H "Content-Type: application/json" \ -X POST https://localhost:$port/get_block -$ca_root is the directory containing your current Chia config files -$hash is the header_hash of the [BlockRecord](../chia/consensus/block_record.py) +$ca_root is the directory containing your current Flax config files +$hash is the header_hash of the [BlockRecord](../flax/consensus/block_record.py) $port is the Full Node RPC API port ``` @@ -27,7 +27,7 @@ The information for each spend is an "NPC" (Name, Puzzle, Condition): "coin_name": a unique 32 byte identifier - "conditions": a list of condition expressions, as in [condition_opcodes.py](../chia/types/condition_opcodes.py) + "conditions": a list of condition expressions, as in [condition_opcodes.py](../flax/types/condition_opcodes.py) "puzzle_hash": the sha256 of the CLVM bytecode that controls spending this coin Condition Opcodes, such as AGG_SIG_ME, or CREATE_COIN are created by running the "puzzle", i.e. the CLVM bytecode @@ -45,23 +45,23 @@ import click from clvm.casts import int_from_bytes -from chia.consensus.constants import ConsensusConstants -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.types.blockchain_format.coin import Coin -from chia.types.blockchain_format.program import SerializedProgram -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.condition_opcodes import ConditionOpcode -from chia.types.condition_with_args import ConditionWithArgs -from chia.types.generator_types import BlockGenerator -from chia.util.config import load_config -from chia.util.default_root import DEFAULT_ROOT_PATH -from chia.util.ints import uint32, uint64 -from chia.wallet.cat_wallet.cat_utils import match_cat_puzzle -from chia.wallet.puzzles.load_clvm import load_serialized_clvm_maybe_recompile -from chia.wallet.uncurried_puzzle import uncurry_puzzle +from flax.consensus.constants import ConsensusConstants +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.types.blockchain_format.coin import Coin +from flax.types.blockchain_format.program import SerializedProgram +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.condition_opcodes import ConditionOpcode +from flax.types.condition_with_args import ConditionWithArgs +from flax.types.generator_types import BlockGenerator +from flax.util.config import load_config +from flax.util.default_root import DEFAULT_ROOT_PATH +from flax.util.ints import uint32, uint64 +from flax.wallet.cat_wallet.cat_utils import match_cat_puzzle +from flax.wallet.puzzles.load_clvm import load_serialized_clvm_maybe_recompile +from flax.wallet.uncurried_puzzle import uncurry_puzzle DESERIALIZE_MOD = load_serialized_clvm_maybe_recompile( - "chialisp_deserialisation.clvm", package_or_requirement="chia.wallet.puzzles" + "flaxlisp_deserialisation.clvm", package_or_requirement="flax.wallet.puzzles" ) diff --git a/tools/test_constants.py b/tools/test_constants.py index 397155eaf..362be7eef 100644 --- a/tools/test_constants.py +++ b/tools/test_constants.py @@ -1,6 +1,6 @@ from __future__ import annotations -from chia.consensus.default_constants import DEFAULT_CONSTANTS +from flax.consensus.default_constants import DEFAULT_CONSTANTS test_constants = DEFAULT_CONSTANTS.replace( **{ diff --git a/tools/test_full_sync.py b/tools/test_full_sync.py old mode 100755 new mode 100644 index 0ef1da740..3d055ce72 --- a/tools/test_full_sync.py +++ b/tools/test_full_sync.py @@ -17,18 +17,18 @@ import click import zstd -import chia.server.ws_connection as ws -from chia.cmds.init_funcs import chia_init -from chia.consensus.default_constants import DEFAULT_CONSTANTS -from chia.full_node.full_node import FullNode -from chia.protocols import full_node_protocol -from chia.server.outbound_message import Message, NodeType -from chia.simulator.block_tools import make_unfinished_block -from chia.types.blockchain_format.sized_bytes import bytes32 -from chia.types.full_block import FullBlock -from chia.types.peer_info import PeerInfo -from chia.util.config import load_config -from chia.util.ints import uint16 +import flax.server.ws_connection as ws +from flax.cmds.init_funcs import flax_init +from flax.consensus.default_constants import DEFAULT_CONSTANTS +from flax.full_node.full_node import FullNode +from flax.protocols import full_node_protocol +from flax.server.outbound_message import Message, NodeType +from flax.simulator.block_tools import make_unfinished_block +from flax.types.blockchain_format.sized_bytes import bytes32 +from flax.types.full_block import FullBlock +from flax.types.peer_info import PeerInfo +from flax.util.config import load_config +from flax.util.ints import uint16 from tools.test_constants import test_constants as TEST_CONSTANTS @@ -71,7 +71,7 @@ def set_received_message_callback(self, callback: Callable): async def get_peer_info(self) -> Optional[PeerInfo]: return None - def get_full_node_outgoing_connections(self) -> List[ws.WSChiaConnection]: + def get_full_node_outgoing_connections(self) -> List[ws.WSFlaxConnection]: return [] def is_duplicate_or_self_connection(self, target_node: PeerInfo) -> bool: @@ -129,7 +129,7 @@ async def run_sync_test( if start_at_checkpoint is not None: shutil.copytree(Path(start_at_checkpoint) / ".", root_path, dirs_exist_ok=True) - chia_init(root_path, should_check_keys=False, v1_db=(db_version == 1)) + flax_init(root_path, should_check_keys=False, v1_db=(db_version == 1)) config = load_config(root_path, "config.yaml") if test_constants: @@ -157,7 +157,7 @@ async def run_sync_test( else: height = 0 - peer: ws.WSChiaConnection = FakePeer() # type: ignore[assignment] + peer: ws.WSFlaxConnection = FakePeer() # type: ignore[assignment] print() counter = 0 @@ -339,7 +339,7 @@ async def run_sync_checkpoint( root_path.mkdir(parents=True, exist_ok=True) - chia_init(root_path, should_check_keys=False, v1_db=False) + flax_init(root_path, should_check_keys=False, v1_db=False) config = load_config(root_path, "config.yaml") overrides = config["network_overrides"]["constants"][config["selected_network"]] @@ -355,7 +355,7 @@ async def run_sync_checkpoint( full_node.set_server(FakeServer()) # type: ignore[arg-type] await full_node._start() - peer: ws.WSChiaConnection = FakePeer() # type: ignore[assignment] + peer: ws.WSFlaxConnection = FakePeer() # type: ignore[assignment] print() height = 0