solidity/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol

29 lines
809 B
Solidity
Raw Normal View History

2020-11-23 18:06:44 +00:00
pragma abicoder v2;
// 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
2021-02-12 12:45:15 +00:00
// compileViaYul: also
// ----
// h(uint256[2][]): 0x20, 3, 123, 124, 223, 224, 323, 324 -> 32, 256, 0x20, 3, 123, 124, 223, 224, 323, 324
2021-04-12 10:53:09 +00:00
// gas irOptimized: 172410
2021-02-12 12:45:15 +00:00
// gas legacy: 175929
2021-03-11 11:17:50 +00:00
// gas legacyOptimized: 172504
// i(uint256[2][2]): 123, 124, 223, 224 -> 32, 128, 123, 124, 223, 224
// gas irOptimized: 107381
2021-02-12 12:45:15 +00:00
// gas legacy: 109868
// gas legacyOptimized: 107388