Add test case that abi.encode nested storage arrays

This commit is contained in:
mingchuan 2019-06-19 10:46:47 +08:00
parent bfe074b2b1
commit 13c1409669
No known key found for this signature in database
GPG Key ID: 607CD25FA2D03651

View File

@ -0,0 +1,21 @@
pragma experimental ABIEncoderV2;
// tests encoding from storage arrays
contract C {
uint256[2][] tmp_h;
function h(uint256[2][] calldata s) external returns (bytes memory) {
tmp_h = s;
return abi.encode(tmp_h);
}
uint256[2][2] tmp_i;
function i(uint256[2][2] calldata s) external returns (bytes memory) {
tmp_i = s;
return abi.encode(tmp_i);
}
}
// ====
// EVMVersion: >homestead
// ----
// h(uint256[2][]) : 0x20, 3, 123, 124, 223, 224, 323, 324 -> 32, 256, 0x20, 3, 123, 124, 223, 224, 323, 324
// i(uint256[2][2]): 123, 124, 223, 224 -> 32, 128, 123, 124, 223, 224