-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Wrong encoding and decoding tests for two-dimensional variadic arrays #1570
Labels
Bug
Addressing a bug
Comments
abdulowork
added a commit
to abdulowork/web3.js
that referenced
this issue
Apr 27, 2018
abdulowork
added a commit
to abdulowork/web3.js
that referenced
this issue
Apr 27, 2018
abdulowork
added a commit
to abdulowork/web3.js
that referenced
this issue
Apr 27, 2018
abdulowork
changed the title
Wrong encoding tests for two-dimensional variadic arrays
Wrong encoding and decoding tests for two-dimensional variadic arrays
Apr 27, 2018
You can also observe the correct encoding if you call the pragma solidity ^0.4.23;
pragma experimental ABIEncoderV2;
contract SimpleGetter {
address[][] public _data = [[0x407d73d8a49eeb85d32cf465507dd71d507100c1,0x407d73d8a49eeb85d32cf465507dd71d507100c2],[0x407d73d8a49eeb85d32cf465507dd71d507100c3,0x407d73d8a49eeb85d32cf465507dd71d507100c4]];
function data() external view returns (address[][]) {
return _data;
}
} |
nivida
added
Bug
Addressing a bug
and removed
In Progress
Currently being worked on
labels
Nov 28, 2018
This should be fixed since I've implemented the new ABICoder. Could you test it and drop a comment here if not? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Encoding of two-dimensional variadic arrays in these tests is wrong:
https://github.com/ethereum/web3.js/blob/f15caf13c91682cccd7b7762b80feadb9fb969dc/test/coder.encodeParam.js#L43-L64
I took these tests for my own implementation of ABI encoding and found out that contracts would not deploy when I wrote some integration tests. These tests are built on the premise that offset of dynamic elements in a dynamic collection should be counted from the beginning of the whole encoding. The correct encoding is that offset is counted from the beginning of the dynamic collection regardless of the position of the dynamic collection in the whole encoding.
Here is a deployed contract using a correct encoding in the ctor: https://kovan.etherscan.io/address/0x812b72fa1fb3b842cb193d743a44ec8439c9a060#readContract
Here is my corrected version of the tests zeriontech/Web3Swift@8ab1f12
I would be very grateful if you star my project if that information was of any help : )
The text was updated successfully, but these errors were encountered: