web3 7.7.0__tar.gz → 7.8.0__tar.gz

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 (360) hide show
  1. {web3-7.7.0 → web3-7.8.0}/LICENSE +1 -1
  2. {web3-7.7.0/web3.egg-info → web3-7.8.0}/PKG-INFO +1 -1
  3. {web3-7.7.0 → web3-7.8.0}/ens/async_ens.py +1 -1
  4. {web3-7.7.0 → web3-7.8.0}/ens/ens.py +1 -1
  5. {web3-7.7.0 → web3-7.8.0}/setup.py +1 -1
  6. {web3-7.7.0 → web3-7.8.0}/tests/beacon/test_async_beacon.py +85 -0
  7. {web3-7.7.0 → web3-7.8.0}/tests/beacon/test_beacon.py +76 -0
  8. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_init.py +2 -2
  9. {web3-7.7.0 → web3-7.8.0}/tests/core/datastructures/test_datastructures.py +12 -0
  10. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_async_http_provider.py +23 -0
  11. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_async_ipc_provider.py +22 -0
  12. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_http_provider.py +22 -0
  13. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_websocket_provider.py +22 -0
  14. {web3-7.7.0 → web3-7.8.0}/tests/core/subscriptions/test_subscription_manager.py +82 -4
  15. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_http_session_manager.py +48 -0
  16. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_ens.py +101 -0
  17. {web3-7.7.0 → web3-7.8.0}/web3/_utils/events.py +1 -1
  18. {web3-7.7.0 → web3-7.8.0}/web3/_utils/http_session_manager.py +19 -1
  19. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/eth_module.py +3 -0
  20. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/module_testing_utils.py +0 -42
  21. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/persistent_connection_provider.py +38 -0
  22. {web3-7.7.0 → web3-7.8.0}/web3/beacon/api_endpoints.py +10 -0
  23. {web3-7.7.0 → web3-7.8.0}/web3/beacon/async_beacon.py +47 -0
  24. {web3-7.7.0 → web3-7.8.0}/web3/beacon/beacon.py +45 -0
  25. {web3-7.7.0 → web3-7.8.0}/web3/contract/async_contract.py +2 -206
  26. {web3-7.7.0 → web3-7.8.0}/web3/contract/base_contract.py +208 -12
  27. {web3-7.7.0 → web3-7.8.0}/web3/contract/contract.py +2 -205
  28. {web3-7.7.0 → web3-7.8.0}/web3/datastructures.py +4 -0
  29. {web3-7.7.0 → web3-7.8.0}/web3/manager.py +62 -18
  30. {web3-7.7.0 → web3-7.8.0}/web3/middleware/base.py +14 -6
  31. {web3-7.7.0 → web3-7.8.0}/web3/providers/async_base.py +5 -4
  32. {web3-7.7.0 → web3-7.8.0}/web3/providers/base.py +3 -3
  33. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/request_processor.py +11 -1
  34. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/subscription_manager.py +110 -45
  35. {web3-7.7.0 → web3-7.8.0}/web3/providers/rpc/async_rpc.py +8 -3
  36. {web3-7.7.0 → web3-7.8.0}/web3/providers/rpc/rpc.py +8 -3
  37. {web3-7.7.0 → web3-7.8.0}/web3/types.py +10 -11
  38. {web3-7.7.0 → web3-7.8.0}/web3/utils/subscriptions.py +5 -1
  39. {web3-7.7.0 → web3-7.8.0/web3.egg-info}/PKG-INFO +1 -1
  40. {web3-7.7.0 → web3-7.8.0}/MANIFEST.in +0 -0
  41. {web3-7.7.0 → web3-7.8.0}/README.md +0 -0
  42. {web3-7.7.0 → web3-7.8.0}/ens/__init__.py +0 -0
  43. {web3-7.7.0 → web3-7.8.0}/ens/_normalization.py +0 -0
  44. {web3-7.7.0 → web3-7.8.0}/ens/abis.py +0 -0
  45. {web3-7.7.0 → web3-7.8.0}/ens/auto.py +0 -0
  46. {web3-7.7.0 → web3-7.8.0}/ens/base_ens.py +0 -0
  47. {web3-7.7.0 → web3-7.8.0}/ens/constants.py +0 -0
  48. {web3-7.7.0 → web3-7.8.0}/ens/contract_data.py +0 -0
  49. {web3-7.7.0 → web3-7.8.0}/ens/exceptions.py +0 -0
  50. {web3-7.7.0 → web3-7.8.0}/ens/specs/nf.json +0 -0
  51. {web3-7.7.0 → web3-7.8.0}/ens/specs/normalization_spec.json +0 -0
  52. {web3-7.7.0 → web3-7.8.0}/ens/utils.py +0 -0
  53. {web3-7.7.0 → web3-7.8.0}/pyproject.toml +0 -0
  54. {web3-7.7.0 → web3-7.8.0}/setup.cfg +0 -0
  55. {web3-7.7.0 → web3-7.8.0}/tests/.DS_Store +0 -0
  56. {web3-7.7.0 → web3-7.8.0}/tests/__init__.py +0 -0
  57. {web3-7.7.0 → web3-7.8.0}/tests/conftest.py +0 -0
  58. {web3-7.7.0 → web3-7.8.0}/tests/core/admin-module/test_admin_addPeer.py +0 -0
  59. {web3-7.7.0 → web3-7.8.0}/tests/core/admin-module/test_admin_nodeInfo.py +0 -0
  60. {web3-7.7.0 → web3-7.8.0}/tests/core/admin-module/test_admin_peers.py +0 -0
  61. {web3-7.7.0 → web3-7.8.0}/tests/core/block-utils/test_select_method_for_block_identifier.py +0 -0
  62. {web3-7.7.0 → web3-7.8.0}/tests/core/caching-utils/test_generate_cache_key.py +0 -0
  63. {web3-7.7.0 → web3-7.8.0}/tests/core/caching-utils/test_request_caching.py +0 -0
  64. {web3-7.7.0 → web3-7.8.0}/tests/core/conftest.py +0 -0
  65. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/conftest.py +0 -0
  66. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_ambiguous_events.py +0 -0
  67. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_ambiguous_functions.py +0 -0
  68. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_attributes.py +0 -0
  69. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_build_transaction.py +0 -0
  70. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_call_interface.py +0 -0
  71. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_caller_interface.py +0 -0
  72. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_class_construction.py +0 -0
  73. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_constructor.py +0 -0
  74. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_constructor_encoding.py +0 -0
  75. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_deployment.py +0 -0
  76. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_estimate_gas.py +0 -0
  77. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_events.py +0 -0
  78. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_events_build_filter.py +0 -0
  79. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_example.py +0 -0
  80. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_method_abi_decoding.py +0 -0
  81. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_method_abi_encoding.py +0 -0
  82. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_method_to_argument_matching.py +0 -0
  83. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_panic_errors.py +0 -0
  84. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_transact_interface.py +0 -0
  85. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_contract_util_functions.py +0 -0
  86. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_extracting_event_data.py +0 -0
  87. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_extracting_event_data_old.py +0 -0
  88. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/test_offchain_lookup.py +0 -0
  89. {web3-7.7.0 → web3-7.8.0}/tests/core/contracts/utils.py +0 -0
  90. {web3-7.7.0 → web3-7.8.0}/tests/core/empty-object/test_empty_object_is_falsy.py +0 -0
  91. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/conftest.py +0 -0
  92. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_accounts.py +0 -0
  93. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_block_api.py +0 -0
  94. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_default_account_api.py +0 -0
  95. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_eth_contract.py +0 -0
  96. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_eth_fee_history.py +0 -0
  97. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_eth_filter.py +0 -0
  98. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_eth_properties.py +0 -0
  99. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_gas_pricing.py +0 -0
  100. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_poa.py +0 -0
  101. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-module/test_transactions.py +0 -0
  102. {web3-7.7.0 → web3-7.8.0}/tests/core/eth-tester-api/test_withdrawals.py +0 -0
  103. {web3-7.7.0 → web3-7.8.0}/tests/core/exceptions/test_exceptions.py +0 -0
  104. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/conftest.py +0 -0
  105. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_basic_filter_tests.py +0 -0
  106. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_contract_create_filter_topic_merging.py +0 -0
  107. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_contract_data_filters.py +0 -0
  108. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_contract_get_logs.py +0 -0
  109. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_contract_on_event_filtering.py +0 -0
  110. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_contract_past_event_filtering.py +0 -0
  111. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_contract_topic_filters.py +0 -0
  112. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_existing_filter_instance.py +0 -0
  113. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_filter_against_latest_blocks.py +0 -0
  114. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_filter_against_pending_transactions.py +0 -0
  115. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_filter_against_transaction_logs.py +0 -0
  116. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_filters_against_many_blocks.py +0 -0
  117. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/test_utils_functions.py +0 -0
  118. {web3-7.7.0 → web3-7.8.0}/tests/core/filtering/utils.py +0 -0
  119. {web3-7.7.0 → web3-7.8.0}/tests/core/gas-strategies/test_rpc_gas_pricing_strategies.py +0 -0
  120. {web3-7.7.0 → web3-7.8.0}/tests/core/gas-strategies/test_time_based_gas_price_strategy.py +0 -0
  121. {web3-7.7.0 → web3-7.8.0}/tests/core/manager/conftest.py +0 -0
  122. {web3-7.7.0 → web3-7.8.0}/tests/core/manager/test_default_middlewares.py +0 -0
  123. {web3-7.7.0 → web3-7.8.0}/tests/core/manager/test_middleware_can_be_stateful.py +0 -0
  124. {web3-7.7.0 → web3-7.8.0}/tests/core/manager/test_middleware_onion_api.py +0 -0
  125. {web3-7.7.0 → web3-7.8.0}/tests/core/manager/test_provider_property.py +0 -0
  126. {web3-7.7.0 → web3-7.8.0}/tests/core/manager/test_provider_request_wrapping.py +0 -0
  127. {web3-7.7.0 → web3-7.8.0}/tests/core/manager/test_response_formatters.py +0 -0
  128. {web3-7.7.0 → web3-7.8.0}/tests/core/method-class/test_method.py +0 -0
  129. {web3-7.7.0 → web3-7.8.0}/tests/core/method-class/test_result_formatters.py +0 -0
  130. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_attrdict_middleware.py +0 -0
  131. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_eth_tester_middleware.py +0 -0
  132. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_filter_middleware.py +0 -0
  133. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_formatting_middleware.py +0 -0
  134. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_gas_price_strategy.py +0 -0
  135. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_middleware.py +0 -0
  136. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_name_to_address_middleware.py +0 -0
  137. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_stalecheck.py +0 -0
  138. {web3-7.7.0 → web3-7.8.0}/tests/core/middleware/test_transaction_signing.py +0 -0
  139. {web3-7.7.0 → web3-7.8.0}/tests/core/module-class/test_module.py +0 -0
  140. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_async_tester_provider.py +0 -0
  141. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_auto_provider.py +0 -0
  142. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_base_provider.py +0 -0
  143. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_http_request_retry.py +0 -0
  144. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_ipc_provider.py +0 -0
  145. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_legacy_websocket_provider.py +0 -0
  146. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_provider_init.py +0 -0
  147. {web3-7.7.0 → web3-7.8.0}/tests/core/providers/test_tester_provider.py +0 -0
  148. {web3-7.7.0 → web3-7.8.0}/tests/core/subscriptions/test_subscriptions.py +0 -0
  149. {web3-7.7.0 → web3-7.8.0}/tests/core/test_library_files.py +0 -0
  150. {web3-7.7.0 → web3-7.8.0}/tests/core/testing-module/test_testing_mine.py +0 -0
  151. {web3-7.7.0 → web3-7.8.0}/tests/core/testing-module/test_testing_snapshot_and_revert.py +0 -0
  152. {web3-7.7.0 → web3-7.8.0}/tests/core/testing-module/test_testing_timeTravel.py +0 -0
  153. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/__init__.py +0 -0
  154. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/conftest.py +0 -0
  155. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_abi.py +0 -0
  156. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_abi_filtering_by_argument_name.py +0 -0
  157. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_abi_is_encodable.py +0 -0
  158. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_abi_named_tree.py +0 -0
  159. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_address.py +0 -0
  160. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_async_transaction.py +0 -0
  161. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_attach_modules.py +0 -0
  162. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_attributedict.py +0 -0
  163. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_caching_utils.py +0 -0
  164. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_construct_event_data_set.py +0 -0
  165. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_construct_event_filter_params.py +0 -0
  166. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_construct_event_topics.py +0 -0
  167. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_datatypes.py +0 -0
  168. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_decorators.py +0 -0
  169. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_encoding.py +0 -0
  170. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_event_filter_builder.py +0 -0
  171. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_event_interface.py +0 -0
  172. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_fee_utils.py +0 -0
  173. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_formatters.py +0 -0
  174. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_is_predefined_block_number.py +0 -0
  175. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_is_probably_enum.py +0 -0
  176. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_is_recognized_type.py +0 -0
  177. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_math.py +0 -0
  178. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_method_formatters.py +0 -0
  179. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_prepare_transaction_replacement.py +0 -0
  180. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_select_filter_method.py +0 -0
  181. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_threads.py +0 -0
  182. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_valid_transaction_params.py +0 -0
  183. {web3-7.7.0 → web3-7.8.0}/tests/core/utilities/test_validation.py +0 -0
  184. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_api.py +0 -0
  185. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_attach_modules.py +0 -0
  186. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_client_version.py +0 -0
  187. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_conversions.py +0 -0
  188. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_import_and_version.py +0 -0
  189. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_keccak.py +0 -0
  190. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_providers.py +0 -0
  191. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_strict_bytes_type_checking.py +0 -0
  192. {web3-7.7.0 → web3-7.8.0}/tests/core/web3-module/test_web3_inheritance.py +0 -0
  193. {web3-7.7.0 → web3-7.8.0}/tests/ens/conftest.py +0 -0
  194. {web3-7.7.0 → web3-7.8.0}/tests/ens/normalization/normalization_tests.json +0 -0
  195. {web3-7.7.0 → web3-7.8.0}/tests/ens/normalization/test_normalize_name_ensip15.py +0 -0
  196. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_get_registry.py +0 -0
  197. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_get_text.py +0 -0
  198. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_nameprep.py +0 -0
  199. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_offchain_resolution.py +0 -0
  200. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_setup_address.py +0 -0
  201. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_setup_name.py +0 -0
  202. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_utils.py +0 -0
  203. {web3-7.7.0 → web3-7.8.0}/tests/ens/test_wildcard_resolution.py +0 -0
  204. {web3-7.7.0 → web3-7.8.0}/tests/integration/.DS_Store +0 -0
  205. {web3-7.7.0 → web3-7.8.0}/tests/integration/README.md +0 -0
  206. {web3-7.7.0 → web3-7.8.0}/tests/integration/common.py +0 -0
  207. {web3-7.7.0 → web3-7.8.0}/tests/integration/conftest.py +0 -0
  208. {web3-7.7.0 → web3-7.8.0}/tests/integration/generate_fixtures/common.py +0 -0
  209. {web3-7.7.0 → web3-7.8.0}/tests/integration/generate_fixtures/go_ethereum.py +0 -0
  210. {web3-7.7.0 → web3-7.8.0}/tests/integration/geth-1.14.12-fixture.zip +0 -0
  211. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/__init__.py +0 -0
  212. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/common.py +0 -0
  213. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/conftest.py +0 -0
  214. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/test_goethereum_http.py +0 -0
  215. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/test_goethereum_ipc.py +0 -0
  216. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/test_goethereum_legacy_ws.py +0 -0
  217. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/test_goethereum_ws/__init__.py +0 -0
  218. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/test_goethereum_ws/conftest.py +0 -0
  219. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_await_w3.py +0 -0
  220. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_ctx_manager_w3.py +0 -0
  221. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_iterator_w3.py +0 -0
  222. {web3-7.7.0 → web3-7.8.0}/tests/integration/go_ethereum/utils.py +0 -0
  223. {web3-7.7.0 → web3-7.8.0}/tests/integration/test_ethereum_tester.py +0 -0
  224. {web3-7.7.0 → web3-7.8.0}/tests/utils.py +0 -0
  225. {web3-7.7.0 → web3-7.8.0}/web3/__init__.py +0 -0
  226. {web3-7.7.0 → web3-7.8.0}/web3/_utils/__init__.py +0 -0
  227. {web3-7.7.0 → web3-7.8.0}/web3/_utils/abi.py +0 -0
  228. {web3-7.7.0 → web3-7.8.0}/web3/_utils/abi_element_identifiers.py +0 -0
  229. {web3-7.7.0 → web3-7.8.0}/web3/_utils/async_caching.py +0 -0
  230. {web3-7.7.0 → web3-7.8.0}/web3/_utils/async_transactions.py +0 -0
  231. {web3-7.7.0 → web3-7.8.0}/web3/_utils/batching.py +0 -0
  232. {web3-7.7.0 → web3-7.8.0}/web3/_utils/blocks.py +0 -0
  233. {web3-7.7.0 → web3-7.8.0}/web3/_utils/caching/__init__.py +0 -0
  234. {web3-7.7.0 → web3-7.8.0}/web3/_utils/caching/caching_utils.py +0 -0
  235. {web3-7.7.0 → web3-7.8.0}/web3/_utils/caching/request_caching_validation.py +0 -0
  236. {web3-7.7.0 → web3-7.8.0}/web3/_utils/compat/__init__.py +0 -0
  237. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/__init__.py +0 -0
  238. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/compile_contracts.py +0 -0
  239. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/__init__.py +0 -0
  240. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/_custom_contract_data.py +0 -0
  241. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/ambiguous_function_contract.py +0 -0
  242. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/arrays_contract.py +0 -0
  243. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/bytes_contracts.py +0 -0
  244. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/constructor_contracts.py +0 -0
  245. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/contract_caller_tester.py +0 -0
  246. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/emitter_contract.py +0 -0
  247. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/event_contracts.py +0 -0
  248. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/extended_resolver.py +0 -0
  249. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/fallback_function_contract.py +0 -0
  250. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +0 -0
  251. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/math_contract.py +0 -0
  252. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/offchain_lookup.py +0 -0
  253. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/offchain_resolver.py +0 -0
  254. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/panic_errors_contract.py +0 -0
  255. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/payable_tester.py +0 -0
  256. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/receive_function_contracts.py +0 -0
  257. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/reflector_contracts.py +0 -0
  258. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/revert_contract.py +0 -0
  259. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/simple_resolver.py +0 -0
  260. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/storage_contract.py +0 -0
  261. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/string_contract.py +0 -0
  262. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contract_sources/contract_data/tuple_contracts.py +0 -0
  263. {web3-7.7.0 → web3-7.8.0}/web3/_utils/contracts.py +0 -0
  264. {web3-7.7.0 → web3-7.8.0}/web3/_utils/datatypes.py +0 -0
  265. {web3-7.7.0 → web3-7.8.0}/web3/_utils/decorators.py +0 -0
  266. {web3-7.7.0 → web3-7.8.0}/web3/_utils/empty.py +0 -0
  267. {web3-7.7.0 → web3-7.8.0}/web3/_utils/encoding.py +0 -0
  268. {web3-7.7.0 → web3-7.8.0}/web3/_utils/ens.py +0 -0
  269. {web3-7.7.0 → web3-7.8.0}/web3/_utils/error_formatters_utils.py +0 -0
  270. {web3-7.7.0 → web3-7.8.0}/web3/_utils/fee_utils.py +0 -0
  271. {web3-7.7.0 → web3-7.8.0}/web3/_utils/filters.py +0 -0
  272. {web3-7.7.0 → web3-7.8.0}/web3/_utils/formatters.py +0 -0
  273. {web3-7.7.0 → web3-7.8.0}/web3/_utils/http.py +0 -0
  274. {web3-7.7.0 → web3-7.8.0}/web3/_utils/hypothesis.py +0 -0
  275. {web3-7.7.0 → web3-7.8.0}/web3/_utils/math.py +0 -0
  276. {web3-7.7.0 → web3-7.8.0}/web3/_utils/method_formatters.py +0 -0
  277. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module.py +0 -0
  278. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/__init__.py +0 -0
  279. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/go_ethereum_admin_module.py +0 -0
  280. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/go_ethereum_debug_module.py +0 -0
  281. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/go_ethereum_txpool_module.py +0 -0
  282. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/net_module.py +0 -0
  283. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/utils.py +0 -0
  284. {web3-7.7.0 → web3-7.8.0}/web3/_utils/module_testing/web3_module.py +0 -0
  285. {web3-7.7.0 → web3-7.8.0}/web3/_utils/normalizers.py +0 -0
  286. {web3-7.7.0 → web3-7.8.0}/web3/_utils/rpc_abi.py +0 -0
  287. {web3-7.7.0 → web3-7.8.0}/web3/_utils/threads.py +0 -0
  288. {web3-7.7.0 → web3-7.8.0}/web3/_utils/transactions.py +0 -0
  289. {web3-7.7.0 → web3-7.8.0}/web3/_utils/type_conversion.py +0 -0
  290. {web3-7.7.0 → web3-7.8.0}/web3/_utils/utility_methods.py +0 -0
  291. {web3-7.7.0 → web3-7.8.0}/web3/_utils/validation.py +0 -0
  292. {web3-7.7.0 → web3-7.8.0}/web3/_utils/windows.py +0 -0
  293. {web3-7.7.0 → web3-7.8.0}/web3/auto/__init__.py +0 -0
  294. {web3-7.7.0 → web3-7.8.0}/web3/auto/gethdev.py +0 -0
  295. {web3-7.7.0 → web3-7.8.0}/web3/beacon/__init__.py +0 -0
  296. {web3-7.7.0 → web3-7.8.0}/web3/constants.py +0 -0
  297. {web3-7.7.0 → web3-7.8.0}/web3/contract/__init__.py +0 -0
  298. {web3-7.7.0 → web3-7.8.0}/web3/contract/utils.py +0 -0
  299. {web3-7.7.0 → web3-7.8.0}/web3/eth/__init__.py +0 -0
  300. {web3-7.7.0 → web3-7.8.0}/web3/eth/async_eth.py +0 -0
  301. {web3-7.7.0 → web3-7.8.0}/web3/eth/base_eth.py +0 -0
  302. {web3-7.7.0 → web3-7.8.0}/web3/eth/eth.py +0 -0
  303. {web3-7.7.0 → web3-7.8.0}/web3/exceptions.py +0 -0
  304. {web3-7.7.0 → web3-7.8.0}/web3/gas_strategies/__init__.py +0 -0
  305. {web3-7.7.0 → web3-7.8.0}/web3/gas_strategies/rpc.py +0 -0
  306. {web3-7.7.0 → web3-7.8.0}/web3/gas_strategies/time_based.py +0 -0
  307. {web3-7.7.0 → web3-7.8.0}/web3/geth.py +0 -0
  308. {web3-7.7.0 → web3-7.8.0}/web3/logs.py +0 -0
  309. {web3-7.7.0 → web3-7.8.0}/web3/main.py +0 -0
  310. {web3-7.7.0 → web3-7.8.0}/web3/method.py +0 -0
  311. {web3-7.7.0 → web3-7.8.0}/web3/middleware/__init__.py +0 -0
  312. {web3-7.7.0 → web3-7.8.0}/web3/middleware/attrdict.py +0 -0
  313. {web3-7.7.0 → web3-7.8.0}/web3/middleware/buffered_gas_estimate.py +0 -0
  314. {web3-7.7.0 → web3-7.8.0}/web3/middleware/filter.py +0 -0
  315. {web3-7.7.0 → web3-7.8.0}/web3/middleware/formatting.py +0 -0
  316. {web3-7.7.0 → web3-7.8.0}/web3/middleware/gas_price_strategy.py +0 -0
  317. {web3-7.7.0 → web3-7.8.0}/web3/middleware/names.py +0 -0
  318. {web3-7.7.0 → web3-7.8.0}/web3/middleware/proof_of_authority.py +0 -0
  319. {web3-7.7.0 → web3-7.8.0}/web3/middleware/pythonic.py +0 -0
  320. {web3-7.7.0 → web3-7.8.0}/web3/middleware/signing.py +0 -0
  321. {web3-7.7.0 → web3-7.8.0}/web3/middleware/stalecheck.py +0 -0
  322. {web3-7.7.0 → web3-7.8.0}/web3/middleware/validation.py +0 -0
  323. {web3-7.7.0 → web3-7.8.0}/web3/module.py +0 -0
  324. {web3-7.7.0 → web3-7.8.0}/web3/net.py +0 -0
  325. {web3-7.7.0 → web3-7.8.0}/web3/providers/__init__.py +0 -0
  326. {web3-7.7.0 → web3-7.8.0}/web3/providers/auto.py +0 -0
  327. {web3-7.7.0 → web3-7.8.0}/web3/providers/eth_tester/__init__.py +0 -0
  328. {web3-7.7.0 → web3-7.8.0}/web3/providers/eth_tester/defaults.py +0 -0
  329. {web3-7.7.0 → web3-7.8.0}/web3/providers/eth_tester/main.py +0 -0
  330. {web3-7.7.0 → web3-7.8.0}/web3/providers/eth_tester/middleware.py +0 -0
  331. {web3-7.7.0 → web3-7.8.0}/web3/providers/ipc.py +0 -0
  332. {web3-7.7.0 → web3-7.8.0}/web3/providers/legacy_websocket.py +0 -0
  333. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/__init__.py +0 -0
  334. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/async_ipc.py +0 -0
  335. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/persistent.py +0 -0
  336. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/persistent_connection.py +0 -0
  337. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/subscription_container.py +0 -0
  338. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/utils.py +0 -0
  339. {web3-7.7.0 → web3-7.8.0}/web3/providers/persistent/websocket.py +0 -0
  340. {web3-7.7.0 → web3-7.8.0}/web3/providers/rpc/__init__.py +0 -0
  341. {web3-7.7.0 → web3-7.8.0}/web3/providers/rpc/utils.py +0 -0
  342. {web3-7.7.0 → web3-7.8.0}/web3/py.typed +0 -0
  343. {web3-7.7.0 → web3-7.8.0}/web3/scripts/__init__.py +0 -0
  344. {web3-7.7.0 → web3-7.8.0}/web3/scripts/install_pre_releases.py +0 -0
  345. {web3-7.7.0 → web3-7.8.0}/web3/scripts/parse_pygeth_version.py +0 -0
  346. {web3-7.7.0 → web3-7.8.0}/web3/scripts/release/__init__.py +0 -0
  347. {web3-7.7.0 → web3-7.8.0}/web3/scripts/release/test_package.py +0 -0
  348. {web3-7.7.0 → web3-7.8.0}/web3/testing.py +0 -0
  349. {web3-7.7.0 → web3-7.8.0}/web3/tracing.py +0 -0
  350. {web3-7.7.0 → web3-7.8.0}/web3/utils/__init__.py +0 -0
  351. {web3-7.7.0 → web3-7.8.0}/web3/utils/abi.py +0 -0
  352. {web3-7.7.0 → web3-7.8.0}/web3/utils/address.py +0 -0
  353. {web3-7.7.0 → web3-7.8.0}/web3/utils/async_exception_handling.py +0 -0
  354. {web3-7.7.0 → web3-7.8.0}/web3/utils/caching.py +0 -0
  355. {web3-7.7.0 → web3-7.8.0}/web3/utils/exception_handling.py +0 -0
  356. {web3-7.7.0 → web3-7.8.0}/web3.egg-info/SOURCES.txt +0 -0
  357. {web3-7.7.0 → web3-7.8.0}/web3.egg-info/dependency_links.txt +0 -0
  358. {web3-7.7.0 → web3-7.8.0}/web3.egg-info/not-zip-safe +0 -0
  359. {web3-7.7.0 → web3-7.8.0}/web3.egg-info/requires.txt +0 -0
  360. {web3-7.7.0 → web3-7.8.0}/web3.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016-2024 The Ethereum Foundation
3
+ Copyright (c) 2016-2025 The Ethereum Foundation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: web3
3
- Version: 7.7.0
3
+ Version: 7.8.0
4
4
  Summary: web3: A Python library for interacting with Ethereum
5
5
  Home-page: https://github.com/ethereum/web3.py
6
6
  Author: The Ethereum Foundation
@@ -152,12 +152,12 @@ class AsyncENS(BaseENS):
152
152
  :param int coin_type: if provided, look up the address for this coin type
153
153
  :raises InvalidName: if `name` has invalid syntax
154
154
  """
155
- r = await self.resolver(name)
156
155
  if coin_type is None:
157
156
  # don't validate `addr(bytes32)` interface id since extended resolvers
158
157
  # can implement a "resolve" function as of ENSIP-10
159
158
  return cast(ChecksumAddress, await self._resolve(name, "addr"))
160
159
  else:
160
+ r = await self.resolver(name)
161
161
  await _async_validate_resolver_and_interface_id(
162
162
  name, r, ENS_MULTICHAIN_ADDRESS_INTERFACE_ID, "addr(bytes32,uint256)"
163
163
  )
@@ -154,12 +154,12 @@ class ENS(BaseENS):
154
154
  :raises UnsupportedFunction: if the resolver does not support the ``addr()``
155
155
  function
156
156
  """
