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

[v6] Rename Contract.encodeABI -> Contract.encode_abi #3280

Merged
merged 3 commits into from Mar 13, 2024

Conversation

reedsa
Copy link
Contributor

@reedsa reedsa commented Mar 12, 2024

What was wrong?

Related to Issue #3278

How was it fixed?

Updated references and deprecated the encodeABI method.

Todo:

Cute Animal Picture

Screen Shot 2024-03-13 at 11 31 39 AM

@reedsa reedsa changed the title Rename Contract.encodeABI -> Contract.encode_abi [v6] Rename Contract.encodeABI -> Contract.encode_abi Mar 12, 2024
reedsa added a commit to reedsa/web3.py that referenced this pull request Mar 12, 2024
reedsa added a commit to reedsa/web3.py that referenced this pull request Mar 13, 2024
@reedsa reedsa marked this pull request as ready for review March 13, 2024 17:31
reedsa added a commit to reedsa/web3.py that referenced this pull request Mar 13, 2024
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!

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.

Left a couple comments around the tests, but feel free to take or leave!

tests/core/contracts/test_contract_method_abi_encoding.py Outdated Show resolved Hide resolved


@patch("web3.eth.Contract.encodeABI", lambda w3, *args, **kwargs: (args, kwargs))
def test_contract_encodeABI_deprecated_calls_encode_abi_with_args(w3):
Copy link
Collaborator

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?

Copy link
Contributor Author

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
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is nice! TIL

@reedsa reedsa merged commit cc23d9d into ethereum:v6 Mar 13, 2024
99 checks passed
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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants