From 13c140966952d37f7a1b78072780101301c98a41 Mon Sep 17 00:00:00 2001 From: mingchuan Date: Wed, 19 Jun 2019 10:46:47 +0800 Subject: [PATCH] Add test case that abi.encode nested storage arrays --- .../abiEncoderV2/storage_array_encoding.sol | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol diff --git a/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol b/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol new file mode 100644 index 000000000..a046a4376 --- /dev/null +++ b/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol @@ -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