-
Notifications
You must be signed in to change notification settings - Fork 21
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
Some thoughts regarding IllegalArgumentException("unconsumed bytes: ...")
#34
Comments
if the bytes are given as a the intention is that the |
try
EDIT: for function output it would actually be |
As of version 6.0.0, the other alternative is specifying the indices to decode with |
Thank you for a quick response! You are absolutely right. That solved our problems! I don't have the expertise or have followed the #33 PR that my colleague @devictr worked on, but it seems like this only works for Anyway, feel free to close this issue. Thank you so much for being so responsive and maintaining this amazing library! |
No problem. For now it seems that any method that accepts a Let me know if you have any further issues. |
Hi @esaulpaugh ,
Thank you so much for a great library!
We've reached an edge case in decoding where we hit the exception mentioned in the title,
IllegalArgumentException("unconsumed bytes: ...")
, when decoding a function's output.We have the following input and output data data:
ABI:
The library throws the following exception with stack trace:
The problem was quite easy to identify. The output data contains 6 x 32 bytes, while the decoder only expects 4 x 32 bytes (
(uint256,uint256,uint256,uint256)
). This causes the exception.One could argue that we do have the wrong data in the first place. Which might be the case, but I've triple checked our node provider API and this is what we get.
We do have a
golang
implementation of decoding which uses geth which doesn't crash on this data. I've also created a quick test script which uses the official eth-abi library. Both implementations consume the data they need and disregard the last 64 bytes.This begs the question: Does throwing an exception on unconsumed bytes adhere to the standard? Should we consider removing that check?
If not, we would be happy to discuss alternative APIs for us to use which doesn't do this check.
Let me know what you think!
Håkon
The text was updated successfully, but these errors were encountered: