Skip to content
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

abi pack method doesn't encode new ABiEncoderV2 features like string[] correctly #18033

Closed
xmxanuel opened this issue Nov 5, 2018 · 1 comment

Comments

@xmxanuel
Copy link

xmxanuel commented Nov 5, 2018

It seems like the encoding of solidity function arguments for new pragma experimental ABIEncoderV2; features isn't working correctly.

I tested to encode an array of strings parameter with abigen and the transaction is not successful.

function test(string[] _values) public

The returned encoding from the Pack method in go-ethereum/accounts/abi/argument.go is different from web3.js using the same input parameters.

I compared the encoding for the same inputs with web3.js which supports the new encoding with version 1.0.0-beta.36.

The Unpack seems to work because a test with web3.js and latest geth was successful.

Is go-ethereum up to date with the latest specification?
https://solidity.readthedocs.io/en/develop/abi-spec.html

@xmxanuel
Copy link
Author

xmxanuel commented Nov 5, 2018

It might be the Pack method in go-ethereum doesn't add the offsets of the dynamic types inside the array at the beginning correctly.

ABI Encoding Comparison

Solidity Method

function mintDummy(string[] _values) public

Input

values := []string{"hello","aaaaaaaaaaa"}

Expected behaviour

Expected abi encoding (using web3.js)

"0xe71e5caf0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000568656c6c6f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6161616161616161616161000000000000000000000000000000000000000000"

Actual behaviour

abi encoding in go-ethereum

"0xe71e5caf00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000568656c6c6f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6161616161616161616161000000000000000000000000000000000000000000"

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

No branches or pull requests

1 participant