web3 7.1.0__tar.gz → 7.2.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 (354) hide show
  1. {web3-7.1.0/web3.egg-info → web3-7.2.0}/PKG-INFO +1 -1
  2. {web3-7.1.0 → web3-7.2.0}/setup.py +1 -1
  3. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_async_http_provider.py +2 -2
  4. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_http_provider.py +2 -2
  5. web3-7.2.0/web3/_utils/http.py +12 -0
  6. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/eth_module.py +40 -0
  7. {web3-7.1.0 → web3-7.2.0}/web3/middleware/signing.py +2 -2
  8. {web3-7.1.0 → web3-7.2.0}/web3/providers/rpc/async_rpc.py +10 -2
  9. {web3-7.1.0 → web3-7.2.0}/web3/providers/rpc/rpc.py +11 -2
  10. {web3-7.1.0 → web3-7.2.0/web3.egg-info}/PKG-INFO +1 -1
  11. {web3-7.1.0 → web3-7.2.0}/web3.egg-info/SOURCES.txt +0 -5
  12. web3-7.1.0/web3/_utils/http.py +0 -9
  13. web3-7.1.0/web3/tools/benchmark/__init__.py +0 -0
  14. web3-7.1.0/web3/tools/benchmark/main.py +0 -190
  15. web3-7.1.0/web3/tools/benchmark/node.py +0 -120
  16. web3-7.1.0/web3/tools/benchmark/reporting.py +0 -39
  17. web3-7.1.0/web3/tools/benchmark/utils.py +0 -69
  18. {web3-7.1.0 → web3-7.2.0}/LICENSE +0 -0
  19. {web3-7.1.0 → web3-7.2.0}/MANIFEST.in +0 -0
  20. {web3-7.1.0 → web3-7.2.0}/README.md +0 -0
  21. {web3-7.1.0 → web3-7.2.0}/ens/__init__.py +0 -0
  22. {web3-7.1.0 → web3-7.2.0}/ens/_normalization.py +0 -0
  23. {web3-7.1.0 → web3-7.2.0}/ens/abis.py +0 -0
  24. {web3-7.1.0 → web3-7.2.0}/ens/async_ens.py +0 -0
  25. {web3-7.1.0 → web3-7.2.0}/ens/auto.py +0 -0
  26. {web3-7.1.0 → web3-7.2.0}/ens/base_ens.py +0 -0
  27. {web3-7.1.0 → web3-7.2.0}/ens/constants.py +0 -0
  28. {web3-7.1.0 → web3-7.2.0}/ens/contract_data.py +0 -0
  29. {web3-7.1.0 → web3-7.2.0}/ens/ens.py +0 -0
  30. {web3-7.1.0 → web3-7.2.0}/ens/exceptions.py +0 -0
  31. {web3-7.1.0 → web3-7.2.0}/ens/specs/nf.json +0 -0
  32. {web3-7.1.0 → web3-7.2.0}/ens/specs/normalization_spec.json +0 -0
  33. {web3-7.1.0 → web3-7.2.0}/ens/utils.py +0 -0
  34. {web3-7.1.0 → web3-7.2.0}/pyproject.toml +0 -0
  35. {web3-7.1.0 → web3-7.2.0}/setup.cfg +0 -0
  36. {web3-7.1.0 → web3-7.2.0}/tests/.DS_Store +0 -0
  37. {web3-7.1.0 → web3-7.2.0}/tests/__init__.py +0 -0
  38. {web3-7.1.0 → web3-7.2.0}/tests/beacon/test_async_beacon.py +0 -0
  39. {web3-7.1.0 → web3-7.2.0}/tests/beacon/test_beacon.py +0 -0
  40. {web3-7.1.0 → web3-7.2.0}/tests/conftest.py +0 -0
  41. {web3-7.1.0 → web3-7.2.0}/tests/core/admin-module/test_admin_addPeer.py +0 -0
  42. {web3-7.1.0 → web3-7.2.0}/tests/core/admin-module/test_admin_nodeInfo.py +0 -0
  43. {web3-7.1.0 → web3-7.2.0}/tests/core/admin-module/test_admin_peers.py +0 -0
  44. {web3-7.1.0 → web3-7.2.0}/tests/core/block-utils/test_select_method_for_block_identifier.py +0 -0
  45. {web3-7.1.0 → web3-7.2.0}/tests/core/caching-utils/test_generate_cache_key.py +0 -0
  46. {web3-7.1.0 → web3-7.2.0}/tests/core/caching-utils/test_request_caching.py +0 -0
  47. {web3-7.1.0 → web3-7.2.0}/tests/core/conftest.py +0 -0
  48. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/conftest.py +0 -0
  49. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_ambiguous_functions.py +0 -0
  50. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_attributes.py +0 -0
  51. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_build_transaction.py +0 -0
  52. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_call_interface.py +0 -0
  53. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_caller_interface.py +0 -0
  54. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_class_construction.py +0 -0
  55. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_constructor.py +0 -0
  56. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_constructor_encoding.py +0 -0
  57. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_deployment.py +0 -0
  58. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_estimate_gas.py +0 -0
  59. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_events_build_filter.py +0 -0
  60. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_example.py +0 -0
  61. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_init.py +0 -0
  62. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_method_abi_decoding.py +0 -0
  63. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_method_abi_encoding.py +0 -0
  64. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_method_to_argument_matching.py +0 -0
  65. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_panic_errors.py +0 -0
  66. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_transact_interface.py +0 -0
  67. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_contract_util_functions.py +0 -0
  68. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_extracting_event_data.py +0 -0
  69. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_extracting_event_data_old.py +0 -0
  70. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/test_offchain_lookup.py +0 -0
  71. {web3-7.1.0 → web3-7.2.0}/tests/core/contracts/utils.py +0 -0
  72. {web3-7.1.0 → web3-7.2.0}/tests/core/datastructures/test_datastructures.py +0 -0
  73. {web3-7.1.0 → web3-7.2.0}/tests/core/empty-object/test_empty_object_is_falsy.py +0 -0
  74. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/conftest.py +0 -0
  75. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_accounts.py +0 -0
  76. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_block_api.py +0 -0
  77. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_default_account_api.py +0 -0
  78. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_eth_contract.py +0 -0
  79. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_eth_fee_history.py +0 -0
  80. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_eth_filter.py +0 -0
  81. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_eth_properties.py +0 -0
  82. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_gas_pricing.py +0 -0
  83. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_poa.py +0 -0
  84. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-module/test_transactions.py +0 -0
  85. {web3-7.1.0 → web3-7.2.0}/tests/core/eth-tester-api/test_withdrawals.py +0 -0
  86. {web3-7.1.0 → web3-7.2.0}/tests/core/exceptions/test_exceptions.py +0 -0
  87. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/conftest.py +0 -0
  88. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_basic_filter_tests.py +0 -0
  89. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_contract_create_filter_topic_merging.py +0 -0
  90. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_contract_data_filters.py +0 -0
  91. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_contract_get_logs.py +0 -0
  92. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_contract_on_event_filtering.py +0 -0
  93. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_contract_past_event_filtering.py +0 -0
  94. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_contract_topic_filters.py +0 -0
  95. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_existing_filter_instance.py +0 -0
  96. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_filter_against_latest_blocks.py +0 -0
  97. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_filter_against_pending_transactions.py +0 -0
  98. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_filter_against_transaction_logs.py +0 -0
  99. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_filters_against_many_blocks.py +0 -0
  100. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/test_utils_functions.py +0 -0
  101. {web3-7.1.0 → web3-7.2.0}/tests/core/filtering/utils.py +0 -0
  102. {web3-7.1.0 → web3-7.2.0}/tests/core/gas-strategies/test_rpc_gas_pricing_strategies.py +0 -0
  103. {web3-7.1.0 → web3-7.2.0}/tests/core/gas-strategies/test_time_based_gas_price_strategy.py +0 -0
  104. {web3-7.1.0 → web3-7.2.0}/tests/core/manager/conftest.py +0 -0
  105. {web3-7.1.0 → web3-7.2.0}/tests/core/manager/test_default_middlewares.py +0 -0
  106. {web3-7.1.0 → web3-7.2.0}/tests/core/manager/test_middleware_can_be_stateful.py +0 -0
  107. {web3-7.1.0 → web3-7.2.0}/tests/core/manager/test_middleware_onion_api.py +0 -0
  108. {web3-7.1.0 → web3-7.2.0}/tests/core/manager/test_provider_property.py +0 -0
  109. {web3-7.1.0 → web3-7.2.0}/tests/core/manager/test_provider_request_wrapping.py +0 -0
  110. {web3-7.1.0 → web3-7.2.0}/tests/core/manager/test_response_formatters.py +0 -0
  111. {web3-7.1.0 → web3-7.2.0}/tests/core/method-class/test_method.py +0 -0
  112. {web3-7.1.0 → web3-7.2.0}/tests/core/method-class/test_result_formatters.py +0 -0
  113. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_attrdict_middleware.py +0 -0
  114. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_eth_tester_middleware.py +0 -0
  115. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_filter_middleware.py +0 -0
  116. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_formatting_middleware.py +0 -0
  117. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_gas_price_strategy.py +0 -0
  118. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_middleware.py +0 -0
  119. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_name_to_address_middleware.py +0 -0
  120. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_stalecheck.py +0 -0
  121. {web3-7.1.0 → web3-7.2.0}/tests/core/middleware/test_transaction_signing.py +0 -0
  122. {web3-7.1.0 → web3-7.2.0}/tests/core/module-class/test_module.py +0 -0
  123. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_async_ipc_provider.py +0 -0
  124. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_async_tester_provider.py +0 -0
  125. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_auto_provider.py +0 -0
  126. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_base_provider.py +0 -0
  127. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_http_request_retry.py +0 -0
  128. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_ipc_provider.py +0 -0
  129. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_legacy_websocket_provider.py +0 -0
  130. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_tester_provider.py +0 -0
  131. {web3-7.1.0 → web3-7.2.0}/tests/core/providers/test_websocket_provider.py +0 -0
  132. {web3-7.1.0 → web3-7.2.0}/tests/core/test_library_files.py +0 -0
  133. {web3-7.1.0 → web3-7.2.0}/tests/core/testing-module/test_testing_mine.py +0 -0
  134. {web3-7.1.0 → web3-7.2.0}/tests/core/testing-module/test_testing_snapshot_and_revert.py +0 -0
  135. {web3-7.1.0 → web3-7.2.0}/tests/core/testing-module/test_testing_timeTravel.py +0 -0
  136. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/__init__.py +0 -0
  137. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/conftest.py +0 -0
  138. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_abi.py +0 -0
  139. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_abi_filtering_by_argument_name.py +0 -0
  140. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_abi_is_encodable.py +0 -0
  141. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_abi_named_tree.py +0 -0
  142. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_address.py +0 -0
  143. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_async_transaction.py +0 -0
  144. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_attach_modules.py +0 -0
  145. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_attributedict.py +0 -0
  146. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_caching_utils.py +0 -0
  147. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_construct_event_data_set.py +0 -0
  148. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_construct_event_filter_params.py +0 -0
  149. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_construct_event_topics.py +0 -0
  150. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_datatypes.py +0 -0
  151. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_decorators.py +0 -0
  152. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_encoding.py +0 -0
  153. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_event_filter_builder.py +0 -0
  154. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_event_interface.py +0 -0
  155. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_fee_utils.py +0 -0
  156. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_formatters.py +0 -0
  157. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_http_session_manager.py +0 -0
  158. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_is_predefined_block_number.py +0 -0
  159. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_is_probably_enum.py +0 -0
  160. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_is_recognized_type.py +0 -0
  161. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_math.py +0 -0
  162. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_method_formatters.py +0 -0
  163. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_prepare_transaction_replacement.py +0 -0
  164. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_select_filter_method.py +0 -0
  165. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_threads.py +0 -0
  166. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_valid_transaction_params.py +0 -0
  167. {web3-7.1.0 → web3-7.2.0}/tests/core/utilities/test_validation.py +0 -0
  168. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_api.py +0 -0
  169. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_attach_modules.py +0 -0
  170. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_client_version.py +0 -0
  171. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_conversions.py +0 -0
  172. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_import_and_version.py +0 -0
  173. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_keccak.py +0 -0
  174. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_providers.py +0 -0
  175. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_strict_bytes_type_checking.py +0 -0
  176. {web3-7.1.0 → web3-7.2.0}/tests/core/web3-module/test_web3_inheritance.py +0 -0
  177. {web3-7.1.0 → web3-7.2.0}/tests/ens/conftest.py +0 -0
  178. {web3-7.1.0 → web3-7.2.0}/tests/ens/normalization/normalization_tests.json +0 -0
  179. {web3-7.1.0 → web3-7.2.0}/tests/ens/normalization/test_normalize_name_ensip15.py +0 -0
  180. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_ens.py +0 -0
  181. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_get_registry.py +0 -0
  182. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_get_text.py +0 -0
  183. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_nameprep.py +0 -0
  184. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_offchain_resolution.py +0 -0
  185. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_setup_address.py +0 -0
  186. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_setup_name.py +0 -0
  187. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_utils.py +0 -0
  188. {web3-7.1.0 → web3-7.2.0}/tests/ens/test_wildcard_resolution.py +0 -0
  189. {web3-7.1.0 → web3-7.2.0}/tests/integration/.DS_Store +0 -0
  190. {web3-7.1.0 → web3-7.2.0}/tests/integration/README.md +0 -0
  191. {web3-7.1.0 → web3-7.2.0}/tests/integration/common.py +0 -0
  192. {web3-7.1.0 → web3-7.2.0}/tests/integration/conftest.py +0 -0
  193. {web3-7.1.0 → web3-7.2.0}/tests/integration/generate_fixtures/common.py +0 -0
  194. {web3-7.1.0 → web3-7.2.0}/tests/integration/generate_fixtures/go_ethereum.py +0 -0
  195. {web3-7.1.0 → web3-7.2.0}/tests/integration/geth-1.14.5-fixture.zip +0 -0
  196. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/__init__.py +0 -0
  197. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/common.py +0 -0
  198. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/conftest.py +0 -0
  199. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/test_goethereum_http.py +0 -0
  200. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/test_goethereum_ipc.py +0 -0
  201. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/test_goethereum_legacy_ws.py +0 -0
  202. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/test_goethereum_ws/__init__.py +0 -0
  203. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/test_goethereum_ws/conftest.py +0 -0
  204. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_await_w3.py +0 -0
  205. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_ctx_manager_w3.py +0 -0
  206. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_iterator_w3.py +0 -0
  207. {web3-7.1.0 → web3-7.2.0}/tests/integration/go_ethereum/utils.py +0 -0
  208. {web3-7.1.0 → web3-7.2.0}/tests/integration/test_ethereum_tester.py +0 -0
  209. {web3-7.1.0 → web3-7.2.0}/tests/utils.py +0 -0
  210. {web3-7.1.0 → web3-7.2.0}/web3/__init__.py +0 -0
  211. {web3-7.1.0 → web3-7.2.0}/web3/_utils/__init__.py +0 -0
  212. {web3-7.1.0 → web3-7.2.0}/web3/_utils/abi.py +0 -0
  213. {web3-7.1.0 → web3-7.2.0}/web3/_utils/abi_element_identifiers.py +0 -0
  214. {web3-7.1.0 → web3-7.2.0}/web3/_utils/async_caching.py +0 -0
  215. {web3-7.1.0 → web3-7.2.0}/web3/_utils/async_transactions.py +0 -0
  216. {web3-7.1.0 → web3-7.2.0}/web3/_utils/batching.py +0 -0
  217. {web3-7.1.0 → web3-7.2.0}/web3/_utils/blocks.py +0 -0
  218. {web3-7.1.0 → web3-7.2.0}/web3/_utils/caching.py +0 -0
  219. {web3-7.1.0 → web3-7.2.0}/web3/_utils/compat/__init__.py +0 -0
  220. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/__init__.py +0 -0
  221. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/compile_contracts.py +0 -0
  222. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/__init__.py +0 -0
  223. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/_custom_contract_data.py +0 -0
  224. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/arrays_contract.py +0 -0
  225. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/bytes_contracts.py +0 -0
  226. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/constructor_contracts.py +0 -0
  227. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/contract_caller_tester.py +0 -0
  228. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/emitter_contract.py +0 -0
  229. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/event_contracts.py +0 -0
  230. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/extended_resolver.py +0 -0
  231. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/fallback_function_contract.py +0 -0
  232. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +0 -0
  233. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/math_contract.py +0 -0
  234. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/offchain_lookup.py +0 -0
  235. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/offchain_resolver.py +0 -0
  236. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/panic_errors_contract.py +0 -0
  237. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/payable_tester.py +0 -0
  238. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/receive_function_contracts.py +0 -0
  239. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/reflector_contracts.py +0 -0
  240. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/revert_contract.py +0 -0
  241. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/simple_resolver.py +0 -0
  242. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/storage_contract.py +0 -0
  243. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/string_contract.py +0 -0
  244. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contract_sources/contract_data/tuple_contracts.py +0 -0
  245. {web3-7.1.0 → web3-7.2.0}/web3/_utils/contracts.py +0 -0
  246. {web3-7.1.0 → web3-7.2.0}/web3/_utils/datatypes.py +0 -0
  247. {web3-7.1.0 → web3-7.2.0}/web3/_utils/decorators.py +0 -0
  248. {web3-7.1.0 → web3-7.2.0}/web3/_utils/empty.py +0 -0
  249. {web3-7.1.0 → web3-7.2.0}/web3/_utils/encoding.py +0 -0
  250. {web3-7.1.0 → web3-7.2.0}/web3/_utils/ens.py +0 -0
  251. {web3-7.1.0 → web3-7.2.0}/web3/_utils/error_formatters_utils.py +0 -0
  252. {web3-7.1.0 → web3-7.2.0}/web3/_utils/events.py +0 -0
  253. {web3-7.1.0 → web3-7.2.0}/web3/_utils/fee_utils.py +0 -0
  254. {web3-7.1.0 → web3-7.2.0}/web3/_utils/filters.py +0 -0
  255. {web3-7.1.0 → web3-7.2.0}/web3/_utils/formatters.py +0 -0
  256. {web3-7.1.0 → web3-7.2.0}/web3/_utils/http_session_manager.py +0 -0
  257. {web3-7.1.0 → web3-7.2.0}/web3/_utils/hypothesis.py +0 -0
  258. {web3-7.1.0 → web3-7.2.0}/web3/_utils/math.py +0 -0
  259. {web3-7.1.0 → web3-7.2.0}/web3/_utils/method_formatters.py +0 -0
  260. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module.py +0 -0
  261. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/__init__.py +0 -0
  262. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/go_ethereum_admin_module.py +0 -0
  263. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/go_ethereum_txpool_module.py +0 -0
  264. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/module_testing_utils.py +0 -0
  265. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/net_module.py +0 -0
  266. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/persistent_connection_provider.py +0 -0
  267. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/utils.py +0 -0
  268. {web3-7.1.0 → web3-7.2.0}/web3/_utils/module_testing/web3_module.py +0 -0
  269. {web3-7.1.0 → web3-7.2.0}/web3/_utils/normalizers.py +0 -0
  270. {web3-7.1.0 → web3-7.2.0}/web3/_utils/rpc_abi.py +0 -0
  271. {web3-7.1.0 → web3-7.2.0}/web3/_utils/threads.py +0 -0
  272. {web3-7.1.0 → web3-7.2.0}/web3/_utils/transactions.py +0 -0
  273. {web3-7.1.0 → web3-7.2.0}/web3/_utils/type_conversion.py +0 -0
  274. {web3-7.1.0 → web3-7.2.0}/web3/_utils/utility_methods.py +0 -0
  275. {web3-7.1.0 → web3-7.2.0}/web3/_utils/validation.py +0 -0
  276. {web3-7.1.0 → web3-7.2.0}/web3/_utils/windows.py +0 -0
  277. {web3-7.1.0 → web3-7.2.0}/web3/auto/__init__.py +0 -0
  278. {web3-7.1.0 → web3-7.2.0}/web3/auto/gethdev.py +0 -0
  279. {web3-7.1.0 → web3-7.2.0}/web3/beacon/__init__.py +0 -0
  280. {web3-7.1.0 → web3-7.2.0}/web3/beacon/api_endpoints.py +0 -0
  281. {web3-7.1.0 → web3-7.2.0}/web3/beacon/async_beacon.py +0 -0
  282. {web3-7.1.0 → web3-7.2.0}/web3/beacon/beacon.py +0 -0
  283. {web3-7.1.0 → web3-7.2.0}/web3/constants.py +0 -0
  284. {web3-7.1.0 → web3-7.2.0}/web3/contract/__init__.py +0 -0
  285. {web3-7.1.0 → web3-7.2.0}/web3/contract/async_contract.py +0 -0
  286. {web3-7.1.0 → web3-7.2.0}/web3/contract/base_contract.py +0 -0
  287. {web3-7.1.0 → web3-7.2.0}/web3/contract/contract.py +0 -0
  288. {web3-7.1.0 → web3-7.2.0}/web3/contract/utils.py +0 -0
  289. {web3-7.1.0 → web3-7.2.0}/web3/datastructures.py +0 -0
  290. {web3-7.1.0 → web3-7.2.0}/web3/eth/__init__.py +0 -0
  291. {web3-7.1.0 → web3-7.2.0}/web3/eth/async_eth.py +0 -0
  292. {web3-7.1.0 → web3-7.2.0}/web3/eth/base_eth.py +0 -0
  293. {web3-7.1.0 → web3-7.2.0}/web3/eth/eth.py +0 -0
  294. {web3-7.1.0 → web3-7.2.0}/web3/exceptions.py +0 -0
  295. {web3-7.1.0 → web3-7.2.0}/web3/gas_strategies/__init__.py +0 -0
  296. {web3-7.1.0 → web3-7.2.0}/web3/gas_strategies/rpc.py +0 -0
  297. {web3-7.1.0 → web3-7.2.0}/web3/gas_strategies/time_based.py +0 -0
  298. {web3-7.1.0 → web3-7.2.0}/web3/geth.py +0 -0
  299. {web3-7.1.0 → web3-7.2.0}/web3/logs.py +0 -0
  300. {web3-7.1.0 → web3-7.2.0}/web3/main.py +0 -0
  301. {web3-7.1.0 → web3-7.2.0}/web3/manager.py +0 -0
  302. {web3-7.1.0 → web3-7.2.0}/web3/method.py +0 -0
  303. {web3-7.1.0 → web3-7.2.0}/web3/middleware/__init__.py +0 -0
  304. {web3-7.1.0 → web3-7.2.0}/web3/middleware/attrdict.py +0 -0
  305. {web3-7.1.0 → web3-7.2.0}/web3/middleware/base.py +0 -0
  306. {web3-7.1.0 → web3-7.2.0}/web3/middleware/buffered_gas_estimate.py +0 -0
  307. {web3-7.1.0 → web3-7.2.0}/web3/middleware/filter.py +0 -0
  308. {web3-7.1.0 → web3-7.2.0}/web3/middleware/formatting.py +0 -0
  309. {web3-7.1.0 → web3-7.2.0}/web3/middleware/gas_price_strategy.py +0 -0
  310. {web3-7.1.0 → web3-7.2.0}/web3/middleware/names.py +0 -0
  311. {web3-7.1.0 → web3-7.2.0}/web3/middleware/proof_of_authority.py +0 -0
  312. {web3-7.1.0 → web3-7.2.0}/web3/middleware/pythonic.py +0 -0
  313. {web3-7.1.0 → web3-7.2.0}/web3/middleware/stalecheck.py +0 -0
  314. {web3-7.1.0 → web3-7.2.0}/web3/middleware/validation.py +0 -0
  315. {web3-7.1.0 → web3-7.2.0}/web3/module.py +0 -0
  316. {web3-7.1.0 → web3-7.2.0}/web3/net.py +0 -0
  317. {web3-7.1.0 → web3-7.2.0}/web3/providers/__init__.py +0 -0
  318. {web3-7.1.0 → web3-7.2.0}/web3/providers/async_base.py +0 -0
  319. {web3-7.1.0 → web3-7.2.0}/web3/providers/auto.py +0 -0
  320. {web3-7.1.0 → web3-7.2.0}/web3/providers/base.py +0 -0
  321. {web3-7.1.0 → web3-7.2.0}/web3/providers/eth_tester/__init__.py +0 -0
  322. {web3-7.1.0 → web3-7.2.0}/web3/providers/eth_tester/defaults.py +0 -0
  323. {web3-7.1.0 → web3-7.2.0}/web3/providers/eth_tester/main.py +0 -0
  324. {web3-7.1.0 → web3-7.2.0}/web3/providers/eth_tester/middleware.py +0 -0
  325. {web3-7.1.0 → web3-7.2.0}/web3/providers/ipc.py +0 -0
  326. {web3-7.1.0 → web3-7.2.0}/web3/providers/legacy_websocket.py +0 -0
  327. {web3-7.1.0 → web3-7.2.0}/web3/providers/persistent/__init__.py +0 -0
  328. {web3-7.1.0 → web3-7.2.0}/web3/providers/persistent/async_ipc.py +0 -0
  329. {web3-7.1.0 → web3-7.2.0}/web3/providers/persistent/persistent.py +0 -0
  330. {web3-7.1.0 → web3-7.2.0}/web3/providers/persistent/persistent_connection.py +0 -0
  331. {web3-7.1.0 → web3-7.2.0}/web3/providers/persistent/request_processor.py +0 -0
  332. {web3-7.1.0 → web3-7.2.0}/web3/providers/persistent/utils.py +0 -0
  333. {web3-7.1.0 → web3-7.2.0}/web3/providers/persistent/websocket.py +0 -0
  334. {web3-7.1.0 → web3-7.2.0}/web3/providers/rpc/__init__.py +0 -0
  335. {web3-7.1.0 → web3-7.2.0}/web3/providers/rpc/utils.py +0 -0
  336. {web3-7.1.0 → web3-7.2.0}/web3/py.typed +0 -0
  337. {web3-7.1.0 → web3-7.2.0}/web3/scripts/__init__.py +0 -0
  338. {web3-7.1.0 → web3-7.2.0}/web3/scripts/install_pre_releases.py +0 -0
  339. {web3-7.1.0 → web3-7.2.0}/web3/scripts/parse_pygeth_version.py +0 -0
  340. {web3-7.1.0 → web3-7.2.0}/web3/scripts/release/__init__.py +0 -0
  341. {web3-7.1.0 → web3-7.2.0}/web3/scripts/release/test_package.py +0 -0
  342. {web3-7.1.0 → web3-7.2.0}/web3/testing.py +0 -0
  343. {web3-7.1.0 → web3-7.2.0}/web3/tracing.py +0 -0
  344. {web3-7.1.0 → web3-7.2.0}/web3/types.py +0 -0
  345. {web3-7.1.0 → web3-7.2.0}/web3/utils/__init__.py +0 -0
  346. {web3-7.1.0 → web3-7.2.0}/web3/utils/abi.py +0 -0
  347. {web3-7.1.0 → web3-7.2.0}/web3/utils/address.py +0 -0
  348. {web3-7.1.0 → web3-7.2.0}/web3/utils/async_exception_handling.py +0 -0
  349. {web3-7.1.0 → web3-7.2.0}/web3/utils/caching.py +0 -0
  350. {web3-7.1.0 → web3-7.2.0}/web3/utils/exception_handling.py +0 -0
  351. {web3-7.1.0 → web3-7.2.0}/web3.egg-info/dependency_links.txt +0 -0
  352. {web3-7.1.0 → web3-7.2.0}/web3.egg-info/not-zip-safe +0 -0
  353. {web3-7.1.0 → web3-7.2.0}/web3.egg-info/requires.txt +0 -0
  354. {web3-7.1.0 → web3-7.2.0}/web3.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: web3
3
- Version: 7.1.0
3
+ Version: 7.2.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
@@ -51,7 +51,7 @@ with open("./README.md") as readme:
51
51
  setup(
52
52
  name="web3",
53
53
  # *IMPORTANT*: Don't manually change the version here. Use `make bump`, as described in readme
54
- version="7.1.0",
54
+ version="7.2.0",
55
55
  description="""web3: A Python library for interacting with Ethereum""",
56
56
  long_description=long_description,
57
57
  long_description_content_type="text/markdown",
@@ -94,8 +94,8 @@ async def test_async_user_provided_session() -> None:
94
94
  assert cached_session == session
95
95
 
96
96
 
97
- def test_get_request_headers():
98
- provider = AsyncHTTPProvider()
97
+ @pytest.mark.parametrize("provider", (AsyncHTTPProvider(), AsyncHTTPProvider))
98
+ def test_get_request_headers(provider):
99
99
  headers = provider.get_request_headers()
100
100
  assert len(headers) == 2
101
101
  assert headers["Content-Type"] == "application/json"
@@ -101,8 +101,8 @@ def test_user_provided_session():
101
101
  assert adapter._pool_maxsize == 20
102
102
 
103
103
 
104
- def test_get_request_headers():
105
- provider = HTTPProvider()
104
+ @pytest.mark.parametrize("provider", (HTTPProvider(), HTTPProvider))
105
+ def test_get_request_headers(provider):
106
106
  headers = provider.get_request_headers()
107
107
  assert len(headers) == 2
108
108
  assert headers["Content-Type"] == "application/json"
@@ -0,0 +1,12 @@
1
+ DEFAULT_HTTP_TIMEOUT = 30.0
2
+
3
+
4
+ def construct_user_agent(
5
+ module: str,
6
+ class_name: str,
7
+ ) -> str:
8
+ from web3 import (
9
+ __version__ as web3_version,
10
+ )
11
+
12
+ return f"web3.py/{web3_version}/{module}.{class_name}"
@@ -88,6 +88,7 @@ from web3.exceptions import (
88
88
  )
89
89
  from web3.middleware import (
90
90
  ExtraDataToPOAMiddleware,
91
+ SignAndSendRawMiddlewareBuilder,
91
92
  )
92
93
  from web3.types import (
93
94
  ENS,
@@ -725,6 +726,26 @@ class AsyncEthModuleTest:
725
726
  txn_hash = await async_w3.eth.send_raw_transaction(signed.raw_transaction)
726
727
  assert txn_hash == HexBytes(signed.hash)
727
728
 
729
+ @pytest.mark.asyncio
730
+ async def test_async_sign_and_send_raw_middleware(
731
+ self, async_w3: "AsyncWeb3", keyfile_account_pkey: HexStr
732
+ ) -> None:
733
+ keyfile_account = async_w3.eth.account.from_key(keyfile_account_pkey)
734
+ txn: TxParams = {
735
+ "from": keyfile_account.address,
736
+ "to": keyfile_account.address,
737
+ "value": Wei(0),
738
+ "gas": 21000,
739
+ }
740
+ async_w3.middleware_onion.add(
741
+ SignAndSendRawMiddlewareBuilder.build(keyfile_account), "signing"
742
+ )
743
+ txn_hash = await async_w3.eth.send_transaction(txn)
744
+ assert isinstance(txn_hash, HexBytes)
745
+
746
+ # clean up
747
+ async_w3.middleware_onion.remove("signing")
748
+
728
749
  @pytest.mark.asyncio
729
750
  async def test_GasPriceStrategyMiddleware(
730
751
  self,
@@ -3716,6 +3737,25 @@ class EthModuleTest:
3716
3737
  txn_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
3717
3738
  assert txn_hash == HexBytes(signed.hash)
3718
3739
 
3740
+ def test_sign_and_send_raw_middleware(
3741
+ self, w3: "Web3", keyfile_account_pkey: HexStr
3742
+ ) -> None:
3743
+ keyfile_account = w3.eth.account.from_key(keyfile_account_pkey)
3744
+ txn: TxParams = {
3745
+ "from": keyfile_account.address,
3746
+ "to": keyfile_account.address,
3747
+ "value": Wei(0),
3748
+ "gas": 21000,
3749
+ }
3750
+ w3.middleware_onion.add(
3751
+ SignAndSendRawMiddlewareBuilder.build(keyfile_account), "signing"
3752
+ )
3753
+ txn_hash = w3.eth.send_transaction(txn)
3754
+ assert isinstance(txn_hash, HexBytes)
3755
+
3756
+ # cleanup
3757
+ w3.middleware_onion.remove("signing")
3758
+
3719
3759
  def test_eth_call(self, w3: "Web3", math_contract: "Contract") -> None:
3720
3760
  txn_params = math_contract._prepare_transaction(
3721
3761
  abi_element_identifier="add",
@@ -189,7 +189,7 @@ class SignAndSendRawMiddlewareBuilder(Web3MiddlewareBuilder):
189
189
 
190
190
  return (
191
191
  RPCEndpoint("eth_sendRawTransaction"),
192
- [raw_tx.hex()],
192
+ [raw_tx.to_0x_hex()],
193
193
  )
194
194
 
195
195
  # -- async -- #
@@ -220,5 +220,5 @@ class SignAndSendRawMiddlewareBuilder(Web3MiddlewareBuilder):
220
220
 
221
221
  return (
222
222
  RPCEndpoint("eth_sendRawTransaction"),
223
- [raw_tx.hex()],
223
+ [raw_tx.to_0x_hex()],
224
224
  )
@@ -19,6 +19,7 @@ from eth_typing import (
19
19
  URI,
20
20
  )
21
21
  from eth_utils import (
22
+ combomethod,
22
23
  to_dict,
23
24
  )
24
25
 
@@ -108,10 +109,17 @@ class AsyncHTTPProvider(AsyncJSONBaseProvider):
108
109
  yield "headers", self.get_request_headers()
109
110
  yield from self._request_kwargs.items()
110
111
 
111
- def get_request_headers(self) -> Dict[str, str]:
112
+ @combomethod
113
+ def get_request_headers(cls) -> Dict[str, str]:
114
+ if isinstance(cls, AsyncHTTPProvider):
115
+ cls_name = cls.__class__.__name__
116
+ else:
117
+ cls_name = cls.__name__
118
+ module = cls.__module__
119
+
112
120
  return {
113
121
  "Content-Type": "application/json",
114
- "User-Agent": construct_user_agent(type(self)),
122
+ "User-Agent": construct_user_agent(module, cls_name),
115
123
  }
116
124
 
117
125
  async def _make_request(self, method: RPCEndpoint, request_data: bytes) -> bytes:
@@ -16,6 +16,7 @@ from eth_typing import (
16
16
  URI,
17
17
  )
18
18
  from eth_utils import (
19
+ combomethod,
19
20
  to_dict,
20
21
  )
21
22
  import requests
@@ -116,10 +117,18 @@ class HTTPProvider(JSONBaseProvider):
116
117
  yield "headers", self.get_request_headers()
117
118
  yield from self._request_kwargs.items()
118
119
 
119
- def get_request_headers(self) -> Dict[str, str]:
120
+ @combomethod
121
+ def get_request_headers(cls) -> Dict[str, str]:
122
+ if isinstance(cls, HTTPProvider):
123
+ cls_name = cls.__class__.__name__
124
+ else:
125
+ cls_name = cls.__name__
126
+
127
+ module = cls.__module__
128
+
120
129
  return {
121
130
  "Content-Type": "application/json",
122
- "User-Agent": construct_user_agent(type(self)),
131
+ "User-Agent": construct_user_agent(module, cls_name),
123
132
  }
124
133
 
125
134
  def _make_request(self, method: RPCEndpoint, request_data: bytes) -> bytes:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: web3
3
- Version: 7.1.0
3
+ Version: 7.2.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
@@ -338,11 +338,6 @@ web3/scripts/install_pre_releases.py
338
338
  web3/scripts/parse_pygeth_version.py
339
339
  web3/scripts/release/__init__.py
340
340
  web3/scripts/release/test_package.py
341
- web3/tools/benchmark/__init__.py
342
- web3/tools/benchmark/main.py
343
- web3/tools/benchmark/node.py
344
- web3/tools/benchmark/reporting.py
345
- web3/tools/benchmark/utils.py
346
341
  web3/utils/__init__.py
347
342
  web3/utils/abi.py
348
343
  web3/utils/address.py
@@ -1,9 +0,0 @@
1
- DEFAULT_HTTP_TIMEOUT = 30.0
2
-
3
-
4
- def construct_user_agent(class_type: type) -> str:
5
- from web3 import (
6
- __version__ as web3_version,
7
- )
8
-
9
- return f"web3.py/{web3_version}/{class_type.__module__}.{class_type.__qualname__}"
File without changes
@@ -1,190 +0,0 @@
1
- import argparse
2
- import asyncio
3
- from collections import (
4
- defaultdict,
5
- )
6
- import logging
7
- import sys
8
- import timeit
9
- from typing import (
10
- Any,
11
- Callable,
12
- Dict,
13
- Union,
14
- )
15
-
16
- from web3 import (
17
- AsyncHTTPProvider,
18
- AsyncWeb3,
19
- HTTPProvider,
20
- Web3,
21
- )
22
- from web3.middleware import (
23
- BufferedGasEstimateMiddleware,
24
- GasPriceStrategyMiddleware,
25
- )
26
- from web3.tools.benchmark.node import (
27
- GethBenchmarkFixture,
28
- )
29
- from web3.tools.benchmark.reporting import (
30
- print_entry,
31
- print_footer,
32
- print_header,
33
- )
34
- from web3.tools.benchmark.utils import (
35
- wait_for_aiohttp,
36
- wait_for_http,
37
- )
38
- from web3.types import (
39
- Wei,
40
- )
41
-
42
- KEYFILE_PW = "web3py-test"
43
-
44
- parser = argparse.ArgumentParser()
45
- parser.add_argument(
46
- "--num-calls",
47
- type=int,
48
- default=10,
49
- help="The number of RPC calls to make",
50
- )
51
-
52
- # TODO - layers to test:
53
- # contract.functions.method(...).call()
54
- # w3.eth.call(...)
55
- # HTTPProvider.make_request(...)
56
-
57
-
58
- def build_web3_http(endpoint_uri: str) -> Web3:
59
- wait_for_http(endpoint_uri)
60
- _w3 = Web3(
61
- HTTPProvider(endpoint_uri),
62
- middleware=[GasPriceStrategyMiddleware, BufferedGasEstimateMiddleware],
63
- )
64
- return _w3
65
-
66
-
67
- async def build_async_w3_http(endpoint_uri: str) -> AsyncWeb3:
68
- await wait_for_aiohttp(endpoint_uri)
69
- _w3 = AsyncWeb3(
70
- AsyncHTTPProvider(endpoint_uri),
71
- middleware=[GasPriceStrategyMiddleware, BufferedGasEstimateMiddleware],
72
- )
73
- return _w3
74
-
75
-
76
- def sync_benchmark(func: Callable[..., Any], n: int) -> Union[float, str]:
77
- try:
78
- starttime = timeit.default_timer()
79
- for _ in range(n):
80
- func()
81
- endtime = timeit.default_timer()
82
- execution_time = endtime - starttime
83
- return execution_time
84
- except Exception:
85
- return "N/A"
86
-
87
-
88
- async def async_benchmark(func: Callable[..., Any], n: int) -> Union[float, str]:
89
- try:
90
- starttime = timeit.default_timer()
91
- for result in asyncio.as_completed([func() for _ in range(n)]):
92
- await result
93
- execution_time = timeit.default_timer() - starttime
94
- return execution_time
95
- except Exception:
96
- return "N/A"
97
-
98
-
99
- def main(logger: logging.Logger, num_calls: int) -> None:
100
- fixture = GethBenchmarkFixture()
101
- for built_fixture in fixture.build():
102
- for _ in built_fixture:
103
- w3_http = build_web3_http(fixture.endpoint_uri)
104
- try:
105
- loop = asyncio.get_running_loop()
106
- except RuntimeError:
107
- loop = asyncio.new_event_loop()
108
- asyncio.set_event_loop(loop)
109
-
110
- # -- sync -- #
111
- account = w3_http.eth.accounts[0]
112
-
113
- # -- async -- #
114
- async_w3_http = loop.run_until_complete(
115
- build_async_w3_http(fixture.endpoint_uri)
116
- )
117
- async_accounts = loop.run_until_complete(async_w3_http.eth.accounts)
118
- async_account = async_accounts[0]
119
-
120
- methods = [
121
- {
122
- "name": "eth_gasPrice",
123
- "params": {},
124
- "exec": lambda w3_http=w3_http: w3_http.eth.gas_price,
125
- "async_exec": lambda async_w3_http=async_w3_http: async_w3_http.eth.gas_price, # noqa: E501
126
- },
127
- {
128
- "name": "eth_sendTransaction",
129
- "params": {},
130
- "exec": lambda w3_http=w3_http, account=account: w3_http.eth.send_transaction( # noqa: E501
131
- {
132
- "to": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
133
- "from": account,
134
- "value": Wei(1),
135
- }
136
- ),
137
- "async_exec": lambda async_w3_http=async_w3_http, async_account=async_account: async_w3_http.eth.send_transaction( # noqa: E501
138
- {
139
- "to": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
140
- "from": async_account,
141
- "value": Wei(1),
142
- }
143
- ),
144
- },
145
- {
146
- "name": "eth_blockNumber",
147
- "params": {},
148
- "exec": lambda w3_http=w3_http: w3_http.eth.block_number,
149
- "async_exec": lambda async_w3_http=async_w3_http: async_w3_http.eth.block_number, # noqa: E501
150
- },
151
- {
152
- "name": "eth_getBlock",
153
- "params": {},
154
- "exec": lambda w3_http=w3_http: w3_http.eth.get_block(1),
155
- "async_exec": lambda async_w3_http=async_w3_http: async_w3_http.eth.get_block( # noqa: E501
156
- 1
157
- ),
158
- },
159
- ]
160
-
161
- def benchmark(
162
- method: Dict[str, Any], loop: asyncio.AbstractEventLoop = loop
163
- ) -> None:
164
- outcomes: Dict[str, Union[str, float]] = defaultdict(lambda: "N/A")
165
- outcomes["name"] = method["name"]
166
- outcomes["HTTPProvider"] = sync_benchmark(
167
- method["exec"],
168
- num_calls,
169
- )
170
- outcomes["AsyncHTTPProvider"] = loop.run_until_complete(
171
- async_benchmark(method["async_exec"], num_calls)
172
- )
173
- print_entry(logger, outcomes)
174
-
175
- print_header(logger, num_calls)
176
-
177
- for method in methods:
178
- benchmark(method)
179
-
180
- print_footer(logger)
181
-
182
-
183
- if __name__ == "__main__":
184
- args = parser.parse_args()
185
-
186
- logger = logging.getLogger()
187
- logger.setLevel(logging.INFO)
188
- logger.addHandler(logging.StreamHandler(sys.stdout))
189
-
190
- main(logger, args.num_calls)
@@ -1,120 +0,0 @@
1
- import os
2
- import socket
3
- from subprocess import (
4
- PIPE,
5
- Popen,
6
- check_output,
7
- )
8
- from tempfile import (
9
- TemporaryDirectory,
10
- )
11
- from typing import (
12
- Any,
13
- Generator,
14
- Sequence,
15
- )
16
- import zipfile
17
-
18
- from geth.install import (
19
- get_executable_path,
20
- install_geth,
21
- )
22
-
23
- from web3.tools.benchmark.utils import (
24
- kill_proc_gracefully,
25
- )
26
-
27
- GETH_FIXTURE_ZIP = "geth-1.14.5-fixture.zip"
28
-
29
-
30
- class GethBenchmarkFixture:
31
- def __init__(self) -> None:
32
- self.rpc_port = self._rpc_port()
33
- self.endpoint_uri = self._endpoint_uri()
34
- self.geth_binary = self._geth_binary()
35
-
36
- def build(self) -> Generator[Any, None, None]:
37
- with TemporaryDirectory() as base_dir:
38
- zipfile_path = os.path.abspath(
39
- os.path.join(
40
- os.path.dirname(__file__),
41
- "../../../tests/integration/",
42
- GETH_FIXTURE_ZIP,
43
- )
44
- )
45
- tmp_datadir = os.path.join(str(base_dir), "datadir")
46
- with zipfile.ZipFile(zipfile_path, "r") as zip_ref:
47
- zip_ref.extractall(tmp_datadir)
48
- self.datadir = tmp_datadir
49
-
50
- genesis_file = os.path.join(self.datadir, "genesis.json")
51
-
52
- yield self._geth_process(self.datadir, genesis_file, self.rpc_port)
53
-
54
- def _rpc_port(self) -> str:
55
- sock = socket.socket()
56
- sock.bind(("127.0.0.1", 0))
57
- port = sock.getsockname()[1]
58
- sock.close()
59
- return str(port)
60
-
61
- def _endpoint_uri(self) -> str:
62
- return f"http://localhost:{self.rpc_port}"
63
-
64
- def _geth_binary(self) -> str:
65
- if "GETH_BINARY" in os.environ:
66
- return os.environ["GETH_BINARY"]
67
- elif "GETH_VERSION" in os.environ:
68
- geth_version = os.environ["GETH_VERSION"]
69
- _geth_binary = get_executable_path(geth_version)
70
- if not os.path.exists(_geth_binary):
71
- install_geth(geth_version)
72
- assert os.path.exists(_geth_binary)
73
- return _geth_binary
74
- else:
75
- return "geth"
76
-
77
- def _geth_command_arguments(self, datadir: str) -> Sequence[str]:
78
- return (
79
- self.geth_binary,
80
- "--dev",
81
- "--dev.period",
82
- "100",
83
- "--datadir",
84
- datadir,
85
- "--nodiscover",
86
- "--http",
87
- "--http.port",
88
- self.rpc_port,
89
- "--http.api",
90
- "admin,eth,net,web3",
91
- "--ipcdisable",
92
- "--password",
93
- os.path.join(datadir, "keystore", "pw.txt"),
94
- )
95
-
96
- def _geth_process(
97
- self, datadir: str, genesis_file: str, rpc_port: str
98
- ) -> Generator[Any, None, None]:
99
- init_datadir_command = (
100
- self.geth_binary,
101
- "--datadir",
102
- str(datadir),
103
- "init",
104
- str(genesis_file),
105
- )
106
- check_output(
107
- init_datadir_command,
108
- stdin=PIPE,
109
- stderr=PIPE,
110
- )
111
- proc = Popen(
112
- self._geth_command_arguments(datadir),
113
- stdin=PIPE,
114
- stdout=PIPE,
115
- stderr=PIPE,
116
- )
117
- try:
118
- yield proc
119
- finally:
120
- kill_proc_gracefully(proc)
@@ -1,39 +0,0 @@
1
- from logging import (
2
- Logger,
3
- )
4
- from typing import (
5
- Any,
6
- Dict,
7
- )
8
-
9
-
10
- def print_header(logger: Logger, num_calls: int) -> None:
11
- logger.info(
12
- "|{:^26}|{:^20}|{:^20}|{:^20}|{:^20}|".format(
13
- f"Method ({num_calls} calls)",
14
- "HTTPProvider",
15
- "AsyncHTTProvider",
16
- "IPCProvider",
17
- "WebSocketProvider",
18
- )
19
- )
20
- logger.info("-" * 112)
21
-
22
-
23
- def print_entry(
24
- logger: Logger,
25
- method_benchmarks: Dict[str, Any],
26
- ) -> None:
27
- logger.info(
28
- "|{:^26}|{:^20.10}|{:^20.10}|{:^20.10}|{:^20.10}|".format(
29
- method_benchmarks["name"],
30
- method_benchmarks["HTTPProvider"],
31
- method_benchmarks["AsyncHTTPProvider"],
32
- method_benchmarks["IPCProvider"],
33
- method_benchmarks["WebSocketProvider"],
34
- )
35
- )
36
-
37
-
38
- def print_footer(logger: Logger) -> None:
39
- logger.info("-" * 112)
@@ -1,69 +0,0 @@
1
- import asyncio
2
- import signal
3
- import socket
4
- import time
5
- from typing import (
6
- Any,
7
- )
8
-
9
- import aiohttp
10
- import requests
11
-
12
-
13
- def wait_for_socket(ipc_path: str, timeout: int = 30) -> None:
14
- start = time.time()
15
- while time.time() < start + timeout:
16
- try:
17
- sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
18
- sock.connect(ipc_path)
19
- sock.settimeout(timeout)
20
- except OSError:
21
- time.sleep(0.01)
22
- else:
23
- break
24
-
25
-
26
- def wait_for_http(endpoint_uri: str, timeout: int = 60) -> None:
27
- start = time.time()
28
- while time.time() < start + timeout:
29
- try:
30
- requests.get(endpoint_uri)
31
- except requests.ConnectionError:
32
- time.sleep(0.01)
33
- else:
34
- break
35
-
36
-
37
- async def wait_for_aiohttp(endpoint_uri: str, timeout: int = 60) -> None:
38
- start = time.time()
39
- while time.time() < start + timeout:
40
- try:
41
- async with aiohttp.ClientSession() as session:
42
- await session.get(endpoint_uri)
43
- except aiohttp.client_exceptions.ClientConnectorError:
44
- await asyncio.sleep(0.01)
45
- else:
46
- break
47
-
48
-
49
- def wait_for_popen(proc: Any, timeout: int) -> None:
50
- start = time.time()
51
- while time.time() < start + timeout:
52
- if proc.poll() is None:
53
- time.sleep(0.01)
54
- else:
55
- break
56
-
57
-
58
- def kill_proc_gracefully(proc: Any) -> None:
59
- if proc.poll() is None:
60
- proc.send_signal(signal.SIGINT)
61
- wait_for_popen(proc, 13)
62
-
63
- if proc.poll() is None:
64
- proc.terminate()
65
- wait_for_popen(proc, 5)
66
-
67
- if proc.poll() is None:
68
- proc.kill()
69
- wait_for_popen(proc, 2)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes