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

Replace eth-abi deprecated method usage with supported methods #2726

Merged
merged 3 commits into from
Nov 21, 2022

Conversation

fselmo
Copy link
Collaborator

@fselmo fselmo commented Nov 21, 2022

What was wrong?

closes #2725

  • These changes have been made in web3.py v6 but need to be updated in v5.

How was it fixed?

  • Replace deprecated eth-abi methods internally with supported methods to silence warnings.
  • Had to do the same with eth-tester for non-breaking changes there since I saw the eth-tester tests with py-evm backend were still giving these warnings in one or two places. Cherry picked an earlier eth-tester branch, released v0.6.0-beta.7, and pulled that in here so now the messages should not be there even through eth-tester with py-evm backend tests.

Todo:

Cute Animal Picture

SSPX0407

- These changes have been made in ``master`` but ``v5`` warnings throughout the library should be silenced as they interfere with user experience. This closes ethereum#2725.
@fselmo fselmo marked this pull request as ready for review November 21, 2022 22:34
- This version includes refactors for using supported ``eth-abi`` methods over the deprecated encode / decode methods.
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!

@ahmetavc
Copy link

ahmetavc commented Dec 2, 2022

Seems like this broke some stuff in our contract calls @pacrob @fselmo

2022-12-02T11:11:03.901425909Z   File "/usr/local/lib/python3.9/site-packages/web3/contract.py", line 970, in call
2022-12-02T11:11:03.902144034Z     return call_contract_function(
2022-12-02T11:11:03.902330841Z   File "/usr/local/lib/python3.9/site-packages/web3/contract.py", line 1514, in call_contract_function
2022-12-02T11:11:03.903130053Z     call_transaction = prepare_transaction(
2022-12-02T11:11:03.903356580Z   File "/usr/local/lib/python3.9/site-packages/web3/_utils/contracts.py", line 236, in prepare_transaction
2022-12-02T11:11:03.903723940Z     prepared_transaction['data'] = encode_transaction_data(
2022-12-02T11:11:03.903945134Z   File "/usr/local/lib/python3.9/site-packages/web3/_utils/contracts.py", line 267, in encode_transaction_data
2022-12-02T11:11:03.904307120Z     return add_0x_prefix(encode_abi(web3, fn_abi, fn_arguments, fn_selector))
2022-12-02T11:11:03.904517916Z   File "/usr/local/lib/python3.9/site-packages/web3/_utils/contracts.py", line 193, in encode_abi
2022-12-02T11:11:03.904872834Z     encoded_arguments = web3.codec.encode(
2022-12-02T11:11:03.905090463Z AttributeError: 'ABICodec' object has no attribute 'encode'

@fselmo
Copy link
Collaborator Author

fselmo commented Dec 2, 2022

@ahmetavc Ah, I think we still have too low of a lower bound for eth-abi. Thanks for flagging this. There are quite a few options here since there were some breaking changes between versions. You can update eth-abi to the stable 2.2.0 or 3.0.1 or the latest beta 4.0.0b2. I'll take care of raising the lower bound in here for web3.py. Thanks again.

@fselmo fselmo mentioned this pull request Dec 2, 2022
1 task
@fselmo
Copy link
Collaborator Author

fselmo commented Dec 2, 2022

@ahmetavc thanks again, we already have this fix out in the latest patch release v5.31.3.

@fselmo fselmo deleted the v5-silence-eth-abi-warnings branch April 3, 2024 20:50
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.

3 participants