-
Notifications
You must be signed in to change notification settings - Fork 269
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
Decode input data with bad padding #227
Comments
Why not just compile it with an older compiler version? |
The above contract is just an example. We want to decode historic transactions to already deployed contacts |
I also needed this for handling data from titanoboa. class ApeUnsignedIntegerDecoder(UnsignedIntegerDecoder):
def read_data_from_stream(self, stream):
"""
Override to pad the value instead of raise an error.
"""
data_byte_size: int = self.data_byte_size # type: ignore
data = stream.read(data_byte_size)
if len(data) != data_byte_size:
# Pad the value (instead of raising InsufficientBytesError).
data = validate_bytes_size(data, 32)
return data
registry.unregister("uint")
registry.register(
BaseEquals("uint"),
UnsignedIntegerEncoder,
ApeUnsignedIntegerDecoder,
label="uint",
) here is the code it replaces: https://github.com/ethereum/eth-abi/blob/main/eth_abi/decoding.py#L385-L394 However - realizing the real issue here is that it does not honor |
We want to decode input data sent to old contracts compiled using solc 0.5.16.
In some of the transactions, an address parameter was sent with a none empty padding:
Compiling this with solc 0.5.16 and calling test() will return 0x1111111111111111111111111111111111111111
Compiling this with solc 0.8.24 and calling test() will result in revert.
We want to be able to decode the input data in python without checking for empty padding (
strict=False
does not apply for fixed length parameters). How can we do this?The text was updated successfully, but these errors were encountered: