chia-blockchain 2.5.0rc2__py3-none-any.whl → 2.5.1rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (637) hide show
  1. chia/_tests/README.md +1 -1
  2. chia/_tests/blockchain/blockchain_test_utils.py +24 -26
  3. chia/_tests/blockchain/test_augmented_chain.py +6 -8
  4. chia/_tests/blockchain/test_blockchain.py +409 -307
  5. chia/_tests/blockchain/test_blockchain_transactions.py +56 -75
  6. chia/_tests/blockchain/test_build_chains.py +11 -13
  7. chia/_tests/blockchain/test_get_block_generator.py +8 -8
  8. chia/_tests/blockchain/test_lookup_fork_chain.py +3 -4
  9. chia/_tests/build-init-files.py +3 -4
  10. chia/_tests/build-job-matrix.py +9 -9
  11. chia/_tests/check_sql_statements.py +2 -3
  12. chia/_tests/clvm/benchmark_costs.py +1 -1
  13. chia/_tests/clvm/coin_store.py +7 -5
  14. chia/_tests/clvm/test_chialisp_deserialization.py +8 -8
  15. chia/_tests/clvm/test_condition_codes.py +2 -2
  16. chia/_tests/clvm/test_curry_and_treehash.py +2 -4
  17. chia/_tests/clvm/test_message_conditions.py +184 -0
  18. chia/_tests/clvm/test_puzzle_compression.py +1 -2
  19. chia/_tests/clvm/test_puzzle_drivers.py +3 -3
  20. chia/_tests/clvm/test_puzzles.py +13 -18
  21. chia/_tests/clvm/test_singletons.py +17 -17
  22. chia/_tests/clvm/test_spend_sim.py +7 -7
  23. chia/_tests/cmds/cmd_test_utils.py +42 -45
  24. chia/_tests/cmds/conftest.py +2 -2
  25. chia/_tests/cmds/test_click_types.py +21 -16
  26. chia/_tests/cmds/test_cmd_framework.py +255 -35
  27. chia/_tests/cmds/test_cmds_util.py +2 -2
  28. chia/_tests/cmds/test_daemon.py +3 -3
  29. chia/_tests/cmds/test_dev_gh.py +131 -0
  30. chia/_tests/cmds/test_farm_cmd.py +1 -2
  31. chia/_tests/cmds/test_show.py +6 -6
  32. chia/_tests/cmds/test_tx_config_args.py +2 -1
  33. chia/_tests/cmds/wallet/test_dao.py +23 -23
  34. chia/_tests/cmds/wallet/test_did.py +29 -29
  35. chia/_tests/cmds/wallet/test_nft.py +24 -23
  36. chia/_tests/cmds/wallet/test_notifications.py +8 -8
  37. chia/_tests/cmds/wallet/test_tx_decorators.py +3 -3
  38. chia/_tests/cmds/wallet/test_vcs.py +97 -73
  39. chia/_tests/cmds/wallet/test_wallet.py +74 -75
  40. chia/_tests/cmds/wallet/test_wallet_check.py +5 -7
  41. chia/_tests/conftest.py +153 -38
  42. chia/_tests/connection_utils.py +7 -6
  43. chia/_tests/core/cmds/test_beta.py +3 -3
  44. chia/_tests/core/cmds/test_keys.py +6 -6
  45. chia/_tests/core/cmds/test_wallet.py +3 -3
  46. chia/_tests/core/consensus/test_block_creation.py +3 -5
  47. chia/_tests/core/custom_types/test_coin.py +1 -3
  48. chia/_tests/core/custom_types/test_spend_bundle.py +3 -4
  49. chia/_tests/core/daemon/test_daemon.py +58 -58
  50. chia/_tests/core/daemon/test_keychain_proxy.py +2 -1
  51. chia/_tests/core/data_layer/conftest.py +4 -3
  52. chia/_tests/core/data_layer/test_data_cli.py +1 -2
  53. chia/_tests/core/data_layer/test_data_layer.py +5 -5
  54. chia/_tests/core/data_layer/test_data_layer_util.py +8 -9
  55. chia/_tests/core/data_layer/test_data_rpc.py +75 -93
  56. chia/_tests/core/data_layer/test_data_store.py +38 -37
  57. chia/_tests/core/data_layer/test_data_store_schema.py +11 -11
  58. chia/_tests/core/data_layer/util.py +11 -10
  59. chia/_tests/core/farmer/test_farmer_api.py +6 -4
  60. chia/_tests/core/full_node/full_sync/test_full_sync.py +5 -10
  61. chia/_tests/core/full_node/ram_db.py +2 -2
  62. chia/_tests/core/full_node/stores/test_block_store.py +113 -11
  63. chia/_tests/core/full_node/stores/test_coin_store.py +37 -28
  64. chia/_tests/core/full_node/stores/test_full_node_store.py +34 -30
  65. chia/_tests/core/full_node/stores/test_hint_store.py +3 -4
  66. chia/_tests/core/full_node/test_address_manager.py +2 -2
  67. chia/_tests/core/full_node/test_block_height_map.py +1 -1
  68. chia/_tests/core/full_node/test_conditions.py +10 -12
  69. chia/_tests/core/full_node/test_full_node.py +2077 -1822
  70. chia/_tests/core/full_node/test_generator_tools.py +4 -4
  71. chia/_tests/core/full_node/test_hint_management.py +2 -2
  72. chia/_tests/core/full_node/test_performance.py +2 -5
  73. chia/_tests/core/full_node/test_subscriptions.py +4 -4
  74. chia/_tests/core/full_node/test_tx_processing_queue.py +5 -4
  75. chia/_tests/core/make_block_generator.py +5 -7
  76. chia/_tests/core/mempool/test_mempool.py +205 -208
  77. chia/_tests/core/mempool/test_mempool_fee_protocol.py +5 -5
  78. chia/_tests/core/mempool/test_mempool_item_queries.py +2 -4
  79. chia/_tests/core/mempool/test_mempool_manager.py +109 -80
  80. chia/_tests/core/mempool/test_mempool_performance.py +3 -4
  81. chia/_tests/core/mempool/test_singleton_fast_forward.py +12 -12
  82. chia/_tests/core/server/flood.py +6 -4
  83. chia/_tests/core/server/serve.py +10 -7
  84. chia/_tests/core/server/test_api_protocol.py +21 -0
  85. chia/_tests/core/server/test_capabilities.py +3 -5
  86. chia/_tests/core/server/test_dos.py +15 -16
  87. chia/_tests/core/server/test_loop.py +14 -10
  88. chia/_tests/core/server/test_node_discovery.py +1 -2
  89. chia/_tests/core/server/test_rate_limits.py +156 -44
  90. chia/_tests/core/server/test_server.py +8 -7
  91. chia/_tests/core/services/test_services.py +59 -37
  92. chia/_tests/core/ssl/test_ssl.py +5 -3
  93. chia/_tests/core/test_cost_calculation.py +5 -6
  94. chia/_tests/core/test_crawler.py +2 -2
  95. chia/_tests/core/test_db_conversion.py +5 -4
  96. chia/_tests/core/test_db_validation.py +6 -5
  97. chia/_tests/core/test_farmer_harvester_rpc.py +8 -7
  98. chia/_tests/core/test_filter.py +3 -5
  99. chia/_tests/core/test_full_node_rpc.py +64 -90
  100. chia/_tests/core/test_merkle_set.py +10 -10
  101. chia/_tests/core/test_program.py +2 -4
  102. chia/_tests/core/test_rpc_util.py +1 -2
  103. chia/_tests/core/test_seeder.py +124 -12
  104. chia/_tests/core/util/test_block_cache.py +5 -5
  105. chia/_tests/core/util/test_cached_bls.py +3 -3
  106. chia/_tests/core/util/test_config.py +13 -13
  107. chia/_tests/core/util/test_files.py +2 -2
  108. chia/_tests/core/util/test_jsonify.py +9 -9
  109. chia/_tests/core/util/test_keychain.py +13 -5
  110. chia/_tests/core/util/test_keyring_wrapper.py +6 -5
  111. chia/_tests/core/util/test_log_exceptions.py +3 -3
  112. chia/_tests/core/util/test_streamable.py +38 -38
  113. chia/_tests/db/test_db_wrapper.py +13 -12
  114. chia/_tests/environments/common.py +2 -2
  115. chia/_tests/environments/full_node.py +2 -2
  116. chia/_tests/environments/wallet.py +109 -48
  117. chia/_tests/farmer_harvester/test_farmer.py +35 -35
  118. chia/_tests/farmer_harvester/test_farmer_harvester.py +17 -17
  119. chia/_tests/farmer_harvester/test_filter_prefix_bits.py +6 -5
  120. chia/_tests/farmer_harvester/test_third_party_harvesters.py +73 -46
  121. chia/_tests/fee_estimation/test_fee_estimation_integration.py +8 -8
  122. chia/_tests/fee_estimation/test_fee_estimation_rpc.py +47 -47
  123. chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +6 -7
  124. chia/_tests/fee_estimation/test_mempoolitem_height_added.py +11 -11
  125. chia/_tests/generator/test_compression.py +13 -30
  126. chia/_tests/generator/test_generator_types.py +3 -3
  127. chia/_tests/generator/test_rom.py +7 -9
  128. chia/_tests/plot_sync/test_delta.py +2 -3
  129. chia/_tests/plot_sync/test_plot_sync.py +25 -24
  130. chia/_tests/plot_sync/test_receiver.py +9 -9
  131. chia/_tests/plot_sync/test_sender.py +1 -1
  132. chia/_tests/plot_sync/test_sync_simulated.py +27 -26
  133. chia/_tests/plot_sync/util.py +2 -1
  134. chia/_tests/plotting/test_plot_manager.py +54 -11
  135. chia/_tests/plotting/util.py +2 -3
  136. chia/_tests/pools/test_pool_cli_parsing.py +128 -0
  137. chia/_tests/pools/test_pool_cmdline.py +993 -15
  138. chia/_tests/pools/test_pool_config.py +3 -5
  139. chia/_tests/pools/test_pool_puzzles_lifecycle.py +10 -11
  140. chia/_tests/pools/test_pool_rpc.py +203 -90
  141. chia/_tests/pools/test_pool_wallet.py +12 -8
  142. chia/_tests/pools/test_wallet_pool_store.py +3 -3
  143. chia/_tests/process_junit.py +16 -17
  144. chia/_tests/rpc/test_rpc_client.py +59 -2
  145. chia/_tests/rpc/test_rpc_server.py +183 -0
  146. chia/_tests/simulation/test_simulation.py +5 -5
  147. chia/_tests/simulation/test_simulator.py +8 -10
  148. chia/_tests/simulation/test_start_simulator.py +5 -4
  149. chia/_tests/timelord/test_new_peak.py +19 -19
  150. chia/_tests/tools/test_run_block.py +1 -2
  151. chia/_tests/tools/test_virtual_project.py +591 -0
  152. chia/_tests/util/benchmark_cost.py +9 -9
  153. chia/_tests/util/benchmarks.py +1 -2
  154. chia/_tests/util/blockchain.py +12 -11
  155. chia/_tests/util/blockchain_mock.py +15 -15
  156. chia/_tests/util/build_network_protocol_files.py +12 -12
  157. chia/_tests/util/db_connection.py +3 -2
  158. chia/_tests/util/full_sync.py +14 -6
  159. chia/_tests/util/gen_ssl_certs.py +4 -5
  160. chia/_tests/util/generator_tools_testing.py +5 -7
  161. chia/_tests/util/get_name_puzzle_conditions.py +52 -0
  162. chia/_tests/util/key_tool.py +2 -3
  163. chia/_tests/util/misc.py +59 -106
  164. chia/_tests/util/network_protocol_data.py +7 -9
  165. chia/_tests/util/protocol_messages_json.py +112 -111
  166. chia/_tests/util/rpc.py +3 -0
  167. chia/_tests/util/run_block.py +16 -16
  168. chia/_tests/util/setup_nodes.py +25 -23
  169. chia/{clvm → _tests/util}/spend_sim.py +59 -55
  170. chia/_tests/util/split_managers.py +12 -9
  171. chia/_tests/util/temp_file.py +1 -1
  172. chia/_tests/util/test_action_scope.py +2 -1
  173. chia/_tests/util/test_async_pool.py +8 -8
  174. chia/_tests/util/test_build_job_matrix.py +2 -3
  175. chia/_tests/util/test_condition_tools.py +4 -6
  176. chia/_tests/util/test_config.py +5 -5
  177. chia/_tests/util/test_dump_keyring.py +1 -1
  178. chia/_tests/util/test_full_block_utils.py +19 -11
  179. chia/_tests/util/test_limited_semaphore.py +4 -3
  180. chia/_tests/util/test_logging_filter.py +2 -3
  181. chia/_tests/util/test_misc.py +29 -28
  182. chia/_tests/util/test_network.py +32 -31
  183. chia/_tests/util/test_network_protocol_files.py +2 -3
  184. chia/_tests/util/test_network_protocol_json.py +1 -0
  185. chia/_tests/util/test_network_protocol_test.py +18 -19
  186. chia/_tests/util/test_paginator.py +3 -4
  187. chia/_tests/util/test_pprint.py +1 -1
  188. chia/_tests/util/test_priority_mutex.py +18 -17
  189. chia/_tests/util/test_recursive_replace.py +2 -2
  190. chia/_tests/util/test_testnet_overrides.py +3 -3
  191. chia/_tests/util/test_timing.py +1 -1
  192. chia/_tests/util/test_trusted_peer.py +2 -2
  193. chia/_tests/util/time_out_assert.py +43 -6
  194. chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +13 -13
  195. chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +1 -1
  196. chia/_tests/wallet/cat_wallet/test_cat_wallet.py +117 -29
  197. chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +15 -15
  198. chia/_tests/wallet/cat_wallet/test_trades.py +50 -28
  199. chia/_tests/wallet/clawback/test_clawback_decorator.py +3 -5
  200. chia/_tests/wallet/clawback/test_clawback_lifecycle.py +6 -6
  201. chia/_tests/wallet/clawback/test_clawback_metadata.py +1 -2
  202. chia/_tests/wallet/conftest.py +135 -74
  203. chia/_tests/wallet/dao_wallet/test_dao_clvm.py +25 -17
  204. chia/_tests/wallet/dao_wallet/test_dao_wallets.py +75 -75
  205. chia/_tests/wallet/db_wallet/test_db_graftroot.py +10 -12
  206. chia/_tests/wallet/db_wallet/test_dl_offers.py +6 -6
  207. chia/_tests/wallet/db_wallet/test_dl_wallet.py +18 -18
  208. chia/_tests/wallet/did_wallet/test_did.py +1277 -474
  209. chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +12 -11
  210. chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +115 -105
  211. chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +6 -7
  212. chia/_tests/wallet/nft_wallet/test_nft_offers.py +16 -16
  213. chia/_tests/wallet/nft_wallet/test_nft_puzzles.py +3 -3
  214. chia/_tests/wallet/nft_wallet/test_nft_wallet.py +38 -12
  215. chia/_tests/wallet/nft_wallet/test_ownership_outer_puzzle.py +1 -1
  216. chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +31 -33
  217. chia/_tests/wallet/rpc/test_wallet_rpc.py +218 -171
  218. chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py +36 -37
  219. chia/_tests/wallet/sync/test_wallet_sync.py +241 -78
  220. chia/_tests/wallet/test_address_type.py +20 -20
  221. chia/_tests/wallet/test_clvm_streamable.py +5 -5
  222. chia/_tests/wallet/test_coin_management.py +354 -0
  223. chia/_tests/wallet/test_coin_selection.py +34 -35
  224. chia/_tests/wallet/test_conditions.py +28 -16
  225. chia/_tests/wallet/test_debug_spend_bundle.py +156 -14
  226. chia/_tests/wallet/test_new_wallet_protocol.py +29 -31
  227. chia/_tests/wallet/test_nft_store.py +1 -2
  228. chia/_tests/wallet/test_notifications.py +2 -2
  229. chia/_tests/wallet/test_offer_parsing_performance.py +1 -1
  230. chia/_tests/wallet/test_puzzle_store.py +2 -3
  231. chia/_tests/wallet/test_sign_coin_spends.py +3 -3
  232. chia/_tests/wallet/test_signer_protocol.py +33 -34
  233. chia/_tests/wallet/test_singleton_lifecycle_fast.py +29 -29
  234. chia/_tests/wallet/test_taproot.py +1 -1
  235. chia/_tests/wallet/test_transaction_store.py +23 -19
  236. chia/_tests/wallet/test_util.py +36 -32
  237. chia/_tests/wallet/test_wallet.py +37 -37
  238. chia/_tests/wallet/test_wallet_action_scope.py +8 -8
  239. chia/_tests/wallet/test_wallet_blockchain.py +4 -6
  240. chia/_tests/wallet/test_wallet_coin_store.py +34 -34
  241. chia/_tests/wallet/test_wallet_node.py +69 -72
  242. chia/_tests/wallet/test_wallet_retry.py +3 -3
  243. chia/_tests/wallet/test_wallet_state_manager.py +12 -5
  244. chia/_tests/wallet/test_wallet_trade_store.py +2 -2
  245. chia/_tests/wallet/test_wallet_utils.py +5 -4
  246. chia/_tests/wallet/vc_wallet/test_cr_outer_puzzle.py +3 -3
  247. chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +18 -18
  248. chia/_tests/wallet/vc_wallet/test_vc_wallet.py +69 -40
  249. chia/_tests/wallet/wallet_block_tools.py +27 -27
  250. chia/_tests/weight_proof/test_weight_proof.py +30 -30
  251. chia/apis.py +19 -0
  252. chia/cmds/beta.py +8 -7
  253. chia/cmds/beta_funcs.py +15 -11
  254. chia/cmds/check_wallet_db.py +29 -27
  255. chia/cmds/chia.py +17 -9
  256. chia/cmds/cmd_classes.py +87 -79
  257. chia/cmds/cmd_helpers.py +242 -0
  258. chia/cmds/cmds_util.py +56 -66
  259. chia/cmds/coin_funcs.py +168 -153
  260. chia/cmds/coins.py +156 -194
  261. chia/cmds/configure.py +4 -3
  262. chia/cmds/dao.py +89 -33
  263. chia/cmds/dao_funcs.py +55 -33
  264. chia/cmds/data.py +7 -6
  265. chia/cmds/data_funcs.py +26 -21
  266. chia/cmds/db.py +4 -3
  267. chia/cmds/db_backup_func.py +2 -2
  268. chia/cmds/db_upgrade_func.py +3 -3
  269. chia/cmds/db_validate_func.py +2 -2
  270. chia/cmds/dev.py +2 -0
  271. chia/cmds/farm.py +18 -5
  272. chia/cmds/farm_funcs.py +17 -24
  273. chia/cmds/gh.py +275 -0
  274. chia/cmds/init.py +4 -11
  275. chia/cmds/init_funcs.py +9 -9
  276. chia/cmds/installers.py +5 -3
  277. chia/cmds/keys.py +56 -39
  278. chia/cmds/keys_funcs.py +30 -31
  279. chia/cmds/netspace.py +6 -3
  280. chia/cmds/netspace_funcs.py +3 -2
  281. chia/cmds/param_types.py +16 -6
  282. chia/cmds/passphrase.py +8 -7
  283. chia/cmds/passphrase_funcs.py +7 -61
  284. chia/cmds/peer.py +2 -1
  285. chia/cmds/peer_funcs.py +5 -5
  286. chia/cmds/plotnft.py +207 -153
  287. chia/cmds/plotnft_funcs.py +205 -174
  288. chia/cmds/plots.py +14 -6
  289. chia/cmds/plotters.py +2 -1
  290. chia/cmds/rpc.py +48 -28
  291. chia/cmds/show.py +2 -1
  292. chia/cmds/show_funcs.py +7 -6
  293. chia/cmds/signer.py +50 -58
  294. chia/cmds/sim.py +22 -14
  295. chia/cmds/sim_funcs.py +11 -11
  296. chia/cmds/start.py +3 -3
  297. chia/cmds/start_funcs.py +9 -12
  298. chia/cmds/stop.py +4 -3
  299. chia/cmds/units.py +1 -3
  300. chia/cmds/wallet.py +252 -96
  301. chia/cmds/wallet_funcs.py +217 -143
  302. chia/consensus/block_body_validation.py +133 -86
  303. chia/consensus/block_creation.py +42 -21
  304. chia/consensus/block_header_validation.py +32 -37
  305. chia/consensus/block_record.py +1 -2
  306. chia/consensus/blockchain.py +167 -180
  307. chia/consensus/blockchain_interface.py +10 -10
  308. chia/consensus/constants.py +2 -2
  309. chia/consensus/default_constants.py +3 -4
  310. chia/consensus/difficulty_adjustment.py +5 -5
  311. chia/consensus/find_fork_point.py +5 -5
  312. chia/consensus/full_block_to_block_record.py +4 -4
  313. chia/consensus/get_block_challenge.py +2 -2
  314. chia/consensus/get_block_generator.py +4 -3
  315. chia/consensus/multiprocess_validation.py +207 -304
  316. chia/consensus/vdf_info_computation.py +3 -3
  317. chia/daemon/client.py +46 -27
  318. chia/daemon/keychain_proxy.py +10 -9
  319. chia/daemon/keychain_server.py +18 -18
  320. chia/daemon/server.py +103 -113
  321. chia/daemon/windows_signal.py +2 -2
  322. chia/data_layer/data_layer.py +64 -76
  323. chia/data_layer/data_layer_api.py +8 -0
  324. chia/data_layer/data_layer_errors.py +3 -3
  325. chia/data_layer/data_layer_server.py +2 -2
  326. chia/data_layer/data_layer_util.py +71 -71
  327. chia/data_layer/data_layer_wallet.py +63 -67
  328. chia/data_layer/data_store.py +72 -72
  329. chia/data_layer/dl_wallet_store.py +10 -10
  330. chia/data_layer/download_data.py +5 -5
  331. chia/data_layer/s3_plugin_service.py +9 -9
  332. chia/data_layer/util/benchmark.py +0 -1
  333. chia/data_layer/util/plugin.py +2 -3
  334. chia/farmer/farmer.py +46 -43
  335. chia/farmer/farmer_api.py +27 -21
  336. chia/full_node/block_height_map.py +6 -6
  337. chia/full_node/block_store.py +41 -35
  338. chia/full_node/coin_store.py +42 -41
  339. chia/full_node/fee_estimate.py +2 -2
  340. chia/full_node/fee_estimation.py +1 -2
  341. chia/full_node/fee_history.py +5 -6
  342. chia/full_node/fee_tracker.py +24 -24
  343. chia/full_node/full_node.py +574 -300
  344. chia/full_node/full_node_api.py +181 -130
  345. chia/full_node/full_node_store.py +43 -43
  346. chia/full_node/hint_management.py +4 -4
  347. chia/full_node/hint_store.py +9 -10
  348. chia/full_node/mempool.py +25 -19
  349. chia/full_node/mempool_check_conditions.py +11 -42
  350. chia/full_node/mempool_manager.py +48 -53
  351. chia/full_node/pending_tx_cache.py +9 -9
  352. chia/full_node/subscriptions.py +23 -24
  353. chia/full_node/sync_store.py +8 -7
  354. chia/full_node/tx_processing_queue.py +3 -3
  355. chia/full_node/util/__init__.py +0 -0
  356. chia/full_node/weight_proof.py +79 -78
  357. chia/harvester/harvester.py +9 -8
  358. chia/harvester/harvester_api.py +19 -13
  359. chia/introducer/introducer.py +7 -5
  360. chia/introducer/introducer_api.py +9 -3
  361. chia/legacy/keyring.py +6 -5
  362. chia/plot_sync/delta.py +8 -8
  363. chia/plot_sync/receiver.py +12 -11
  364. chia/plot_sync/sender.py +15 -12
  365. chia/plotters/bladebit.py +12 -12
  366. chia/plotters/chiapos.py +2 -2
  367. chia/plotters/madmax.py +8 -8
  368. chia/plotters/plotters.py +6 -6
  369. chia/plotters/plotters_util.py +6 -4
  370. chia/plotting/cache.py +8 -7
  371. chia/plotting/check_plots.py +8 -8
  372. chia/plotting/create_plots.py +6 -6
  373. chia/plotting/manager.py +22 -22
  374. chia/plotting/util.py +31 -19
  375. chia/pools/pool_config.py +7 -7
  376. chia/pools/pool_puzzles.py +16 -16
  377. chia/pools/pool_wallet.py +64 -57
  378. chia/pools/pool_wallet_info.py +3 -3
  379. chia/protocols/full_node_protocol.py +3 -3
  380. chia/protocols/harvester_protocol.py +12 -12
  381. chia/protocols/introducer_protocol.py +1 -2
  382. chia/protocols/protocol_message_types.py +4 -4
  383. chia/protocols/protocol_state_machine.py +2 -2
  384. chia/protocols/protocol_timing.py +1 -0
  385. chia/protocols/shared_protocol.py +3 -3
  386. chia/protocols/timelord_protocol.py +2 -2
  387. chia/protocols/wallet_protocol.py +33 -33
  388. chia/rpc/crawler_rpc_api.py +12 -7
  389. chia/rpc/data_layer_rpc_api.py +49 -44
  390. chia/rpc/data_layer_rpc_client.py +41 -41
  391. chia/rpc/data_layer_rpc_util.py +7 -11
  392. chia/rpc/farmer_rpc_api.py +32 -27
  393. chia/rpc/farmer_rpc_client.py +14 -14
  394. chia/rpc/full_node_rpc_api.py +53 -48
  395. chia/rpc/full_node_rpc_client.py +30 -30
  396. chia/rpc/harvester_rpc_api.py +16 -11
  397. chia/rpc/harvester_rpc_client.py +6 -6
  398. chia/rpc/rpc_client.py +34 -14
  399. chia/rpc/rpc_server.py +117 -43
  400. chia/rpc/timelord_rpc_api.py +9 -4
  401. chia/rpc/util.py +11 -211
  402. chia/rpc/wallet_request_types.py +276 -60
  403. chia/rpc/wallet_rpc_api.py +563 -399
  404. chia/rpc/wallet_rpc_client.py +220 -250
  405. chia/seeder/crawl_store.py +6 -8
  406. chia/seeder/crawler.py +23 -36
  407. chia/seeder/crawler_api.py +28 -22
  408. chia/seeder/dns_server.py +99 -50
  409. chia/seeder/start_crawler.py +13 -9
  410. chia/server/address_manager.py +19 -19
  411. chia/server/address_manager_store.py +17 -17
  412. chia/server/api_protocol.py +106 -1
  413. chia/server/capabilities.py +3 -3
  414. chia/server/chia_policy.py +17 -16
  415. chia/server/introducer_peers.py +3 -3
  416. chia/server/node_discovery.py +34 -38
  417. chia/server/rate_limit_numbers.py +26 -16
  418. chia/server/rate_limits.py +67 -27
  419. chia/server/server.py +52 -31
  420. chia/server/signal_handlers.py +6 -3
  421. chia/server/ssl_context.py +5 -5
  422. chia/server/start_data_layer.py +37 -23
  423. chia/server/start_farmer.py +28 -16
  424. chia/server/start_full_node.py +29 -23
  425. chia/server/start_harvester.py +28 -15
  426. chia/server/start_introducer.py +27 -15
  427. chia/server/start_service.py +17 -29
  428. chia/server/start_timelord.py +25 -18
  429. chia/server/start_wallet.py +22 -18
  430. chia/server/upnp.py +4 -3
  431. chia/server/ws_connection.py +68 -54
  432. chia/simulator/add_blocks_in_batches.py +54 -0
  433. chia/simulator/block_tools.py +65 -64
  434. chia/simulator/full_node_simulator.py +66 -74
  435. chia/simulator/setup_services.py +10 -9
  436. chia/simulator/simulator_full_node_rpc_api.py +12 -14
  437. chia/simulator/simulator_full_node_rpc_client.py +3 -5
  438. chia/simulator/simulator_test_tools.py +8 -7
  439. chia/simulator/socket.py +1 -4
  440. chia/simulator/ssl_certs.py +5 -5
  441. chia/simulator/ssl_certs_1.py +2 -4
  442. chia/simulator/ssl_certs_10.py +2 -4
  443. chia/simulator/ssl_certs_2.py +2 -4
  444. chia/simulator/ssl_certs_3.py +2 -4
  445. chia/simulator/ssl_certs_4.py +2 -4
  446. chia/simulator/ssl_certs_5.py +2 -4
  447. chia/simulator/ssl_certs_6.py +2 -4
  448. chia/simulator/ssl_certs_7.py +2 -4
  449. chia/simulator/ssl_certs_8.py +2 -4
  450. chia/simulator/ssl_certs_9.py +2 -4
  451. chia/simulator/start_simulator.py +14 -6
  452. chia/simulator/wallet_tools.py +21 -20
  453. chia/ssl/create_ssl.py +11 -11
  454. chia/timelord/iters_from_block.py +2 -2
  455. chia/timelord/timelord.py +57 -33
  456. chia/timelord/timelord_api.py +12 -6
  457. chia/timelord/timelord_launcher.py +10 -8
  458. chia/timelord/timelord_state.py +5 -5
  459. chia/types/block_protocol.py +2 -2
  460. chia/types/blockchain_format/coin.py +3 -3
  461. chia/types/blockchain_format/program.py +17 -18
  462. chia/types/blockchain_format/tree_hash.py +9 -9
  463. chia/types/coin_spend.py +8 -8
  464. chia/types/condition_with_args.py +1 -2
  465. chia/types/eligible_coin_spends.py +16 -15
  466. chia/types/generator_types.py +1 -2
  467. chia/types/internal_mempool_item.py +1 -2
  468. chia/types/mempool_item.py +7 -7
  469. chia/types/mempool_submission_status.py +2 -2
  470. chia/types/peer_info.py +1 -1
  471. chia/types/spend_bundle.py +1 -2
  472. chia/types/transaction_queue_entry.py +2 -2
  473. chia/types/unfinished_header_block.py +2 -2
  474. chia/types/validation_state.py +14 -0
  475. chia/types/weight_proof.py +5 -6
  476. chia/util/action_scope.py +8 -8
  477. chia/util/async_pool.py +6 -4
  478. chia/util/augmented_chain.py +13 -9
  479. chia/util/batches.py +5 -2
  480. chia/util/bech32m.py +14 -11
  481. chia/util/beta_metrics.py +5 -4
  482. chia/util/block_cache.py +5 -5
  483. chia/util/byte_types.py +2 -0
  484. chia/util/check_fork_next_block.py +3 -2
  485. chia/util/chia_logging.py +41 -21
  486. chia/util/collection.py +3 -3
  487. chia/util/condition_tools.py +18 -18
  488. chia/util/config.py +26 -25
  489. chia/util/cpu.py +2 -0
  490. chia/util/db_synchronous.py +2 -0
  491. chia/util/db_version.py +2 -0
  492. chia/util/db_wrapper.py +13 -10
  493. chia/util/default_root.py +17 -0
  494. chia/util/dump_keyring.py +6 -6
  495. chia/util/errors.py +5 -3
  496. chia/util/file_keyring.py +22 -33
  497. chia/util/files.py +2 -0
  498. chia/util/full_block_utils.py +31 -7
  499. chia/util/generator_tools.py +18 -8
  500. chia/util/hash.py +3 -1
  501. chia/util/initial-config.yaml +19 -0
  502. chia/util/inline_executor.py +2 -0
  503. chia/util/ip_address.py +39 -0
  504. chia/util/json_util.py +0 -4
  505. chia/util/keychain.py +27 -24
  506. chia/util/keyring_wrapper.py +65 -4
  507. chia/util/limited_semaphore.py +3 -1
  508. chia/util/lock.py +4 -2
  509. chia/util/log_exceptions.py +5 -2
  510. chia/util/logging.py +3 -1
  511. chia/util/lru_cache.py +2 -0
  512. chia/util/math.py +4 -4
  513. chia/util/network.py +15 -73
  514. chia/util/paginator.py +3 -1
  515. chia/util/path.py +2 -0
  516. chia/util/permissions.py +3 -2
  517. chia/util/prev_transaction_block.py +1 -3
  518. chia/util/priority_mutex.py +6 -3
  519. chia/util/profiler.py +7 -4
  520. chia/util/recursive_replace.py +2 -0
  521. chia/util/safe_cancel_task.py +2 -0
  522. chia/util/service_groups.py +2 -2
  523. chia/util/setproctitle.py +2 -0
  524. chia/util/significant_bits.py +2 -0
  525. chia/util/ssl_check.py +11 -11
  526. chia/util/streamable.py +44 -56
  527. chia/util/task_referencer.py +59 -0
  528. chia/util/task_timing.py +22 -18
  529. chia/util/timing.py +4 -1
  530. chia/util/vdf_prover.py +2 -3
  531. chia/util/virtual_project_analysis.py +540 -0
  532. chia/util/ws_message.py +6 -6
  533. chia/wallet/cat_wallet/cat_info.py +3 -3
  534. chia/wallet/cat_wallet/cat_outer_puzzle.py +3 -3
  535. chia/wallet/cat_wallet/cat_utils.py +5 -4
  536. chia/wallet/cat_wallet/cat_wallet.py +56 -70
  537. chia/wallet/cat_wallet/dao_cat_info.py +3 -3
  538. chia/wallet/cat_wallet/dao_cat_wallet.py +18 -18
  539. chia/wallet/cat_wallet/lineage_store.py +2 -2
  540. chia/wallet/coin_selection.py +15 -15
  541. chia/wallet/conditions.py +257 -71
  542. chia/wallet/dao_wallet/dao_info.py +4 -4
  543. chia/wallet/dao_wallet/dao_utils.py +43 -42
  544. chia/wallet/dao_wallet/dao_wallet.py +66 -68
  545. chia/wallet/db_wallet/db_wallet_puzzles.py +12 -8
  546. chia/wallet/derive_keys.py +11 -11
  547. chia/wallet/did_wallet/did_info.py +3 -3
  548. chia/wallet/did_wallet/did_wallet.py +56 -47
  549. chia/wallet/did_wallet/did_wallet_puzzles.py +7 -6
  550. chia/wallet/lineage_proof.py +4 -4
  551. chia/wallet/nft_wallet/metadata_outer_puzzle.py +2 -2
  552. chia/wallet/nft_wallet/nft_info.py +4 -4
  553. chia/wallet/nft_wallet/nft_puzzles.py +16 -16
  554. chia/wallet/nft_wallet/nft_wallet.py +90 -89
  555. chia/wallet/nft_wallet/ownership_outer_puzzle.py +2 -2
  556. chia/wallet/nft_wallet/singleton_outer_puzzle.py +2 -2
  557. chia/wallet/nft_wallet/transfer_program_puzzle.py +2 -2
  558. chia/wallet/nft_wallet/uncurry_nft.py +2 -2
  559. chia/wallet/notification_manager.py +5 -5
  560. chia/wallet/notification_store.py +6 -6
  561. chia/wallet/outer_puzzles.py +2 -2
  562. chia/wallet/payment.py +4 -5
  563. chia/wallet/puzzle_drivers.py +4 -4
  564. chia/wallet/puzzles/clawback/drivers.py +5 -5
  565. chia/wallet/puzzles/clawback/puzzle_decorator.py +7 -7
  566. chia/wallet/puzzles/load_clvm.py +2 -3
  567. chia/wallet/puzzles/p2_conditions.py +1 -2
  568. chia/wallet/puzzles/p2_delegated_conditions.py +1 -2
  569. chia/wallet/puzzles/p2_delegated_puzzle.py +2 -3
  570. chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +3 -4
  571. chia/wallet/puzzles/p2_m_of_n_delegate_direct.py +1 -2
  572. chia/wallet/puzzles/p2_puzzle_hash.py +1 -2
  573. chia/wallet/puzzles/puzzle_utils.py +7 -7
  574. chia/wallet/puzzles/singleton_top_layer.py +6 -5
  575. chia/wallet/puzzles/singleton_top_layer_v1_1.py +6 -5
  576. chia/wallet/puzzles/tails.py +34 -30
  577. chia/wallet/signer_protocol.py +7 -8
  578. chia/wallet/singleton.py +4 -4
  579. chia/wallet/trade_manager.py +155 -141
  580. chia/wallet/trade_record.py +5 -5
  581. chia/wallet/trading/offer.py +100 -101
  582. chia/wallet/trading/trade_store.py +14 -14
  583. chia/wallet/transaction_record.py +31 -16
  584. chia/wallet/util/address_type.py +4 -4
  585. chia/wallet/util/blind_signer_tl.py +8 -12
  586. chia/wallet/util/clvm_streamable.py +15 -15
  587. chia/wallet/util/compute_hints.py +5 -5
  588. chia/wallet/util/compute_memos.py +4 -6
  589. chia/wallet/util/curry_and_treehash.py +3 -2
  590. chia/wallet/util/debug_spend_bundle.py +6 -8
  591. chia/wallet/util/merkle_tree.py +10 -10
  592. chia/wallet/util/merkle_utils.py +10 -10
  593. chia/wallet/util/new_peak_queue.py +3 -3
  594. chia/wallet/util/peer_request_cache.py +8 -8
  595. chia/{util → wallet/util}/pprint.py +2 -3
  596. chia/wallet/util/puzzle_compression.py +3 -4
  597. chia/wallet/util/puzzle_decorator.py +10 -10
  598. chia/wallet/util/query_filter.py +9 -10
  599. chia/wallet/util/tx_config.py +12 -12
  600. chia/wallet/util/wallet_sync_utils.py +24 -21
  601. chia/wallet/util/wallet_types.py +9 -2
  602. chia/wallet/vc_wallet/cr_cat_drivers.py +28 -27
  603. chia/wallet/vc_wallet/cr_cat_wallet.py +42 -40
  604. chia/wallet/vc_wallet/cr_outer_puzzle.py +4 -4
  605. chia/wallet/vc_wallet/vc_drivers.py +16 -16
  606. chia/wallet/vc_wallet/vc_store.py +9 -9
  607. chia/wallet/vc_wallet/vc_wallet.py +35 -35
  608. chia/wallet/wallet.py +54 -54
  609. chia/wallet/wallet_action_scope.py +14 -13
  610. chia/wallet/wallet_blockchain.py +10 -10
  611. chia/wallet/wallet_coin_record.py +2 -2
  612. chia/wallet/wallet_coin_store.py +10 -10
  613. chia/wallet/wallet_info.py +1 -2
  614. chia/wallet/wallet_interested_store.py +5 -5
  615. chia/wallet/wallet_nft_store.py +6 -6
  616. chia/wallet/wallet_node.py +72 -76
  617. chia/wallet/wallet_node_api.py +33 -27
  618. chia/wallet/wallet_pool_store.py +1 -2
  619. chia/wallet/wallet_protocol.py +15 -15
  620. chia/wallet/wallet_puzzle_store.py +35 -4
  621. chia/wallet/wallet_retry_store.py +2 -2
  622. chia/wallet/wallet_singleton_store.py +10 -9
  623. chia/wallet/wallet_spend_bundle.py +4 -20
  624. chia/wallet/wallet_state_manager.py +223 -224
  625. chia/wallet/wallet_transaction_store.py +44 -18
  626. chia/wallet/wallet_user_store.py +2 -2
  627. chia/wallet/wallet_weight_proof_handler.py +2 -2
  628. {chia_blockchain-2.5.0rc2.dist-info → chia_blockchain-2.5.1rc2.dist-info}/LICENSE +1 -1
  629. {chia_blockchain-2.5.0rc2.dist-info → chia_blockchain-2.5.1rc2.dist-info}/METADATA +67 -72
  630. chia_blockchain-2.5.1rc2.dist-info/RECORD +1042 -0
  631. {chia_blockchain-2.5.0rc2.dist-info → chia_blockchain-2.5.1rc2.dist-info}/WHEEL +1 -1
  632. mozilla-ca/cacert.pem +32 -87
  633. chia/_tests/cmds/wallet/test_coins.py +0 -195
  634. chia/consensus/block_root_validation.py +0 -46
  635. chia/util/api_decorators.py +0 -89
  636. chia_blockchain-2.5.0rc2.dist-info/RECORD +0 -1028
  637. {chia_blockchain-2.5.0rc2.dist-info → chia_blockchain-2.5.1rc2.dist-info}/entry_points.txt +0 -0
@@ -3,10 +3,11 @@ from __future__ import annotations
3
3
  import contextlib
4
4
  import logging
5
5
  from collections import defaultdict
6
+ from collections.abc import AsyncIterator, Awaitable
6
7
  from contextlib import asynccontextmanager
7
8
  from dataclasses import dataclass, replace
8
9
  from pathlib import Path
9
- from typing import Any, AsyncIterator, Awaitable, BinaryIO, Callable, Dict, List, Optional, Set, Tuple, Union
10
+ from typing import Any, BinaryIO, Callable, Optional, Union
10
11
 
11
12
  import aiosqlite
12
13
 
@@ -495,15 +496,14 @@ class DataStore:
495
496
 
496
497
  async def check(self) -> None:
497
498
  for check in self._checks:
498
- # pylint seems to think these are bound methods not unbound methods.
499
- await check(self) # pylint: disable=too-many-function-args
499
+ await check(self)
500
500
 
501
501
  async def _check_roots_are_incrementing(self) -> None:
502
502
  async with self.db_wrapper.reader() as reader:
503
503
  cursor = await reader.execute("SELECT * FROM root ORDER BY tree_id, generation")
504
504
  roots = [Root.from_row(row=row) async for row in cursor]
505
505
 
506
- roots_by_tree: Dict[bytes32, List[Root]] = defaultdict(list)
506
+ roots_by_tree: dict[bytes32, list[Root]] = defaultdict(list)
507
507
  for root in roots:
508
508
  roots_by_tree[root.store_id].append(root)
509
509
 
@@ -522,7 +522,7 @@ class DataStore:
522
522
  async with self.db_wrapper.reader() as reader:
523
523
  cursor = await reader.execute("SELECT * FROM node")
524
524
 
525
- bad_node_hashes: List[bytes32] = []
525
+ bad_node_hashes: list[bytes32] = []
526
526
  async for row in cursor:
527
527
  node = row_to_node(row=row)
528
528
  if isinstance(node, InternalNode):
@@ -538,7 +538,7 @@ class DataStore:
538
538
  if len(bad_node_hashes) > 0:
539
539
  raise NodeHashError(node_hashes=bad_node_hashes)
540
540
 
541
- _checks: Tuple[Callable[[DataStore], Awaitable[None]], ...] = (
541
+ _checks: tuple[Callable[[DataStore], Awaitable[None]], ...] = (
542
542
  _check_roots_are_incrementing,
543
543
  _check_hashes,
544
544
  )
@@ -553,7 +553,7 @@ class DataStore:
553
553
 
554
554
  return tree_root.node_hash is None
555
555
 
556
- async def get_store_ids(self) -> Set[bytes32]:
556
+ async def get_store_ids(self) -> set[bytes32]:
557
557
  async with self.db_wrapper.reader() as reader:
558
558
  cursor = await reader.execute("SELECT DISTINCT tree_id FROM root")
559
559
 
@@ -597,7 +597,7 @@ class DataStore:
597
597
 
598
598
  return Root.from_row(row=row)
599
599
 
600
- async def get_all_pending_batches_roots(self) -> List[Root]:
600
+ async def get_all_pending_batches_roots(self) -> list[Root]:
601
601
  async with self.db_wrapper.reader() as reader:
602
602
  cursor = await reader.execute(
603
603
  """
@@ -623,7 +623,7 @@ class DataStore:
623
623
  return False
624
624
  return True
625
625
 
626
- async def get_roots_between(self, store_id: bytes32, generation_begin: int, generation_end: int) -> List[Root]:
626
+ async def get_roots_between(self, store_id: bytes32, generation_begin: int, generation_end: int) -> list[Root]:
627
627
  async with self.db_wrapper.reader() as reader:
628
628
  cursor = await reader.execute(
629
629
  "SELECT * FROM root WHERE tree_id == :tree_id "
@@ -658,7 +658,7 @@ class DataStore:
658
658
  node_hash: bytes32,
659
659
  store_id: bytes32,
660
660
  root_hash: Optional[bytes32] = None,
661
- ) -> List[InternalNode]:
661
+ ) -> list[InternalNode]:
662
662
  async with self.db_wrapper.reader() as reader:
663
663
  if root_hash is None:
664
664
  root = await self.get_tree_root(store_id=store_id)
@@ -702,7 +702,7 @@ class DataStore:
702
702
  store_id: bytes32,
703
703
  generation: Optional[int] = None,
704
704
  root_hash: Optional[bytes32] = None,
705
- ) -> List[InternalNode]:
705
+ ) -> list[InternalNode]:
706
706
  async with self.db_wrapper.reader():
707
707
  nodes = []
708
708
  if root_hash is None:
@@ -725,7 +725,7 @@ class DataStore:
725
725
 
726
726
  return nodes
727
727
 
728
- async def get_internal_nodes(self, store_id: bytes32, root_hash: Optional[bytes32] = None) -> List[InternalNode]:
728
+ async def get_internal_nodes(self, store_id: bytes32, root_hash: Optional[bytes32] = None) -> list[InternalNode]:
729
729
  async with self.db_wrapper.reader() as reader:
730
730
  if root_hash is None:
731
731
  root = await self.get_tree_root(store_id=store_id)
@@ -745,7 +745,7 @@ class DataStore:
745
745
  {"root_hash": root_hash, "node_type": NodeType.INTERNAL},
746
746
  )
747
747
 
748
- internal_nodes: List[InternalNode] = []
748
+ internal_nodes: list[InternalNode] = []
749
749
  async for row in cursor:
750
750
  node = row_to_node(row=row)
751
751
  if not isinstance(node, InternalNode):
@@ -791,7 +791,7 @@ class DataStore:
791
791
  self,
792
792
  store_id: bytes32,
793
793
  root_hash: Union[bytes32, Unspecified] = unspecified,
794
- ) -> List[TerminalNode]:
794
+ ) -> list[TerminalNode]:
795
795
  async with self.db_wrapper.reader() as reader:
796
796
  resolved_root_hash: Optional[bytes32]
797
797
  if root_hash is unspecified:
@@ -801,7 +801,7 @@ class DataStore:
801
801
  resolved_root_hash = root_hash
802
802
 
803
803
  cursor = await self.get_keys_values_cursor(reader, resolved_root_hash)
804
- terminal_nodes: List[TerminalNode] = []
804
+ terminal_nodes: list[TerminalNode] = []
805
805
  async for row in cursor:
806
806
  if row["depth"] > 62:
807
807
  # TODO: Review the value and implementation of left-to-right order
@@ -836,9 +836,9 @@ class DataStore:
836
836
  resolved_root_hash = root_hash
837
837
 
838
838
  cursor = await self.get_keys_values_cursor(reader, resolved_root_hash)
839
- keys_values_hashed: Dict[bytes32, bytes32] = {}
840
- key_hash_to_length: Dict[bytes32, int] = {}
841
- leaf_hash_to_length: Dict[bytes32, int] = {}
839
+ keys_values_hashed: dict[bytes32, bytes32] = {}
840
+ key_hash_to_length: dict[bytes32, int] = {}
841
+ leaf_hash_to_length: dict[bytes32, int] = {}
842
842
  async for row in cursor:
843
843
  if row["depth"] > 62:
844
844
  raise Exception("Tree depth exceeded 62, unable to guarantee left-to-right node order.")
@@ -853,8 +853,8 @@ class DataStore:
853
853
 
854
854
  async def get_leaf_hashes_by_hashed_key(
855
855
  self, store_id: bytes32, root_hash: Optional[bytes32] = None
856
- ) -> Dict[bytes32, bytes32]:
857
- result: Dict[bytes32, bytes32] = {}
856
+ ) -> dict[bytes32, bytes32]:
857
+ result: dict[bytes32, bytes32] = {}
858
858
  async with self.db_wrapper.reader() as reader:
859
859
  if root_hash is None:
860
860
  root = await self.get_tree_root(store_id=store_id)
@@ -876,7 +876,7 @@ class DataStore:
876
876
  keys_values_compressed = await self.get_keys_values_compressed(store_id, root_hash)
877
877
  pagination_data = get_hashes_for_page(page, keys_values_compressed.key_hash_to_length, max_page_size)
878
878
 
879
- keys: List[bytes] = []
879
+ keys: list[bytes] = []
880
880
  for hash in pagination_data.hashes:
881
881
  leaf_hash = keys_values_compressed.keys_values_hashed[hash]
882
882
  node = await self.get_node(leaf_hash)
@@ -900,7 +900,7 @@ class DataStore:
900
900
  keys_values_compressed = await self.get_keys_values_compressed(store_id, root_hash)
901
901
  pagination_data = get_hashes_for_page(page, keys_values_compressed.leaf_hash_to_length, max_page_size)
902
902
 
903
- keys_values: List[TerminalNode] = []
903
+ keys_values: list[TerminalNode] = []
904
904
  for hash in pagination_data.hashes:
905
905
  node = await self.get_node(hash)
906
906
  assert isinstance(node, TerminalNode)
@@ -923,11 +923,11 @@ class DataStore:
923
923
  hash2: bytes32,
924
924
  ) -> KVDiffPaginationData:
925
925
  old_pairs = await self.get_keys_values_compressed(store_id, hash1)
926
- if len(old_pairs.keys_values_hashed) == 0 and hash1 != bytes32([0] * 32):
926
+ if len(old_pairs.keys_values_hashed) == 0 and hash1 != bytes32.zeros:
927
927
  raise Exception(f"Unable to diff: Can't find keys and values for {hash1}")
928
928
 
929
929
  new_pairs = await self.get_keys_values_compressed(store_id, hash2)
930
- if len(new_pairs.keys_values_hashed) == 0 and hash2 != bytes32([0] * 32):
930
+ if len(new_pairs.keys_values_hashed) == 0 and hash2 != bytes32.zeros:
931
931
  raise Exception(f"Unable to diff: Can't find keys and values for {hash2}")
932
932
 
933
933
  old_pairs_leaf_hashes = {v for v in old_pairs.keys_values_hashed.values()}
@@ -941,7 +941,7 @@ class DataStore:
941
941
  lengths[hash] = old_pairs.leaf_hash_to_length[hash]
942
942
 
943
943
  pagination_data = get_hashes_for_page(page, lengths, max_page_size)
944
- kv_diff: List[DiffData] = []
944
+ kv_diff: list[DiffData] = []
945
945
 
946
946
  for hash in pagination_data.hashes:
947
947
  node = await self.get_node(hash)
@@ -1063,7 +1063,7 @@ class DataStore:
1063
1063
  self,
1064
1064
  store_id: bytes32,
1065
1065
  root_hash: Union[bytes32, Unspecified] = unspecified,
1066
- ) -> Dict[bytes, bytes]:
1066
+ ) -> dict[bytes, bytes]:
1067
1067
  pairs = await self.get_keys_values(store_id=store_id, root_hash=root_hash)
1068
1068
  return {node.key: node.value for node in pairs}
1069
1069
 
@@ -1071,7 +1071,7 @@ class DataStore:
1071
1071
  self,
1072
1072
  store_id: bytes32,
1073
1073
  root_hash: Union[bytes32, Unspecified] = unspecified,
1074
- ) -> List[bytes]:
1074
+ ) -> list[bytes]:
1075
1075
  async with self.db_wrapper.reader() as reader:
1076
1076
  if root_hash is unspecified:
1077
1077
  root = await self.get_tree_root(store_id=store_id)
@@ -1094,7 +1094,7 @@ class DataStore:
1094
1094
  {"root_hash": resolved_root_hash, "node_type": NodeType.TERMINAL},
1095
1095
  )
1096
1096
 
1097
- keys: List[bytes] = [row["key"] async for row in cursor]
1097
+ keys: list[bytes] = [row["key"] async for row in cursor]
1098
1098
 
1099
1099
  return keys
1100
1100
 
@@ -1105,9 +1105,9 @@ class DataStore:
1105
1105
  root_hash: Optional[bytes32],
1106
1106
  generation: Optional[int] = None,
1107
1107
  use_optimized: bool = True,
1108
- ) -> List[InternalNode]:
1108
+ ) -> list[InternalNode]:
1109
1109
  if use_optimized:
1110
- ancestors: List[InternalNode] = await self.get_ancestors_optimized(
1110
+ ancestors: list[InternalNode] = await self.get_ancestors_optimized(
1111
1111
  node_hash=node_hash,
1112
1112
  store_id=store_id,
1113
1113
  generation=generation,
@@ -1120,7 +1120,7 @@ class DataStore:
1120
1120
  generation=generation,
1121
1121
  root_hash=root_hash,
1122
1122
  )
1123
- ancestors_2: List[InternalNode] = await self.get_ancestors(
1123
+ ancestors_2: list[InternalNode] = await self.get_ancestors(
1124
1124
  node_hash=node_hash, store_id=store_id, root_hash=root_hash
1125
1125
  )
1126
1126
  if ancestors != ancestors_2:
@@ -1136,12 +1136,12 @@ class DataStore:
1136
1136
  left: bytes32,
1137
1137
  right: bytes32,
1138
1138
  traversal_node_hash: bytes32,
1139
- ancestors: List[InternalNode],
1139
+ ancestors: list[InternalNode],
1140
1140
  status: Status,
1141
1141
  root: Root,
1142
1142
  ) -> Root:
1143
1143
  # update ancestors after inserting root, to keep table constraints.
1144
- insert_ancestors_cache: List[Tuple[bytes32, bytes32, bytes32]] = []
1144
+ insert_ancestors_cache: list[tuple[bytes32, bytes32, bytes32]] = []
1145
1145
  new_generation = root.generation + 1
1146
1146
  # create first new internal node
1147
1147
  new_hash = await self._insert_internal_node(left_hash=left, right_hash=right)
@@ -1212,7 +1212,7 @@ class DataStore:
1212
1212
 
1213
1213
  if was_empty:
1214
1214
  if side is not None:
1215
- raise Exception("Tree was empty so side must be unspecified, got: {side!r}")
1215
+ raise Exception(f"Tree was empty so side must be unspecified, got: {side!r}")
1216
1216
 
1217
1217
  new_root = await self._insert_root(
1218
1218
  store_id=store_id,
@@ -1273,7 +1273,7 @@ class DataStore:
1273
1273
  log.debug(f"Request to delete an unknown key ignored: {key.hex()}")
1274
1274
  return root
1275
1275
 
1276
- ancestors: List[InternalNode] = await self.get_ancestors_common(
1276
+ ancestors: list[InternalNode] = await self.get_ancestors_common(
1277
1277
  node_hash=node_hash,
1278
1278
  store_id=store_id,
1279
1279
  root_hash=root_hash,
@@ -1306,7 +1306,7 @@ class DataStore:
1306
1306
  else:
1307
1307
  new_generation = root.generation + 1
1308
1308
  # update ancestors after inserting root, to keep table constraints.
1309
- insert_ancestors_cache: List[Tuple[bytes32, bytes32, bytes32]] = []
1309
+ insert_ancestors_cache: list[tuple[bytes32, bytes32, bytes32]] = []
1310
1310
  # more parents to handle so let's traverse them
1311
1311
  for ancestor in ancestors[1:]:
1312
1312
  if ancestor.left_hash == old_child_hash:
@@ -1433,7 +1433,7 @@ class DataStore:
1433
1433
  else:
1434
1434
  await writer.execute(query, params)
1435
1435
 
1436
- async def get_nodes(self, node_hashes: List[bytes32]) -> List[Node]:
1436
+ async def get_nodes(self, node_hashes: list[bytes32]) -> list[Node]:
1437
1437
  query_parameter_place_holders = ",".join("?" for _ in node_hashes)
1438
1438
  async with self.db_wrapper.reader() as reader:
1439
1439
  # TODO: handle SQLITE_MAX_VARIABLE_NUMBER
@@ -1452,9 +1452,9 @@ class DataStore:
1452
1452
  return [hash_to_node[node_hash] for node_hash in node_hashes]
1453
1453
 
1454
1454
  async def get_leaf_at_minimum_height(
1455
- self, root_hash: bytes32, hash_to_parent: Dict[bytes32, InternalNode]
1455
+ self, root_hash: bytes32, hash_to_parent: dict[bytes32, InternalNode]
1456
1456
  ) -> TerminalNode:
1457
- queue: List[bytes32] = [root_hash]
1457
+ queue: list[bytes32] = [root_hash]
1458
1458
  batch_size = min(500, SQLITE_MAX_VARIABLE_NUMBER - 10)
1459
1459
 
1460
1460
  while True:
@@ -1473,8 +1473,8 @@ class DataStore:
1473
1473
  async def batch_upsert(
1474
1474
  self,
1475
1475
  hash: bytes32,
1476
- to_update_hashes: Set[bytes32],
1477
- pending_upsert_new_hashes: Dict[bytes32, bytes32],
1476
+ to_update_hashes: set[bytes32],
1477
+ pending_upsert_new_hashes: dict[bytes32, bytes32],
1478
1478
  ) -> bytes32:
1479
1479
  if hash not in to_update_hashes:
1480
1480
  return hash
@@ -1488,7 +1488,7 @@ class DataStore:
1488
1488
  async def insert_batch(
1489
1489
  self,
1490
1490
  store_id: bytes32,
1491
- changelist: List[Dict[str, Any]],
1491
+ changelist: list[dict[str, Any]],
1492
1492
  status: Status = Status.PENDING,
1493
1493
  enable_batch_autoinsert: bool = True,
1494
1494
  ) -> Optional[bytes32]:
@@ -1510,9 +1510,9 @@ class DataStore:
1510
1510
 
1511
1511
  assert latest_local_root is not None
1512
1512
 
1513
- key_hash_frequency: Dict[bytes32, int] = {}
1514
- first_action: Dict[bytes32, str] = {}
1515
- last_action: Dict[bytes32, str] = {}
1513
+ key_hash_frequency: dict[bytes32, int] = {}
1514
+ first_action: dict[bytes32, str] = {}
1515
+ last_action: dict[bytes32, str] = {}
1516
1516
 
1517
1517
  for change in changelist:
1518
1518
  key = change["key"]
@@ -1522,8 +1522,8 @@ class DataStore:
1522
1522
  first_action[hash] = change["action"]
1523
1523
  last_action[hash] = change["action"]
1524
1524
 
1525
- pending_autoinsert_hashes: List[bytes32] = []
1526
- pending_upsert_new_hashes: Dict[bytes32, bytes32] = {}
1525
+ pending_autoinsert_hashes: list[bytes32] = []
1526
+ pending_upsert_new_hashes: dict[bytes32, bytes32] = {}
1527
1527
  leaf_hashes = await self.get_leaf_hashes_by_hashed_key(store_id)
1528
1528
 
1529
1529
  for change in changelist:
@@ -1598,8 +1598,8 @@ class DataStore:
1598
1598
  raise Exception(f"Operation in batch is not insert or delete: {change}")
1599
1599
 
1600
1600
  if len(pending_upsert_new_hashes) > 0:
1601
- to_update_hashes: Set[bytes32] = set(pending_upsert_new_hashes.keys())
1602
- to_update_queue: List[bytes32] = list(pending_upsert_new_hashes.keys())
1601
+ to_update_hashes: set[bytes32] = set(pending_upsert_new_hashes.keys())
1602
+ to_update_queue: list[bytes32] = list(pending_upsert_new_hashes.keys())
1603
1603
  batch_size = min(500, SQLITE_MAX_VARIABLE_NUMBER - 10)
1604
1604
 
1605
1605
  while len(to_update_queue) > 0:
@@ -1622,7 +1622,7 @@ class DataStore:
1622
1622
  # Start with the leaf nodes and pair them to form new nodes at the next level up, repeating this process
1623
1623
  # in a bottom-up fashion until a single root node remains. This constructs a balanced tree from the leaves.
1624
1624
  while len(pending_autoinsert_hashes) > 1:
1625
- new_hashes: List[bytes32] = []
1625
+ new_hashes: list[bytes32] = []
1626
1626
  for i in range(0, len(pending_autoinsert_hashes) - 1, 2):
1627
1627
  internal_node_hash = await self._insert_internal_node(
1628
1628
  pending_autoinsert_hashes[i], pending_autoinsert_hashes[i + 1]
@@ -1638,9 +1638,9 @@ class DataStore:
1638
1638
  if latest_local_root is None or latest_local_root.node_hash is None:
1639
1639
  await self._insert_root(store_id=store_id, node_hash=subtree_hash, status=Status.COMMITTED)
1640
1640
  else:
1641
- hash_to_parent: Dict[bytes32, InternalNode] = {}
1641
+ hash_to_parent: dict[bytes32, InternalNode] = {}
1642
1642
  min_height_leaf = await self.get_leaf_at_minimum_height(latest_local_root.node_hash, hash_to_parent)
1643
- ancestors: List[InternalNode] = []
1643
+ ancestors: list[InternalNode] = []
1644
1644
  hash = min_height_leaf.hash
1645
1645
  while hash in hash_to_parent:
1646
1646
  node = hash_to_parent[hash]
@@ -1665,7 +1665,7 @@ class DataStore:
1665
1665
  # We delete all "temporary" records stored in root and ancestor tables and store only the final result.
1666
1666
  await self.rollback_to_generation(store_id, old_root.generation)
1667
1667
  await self.insert_root_with_ancestor_table(store_id=store_id, node_hash=root.node_hash, status=status)
1668
- if status in (Status.PENDING, Status.PENDING_BATCH):
1668
+ if status in {Status.PENDING, Status.PENDING_BATCH}:
1669
1669
  new_root = await self.get_pending_root(store_id=store_id)
1670
1670
  assert new_root is not None
1671
1671
  elif status == Status.COMMITTED:
@@ -1712,10 +1712,10 @@ class DataStore:
1712
1712
 
1713
1713
  async def _get_one_ancestor_multiple_hashes(
1714
1714
  self,
1715
- node_hashes: List[bytes32],
1715
+ node_hashes: list[bytes32],
1716
1716
  store_id: bytes32,
1717
1717
  generation: Optional[int] = None,
1718
- ) -> List[InternalNode]:
1718
+ ) -> list[InternalNode]:
1719
1719
  async with self.db_wrapper.reader() as reader:
1720
1720
  node_hashes_place_holders = ",".join("?" for _ in node_hashes)
1721
1721
  if generation is None:
@@ -1747,14 +1747,14 @@ class DataStore:
1747
1747
  )
1748
1748
 
1749
1749
  if previous_root.node_hash is not None:
1750
- previous_internal_nodes: List[InternalNode] = await self.get_internal_nodes(
1750
+ previous_internal_nodes: list[InternalNode] = await self.get_internal_nodes(
1751
1751
  store_id=store_id,
1752
1752
  root_hash=previous_root.node_hash,
1753
1753
  )
1754
- known_hashes: Set[bytes32] = {node.hash for node in previous_internal_nodes}
1754
+ known_hashes: set[bytes32] = {node.hash for node in previous_internal_nodes}
1755
1755
  else:
1756
1756
  known_hashes = set()
1757
- internal_nodes: List[InternalNode] = await self.get_internal_nodes(
1757
+ internal_nodes: list[InternalNode] = await self.get_internal_nodes(
1758
1758
  store_id=store_id,
1759
1759
  root_hash=root.node_hash,
1760
1760
  )
@@ -1809,7 +1809,7 @@ class DataStore:
1809
1809
  return node
1810
1810
 
1811
1811
  async def maybe_get_node_from_key_hash(
1812
- self, leaf_hashes: Dict[bytes32, bytes32], hash: bytes32
1812
+ self, leaf_hashes: dict[bytes32, bytes32], hash: bytes32
1813
1813
  ) -> Optional[TerminalNode]:
1814
1814
  if hash in leaf_hashes:
1815
1815
  leaf_hash = leaf_hashes[hash]
@@ -1875,7 +1875,7 @@ class DataStore:
1875
1875
  {"root_hash": root_node.hash},
1876
1876
  )
1877
1877
  nodes = [row_to_node(row=row) async for row in cursor]
1878
- hash_to_node: Dict[bytes32, Node] = {}
1878
+ hash_to_node: dict[bytes32, Node] = {}
1879
1879
  for node in reversed(nodes):
1880
1880
  if isinstance(node, InternalNode):
1881
1881
  node = replace(node, left=hash_to_node[node.left_hash], right=hash_to_node[node.right_hash])
@@ -1904,7 +1904,7 @@ class DataStore:
1904
1904
  else:
1905
1905
  ancestors = await self.get_ancestors(node_hash=node_hash, store_id=store_id, root_hash=root_hash)
1906
1906
 
1907
- layers: List[ProofOfInclusionLayer] = []
1907
+ layers: list[ProofOfInclusionLayer] = []
1908
1908
  child_hash = node_hash
1909
1909
  for parent in ancestors:
1910
1910
  layer = ProofOfInclusionLayer.from_internal_node(internal_node=parent, traversal_child_hash=child_hash)
@@ -1959,7 +1959,7 @@ class DataStore:
1959
1959
  deltas_only: bool,
1960
1960
  writer: BinaryIO,
1961
1961
  ) -> None:
1962
- if node_hash == bytes32([0] * 32):
1962
+ if node_hash == bytes32.zeros:
1963
1963
  return
1964
1964
 
1965
1965
  if deltas_only:
@@ -1981,7 +1981,7 @@ class DataStore:
1981
1981
  writer.write(len(to_write).to_bytes(4, byteorder="big"))
1982
1982
  writer.write(to_write)
1983
1983
 
1984
- async def update_subscriptions_from_wallet(self, store_id: bytes32, new_urls: List[str]) -> None:
1984
+ async def update_subscriptions_from_wallet(self, store_id: bytes32, new_urls: list[str]) -> None:
1985
1985
  async with self.db_wrapper.writer() as writer:
1986
1986
  cursor = await writer.execute(
1987
1987
  "SELECT * FROM subscriptions WHERE from_wallet == 1 AND tree_id == :tree_id",
@@ -2053,7 +2053,7 @@ class DataStore:
2053
2053
  },
2054
2054
  )
2055
2055
 
2056
- async def remove_subscriptions(self, store_id: bytes32, urls: List[str]) -> None:
2056
+ async def remove_subscriptions(self, store_id: bytes32, urls: list[str]) -> None:
2057
2057
  async with self.db_wrapper.writer() as writer:
2058
2058
  for url in urls:
2059
2059
  await writer.execute(
@@ -2099,8 +2099,8 @@ class DataStore:
2099
2099
  "pending_batch_status": Status.PENDING_BATCH.value,
2100
2100
  },
2101
2101
  )
2102
- to_delete: Dict[bytes, Tuple[bytes, bytes]] = {}
2103
- ref_counts: Dict[bytes, int] = {}
2102
+ to_delete: dict[bytes, tuple[bytes, bytes]] = {}
2103
+ ref_counts: dict[bytes, int] = {}
2104
2104
  async for row in cursor:
2105
2105
  hash = row["hash"]
2106
2106
  left = row["left"]
@@ -2195,7 +2195,7 @@ class DataStore:
2195
2195
  await self.update_server_info(store_id, new_server_info)
2196
2196
  return new_server_info
2197
2197
 
2198
- async def get_available_servers_for_store(self, store_id: bytes32, timestamp: int) -> List[ServerInfo]:
2198
+ async def get_available_servers_for_store(self, store_id: bytes32, timestamp: int) -> list[ServerInfo]:
2199
2199
  subscriptions = await self.get_subscriptions()
2200
2200
  subscription = next((subscription for subscription in subscriptions if subscription.store_id == store_id), None)
2201
2201
  if subscription is None:
@@ -2206,8 +2206,8 @@ class DataStore:
2206
2206
  servers_info.append(server_info)
2207
2207
  return servers_info
2208
2208
 
2209
- async def get_subscriptions(self) -> List[Subscription]:
2210
- subscriptions: List[Subscription] = []
2209
+ async def get_subscriptions(self) -> list[Subscription]:
2210
+ subscriptions: list[Subscription] = []
2211
2211
 
2212
2212
  async with self.db_wrapper.reader() as reader:
2213
2213
  cursor = await reader.execute(
@@ -2244,14 +2244,14 @@ class DataStore:
2244
2244
  # NOTE: empty is expressed as zeros
2245
2245
  hash_1: bytes32,
2246
2246
  hash_2: bytes32,
2247
- ) -> Set[DiffData]:
2247
+ ) -> set[DiffData]:
2248
2248
  async with self.db_wrapper.reader():
2249
2249
  old_pairs = set(await self.get_keys_values(store_id, hash_1))
2250
- if len(old_pairs) == 0 and hash_1 != bytes32([0] * 32):
2250
+ if len(old_pairs) == 0 and hash_1 != bytes32.zeros:
2251
2251
  raise Exception(f"Unable to diff: Can't find keys and values for {hash_1}")
2252
2252
 
2253
2253
  new_pairs = set(await self.get_keys_values(store_id, hash_2))
2254
- if len(new_pairs) == 0 and hash_2 != bytes32([0] * 32):
2254
+ if len(new_pairs) == 0 and hash_2 != bytes32.zeros:
2255
2255
  raise Exception(f"Unable to diff: Can't find keys and values for {hash_2}")
2256
2256
 
2257
2257
  insertions = {
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import dataclasses
4
- from typing import List, Optional, Type, TypeVar, Union
4
+ from typing import Optional, TypeVar, Union
5
5
 
6
6
  from aiosqlite import Row
7
7
 
@@ -30,7 +30,7 @@ def _row_to_singleton_record(row: Row) -> SingletonRecord:
30
30
 
31
31
 
32
32
  def _row_to_mirror(row: Row, confirmed_at_height: Optional[uint32]) -> Mirror:
33
- urls: List[bytes] = []
33
+ urls: list[bytes] = []
34
34
  byte_list: bytes = row[3]
35
35
  while byte_list != b"":
36
36
  length = uint16.from_bytes(byte_list[0:2])
@@ -48,7 +48,7 @@ class DataLayerStore:
48
48
  db_wrapper: DBWrapper2
49
49
 
50
50
  @classmethod
51
- async def create(cls: Type[_T_DataLayerStore], db_wrapper: DBWrapper2) -> _T_DataLayerStore:
51
+ async def create(cls: type[_T_DataLayerStore], db_wrapper: DBWrapper2) -> _T_DataLayerStore:
52
52
  self = cls()
53
53
 
54
54
  self.db_wrapper = db_wrapper
@@ -131,11 +131,11 @@ class DataLayerStore:
131
131
  min_generation: Optional[uint32] = None,
132
132
  max_generation: Optional[uint32] = None,
133
133
  num_results: Optional[uint32] = None,
134
- ) -> List[SingletonRecord]:
134
+ ) -> list[SingletonRecord]:
135
135
  """
136
136
  Returns stored singletons with a specific launcher ID.
137
137
  """
138
- query_params: List[Union[bytes32, uint32]] = [launcher_id]
138
+ query_params: list[Union[bytes32, uint32]] = [launcher_id]
139
139
  for optional_param in (min_generation, max_generation, num_results):
140
140
  if optional_param is not None:
141
141
  query_params.append(optional_param)
@@ -200,7 +200,7 @@ class DataLayerStore:
200
200
  return _row_to_singleton_record(row)
201
201
  return None
202
202
 
203
- async def get_unconfirmed_singletons(self, launcher_id: bytes32) -> List[SingletonRecord]:
203
+ async def get_unconfirmed_singletons(self, launcher_id: bytes32) -> list[SingletonRecord]:
204
204
  """
205
205
  Returns all singletons with a specific launcher id that have not yet been marked confirmed
206
206
  """
@@ -214,7 +214,7 @@ class DataLayerStore:
214
214
 
215
215
  return records
216
216
 
217
- async def get_singletons_by_root(self, launcher_id: bytes32, root: bytes32) -> List[SingletonRecord]:
217
+ async def get_singletons_by_root(self, launcher_id: bytes32, root: bytes32) -> list[SingletonRecord]:
218
218
  async with self.db_wrapper.reader_no_transaction() as conn:
219
219
  cursor = await conn.execute(
220
220
  "SELECT * from singleton_records WHERE launcher_id=? AND root=? ORDER BY generation DESC",
@@ -276,7 +276,7 @@ class DataLayerStore:
276
276
  return Coin(bytes32(row[1][0:32]), bytes32(row[1][32:64]), uint64(int.from_bytes(row[1][64:72], "big")))
277
277
  return None
278
278
 
279
- async def get_all_launchers(self) -> List[bytes32]:
279
+ async def get_all_launchers(self) -> list[bytes32]:
280
280
  """
281
281
  Checks DB for all launchers.
282
282
  """
@@ -329,7 +329,7 @@ class DataLayerStore:
329
329
  ),
330
330
  )
331
331
 
332
- async def get_mirrors(self, launcher_id: bytes32) -> List[Mirror]:
332
+ async def get_mirrors(self, launcher_id: bytes32) -> list[Mirror]:
333
333
  async with self.db_wrapper.reader_no_transaction() as conn:
334
334
  cursor = await conn.execute(
335
335
  "SELECT * from mirrors WHERE launcher_id=?",
@@ -337,7 +337,7 @@ class DataLayerStore:
337
337
  )
338
338
  rows = await cursor.fetchall()
339
339
  await cursor.close()
340
- mirrors: List[Mirror] = []
340
+ mirrors: list[Mirror] = []
341
341
 
342
342
  for row in rows:
343
343
  confirmation_height = await execute_fetchone(
@@ -5,7 +5,7 @@ import logging
5
5
  import time
6
6
  from dataclasses import dataclass
7
7
  from pathlib import Path
8
- from typing import List, Optional
8
+ from typing import Optional
9
9
 
10
10
  import aiohttp
11
11
  from typing_extensions import Literal
@@ -145,7 +145,7 @@ async def write_files_for_root(
145
145
  if root.node_hash is not None:
146
146
  node_hash = root.node_hash
147
147
  else:
148
- node_hash = bytes32([0] * 32) # todo change
148
+ node_hash = bytes32.zeros # todo change
149
149
 
150
150
  filename_full_tree = get_full_tree_filename_path(foldername, store_id, node_hash, root.generation, group_by_store)
151
151
  filename_diff_tree = get_delta_filename_path(foldername, store_id, node_hash, root.generation, group_by_store)
@@ -237,7 +237,7 @@ async def insert_from_delta_file(
237
237
  store_id: bytes32,
238
238
  existing_generation: int,
239
239
  target_generation: int,
240
- root_hashes: List[bytes32],
240
+ root_hashes: list[bytes32],
241
241
  server_info: ServerInfo,
242
242
  client_foldername: Path,
243
243
  timeout: aiohttp.ClientTimeout,
@@ -291,7 +291,7 @@ async def insert_from_delta_file(
291
291
  num_inserted = await insert_into_data_store_from_file(
292
292
  data_store,
293
293
  store_id,
294
- None if root_hash == bytes32([0] * 32) else root_hash,
294
+ None if root_hash == bytes32.zeros else root_hash,
295
295
  target_filename_path,
296
296
  )
297
297
  log.info(
@@ -336,7 +336,7 @@ def delete_full_file_if_exists(foldername: Path, store_id: bytes32, root: Root)
336
336
  if root.node_hash is not None:
337
337
  node_hash = root.node_hash
338
338
  else:
339
- node_hash = bytes32([0] * 32) # todo change
339
+ node_hash = bytes32.zeros # todo change
340
340
 
341
341
  not_found = 0
342
342
  for group_by_store in (True, False):