-
Notifications
You must be signed in to change notification settings - Fork 271
Closed
Description
What was wrong?
The encode_abi
and decode_abi
functions (found here and here) do not really serve a useful purpose any more. For example, the following invocations are equivalent:
In [1]: from eth_abi import *
In [2]: encode_single('(int,int)', (1, 2))
Out[2]: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02'
In [3]: encode_abi(('int', 'int'), (1, 2))
Out[3]: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02'
How can it be fixed?
Perhaps we should remove encode_abi
and decode_abi
and rename encode_single
and decode_single
to encode
and decode
respectively?
This could also match Solidity's own API better: https://solidity.readthedocs.io/en/v0.4.24/units-and-global-variables.html?highlight=abi#abi-encoding-functions
Metadata
Metadata
Assignees
Labels
No labels