From 32b83328673c8e28a71c2d24171b2e60572f4845 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 7 Apr 2021 16:25:59 +0200 Subject: [PATCH 1/3] Refactor array decoding. --- libsolidity/codegen/ABIFunctions.cpp | 51 ++++++++++--------- .../offset_overflow_in_array_decoding.sol | 29 +++++++++++ .../offset_overflow_in_array_decoding_2.sol | 30 +++++++++++ .../offset_overflow_in_array_decoding_3.sol | 23 +++++++++ 4 files changed, 109 insertions(+), 24 deletions(-) create mode 100644 test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol create mode 100644 test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol create mode 100644 test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index facdb9cb8..cfbb01ec6 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -1182,12 +1182,28 @@ string ABIFunctions::abiDecodingFunctionArrayAvailableLength(ArrayType const& _t function (offset, length, end) -> array { array := ((length)) let dst := array - + + mstore(array, length) + dst := add(array, 0x20) + let src := offset - + + // TODO add check that we can actually load from all + // offset pointers, i.e. as below, but with stride being 0x20. + + if gt(add(src, mul(length, )), end) { + + } + for { let i := 0 } lt(i, length) { i := add(i, 1) } { - let elementPos := + + let innerOffset := (src) + // TODO add overflow check + let elementPos := add(offset, innerOffset) + + let elementPos := src + mstore(dst, (elementPos, end)) dst := add(dst, 0x20) src := add(src, ) @@ -1198,28 +1214,15 @@ string ABIFunctions::abiDecodingFunctionArrayAvailableLength(ArrayType const& _t templ("readableTypeName", _type.toString(true)); templ("allocate", m_utils.allocationFunction()); templ("allocationSize", m_utils.arrayAllocationSizeFunction(_type)); - string calldataStride = toCompactHexWithPrefix(_type.calldataStride()); - templ("stride", calldataStride); - if (_type.isDynamicallySized()) - templ("storeLength", "mstore(array, length) dst := add(array, 0x20)"); - else - templ("storeLength", ""); - if (_type.baseType()->isDynamicallyEncoded()) - { - templ("staticBoundsCheck", ""); - string load = _fromMemory ? "mload" : "calldataload"; - templ("retrieveElementPos", "add(offset, " + load + "(src))"); - } - else - { - templ("staticBoundsCheck", "if gt(add(src, mul(length, " + - calldataStride + - ")), end) { " + - revertReasonIfDebug("ABI decoding: invalid calldata array stride") + - " }" + templ("stride", toCompactHexWithPrefix(_type.calldataStride())); + templ("dynamic", _type.isDynamicallySized()); + templ("load", _fromMemory ? "mload" : "calldataload"); + templ("dynamicBase", _type.baseType()->isDynamicallyEncoded()); + if (!_type.baseType()->isDynamicallyEncoded()) + templ( + "revertInvalidStride", + revertReasonIfDebug("ABI decoding: invalid calldata array stride") ); - templ("retrieveElementPos", "src"); - } templ("decodingFun", abiDecodingFunction(*_type.baseType(), _fromMemory, false)); return templ.render(); }); diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol new file mode 100644 index 000000000..a7e335e47 --- /dev/null +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol @@ -0,0 +1,29 @@ +pragma abicoder v2; +contract Test { + struct MemoryUint { + uint field; + } + function test() public pure returns (uint) { + uint[] memory before = new uint[](1); // at offset 0x80 + // Two problems here: The first offset is zero, the second offset is missing. + bytes memory corrupt = abi.encode(uint(32), // offset to "tuple" + uint(0)); // bogus first element + /* + At this point the free pointer is 0x80 + 64 (size of before) + 32 (length field of corrupt) + 64 (two encoded words) + + Now let's put random junk into memory immediately after the bogus first element. Our goal is to overflow the read pointer to point to before. + The value read out at this point will be added to beginning of the encoded tuple, AKA corrupt + 64. We need then to write x where: + x + 0x80 + 64 (before) + 32 (length of corrupt) + 32 (first word of corrupt) = 0x80 (mod 2^256) + that is MAX_UINT - 128 + */ + MemoryUint memory afterCorrupt; + afterCorrupt.field = uint(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80); + before[0] = 123456; + uint[][2] memory decoded = abi.decode(corrupt, (uint[][2])); + return decoded[1][0]; + } +} +// ==== +// compileViaYul: also +// ---- +// test() -> 0x01e240 diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol new file mode 100644 index 000000000..88ff3510b --- /dev/null +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol @@ -0,0 +1,30 @@ +pragma abicoder v2; +contract Test { + struct MemoryTuple { + uint field1; + uint field2; + } + function withinArray() public pure returns (uint) { + uint[] memory before = new uint[](1); + bytes memory corrupt = abi.encode(uint(32), + uint(2)); + MemoryTuple memory afterCorrupt; + before[0] = 123456; + /* + As above, but in this case we are adding to: + 0x80 + 64 (before) + 32 (length of corrupt) + 32 (offset) + 32 (field pointer) + giving MAX_UINT - 96 + */ + afterCorrupt.field1 = uint(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60); + afterCorrupt.field2 = uint(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60); + uint[][] memory decoded = abi.decode(corrupt, (uint[][])); + /* + Will return 123456 * 2, AKA before has been copied twice + */ + return decoded[0][0] + decoded[1][0]; + } +} +// ==== +// compileViaYul: also +// ---- +// withinArray() -> 0x03c480 diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol new file mode 100644 index 000000000..30fc8731e --- /dev/null +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol @@ -0,0 +1,23 @@ +pragma abicoder v2; +contract Test { + struct MemoryUint { + uint field; + } + function test() public pure returns (uint) { + uint[] memory before = new uint[](1); // at offset 0x80 + bytes memory corrupt = abi.encode( + uint(32), + uint(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80), + uint(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80) + ); + MemoryUint memory afterCorrupt; + afterCorrupt.field = uint(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80); + before[0] = 123456; + uint[][2] memory decoded = abi.decode(corrupt, (uint[][2])); + return decoded[1][0]; + } +} +// ==== +// compileViaYul: also +// ---- +// test() -> 0x01e240 From 72d0a56a72883e38982f40d88334c03c815ff718 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 7 Apr 2021 16:44:02 +0200 Subject: [PATCH 2/3] Fix array decoding offset overflow. --- libsolidity/codegen/ABIFunctions.cpp | 23 ++++++++----------- .../offset_overflow_in_array_decoding.sol | 2 +- .../offset_overflow_in_array_decoding_2.sol | 2 +- .../offset_overflow_in_array_decoding_3.sol | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index cfbb01ec6..ffced74c5 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -1187,19 +1187,14 @@ string ABIFunctions::abiDecodingFunctionArrayAvailableLength(ArrayType const& _t dst := add(array, 0x20) let src := offset - - // TODO add check that we can actually load from all - // offset pointers, i.e. as below, but with stride being 0x20. - - if gt(add(src, mul(length, )), end) { - - } - + if gt(add(src, mul(length, )), end) { + + } for { let i := 0 } lt(i, length) { i := add(i, 1) } { let innerOffset := (src) - // TODO add overflow check + if gt(innerOffset, 0xffffffffffffffff) { } let elementPos := add(offset, innerOffset) let elementPos := src @@ -1218,11 +1213,11 @@ string ABIFunctions::abiDecodingFunctionArrayAvailableLength(ArrayType const& _t templ("dynamic", _type.isDynamicallySized()); templ("load", _fromMemory ? "mload" : "calldataload"); templ("dynamicBase", _type.baseType()->isDynamicallyEncoded()); - if (!_type.baseType()->isDynamicallyEncoded()) - templ( - "revertInvalidStride", - revertReasonIfDebug("ABI decoding: invalid calldata array stride") - ); + templ( + "revertInvalidStride", + revertReasonIfDebug("ABI decoding: invalid calldata array stride") + ); + templ("revertStringOffset", revertReasonIfDebug("ABI decoding: invalid calldata array offset")); templ("decodingFun", abiDecodingFunction(*_type.baseType(), _fromMemory, false)); return templ.render(); }); diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol index a7e335e47..40d633d96 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol @@ -26,4 +26,4 @@ contract Test { // ==== // compileViaYul: also // ---- -// test() -> 0x01e240 +// test() -> FAILURE diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol index 88ff3510b..d21f0111b 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol @@ -27,4 +27,4 @@ contract Test { // ==== // compileViaYul: also // ---- -// withinArray() -> 0x03c480 +// withinArray() -> FAILURE diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol index 30fc8731e..2ac68257b 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol @@ -20,4 +20,4 @@ contract Test { // ==== // compileViaYul: also // ---- -// test() -> 0x01e240 +// test() -> FAILURE From 2ed17e4b4334ac5bbdf2d047a721783288566ccc Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 7 Apr 2021 16:47:55 +0200 Subject: [PATCH 3/3] Update tests. --- Changelog.md | 4 ++ docs/bugs.json | 11 ++++ docs/bugs_by_version.json | 56 ++++++++++++++++++- .../standard_generatedSources/output.json | 13 ++++- test/libsolidity/gasTests/abiv2.sol | 6 +- test/libsolidity/gasTests/abiv2_optimised.sol | 6 +- 6 files changed, 86 insertions(+), 10 deletions(-) diff --git a/Changelog.md b/Changelog.md index 8728da617..9f07d0cd9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ ### 0.8.4 (unreleased) +Important Bugfixes: + * ABI Decoder V2: For two-dimensional arrays and specially crafted data in memory, the result of ``abi.decode`` can depend on data elsewhere in memory. Calldata decoding is not affected. + + Language Features: * Assembly / Yul: Allow hex string literals. * Possibility to use ``bytes.concat`` with variable number of ``bytes`` and ``bytesNN`` arguments which behaves as a restricted version of `abi.encodePacked` with a more descriptive name. diff --git a/docs/bugs.json b/docs/bugs.json index ddcd69aa0..36d800b43 100644 --- a/docs/bugs.json +++ b/docs/bugs.json @@ -1,4 +1,15 @@ [ + { + "name": "ABIDecodeTwoDimensionalArrayMemory", + "summary": "If used on memory byte arrays, result of the function ``abi.decode`` can depend on the contents of memory outside of the actual byte array that is decoded.", + "description": "The ABI specification uses pointers to data areas for everything that is dynamically-sized. When decoding data from memory (instead of calldata), the ABI decoder did not properly validate some of these pointers. More specifically, it was possible to use large values for the pointers inside arrays such that computing the offset resulted in an undetected overflow. This could lead to these pointers targeting areas in memory outside of the actual area to be decoded. This way, it was possible for ``abi.decode`` to return different values for the same encoded byte array.", + "introduced": "0.4.16", + "fixed": "0.8.4", + "conditions": { + "ABIEncoderV2": true + }, + "severity": "very low" + }, { "name": "KeccakCaching", "summary": "The bytecode optimizer incorrectly re-used previously evaluated Keccak-256 hashes. You are unlikely to be affected if you do not compute Keccak-256 hashes in inline assembly.", diff --git a/docs/bugs_by_version.json b/docs/bugs_by_version.json index b3b51ad53..671aef23e 100644 --- a/docs/bugs_by_version.json +++ b/docs/bugs_by_version.json @@ -595,6 +595,7 @@ }, "0.4.16": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -615,6 +616,7 @@ }, "0.4.17": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -636,6 +638,7 @@ }, "0.4.18": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -656,6 +659,7 @@ }, "0.4.19": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -699,6 +703,7 @@ }, "0.4.20": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -720,6 +725,7 @@ }, "0.4.21": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -741,6 +747,7 @@ }, "0.4.22": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -762,6 +769,7 @@ }, "0.4.23": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -782,6 +790,7 @@ }, "0.4.24": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -802,6 +811,7 @@ }, "0.4.25": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -820,6 +830,7 @@ }, "0.4.26": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -987,6 +998,7 @@ }, "0.5.0": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1005,6 +1017,7 @@ }, "0.5.1": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1023,6 +1036,7 @@ }, "0.5.10": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1037,6 +1051,7 @@ }, "0.5.11": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1050,6 +1065,7 @@ }, "0.5.12": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1063,6 +1079,7 @@ }, "0.5.13": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1076,6 +1093,7 @@ }, "0.5.14": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1091,6 +1109,7 @@ }, "0.5.15": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1105,6 +1124,7 @@ }, "0.5.16": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1118,6 +1138,7 @@ }, "0.5.17": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1130,6 +1151,7 @@ }, "0.5.2": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1148,6 +1170,7 @@ }, "0.5.3": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1166,6 +1189,7 @@ }, "0.5.4": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1184,6 +1208,7 @@ }, "0.5.5": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1204,6 +1229,7 @@ }, "0.5.6": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1224,6 +1250,7 @@ }, "0.5.7": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1242,6 +1269,7 @@ }, "0.5.8": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1259,6 +1287,7 @@ }, "0.5.9": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1275,6 +1304,7 @@ }, "0.6.0": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1289,6 +1319,7 @@ }, "0.6.1": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1302,6 +1333,7 @@ }, "0.6.10": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup" @@ -1310,6 +1342,7 @@ }, "0.6.11": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup" @@ -1318,6 +1351,7 @@ }, "0.6.12": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup" @@ -1326,6 +1360,7 @@ }, "0.6.2": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1339,6 +1374,7 @@ }, "0.6.3": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1352,6 +1388,7 @@ }, "0.6.4": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1365,6 +1402,7 @@ }, "0.6.5": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1377,6 +1415,7 @@ }, "0.6.6": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1388,6 +1427,7 @@ }, "0.6.7": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1399,6 +1439,7 @@ }, "0.6.8": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup" @@ -1407,6 +1448,7 @@ }, "0.6.9": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1416,6 +1458,7 @@ }, "0.7.0": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup" @@ -1424,6 +1467,7 @@ }, "0.7.1": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup", @@ -1433,6 +1477,7 @@ }, "0.7.2": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy", "DynamicArrayCleanup" @@ -1441,6 +1486,7 @@ }, "0.7.3": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching", "EmptyByteArrayCopy" ], @@ -1448,42 +1494,50 @@ }, "0.7.4": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching" ], "released": "2020-10-19" }, "0.7.5": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching" ], "released": "2020-11-18" }, "0.7.6": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching" ], "released": "2020-12-16" }, "0.8.0": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching" ], "released": "2020-12-16" }, "0.8.1": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching" ], "released": "2021-01-27" }, "0.8.2": { "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory", "KeccakCaching" ], "released": "2021-03-02" }, "0.8.3": { - "bugs": [], + "bugs": [ + "ABIDecodeTwoDimensionalArrayMemory" + ], "released": "2021-03-23" } } \ No newline at end of file diff --git a/test/cmdlineTests/standard_generatedSources/output.json b/test/cmdlineTests/standard_generatedSources/output.json index 56c87b7ce..0a9f12669 100644 --- a/test/cmdlineTests/standard_generatedSources/output.json +++ b/test/cmdlineTests/standard_generatedSources/output.json @@ -1,15 +1,22 @@ -{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"object":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:3209:1","statements":[{"body":{"nodeType":"YulBlock","src":"126:521:1","statements":[{"nodeType":"YulAssignment","src":"136:90:1","value":{"arguments":[{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"218:6:1"}],"functionName":{"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"161:56:1"},"nodeType":"YulFunctionCall","src":"161:64:1"}],"functionName":{"name":"allocate_memory","nodeType":"YulIdentifier","src":"145:15:1"},"nodeType":"YulFunctionCall","src":"145:81:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"136:5:1"}]},{"nodeType":"YulVariableDeclaration","src":"235:16:1","value":{"name":"array","nodeType":"YulIdentifier","src":"246:5:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"239:3:1","type":""}]},{"expression":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"267:5:1"},{"name":"length","nodeType":"YulIdentifier","src":"274:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"260:6:1"},"nodeType":"YulFunctionCall","src":"260:21:1"},"nodeType":"YulExpressionStatement","src":"260:21:1"},{"nodeType":"YulAssignment","src":"282:23:1","value":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"293:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"300:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"289:3:1"},"nodeType":"YulFunctionCall","src":"289:16:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"282:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"314:17:1","value":{"name":"offset","nodeType":"YulIdentifier","src":"325:6:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"318:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"380:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"389:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"392:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"382:6:1"},"nodeType":"YulFunctionCall","src":"382:12:1"},"nodeType":"YulExpressionStatement","src":"382:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"350:3:1"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"359:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"367:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"355:3:1"},"nodeType":"YulFunctionCall","src":"355:17:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"346:3:1"},"nodeType":"YulFunctionCall","src":"346:27:1"},{"name":"end","nodeType":"YulIdentifier","src":"375:3:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"343:2:1"},"nodeType":"YulFunctionCall","src":"343:36:1"},"nodeType":"YulIf","src":"340:2:1"},{"body":{"nodeType":"YulBlock","src":"465:176:1","statements":[{"nodeType":"YulVariableDeclaration","src":"479:21:1","value":{"name":"src","nodeType":"YulIdentifier","src":"497:3:1"},"variables":[{"name":"elementPos","nodeType":"YulTypedName","src":"483:10:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"520:3:1"},{"arguments":[{"name":"elementPos","nodeType":"YulIdentifier","src":"546:10:1"},{"name":"end","nodeType":"YulIdentifier","src":"558:3:1"}],"functionName":{"name":"abi_decode_t_uint256","nodeType":"YulIdentifier","src":"525:20:1"},"nodeType":"YulFunctionCall","src":"525:37:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"513:6:1"},"nodeType":"YulFunctionCall","src":"513:50:1"},"nodeType":"YulExpressionStatement","src":"513:50:1"},{"nodeType":"YulAssignment","src":"576:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"587:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"592:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"583:3:1"},"nodeType":"YulFunctionCall","src":"583:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"576:3:1"}]},{"nodeType":"YulAssignment","src":"610:21:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"621:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"626:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"617:3:1"},"nodeType":"YulFunctionCall","src":"617:14:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"610:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"427:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"430:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"424:2:1"},"nodeType":"YulFunctionCall","src":"424:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"438:18:1","statements":[{"nodeType":"YulAssignment","src":"440:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"449:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"452:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"445:3:1"},"nodeType":"YulFunctionCall","src":"445:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"440:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"409:14:1","statements":[{"nodeType":"YulVariableDeclaration","src":"411:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"420:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"415:1:1","type":""}]}]},"src":"405:236:1"}]},"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"96:6:1","type":""},{"name":"length","nodeType":"YulTypedName","src":"104:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"112:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"120:5:1","type":""}],"src":"24:623:1"},{"body":{"nodeType":"YulBlock","src":"747:226:1","statements":[{"body":{"nodeType":"YulBlock","src":"796:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"805:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"808:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"798:6:1"},"nodeType":"YulFunctionCall","src":"798:12:1"},"nodeType":"YulExpressionStatement","src":"798:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"775:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"783:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"771:3:1"},"nodeType":"YulFunctionCall","src":"771:17:1"},{"name":"end","nodeType":"YulIdentifier","src":"790:3:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"767:3:1"},"nodeType":"YulFunctionCall","src":"767:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"760:6:1"},"nodeType":"YulFunctionCall","src":"760:35:1"},"nodeType":"YulIf","src":"757:2:1"},{"nodeType":"YulVariableDeclaration","src":"821:34:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"848:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"835:12:1"},"nodeType":"YulFunctionCall","src":"835:20:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"825:6:1","type":""}]},{"nodeType":"YulAssignment","src":"864:103:1","value":{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"940:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"948:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"936:3:1"},"nodeType":"YulFunctionCall","src":"936:17:1"},{"name":"length","nodeType":"YulIdentifier","src":"955:6:1"},{"name":"end","nodeType":"YulIdentifier","src":"963:3:1"}],"functionName":{"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"873:62:1"},"nodeType":"YulFunctionCall","src":"873:94:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"864:5:1"}]}]},"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"725:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"733:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"741:5:1","type":""}],"src":"670:303:1"},{"body":{"nodeType":"YulBlock","src":"1031:87:1","statements":[{"nodeType":"YulAssignment","src":"1041:29:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1063:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1050:12:1"},"nodeType":"YulFunctionCall","src":"1050:20:1"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"1041:5:1"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1106:5:1"}],"functionName":{"name":"validator_revert_t_uint256","nodeType":"YulIdentifier","src":"1079:26:1"},"nodeType":"YulFunctionCall","src":"1079:33:1"},"nodeType":"YulExpressionStatement","src":"1079:33:1"}]},"name":"abi_decode_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"1009:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"1017:3:1","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"1025:5:1","type":""}],"src":"979:139:1"},{"body":{"nodeType":"YulBlock","src":"1215:314:1","statements":[{"body":{"nodeType":"YulBlock","src":"1261:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1270:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1273:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1263:6:1"},"nodeType":"YulFunctionCall","src":"1263:12:1"},"nodeType":"YulExpressionStatement","src":"1263:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"1236:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"1245:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"1232:3:1"},"nodeType":"YulFunctionCall","src":"1232:23:1"},{"kind":"number","nodeType":"YulLiteral","src":"1257:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"1228:3:1"},"nodeType":"YulFunctionCall","src":"1228:32:1"},"nodeType":"YulIf","src":"1225:2:1"},{"nodeType":"YulBlock","src":"1287:235:1","statements":[{"nodeType":"YulVariableDeclaration","src":"1302:45:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1333:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1344:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1329:3:1"},"nodeType":"YulFunctionCall","src":"1329:17:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1316:12:1"},"nodeType":"YulFunctionCall","src":"1316:31:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"1306:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1394:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1403:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1406:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1396:6:1"},"nodeType":"YulFunctionCall","src":"1396:12:1"},"nodeType":"YulExpressionStatement","src":"1396:12:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1366:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1374:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1363:2:1"},"nodeType":"YulFunctionCall","src":"1363:30:1"},"nodeType":"YulIf","src":"1360:2:1"},{"nodeType":"YulAssignment","src":"1424:88:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1484:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"1495:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1480:3:1"},"nodeType":"YulFunctionCall","src":"1480:22:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1504:7:1"}],"functionName":{"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"1434:45:1"},"nodeType":"YulFunctionCall","src":"1434:78:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1424:6:1"}]}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1185:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"1196:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"1208:6:1","type":""}],"src":"1124:405:1"},{"body":{"nodeType":"YulBlock","src":"1600:53:1","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1617:3:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1640:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"1622:17:1"},"nodeType":"YulFunctionCall","src":"1622:24:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1610:6:1"},"nodeType":"YulFunctionCall","src":"1610:37:1"},"nodeType":"YulExpressionStatement","src":"1610:37:1"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1588:5:1","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1595:3:1","type":""}],"src":"1535:118:1"},{"body":{"nodeType":"YulBlock","src":"1757:124:1","statements":[{"nodeType":"YulAssignment","src":"1767:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1779:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1790:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1775:3:1"},"nodeType":"YulFunctionCall","src":"1775:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1767:4:1"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"1847:6:1"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1860:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1871:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1856:3:1"},"nodeType":"YulFunctionCall","src":"1856:17:1"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulIdentifier","src":"1803:43:1"},"nodeType":"YulFunctionCall","src":"1803:71:1"},"nodeType":"YulExpressionStatement","src":"1803:71:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1729:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1741:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1752:4:1","type":""}],"src":"1659:222:1"},{"body":{"nodeType":"YulBlock","src":"1928:88:1","statements":[{"nodeType":"YulAssignment","src":"1938:30:1","value":{"arguments":[],"functionName":{"name":"allocate_unbounded","nodeType":"YulIdentifier","src":"1948:18:1"},"nodeType":"YulFunctionCall","src":"1948:20:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1938:6:1"}]},{"expression":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1997:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"2005:4:1"}],"functionName":{"name":"finalize_allocation","nodeType":"YulIdentifier","src":"1977:19:1"},"nodeType":"YulFunctionCall","src":"1977:33:1"},"nodeType":"YulExpressionStatement","src":"1977:33:1"}]},"name":"allocate_memory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"1912:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"1921:6:1","type":""}],"src":"1887:129:1"},{"body":{"nodeType":"YulBlock","src":"2062:35:1","statements":[{"nodeType":"YulAssignment","src":"2072:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2088:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"2082:5:1"},"nodeType":"YulFunctionCall","src":"2082:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2072:6:1"}]}]},"name":"allocate_unbounded","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"2055:6:1","type":""}],"src":"2022:75:1"},{"body":{"nodeType":"YulBlock","src":"2185:229:1","statements":[{"body":{"nodeType":"YulBlock","src":"2290:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"2292:16:1"},"nodeType":"YulFunctionCall","src":"2292:18:1"},"nodeType":"YulExpressionStatement","src":"2292:18:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2262:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2270:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2259:2:1"},"nodeType":"YulFunctionCall","src":"2259:30:1"},"nodeType":"YulIf","src":"2256:2:1"},{"nodeType":"YulAssignment","src":"2322:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2334:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2342:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"2330:3:1"},"nodeType":"YulFunctionCall","src":"2330:17:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2322:4:1"}]},{"nodeType":"YulAssignment","src":"2384:23:1","value":{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2396:4:1"},{"kind":"number","nodeType":"YulLiteral","src":"2402:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2392:3:1"},"nodeType":"YulFunctionCall","src":"2392:15:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2384:4:1"}]}]},"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nodeType":"YulTypedName","src":"2169:6:1","type":""}],"returnVariables":[{"name":"size","nodeType":"YulTypedName","src":"2180:4:1","type":""}],"src":"2103:311:1"},{"body":{"nodeType":"YulBlock","src":"2465:32:1","statements":[{"nodeType":"YulAssignment","src":"2475:16:1","value":{"name":"value","nodeType":"YulIdentifier","src":"2486:5:1"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"2475:7:1"}]}]},"name":"cleanup_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2447:5:1","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"2457:7:1","type":""}],"src":"2420:77:1"},{"body":{"nodeType":"YulBlock","src":"2546:238:1","statements":[{"nodeType":"YulVariableDeclaration","src":"2556:58:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2578:6:1"},{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2608:4:1"}],"functionName":{"name":"round_up_to_mul_of_32","nodeType":"YulIdentifier","src":"2586:21:1"},"nodeType":"YulFunctionCall","src":"2586:27:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2574:3:1"},"nodeType":"YulFunctionCall","src":"2574:40:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"2560:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"2725:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"2727:16:1"},"nodeType":"YulFunctionCall","src":"2727:18:1"},"nodeType":"YulExpressionStatement","src":"2727:18:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2668:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"2680:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2665:2:1"},"nodeType":"YulFunctionCall","src":"2665:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2704:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"2716:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"2701:2:1"},"nodeType":"YulFunctionCall","src":"2701:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"2662:2:1"},"nodeType":"YulFunctionCall","src":"2662:62:1"},"nodeType":"YulIf","src":"2659:2:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2763:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2767:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2756:6:1"},"nodeType":"YulFunctionCall","src":"2756:22:1"},"nodeType":"YulExpressionStatement","src":"2756:22:1"}]},"name":"finalize_allocation","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nodeType":"YulTypedName","src":"2532:6:1","type":""},{"name":"size","nodeType":"YulTypedName","src":"2540:4:1","type":""}],"src":"2503:281:1"},{"body":{"nodeType":"YulBlock","src":"2818:152:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2835:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"2838:77:1","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2828:6:1"},"nodeType":"YulFunctionCall","src":"2828:88:1"},"nodeType":"YulExpressionStatement","src":"2828:88:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2932:1:1","type":"","value":"4"},{"kind":"number","nodeType":"YulLiteral","src":"2935:4:1","type":"","value":"0x41"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2925:6:1"},"nodeType":"YulFunctionCall","src":"2925:15:1"},"nodeType":"YulExpressionStatement","src":"2925:15:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2956:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"2959:4:1","type":"","value":"0x24"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"2949:6:1"},"nodeType":"YulFunctionCall","src":"2949:15:1"},"nodeType":"YulExpressionStatement","src":"2949:15:1"}]},"name":"panic_error_0x41","nodeType":"YulFunctionDefinition","src":"2790:180:1"},{"body":{"nodeType":"YulBlock","src":"3024:54:1","statements":[{"nodeType":"YulAssignment","src":"3034:38:1","value":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3052:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"3059:2:1","type":"","value":"31"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"3048:3:1"},"nodeType":"YulFunctionCall","src":"3048:14:1"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3068:2:1","type":"","value":"31"}],"functionName":{"name":"not","nodeType":"YulIdentifier","src":"3064:3:1"},"nodeType":"YulFunctionCall","src":"3064:7:1"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"3044:3:1"},"nodeType":"YulFunctionCall","src":"3044:28:1"},"variableNames":[{"name":"result","nodeType":"YulIdentifier","src":"3034:6:1"}]}]},"name":"round_up_to_mul_of_32","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"3007:5:1","type":""}],"returnVariables":[{"name":"result","nodeType":"YulTypedName","src":"3017:6:1","type":""}],"src":"2976:102:1"},{"body":{"nodeType":"YulBlock","src":"3127:79:1","statements":[{"body":{"nodeType":"YulBlock","src":"3184:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3193:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3196:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"3186:6:1"},"nodeType":"YulFunctionCall","src":"3186:12:1"},"nodeType":"YulExpressionStatement","src":"3186:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3150:5:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3175:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"3157:17:1"},"nodeType":"YulFunctionCall","src":"3157:24:1"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"3147:2:1"},"nodeType":"YulFunctionCall","src":"3147:35:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"3140:6:1"},"nodeType":"YulFunctionCall","src":"3140:43:1"},"nodeType":"YulIf","src":"3137:2:1"}]},"name":"validator_revert_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"3120:5:1","type":""}],"src":"3084:122:1"}]},"contents":"{ +{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"object":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:3241:1","statements":[{"body":{"nodeType":"YulBlock","src":"126:553:1","statements":[{"nodeType":"YulAssignment","src":"136:90:1","value":{"arguments":[{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"218:6:1"}],"functionName":{"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"161:56:1"},"nodeType":"YulFunctionCall","src":"161:64:1"}],"functionName":{"name":"allocate_memory","nodeType":"YulIdentifier","src":"145:15:1"},"nodeType":"YulFunctionCall","src":"145:81:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"136:5:1"}]},{"nodeType":"YulVariableDeclaration","src":"235:16:1","value":{"name":"array","nodeType":"YulIdentifier","src":"246:5:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"239:3:1","type":""}]},{"expression":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"268:5:1"},{"name":"length","nodeType":"YulIdentifier","src":"275:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"261:6:1"},"nodeType":"YulFunctionCall","src":"261:21:1"},"nodeType":"YulExpressionStatement","src":"261:21:1"},{"nodeType":"YulAssignment","src":"291:23:1","value":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"302:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"309:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"298:3:1"},"nodeType":"YulFunctionCall","src":"298:16:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"291:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"324:17:1","value":{"name":"offset","nodeType":"YulIdentifier","src":"335:6:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"328:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"390:36:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"411:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"414:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"404:6:1"},"nodeType":"YulFunctionCall","src":"404:12:1"},"nodeType":"YulExpressionStatement","src":"404:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"360:3:1"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"369:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"377:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"365:3:1"},"nodeType":"YulFunctionCall","src":"365:17:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"356:3:1"},"nodeType":"YulFunctionCall","src":"356:27:1"},{"name":"end","nodeType":"YulIdentifier","src":"385:3:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"353:2:1"},"nodeType":"YulFunctionCall","src":"353:36:1"},"nodeType":"YulIf","src":"350:2:1"},{"body":{"nodeType":"YulBlock","src":"495:178:1","statements":[{"nodeType":"YulVariableDeclaration","src":"510:21:1","value":{"name":"src","nodeType":"YulIdentifier","src":"528:3:1"},"variables":[{"name":"elementPos","nodeType":"YulTypedName","src":"514:10:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"552:3:1"},{"arguments":[{"name":"elementPos","nodeType":"YulIdentifier","src":"578:10:1"},{"name":"end","nodeType":"YulIdentifier","src":"590:3:1"}],"functionName":{"name":"abi_decode_t_uint256","nodeType":"YulIdentifier","src":"557:20:1"},"nodeType":"YulFunctionCall","src":"557:37:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"545:6:1"},"nodeType":"YulFunctionCall","src":"545:50:1"},"nodeType":"YulExpressionStatement","src":"545:50:1"},{"nodeType":"YulAssignment","src":"608:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"619:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"624:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"615:3:1"},"nodeType":"YulFunctionCall","src":"615:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"608:3:1"}]},{"nodeType":"YulAssignment","src":"642:21:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"653:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"658:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"649:3:1"},"nodeType":"YulFunctionCall","src":"649:14:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"642:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"457:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"460:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"454:2:1"},"nodeType":"YulFunctionCall","src":"454:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"468:18:1","statements":[{"nodeType":"YulAssignment","src":"470:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"479:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"482:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"475:3:1"},"nodeType":"YulFunctionCall","src":"475:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"470:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"439:14:1","statements":[{"nodeType":"YulVariableDeclaration","src":"441:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"450:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"445:1:1","type":""}]}]},"src":"435:238:1"}]},"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"96:6:1","type":""},{"name":"length","nodeType":"YulTypedName","src":"104:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"112:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"120:5:1","type":""}],"src":"24:655:1"},{"body":{"nodeType":"YulBlock","src":"779:226:1","statements":[{"body":{"nodeType":"YulBlock","src":"828:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"837:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"840:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"830:6:1"},"nodeType":"YulFunctionCall","src":"830:12:1"},"nodeType":"YulExpressionStatement","src":"830:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"807:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"815:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"803:3:1"},"nodeType":"YulFunctionCall","src":"803:17:1"},{"name":"end","nodeType":"YulIdentifier","src":"822:3:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"799:3:1"},"nodeType":"YulFunctionCall","src":"799:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"792:6:1"},"nodeType":"YulFunctionCall","src":"792:35:1"},"nodeType":"YulIf","src":"789:2:1"},{"nodeType":"YulVariableDeclaration","src":"853:34:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"880:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"867:12:1"},"nodeType":"YulFunctionCall","src":"867:20:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"857:6:1","type":""}]},{"nodeType":"YulAssignment","src":"896:103:1","value":{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"972:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"980:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"968:3:1"},"nodeType":"YulFunctionCall","src":"968:17:1"},{"name":"length","nodeType":"YulIdentifier","src":"987:6:1"},{"name":"end","nodeType":"YulIdentifier","src":"995:3:1"}],"functionName":{"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"905:62:1"},"nodeType":"YulFunctionCall","src":"905:94:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"896:5:1"}]}]},"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"757:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"765:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"773:5:1","type":""}],"src":"702:303:1"},{"body":{"nodeType":"YulBlock","src":"1063:87:1","statements":[{"nodeType":"YulAssignment","src":"1073:29:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1095:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1082:12:1"},"nodeType":"YulFunctionCall","src":"1082:20:1"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"1073:5:1"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1138:5:1"}],"functionName":{"name":"validator_revert_t_uint256","nodeType":"YulIdentifier","src":"1111:26:1"},"nodeType":"YulFunctionCall","src":"1111:33:1"},"nodeType":"YulExpressionStatement","src":"1111:33:1"}]},"name":"abi_decode_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"1041:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"1049:3:1","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"1057:5:1","type":""}],"src":"1011:139:1"},{"body":{"nodeType":"YulBlock","src":"1247:314:1","statements":[{"body":{"nodeType":"YulBlock","src":"1293:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1302:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1305:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1295:6:1"},"nodeType":"YulFunctionCall","src":"1295:12:1"},"nodeType":"YulExpressionStatement","src":"1295:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"1268:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"1277:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"1264:3:1"},"nodeType":"YulFunctionCall","src":"1264:23:1"},{"kind":"number","nodeType":"YulLiteral","src":"1289:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"1260:3:1"},"nodeType":"YulFunctionCall","src":"1260:32:1"},"nodeType":"YulIf","src":"1257:2:1"},{"nodeType":"YulBlock","src":"1319:235:1","statements":[{"nodeType":"YulVariableDeclaration","src":"1334:45:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1365:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1376:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1361:3:1"},"nodeType":"YulFunctionCall","src":"1361:17:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1348:12:1"},"nodeType":"YulFunctionCall","src":"1348:31:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"1338:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1426:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1435:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1438:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1428:6:1"},"nodeType":"YulFunctionCall","src":"1428:12:1"},"nodeType":"YulExpressionStatement","src":"1428:12:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1398:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1406:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1395:2:1"},"nodeType":"YulFunctionCall","src":"1395:30:1"},"nodeType":"YulIf","src":"1392:2:1"},{"nodeType":"YulAssignment","src":"1456:88:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1516:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"1527:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1512:3:1"},"nodeType":"YulFunctionCall","src":"1512:22:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1536:7:1"}],"functionName":{"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"1466:45:1"},"nodeType":"YulFunctionCall","src":"1466:78:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1456:6:1"}]}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1217:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"1228:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"1240:6:1","type":""}],"src":"1156:405:1"},{"body":{"nodeType":"YulBlock","src":"1632:53:1","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1649:3:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1672:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"1654:17:1"},"nodeType":"YulFunctionCall","src":"1654:24:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1642:6:1"},"nodeType":"YulFunctionCall","src":"1642:37:1"},"nodeType":"YulExpressionStatement","src":"1642:37:1"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1620:5:1","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1627:3:1","type":""}],"src":"1567:118:1"},{"body":{"nodeType":"YulBlock","src":"1789:124:1","statements":[{"nodeType":"YulAssignment","src":"1799:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1811:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1822:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1807:3:1"},"nodeType":"YulFunctionCall","src":"1807:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1799:4:1"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"1879:6:1"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1892:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1903:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1888:3:1"},"nodeType":"YulFunctionCall","src":"1888:17:1"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulIdentifier","src":"1835:43:1"},"nodeType":"YulFunctionCall","src":"1835:71:1"},"nodeType":"YulExpressionStatement","src":"1835:71:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1761:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1773:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1784:4:1","type":""}],"src":"1691:222:1"},{"body":{"nodeType":"YulBlock","src":"1960:88:1","statements":[{"nodeType":"YulAssignment","src":"1970:30:1","value":{"arguments":[],"functionName":{"name":"allocate_unbounded","nodeType":"YulIdentifier","src":"1980:18:1"},"nodeType":"YulFunctionCall","src":"1980:20:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1970:6:1"}]},{"expression":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2029:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"2037:4:1"}],"functionName":{"name":"finalize_allocation","nodeType":"YulIdentifier","src":"2009:19:1"},"nodeType":"YulFunctionCall","src":"2009:33:1"},"nodeType":"YulExpressionStatement","src":"2009:33:1"}]},"name":"allocate_memory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"1944:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"1953:6:1","type":""}],"src":"1919:129:1"},{"body":{"nodeType":"YulBlock","src":"2094:35:1","statements":[{"nodeType":"YulAssignment","src":"2104:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2120:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"2114:5:1"},"nodeType":"YulFunctionCall","src":"2114:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2104:6:1"}]}]},"name":"allocate_unbounded","nodeType":"YulFunctionDefinition","returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"2087:6:1","type":""}],"src":"2054:75:1"},{"body":{"nodeType":"YulBlock","src":"2217:229:1","statements":[{"body":{"nodeType":"YulBlock","src":"2322:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"2324:16:1"},"nodeType":"YulFunctionCall","src":"2324:18:1"},"nodeType":"YulExpressionStatement","src":"2324:18:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2294:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2302:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2291:2:1"},"nodeType":"YulFunctionCall","src":"2291:30:1"},"nodeType":"YulIf","src":"2288:2:1"},{"nodeType":"YulAssignment","src":"2354:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2366:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2374:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"2362:3:1"},"nodeType":"YulFunctionCall","src":"2362:17:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2354:4:1"}]},{"nodeType":"YulAssignment","src":"2416:23:1","value":{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2428:4:1"},{"kind":"number","nodeType":"YulLiteral","src":"2434:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2424:3:1"},"nodeType":"YulFunctionCall","src":"2424:15:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2416:4:1"}]}]},"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nodeType":"YulTypedName","src":"2201:6:1","type":""}],"returnVariables":[{"name":"size","nodeType":"YulTypedName","src":"2212:4:1","type":""}],"src":"2135:311:1"},{"body":{"nodeType":"YulBlock","src":"2497:32:1","statements":[{"nodeType":"YulAssignment","src":"2507:16:1","value":{"name":"value","nodeType":"YulIdentifier","src":"2518:5:1"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"2507:7:1"}]}]},"name":"cleanup_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2479:5:1","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"2489:7:1","type":""}],"src":"2452:77:1"},{"body":{"nodeType":"YulBlock","src":"2578:238:1","statements":[{"nodeType":"YulVariableDeclaration","src":"2588:58:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"2610:6:1"},{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2640:4:1"}],"functionName":{"name":"round_up_to_mul_of_32","nodeType":"YulIdentifier","src":"2618:21:1"},"nodeType":"YulFunctionCall","src":"2618:27:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2606:3:1"},"nodeType":"YulFunctionCall","src":"2606:40:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"2592:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"2757:22:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error_0x41","nodeType":"YulIdentifier","src":"2759:16:1"},"nodeType":"YulFunctionCall","src":"2759:18:1"},"nodeType":"YulExpressionStatement","src":"2759:18:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2700:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"2712:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2697:2:1"},"nodeType":"YulFunctionCall","src":"2697:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2736:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"2748:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"2733:2:1"},"nodeType":"YulFunctionCall","src":"2733:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"2694:2:1"},"nodeType":"YulFunctionCall","src":"2694:62:1"},"nodeType":"YulIf","src":"2691:2:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2795:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2799:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2788:6:1"},"nodeType":"YulFunctionCall","src":"2788:22:1"},"nodeType":"YulExpressionStatement","src":"2788:22:1"}]},"name":"finalize_allocation","nodeType":"YulFunctionDefinition","parameters":[{"name":"memPtr","nodeType":"YulTypedName","src":"2564:6:1","type":""},{"name":"size","nodeType":"YulTypedName","src":"2572:4:1","type":""}],"src":"2535:281:1"},{"body":{"nodeType":"YulBlock","src":"2850:152:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2867:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"2870:77:1","type":"","value":"35408467139433450592217433187231851964531694900788300625387963629091585785856"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2860:6:1"},"nodeType":"YulFunctionCall","src":"2860:88:1"},"nodeType":"YulExpressionStatement","src":"2860:88:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2964:1:1","type":"","value":"4"},{"kind":"number","nodeType":"YulLiteral","src":"2967:4:1","type":"","value":"0x41"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2957:6:1"},"nodeType":"YulFunctionCall","src":"2957:15:1"},"nodeType":"YulExpressionStatement","src":"2957:15:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2988:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"2991:4:1","type":"","value":"0x24"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"2981:6:1"},"nodeType":"YulFunctionCall","src":"2981:15:1"},"nodeType":"YulExpressionStatement","src":"2981:15:1"}]},"name":"panic_error_0x41","nodeType":"YulFunctionDefinition","src":"2822:180:1"},{"body":{"nodeType":"YulBlock","src":"3056:54:1","statements":[{"nodeType":"YulAssignment","src":"3066:38:1","value":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3084:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"3091:2:1","type":"","value":"31"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"3080:3:1"},"nodeType":"YulFunctionCall","src":"3080:14:1"},{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3100:2:1","type":"","value":"31"}],"functionName":{"name":"not","nodeType":"YulIdentifier","src":"3096:3:1"},"nodeType":"YulFunctionCall","src":"3096:7:1"}],"functionName":{"name":"and","nodeType":"YulIdentifier","src":"3076:3:1"},"nodeType":"YulFunctionCall","src":"3076:28:1"},"variableNames":[{"name":"result","nodeType":"YulIdentifier","src":"3066:6:1"}]}]},"name":"round_up_to_mul_of_32","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"3039:5:1","type":""}],"returnVariables":[{"name":"result","nodeType":"YulTypedName","src":"3049:6:1","type":""}],"src":"3008:102:1"},{"body":{"nodeType":"YulBlock","src":"3159:79:1","statements":[{"body":{"nodeType":"YulBlock","src":"3216:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"3225:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"3228:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"3218:6:1"},"nodeType":"YulFunctionCall","src":"3218:12:1"},"nodeType":"YulExpressionStatement","src":"3218:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3182:5:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"3207:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"3189:17:1"},"nodeType":"YulFunctionCall","src":"3189:24:1"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"3179:2:1"},"nodeType":"YulFunctionCall","src":"3179:35:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"3172:6:1"},"nodeType":"YulFunctionCall","src":"3172:43:1"},"nodeType":"YulIf","src":"3169:2:1"}]},"name":"validator_revert_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"3152:5:1","type":""}],"src":"3116:122:1"}]},"contents":"{ // uint256[] function abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr(offset, length, end) -> array { array := allocate_memory(array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr(length)) let dst := array - mstore(array, length) dst := add(array, 0x20) + + mstore(array, length) + dst := add(array, 0x20) + let src := offset - if gt(add(src, mul(length, 0x20)), end) { revert(0, 0) } + if gt(add(src, mul(length, 0x20)), end) { + revert(0, 0) + } for { let i := 0 } lt(i, length) { i := add(i, 1) } { + let elementPos := src + mstore(dst, abi_decode_t_uint256(elementPos, end)) dst := add(dst, 0x20) src := add(src, 0x20) diff --git a/test/libsolidity/gasTests/abiv2.sol b/test/libsolidity/gasTests/abiv2.sol index 17e42cf1b..980a9ee28 100644 --- a/test/libsolidity/gasTests/abiv2.sol +++ b/test/libsolidity/gasTests/abiv2.sol @@ -14,9 +14,9 @@ contract C { } // ---- // creation: -// codeDepositCost: 1170600 -// executionCost: 1214 -// totalCost: 1171814 +// codeDepositCost: 1211600 +// executionCost: 1261 +// totalCost: 1212861 // external: // a(): 1130 // b(uint256): infinite diff --git a/test/libsolidity/gasTests/abiv2_optimised.sol b/test/libsolidity/gasTests/abiv2_optimised.sol index 5ad314f59..cf55b0a4a 100644 --- a/test/libsolidity/gasTests/abiv2_optimised.sol +++ b/test/libsolidity/gasTests/abiv2_optimised.sol @@ -17,9 +17,9 @@ contract C { // optimize-yul: true // ---- // creation: -// codeDepositCost: 626600 -// executionCost: 657 -// totalCost: 627257 +// codeDepositCost: 664600 +// executionCost: 696 +// totalCost: 665296 // external: // a(): 985 // b(uint256): 2052