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
[v6] Rename Contract.encodeABI
-> Contract.encode_abi
#3280
Conversation
Contract.encodeABI
-> Contract.encode_abi
Contract.encodeABI
-> Contract.encode_abi
9f791c7
to
6a2fc30
Compare
6a2fc30
to
2b9e863
Compare
2b9e863
to
a4cb583
Compare
a4cb583
to
bf5fdfc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple comments around the tests, but feel free to take or leave!
|
||
|
||
@patch("web3.eth.Contract.encodeABI", lambda w3, *args, **kwargs: (args, kwargs)) | ||
def test_contract_encodeABI_deprecated_calls_encode_abi_with_args(w3): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test add any new test vector? It looks like the test above tests kwargs already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test expects the new method to be called with all the arguments. The @patch
wraps the encode function to be able to check values for each argument.
"0xea87152b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000087261696e626f7773000000000000000000000000000000000000000000000000" | ||
|
||
.. py:classmethod:: Contract.encodeABI(fn_name, args=None, kwargs=None, data=None) | ||
|
||
.. deprecated:: 7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice! TIL
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->_make_request()`` (`[#3267](ethereum/web3.py#3267) <https://github.com/ethereum/web3.py/issues/3267>`__) - Fix/update methods and decorators in ``web3/_utils/abi.py`` to address issues raised by ``mypy`` (`[#3273](ethereum/web3.py#3273) <https://github.com/ethereum/web3.py/issues/3273>`__) - 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) <https://github.com/ethereum/web3.py/issues/3288>`__) - Fix ``process_log`` for ``HexStr`` inputs. Explicit type coercion of entry ``topics`` and ``data`` values. (`[#3292](ethereum/web3.py#3292) <https://github.com/ethereum/web3.py/issues/3292>`__) - Fix typing for json data argument to ``eth_signTypedData``. (`[#3311](ethereum/web3.py#3311) <https://github.com/ethereum/web3.py/issues/3311>`__) <p>Deprecations </code></pre></p> <ul> <li>Deprecate Geth miner namespace (<code>[#2857](ethereum/web3.py#2857) <https://github.com/ethereum/web3.py/issues/2857></code>__)</li> <li>Deprecated <code>Contract.encodeABI()</code> in favor of <code>Contract.encode_abi()</code>. (<code>[#3280](ethereum/web3.py#3280) <https://github.com/ethereum/web3.py/issues/3280></code>__)</li> </ul> <p>Features</p> <pre><code> - Implement ``state_override`` parameter for ``eth_estimateGas`` method. (`[#3164](ethereum/web3.py#3164) <https://github.com/ethereum/web3.py/issues/3164>`__) - Add formatters for new ``Cancun`` network upgrade block header fields: ``blobGasUsed``, ``excessBlobGas``, and ``parentBeaconBlockRoot``. (`[#3224](ethereum/web3.py#3224) <https://github.com/ethereum/web3.py/issues/3224>`__) - 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) <https://github.com/ethereum/web3.py/issues/3226>`__) - Add ``user_message`` kwarg for human readable ``Web3Exception`` messages. (`[#3282](ethereum/web3.py#3282) <https://github.com/ethereum/web3.py/issues/3282>`__) - Add formatters for type 3 transaction fields ``maxFeePerBlobGas`` and ``blobVersionedHashes``. (`[#3315](ethereum/web3.py#3315) <https://github.com/ethereum/web3.py/issues/3315>`__) <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) <https://github.com/ethereum/web3.py/issues/3301></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) <https://github.com/ethereum/web3.py/issues/3305>`__) </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>
What was wrong?
Related to Issue #3278
How was it fixed?
Updated references and deprecated the encodeABI method.
Todo:
Cute Animal Picture