Skip to content
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

Deprecate Geth miner namespace #2857

Closed
wants to merge 84 commits into from
Closed

Conversation

e3243eric
Copy link
Contributor

@e3243eric e3243eric commented Mar 2, 2023

What was wrong?

Closes #2856

Geth removed support for their miner API.

How was it fixed?

Change GethMiner methods to DeprecatedMethod.

Todo:

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@e3243eric
Copy link
Contributor Author

e3243eric commented Mar 2, 2023

I'm wondering why the tests in tests/core/mining-module are always skipped.

@kclowes
Copy link
Collaborator

kclowes commented Mar 6, 2023

Thank you!

I'm wondering why the tests in tests/core/mining-module are always skipped.

The core tests run with the eth-tester provider which doesn't have mining implemented.

I'm hoping I'll be able to review this later in the week!

@e3243eric e3243eric force-pushed the geth-miner branch 3 times, most recently from dd72dd6 to 67425f3 Compare March 13, 2023 13:51
Copy link
Contributor

@reedsa reedsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit about the newsfragment filename, otherwise lgtm! @kclowes do you have any feedback here?

newsfragments/2857.removal.rst Outdated Show resolved Hide resolved
tests/core/mining-module/test_miner_start.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@kclowes kclowes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviving this PR, @reedsa!

@e3243eric I made a comment around the messaging in the DeprecatedMethod class, let me know what you think. I'm happy to make that update if you don't want/have time to, just let me know!

Thanks for taking it on!

web3/_utils/miner.py Outdated Show resolved Hide resolved
- Refactor middlewares as classes with request processors and response processors
- Apply this refactor to some existing middlewares and test
  - gas_price_strategy_middleware
  - validation / formatting middleware
  - attrdict_middleware
  - (incomplete) ens_name_to_address_middleware
- Refactor the exception_retry_middleware to be a configuration on the http providers
- Remove all caching middleware.
- Refactor request caching via configurations on the provider classes and decorators on their respective ``make_request()`` methods.
- This middleware depends on a request always being made when middleware are processed. This isn't how the middleware is processed for websockets and the separation of middleware into request param processing and response processing further helps with being able to support batch requests. Remove all middleware that were dependent on a request always being sandwiched between request processing and response processing.
- Add a ``RequestMocker`` class with ``request_mocker`` pytest fixture to fascilitate request mocking now that the middleware doesn't sequester the ``make_request()`` call. Since we can't swap the ``make_request()`` on the fly, mock results and errors using this test utility class.
- Linting
- Some cleanup along the way
- In the middleware refactor, we weren't accounting for manipulating the ``method``, only the params. Allow for this kind of manipulation as it is necessary for ``sign_and_send_raw_middleware``, for example.
…leware class

- Use a repr() for the middleware onion name when a non-hashable, such as the curried `build` method on a web3middlewarebuilder is used.
- Add support back for ``local_filter_middleware`` by overriding the ``_wrap_make_request()`` of the base middleware class. If this method is overridden, the ``make_request`` can be effectively replaced if a request is not needed.
- closes ethereum#2995
- ``ens_name_to_address_middleware`` would return the ``bytes`` address, rather than checksummed address. Since this happens after the ``request_formatters`` have been applied, this would override the results from the ``ABI_REQUEST_FORMATTERS`` which take ``address`` types and format them to a checksummed hex address.
…ware

- Use request_mocker where we can
- result_processors take care of the formatting... this was causing the ``None`` value for logsBloom to raise when mocked
- The middleware changed names in the refactor, but this commit puts the finishing touches and closes ethereum#899
- Make request caching more robust by re-introducing the lock from the middleware as well as checking for "error" and None responses and not caching those.
- Re-introduce the tests for the simple_cache_middleware as caching utils tests.

[Unrelated]

- Keep the decorator logic on ``make_request`` when using the ``request_mocker`` fixture so we can still utilized the request mocker for testing cached requests.
fselmo and others added 8 commits February 7, 2024 10:50
- State overrid is used in more requests than just ``eth_call``.
  We should use a more generic name that suits this type more.
  ``StateOverride`` seems the most appropriate here.
….blockNumber` (ethereum#3228)

* Sort events by logIndex

* Test for contract event logs to ensure sort order

* Add doc for get_logs sort order

* Update sort by block number and log index

* newsfragment for ethereum#3228
* Rename fixture file, updates to circle config

* Add newsfragment
@reedsa reedsa force-pushed the geth-miner branch 4 times, most recently from a275217 to 915bcc1 Compare February 20, 2024 22:12
Copy link
Contributor

@pacrob pacrob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! - but should be to v6, removed for v7, yes?

@fselmo
Copy link
Collaborator

fselmo commented Feb 21, 2024

lgtm! - but should be to v6, removed for v7, yes?

Yep, along with #3236, this should close it all out

@fselmo fselmo changed the base branch from main to v6 February 21, 2024 20:24
@fselmo fselmo added the deprecate in v6 Deprecations that need to be made in v6 branch and are set to be removed in the v7 branch label Feb 21, 2024
@reedsa
Copy link
Contributor

reedsa commented Feb 21, 2024

Rebased this against main by mistake, closing in favor of #3238

@reedsa reedsa closed this Feb 21, 2024
reedsa added a commit to reedsa/web3.py that referenced this pull request Feb 21, 2024
reedsa added a commit to reedsa/web3.py that referenced this pull request Mar 4, 2024
reedsa added a commit that referenced this pull request Mar 4, 2024
* Deprecate Geth miner namespace

* `DeprecatedMethod` class takes `msg` kwarg for custom warnings

* Remove warn check from geth fixture generation script

* Refactor DeprecatedMethod.__get__ warning

* Newsfragment for #2857

---------

Co-authored-by: e3243eric <e0525eric@gmail.com>
EgorHenek pushed a commit to EgorHenek/karmony that referenced this pull request Apr 5, 2024
Bumps [web3](https://github.com/ethereum/web3.py) from 6.15.1 to 6.16.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/ethereum/web3.py/blob/v6.16.0/docs/releases.rst">web3's
changelog</a>.</em></p>
<blockquote>
<h2>web3.py v6.16.0 (2024-03-28)</h2>
<p>Bugfixes</p>
<pre><code>
- Catch all types of ``eth-abi`` ``DecodingError`` in
``EthereumTesterProvider-&gt;_make_request()``
(`[#3267](ethereum/web3.py#3267)
&lt;https://github.com/ethereum/web3.py/issues/3267&gt;`__)
- Fix/update methods and decorators in ``web3/_utils/abi.py`` to address
issues raised by ``mypy``
(`[#3273](ethereum/web3.py#3273)
&lt;https://github.com/ethereum/web3.py/issues/3273&gt;`__)
- Fix ``process_log()`` when parsing logs for events with indexed and
non-indexed inputs. ``get_event_data()`` now compares log topics and
event ABIs as hex values.
(`[#3288](ethereum/web3.py#3288)
&lt;https://github.com/ethereum/web3.py/issues/3288&gt;`__)
- Fix ``process_log`` for ``HexStr`` inputs. Explicit type coercion of
entry ``topics`` and ``data`` values.
(`[#3292](ethereum/web3.py#3292)
&lt;https://github.com/ethereum/web3.py/issues/3292&gt;`__)
- Fix typing for json data argument to ``eth_signTypedData``.
(`[#3311](ethereum/web3.py#3311)
&lt;https://github.com/ethereum/web3.py/issues/3311&gt;`__)
<p>Deprecations
</code></pre></p>
<ul>
<li>Deprecate Geth miner namespace
(<code>[#2857](ethereum/web3.py#2857)
&lt;https://github.com/ethereum/web3.py/issues/2857&gt;</code>__)</li>
<li>Deprecated <code>Contract.encodeABI()</code> in favor of
<code>Contract.encode_abi()</code>.
(<code>[#3280](ethereum/web3.py#3280)
&lt;https://github.com/ethereum/web3.py/issues/3280&gt;</code>__)</li>
</ul>
<p>Features</p>
<pre><code>
- Implement ``state_override`` parameter for ``eth_estimateGas`` method.
(`[#3164](ethereum/web3.py#3164)
&lt;https://github.com/ethereum/web3.py/issues/3164&gt;`__)
- Add formatters for new ``Cancun`` network upgrade block header fields:
``blobGasUsed``, ``excessBlobGas``, and ``parentBeaconBlockRoot``.
(`[#3224](ethereum/web3.py#3224)
&lt;https://github.com/ethereum/web3.py/issues/3224&gt;`__)
- Allow for configuring the ``request_information_cache_size`` for
``PersistentConnectionProvider`` classes. Issue a warning when the cache
is full and unexpected behavior may occur.
(`[#3226](ethereum/web3.py#3226)
&lt;https://github.com/ethereum/web3.py/issues/3226&gt;`__)
- Add ``user_message`` kwarg for human readable ``Web3Exception``
messages. (`[#3282](ethereum/web3.py#3282)
&lt;https://github.com/ethereum/web3.py/issues/3282&gt;`__)
- Add formatters for type 3 transaction fields ``maxFeePerBlobGas`` and
``blobVersionedHashes``.
(`[#3315](ethereum/web3.py#3315)
&lt;https://github.com/ethereum/web3.py/issues/3315&gt;`__)
<p>Internal Changes - for web3.py Contributors
</code></pre></p>
<ul>
<li>Fix internal typing for functions used by <code>process_log</code>.
(<code>[#3301](ethereum/web3.py#3301)
&lt;https://github.com/ethereum/web3.py/issues/3301&gt;</code>__)</li>
</ul>
<p>Performance Improvements</p>
<pre><code>
- Utilize ``async`` functionality when popping responses from request
manager cache for persistent connection providers.
(`[#3305](ethereum/web3.py#3305)
&lt;https://github.com/ethereum/web3.py/issues/3305&gt;`__)
</code></pre>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/ethereum/web3.py/commit/aed99d84aab5d2c936bb3d8f5b24494553650410"><code>aed99d8</code></a>
Bump version: 6.15.1 → 6.16.0</li>
<li><a
href="https://github.com/ethereum/web3.py/commit/546e10f4c0649f00ed936f11548a7a1e3b7e4558"><code>546e10f</code></a>
Compile release notes for v6.16.0</li>
<li><a
href="https://github.com/ethereum/web3.py/commit/c2bbc50414a99bbed2342b005842f9dce3ce9d82"><code>c2bbc50</code></a>
newsfragment for <a
href="https://redirect.github.com/ethereum/web3.py/issues/3315">#3315</a></li>
<li><a
href="https://github.com/ethereum/web3.py/commit/029df2263eca8049f4e555d393f907d02e4b4d34"><code>029df22</code></a>
v6 backport of <a
href="https://redirect.github.com/ethereum/web3.py/issues/3306">#3306</a>:
async pop message from queue</li>
<li><a
href="https://github.com/ethereum/web3.py/commit/2dbac2b834fb98d4148f8fc9448935aefbcc3ce6"><code>2dbac2b</code></a>
newsfragment for <a
href="https://redirect.github.com/ethereum/web3.py/issues/3315">#3315</a></li>
<li><a
href="https://github.com/ethereum/web3.py/commit/b90033dd7a34b7d6825add969bbf396af9ce55fd"><code>b90033d</code></a>
Add formatters for type 3 transaction fields:</li>
<li><a
href="https://github.com/ethereum/web3.py/commit/b3d51ba407942456b03d693e30e06f40568f58fa"><code>b3d51ba</code></a>
newsfragment for <a
href="https://redirect.github.com/ethereum/web3.py/issues/3311">#3311</a></li>
<li><a
href="https://github.com/ethereum/web3.py/commit/39b257d961016463438390f2a066e08467879c66"><code>39b257d</code></a>
[v6] fix typing for eth_signTypedData</li>
<li><a
href="https://github.com/ethereum/web3.py/commit/290df0b42682be65ac629f4dfd5b2a8c8bd23a2d"><code>290df0b</code></a>
[V6] Fix internal typing for functions used by <code>process_log</code>
(<a
href="https://redirect.github.com/ethereum/web3.py/issues/3301">#3301</a>)</li>
<li><a
href="https://github.com/ethereum/web3.py/commit/18240c2cea7bf3e743285ee14a24cc1f47f81c6d"><code>18240c2</code></a>
[V6] Fix <code>process_log</code> for <code>HexStr</code> inputs (<a
href="https://redirect.github.com/ethereum/web3.py/issues/3292">#3292</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/ethereum/web3.py/compare/v6.15.1...v6.16.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=web3&package-manager=pip&previous-version=6.15.1&new-version=6.16.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecate in v6 Deprecations that need to be made in v6 branch and are set to be removed in the v7 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate miner namespace support and tests
7 participants