Skip to content

Deprecate Geth miner namespace #2857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 84 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
4f851f6
Initial commit for middleware refactor
fselmo Nov 8, 2023
91a3bbe
Refactor new middleware onion setup
fselmo Nov 16, 2023
390a3a5
Refactor caching as a decorator on ``make_request()``
fselmo Nov 18, 2023
0310019
Remove middleware dependent on old logic
fselmo Nov 21, 2023
64c5c5a
Add request mocker fixture for mocking requests
fselmo Nov 22, 2023
eba412e
Some refactoring to make cached_requests work with WSV2
fselmo Nov 29, 2023
48002a5
WIP: Fix or comment out core test errors so core suite can run
fselmo Nov 29, 2023
ef7e040
Allow for manipulating the method via middleware
fselmo Nov 30, 2023
0b6683f
Re-introduce the sandwiched middleware model via a method on the midd…
fselmo Dec 5, 2023
582237d
Build on the wrapped make_request middleware refactor
fselmo Dec 7, 2023
2e66c8f
Fix remaining tests that were broken due to refactor
fselmo Dec 8, 2023
90dc3b4
Remove the necessity for the ``abi_middleware``
fselmo Dec 8, 2023
f0a16df
Reinstate the http retry request tests as configuration
fselmo Dec 13, 2023
46e8786
Fix type hinting for refactor
fselmo Dec 14, 2023
45b0bca
Fix inconsistency with eth-tester integration test
fselmo Dec 15, 2023
66ceac5
Remove unnecessary imports hidden by # noqa: F401
fselmo Dec 15, 2023
e52d693
use request mocker + no need to format logsBloom in eth-tester middle…
fselmo Dec 15, 2023
b0c0173
Rename all references of geth_poa to extradata_to_poa
fselmo Dec 15, 2023
a261936
Minor cleanups from refactor PR
fselmo Dec 15, 2023
7e08b98
'name_to_address' -> 'ens_name_to_address' for consistency.
fselmo Dec 18, 2023
8190d7f
Make caching more robust; add tests back for cached requests
fselmo Dec 18, 2023
e20cb86
Changes from comments on PR #3169
fselmo Jan 16, 2024
6f48709
Use as_tuple_of_middlewares() to get around typing issues
fselmo Jan 18, 2024
635b542
newsfragment for 3169
fselmo Jan 18, 2024
e6ae0b0
Validate geth version in test fixture against binary used for tests
fselmo Jan 18, 2024
c4f3a8c
newsfragment for #3193
fselmo Jan 18, 2024
755dd51
closes #2884 - drop lru-dict dependency
fselmo Jan 22, 2024
84609c3
newsfragment for #3196
fselmo Jan 22, 2024
1ee4312
Drop support for python 3.7:
fselmo Jan 20, 2024
2af83cc
newsfragment for #3198
fselmo Jan 22, 2024
6ea78ef
address comments from #3195
fselmo Jan 22, 2024
2c947dd
Use a message listener background task over ws.recv()
fselmo Dec 26, 2023
23c4faa
Make listener task exception handling a boolean
fselmo Dec 27, 2023
7de0980
Improve INFO logging and naming for new wsv2 setup
fselmo Dec 27, 2023
1fc4071
Add tests around message listener task; some refactor + renaming
fselmo Dec 28, 2023
2a7f890
``listen_to_websocket`` -> ``process_subscriptions`` renaming:
fselmo Dec 28, 2023
fe96e1e
Update documentation around the websocket provider v2 refactor
fselmo Dec 28, 2023
9ae0e13
``pass`` instead of INFO logging for expected exceptions.
fselmo Dec 28, 2023
82ffc87
Only yield active subscriptions.
fselmo Jan 3, 2024
b9582d0
Pass ``PersistentConnectionProvider`` kwargs through
fselmo Jan 8, 2024
48dfd4d
Add a test for listen Event when subs queue is full
fselmo Jan 11, 2024
402ab62
Add newsfragment for #3179
fselmo Jan 11, 2024
51407e6
Keep the message listener alive inside a while True
fselmo Jan 12, 2024
a0b9964
Changes from comments on #3179
fselmo Jan 23, 2024
fc53f9b
re-compile test contracts with solidity ``v0.8.24``
fselmo Jan 25, 2024
68ee4df
newsfragment for #3204
fselmo Jan 25, 2024
f1c23b0
Raise exceptions by default; opt to silence in message listener task
fselmo Jan 24, 2024
5f01477
newsfragment for #3202
fselmo Jan 25, 2024
47dd1b7
Update documentation for ``WebsocketProviderV2`` + minor refactor.
fselmo Jan 25, 2024
7e5ecc9
Formatting updates for black v24.1.0
reedsa Jan 26, 2024
bfe11be
newsfragment for #3207
reedsa Jan 26, 2024
1b0e66f
Fix types - AsyncContractConstructor
Nov1kov Jan 18, 2024
495c9ea
restore class order and add newsfragment
pacrob Jan 26, 2024
4410048
``geth --dev`` test fixture setup (#3191)
fselmo Jan 30, 2024
a92b854
Catch newly raised geth errors when tx indexing in progress:
fselmo Feb 1, 2024
6c74824
newsfragment for #3216
fselmo Feb 1, 2024
3cd9572
Minor update to docstrings for #3216
fselmo Feb 1, 2024
9a45475
Update documentation related to the middleware refactor:
fselmo Jan 22, 2024
ce94359
Update setup for HTTP rexception retry config
fselmo Jan 29, 2024
980f478
Update documentation on caching and exception retries for v7
fselmo Jan 29, 2024
35470af
Start the ``v6`` -> ``v7`` migration guide
fselmo Jan 29, 2024
adc468a
Relevant newsfragments for #3211
fselmo Jan 29, 2024
d30980d
Clarify how custom middleware can be added to the stack
fselmo Jan 29, 2024
9ce2353
Remove references to middleware classes; opt for class-only
fselmo Jan 29, 2024
614a073
Fix issues with missing repr of unhashables in middleware onion
fselmo Jan 29, 2024
af6f4ee
Final cleanups after removing middleware references to classes
fselmo Jan 30, 2024
c496b43
changes from comments on PR #3211
fselmo Jan 31, 2024
55f3ac0
Return function in contract function iterator (#3200)
reedsa Feb 5, 2024
6f707c2
format as code
fselmo Feb 5, 2024
3681f5e
Update eth-tester and add support for eth_feeHistory
fselmo Dec 15, 2023
11d8be2
newsfragment for #3172
fselmo Feb 5, 2024
47c0d03
Estimate Gas with State Override (#3168)
reedsa Feb 5, 2024
076ee55
Add formatters for Cancun block header fields:
fselmo Feb 6, 2024
7225dfd
newsfragment for #3223
fselmo Feb 6, 2024
3ebd0ae
``CallOverride`` -> ``StateOverride``
fselmo Feb 6, 2024
466c4ea
news for #3227
fselmo Feb 6, 2024
2e6f2a4
Add note for CallOverride -> StateOverride to v7 migration
fselmo Feb 7, 2024
79979a3
Move newsfragment to newsfragment directory (#3229)
kclowes Feb 12, 2024
3443604
Contract Events Sorted by `ContractEvent.logIndex` and `ContractEvent…
reedsa Feb 12, 2024
21b76b7
Upgrade geth fixture (#3231)
kclowes Feb 14, 2024
4bf16d4
chore: fix typos
ymittal Feb 17, 2024
c0c30da
Deprecate Geth miner namespace
e3243eric Mar 13, 2023
5a1fd59
`DeprecatedMethod` class takes `msg` kwarg for custom warnings
reedsa Feb 20, 2024
220c2a6
Newsfragment for #2857
reedsa Feb 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
158 changes: 2 additions & 156 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ version: 2.1
parameters:
geth_version:
# update default value when updating geth integration test fixture
default: "v1.11.6"
default: "v1.13.11"
type: string
pygeth_version:
# update default value when updating geth integration test fixture
default: "3.13.0"
default: "4.3.0"
type: string
go_version:
default: "1.20.2"
Expand Down Expand Up @@ -107,7 +107,6 @@ geth_steps: &geth_steps
fi
sudo ln -s /home/circleci/.py-geth/geth-<< pipeline.parameters.geth_version >>/bin/geth /usr/local/bin/geth
geth version
geth makedag 0 $HOME/.ethash
- run:
name: run tox
command: python -m tox -r
Expand Down Expand Up @@ -148,7 +147,6 @@ geth_custom_steps: &geth_custom_steps
sudo apt-get update;
sudo apt-get install -y build-essential;
./custom_geth version
./custom_geth makedag 0 $HOME/.ethash
- run:
name: run tox
command: python -m tox -r
Expand Down Expand Up @@ -236,140 +234,6 @@ jobs:
environment:
TOXENV: docs


#
# Python 3.7
#
py37-core:
<<: *common
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-core

py37-core_async:
<<: *common
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-core_async

py37-ens:
<<: *common
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-ens

py37-ensip15:
<<: *common
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-ensip15

py37-ethpm:
<<: *ethpm_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-ethpm
# Please don't use this key for any shenanigans
WEB3_INFURA_PROJECT_ID: $WEB3_INFURA_PROJECT_ID

py37-integration-goethereum-ipc:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-ipc

py37-integration-goethereum-ipc_flaky:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-ipc_flaky

py37-integration-goethereum-http:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-http

py37-integration-goethereum-http_async:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-http_async

py37-integration-goethereum-http_async_flaky:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-http_async_flaky

py37-integration-goethereum-http_flaky:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-http_flaky

py37-integration-goethereum-ws:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-ws

py37-integration-goethereum-ws_flaky:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-ws_flaky

py37-integration-goethereum-ws-v2:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-ws_v2

py37-integration-goethereum-ws-v2_flaky:
<<: *geth_steps
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-goethereum-ws_v2_flaky

py37-integration-ethtester-pyevm:
<<: *common
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-ethtester
ETHEREUM_TESTER_CHAIN_BACKEND: eth_tester.backends.PyEVMBackend

py37-integration-ethtester-pyevm_flaky:
<<: *common
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-integration-ethtester_flaky
ETHEREUM_TESTER_CHAIN_BACKEND: eth_tester.backends.PyEVMBackend

py37-wheel-cli:
<<: *common
docker:
- image: cimg/python:3.7
environment:
TOXENV: py37-wheel-cli

#
# Python 3.8
#
Expand Down Expand Up @@ -945,34 +809,16 @@ workflows:
test:
jobs:
# These are the longest running tests, start them first
- py37-core
- py38-core
- py39-core
- py310-core
- py311-core
- py37-core_async
- py38-core_async
- py39-core_async
- py310-core_async
- py311-core_async
- docs
- benchmark
- py37-ens
- py37-ensip15
- py37-ethpm
- py37-integration-goethereum-ipc
- py37-integration-goethereum-ipc_flaky
- py37-integration-goethereum-http
- py37-integration-goethereum-http_async
- py37-integration-goethereum-http_async_flaky
- py37-integration-goethereum-http_flaky
- py37-integration-goethereum-ws
- py37-integration-goethereum-ws_flaky
- py37-integration-goethereum-ws-v2
- py37-integration-goethereum-ws-v2_flaky
- py37-integration-ethtester-pyevm
- py37-integration-ethtester-pyevm_flaky
- py37-wheel-cli
- py38-lint
- py38-ens
- py38-ensip15
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ docs/web3.gas_strategies.rst
docs/web3.middleware.rst
docs/web3.providers.eth_tester.rst
docs/web3.providers.rst
docs/web3.providers.rpc.rst
docs/web3.providers.websocket.rst
docs/web3.rst
docs/web3.scripts.release.rst
Expand Down
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ force_sort_within_sections=true
include_trailing_comma=true
extra_standard_library=pytest
known_first_party=web3,ens,ethpm
known_third_party=lru,eth_tester
known_third_party=eth_tester
line_length=88
use_parentheses=true
# skip `__init__.py` files because sometimes order of initialization is important
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

A Python library for interacting with Ethereum.

- Python 3.7.2+ support
- Python 3.8+ support

---

Expand Down
9 changes: 8 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"web3.gas_strategies.rst",
"web3.middleware.rst",
"web3.providers.rst",
"web3.providers.rpc.rst",
"web3.providers.websocket.rst",
"web3.providers.eth_tester.rst",
"web3.scripts.*",
Expand Down Expand Up @@ -224,7 +225,13 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
("index", "Populus.tex", "Populus Documentation", "The Ethereum Foundation", "manual"),
(
"index",
"Populus.tex",
"Populus Documentation",
"The Ethereum Foundation",
"manual",
),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down
6 changes: 3 additions & 3 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ You can use ``tox`` to run all the tests for a given version of Python:

.. code:: sh

$ tox -e py37-core
$ tox -e py38-core


Linting is also performed by the CI. You can save yourself some time by checking for
Expand Down Expand Up @@ -373,13 +373,13 @@ Geth Fixtures

.. code:: sh

$ python -m geth.install v1.11.6
$ python -m geth.install v1.13.11

2. Specify the Geth binary and run the fixture creation script (from within the web3.py directory):

.. code:: sh

$ GETH_BINARY=~/.py-geth/geth-v1.11.6/bin/geth python ./tests/integration/generate_fixtures/go_ethereum.py ./tests/integration/geth-1.11.6-fixture
$ GETH_BINARY=~/.py-geth/geth-v1.13.11/bin/geth python ./tests/integration/generate_fixtures/go_ethereum.py ./tests/integration/geth-1.13.11-fixture

3. The output of this script is your fixture, a zip file, which is now stored in ``/tests/integration/``.
Update the ``/tests/integration/go_ethereum/conftest.py`` and
Expand Down
15 changes: 7 additions & 8 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ There are a few options for sending transactions:
- :meth:`~web3.eth.Eth.send_transaction`
- :meth:`~web3.eth.Eth.send_raw_transaction`
- Calling :meth:`~web3.contract.ContractFunction.transact` on a contract function
- Utilizing :meth:`~web3.middleware.construct_sign_and_send_raw_middleware`
- Configuring the sign-and-send middleware :class:`~web3.middleware.SignAndSendRawMiddlewareBuilder`

For more context, see the :doc:`transactions` Guide.

Expand Down Expand Up @@ -688,8 +688,8 @@ Inject the middleware into the middleware onion

.. code-block:: python

from web3.middleware import geth_poa_middleware
w3.middleware_onion.inject(geth_poa_middleware, layer=0)
from web3.middleware import ExtraDataToPOAMiddleware
w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)

Just remember that you have to sign all transactions locally, as infura does not handle any keys from your wallet ( refer to `this`_ )

Expand Down Expand Up @@ -797,7 +797,7 @@ The following example code is divided into a reusable ``EventScanner`` class and

* only supports ``HTTPS`` providers, because JSON-RPC retry logic depends on the implementation details of the underlying protocol,

* disables the standard ``http_retry_request_middleware`` because it does not know how to handle the shrinking block range window for ``eth_getLogs``, and
* disables the default exception retry configuration because it does not know how to handle the shrinking block range window for ``eth_getLogs``, and

* consumes around 20k JSON-RPC API calls.

Expand Down Expand Up @@ -886,7 +886,7 @@ The script can be run with: ``python ./eventscanner.py <your JSON-RPC API URL>``
Unlike the easy web3.contract.Contract, this scanner can scan events from multiple contracts at once.
For example, you can get all transfers from all tokens in the same scan.

You *should* disable the default `http_retry_request_middleware` on your provider for Web3,
You *should* disable the default ``exception_retry_configuration`` on your provider for Web3,
because it cannot correctly throttle and decrease the `eth_getLogs` block number range.
"""

Expand Down Expand Up @@ -1373,10 +1373,9 @@ The script can be run with: ``python ./eventscanner.py <your JSON-RPC API URL>``

provider = HTTPProvider(api_url)

# Remove the default JSON-RPC retry middleware
# Disable the default JSON-RPC retry configuration
# as it correctly cannot handle eth_getLogs block range
# throttle down.
provider.middlewares.clear()
provider.exception_retry_configuration = None

w3 = Web3(provider)

Expand Down
4 changes: 1 addition & 3 deletions docs/gas_price.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,4 @@ Available gas price strategies
w3 = Web3()
w3.eth.set_gas_price_strategy(medium_gas_price_strategy)

w3.middleware_onion.add(middleware.time_based_cache_middleware)
w3.middleware_onion.add(middleware.latest_block_based_cache_middleware)
w3.middleware_onion.add(middleware.simple_cache_middleware)
w3.provider.cache_allowed_requests = True
Loading