Skip to content

fix: recursively set strict on nested decoders#247

Open
jsvisa wants to merge 5 commits into
ApeWorX:mainfrom
jsvisa:decode-less-strict
Open

fix: recursively set strict on nested decoders#247
jsvisa wants to merge 5 commits into
ApeWorX:mainfrom
jsvisa:decode-less-strict

Conversation

@jsvisa
Copy link
Copy Markdown

@jsvisa jsvisa commented Sep 23, 2025

What was wrong?

eth_abi failed to decode the input of this tx https://etherscan.io/tx/0xc0d6f3899012f15ec11bde6128ad01998bd6387adea8134340fdd604b6ff67a3:

from eth_abi.abi import decode

data = bytes.fromhex(    "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000104b858183f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000078ba4c2b0cc3385ca967d250b2313f187d5002f3000000000000000000000000000000000000000000000000000000000a59d6f2000000000000000000000000000000000000000000000000008f3316b7531da4000000000000000000000000000000000000000000000000000000000000002ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000064c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000"
)

decode(["bytes[]"], data, strict=False)

raised the error as below:

File ~/.miniconda3-3.12/lib/python3.12/site-packages/eth_abi/decoding.py:601, in ByteStringDecoder.read_data_from_stream(self, stream)
    599 if self.strict:
    600     if len(data) < padded_length:
--> 601         raise InsufficientDataBytes(
    602             f"Tried to read {padded_length} bytes, only got {len(data)} bytes"
    603         )
    605     padding_bytes = data[data_length:]
    606     if padding_bytes != b"\x00" * (padded_length - data_length):

InsufficientDataBytes: Tried to read 288 bytes, only got 260 bytes

Related to Issue #
Closes #

How was it fixed?

After reviewing the codebase, it seems we're not set the inner strict property, so try to fix it.

Todo:

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

jsvisa added 5 commits May 14, 2026 00:22
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
Signed-off-by: Delweng <delweng@gmail.com>
@jsvisa jsvisa force-pushed the decode-less-strict branch from ae31aa3 to dcc31a9 Compare May 13, 2026 16:28
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.

1 participant