Skip to content

DeprecationWarning: abi.decode_single() is deprecated and will be removed in version 4.0.0 in favor of abi.decode() #2725

@miohtama

Description

@miohtama
  • Version: 5.31.1
  • Python: 3.10
  • OS: osx

What was wrong?

Seeing

python3.10/site-packages/eth_abi/codec.py:87: DeprecationWarning:
  
  abi.encode_abi() and abi.encode_abi_packed() are deprecated and will be removed in version 4.0.0 in favor of abi.encode() and abi.encode_packed(), respectively

when using Web3.py.

This is an internal to Web3.py

 File "/Users/moo/Library/Caches/pypoetry/virtualenvs/trade-executor-8Oz1GdY1-py3.10/lib/python3.10/site-packages/eth_defi/deploy.py", line 37, in deploy_contract
    tx_hash = Contract.constructor(*constructor_args).transact({"from": deployer})
  File "/Users/moo/Library/Caches/pypoetry/virtualenvs/trade-executor-8Oz1GdY1-py3.10/lib/python3.10/site-packages/web3/contract.py", line 391, in constructor
    return ContractConstructor(cls.web3,
  File "/Users/moo/Library/Caches/pypoetry/virtualenvs/trade-executor-8Oz1GdY1-py3.10/lib/python3.10/site-packages/web3/contract.py", line 604, in __init__
    self.data_in_transaction = self._encode_data_in_transaction(*args, **kwargs)
  File "/Users/moo/Library/Caches/pypoetry/virtualenvs/trade-executor-8Oz1GdY1-py3.10/lib/python3.10/site-packages/eth_utils/decorators.py", line 18, in _wrapper
    return self.method(obj, *args, **kwargs)
  File "/Users/moo/Library/Caches/pypoetry/virtualenvs/trade-executor-8Oz1GdY1-py3.10/lib/python3.10/site-packages/web3/contract.py", line 618, in _encode_data_in_transaction
    encode_abi(self.web3, constructor_abi, arguments, data=self.bytecode)
  File "/Users/moo/Library/Caches/pypoetry/virtualenvs/trade-executor-8Oz1GdY1-py3.10/lib/python3.10/site-packages/web3/_utils/contracts.py", line 193, in encode_abi
    encoded_arguments = web3.codec.encode_abi(
  File "/Users/moo/Library/Caches/pypoetry/virtualenvs/trade-executor-8Oz1GdY1-py3.10/lib/python3.10/site-packages/eth_abi/codec.py", line 87, in encode_abi

This is an annoyance, which prevents running any tests with pytest -Werror.

How can it be fixed?

I do not know, because I do not know how web3.py and dependency package releases are co-ordinated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions