Closed Uxio0 closed 1 year ago
@Uxio0 I'd like to get a bit of clarity on this outstanding issue. I saw you were at least able to get around it for your library, which seems to be the best solution to me at the moment.
as Solidity does
I can't really reproduce this. Let me know if I'm missing anything.
function decode(bytes memory _bytes) external pure returns (address) {
address _decoded = abi.decode(_bytes, (address));
return _decoded;
}
Testing on remix...
Calling the above with 0x0000000000000000000000ffdc5299b629ef24fdecfbb240c00fc79fabb9cf97
reverts with "error": "Failed to decode output: Error: hex data is odd-length (argument=\"value\", value=\"0x0\", code=INVALID_ARGUMENT, version=bytes/5.7.0)"
.
Calling the above with 0x000000000000000000000000dc5299b629ef24fdecfbb240c00fc79fabb9cf97
does not revert and returns "0": "address: 0xdC5299b629Ef24fDECfBb240C00Fc79FAbB9cf97"
.
I think it's good to keep that kind of parity in the core library but I'm glad you can at least get around it. Again, let me know if I'm missing anything.
Closing for now. Can't reproduce desired result in Solidity.
Sorry for the late reply @fselmo , I was on holidays when you answered and totally missed this. Maybe I was wrong when I tested it on Solidity last year, but as the current behaviour is the same, I'm happy with it.
Thank you for taking the time to check this
What was wrong?
To have the same behaviour than Solidity,
eth_abi
should add an option to ignore padding bytesCode that produced the error
Full error output
Expected Result
No errors, just ignore the non empty padding bytes (as Solidity does)
Environment
Python 3.10, eth-abi=2.1.1
How can it be fixed?
Workaround for this case