-
Notifications
You must be signed in to change notification settings - Fork 440
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
fixed parsing of ABIs with tuples + wrong gas info when transactionOptions created from json #379
Conversation
- fixed ABI method signature creation when tuple is in paramater list
subpointer = subpointer + consumedUnwrapped | ||
} | ||
else { | ||
subpointer = consumedUnwrapped // need to go by nextElementPointer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaks decoding of arrays that contain any type that is not static.
That would be string
, dynamicBytes
, array
and tuple
that contain non-static types.
@izakpavel Could you please explain what you meant by this comment?
// need to go by nextElementPointer
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is an example with values that I'm working with.
What I'm doing is encoding two arrays and using that result as an argument for the decoding function.
This is the first array to be encoded.
ABI.Element.ParameterType
is array(bytes(32))
:
[0] - 0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3
[1] - 0x4b80742d0000000082ac000022300fd00e3402df12db7a0a054fae50f0bf91d7
[2] - 0x027545a85de73f6a6ec5ce14736fa7eb00000000000000000000000000000002
This is the second array to encoded.
ABI.Element.ParameterType
is array(dynamicBytes)
even though in this specific example all values are 32 bytes long:
[0] - 0x0000000000000000000000000000000000000000000000000000000000000003
[1] - 0x00000000000000000000000000000000000000000000000000000000000003fe
[2] - 0x22300fd00e3402df12db7a0a054fae50f0bf91d7000000000000000000000000
And this is how they are decoded:
Array with bytes(32)
:
[0] - 0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3
[1] - 0x4b80742d0000000082ac000022300fd00e3402df12db7a0a054fae50f0bf91d7
[2] - 0x027545a85de73f6a6ec5ce14736fa7eb00000000000000000000000000000002
Array with dynamicBytes
:
[0] - 0x0000000000000000000000000000000000000000000000000000000000000003
[1] - 0x00000000000000000000000000000000000000000000000000000000000003fe
[2] - 0x00000000000000000000000000000000000000000000000000000000000003fe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BaldyAsh Please, take a look at this issue. It feels like reverting line 144 back to
subpointer = subpointer + consumedUnwrapped
would fix the issue.
Note: tested the suggestion above in a fork of web3swift and it does indeed fix the issue.
I'll test later with array(tuple)
type as @izakpavel had issues with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array(tuple)
does break indeed if line 144 is reverted to its previous logic.
related to the issues #358 (#358)
and #353 #353