chia-blockchain 2.5.2rc1__py3-none-any.whl → 2.5.3rc1__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 (640) hide show
  1. chia/__init__.py +7 -0
  2. chia/_tests/blockchain/blockchain_test_utils.py +1 -1
  3. chia/_tests/blockchain/test_augmented_chain.py +54 -5
  4. chia/_tests/blockchain/test_blockchain.py +5 -12
  5. chia/_tests/blockchain/test_blockchain_transactions.py +3 -5
  6. chia/_tests/blockchain/test_get_block_generator.py +2 -2
  7. chia/_tests/blockchain/test_lookup_fork_chain.py +2 -2
  8. chia/_tests/clvm/benchmark_costs.py +2 -1
  9. chia/_tests/clvm/coin_store.py +4 -3
  10. chia/_tests/clvm/test_chialisp_deserialization.py +2 -2
  11. chia/_tests/clvm/test_curry_and_treehash.py +1 -1
  12. chia/_tests/clvm/test_puzzle_compression.py +2 -2
  13. chia/_tests/clvm/test_puzzles.py +2 -2
  14. chia/_tests/clvm/test_singletons.py +2 -2
  15. chia/_tests/clvm/test_spend_sim.py +1 -1
  16. chia/_tests/cmds/cmd_test_utils.py +2 -2
  17. chia/_tests/cmds/test_click_types.py +2 -2
  18. chia/_tests/cmds/test_cmd_framework.py +6 -6
  19. chia/_tests/cmds/test_show.py +4 -3
  20. chia/_tests/cmds/test_tx_config_args.py +1 -1
  21. chia/_tests/cmds/testing_classes.py +2 -2
  22. chia/_tests/cmds/wallet/test_consts.py +2 -2
  23. chia/_tests/cmds/wallet/test_did.py +2 -2
  24. chia/_tests/cmds/wallet/test_nft.py +2 -2
  25. chia/_tests/cmds/wallet/test_notifications.py +3 -2
  26. chia/_tests/cmds/wallet/test_vcs.py +2 -2
  27. chia/_tests/cmds/wallet/test_wallet.py +4 -8
  28. chia/_tests/conftest.py +4 -3
  29. chia/_tests/connection_utils.py +2 -2
  30. chia/_tests/core/cmds/test_keys.py +1 -2
  31. chia/_tests/core/cmds/test_wallet.py +2 -2
  32. chia/_tests/core/consensus/test_block_creation.py +2 -2
  33. chia/_tests/core/consensus/test_pot_iterations.py +1 -1
  34. chia/_tests/core/custom_types/test_coin.py +2 -2
  35. chia/_tests/core/custom_types/test_proof_of_space.py +2 -2
  36. chia/_tests/core/custom_types/test_spend_bundle.py +2 -2
  37. chia/_tests/core/data_layer/conftest.py +1 -1
  38. chia/_tests/core/data_layer/test_data_layer.py +1 -1
  39. chia/_tests/core/data_layer/test_data_layer_util.py +1 -1
  40. chia/_tests/core/data_layer/test_data_rpc.py +2 -2
  41. chia/_tests/core/data_layer/test_data_store.py +1 -1
  42. chia/_tests/core/data_layer/test_data_store_schema.py +1 -1
  43. chia/_tests/core/data_layer/util.py +2 -1
  44. chia/_tests/core/farmer/test_farmer_api.py +1 -1
  45. chia/_tests/core/full_node/full_sync/test_full_sync.py +1 -7
  46. chia/_tests/core/full_node/ram_db.py +2 -1
  47. chia/_tests/core/full_node/stores/test_block_store.py +2 -2
  48. chia/_tests/core/full_node/stores/test_coin_store.py +2 -2
  49. chia/_tests/core/full_node/stores/test_full_node_store.py +3 -3
  50. chia/_tests/core/full_node/stores/test_hint_store.py +2 -2
  51. chia/_tests/core/full_node/stores/test_sync_store.py +1 -1
  52. chia/_tests/core/full_node/test_address_manager.py +1 -1
  53. chia/_tests/core/full_node/test_block_height_map.py +2 -2
  54. chia/_tests/core/full_node/test_conditions.py +1 -1
  55. chia/_tests/core/full_node/test_full_node.py +346 -164
  56. chia/_tests/core/full_node/test_generator_tools.py +3 -2
  57. chia/_tests/core/full_node/test_hint_management.py +2 -2
  58. chia/_tests/core/full_node/test_performance.py +2 -15
  59. chia/_tests/core/full_node/test_subscriptions.py +1 -1
  60. chia/_tests/core/full_node/test_transactions.py +186 -185
  61. chia/_tests/core/full_node/test_tx_processing_queue.py +1 -1
  62. chia/_tests/core/make_block_generator.py +2 -2
  63. chia/_tests/core/mempool/test_mempool.py +165 -22
  64. chia/_tests/core/mempool/test_mempool_fee_estimator.py +1 -1
  65. chia/_tests/core/mempool/test_mempool_fee_protocol.py +1 -1
  66. chia/_tests/core/mempool/test_mempool_manager.py +476 -66
  67. chia/_tests/core/mempool/test_mempool_performance.py +2 -2
  68. chia/_tests/core/mempool/test_singleton_fast_forward.py +19 -25
  69. chia/_tests/core/node_height.py +2 -1
  70. chia/_tests/core/server/test_capabilities.py +1 -1
  71. chia/_tests/core/server/test_dos.py +36 -28
  72. chia/_tests/core/server/test_loop.py +3 -3
  73. chia/_tests/core/server/test_rate_limits.py +1 -1
  74. chia/_tests/core/server/test_server.py +2 -2
  75. chia/_tests/core/services/test_services.py +1 -1
  76. chia/_tests/core/ssl/test_ssl.py +1 -1
  77. chia/_tests/core/test_coins.py +2 -1
  78. chia/_tests/core/test_cost_calculation.py +2 -2
  79. chia/_tests/core/test_crawler.py +2 -2
  80. chia/_tests/core/test_db_conversion.py +2 -2
  81. chia/_tests/core/test_db_validation.py +26 -13
  82. chia/_tests/core/test_farmer_harvester_rpc.py +2 -2
  83. chia/_tests/core/test_full_node_rpc.py +2 -2
  84. chia/_tests/core/test_merkle_set.py +2 -2
  85. chia/_tests/core/test_program.py +2 -2
  86. chia/_tests/core/test_rpc_util.py +1 -1
  87. chia/_tests/core/test_seeder.py +1 -1
  88. chia/_tests/core/util/test_block_cache.py +3 -3
  89. chia/_tests/core/util/test_jsonify.py +3 -2
  90. chia/_tests/core/util/test_keychain.py +3 -3
  91. chia/_tests/core/util/test_streamable.py +3 -4
  92. chia/_tests/environments/wallet.py +3 -2
  93. chia/_tests/farmer_harvester/test_farmer.py +3 -4
  94. chia/_tests/farmer_harvester/test_farmer_harvester.py +2 -2
  95. chia/_tests/farmer_harvester/test_filter_prefix_bits.py +2 -2
  96. chia/_tests/farmer_harvester/test_third_party_harvesters.py +3 -4
  97. chia/_tests/fee_estimation/test_fee_estimation_integration.py +1 -1
  98. chia/_tests/fee_estimation/test_fee_estimation_rpc.py +2 -2
  99. chia/_tests/fee_estimation/test_fee_estimation_unit_tests.py +1 -1
  100. chia/_tests/fee_estimation/test_mempoolitem_height_added.py +3 -4
  101. chia/_tests/generator/test_compression.py +20 -10
  102. chia/_tests/generator/test_rom.py +7 -9
  103. chia/_tests/plot_sync/test_delta.py +2 -2
  104. chia/_tests/plot_sync/test_plot_sync.py +2 -2
  105. chia/_tests/plot_sync/test_receiver.py +2 -2
  106. chia/_tests/plot_sync/test_sender.py +2 -2
  107. chia/_tests/plot_sync/test_sync_simulated.py +2 -2
  108. chia/_tests/plot_sync/util.py +3 -2
  109. chia/_tests/plotting/test_plot_manager.py +1 -1
  110. chia/_tests/pools/test_pool_cli_parsing.py +3 -2
  111. chia/_tests/pools/test_pool_cmdline.py +2 -2
  112. chia/_tests/pools/test_pool_puzzles_lifecycle.py +3 -3
  113. chia/_tests/pools/test_pool_rpc.py +4 -5
  114. chia/_tests/pools/test_pool_wallet.py +1 -1
  115. chia/_tests/pools/test_wallet_pool_store.py +2 -2
  116. chia/_tests/rpc/test_rpc_client.py +1 -1
  117. chia/_tests/rpc/test_rpc_server.py +1 -1
  118. chia/_tests/simulation/test_simulation.py +36 -8
  119. chia/_tests/simulation/test_simulator.py +5 -5
  120. chia/_tests/simulation/test_start_simulator.py +2 -2
  121. chia/_tests/timelord/test_new_peak.py +2 -2
  122. chia/_tests/tools/test_run_block.py +3 -2
  123. chia/_tests/util/benchmark_cost.py +2 -2
  124. chia/_tests/util/benchmarks.py +17 -6
  125. chia/_tests/util/blockchain.py +2 -1
  126. chia/_tests/util/blockchain_mock.py +9 -5
  127. chia/_tests/util/build_network_protocol_files.py +2 -1
  128. chia/_tests/util/constants.py +2 -1
  129. chia/_tests/util/full_sync.py +6 -3
  130. chia/_tests/util/gen_ssl_certs.py +2 -2
  131. chia/_tests/util/generator_tools_testing.py +4 -3
  132. chia/_tests/util/get_name_puzzle_conditions.py +2 -2
  133. chia/_tests/util/misc.py +16 -2
  134. chia/_tests/util/network_protocol_data.py +17 -7
  135. chia/_tests/util/run_block.py +6 -8
  136. chia/_tests/util/setup_nodes.py +4 -3
  137. chia/_tests/util/spend_sim.py +9 -5
  138. chia/_tests/util/test_condition_tools.py +2 -2
  139. chia/_tests/util/test_config.py +2 -1
  140. chia/_tests/util/test_errors.py +2 -1
  141. chia/_tests/util/test_full_block_utils.py +17 -7
  142. chia/_tests/util/test_misc.py +1 -1
  143. chia/_tests/util/test_network_protocol_test.py +24 -24
  144. chia/_tests/util/test_replace_str_to_bytes.py +2 -2
  145. chia/_tests/util/test_trusted_peer.py +1 -1
  146. chia/_tests/util/time_out_assert.py +20 -7
  147. chia/_tests/wallet/cat_wallet/test_cat_lifecycle.py +1 -1
  148. chia/_tests/wallet/cat_wallet/test_cat_outer_puzzle.py +2 -2
  149. chia/_tests/wallet/cat_wallet/test_cat_wallet.py +5 -6
  150. chia/_tests/wallet/cat_wallet/test_offer_lifecycle.py +17 -15
  151. chia/_tests/wallet/cat_wallet/test_trades.py +2 -2
  152. chia/_tests/wallet/clawback/test_clawback_lifecycle.py +2 -2
  153. chia/_tests/wallet/clawback/test_clawback_metadata.py +2 -2
  154. chia/_tests/wallet/conftest.py +3 -3
  155. chia/_tests/wallet/db_wallet/test_db_graftroot.py +3 -5
  156. chia/_tests/wallet/db_wallet/test_dl_offers.py +2 -2
  157. chia/_tests/wallet/db_wallet/test_dl_wallet.py +433 -384
  158. chia/_tests/wallet/did_wallet/test_did.py +3 -3
  159. chia/_tests/wallet/nft_wallet/test_nft_1_offers.py +2 -2
  160. chia/_tests/wallet/nft_wallet/test_nft_bulk_mint.py +2 -2
  161. chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py +3 -4
  162. chia/_tests/wallet/nft_wallet/test_nft_offers.py +1293 -703
  163. chia/_tests/wallet/nft_wallet/test_nft_puzzles.py +28 -30
  164. chia/_tests/wallet/nft_wallet/test_nft_wallet.py +2 -2
  165. chia/_tests/wallet/nft_wallet/test_ownership_outer_puzzle.py +2 -2
  166. chia/_tests/wallet/rpc/config.py +1 -1
  167. chia/_tests/wallet/rpc/test_dl_wallet_rpc.py +2 -2
  168. chia/_tests/wallet/rpc/test_wallet_rpc.py +20 -77
  169. chia/_tests/wallet/simple_sync/test_simple_sync_protocol.py +9 -7
  170. chia/_tests/wallet/sync/test_wallet_sync.py +79 -31
  171. chia/_tests/wallet/test_clvm_streamable.py +2 -2
  172. chia/_tests/wallet/test_coin_management.py +7 -7
  173. chia/_tests/wallet/test_coin_selection.py +20 -2
  174. chia/_tests/wallet/test_conditions.py +2 -2
  175. chia/_tests/wallet/test_debug_spend_bundle.py +2 -2
  176. chia/_tests/wallet/test_new_wallet_protocol.py +2 -2
  177. chia/_tests/wallet/test_nft_store.py +2 -2
  178. chia/_tests/wallet/test_notifications.py +2 -2
  179. chia/_tests/wallet/test_puzzle_store.py +2 -2
  180. chia/_tests/wallet/test_sign_coin_spends.py +2 -2
  181. chia/_tests/wallet/test_signer_protocol.py +3 -3
  182. chia/_tests/wallet/test_singleton.py +3 -11
  183. chia/_tests/wallet/test_singleton_lifecycle_fast.py +12 -13
  184. chia/_tests/wallet/test_singleton_store.py +2 -4
  185. chia/_tests/wallet/test_transaction_store.py +2 -2
  186. chia/_tests/wallet/test_util.py +2 -2
  187. chia/_tests/wallet/test_wallet.py +53 -49
  188. chia/_tests/wallet/test_wallet_action_scope.py +24 -6
  189. chia/_tests/wallet/test_wallet_blockchain.py +1 -1
  190. chia/_tests/wallet/test_wallet_coin_store.py +2 -2
  191. chia/_tests/wallet/test_wallet_interested_store.py +2 -2
  192. chia/_tests/wallet/test_wallet_node.py +3 -3
  193. chia/_tests/wallet/test_wallet_retry.py +3 -3
  194. chia/_tests/wallet/test_wallet_state_manager.py +8 -8
  195. chia/_tests/wallet/test_wallet_test_framework.py +1 -1
  196. chia/_tests/wallet/test_wallet_trade_store.py +2 -2
  197. chia/_tests/wallet/test_wallet_utils.py +2 -2
  198. chia/_tests/wallet/vc_wallet/test_cr_outer_puzzle.py +3 -2
  199. chia/_tests/wallet/vc_wallet/test_vc_lifecycle.py +15 -15
  200. chia/_tests/wallet/vc_wallet/test_vc_wallet.py +5 -3
  201. chia/_tests/wallet/wallet_block_tools.py +15 -7
  202. chia/_tests/weight_proof/test_weight_proof.py +3 -3
  203. chia/cmds/chia.py +0 -2
  204. chia/cmds/cmd_classes.py +3 -3
  205. chia/cmds/cmd_helpers.py +4 -4
  206. chia/cmds/cmds_util.py +2 -2
  207. chia/cmds/coin_funcs.py +3 -2
  208. chia/cmds/coins.py +1 -1
  209. chia/cmds/data.py +2 -2
  210. chia/cmds/data_funcs.py +3 -2
  211. chia/cmds/db_upgrade_func.py +2 -2
  212. chia/cmds/db_validate_func.py +15 -8
  213. chia/cmds/farm.py +2 -4
  214. chia/cmds/keys.py +0 -2
  215. chia/cmds/keys_funcs.py +1 -1
  216. chia/cmds/netspace_funcs.py +2 -1
  217. chia/cmds/param_types.py +2 -2
  218. chia/cmds/plotnft.py +2 -2
  219. chia/cmds/plotnft_funcs.py +2 -2
  220. chia/cmds/rpc.py +1 -1
  221. chia/cmds/show.py +1 -2
  222. chia/cmds/show_funcs.py +6 -3
  223. chia/cmds/signer.py +1 -2
  224. chia/cmds/sim.py +1 -2
  225. chia/cmds/sim_funcs.py +2 -2
  226. chia/cmds/wallet.py +2 -2
  227. chia/cmds/wallet_funcs.py +4 -11
  228. chia/consensus/block_body_validation.py +3 -4
  229. chia/consensus/block_creation.py +10 -6
  230. chia/consensus/block_header_validation.py +3 -4
  231. chia/consensus/block_record.py +2 -3
  232. chia/consensus/block_rewards.py +1 -1
  233. chia/consensus/blockchain.py +20 -17
  234. chia/consensus/blockchain_interface.py +5 -4
  235. chia/consensus/coinbase.py +2 -2
  236. chia/consensus/constants.py +1 -1
  237. chia/consensus/cost_calculator.py +2 -1
  238. chia/consensus/default_constants.py +4 -3
  239. chia/consensus/deficit.py +3 -2
  240. chia/consensus/difficulty_adjustment.py +8 -9
  241. chia/consensus/find_fork_point.py +4 -3
  242. chia/consensus/full_block_to_block_record.py +4 -3
  243. chia/consensus/get_block_challenge.py +4 -3
  244. chia/consensus/get_block_generator.py +3 -2
  245. chia/consensus/make_sub_epoch_summary.py +3 -2
  246. chia/consensus/multiprocess_validation.py +9 -4
  247. chia/consensus/pos_quality.py +1 -1
  248. chia/consensus/pot_iterations.py +4 -3
  249. chia/consensus/vdf_info_computation.py +4 -3
  250. chia/daemon/client.py +1 -1
  251. chia/daemon/keychain_server.py +1 -1
  252. chia/daemon/server.py +1 -1
  253. chia/daemon/windows_signal.py +1 -1
  254. chia/data_layer/data_layer.py +4 -3
  255. chia/data_layer/data_layer_errors.py +1 -1
  256. chia/data_layer/data_layer_util.py +2 -2
  257. chia/data_layer/data_layer_wallet.py +47 -69
  258. chia/data_layer/data_store.py +1 -1
  259. chia/data_layer/dl_wallet_store.py +5 -6
  260. chia/data_layer/download_data.py +1 -1
  261. chia/data_layer/s3_plugin_service.py +4 -4
  262. chia/data_layer/singleton_record.py +23 -0
  263. chia/data_layer/util/benchmark.py +2 -1
  264. chia/farmer/farmer.py +4 -6
  265. chia/farmer/farmer_api.py +4 -6
  266. chia/full_node/bitcoin_fee_estimator.py +2 -1
  267. chia/full_node/block_height_map.py +2 -2
  268. chia/full_node/block_store.py +8 -9
  269. chia/{util → full_node}/check_fork_next_block.py +2 -1
  270. chia/full_node/coin_store.py +10 -10
  271. chia/full_node/fee_estimate.py +2 -1
  272. chia/full_node/fee_estimation.py +2 -1
  273. chia/full_node/fee_estimator.py +2 -1
  274. chia/full_node/fee_estimator_interface.py +1 -1
  275. chia/full_node/fee_history.py +2 -1
  276. chia/full_node/fee_tracker.py +2 -1
  277. chia/full_node/full_node.py +25 -15
  278. chia/full_node/full_node_api.py +12 -32
  279. chia/full_node/full_node_store.py +4 -3
  280. chia/full_node/hint_management.py +2 -1
  281. chia/full_node/hint_store.py +3 -3
  282. chia/full_node/mempool.py +79 -12
  283. chia/full_node/mempool_check_conditions.py +6 -7
  284. chia/full_node/mempool_manager.py +168 -21
  285. chia/full_node/pending_tx_cache.py +2 -2
  286. chia/full_node/subscriptions.py +2 -2
  287. chia/full_node/sync_store.py +2 -3
  288. chia/full_node/tx_processing_queue.py +2 -1
  289. chia/full_node/weight_proof.py +5 -8
  290. chia/harvester/harvester.py +5 -3
  291. chia/harvester/harvester_api.py +2 -2
  292. chia/introducer/introducer.py +30 -2
  293. chia/introducer/introducer_api.py +9 -1
  294. chia/legacy/keyring.py +1 -2
  295. chia/plot_sync/exceptions.py +2 -1
  296. chia/plot_sync/receiver.py +2 -2
  297. chia/plot_sync/sender.py +1 -1
  298. chia/plotting/cache.py +2 -2
  299. chia/plotting/check_plots.py +4 -2
  300. chia/plotting/create_plots.py +1 -1
  301. chia/plotting/manager.py +3 -3
  302. chia/plotting/util.py +2 -2
  303. chia/pools/pool_config.py +1 -1
  304. chia/pools/pool_puzzles.py +23 -17
  305. chia/pools/pool_wallet.py +22 -9
  306. chia/pools/pool_wallet_info.py +2 -2
  307. chia/protocols/farmer_protocol.py +3 -6
  308. chia/protocols/full_node_protocol.py +3 -2
  309. chia/protocols/harvester_protocol.py +3 -4
  310. chia/protocols/pool_protocol.py +2 -2
  311. chia/protocols/shared_protocol.py +2 -1
  312. chia/protocols/timelord_protocol.py +4 -4
  313. chia/protocols/wallet_protocol.py +2 -2
  314. chia/rpc/data_layer_rpc_api.py +3 -4
  315. chia/rpc/data_layer_rpc_client.py +3 -2
  316. chia/rpc/farmer_rpc_api.py +2 -2
  317. chia/rpc/farmer_rpc_client.py +2 -1
  318. chia/rpc/full_node_rpc_api.py +3 -2
  319. chia/rpc/full_node_rpc_client.py +3 -2
  320. chia/rpc/harvester_rpc_api.py +2 -1
  321. chia/rpc/rpc_client.py +2 -2
  322. chia/rpc/rpc_server.py +1 -1
  323. chia/rpc/wallet_request_types.py +2 -62
  324. chia/rpc/wallet_rpc_api.py +98 -628
  325. chia/rpc/wallet_rpc_client.py +5 -253
  326. chia/seeder/crawl_store.py +1 -1
  327. chia/seeder/crawler.py +2 -2
  328. chia/seeder/peer_record.py +2 -1
  329. chia/seeder/start_crawler.py +3 -1
  330. chia/server/address_manager.py +2 -1
  331. chia/server/address_manager_store.py +1 -1
  332. chia/server/capabilities.py +2 -1
  333. chia/server/introducer_peers.py +2 -1
  334. chia/server/node_discovery.py +1 -1
  335. chia/server/outbound_message.py +2 -1
  336. chia/server/server.py +2 -2
  337. chia/server/start_data_layer.py +2 -1
  338. chia/server/start_farmer.py +3 -1
  339. chia/server/start_full_node.py +4 -2
  340. chia/server/start_harvester.py +3 -1
  341. chia/server/start_introducer.py +12 -1
  342. chia/server/start_service.py +2 -1
  343. chia/server/start_timelord.py +3 -1
  344. chia/server/start_wallet.py +3 -1
  345. chia/server/upnp.py +1 -2
  346. chia/server/ws_connection.py +3 -4
  347. chia/simulator/add_blocks_in_batches.py +5 -3
  348. chia/simulator/block_tools.py +16 -12
  349. chia/simulator/full_node_simulator.py +9 -14
  350. chia/simulator/setup_services.py +5 -3
  351. chia/simulator/simulator_full_node_rpc_api.py +3 -2
  352. chia/simulator/simulator_full_node_rpc_client.py +3 -2
  353. chia/simulator/simulator_protocol.py +3 -2
  354. chia/simulator/simulator_test_tools.py +2 -2
  355. chia/simulator/start_simulator.py +3 -2
  356. chia/simulator/wallet_tools.py +3 -4
  357. chia/timelord/iters_from_block.py +4 -4
  358. chia/timelord/timelord.py +7 -12
  359. chia/timelord/timelord_api.py +3 -3
  360. chia/timelord/timelord_state.py +4 -3
  361. chia/types/block_protocol.py +2 -2
  362. chia/types/blockchain_format/coin.py +2 -2
  363. chia/types/blockchain_format/program.py +1 -1
  364. chia/types/blockchain_format/proof_of_space.py +3 -4
  365. chia/types/blockchain_format/tree_hash.py +1 -1
  366. chia/types/blockchain_format/vdf.py +3 -4
  367. chia/types/clvm_cost.py +1 -1
  368. chia/types/coin_record.py +4 -3
  369. chia/types/coin_spend.py +1 -1
  370. chia/types/eligible_coin_spends.py +9 -5
  371. chia/types/fee_rate.py +1 -1
  372. chia/types/generator_types.py +3 -3
  373. chia/types/internal_mempool_item.py +3 -2
  374. chia/types/mempool_item.py +10 -3
  375. chia/types/mempool_submission_status.py +2 -1
  376. chia/types/mojos.py +1 -1
  377. chia/types/peer_info.py +2 -1
  378. chia/types/transaction_queue_entry.py +2 -1
  379. chia/types/unfinished_header_block.py +4 -4
  380. chia/types/validation_state.py +2 -1
  381. chia/types/weight_proof.py +1 -9
  382. chia/util/augmented_chain.py +20 -9
  383. chia/util/block_cache.py +8 -4
  384. chia/util/condition_tools.py +2 -2
  385. chia/util/full_block_utils.py +3 -4
  386. chia/util/generator_tools.py +2 -2
  387. chia/util/initial-config.yaml +2 -11
  388. chia/util/network.py +2 -2
  389. chia/util/prev_transaction_block.py +2 -1
  390. chia/util/task_timing.py +1 -1
  391. chia/util/vdf_prover.py +3 -3
  392. chia/util/ws_message.py +1 -1
  393. chia/wallet/cat_wallet/cat_info.py +3 -2
  394. chia/wallet/cat_wallet/cat_outer_puzzle.py +3 -2
  395. chia/wallet/cat_wallet/cat_utils.py +6 -4
  396. chia/wallet/cat_wallet/cat_wallet.py +16 -18
  397. chia/wallet/cat_wallet/lineage_store.py +2 -1
  398. chia/wallet/coin_selection.py +5 -5
  399. chia/wallet/conditions.py +22 -16
  400. chia/wallet/db_wallet/db_wallet_puzzles.py +15 -15
  401. chia/wallet/derivation_record.py +2 -2
  402. chia/wallet/derive_keys.py +2 -2
  403. chia/wallet/did_wallet/did_info.py +3 -2
  404. chia/wallet/did_wallet/did_wallet.py +41 -19
  405. chia/wallet/did_wallet/did_wallet_puzzles.py +18 -12
  406. chia/wallet/driver_protocol.py +1 -1
  407. chia/wallet/lineage_proof.py +3 -2
  408. chia/wallet/nft_wallet/metadata_outer_puzzle.py +6 -7
  409. chia/wallet/nft_wallet/nft_info.py +5 -5
  410. chia/wallet/nft_wallet/nft_puzzle_utils.py +293 -0
  411. chia/wallet/nft_wallet/nft_puzzles.py +21 -298
  412. chia/wallet/nft_wallet/nft_wallet.py +47 -62
  413. chia/wallet/nft_wallet/ownership_outer_puzzle.py +4 -8
  414. chia/wallet/nft_wallet/singleton_outer_puzzle.py +3 -2
  415. chia/wallet/nft_wallet/transfer_program_puzzle.py +6 -10
  416. chia/wallet/nft_wallet/uncurry_nft.py +6 -8
  417. chia/wallet/notification_manager.py +5 -5
  418. chia/wallet/notification_store.py +3 -2
  419. chia/wallet/outer_puzzles.py +2 -1
  420. chia/wallet/puzzles/clawback/drivers.py +21 -8
  421. chia/wallet/puzzles/clawback/metadata.py +3 -2
  422. chia/wallet/puzzles/clawback/puzzle_decorator.py +5 -4
  423. chia/wallet/puzzles/deployed_puzzle_hashes.json +0 -10
  424. chia/wallet/puzzles/p2_conditions.py +3 -2
  425. chia/wallet/puzzles/p2_delegated_conditions.py +3 -2
  426. chia/wallet/puzzles/p2_delegated_puzzle.py +3 -2
  427. chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py +3 -3
  428. chia/wallet/puzzles/p2_m_of_n_delegate_direct.py +3 -2
  429. chia/wallet/puzzles/p2_puzzle_hash.py +4 -3
  430. chia/wallet/puzzles/puzzle_utils.py +3 -2
  431. chia/wallet/puzzles/singleton_top_layer.py +26 -10
  432. chia/wallet/puzzles/singleton_top_layer_v1_1.py +21 -9
  433. chia/wallet/puzzles/tails.py +21 -129
  434. chia/wallet/signer_protocol.py +3 -2
  435. chia/wallet/singleton.py +12 -6
  436. chia/wallet/singleton_record.py +3 -2
  437. chia/wallet/trade_manager.py +31 -55
  438. chia/wallet/trade_record.py +3 -2
  439. chia/wallet/trading/offer.py +14 -13
  440. chia/wallet/trading/trade_store.py +3 -4
  441. chia/wallet/transaction_record.py +2 -2
  442. chia/wallet/util/blind_signer_tl.py +3 -2
  443. chia/wallet/util/compute_hints.py +3 -2
  444. chia/wallet/util/compute_memos.py +2 -2
  445. chia/wallet/util/curry_and_treehash.py +1 -2
  446. chia/wallet/util/merkle_tree.py +1 -1
  447. chia/wallet/util/merkle_utils.py +1 -1
  448. chia/wallet/util/new_peak_queue.py +2 -1
  449. chia/wallet/util/notifications.py +5 -4
  450. chia/wallet/util/peer_request_cache.py +3 -2
  451. chia/wallet/util/puzzle_compression.py +6 -4
  452. chia/wallet/util/puzzle_decorator.py +6 -4
  453. chia/wallet/util/query_filter.py +3 -2
  454. chia/wallet/util/tx_config.py +3 -3
  455. chia/wallet/util/wallet_sync_utils.py +2 -2
  456. chia/wallet/util/wallet_types.py +2 -3
  457. chia/wallet/vc_wallet/cr_cat_drivers.py +18 -22
  458. chia/wallet/vc_wallet/cr_cat_wallet.py +14 -10
  459. chia/wallet/vc_wallet/cr_outer_puzzle.py +2 -2
  460. chia/wallet/vc_wallet/vc_drivers.py +50 -68
  461. chia/wallet/vc_wallet/vc_store.py +2 -2
  462. chia/wallet/vc_wallet/vc_wallet.py +47 -15
  463. chia/wallet/wallet.py +51 -46
  464. chia/wallet/wallet_action_scope.py +4 -0
  465. chia/wallet/wallet_blockchain.py +12 -7
  466. chia/wallet/wallet_coin_record.py +3 -2
  467. chia/wallet/wallet_coin_store.py +3 -2
  468. chia/wallet/wallet_info.py +2 -1
  469. chia/wallet/wallet_interested_store.py +3 -2
  470. chia/wallet/wallet_nft_store.py +4 -4
  471. chia/wallet/wallet_node.py +3 -4
  472. chia/wallet/wallet_pool_store.py +3 -4
  473. chia/wallet/wallet_protocol.py +19 -5
  474. chia/wallet/wallet_puzzle_store.py +2 -2
  475. chia/wallet/wallet_retry_store.py +3 -6
  476. chia/wallet/wallet_singleton_store.py +2 -2
  477. chia/wallet/wallet_state_manager.py +20 -197
  478. chia/wallet/wallet_transaction_store.py +2 -2
  479. chia/wallet/wallet_user_store.py +2 -1
  480. chia/wallet/wallet_weight_proof_handler.py +3 -2
  481. {chia_blockchain-2.5.2rc1.dist-info → chia_blockchain-2.5.3rc1.dist-info}/METADATA +3 -2
  482. chia_blockchain-2.5.3rc1.dist-info/RECORD +891 -0
  483. mozilla-ca/cacert.pem +64 -33
  484. chia/_tests/clvm/test_condition_codes.py +0 -13
  485. chia/_tests/cmds/wallet/test_dao.py +0 -565
  486. chia/_tests/wallet/dao_wallet/__init__.py +0 -0
  487. chia/_tests/wallet/dao_wallet/config.py +0 -3
  488. chia/_tests/wallet/dao_wallet/test_dao_clvm.py +0 -1330
  489. chia/_tests/wallet/dao_wallet/test_dao_wallets.py +0 -3488
  490. chia/cmds/dao.py +0 -1064
  491. chia/cmds/dao_funcs.py +0 -598
  492. chia/consensus/puzzles/__init__.py +0 -0
  493. chia/consensus/puzzles/chialisp_deserialisation.clsp +0 -69
  494. chia/consensus/puzzles/chialisp_deserialisation.clsp.hex +0 -1
  495. chia/consensus/puzzles/rom_bootstrap_generator.clsp +0 -37
  496. chia/consensus/puzzles/rom_bootstrap_generator.clsp.hex +0 -1
  497. chia/full_node/puzzles/__init__.py +0 -0
  498. chia/full_node/puzzles/block_program_zero.clsp +0 -14
  499. chia/full_node/puzzles/block_program_zero.clsp.hex +0 -1
  500. chia/full_node/puzzles/decompress_coin_spend_entry.clsp +0 -5
  501. chia/full_node/puzzles/decompress_coin_spend_entry.clsp.hex +0 -1
  502. chia/full_node/puzzles/decompress_coin_spend_entry_with_prefix.clsp +0 -7
  503. chia/full_node/puzzles/decompress_coin_spend_entry_with_prefix.clsp.hex +0 -1
  504. chia/full_node/puzzles/decompress_puzzle.clsp +0 -6
  505. chia/full_node/puzzles/decompress_puzzle.clsp.hex +0 -1
  506. chia/pools/puzzles/__init__.py +0 -0
  507. chia/pools/puzzles/pool_member_innerpuz.clsp +0 -70
  508. chia/pools/puzzles/pool_member_innerpuz.clsp.hex +0 -1
  509. chia/pools/puzzles/pool_waitingroom_innerpuz.clsp +0 -69
  510. chia/pools/puzzles/pool_waitingroom_innerpuz.clsp.hex +0 -1
  511. chia/simulator/simulator_constants.py +0 -13
  512. chia/types/blockchain_format/foliage.py +0 -8
  513. chia/types/blockchain_format/pool_target.py +0 -5
  514. chia/types/blockchain_format/reward_chain_block.py +0 -6
  515. chia/types/blockchain_format/sized_bytes.py +0 -11
  516. chia/util/ints.py +0 -19
  517. chia/wallet/cat_wallet/dao_cat_info.py +0 -28
  518. chia/wallet/cat_wallet/dao_cat_wallet.py +0 -669
  519. chia/wallet/cat_wallet/puzzles/__init__.py +0 -0
  520. chia/wallet/cat_wallet/puzzles/cat_truths.clib +0 -31
  521. chia/wallet/cat_wallet/puzzles/cat_v2.clsp +0 -397
  522. chia/wallet/cat_wallet/puzzles/cat_v2.clsp.hex +0 -1
  523. chia/wallet/cat_wallet/puzzles/delegated_tail.clsp +0 -25
  524. chia/wallet/cat_wallet/puzzles/delegated_tail.clsp.hex +0 -1
  525. chia/wallet/cat_wallet/puzzles/everything_with_signature.clsp +0 -15
  526. chia/wallet/cat_wallet/puzzles/everything_with_signature.clsp.hex +0 -1
  527. chia/wallet/cat_wallet/puzzles/genesis_by_coin_id.clsp +0 -26
  528. chia/wallet/cat_wallet/puzzles/genesis_by_coin_id.clsp.hex +0 -1
  529. chia/wallet/cat_wallet/puzzles/genesis_by_coin_id_or_singleton.clsp +0 -42
  530. chia/wallet/cat_wallet/puzzles/genesis_by_coin_id_or_singleton.clsp.hex +0 -1
  531. chia/wallet/cat_wallet/puzzles/genesis_by_puzzle_hash.clsp +0 -24
  532. chia/wallet/cat_wallet/puzzles/genesis_by_puzzle_hash.clsp.hex +0 -1
  533. chia/wallet/dao_wallet/__init__.py +0 -0
  534. chia/wallet/dao_wallet/dao_info.py +0 -61
  535. chia/wallet/dao_wallet/dao_utils.py +0 -811
  536. chia/wallet/dao_wallet/dao_wallet.py +0 -2119
  537. chia/wallet/did_wallet/puzzles/__init__.py +0 -0
  538. chia/wallet/did_wallet/puzzles/did_innerpuz.clsp +0 -135
  539. chia/wallet/did_wallet/puzzles/did_innerpuz.clsp.hex +0 -1
  540. chia/wallet/payment.py +0 -33
  541. chia/wallet/puzzles/augmented_condition.clsp +0 -13
  542. chia/wallet/puzzles/augmented_condition.clsp.hex +0 -1
  543. chia/wallet/puzzles/condition_codes.clib +0 -77
  544. chia/wallet/puzzles/curry-and-treehash.clib +0 -102
  545. chia/wallet/puzzles/curry.clib +0 -135
  546. chia/wallet/puzzles/curry_by_index.clib +0 -16
  547. chia/wallet/puzzles/dao_cat_eve.clsp +0 -17
  548. chia/wallet/puzzles/dao_cat_eve.clsp.hex +0 -1
  549. chia/wallet/puzzles/dao_cat_launcher.clsp +0 -36
  550. chia/wallet/puzzles/dao_cat_launcher.clsp.hex +0 -1
  551. chia/wallet/puzzles/dao_finished_state.clsp +0 -35
  552. chia/wallet/puzzles/dao_finished_state.clsp.hex +0 -1
  553. chia/wallet/puzzles/dao_finished_state.clsp.hex.sha256tree +0 -1
  554. chia/wallet/puzzles/dao_lockup.clsp +0 -288
  555. chia/wallet/puzzles/dao_lockup.clsp.hex +0 -1
  556. chia/wallet/puzzles/dao_lockup.clsp.hex.sha256tree +0 -1
  557. chia/wallet/puzzles/dao_proposal.clsp +0 -377
  558. chia/wallet/puzzles/dao_proposal.clsp.hex +0 -1
  559. chia/wallet/puzzles/dao_proposal.clsp.hex.sha256tree +0 -1
  560. chia/wallet/puzzles/dao_proposal_timer.clsp +0 -78
  561. chia/wallet/puzzles/dao_proposal_timer.clsp.hex +0 -1
  562. chia/wallet/puzzles/dao_proposal_timer.clsp.hex.sha256tree +0 -1
  563. chia/wallet/puzzles/dao_proposal_validator.clsp +0 -87
  564. chia/wallet/puzzles/dao_proposal_validator.clsp.hex +0 -1
  565. chia/wallet/puzzles/dao_proposal_validator.clsp.hex.sha256tree +0 -1
  566. chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp +0 -240
  567. chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex +0 -1
  568. chia/wallet/puzzles/dao_spend_p2_singleton_v2.clsp.hex.sha256tree +0 -1
  569. chia/wallet/puzzles/dao_treasury.clsp +0 -115
  570. chia/wallet/puzzles/dao_treasury.clsp.hex +0 -1
  571. chia/wallet/puzzles/dao_update_proposal.clsp +0 -44
  572. chia/wallet/puzzles/dao_update_proposal.clsp.hex +0 -1
  573. chia/wallet/puzzles/json.clib +0 -25
  574. chia/wallet/puzzles/merkle_utils.clib +0 -18
  575. chia/wallet/puzzles/notification.clsp +0 -7
  576. chia/wallet/puzzles/notification.clsp.hex +0 -1
  577. chia/wallet/puzzles/p2_1_of_n.clsp +0 -22
  578. chia/wallet/puzzles/p2_1_of_n.clsp.hex +0 -1
  579. chia/wallet/puzzles/p2_conditions.clsp +0 -3
  580. chia/wallet/puzzles/p2_conditions.clsp.hex +0 -1
  581. chia/wallet/puzzles/p2_delegated_conditions.clsp +0 -18
  582. chia/wallet/puzzles/p2_delegated_conditions.clsp.hex +0 -1
  583. chia/wallet/puzzles/p2_delegated_puzzle.clsp +0 -19
  584. chia/wallet/puzzles/p2_delegated_puzzle.clsp.hex +0 -1
  585. chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp +0 -91
  586. chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.clsp.hex +0 -1
  587. chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp +0 -108
  588. chia/wallet/puzzles/p2_m_of_n_delegate_direct.clsp.hex +0 -1
  589. chia/wallet/puzzles/p2_parent.clsp +0 -19
  590. chia/wallet/puzzles/p2_parent.clsp.hex +0 -1
  591. chia/wallet/puzzles/p2_puzzle_hash.clsp +0 -18
  592. chia/wallet/puzzles/p2_puzzle_hash.clsp.hex +0 -1
  593. chia/wallet/puzzles/p2_singleton.clsp +0 -30
  594. chia/wallet/puzzles/p2_singleton.clsp.hex +0 -1
  595. chia/wallet/puzzles/p2_singleton_aggregator.clsp +0 -81
  596. chia/wallet/puzzles/p2_singleton_aggregator.clsp.hex +0 -1
  597. chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp +0 -50
  598. chia/wallet/puzzles/p2_singleton_or_delayed_puzhash.clsp.hex +0 -1
  599. chia/wallet/puzzles/p2_singleton_via_delegated_puzzle.clsp +0 -47
  600. chia/wallet/puzzles/p2_singleton_via_delegated_puzzle.clsp.hex +0 -1
  601. chia/wallet/puzzles/settlement_payments.clsp +0 -49
  602. chia/wallet/puzzles/settlement_payments.clsp.hex +0 -1
  603. chia/wallet/puzzles/sha256tree.clib +0 -11
  604. chia/wallet/puzzles/singleton_launcher.clsp +0 -16
  605. chia/wallet/puzzles/singleton_launcher.clsp.hex +0 -1
  606. chia/wallet/puzzles/singleton_top_layer.clsp +0 -177
  607. chia/wallet/puzzles/singleton_top_layer.clsp.hex +0 -1
  608. chia/wallet/puzzles/singleton_top_layer_v1_1.clsp +0 -107
  609. chia/wallet/puzzles/singleton_top_layer_v1_1.clsp.hex +0 -1
  610. chia/wallet/puzzles/singleton_truths.clib +0 -21
  611. chia/wallet/vc_wallet/cr_puzzles/__init__.py +0 -0
  612. chia/wallet/vc_wallet/cr_puzzles/conditions_w_fee_announce.clsp +0 -3
  613. chia/wallet/vc_wallet/cr_puzzles/conditions_w_fee_announce.clsp.hex +0 -1
  614. chia/wallet/vc_wallet/cr_puzzles/credential_restriction.clsp +0 -304
  615. chia/wallet/vc_wallet/cr_puzzles/credential_restriction.clsp.hex +0 -1
  616. chia/wallet/vc_wallet/cr_puzzles/flag_proofs_checker.clsp +0 -45
  617. chia/wallet/vc_wallet/cr_puzzles/flag_proofs_checker.clsp.hex +0 -1
  618. chia/wallet/vc_wallet/vc_puzzles/__init__.py +0 -0
  619. chia/wallet/vc_wallet/vc_puzzles/covenant_layer.clsp +0 -30
  620. chia/wallet/vc_wallet/vc_puzzles/covenant_layer.clsp.hex +0 -1
  621. chia/wallet/vc_wallet/vc_puzzles/eml_covenant_morpher.clsp +0 -75
  622. chia/wallet/vc_wallet/vc_puzzles/eml_covenant_morpher.clsp.hex +0 -1
  623. chia/wallet/vc_wallet/vc_puzzles/eml_transfer_program_covenant_adapter.clsp +0 -32
  624. chia/wallet/vc_wallet/vc_puzzles/eml_transfer_program_covenant_adapter.clsp.hex +0 -1
  625. chia/wallet/vc_wallet/vc_puzzles/eml_update_metadata_with_DID.clsp +0 -80
  626. chia/wallet/vc_wallet/vc_puzzles/eml_update_metadata_with_DID.clsp.hex +0 -1
  627. chia/wallet/vc_wallet/vc_puzzles/exigent_metadata_layer.clsp +0 -163
  628. chia/wallet/vc_wallet/vc_puzzles/exigent_metadata_layer.clsp.hex +0 -1
  629. chia/wallet/vc_wallet/vc_puzzles/p2_announced_delegated_puzzle.clsp +0 -16
  630. chia/wallet/vc_wallet/vc_puzzles/p2_announced_delegated_puzzle.clsp.hex +0 -1
  631. chia/wallet/vc_wallet/vc_puzzles/standard_vc_backdoor_puzzle.clsp +0 -74
  632. chia/wallet/vc_wallet/vc_puzzles/standard_vc_backdoor_puzzle.clsp.hex +0 -1
  633. chia/wallet/vc_wallet/vc_puzzles/std_parent_morpher.clsp +0 -23
  634. chia/wallet/vc_wallet/vc_puzzles/std_parent_morpher.clsp.hex +0 -1
  635. chia/wallet/vc_wallet/vc_puzzles/viral_backdoor.clsp +0 -64
  636. chia/wallet/vc_wallet/vc_puzzles/viral_backdoor.clsp.hex +0 -1
  637. chia_blockchain-2.5.2rc1.dist-info/RECORD +0 -1042
  638. {chia_blockchain-2.5.2rc1.dist-info → chia_blockchain-2.5.3rc1.dist-info}/LICENSE +0 -0
  639. {chia_blockchain-2.5.2rc1.dist-info → chia_blockchain-2.5.3rc1.dist-info}/WHEEL +0 -0
  640. {chia_blockchain-2.5.2rc1.dist-info → chia_blockchain-2.5.3rc1.dist-info}/entry_points.txt +0 -0
@@ -7,17 +7,23 @@ import logging
7
7
  import random
8
8
  import time
9
9
  from collections.abc import Awaitable, Coroutine
10
- from typing import Optional
10
+ from typing import Any, Optional
11
11
 
12
12
  import pytest
13
13
  from chia_rs import (
14
14
  AugSchemeMPL,
15
+ Foliage,
16
+ FoliageTransactionBlock,
15
17
  G2Element,
16
18
  PrivateKey,
19
+ RewardChainBlockUnfinished,
17
20
  SpendBundleConditions,
21
+ TransactionsInfo,
18
22
  additions_and_removals,
19
23
  get_flags_for_height_and_constants,
20
24
  )
25
+ from chia_rs.sized_bytes import bytes32
26
+ from chia_rs.sized_ints import uint8, uint16, uint32, uint64, uint128
21
27
  from clvm.casts import int_to_bytes
22
28
  from packaging.version import Version
23
29
 
@@ -28,9 +34,10 @@ from chia._tests.core.full_node.stores.test_coin_store import get_future_reward_
28
34
  from chia._tests.core.make_block_generator import make_spend_bundle
29
35
  from chia._tests.core.node_height import node_height_at_least
30
36
  from chia._tests.util.misc import wallet_height_at_least
31
- from chia._tests.util.setup_nodes import SimulatorsAndWalletsServices
37
+ from chia._tests.util.setup_nodes import OldSimulatorsAndWallets, SimulatorsAndWalletsServices
32
38
  from chia._tests.util.time_out_assert import time_out_assert, time_out_assert_custom_interval, time_out_messages
33
39
  from chia.consensus.block_body_validation import ForkInfo
40
+ from chia.consensus.blockchain import Blockchain
34
41
  from chia.consensus.multiprocess_validation import PreValidationResult, pre_validate_block
35
42
  from chia.consensus.pot_iterations import is_overflow_block
36
43
  from chia.full_node.coin_store import CoinStore
@@ -40,11 +47,12 @@ from chia.full_node.signage_point import SignagePoint
40
47
  from chia.full_node.sync_store import Peak
41
48
  from chia.protocols import full_node_protocol, timelord_protocol, wallet_protocol
42
49
  from chia.protocols import full_node_protocol as fnp
43
- from chia.protocols.full_node_protocol import RespondTransaction
50
+ from chia.protocols.full_node_protocol import NewTransaction, RespondTransaction
44
51
  from chia.protocols.protocol_message_types import ProtocolMessageTypes
45
52
  from chia.protocols.shared_protocol import Capability, default_capabilities
46
53
  from chia.protocols.wallet_protocol import SendTransaction, TransactionAck
47
54
  from chia.server.address_manager import AddressManager
55
+ from chia.server.node_discovery import FullNodePeers
48
56
  from chia.server.outbound_message import Message, NodeType
49
57
  from chia.server.server import ChiaServer
50
58
  from chia.simulator.add_blocks_in_batches import add_blocks_in_batches
@@ -61,12 +69,14 @@ from chia.simulator.setup_services import setup_full_node
61
69
  from chia.simulator.simulator_protocol import FarmNewBlockProtocol
62
70
  from chia.simulator.wallet_tools import WalletTool
63
71
  from chia.types.blockchain_format.classgroup import ClassgroupElement
64
- from chia.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, TransactionsInfo
65
72
  from chia.types.blockchain_format.program import Program
66
- from chia.types.blockchain_format.proof_of_space import ProofOfSpace, calculate_plot_id_pk, calculate_pos_challenge
67
- from chia.types.blockchain_format.reward_chain_block import RewardChainBlockUnfinished
73
+ from chia.types.blockchain_format.proof_of_space import (
74
+ ProofOfSpace,
75
+ calculate_plot_id_ph,
76
+ calculate_plot_id_pk,
77
+ calculate_pos_challenge,
78
+ )
68
79
  from chia.types.blockchain_format.serialized_program import SerializedProgram
69
- from chia.types.blockchain_format.sized_bytes import bytes32
70
80
  from chia.types.blockchain_format.vdf import CompressibleVDFField, VDFProof
71
81
  from chia.types.coin_record import CoinRecord
72
82
  from chia.types.coin_spend import make_spend
@@ -81,12 +91,13 @@ from chia.types.validation_state import ValidationState
81
91
  from chia.util.augmented_chain import AugmentedBlockchain
82
92
  from chia.util.errors import ConsensusError, Err
83
93
  from chia.util.hash import std_hash
84
- from chia.util.ints import uint8, uint16, uint32, uint64, uint128
85
94
  from chia.util.limited_semaphore import LimitedSemaphore
86
95
  from chia.util.recursive_replace import recursive_replace
87
96
  from chia.util.task_referencer import create_referenced_task
88
97
  from chia.util.vdf_prover import get_vdf_info_and_proof
98
+ from chia.wallet.transaction_record import TransactionRecord
89
99
  from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG
100
+ from chia.wallet.wallet_node import WalletNode
90
101
  from chia.wallet.wallet_spend_bundle import WalletSpendBundle
91
102
 
92
103
 
@@ -100,7 +111,7 @@ def test_pre_validation_result() -> None:
100
111
  assert results.validated_signature is False
101
112
 
102
113
 
103
- async def new_transaction_not_requested(incoming, new_spend):
114
+ async def new_transaction_not_requested(incoming: asyncio.Queue[Message], new_spend: NewTransaction) -> bool:
104
115
  await asyncio.sleep(3)
105
116
  while not incoming.empty():
106
117
  response = await incoming.get()
@@ -115,7 +126,7 @@ async def new_transaction_not_requested(incoming, new_spend):
115
126
  return True
116
127
 
117
128
 
118
- async def new_transaction_requested(incoming, new_spend):
129
+ async def new_transaction_requested(incoming: asyncio.Queue[Message], new_spend: NewTransaction) -> bool:
119
130
  await asyncio.sleep(1)
120
131
  while not incoming.empty():
121
132
  response = await incoming.get()
@@ -130,23 +141,13 @@ async def new_transaction_requested(incoming, new_spend):
130
141
  return False
131
142
 
132
143
 
133
- async def get_block_path(full_node: FullNodeAPI):
134
- blocks_list = [await full_node.full_node.blockchain.get_full_peak()]
135
- assert blocks_list[0] is not None
136
- while blocks_list[0].height != 0:
137
- b = await full_node.full_node.block_store.get_full_block(blocks_list[0].prev_header_hash)
138
- assert b is not None
139
- blocks_list.insert(0, b)
140
- return blocks_list
141
-
142
-
143
144
  @pytest.mark.anyio
144
145
  async def test_sync_no_farmer(
145
- setup_two_nodes_and_wallet,
146
+ setup_two_nodes_and_wallet: OldSimulatorsAndWallets,
146
147
  default_1000_blocks: list[FullBlock],
147
148
  self_hostname: str,
148
149
  seeded_random: random.Random,
149
- ):
150
+ ) -> None:
150
151
  nodes, _wallets, _bt = setup_two_nodes_and_wallet
151
152
  server_1 = nodes[0].full_node.server
152
153
  server_2 = nodes[1].full_node.server
@@ -164,7 +165,7 @@ async def test_sync_no_farmer(
164
165
  # connect the nodes and wait for node 2 to sync up to node 1
165
166
  await connect_and_get_peer(server_1, server_2, self_hostname)
166
167
 
167
- def check_nodes_in_sync():
168
+ def check_nodes_in_sync() -> bool:
168
169
  p1 = full_node_2.full_node.blockchain.get_peak()
169
170
  p2 = full_node_1.full_node.blockchain.get_peak()
170
171
  return p1 == p2
@@ -176,8 +177,10 @@ async def test_sync_no_farmer(
176
177
 
177
178
 
178
179
  @pytest.mark.anyio
179
- @pytest.mark.parametrize("tx_size", [3000000000000])
180
- async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, tx_size, self_hostname):
180
+ @pytest.mark.parametrize("tx_size", [3_000_000_000_000])
181
+ async def test_block_compression(
182
+ setup_two_nodes_and_wallet: OldSimulatorsAndWallets, empty_blockchain: Blockchain, tx_size: int, self_hostname: str
183
+ ) -> None:
181
184
  nodes, wallets, bt = setup_two_nodes_and_wallet
182
185
  server_1 = nodes[0].full_node.server
183
186
  server_2 = nodes[1].full_node.server
@@ -205,8 +208,8 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
205
208
  # Send a transaction to mempool
206
209
  async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
207
210
  await wallet.generate_signed_transaction(
208
- tx_size,
209
- ph,
211
+ [uint64(tx_size)],
212
+ [ph],
210
213
  action_scope,
211
214
  )
212
215
  [tr] = action_scope.side_effects.transactions
@@ -224,8 +227,9 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
224
227
  await time_out_assert(30, wallet_height_at_least, True, wallet_node_1, 5)
225
228
  await full_node_1.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30)
226
229
 
227
- async def check_transaction_confirmed(transaction) -> bool:
230
+ async def check_transaction_confirmed(transaction: TransactionRecord) -> bool:
228
231
  tx = await wallet_node_1.wallet_state_manager.get_transaction(transaction.name)
232
+ assert tx is not None
229
233
  return tx.confirmed
230
234
 
231
235
  await time_out_assert(30, check_transaction_confirmed, True, tr)
@@ -238,8 +242,8 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
238
242
  # Send another tx
239
243
  async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
240
244
  await wallet.generate_signed_transaction(
241
- 20000,
242
- ph,
245
+ [uint64(20_000)],
246
+ [ph],
243
247
  action_scope,
244
248
  )
245
249
  [tr] = action_scope.side_effects.transactions
@@ -260,7 +264,7 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
260
264
  await time_out_assert(10, check_transaction_confirmed, True, tr)
261
265
 
262
266
  # Confirm generator is compressed
263
- program: Optional[SerializedProgram] = (await full_node_1.get_all_full_blocks())[-1].transactions_generator
267
+ program = (await full_node_1.get_all_full_blocks())[-1].transactions_generator
264
268
  assert program is not None
265
269
  num_blocks = len((await full_node_1.get_all_full_blocks())[-1].transactions_generator_ref_list)
266
270
  # since the hard fork, we don't use this compression mechanism
@@ -278,8 +282,8 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
278
282
  # Send another 2 tx
279
283
  async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
280
284
  await wallet.generate_signed_transaction(
281
- 30000,
282
- ph,
285
+ [uint64(30_000)],
286
+ [ph],
283
287
  action_scope,
284
288
  )
285
289
  [tr] = action_scope.side_effects.transactions
@@ -291,8 +295,8 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
291
295
  )
292
296
  async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
293
297
  await wallet.generate_signed_transaction(
294
- 40000,
295
- ph,
298
+ [uint64(40_000)],
299
+ [ph],
296
300
  action_scope,
297
301
  )
298
302
  [tr] = action_scope.side_effects.transactions
@@ -305,8 +309,8 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
305
309
 
306
310
  async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
307
311
  await wallet.generate_signed_transaction(
308
- 50000,
309
- ph,
312
+ [uint64(50_000)],
313
+ [ph],
310
314
  action_scope,
311
315
  )
312
316
  [tr] = action_scope.side_effects.transactions
@@ -319,8 +323,8 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
319
323
 
320
324
  async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=True) as action_scope:
321
325
  await wallet.generate_signed_transaction(
322
- 3000000000000,
323
- ph,
326
+ [uint64(3_000_000_000_000)],
327
+ [ph],
324
328
  action_scope,
325
329
  )
326
330
  [tr] = action_scope.side_effects.transactions
@@ -341,7 +345,7 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
341
345
  await time_out_assert(10, check_transaction_confirmed, True, tr)
342
346
 
343
347
  # Confirm generator is compressed
344
- program: Optional[SerializedProgram] = (await full_node_1.get_all_full_blocks())[-1].transactions_generator
348
+ program = (await full_node_1.get_all_full_blocks())[-1].transactions_generator
345
349
  assert program is not None
346
350
  num_blocks = len((await full_node_1.get_all_full_blocks())[-1].transactions_generator_ref_list)
347
351
  # since the hard fork, we don't use this compression mechanism
@@ -351,11 +355,12 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
351
355
  # Creates a standard_transaction and an anyone-can-spend tx
352
356
  async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=False) as action_scope:
353
357
  await wallet.generate_signed_transaction(
354
- 30000,
355
- Program.to(1).get_tree_hash(),
358
+ [uint64(30_000)],
359
+ [Program.to(1).get_tree_hash()],
356
360
  action_scope,
357
361
  )
358
362
  [tr] = action_scope.side_effects.transactions
363
+ assert tr.spend_bundle is not None
359
364
  extra_spend = WalletSpendBundle(
360
365
  [
361
366
  make_spend(
@@ -374,6 +379,7 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
374
379
  removals=new_spend_bundle.removals(),
375
380
  )
376
381
  [new_tr] = await wallet.wallet_state_manager.add_pending_transactions([new_tr])
382
+ assert new_tr.spend_bundle is not None
377
383
  await time_out_assert(
378
384
  10,
379
385
  full_node_2.full_node.mempool_manager.get_spendbundle,
@@ -392,18 +398,19 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
392
398
 
393
399
  # Confirm generator is not compressed, #CAT creation has a cat spend
394
400
  all_blocks = await full_node_1.get_all_full_blocks()
395
- program: Optional[SerializedProgram] = all_blocks[-1].transactions_generator
401
+ program = all_blocks[-1].transactions_generator
396
402
  assert program is not None
397
403
  assert len(all_blocks[-1].transactions_generator_ref_list) == 0
398
404
 
399
405
  # Make a standard transaction and an anyone-can-spend transaction
400
406
  async with wallet.wallet_state_manager.new_action_scope(DEFAULT_TX_CONFIG, push=False) as action_scope:
401
407
  await wallet.generate_signed_transaction(
402
- 30000,
403
- Program.to(1).get_tree_hash(),
408
+ [uint64(30_000)],
409
+ [Program.to(1).get_tree_hash()],
404
410
  action_scope,
405
411
  )
406
412
  [tr] = action_scope.side_effects.transactions
413
+ assert tr.spend_bundle is not None
407
414
  extra_spend = WalletSpendBundle(
408
415
  [
409
416
  make_spend(
@@ -422,6 +429,7 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
422
429
  removals=new_spend_bundle.removals(),
423
430
  )
424
431
  [new_tr] = await wallet.wallet_state_manager.add_pending_transactions([new_tr])
432
+ assert new_tr.spend_bundle is not None
425
433
  await time_out_assert(
426
434
  10,
427
435
  full_node_2.full_node.mempool_manager.get_spendbundle,
@@ -437,14 +445,16 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
437
445
  await full_node_1.wait_for_wallet_synced(wallet_node=wallet_node_1, timeout=30)
438
446
 
439
447
  # Confirm generator is not compressed
440
- program: Optional[SerializedProgram] = (await full_node_1.get_all_full_blocks())[-1].transactions_generator
448
+ program = (await full_node_1.get_all_full_blocks())[-1].transactions_generator
441
449
  assert program is not None
442
450
  assert len((await full_node_1.get_all_full_blocks())[-1].transactions_generator_ref_list) == 0
443
451
 
444
- height = full_node_1.full_node.blockchain.get_peak().height
452
+ peak = full_node_1.full_node.blockchain.get_peak()
453
+ assert peak is not None
454
+ height = peak.height
445
455
 
446
456
  blockchain = empty_blockchain
447
- all_blocks: list[FullBlock] = await full_node_1.get_all_full_blocks()
457
+ all_blocks = await full_node_1.get_all_full_blocks()
448
458
  assert height == len(all_blocks) - 1
449
459
 
450
460
  if test_reorgs:
@@ -492,14 +502,14 @@ async def test_block_compression(setup_two_nodes_and_wallet, empty_blockchain, t
492
502
 
493
503
 
494
504
  @pytest.mark.anyio
495
- async def test_spendbundle_serialization():
505
+ async def test_spendbundle_serialization() -> None:
496
506
  sb: SpendBundle = make_spend_bundle(1)
497
507
  protocol_message = RespondTransaction(sb)
498
508
  assert bytes(sb) == bytes(protocol_message)
499
509
 
500
510
 
501
511
  @pytest.mark.anyio
502
- async def test_inbound_connection_limit(setup_four_nodes, self_hostname):
512
+ async def test_inbound_connection_limit(setup_four_nodes: OldSimulatorsAndWallets, self_hostname: str) -> None:
503
513
  nodes, _, _ = setup_four_nodes
504
514
  server_1 = nodes[0].full_node.server
505
515
  server_1.config["target_peer_count"] = 2
@@ -512,29 +522,45 @@ async def test_inbound_connection_limit(setup_four_nodes, self_hostname):
512
522
 
513
523
 
514
524
  @pytest.mark.anyio
515
- async def test_request_peers(wallet_nodes, self_hostname):
525
+ async def test_request_peers(
526
+ wallet_nodes: tuple[
527
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
528
+ ],
529
+ self_hostname: str,
530
+ ) -> None:
516
531
  full_node_1, full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, _ = wallet_nodes
532
+ assert full_node_2.full_node.full_node_peers is not None
533
+ assert full_node_2.full_node.full_node_peers.address_manager is not None
517
534
  full_node_2.full_node.full_node_peers.address_manager.make_private_subnets_valid()
518
535
  await server_2.start_client(PeerInfo(self_hostname, server_1.get_port()))
519
536
 
520
- async def have_msgs():
521
- await full_node_2.full_node.full_node_peers.address_manager.add_to_new_table(
522
- [TimestampedPeerInfo("127.0.0.1", uint16(1000), uint64(int(time.time())) - 1000)],
537
+ async def have_msgs(full_node_peers: FullNodePeers) -> bool:
538
+ assert full_node_peers.address_manager is not None
539
+ await full_node_peers.address_manager.add_to_new_table(
540
+ [TimestampedPeerInfo("127.0.0.1", uint16(1000), uint64(int(time.time()) - 1000))],
523
541
  None,
524
542
  )
525
- msg_bytes = await full_node_2.full_node.full_node_peers.request_peers(PeerInfo("::1", server_2._port))
543
+ assert server_2._port is not None
544
+ msg_bytes = await full_node_peers.request_peers(PeerInfo("::1", server_2._port))
545
+ assert msg_bytes is not None
526
546
  msg = fnp.RespondPeers.from_bytes(msg_bytes.data)
527
547
  if msg is not None and not (len(msg.peer_list) == 1):
528
548
  return False
529
549
  peer = msg.peer_list[0]
530
550
  return (peer.host in {self_hostname, "127.0.0.1"}) and peer.port == 1000
531
551
 
532
- await time_out_assert_custom_interval(10, 1, have_msgs, True)
552
+ await time_out_assert_custom_interval(10, 1, have_msgs, True, full_node_2.full_node.full_node_peers)
553
+ assert full_node_1.full_node.full_node_peers is not None
533
554
  full_node_1.full_node.full_node_peers.address_manager = AddressManager()
534
555
 
535
556
 
536
557
  @pytest.mark.anyio
537
- async def test_basic_chain(wallet_nodes, self_hostname):
558
+ async def test_basic_chain(
559
+ wallet_nodes: tuple[
560
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
561
+ ],
562
+ self_hostname: str,
563
+ ) -> None:
538
564
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
539
565
 
540
566
  incoming_queue, _ = await add_dummy_connection(server_1, self_hostname, 12312)
@@ -549,17 +575,26 @@ async def test_basic_chain(wallet_nodes, self_hostname):
549
575
 
550
576
  await time_out_assert(10, time_out_messages(incoming_queue, "new_peak", 1))
551
577
 
552
- assert full_node_1.full_node.blockchain.get_peak().height == 0
578
+ peak = full_node_1.full_node.blockchain.get_peak()
579
+ assert peak is not None
580
+ assert peak.height == 0
553
581
 
554
582
  fork_info = ForkInfo(-1, -1, bt.constants.GENESIS_CHALLENGE)
555
583
  for block in bt.get_consecutive_blocks(30):
556
584
  await full_node_1.full_node.add_block(block, peer, fork_info=fork_info)
557
585
 
558
- assert full_node_1.full_node.blockchain.get_peak().height == 29
586
+ peak = full_node_1.full_node.blockchain.get_peak()
587
+ assert peak is not None
588
+ assert peak.height == 29
559
589
 
560
590
 
561
591
  @pytest.mark.anyio
562
- async def test_respond_end_of_sub_slot(wallet_nodes, self_hostname):
592
+ async def test_respond_end_of_sub_slot(
593
+ wallet_nodes: tuple[
594
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
595
+ ],
596
+ self_hostname: str,
597
+ ) -> None:
563
598
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
564
599
 
565
600
  incoming_queue, _dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
@@ -618,7 +653,12 @@ async def test_respond_end_of_sub_slot(wallet_nodes, self_hostname):
618
653
 
619
654
 
620
655
  @pytest.mark.anyio
621
- async def test_respond_end_of_sub_slot_no_reorg(wallet_nodes, self_hostname):
656
+ async def test_respond_end_of_sub_slot_no_reorg(
657
+ wallet_nodes: tuple[
658
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
659
+ ],
660
+ self_hostname: str,
661
+ ) -> None:
622
662
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
623
663
 
624
664
  incoming_queue, _dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
@@ -656,7 +696,12 @@ async def test_respond_end_of_sub_slot_no_reorg(wallet_nodes, self_hostname):
656
696
 
657
697
 
658
698
  @pytest.mark.anyio
659
- async def test_respond_end_of_sub_slot_race(wallet_nodes, self_hostname):
699
+ async def test_respond_end_of_sub_slot_race(
700
+ wallet_nodes: tuple[
701
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
702
+ ],
703
+ self_hostname: str,
704
+ ) -> None:
660
705
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
661
706
 
662
707
  incoming_queue, _dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
@@ -687,7 +732,12 @@ async def test_respond_end_of_sub_slot_race(wallet_nodes, self_hostname):
687
732
 
688
733
 
689
734
  @pytest.mark.anyio
690
- async def test_respond_unfinished(wallet_nodes, self_hostname):
735
+ async def test_respond_unfinished(
736
+ wallet_nodes: tuple[
737
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
738
+ ],
739
+ self_hostname: str,
740
+ ) -> None:
691
741
  full_node_1, _full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
692
742
 
693
743
  incoming_queue, _dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
@@ -772,6 +822,7 @@ async def test_respond_unfinished(wallet_nodes, self_hostname):
772
822
  assert full_node_1.full_node.full_node_store.get_unfinished_block(unf.partial_hash) is None
773
823
  await full_node_1.full_node.add_unfinished_block(unf, None)
774
824
  assert full_node_1.full_node.full_node_store.get_unfinished_block(unf.partial_hash) is not None
825
+ assert unf.foliage.foliage_transaction_block_hash is not None
775
826
  entry = full_node_1.full_node.full_node_store.get_unfinished_block_result(
776
827
  unf.partial_hash, unf.foliage.foliage_transaction_block_hash
777
828
  )
@@ -781,17 +832,22 @@ async def test_respond_unfinished(wallet_nodes, self_hostname):
781
832
  assert result.conds is not None
782
833
  assert result.conds.cost > 0
783
834
 
784
- assert not full_node_1.full_node.blockchain.contains_block(block.header_hash)
835
+ assert not full_node_1.full_node.blockchain.contains_block(block.header_hash, block.height)
785
836
  assert block.transactions_generator is not None
786
837
  block_no_transactions = block.replace(transactions_generator=None)
787
838
  assert block_no_transactions.transactions_generator is None
788
839
 
789
840
  await full_node_1.full_node.add_block(block_no_transactions)
790
- assert full_node_1.full_node.blockchain.contains_block(block.header_hash)
841
+ assert full_node_1.full_node.blockchain.contains_block(block.header_hash, block.height)
791
842
 
792
843
 
793
844
  @pytest.mark.anyio
794
- async def test_new_peak(wallet_nodes, self_hostname):
845
+ async def test_new_peak(
846
+ wallet_nodes: tuple[
847
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
848
+ ],
849
+ self_hostname: str,
850
+ ) -> None:
795
851
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
796
852
 
797
853
  incoming_queue, dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12312)
@@ -824,7 +880,7 @@ async def test_new_peak(wallet_nodes, self_hostname):
824
880
  await time_out_assert(10, time_out_messages(incoming_queue, "request_block", 0))
825
881
  task_2.cancel()
826
882
 
827
- async def suppress_value_error(coro: Coroutine) -> None:
883
+ async def suppress_value_error(coro: Coroutine[Any, Any, None]) -> None:
828
884
  with contextlib.suppress(ValueError):
829
885
  await coro
830
886
 
@@ -852,7 +908,13 @@ async def test_new_peak(wallet_nodes, self_hostname):
852
908
 
853
909
 
854
910
  @pytest.mark.anyio
855
- async def test_new_transaction_and_mempool(wallet_nodes, self_hostname, seeded_random: random.Random):
911
+ async def test_new_transaction_and_mempool(
912
+ wallet_nodes: tuple[
913
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
914
+ ],
915
+ self_hostname: str,
916
+ seeded_random: random.Random,
917
+ ) -> None:
856
918
  full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
857
919
  wallet_ph = wallet_a.get_new_puzzlehash()
858
920
  blocks = bt.get_consecutive_blocks(
@@ -864,18 +926,15 @@ async def test_new_transaction_and_mempool(wallet_nodes, self_hostname, seeded_r
864
926
  for block in blocks:
865
927
  await full_node_1.full_node.add_block(block)
866
928
 
867
- start_height = (
868
- full_node_1.full_node.blockchain.get_peak().height
869
- if full_node_1.full_node.blockchain.get_peak() is not None
870
- else -1
871
- )
929
+ peak = full_node_1.full_node.blockchain.get_peak()
930
+ start_height = peak.height if peak is not None else -1
872
931
  peer = await connect_and_get_peer(server_1, server_2, self_hostname)
873
932
  incoming_queue, node_id = await add_dummy_connection(server_1, self_hostname, 12312)
874
933
  fake_peer = server_1.all_connections[node_id]
875
934
  puzzle_hashes = []
876
935
 
877
936
  # Makes a bunch of coins
878
- conditions_dict: dict = {ConditionOpcode.CREATE_COIN: []}
937
+ conditions_dict: dict[ConditionOpcode, list[ConditionWithArgs]] = {ConditionOpcode.CREATE_COIN: []}
879
938
  # This should fit in one transaction
880
939
  for _ in range(100):
881
940
  receiver_puzzlehash = wallet_receiver.get_new_puzzlehash()
@@ -885,7 +944,7 @@ async def test_new_transaction_and_mempool(wallet_nodes, self_hostname, seeded_r
885
944
  conditions_dict[ConditionOpcode.CREATE_COIN].append(output)
886
945
 
887
946
  spend_bundle = wallet_a.generate_signed_transaction(
888
- 100,
947
+ uint64(100),
889
948
  puzzle_hashes[0],
890
949
  get_future_reward_coins(blocks[1])[0],
891
950
  condition_dic=conditions_dict,
@@ -954,7 +1013,7 @@ async def test_new_transaction_and_mempool(wallet_nodes, self_hostname, seeded_r
954
1013
 
955
1014
  fee_rate_for_med = full_node_1.full_node.mempool_manager.mempool.get_min_fee_rate(5000000)
956
1015
  fee_rate_for_large = full_node_1.full_node.mempool_manager.mempool.get_min_fee_rate(50000000)
957
- if fee_rate_for_large > fee_rate_for_med:
1016
+ if fee_rate_for_med is not None and fee_rate_for_large is not None and fee_rate_for_large > fee_rate_for_med:
958
1017
  seen_bigger_transaction_has_high_fee = True
959
1018
 
960
1019
  if req is not None and req.data == bytes(fnp.RespondTransaction(spend_bundle)):
@@ -966,7 +1025,8 @@ async def test_new_transaction_and_mempool(wallet_nodes, self_hostname, seeded_r
966
1025
  successful_bundle = spend_bundle
967
1026
  else:
968
1027
  assert full_node_1.full_node.mempool_manager.mempool.at_full_capacity(10500000 * group_size)
969
- assert full_node_1.full_node.mempool_manager.mempool.get_min_fee_rate(10500000 * group_size) > 0
1028
+ min_fee_rate = full_node_1.full_node.mempool_manager.mempool.get_min_fee_rate(10500000 * group_size)
1029
+ assert min_fee_rate is not None and min_fee_rate > 0
970
1030
  assert not force_high_fee
971
1031
  not_included_tx += 1
972
1032
  assert successful_bundle is not None
@@ -998,6 +1058,7 @@ async def test_new_transaction_and_mempool(wallet_nodes, self_hostname, seeded_r
998
1058
 
999
1059
  # Resubmission through wallet is also fine
1000
1060
  response_msg = await full_node_1.send_transaction(SendTransaction(successful_bundle), test=True)
1061
+ assert response_msg is not None
1001
1062
  assert TransactionAck.from_bytes(response_msg.data).status == MempoolInclusionStatus.SUCCESS.value
1002
1063
 
1003
1064
  # Farm one block to clear mempool
@@ -1033,7 +1094,13 @@ async def test_new_transaction_and_mempool(wallet_nodes, self_hostname, seeded_r
1033
1094
 
1034
1095
 
1035
1096
  @pytest.mark.anyio
1036
- async def test_request_respond_transaction(wallet_nodes, self_hostname, seeded_random: random.Random):
1097
+ async def test_request_respond_transaction(
1098
+ wallet_nodes: tuple[
1099
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1100
+ ],
1101
+ self_hostname: str,
1102
+ seeded_random: random.Random,
1103
+ ) -> None:
1037
1104
  full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
1038
1105
  wallet_ph = wallet_a.get_new_puzzlehash()
1039
1106
  blocks = await full_node_1.get_all_full_blocks()
@@ -1065,7 +1132,7 @@ async def test_request_respond_transaction(wallet_nodes, self_hostname, seeded_r
1065
1132
  receiver_puzzlehash = wallet_receiver.get_new_puzzlehash()
1066
1133
 
1067
1134
  spend_bundle = wallet_a.generate_signed_transaction(
1068
- 100, receiver_puzzlehash, blocks[-1].get_included_reward_coins()[0]
1135
+ uint64(100), receiver_puzzlehash, blocks[-1].get_included_reward_coins()[0]
1069
1136
  )
1070
1137
  assert spend_bundle is not None
1071
1138
  respond_transaction = fnp.RespondTransaction(spend_bundle)
@@ -1082,7 +1149,13 @@ async def test_request_respond_transaction(wallet_nodes, self_hostname, seeded_r
1082
1149
 
1083
1150
 
1084
1151
  @pytest.mark.anyio
1085
- async def test_respond_transaction_fail(wallet_nodes, self_hostname, seeded_random: random.Random):
1152
+ async def test_respond_transaction_fail(
1153
+ wallet_nodes: tuple[
1154
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1155
+ ],
1156
+ self_hostname: str,
1157
+ seeded_random: random.Random,
1158
+ ) -> None:
1086
1159
  full_node_1, _full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
1087
1160
  blocks = await full_node_1.get_all_full_blocks()
1088
1161
  cb_ph = wallet_a.get_new_puzzlehash()
@@ -1115,7 +1188,7 @@ async def test_respond_transaction_fail(wallet_nodes, self_hostname, seeded_rand
1115
1188
  await time_out_assert(10, time_out_messages(incoming_queue, "new_peak", 3))
1116
1189
  # Invalid transaction does not propagate
1117
1190
  spend_bundle = wallet_a.generate_signed_transaction(
1118
- 100000000000000,
1191
+ uint64(100_000_000_000_000),
1119
1192
  receiver_puzzlehash,
1120
1193
  blocks_new[-1].get_included_reward_coins()[0],
1121
1194
  )
@@ -1130,7 +1203,11 @@ async def test_respond_transaction_fail(wallet_nodes, self_hostname, seeded_rand
1130
1203
 
1131
1204
 
1132
1205
  @pytest.mark.anyio
1133
- async def test_request_block(wallet_nodes):
1206
+ async def test_request_block(
1207
+ wallet_nodes: tuple[
1208
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1209
+ ],
1210
+ ) -> None:
1134
1211
  full_node_1, _full_node_2, _server_1, _server_2, wallet_a, wallet_receiver, bt = wallet_nodes
1135
1212
  blocks = await full_node_1.get_all_full_blocks()
1136
1213
 
@@ -1142,7 +1219,7 @@ async def test_request_block(wallet_nodes):
1142
1219
  pool_reward_puzzle_hash=wallet_a.get_new_puzzlehash(),
1143
1220
  )
1144
1221
  spend_bundle = wallet_a.generate_signed_transaction(
1145
- 1123,
1222
+ uint64(1123),
1146
1223
  wallet_receiver.get_new_puzzlehash(),
1147
1224
  blocks[-1].get_included_reward_coins()[0],
1148
1225
  )
@@ -1155,25 +1232,33 @@ async def test_request_block(wallet_nodes):
1155
1232
 
1156
1233
  # Don't have height
1157
1234
  res = await full_node_1.request_block(fnp.RequestBlock(uint32(1248921), False))
1235
+ assert res is not None
1158
1236
  assert res.type == ProtocolMessageTypes.reject_block.value
1159
1237
 
1160
1238
  # Ask without transactions
1161
1239
  res = await full_node_1.request_block(fnp.RequestBlock(blocks[-1].height, False))
1240
+ assert res is not None
1162
1241
  assert res.type != ProtocolMessageTypes.reject_block.value
1163
1242
  assert fnp.RespondBlock.from_bytes(res.data).block.transactions_generator is None
1164
1243
 
1165
1244
  # Ask with transactions
1166
1245
  res = await full_node_1.request_block(fnp.RequestBlock(blocks[-1].height, True))
1246
+ assert res is not None
1167
1247
  assert res.type != ProtocolMessageTypes.reject_block.value
1168
1248
  assert fnp.RespondBlock.from_bytes(res.data).block.transactions_generator is not None
1169
1249
 
1170
1250
  # Ask for another one
1171
- res = await full_node_1.request_block(fnp.RequestBlock(blocks[-1].height - 1, True))
1251
+ res = await full_node_1.request_block(fnp.RequestBlock(uint32(blocks[-1].height - 1), True))
1252
+ assert res is not None
1172
1253
  assert res.type != ProtocolMessageTypes.reject_block.value
1173
1254
 
1174
1255
 
1175
1256
  @pytest.mark.anyio
1176
- async def test_request_blocks(wallet_nodes):
1257
+ async def test_request_blocks(
1258
+ wallet_nodes: tuple[
1259
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1260
+ ],
1261
+ ) -> None:
1177
1262
  full_node_1, _full_node_2, _server_1, _server_2, wallet_a, wallet_receiver, bt = wallet_nodes
1178
1263
  blocks = await full_node_1.get_all_full_blocks()
1179
1264
 
@@ -1187,7 +1272,7 @@ async def test_request_blocks(wallet_nodes):
1187
1272
  )
1188
1273
 
1189
1274
  spend_bundle = wallet_a.generate_signed_transaction(
1190
- 1123,
1275
+ uint64(1123),
1191
1276
  wallet_receiver.get_new_puzzlehash(),
1192
1277
  blocks[-1].get_included_reward_coins()[0],
1193
1278
  )
@@ -1207,18 +1292,21 @@ async def test_request_blocks(wallet_nodes):
1207
1292
  assert len(fetched_blocks) == 1
1208
1293
  assert fetched_blocks[0].header_hash == blocks[4].header_hash
1209
1294
  res = await full_node_1.request_blocks(fnp.RequestBlocks(uint32(5), uint32(4), False))
1295
+ assert res is not None
1210
1296
  assert res.type == ProtocolMessageTypes.reject_blocks.value
1211
1297
  # Invalid range
1212
1298
  res = await full_node_1.request_blocks(fnp.RequestBlocks(uint32(peak_height - 5), uint32(peak_height + 5), False))
1299
+ assert res is not None
1213
1300
  assert res.type == ProtocolMessageTypes.reject_blocks.value
1214
1301
 
1215
1302
  # Try fetching more blocks than constants.MAX_BLOCK_COUNT_PER_REQUESTS
1216
1303
  res = await full_node_1.request_blocks(fnp.RequestBlocks(uint32(0), uint32(33), False))
1304
+ assert res is not None
1217
1305
  assert res.type == ProtocolMessageTypes.reject_blocks.value
1218
1306
 
1219
1307
  # Ask without transactions
1220
1308
  res = await full_node_1.request_blocks(fnp.RequestBlocks(uint32(peak_height - 5), uint32(peak_height), False))
1221
-
1309
+ assert res is not None
1222
1310
  fetched_blocks = fnp.RespondBlocks.from_bytes(res.data).blocks
1223
1311
  assert len(fetched_blocks) == 6
1224
1312
  for b in fetched_blocks:
@@ -1226,6 +1314,7 @@ async def test_request_blocks(wallet_nodes):
1226
1314
 
1227
1315
  # Ask with transactions
1228
1316
  res = await full_node_1.request_blocks(fnp.RequestBlocks(uint32(peak_height - 5), uint32(peak_height), True))
1317
+ assert res is not None
1229
1318
  fetched_blocks = fnp.RespondBlocks.from_bytes(res.data).blocks
1230
1319
  assert len(fetched_blocks) == 6
1231
1320
  assert fetched_blocks[-1].transactions_generator is not None
@@ -1235,7 +1324,14 @@ async def test_request_blocks(wallet_nodes):
1235
1324
  @pytest.mark.anyio
1236
1325
  @pytest.mark.parametrize("peer_version", ["0.0.35", "0.0.36"])
1237
1326
  @pytest.mark.parametrize("requesting", [0, 1, 2])
1238
- async def test_new_unfinished_block(wallet_nodes, peer_version: str, requesting: int, self_hostname: str):
1327
+ async def test_new_unfinished_block(
1328
+ wallet_nodes: tuple[
1329
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1330
+ ],
1331
+ peer_version: str,
1332
+ requesting: int,
1333
+ self_hostname: str,
1334
+ ) -> None:
1239
1335
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
1240
1336
  blocks = await full_node_1.get_all_full_blocks()
1241
1337
 
@@ -1290,7 +1386,13 @@ async def test_new_unfinished_block(wallet_nodes, peer_version: str, requesting:
1290
1386
 
1291
1387
  @pytest.mark.anyio
1292
1388
  @pytest.mark.parametrize("requesting", [0, 1, 2])
1293
- async def test_new_unfinished_block2(wallet_nodes, requesting: int, self_hostname: str):
1389
+ async def test_new_unfinished_block2(
1390
+ wallet_nodes: tuple[
1391
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1392
+ ],
1393
+ requesting: int,
1394
+ self_hostname: str,
1395
+ ) -> None:
1294
1396
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
1295
1397
  blocks = await full_node_1.get_all_full_blocks()
1296
1398
 
@@ -1330,7 +1432,12 @@ async def test_new_unfinished_block2(wallet_nodes, requesting: int, self_hostnam
1330
1432
 
1331
1433
 
1332
1434
  @pytest.mark.anyio
1333
- async def test_new_unfinished_block2_forward_limit(wallet_nodes, self_hostname: str):
1435
+ async def test_new_unfinished_block2_forward_limit(
1436
+ wallet_nodes: tuple[
1437
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1438
+ ],
1439
+ self_hostname: str,
1440
+ ) -> None:
1334
1441
  full_node_1, _full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
1335
1442
  blocks = bt.get_consecutive_blocks(3, guarantee_transaction_block=True)
1336
1443
  for block in blocks:
@@ -1353,7 +1460,7 @@ async def test_new_unfinished_block2_forward_limit(wallet_nodes, self_hostname:
1353
1460
  for idx in range(0, 6):
1354
1461
  # we include a different transaction in each block. This makes the
1355
1462
  # foliage different in each of them, but the reward block (plot) the same
1356
- tx = wallet_a.generate_signed_transaction(100 * (idx + 1), puzzle_hash, coin)
1463
+ tx = wallet_a.generate_signed_transaction(uint64(100 * (idx + 1)), puzzle_hash, coin)
1357
1464
 
1358
1465
  # note that we use the same chain to build the new block on top of every time
1359
1466
  block = bt.get_consecutive_blocks(
@@ -1404,7 +1511,14 @@ async def test_new_unfinished_block2_forward_limit(wallet_nodes, self_hostname:
1404
1511
  (7, Err.TOO_MANY_GENERATOR_REFS),
1405
1512
  ],
1406
1513
  )
1407
- async def test_unfinished_block_with_replaced_generator(wallet_nodes, self_hostname, committment, expected):
1514
+ async def test_unfinished_block_with_replaced_generator(
1515
+ wallet_nodes: tuple[
1516
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1517
+ ],
1518
+ self_hostname: str,
1519
+ committment: int,
1520
+ expected: Err,
1521
+ ) -> None:
1408
1522
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
1409
1523
  blocks = await full_node_1.get_all_full_blocks()
1410
1524
 
@@ -1418,6 +1532,7 @@ async def test_unfinished_block_with_replaced_generator(wallet_nodes, self_hostn
1418
1532
 
1419
1533
  if committment > 0:
1420
1534
  tr = block.transactions_info
1535
+ assert tr is not None
1421
1536
  transactions_info = TransactionsInfo(
1422
1537
  std_hash(bytes(replaced_generator)),
1423
1538
  tr.generator_refs_root,
@@ -1427,10 +1542,12 @@ async def test_unfinished_block_with_replaced_generator(wallet_nodes, self_hostn
1427
1542
  tr.reward_claims_incorporated,
1428
1543
  )
1429
1544
  else:
1545
+ assert block.transactions_info is not None
1430
1546
  transactions_info = block.transactions_info
1431
1547
 
1432
1548
  if committment > 1:
1433
1549
  tb = block.foliage_transaction_block
1550
+ assert tb is not None
1434
1551
  transaction_block = FoliageTransactionBlock(
1435
1552
  tb.prev_transaction_block_hash,
1436
1553
  tb.timestamp,
@@ -1440,6 +1557,7 @@ async def test_unfinished_block_with_replaced_generator(wallet_nodes, self_hostn
1440
1557
  transactions_info.get_hash(),
1441
1558
  )
1442
1559
  else:
1560
+ assert block.foliage_transaction_block is not None
1443
1561
  transaction_block = block.foliage_transaction_block
1444
1562
 
1445
1563
  if committment > 2:
@@ -1476,7 +1594,8 @@ async def test_unfinished_block_with_replaced_generator(wallet_nodes, self_hostn
1476
1594
 
1477
1595
  if committment > 5:
1478
1596
  if pos.pool_public_key is None:
1479
- plot_id = calculate_plot_id_pk(pos.pool_contract_puzzle_hash, public_key)
1597
+ assert pos.pool_contract_puzzle_hash is not None
1598
+ plot_id = calculate_plot_id_ph(pos.pool_contract_puzzle_hash, public_key)
1480
1599
  else:
1481
1600
  plot_id = calculate_plot_id_pk(pos.pool_public_key, public_key)
1482
1601
  original_challenge_hash = block.reward_chain_block.pos_ss_cc_challenge_hash
@@ -1544,7 +1663,12 @@ async def test_unfinished_block_with_replaced_generator(wallet_nodes, self_hostn
1544
1663
 
1545
1664
 
1546
1665
  @pytest.mark.anyio
1547
- async def test_double_blocks_same_pospace(wallet_nodes, self_hostname):
1666
+ async def test_double_blocks_same_pospace(
1667
+ wallet_nodes: tuple[
1668
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1669
+ ],
1670
+ self_hostname: str,
1671
+ ) -> None:
1548
1672
  full_node_1, full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
1549
1673
 
1550
1674
  incoming_queue, dummy_node_id = await add_dummy_connection(server_1, self_hostname, 12315)
@@ -1558,7 +1682,7 @@ async def test_double_blocks_same_pospace(wallet_nodes, self_hostname):
1558
1682
  blocks: list[FullBlock] = await full_node_1.get_all_full_blocks()
1559
1683
 
1560
1684
  coin = blocks[-1].get_included_reward_coins()[0]
1561
- tx = wallet_a.generate_signed_transaction(10000, wallet_receiver.get_new_puzzlehash(), coin)
1685
+ tx = wallet_a.generate_signed_transaction(uint64(10_000), wallet_receiver.get_new_puzzlehash(), coin)
1562
1686
 
1563
1687
  blocks = bt.get_consecutive_blocks(
1564
1688
  1, block_list_input=blocks, guarantee_transaction_block=True, transaction_data=tx
@@ -1569,6 +1693,7 @@ async def test_double_blocks_same_pospace(wallet_nodes, self_hostname):
1569
1693
  await full_node_1.full_node.add_unfinished_block(unf, dummy_peer)
1570
1694
  assert full_node_1.full_node.full_node_store.get_unfinished_block(unf.partial_hash)
1571
1695
 
1696
+ assert unf.foliage_transaction_block is not None
1572
1697
  block_2 = recursive_replace(
1573
1698
  blocks[-1], "foliage_transaction_block.timestamp", unf.foliage_transaction_block.timestamp + 1
1574
1699
  )
@@ -1584,14 +1709,19 @@ async def test_double_blocks_same_pospace(wallet_nodes, self_hostname):
1584
1709
 
1585
1710
 
1586
1711
  @pytest.mark.anyio
1587
- async def test_request_unfinished_block(wallet_nodes, self_hostname):
1712
+ async def test_request_unfinished_block(
1713
+ wallet_nodes: tuple[
1714
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1715
+ ],
1716
+ self_hostname: str,
1717
+ ) -> None:
1588
1718
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
1589
1719
  blocks = await full_node_1.get_all_full_blocks()
1590
1720
  peer = await connect_and_get_peer(server_1, server_2, self_hostname)
1591
1721
  blocks = bt.get_consecutive_blocks(10, block_list_input=blocks, seed=b"12345")
1592
1722
  for block in blocks[:-1]:
1593
1723
  await full_node_1.full_node.add_block(block)
1594
- block: FullBlock = blocks[-1]
1724
+ block = blocks[-1]
1595
1725
  unf = make_unfinished_block(block, bt.constants)
1596
1726
 
1597
1727
  # Don't have
@@ -1604,7 +1734,12 @@ async def test_request_unfinished_block(wallet_nodes, self_hostname):
1604
1734
 
1605
1735
 
1606
1736
  @pytest.mark.anyio
1607
- async def test_request_unfinished_block2(wallet_nodes, self_hostname):
1737
+ async def test_request_unfinished_block2(
1738
+ wallet_nodes: tuple[
1739
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1740
+ ],
1741
+ self_hostname: str,
1742
+ ) -> None:
1608
1743
  full_node_1, _full_node_2, server_1, server_2, wallet_a, wallet_receiver, bt = wallet_nodes
1609
1744
  blocks = await full_node_1.get_all_full_blocks()
1610
1745
  blocks = bt.get_consecutive_blocks(3, guarantee_transaction_block=True)
@@ -1622,7 +1757,7 @@ async def test_request_unfinished_block2(wallet_nodes, self_hostname):
1622
1757
  for idx in range(0, 6):
1623
1758
  # we include a different transaction in each block. This makes the
1624
1759
  # foliage different in each of them, but the reward block (plot) the same
1625
- tx = wallet_a.generate_signed_transaction(100 * (idx + 1), puzzle_hash, coin)
1760
+ tx = wallet_a.generate_signed_transaction(uint64(100 * (idx + 1)), puzzle_hash, coin)
1626
1761
 
1627
1762
  # note that we use the same chain to build the new block on top of every time
1628
1763
  block = bt.get_consecutive_blocks(
@@ -1634,7 +1769,7 @@ async def test_request_unfinished_block2(wallet_nodes, self_hostname):
1634
1769
  if best_unf is None:
1635
1770
  best_unf = unf
1636
1771
  elif (
1637
- unf.foliage.foliage_transaction_block_hash is not None
1772
+ best_unf.foliage.foliage_transaction_block_hash is not None
1638
1773
  and unf.foliage.foliage_transaction_block_hash < best_unf.foliage.foliage_transaction_block_hash
1639
1774
  ):
1640
1775
  best_unf = unf
@@ -1650,17 +1785,25 @@ async def test_request_unfinished_block2(wallet_nodes, self_hostname):
1650
1785
  res = await full_node_1.request_unfinished_block2(
1651
1786
  fnp.RequestUnfinishedBlock2(unf.partial_hash, unf.foliage.foliage_transaction_block_hash)
1652
1787
  )
1788
+ assert res is not None
1653
1789
  assert res.data == bytes(fnp.RespondUnfinishedBlock(unf))
1654
1790
 
1655
1791
  res = await full_node_1.request_unfinished_block(fnp.RequestUnfinishedBlock(unf.partial_hash))
1792
+ assert res is not None
1656
1793
  assert res.data == bytes(fnp.RespondUnfinishedBlock(best_unf))
1657
1794
 
1658
1795
  res = await full_node_1.request_unfinished_block2(fnp.RequestUnfinishedBlock2(unf.partial_hash, None))
1796
+ assert res is not None
1659
1797
  assert res.data == bytes(fnp.RespondUnfinishedBlock(best_unf))
1660
1798
 
1661
1799
 
1662
1800
  @pytest.mark.anyio
1663
- async def test_new_signage_point_or_end_of_sub_slot(wallet_nodes, self_hostname):
1801
+ async def test_new_signage_point_or_end_of_sub_slot(
1802
+ wallet_nodes: tuple[
1803
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1804
+ ],
1805
+ self_hostname: str,
1806
+ ) -> None:
1664
1807
  full_node_1, full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
1665
1808
  blocks = await full_node_1.get_all_full_blocks()
1666
1809
 
@@ -1671,7 +1814,7 @@ async def test_new_signage_point_or_end_of_sub_slot(wallet_nodes, self_hostname)
1671
1814
 
1672
1815
  blockchain = full_node_1.full_node.blockchain
1673
1816
  peak = blockchain.get_peak()
1674
-
1817
+ assert peak is not None
1675
1818
  sp = get_signage_point(
1676
1819
  bt.constants,
1677
1820
  blockchain,
@@ -1681,11 +1824,14 @@ async def test_new_signage_point_or_end_of_sub_slot(wallet_nodes, self_hostname)
1681
1824
  [],
1682
1825
  peak.sub_slot_iters,
1683
1826
  )
1827
+ assert sp.cc_vdf is not None
1828
+ assert sp.rc_vdf is not None
1684
1829
 
1685
1830
  peer = await connect_and_get_peer(server_1, server_2, self_hostname)
1686
1831
  res = await full_node_1.new_signage_point_or_end_of_sub_slot(
1687
1832
  fnp.NewSignagePointOrEndOfSubSlot(None, sp.cc_vdf.challenge, uint8(11), sp.rc_vdf.challenge), peer
1688
1833
  )
1834
+ assert res is not None
1689
1835
  assert res.type == ProtocolMessageTypes.request_signage_point_or_end_of_sub_slot.value
1690
1836
  assert fnp.RequestSignagePointOrEndOfSubSlot.from_bytes(res.data).index_from_challenge == uint8(11)
1691
1837
 
@@ -1709,14 +1855,20 @@ async def test_new_signage_point_or_end_of_sub_slot(wallet_nodes, self_hostname)
1709
1855
 
1710
1856
  assert len(full_node_1.full_node.full_node_store.finished_sub_slots) >= num_slots
1711
1857
 
1712
- def caught_up_slots():
1858
+ def caught_up_slots() -> bool:
1713
1859
  return len(full_node_2.full_node.full_node_store.finished_sub_slots) >= num_slots
1714
1860
 
1715
1861
  await time_out_assert(20, caught_up_slots)
1716
1862
 
1717
1863
 
1718
1864
  @pytest.mark.anyio
1719
- async def test_new_signage_point_caching(wallet_nodes, empty_blockchain, self_hostname):
1865
+ async def test_new_signage_point_caching(
1866
+ wallet_nodes: tuple[
1867
+ FullNodeSimulator, FullNodeSimulator, ChiaServer, ChiaServer, WalletTool, WalletTool, BlockTools
1868
+ ],
1869
+ empty_blockchain: Blockchain,
1870
+ self_hostname: str,
1871
+ ) -> None:
1720
1872
  full_node_1, _full_node_2, server_1, server_2, _wallet_a, _wallet_receiver, bt = wallet_nodes
1721
1873
  blocks = await full_node_1.get_all_full_blocks()
1722
1874
 
@@ -1732,7 +1884,7 @@ async def test_new_signage_point_caching(wallet_nodes, empty_blockchain, self_ho
1732
1884
  blocks = bt.get_consecutive_blocks(1, block_list_input=blocks, skip_slots=1, force_overflow=True)
1733
1885
  for ss in blocks[-1].finished_sub_slots:
1734
1886
  challenge_chain = ss.challenge_chain.replace(
1735
- new_difficulty=20,
1887
+ new_difficulty=uint64(20),
1736
1888
  )
1737
1889
  slot2 = ss.replace(
1738
1890
  challenge_chain=challenge_chain,
@@ -1745,6 +1897,7 @@ async def test_new_signage_point_caching(wallet_nodes, empty_blockchain, self_ho
1745
1897
 
1746
1898
  # Creates a signage point based on the last block
1747
1899
  peak_2 = second_blockchain.get_peak()
1900
+ assert peak_2 is not None
1748
1901
  sp: SignagePoint = get_signage_point(
1749
1902
  bt.constants,
1750
1903
  blockchain,
@@ -1754,13 +1907,17 @@ async def test_new_signage_point_caching(wallet_nodes, empty_blockchain, self_ho
1754
1907
  [],
1755
1908
  peak_2.sub_slot_iters,
1756
1909
  )
1910
+ assert sp.cc_vdf is not None
1911
+ assert sp.cc_proof is not None
1912
+ assert sp.rc_vdf is not None
1913
+ assert sp.rc_proof is not None
1757
1914
  # Submits the signage point, cannot add because don't have block
1758
1915
  await full_node_1.respond_signage_point(
1759
- fnp.RespondSignagePoint(4, sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer
1916
+ fnp.RespondSignagePoint(uint8(4), sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer
1760
1917
  )
1761
1918
  # Should not add duplicates to cache though
1762
1919
  await full_node_1.respond_signage_point(
1763
- fnp.RespondSignagePoint(4, sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer
1920
+ fnp.RespondSignagePoint(uint8(4), sp.cc_vdf, sp.cc_proof, sp.rc_vdf, sp.rc_proof), peer
1764
1921
  )
1765
1922
  assert full_node_1.full_node.full_node_store.get_signage_point(sp.cc_vdf.output.get_hash()) is None
1766
1923
  assert len(full_node_1.full_node.full_node_store.future_sp_cache[sp.rc_vdf.challenge]) == 1
@@ -1769,12 +1926,14 @@ async def test_new_signage_point_caching(wallet_nodes, empty_blockchain, self_ho
1769
1926
  await full_node_1.full_node.add_block(blocks[-1], peer)
1770
1927
 
1771
1928
  # Now signage point should be added
1772
- sp = full_node_1.full_node.full_node_store.get_signage_point(sp.cc_vdf.output.get_hash())
1773
- assert sp is not None
1929
+ assert full_node_1.full_node.full_node_store.get_signage_point(sp.cc_vdf.output.get_hash()) is not None
1774
1930
 
1775
1931
 
1776
1932
  @pytest.mark.anyio
1777
- async def test_slot_catch_up_genesis(setup_two_nodes_fixture, self_hostname):
1933
+ async def test_slot_catch_up_genesis(
1934
+ setup_two_nodes_fixture: tuple[list[FullNodeSimulator], list[tuple[WalletNode, ChiaServer]], BlockTools],
1935
+ self_hostname: str,
1936
+ ) -> None:
1778
1937
  nodes, _, bt = setup_two_nodes_fixture
1779
1938
  server_1 = nodes[0].full_node.server
1780
1939
  server_2 = nodes[1].full_node.server
@@ -1799,14 +1958,16 @@ async def test_slot_catch_up_genesis(setup_two_nodes_fixture, self_hostname):
1799
1958
 
1800
1959
  assert len(full_node_1.full_node.full_node_store.finished_sub_slots) >= num_slots
1801
1960
 
1802
- def caught_up_slots():
1961
+ def caught_up_slots() -> bool:
1803
1962
  return len(full_node_2.full_node.full_node_store.finished_sub_slots) >= num_slots
1804
1963
 
1805
1964
  await time_out_assert(20, caught_up_slots)
1806
1965
 
1807
1966
 
1808
1967
  @pytest.mark.anyio
1809
- async def test_compact_protocol(setup_two_nodes_fixture):
1968
+ async def test_compact_protocol(
1969
+ setup_two_nodes_fixture: tuple[list[FullNodeSimulator], list[tuple[WalletNode, ChiaServer]], BlockTools],
1970
+ ) -> None:
1810
1971
  nodes, _, bt = setup_two_nodes_fixture
1811
1972
  full_node_1 = nodes[0]
1812
1973
  full_node_2 = nodes[1]
@@ -1831,7 +1992,7 @@ async def test_compact_protocol(setup_two_nodes_fixture):
1831
1992
  vdf_proof,
1832
1993
  block.header_hash,
1833
1994
  block.height,
1834
- CompressibleVDFField.CC_EOS_VDF,
1995
+ uint8(CompressibleVDFField.CC_EOS_VDF),
1835
1996
  )
1836
1997
  )
1837
1998
  blocks_2 = bt.get_consecutive_blocks(num_blocks=10, block_list_input=blocks, skip_slots=3)
@@ -1855,7 +2016,7 @@ async def test_compact_protocol(setup_two_nodes_fixture):
1855
2016
  vdf_proof,
1856
2017
  block.header_hash,
1857
2018
  block.height,
1858
- CompressibleVDFField.ICC_EOS_VDF,
2019
+ uint8(CompressibleVDFField.ICC_EOS_VDF),
1859
2020
  )
1860
2021
  )
1861
2022
  assert block.reward_chain_block.challenge_chain_sp_vdf is not None
@@ -1872,7 +2033,7 @@ async def test_compact_protocol(setup_two_nodes_fixture):
1872
2033
  vdf_proof,
1873
2034
  block.header_hash,
1874
2035
  block.height,
1875
- CompressibleVDFField.CC_SP_VDF,
2036
+ uint8(CompressibleVDFField.CC_SP_VDF),
1876
2037
  )
1877
2038
  )
1878
2039
  vdf_info, vdf_proof = get_vdf_info_and_proof(
@@ -1888,7 +2049,7 @@ async def test_compact_protocol(setup_two_nodes_fixture):
1888
2049
  vdf_proof,
1889
2050
  block.header_hash,
1890
2051
  block.height,
1891
- CompressibleVDFField.CC_IP_VDF,
2052
+ uint8(CompressibleVDFField.CC_IP_VDF),
1892
2053
  )
1893
2054
  )
1894
2055
 
@@ -1921,11 +2082,16 @@ async def test_compact_protocol(setup_two_nodes_fixture):
1921
2082
  assert has_compact_cc_ip_vdf
1922
2083
  for height, block in enumerate(stored_blocks):
1923
2084
  await full_node_2.full_node.add_block(block)
1924
- assert full_node_2.full_node.blockchain.get_peak().height == height
2085
+ peak = full_node_2.full_node.blockchain.get_peak()
2086
+ assert peak is not None
2087
+ assert peak.height == height
1925
2088
 
1926
2089
 
1927
2090
  @pytest.mark.anyio
1928
- async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_hostname):
2091
+ async def test_compact_protocol_invalid_messages(
2092
+ setup_two_nodes_fixture: tuple[list[FullNodeSimulator], list[tuple[WalletNode, ChiaServer]], BlockTools],
2093
+ self_hostname: str,
2094
+ ) -> None:
1929
2095
  nodes, _, bt = setup_two_nodes_fixture
1930
2096
  full_node_1 = nodes[0]
1931
2097
  full_node_2 = nodes[1]
@@ -1933,7 +2099,9 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
1933
2099
  blocks_2 = bt.get_consecutive_blocks(num_blocks=3, block_list_input=blocks, skip_slots=3)
1934
2100
  for block in blocks_2[:2]:
1935
2101
  await full_node_1.full_node.add_block(block)
1936
- assert full_node_1.full_node.blockchain.get_peak().height == 1
2102
+ peak = full_node_1.full_node.blockchain.get_peak()
2103
+ assert peak is not None
2104
+ assert peak.height == 1
1937
2105
  # (wrong_vdf_info, wrong_vdf_proof) pair verifies, but it's not present in the blockchain at all.
1938
2106
  block = blocks_2[2]
1939
2107
  wrong_vdf_info, wrong_vdf_proof = get_vdf_info_and_proof(
@@ -1943,8 +2111,8 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
1943
2111
  block.reward_chain_block.challenge_chain_ip_vdf.number_of_iterations,
1944
2112
  True,
1945
2113
  )
1946
- timelord_protocol_invalid_messages = []
1947
- full_node_protocol_invalid_messaages = []
2114
+ timelord_protocol_invalid_messages: list[timelord_protocol.RespondCompactProofOfTime] = []
2115
+ full_node_protocol_invalid_messages: list[fnp.RespondCompactVDF] = []
1948
2116
  for block in blocks_2[:2]:
1949
2117
  for sub_slot in block.finished_sub_slots:
1950
2118
  vdf_info, correct_vdf_proof = get_vdf_info_and_proof(
@@ -1961,14 +2129,14 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
1961
2129
  wrong_vdf_proof,
1962
2130
  block.header_hash,
1963
2131
  block.height,
1964
- CompressibleVDFField.CC_EOS_VDF,
2132
+ uint8(CompressibleVDFField.CC_EOS_VDF),
1965
2133
  )
1966
2134
  )
1967
- full_node_protocol_invalid_messaages.append(
2135
+ full_node_protocol_invalid_messages.append(
1968
2136
  fnp.RespondCompactVDF(
1969
2137
  block.height,
1970
2138
  block.header_hash,
1971
- CompressibleVDFField.CC_EOS_VDF,
2139
+ uint8(CompressibleVDFField.CC_EOS_VDF),
1972
2140
  vdf_info,
1973
2141
  wrong_vdf_proof,
1974
2142
  )
@@ -1988,14 +2156,14 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
1988
2156
  wrong_vdf_proof,
1989
2157
  block.header_hash,
1990
2158
  block.height,
1991
- CompressibleVDFField.ICC_EOS_VDF,
2159
+ uint8(CompressibleVDFField.ICC_EOS_VDF),
1992
2160
  )
1993
2161
  )
1994
- full_node_protocol_invalid_messaages.append(
2162
+ full_node_protocol_invalid_messages.append(
1995
2163
  fnp.RespondCompactVDF(
1996
2164
  block.height,
1997
2165
  block.header_hash,
1998
- CompressibleVDFField.ICC_EOS_VDF,
2166
+ uint8(CompressibleVDFField.ICC_EOS_VDF),
1999
2167
  vdf_info,
2000
2168
  wrong_vdf_proof,
2001
2169
  )
@@ -2019,14 +2187,14 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
2019
2187
  sp_vdf_proof,
2020
2188
  block.header_hash,
2021
2189
  block.height,
2022
- CompressibleVDFField.CC_SP_VDF,
2190
+ uint8(CompressibleVDFField.CC_SP_VDF),
2023
2191
  )
2024
2192
  )
2025
- full_node_protocol_invalid_messaages.append(
2193
+ full_node_protocol_invalid_messages.append(
2026
2194
  fnp.RespondCompactVDF(
2027
2195
  block.height,
2028
2196
  block.header_hash,
2029
- CompressibleVDFField.CC_SP_VDF,
2197
+ uint8(CompressibleVDFField.CC_SP_VDF),
2030
2198
  vdf_info,
2031
2199
  sp_vdf_proof,
2032
2200
  )
@@ -2049,14 +2217,14 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
2049
2217
  ip_vdf_proof,
2050
2218
  block.header_hash,
2051
2219
  block.height,
2052
- CompressibleVDFField.CC_IP_VDF,
2220
+ uint8(CompressibleVDFField.CC_IP_VDF),
2053
2221
  )
2054
2222
  )
2055
- full_node_protocol_invalid_messaages.append(
2223
+ full_node_protocol_invalid_messages.append(
2056
2224
  fnp.RespondCompactVDF(
2057
2225
  block.height,
2058
2226
  block.header_hash,
2059
- CompressibleVDFField.CC_IP_VDF,
2227
+ uint8(CompressibleVDFField.CC_IP_VDF),
2060
2228
  vdf_info,
2061
2229
  ip_vdf_proof,
2062
2230
  )
@@ -2068,7 +2236,7 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
2068
2236
  wrong_vdf_proof,
2069
2237
  block.header_hash,
2070
2238
  block.height,
2071
- CompressibleVDFField.CC_EOS_VDF,
2239
+ uint8(CompressibleVDFField.CC_EOS_VDF),
2072
2240
  )
2073
2241
  )
2074
2242
  timelord_protocol_invalid_messages.append(
@@ -2077,7 +2245,7 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
2077
2245
  wrong_vdf_proof,
2078
2246
  block.header_hash,
2079
2247
  block.height,
2080
- CompressibleVDFField.ICC_EOS_VDF,
2248
+ uint8(CompressibleVDFField.ICC_EOS_VDF),
2081
2249
  )
2082
2250
  )
2083
2251
  timelord_protocol_invalid_messages.append(
@@ -2086,7 +2254,7 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
2086
2254
  wrong_vdf_proof,
2087
2255
  block.header_hash,
2088
2256
  block.height,
2089
- CompressibleVDFField.CC_SP_VDF,
2257
+ uint8(CompressibleVDFField.CC_SP_VDF),
2090
2258
  )
2091
2259
  )
2092
2260
  timelord_protocol_invalid_messages.append(
@@ -2095,41 +2263,41 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
2095
2263
  wrong_vdf_proof,
2096
2264
  block.header_hash,
2097
2265
  block.height,
2098
- CompressibleVDFField.CC_IP_VDF,
2266
+ uint8(CompressibleVDFField.CC_IP_VDF),
2099
2267
  )
2100
2268
  )
2101
- full_node_protocol_invalid_messaages.append(
2269
+ full_node_protocol_invalid_messages.append(
2102
2270
  fnp.RespondCompactVDF(
2103
2271
  block.height,
2104
2272
  block.header_hash,
2105
- CompressibleVDFField.CC_EOS_VDF,
2273
+ uint8(CompressibleVDFField.CC_EOS_VDF),
2106
2274
  wrong_vdf_info,
2107
2275
  wrong_vdf_proof,
2108
2276
  )
2109
2277
  )
2110
- full_node_protocol_invalid_messaages.append(
2278
+ full_node_protocol_invalid_messages.append(
2111
2279
  fnp.RespondCompactVDF(
2112
2280
  block.height,
2113
2281
  block.header_hash,
2114
- CompressibleVDFField.ICC_EOS_VDF,
2282
+ uint8(CompressibleVDFField.ICC_EOS_VDF),
2115
2283
  wrong_vdf_info,
2116
2284
  wrong_vdf_proof,
2117
2285
  )
2118
2286
  )
2119
- full_node_protocol_invalid_messaages.append(
2287
+ full_node_protocol_invalid_messages.append(
2120
2288
  fnp.RespondCompactVDF(
2121
2289
  block.height,
2122
2290
  block.header_hash,
2123
- CompressibleVDFField.CC_SP_VDF,
2291
+ uint8(CompressibleVDFField.CC_SP_VDF),
2124
2292
  wrong_vdf_info,
2125
2293
  wrong_vdf_proof,
2126
2294
  )
2127
2295
  )
2128
- full_node_protocol_invalid_messaages.append(
2296
+ full_node_protocol_invalid_messages.append(
2129
2297
  fnp.RespondCompactVDF(
2130
2298
  block.height,
2131
2299
  block.header_hash,
2132
- CompressibleVDFField.CC_IP_VDF,
2300
+ uint8(CompressibleVDFField.CC_IP_VDF),
2133
2301
  wrong_vdf_info,
2134
2302
  wrong_vdf_proof,
2135
2303
  )
@@ -2139,8 +2307,8 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
2139
2307
  peer = await connect_and_get_peer(server_1, server_2, self_hostname)
2140
2308
  for invalid_compact_proof in timelord_protocol_invalid_messages:
2141
2309
  await full_node_1.full_node.add_compact_proof_of_time(invalid_compact_proof)
2142
- for invalid_compact_proof in full_node_protocol_invalid_messaages:
2143
- await full_node_1.full_node.add_compact_vdf(invalid_compact_proof, peer)
2310
+ for invalid_compact_vdf in full_node_protocol_invalid_messages:
2311
+ await full_node_1.full_node.add_compact_vdf(invalid_compact_vdf, peer)
2144
2312
  stored_blocks = await full_node_1.get_all_full_blocks()
2145
2313
  for block in stored_blocks:
2146
2314
  for sub_slot in block.finished_sub_slots:
@@ -2153,7 +2321,9 @@ async def test_compact_protocol_invalid_messages(setup_two_nodes_fixture, self_h
2153
2321
 
2154
2322
 
2155
2323
  @pytest.mark.anyio
2156
- async def test_respond_compact_proof_message_limit(setup_two_nodes_fixture):
2324
+ async def test_respond_compact_proof_message_limit(
2325
+ setup_two_nodes_fixture: tuple[list[FullNodeSimulator], list[tuple[WalletNode, ChiaServer]], BlockTools],
2326
+ ) -> None:
2157
2327
  nodes, _, bt = setup_two_nodes_fixture
2158
2328
  full_node_1 = nodes[0]
2159
2329
  full_node_2 = nodes[1]
@@ -2178,11 +2348,11 @@ async def test_respond_compact_proof_message_limit(setup_two_nodes_fixture):
2178
2348
  vdf_proof,
2179
2349
  block.header_hash,
2180
2350
  block.height,
2181
- CompressibleVDFField.CC_IP_VDF,
2351
+ uint8(CompressibleVDFField.CC_IP_VDF),
2182
2352
  )
2183
2353
  )
2184
2354
 
2185
- async def coro(full_node, compact_proof):
2355
+ async def coro(full_node: FullNodeSimulator, compact_proof: timelord_protocol.RespondCompactProofOfTime) -> None:
2186
2356
  await full_node.respond_compact_proof_of_time(compact_proof)
2187
2357
 
2188
2358
  full_node_1.full_node._compact_vdf_sem = LimitedSemaphore.create(active_limit=1, waiting_limit=2)
@@ -2370,12 +2540,12 @@ async def validate_coin_set(coin_store: CoinStore, blocks: list[FullBlock]) -> N
2370
2540
  @pytest.mark.parametrize("light_blocks", [True, False])
2371
2541
  async def test_long_reorg(
2372
2542
  light_blocks: bool,
2373
- one_node_one_block,
2543
+ one_node_one_block: tuple[FullNodeSimulator, ChiaServer, BlockTools],
2374
2544
  default_10000_blocks: list[FullBlock],
2375
2545
  test_long_reorg_1500_blocks: list[FullBlock],
2376
2546
  test_long_reorg_1500_blocks_light: list[FullBlock],
2377
2547
  seeded_random: random.Random,
2378
- ):
2548
+ ) -> None:
2379
2549
  node, _server, _bt = one_node_one_block
2380
2550
 
2381
2551
  fork_point = 1499
@@ -2390,6 +2560,7 @@ async def test_long_reorg(
2390
2560
 
2391
2561
  await add_blocks_in_batches(blocks, node.full_node)
2392
2562
  peak = node.full_node.blockchain.get_peak()
2563
+ assert peak is not None
2393
2564
  chain_1_height = peak.height
2394
2565
  chain_1_weight = peak.weight
2395
2566
  chain_1_peak = peak.header_hash
@@ -2397,6 +2568,7 @@ async def test_long_reorg(
2397
2568
  assert reorg_blocks[fork_point] == default_10000_blocks[fork_point]
2398
2569
  assert reorg_blocks[fork_point + 1] != default_10000_blocks[fork_point + 1]
2399
2570
 
2571
+ assert node.full_node._coin_store is not None
2400
2572
  await validate_coin_set(node.full_node._coin_store, blocks)
2401
2573
 
2402
2574
  # one aspect of this test is to make sure we can reorg blocks that are
@@ -2406,6 +2578,7 @@ async def test_long_reorg(
2406
2578
  await add_blocks_in_batches(reorg_blocks, node.full_node)
2407
2579
  # if these asserts fires, there was no reorg
2408
2580
  peak = node.full_node.blockchain.get_peak()
2581
+ assert peak is not None
2409
2582
  assert peak.header_hash != chain_1_peak
2410
2583
  assert peak.weight > chain_1_weight
2411
2584
  chain_2_weight = peak.weight
@@ -2424,7 +2597,7 @@ async def test_long_reorg(
2424
2597
  # this exercises the case where we have some of the blocks in the DB already
2425
2598
  node.full_node.blockchain.clean_block_records()
2426
2599
  # when using add_block manualy we must warmup the cache
2427
- await node.full_node.blockchain.warmup(fork_point - 100)
2600
+ await node.full_node.blockchain.warmup(uint32(fork_point - 100))
2428
2601
  if light_blocks:
2429
2602
  blocks = default_10000_blocks[fork_point - 100 : 3200]
2430
2603
  else:
@@ -2432,6 +2605,7 @@ async def test_long_reorg(
2432
2605
  await add_blocks_in_batches(blocks, node.full_node)
2433
2606
  # if these asserts fires, there was no reorg back to the original chain
2434
2607
  peak = node.full_node.blockchain.get_peak()
2608
+ assert peak is not None
2435
2609
  assert peak.header_hash != chain_2_peak
2436
2610
  assert peak.weight > chain_2_weight
2437
2611
 
@@ -2447,7 +2621,7 @@ async def test_long_reorg_nodes(
2447
2621
  light_blocks: bool,
2448
2622
  chain_length: int,
2449
2623
  fork_point: int,
2450
- three_nodes,
2624
+ three_nodes: list[FullNodeAPI],
2451
2625
  default_10000_blocks: list[FullBlock],
2452
2626
  test_long_reorg_blocks: list[FullBlock],
2453
2627
  test_long_reorg_blocks_light: list[FullBlock],
@@ -2455,9 +2629,13 @@ async def test_long_reorg_nodes(
2455
2629
  test_long_reorg_1500_blocks_light: list[FullBlock],
2456
2630
  self_hostname: str,
2457
2631
  seeded_random: random.Random,
2458
- ):
2632
+ ) -> None:
2459
2633
  full_node_1, full_node_2, full_node_3 = three_nodes
2460
2634
 
2635
+ assert full_node_1.full_node._coin_store is not None
2636
+ assert full_node_2.full_node._coin_store is not None
2637
+ assert full_node_3.full_node._coin_store is not None
2638
+
2461
2639
  if fork_point == 1500:
2462
2640
  blocks = default_10000_blocks[: 3600 - chain_length]
2463
2641
  else:
@@ -2492,13 +2670,14 @@ async def test_long_reorg_nodes(
2492
2670
 
2493
2671
  start = time.monotonic()
2494
2672
 
2495
- def check_nodes_in_sync():
2673
+ def check_nodes_in_sync() -> bool:
2496
2674
  p1 = full_node_2.full_node.blockchain.get_peak()
2497
2675
  p2 = full_node_1.full_node.blockchain.get_peak()
2498
2676
  return p1 == p2
2499
2677
 
2500
2678
  await time_out_assert(100, check_nodes_in_sync)
2501
2679
  peak = full_node_2.full_node.blockchain.get_peak()
2680
+ assert peak is not None
2502
2681
  print(f"peak: {str(peak.header_hash)[:6]}")
2503
2682
 
2504
2683
  reorg1_timing = time.monotonic() - start
@@ -2506,7 +2685,9 @@ async def test_long_reorg_nodes(
2506
2685
  p1 = full_node_1.full_node.blockchain.get_peak()
2507
2686
  p2 = full_node_2.full_node.blockchain.get_peak()
2508
2687
 
2688
+ assert p1 is not None
2509
2689
  assert p1.header_hash == reorg_blocks[-1].header_hash
2690
+ assert p2 is not None
2510
2691
  assert p2.header_hash == reorg_blocks[-1].header_hash
2511
2692
 
2512
2693
  await validate_coin_set(full_node_1.full_node._coin_store, reorg_blocks)
@@ -2526,7 +2707,7 @@ async def test_long_reorg_nodes(
2526
2707
 
2527
2708
  start = time.monotonic()
2528
2709
 
2529
- def check_nodes_in_sync2():
2710
+ def check_nodes_in_sync2() -> bool:
2530
2711
  p1 = full_node_1.full_node.blockchain.get_peak()
2531
2712
  p2 = full_node_2.full_node.blockchain.get_peak()
2532
2713
  p3 = full_node_3.full_node.blockchain.get_peak()
@@ -2540,8 +2721,11 @@ async def test_long_reorg_nodes(
2540
2721
  p2 = full_node_2.full_node.blockchain.get_peak()
2541
2722
  p3 = full_node_3.full_node.blockchain.get_peak()
2542
2723
 
2724
+ assert p1 is not None
2543
2725
  assert p1.header_hash == blocks[-1].header_hash
2726
+ assert p2 is not None
2544
2727
  assert p2.header_hash == blocks[-1].header_hash
2728
+ assert p3 is not None
2545
2729
  assert p3.header_hash == blocks[-1].header_hash
2546
2730
 
2547
2731
  print(f"reorg1 timing: {reorg1_timing:0.2f}s")
@@ -2553,11 +2737,7 @@ async def test_long_reorg_nodes(
2553
2737
 
2554
2738
 
2555
2739
  @pytest.mark.anyio
2556
- async def test_shallow_reorg_nodes(
2557
- three_nodes,
2558
- self_hostname: str,
2559
- bt: BlockTools,
2560
- ):
2740
+ async def test_shallow_reorg_nodes(three_nodes: list[FullNodeAPI], self_hostname: str, bt: BlockTools) -> None:
2561
2741
  full_node_1, full_node_2, _ = three_nodes
2562
2742
 
2563
2743
  # node 1 has chan A, then we replace the top block and ensure
@@ -2584,7 +2764,7 @@ async def test_shallow_reorg_nodes(
2584
2764
  if coin.puzzle_hash == coinbase_puzzlehash:
2585
2765
  all_coins.append(coin)
2586
2766
 
2587
- def check_nodes_in_sync():
2767
+ def check_nodes_in_sync() -> bool:
2588
2768
  p1 = full_node_2.full_node.blockchain.get_peak()
2589
2769
  p2 = full_node_1.full_node.blockchain.get_peak()
2590
2770
  return p1 == p2
@@ -2629,7 +2809,9 @@ async def test_shallow_reorg_nodes(
2629
2809
  await add_blocks_in_batches(chain_b[-1:], full_node_1.full_node)
2630
2810
 
2631
2811
  # make sure node 1 reorged onto chain B
2632
- assert full_node_1.full_node.blockchain.get_peak().header_hash == chain_b[-1].header_hash
2812
+ peak = full_node_1.full_node.blockchain.get_peak()
2813
+ assert peak is not None
2814
+ assert peak.header_hash == chain_b[-1].header_hash
2633
2815
 
2634
2816
  await time_out_assert(10, check_nodes_in_sync)
2635
2817
  await validate_coin_set(full_node_1.full_node.blockchain.coin_store, chain_b)