157
- r = self.resolver(name)
158
157
  if coin_type is None:
159
158
  # don't validate `addr(bytes32)` interface id since extended resolvers
160
159
  # can implement a "resolve" function as of ENSIP-10
161
160
  return cast(ChecksumAddress, self._resolve(name, "addr"))
162
161
  else:
162
+ r = self.resolver(name)
163
163
  _validate_resolver_and_interface_id(
164
164
  name, r, ENS_MULTICHAIN_ADDRESS_INTERFACE_ID, "addr(bytes32,uint256)"
165
165
  )
@@ -55,7 +55,7 @@ with open("./README.md") as readme:
55
55
  setup(
56
56
  name="web3",
57
57
  # *IMPORTANT*: Don't manually change the version here. Use `make bump`, as described in readme
58
- version="7.7.0",
58
+ version="7.8.0",
59
59
  description="""web3: A Python library for interacting with Ethereum""",
60
60
  long_description=long_description,
61
61
  long_description_content_type="text/markdown",
@@ -256,6 +256,12 @@ async def test_async_cl_node_get_peer(async_beacon):
256
256
  _assert_valid_response(response)
257
257
 
258
258
 
259
+ @pytest.mark.asyncio
260
+ async def test_async_cl_node_get_peer_count(async_beacon):
261
+ response = await async_beacon.get_peer_count()
262
+ _assert_valid_response(response)
263
+
264
+
259
265
  @pytest.mark.asyncio
260
266
  async def test_async_cl_node_get_health(async_beacon):
261
267
  response = await async_beacon.get_health()
@@ -285,3 +291,82 @@ async def test_async_cl_node_get_blob_sidecars(async_beacon):
285
291
  # test with indices
286
292
  with_indices = await async_beacon.get_blob_sidecars("head", [0, 1])
287
293
  _assert_valid_response(with_indices)
294
+
295
+
296
+ # Validator endpoint tests:
297
+
298
+
299
+ @pytest.mark.asyncio
300
+ async def test_async_cl_validator_get_attester_duties(async_beacon):
301
+ finality_checkpoint_response = await async_beacon.get_finality_checkpoint()
302
+ _assert_valid_response(finality_checkpoint_response)
303
+
304
+ finality_checkpoint = finality_checkpoint_response["data"]
305
+ epoch = finality_checkpoint["finalized"]["epoch"]
306
+
307
+ validators_response = await async_beacon.get_validators()
308
+ _assert_valid_response(validators_response)
309
+
310
+ validators = validators_response["data"]
311
+ random_validator = validators[randint(0, len(validators))]
312
+ random_validator_index = random_validator["index"]
313
+
314
+ response = await async_beacon.get_attester_duties(epoch, [random_validator_index])
315
+ _assert_valid_response(response)
316
+
317
+
318
+ @pytest.mark.asyncio
319
+ async def test_async_cl_validator_get_block_proposer_duties(async_beacon):
320
+ finality_checkpoint_response = await async_beacon.get_finality_checkpoint()
321
+ _assert_valid_response(finality_checkpoint_response)
322
+
323
+ finality_checkpoint = finality_checkpoint_response["data"]
324
+ epoch = finality_checkpoint["finalized"]["epoch"]
325
+
326
+ response = await async_beacon.get_block_proposer_duties(epoch)
327
+ _assert_valid_response(response)
328
+
329
+
330
+ @pytest.mark.asyncio
331
+ async def test_async_cl_validator_get_sync_committee_duties(async_beacon):
332
+ finality_checkpoint_response = await async_beacon.get_finality_checkpoint()
333
+ _assert_valid_response(finality_checkpoint_response)
334
+
335
+ finality_checkpoint = finality_checkpoint_response["data"]
336
+ epoch = finality_checkpoint["finalized"]["epoch"]
337
+
338
+ validators_response = await async_beacon.get_validators()
339
+ _assert_valid_response(validators_response)
340
+
341
+ validators = validators_response["data"]
342
+ random_validator = validators[randint(0, len(validators))]
343
+ random_validator_index = random_validator["index"]
344
+
345
+ response = await async_beacon.get_sync_committee_duties(
346
+ epoch, [random_validator_index]
347
+ )
348
+ _assert_valid_response(response)
349
+
350
+
351
+ # Rewards endpoint tests:
352
+
353
+
354
+ @pytest.mark.asyncio
355
+ async def test_async_cl_validator_get_attestations_rewards(async_beacon):
356
+ finality_checkpoint_response = await async_beacon.get_finality_checkpoint()
357
+ _assert_valid_response(finality_checkpoint_response)
358
+
359
+ finality_checkpoint = finality_checkpoint_response["data"]
360
+ epoch = finality_checkpoint["finalized"]["epoch"]
361
+
362
+ validators_response = await async_beacon.get_validators()
363
+ _assert_valid_response(validators_response)
364
+
365
+ validators = validators_response["data"]
366
+ random_validator = validators[randint(0, len(validators))]
367
+ random_validator_index = random_validator["index"]
368
+
369
+ response = await async_beacon.get_attestations_rewards(
370
+ epoch, [random_validator_index]
371
+ )
372
+ _assert_valid_response(response)
@@ -214,6 +214,11 @@ def test_cl_node_get_peer(beacon):
214
214
  _assert_valid_response(response)
215
215
 
216
216
 
217
+ def test_cl_node_get_peer_count(beacon):
218
+ response = beacon.get_peer_count()
219
+ _assert_valid_response(response)
220
+
221
+
217
222
  def test_cl_node_get_health(beacon):
218
223
  response = beacon.get_health()
219
224
  assert isinstance(response, int)
@@ -239,3 +244,74 @@ def test_cl_node_get_blob_sidecars(beacon):
239
244
  # test with indices
240
245
  with_indices = beacon.get_blob_sidecars("head", [0, 1])
241
246
  _assert_valid_response(with_indices)
247
+
248
+
249
+ # Validator endpoint tests:
250
+
251
+
252
+ def test_cl_validator_get_attester_duties(beacon):
253
+ finality_checkpoint_response = beacon.get_finality_checkpoint()
254
+ _assert_valid_response(finality_checkpoint_response)
255
+
256
+ finality_checkpoint = finality_checkpoint_response["data"]
257
+ epoch = finality_checkpoint["finalized"]["epoch"]
258
+
259
+ validators_response = beacon.get_validators()
260
+ _assert_valid_response(validators_response)
261
+
262
+ validators = validators_response["data"]
263
+ random_validator = validators[randint(0, len(validators))]
264
+ random_validator_index = random_validator["index"]
265
+
266
+ response = beacon.get_attester_duties(epoch, [random_validator_index])
267
+ _assert_valid_response(response)
268
+
269
+
270
+ def test_cl_validator_get_block_proposer_duties(beacon):
271
+ finality_checkpoint_response = beacon.get_finality_checkpoint()
272
+ _assert_valid_response(finality_checkpoint_response)
273
+
274
+ finality_checkpoint = finality_checkpoint_response["data"]
275
+ epoch = finality_checkpoint["finalized"]["epoch"]
276
+
277
+ response = beacon.get_block_proposer_duties(epoch)
278
+ _assert_valid_response(response)
279
+
280
+
281
+ def test_cl_validator_get_sync_committee_duties(beacon):
282
+ finality_checkpoint_response = beacon.get_finality_checkpoint()
283
+ _assert_valid_response(finality_checkpoint_response)
284
+
285
+ finality_checkpoint = finality_checkpoint_response["data"]
286
+ epoch = finality_checkpoint["finalized"]["epoch"]
287
+
288
+ validators_response = beacon.get_validators()
289
+ _assert_valid_response(validators_response)
290
+
291
+ validators = validators_response["data"]
292
+ random_validator = validators[randint(0, len(validators))]
293
+ random_validator_index = random_validator["index"]
294
+
295
+ response = beacon.get_sync_committee_duties(epoch, [random_validator_index])
296
+ _assert_valid_response(response)
297
+
298
+
299
+ # Rewards endpoint tests:
300
+
301
+
302
+ def test_cl_validator_get_attestations_rewards(beacon):
303
+ finality_checkpoint_response = beacon.get_finality_checkpoint()
304
+ _assert_valid_response(finality_checkpoint_response)
305
+
306
+ finality_checkpoint = finality_checkpoint_response["data"]
307
+ epoch = finality_checkpoint["finalized"]["epoch"]
308
+
309
+ validators_response = beacon.get_validators()
310
+ _assert_valid_response(validators_response)
311
+
312
+ validators = validators_response["data"]
313
+ random_validator = validators[randint(0, len(validators))]
314
+ random_validator_index = random_validator["index"]
315
+
316
+ response = beacon.get_attestations_rewards(epoch, [random_validator_index])
317
+ _assert_valid_response(response)
@@ -85,7 +85,7 @@ def test_init_multiple_contracts_performance(w3, emitter_contract_data):
85
85
  abi=emitter_contract_data["abi"], bytecode=emitter_contract_data["bytecode"]
86
86
  )
87
87
  # assert initializing 500 contracts is within a conservative / reasonable time
88
- assert (time.time() - start_time) < 1.5
88
+ assert (time.time() - start_time) < 1.75
89
89
 
90
90
 
91
91
  # -- async -- #
@@ -98,4 +98,4 @@ def test_async_init_multiple_contracts_performance(async_w3, emitter_contract_da
98
98
  abi=emitter_contract_data["abi"], bytecode=emitter_contract_data["bytecode"]
99
99
  )
100
100
  # assert initializing 500 contracts is within a conservative / reasonable time
101
- assert (time.time() - start_time) < 1.5
101
+ assert (time.time() - start_time) < 1.75
@@ -4,8 +4,12 @@ import re
4
4
 
5
5
  from web3.datastructures import (
6
6
  AttributeDict,
7
+ NamedElementOnion,
7
8
  tupleize_lists_nested,
8
9
  )
10
+ from web3.middleware import (
11
+ GasPriceStrategyMiddleware,
12
+ )
9
13
 
10
14
 
11
15
  def generate_random_value(depth=0, max_depth=3, key_type=None):
@@ -207,3 +211,11 @@ def test_AttributeDict_hashing_backwards_compatibility(input, error):
207
211
  assert hash(tuple(sorted(input.items()))) == hash(input)
208
212
  else:
209
213
  assert hash(tuple(sorted(input.items()))) == hash(input)
214
+
215
+
216
+ def test_NamedElementOnion_values():
217
+ middleware = GasPriceStrategyMiddleware(None)
218
+ initial_items = [(middleware, "gas_price_strategy")]
219
+ named_element_onion = NamedElementOnion(initial_items)
220
+ actual = [x for x in named_element_onion.values()]
221
+ assert actual == [middleware]
@@ -1,4 +1,8 @@
1
1
  import pytest
2
+ from unittest.mock import (
3
+ AsyncMock,
4
+ patch,
5
+ )
2
6
 
3
7
  from aiohttp import (
4
8
  ClientSession,
@@ -13,6 +17,7 @@ from web3.eth import (
13
17
  )
14
18
  from web3.exceptions import (
15
19
  ProviderConnectionError,
20
+ Web3RPCError,
16
21
  )
17
22
  from web3.geth import (
18
23
  AsyncGeth,
@@ -107,3 +112,21 @@ def test_get_request_headers(provider):
107
112
  headers["User-Agent"] == f"web3.py/{web3py_version}/"
108
113
  f"{AsyncHTTPProvider.__module__}.{AsyncHTTPProvider.__qualname__}"
109
114
  )
115
+
116
+
117
+ @patch(
118
+ "web3._utils.http_session_manager.HTTPSessionManager.async_make_post_request",
119
+ new_callable=AsyncMock,
120
+ )
121
+ @pytest.mark.asyncio
122
+ async def test_async_http_empty_batch_response(mock_async_post):
123
+ mock_async_post.return_value = (
124
+ b'{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"empty batch"}}'
125
+ )
126
+ async_w3 = AsyncWeb3(AsyncHTTPProvider())
127
+ async with async_w3.batch_requests() as batch:
128
+ with pytest.raises(Web3RPCError, match="empty batch"):
129
+ await batch.async_execute()
130
+
131
+ # assert that even though there was an error, we have reset the batching state
132
+ assert not async_w3.provider._is_batching
@@ -25,6 +25,7 @@ from web3.datastructures import (
25
25
  )
26
26
  from web3.exceptions import (
27
27
  ReadBufferLimitReached,
28
+ Web3RPCError,
28
29
  )
29
30
  from web3.providers import (
30
31
  AsyncIPCProvider,
@@ -366,3 +367,24 @@ async def test_async_ipc_provider_write_messages_end_with_new_line_delimiter(
366
367
 
367
368
  request_data = b'{"id": 0, "jsonrpc": "2.0", "method": "method", "params": []}'
368
369
  w3.provider._writer.write.assert_called_with(request_data + b"\n")
370
+
371
+
372
+ @pytest.mark.asyncio
373
+ async def test_persistent_connection_provider_empty_batch_response(
374
+ simple_ipc_server,
375
+ jsonrpc_ipc_pipe_path,
376
+ ):
377
+ async with AsyncWeb3(
378
+ AsyncIPCProvider(pathlib.Path(jsonrpc_ipc_pipe_path))
379
+ ) as async_w3:
380
+ async_w3.provider._reader.readline = AsyncMock()
381
+ async_w3.provider._reader.readline.return_value = (
382
+ b'{"jsonrpc": "2.0","id":null,"error": {"code": -32600, "message": '
383
+ b'"empty batch"}}\n'
384
+ )
385
+ async with async_w3.batch_requests() as batch:
386
+ with pytest.raises(Web3RPCError, match="empty batch"):
387
+ await batch.async_execute()
388
+
389
+ # assert that even though there was an error, we have reset the batching state
390
+ assert not async_w3.provider._is_batching
@@ -1,4 +1,8 @@
1
1
  import pytest
2
+ from unittest.mock import (
3
+ Mock,
4
+ patch,
5
+ )
2
6
 
3
7
  from requests import (
4
8
  Session,
@@ -16,6 +20,7 @@ from web3.eth import (
16
20
  )
17
21
  from web3.exceptions import (
18
22
  ProviderConnectionError,
23
+ Web3RPCError,
19
24
  )
20
25
  from web3.geth import (
21
26
  Geth,
@@ -110,3 +115,20 @@ def test_get_request_headers(provider):
110
115
  headers["User-Agent"] == f"web3.py/{web3py_version}/"
111
116
  f"{HTTPProvider.__module__}.{HTTPProvider.__qualname__}"
112
117
  )
118
+
119
+
120
+ @patch(
121
+ "web3._utils.http_session_manager.HTTPSessionManager.make_post_request",
122
+ new_callable=Mock,
123
+ )
124
+ def test_http_empty_batch_response(mock_post):
125
+ mock_post.return_value = (
126
+ b'{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"empty batch"}}'
127
+ )
128
+ w3 = Web3(HTTPProvider())
129
+ with w3.batch_requests() as batch:
130
+ with pytest.raises(Web3RPCError, match="empty batch"):
131
+ batch.execute()
132
+
133
+ # assert that even though there was an error, we have reset the batching state
134
+ assert not w3.provider._is_batching
@@ -27,6 +27,7 @@ from web3._utils.module_testing.module_testing_utils import (
27
27
  )
28
28
  from web3.exceptions import (
29
29
  TimeExhausted,
30
+ Web3RPCError,
30
31
  )
31
32
  from web3.providers.persistent import (
32
33
  WebSocketProvider,
@@ -432,3 +433,24 @@ async def test_listener_task_breaks_out_of_handle_subscriptions_when_cancelled()
432
433
  # up the exception.
433
434
  with pytest.raises(asyncio.CancelledError):
434
435
  await async_w3.subscription_manager.handle_subscriptions(run_forever=True)
436
+
437
+
438
+ @pytest.mark.asyncio
439
+ async def test_persistent_connection_provider_empty_batch_response():
440
+ with patch(
441
+ "web3.providers.persistent.websocket.connect",
442
+ new=lambda *_1, **_2: _mocked_ws_conn(),
443
+ ):
444
+ async with AsyncWeb3(WebSocketProvider("ws://mocked")) as async_w3:
445
+ async_w3.provider._ws.recv = AsyncMock()
446
+ async_w3.provider._ws.recv.return_value = (
447
+ b'{"jsonrpc": "2.0","id":null,"error": {"code": -32600, "message": '
448
+ b'"empty batch"}}\n'
449
+ )
450
+ async with async_w3.batch_requests() as batch:
451
+ with pytest.raises(Web3RPCError, match="empty batch"):
452
+ await batch.async_execute()
453
+
454
+ # assert that even though there was an error, we have reset the batching
455
+ # state
456
+ assert not async_w3.provider._is_batching
@@ -4,6 +4,9 @@ from unittest.mock import (
4
4
  AsyncMock,
5
5
  )
6
6
 
7
+ from eth_typing import (
8
+ HexStr,
9
+ )
7
10
  import pytest_asyncio
8
11
 
9
12
  from web3 import (
@@ -40,19 +43,43 @@ async def subscription_manager():
40
43
 
41
44
 
42
45
  @pytest.mark.asyncio
43
- async def test_subscription_manager_raises_for_sub_with_the_same_label(
46
+ async def test_subscription_default_labels_are_unique(subscription_manager):
47
+ sub1 = NewHeadsSubscription()
48
+ sub2 = NewHeadsSubscription()
49
+ sub3 = NewHeadsSubscription()
50
+ sub4 = NewHeadsSubscription()
51
+
52
+ sub_ids = await subscription_manager.subscribe([sub1, sub2, sub3, sub4])
53
+ assert sub_ids == ["0x0", "0x1", "0x2", "0x3"]
54
+
55
+ assert sub1.label != sub2.label != sub3.label != sub4.label
56
+ assert sub1.label == "NewHeadsSubscription('newHeads',)"
57
+ assert sub2.label == "NewHeadsSubscription('newHeads',)#2"
58
+ assert sub3.label == "NewHeadsSubscription('newHeads',)#3"
59
+ assert sub4.label == "NewHeadsSubscription('newHeads',)#4"
60
+
61
+ # assert no issues unsubscribing
62
+ await subscription_manager.unsubscribe_all()
63
+
64
+ assert subscription_manager.subscriptions == []
65
+ assert subscription_manager._subscription_container.subscriptions == []
66
+ assert subscription_manager._subscription_container.subscriptions_by_id == {}
67
+ assert subscription_manager._subscription_container.subscriptions_by_label == {}
68
+
69
+
70
+ @pytest.mark.asyncio
71
+ async def test_subscription_manager_raises_for_new_subs_with_the_same_custom_label(
44
72
  subscription_manager,
45
73
  ):
46
74
  sub1 = NewHeadsSubscription(label="foo")
47
- await subscription_manager.subscribe(sub1)
75
+ sub2 = LogsSubscription(label="foo")
48
76
 
49
77
  with pytest.raises(
50
78
  Web3ValueError,
51
79
  match="Subscription label already exists. Subscriptions must have unique "
52
80
  "labels.\n label: foo",
53
81
  ):
54
- sub2 = LogsSubscription(label="foo")
55
- await subscription_manager.subscribe(sub2)
82
+ await subscription_manager.subscribe([sub1, sub2])
56
83
 
57
84
  # make sure the subscription was subscribed to and not added to the manager
58
85
  assert subscription_manager.subscriptions == [sub1]
@@ -110,3 +137,54 @@ async def test_unsubscribe_all_clears_all_subscriptions(subscription_manager):
110
137
  assert sub_container.subscriptions == []
111
138
  assert sub_container.subscriptions_by_id == {}
112
139
  assert sub_container.subscriptions_by_label == {}
140
+
141
+
142
+ @pytest.mark.asyncio
143
+ async def test_unsubscribe_with_one_or_multiple(subscription_manager):
144
+ sub1 = NewHeadsSubscription()
145
+ sub2 = PendingTxSubscription()
146
+ sub3 = NewHeadsSubscription()
147
+ sub4 = LogsSubscription()
148
+ sub5 = NewHeadsSubscription()
149
+ sub6 = PendingTxSubscription()
150
+
151
+ (
152
+ sub_id1,
153
+ sub_id2,
154
+ sub_id3,
155
+ sub_id4,
156
+ sub_id5,
157
+ sub_id6,
158
+ ) = await subscription_manager.subscribe([sub1, sub2, sub3, sub4, sub5, sub6])
159
+ assert sub_id1 == "0x0"
160
+ assert sub_id2 == "0x1"
161
+ assert sub_id3 == "0x2"
162
+ assert sub_id4 == "0x3"
163
+ assert sub_id5 == "0x4"
164
+ assert sub_id6 == "0x5"
165
+
166
+ assert subscription_manager.subscriptions == [sub1, sub2, sub3, sub4, sub5, sub6]
167
+
168
+ # unsubscribe single by hex id
169
+ assert await subscription_manager.unsubscribe(sub_id1) is True
170
+ assert subscription_manager.subscriptions == [sub2, sub3, sub4, sub5, sub6]
171
+
172
+ # unsubscribe many by hex id
173
+ assert await subscription_manager.unsubscribe([sub_id2, sub_id3]) is True
174
+ assert subscription_manager.subscriptions == [sub4, sub5, sub6]
175
+
176
+ # unsubscribe non-existent hex id
177
+ with pytest.raises(Web3ValueError, match=f"Subscription not found|{0x7}"):
178
+ await subscription_manager.unsubscribe(HexStr("0x7"))
179
+
180
+ # unsubscribe by subscription object
181
+ assert await subscription_manager.unsubscribe(sub4) is True
182
+ assert subscription_manager.subscriptions == [sub5, sub6]
183
+
184
+ # unsubscribe many by subscription object
185
+ assert await subscription_manager.unsubscribe([sub5, sub6]) is True
186
+ assert subscription_manager.subscriptions == []
187
+
188
+ # unsubscribe non-existent subscription object
189
+ with pytest.raises(Web3ValueError, match=f"Subscription not found|{sub5.id}"):
190
+ await subscription_manager.unsubscribe(sub5)
@@ -112,6 +112,28 @@ def test_session_manager_json_make_get_request(mocker, http_session_manager):
112
112
  assert adapter._pool_maxsize == DEFAULT_POOLSIZE
113
113
 
114
114
 
115
+ def test_session_manager_json_make_post_request(mocker, http_session_manager):
116
+ mocker.patch("requests.Session.post", return_value=MockedResponse())
117
+
118
+ # Submit a first request to create a session with default parameters
119
+ assert len(http_session_manager.session_cache) == 0
120
+ response = http_session_manager.json_make_post_request(
121
+ TEST_URI, json={"data": "request"}
122
+ )
123
+ assert response == json.dumps({"data": "content"})
124
+ assert len(http_session_manager.session_cache) == 1
125
+ cache_key = generate_cache_key(f"{threading.get_ident()}:{TEST_URI}")
126
+ session = http_session_manager.session_cache.get_cache_entry(cache_key)
127
+ session.post.assert_called_once_with(TEST_URI, json={"data": "request"}, timeout=30)
128
+
129
+ # Ensure the adapter was created with default values
130
+ check_adapters_mounted(session)
131
+ adapter = session.get_adapter(TEST_URI)
132
+ assert isinstance(adapter, HTTPAdapter)
133
+ assert adapter._pool_connections == DEFAULT_POOLSIZE
134
+ assert adapter._pool_maxsize == DEFAULT_POOLSIZE
135
+
136
+
115
137
  def test_session_manager_make_post_request_no_args(mocker, http_session_manager):
116
138
  mocker.patch("requests.Session.post", return_value=MockedResponse())
117
139
 
@@ -332,6 +354,32 @@ async def test_session_manager_async_json_make_get_request(
332
354
  await session.close()
333
355
 
334
356
 
357
+ @pytest.mark.asyncio
358
+ async def test_session_manager_async_json_make_post_request(
359
+ mocker, http_session_manager
360
+ ):
361
+ mocker.patch("aiohttp.ClientSession.post", return_value=AsyncMockedResponse())
362
+
363
+ # Submit a first request to create a session with default parameters
364
+ assert len(http_session_manager.session_cache) == 0
365
+ response = await http_session_manager.async_json_make_post_request(
366
+ TEST_URI, json={"data": "request"}
367
+ )
368
+ assert response == json.dumps({"data": "content"})
369
+ assert len(http_session_manager.session_cache) == 1
370
+ cache_key = generate_cache_key(f"{threading.get_ident()}:{TEST_URI}")
371
+ session = http_session_manager.session_cache.get_cache_entry(cache_key)
372
+ assert isinstance(session, ClientSession)
373
+ session.post.assert_called_once_with(
374
+ TEST_URI,
375
+ json={"data": "request"},
376
+ timeout=ClientTimeout(
377
+ total=30, connect=None, sock_read=None, sock_connect=None
378
+ ),
379
+ )
380
+ await session.close()
381
+
382
+
335
383
  @pytest.mark.asyncio
336
384
  async def test_session_manager_async_make_post_request(mocker, http_session_manager):
337
385
  mocker.patch("aiohttp.ClientSession.post", return_value=AsyncMockedResponse())