-
Notifications
You must be signed in to change notification settings - Fork 151
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
[Bug] Certain dynamic data fails to decode #167
Comments
appreciate it. identified the issue and expect to have a branch this afternoon |
issue arises because solidity specification appears to be incorrect wrt encoding of dynamic sequences when compared to real-world implementation specified behavior (snippet below) is that offset is "relative to the start of enc(X)" actual behavior in test vectors and other implementations is that the offset is relative to the first word of the body (the second word of the encoding)
|
Not sure I see what you mean? From what I can see other implementations are following the spec? |
the spec says the following:
so based on that we expect the offsets in a dynamically-length sequence to be relative to the beginning of the actual behavior (as observed in other implementations and in the tests) is that the offsets are relative to the word AFTER |
I think the use of the I interpret the spec such that when it says that objects of type I see more evidence for this interpretation by how |
that reading contradicts the following line tho: not arguing with you, btw. the other implementations have clear behavior even if the spec is unclear. |
Component
dyn-abi
What version of Alloy are you on?
├── alloy-dyn-abi v0.2.0 (https://github.com/alloy-rs/core?branch=main#3eab410e) │ ├── alloy-primitives v0.2.0 (https://github.com/alloy-rs/core?branch=main#3eab410e) │ ├── alloy-sol-types v0.2.0 (https://github.com/alloy-rs/core?branch=main#3eab410e) │ │ ├── alloy-primitives v0.2.0 (https://github.com/alloy-rs/core?branch=main#3eab410e) (*) │ │ ├── alloy-sol-macro v0.2.0 (proc-macro) (https://github.com/alloy-rs/core?branch=main#3eab410e) │ │ │ ├── syn-solidity v0.2.0 (https://github.com/alloy-rs/core?branch=main#3eab410e)
Operating System
Linux
Describe the bug
There are certain types of data that the
dyn-abi
decoder methods (decode_params
,decode_sequence
,decode_single
) fail to decode correctly.Example 1
Type:
(string[],string[],string,uint24,address)
Data (as json):
Error (from
DynSolType::decode_params
):Type check failed for "Solidity pointer (uint32)" with data: 674e4577507a620a000000000000000000000000000000000000000000000000
Example 2
Type:
(bytes30,bytes31,address,bytes31,bytes32[2],uint112,bytes32,string[])
Data (as json):
Error (from
DynSolType::decode_params
):Type check failed for "Solidity pointer (uint32)" with data: 0000000000000000000000000000000000004f89f5d169e8bce841281b02d252
Example 3
Type:
(bytes22,(bytes9[],string)[],bytes,uint200,bytes13,address)
Data (as json):
Error (from
DynSolType::decode_params
):Buffer overrun while deserializing
The text was updated successfully, but these errors were encountered: