diff --git a/libsolidity/codegen/ABIFunctions.cpp b/libsolidity/codegen/ABIFunctions.cpp index 88e3c39fd..8f2e7a96f 100644 --- a/libsolidity/codegen/ABIFunctions.cpp +++ b/libsolidity/codegen/ABIFunctions.cpp @@ -1079,8 +1079,6 @@ string ABIFunctions::abiDecodingFunction(Type const& _type, bool _fromMemory, bo solAssert(!_fromMemory, ""); return abiDecodingFunctionCalldataArray(*arrayType); } - else if (arrayType->isByteArray()) - return abiDecodingFunctionByteArray(*arrayType, _fromMemory); else return abiDecodingFunctionArray(*arrayType, _fromMemory); } @@ -1133,36 +1131,21 @@ string ABIFunctions::abiDecodingFunctionValueType(Type const& _type, bool _fromM string ABIFunctions::abiDecodingFunctionArray(ArrayType const& _type, bool _fromMemory) { solAssert(_type.dataStoredIn(DataLocation::Memory), ""); - solAssert(!_type.isByteArray(), ""); string functionName = "abi_decode_" + _type.identifier() + (_fromMemory ? "_fromMemory" : ""); - solAssert(!_type.dataStoredIn(DataLocation::Storage), ""); - return createFunction(functionName, [&]() { string load = _fromMemory ? "mload" : "calldataload"; - bool dynamicBase = _type.baseType()->isDynamicallyEncoded(); Whiskers templ( R"( // function (offset, end) -> array { if iszero(slt(add(offset, 0x1f), end)) { } let length := - array := ((length)) - let dst := array - // might update offset and dst - let src := offset - - for { let i := 0 } lt(i, length) { i := add(i, 1) } - { - let elementPos := - mstore(dst, (elementPos, end)) - dst := add(dst, 0x20) - src := add(src, ) - } + array := (, length, end) } )" ); @@ -1170,18 +1153,56 @@ string ABIFunctions::abiDecodingFunctionArray(ArrayType const& _type, bool _from templ("revertString", revertReasonIfDebug("ABI decoding: invalid calldata array offset")); templ("functionName", functionName); templ("readableTypeName", _type.toString(true)); - templ("retrieveLength", !_type.isDynamicallySized() ? toCompactHexWithPrefix(_type.length()) : load + "(offset)"); + templ("retrieveLength", _type.isDynamicallySized() ? (load + "(offset)") : toCompactHexWithPrefix(_type.length())); + templ("offset", _type.isDynamicallySized() ? "add(offset, 0x20)" : "offset"); + templ("abiDecodeAvailableLen", abiDecodingFunctionArrayAvailableLength(_type, _fromMemory)); + return templ.render(); + }); +} + +string ABIFunctions::abiDecodingFunctionArrayAvailableLength(ArrayType const& _type, bool _fromMemory) +{ + solAssert(_type.dataStoredIn(DataLocation::Memory), ""); + if (_type.isByteArray()) + return abiDecodingFunctionByteArrayAvailableLength(_type, _fromMemory); + + string functionName = + "abi_decode_available_length_" + + _type.identifier() + + (_fromMemory ? "_fromMemory" : ""); + + return createFunction(functionName, [&]() { + Whiskers templ(R"( + // + function (offset, length, end) -> array { + array := ((length)) + let dst := array + + let src := offset + + for { let i := 0 } lt(i, length) { i := add(i, 1) } + { + let elementPos := + mstore(dst, (elementPos, end)) + dst := add(dst, 0x20) + src := add(src, ) + } + } + )"); + templ("functionName", functionName); + 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) offset := add(offset, 0x20) dst := add(dst, 0x20)"); + templ("storeLength", "mstore(array, length) dst := add(array, 0x20)"); else templ("storeLength", ""); - if (dynamicBase) + if (_type.baseType()->isDynamicallyEncoded()) { templ("staticBoundsCheck", ""); + string load = _fromMemory ? "mload" : "calldataload"; templ("retrieveElementPos", "add(offset, " + load + "(src))"); } else @@ -1245,36 +1266,28 @@ string ABIFunctions::abiDecodingFunctionCalldataArray(ArrayType const& _type) }); } -string ABIFunctions::abiDecodingFunctionByteArray(ArrayType const& _type, bool _fromMemory) +string ABIFunctions::abiDecodingFunctionByteArrayAvailableLength(ArrayType const& _type, bool _fromMemory) { solAssert(_type.dataStoredIn(DataLocation::Memory), ""); solAssert(_type.isByteArray(), ""); string functionName = - "abi_decode_" + + "abi_decode_available_length_" + _type.identifier() + (_fromMemory ? "_fromMemory" : ""); return createFunction(functionName, [&]() { - Whiskers templ( - R"( - function (offset, end) -> array { - if iszero(slt(add(offset, 0x1f), end)) { } - let length := (offset) - array := ((length)) - mstore(array, length) - let src := add(offset, 0x20) - let dst := add(array, 0x20) - if gt(add(src, length), end) { } - (src, dst, length) - } - )" - ); - // TODO add test - templ("revertStringOffset", revertReasonIfDebug("ABI decoding: invalid byte array offset")); + Whiskers templ(R"( + function (src, length, end) -> array { + array := ((length)) + mstore(array, length) + let dst := add(array, 0x20) + if gt(add(src, length), end) { } + (src, dst, length) + } + )"); templ("revertStringLength", revertReasonIfDebug("ABI decoding: invalid byte array length")); templ("functionName", functionName); - templ("load", _fromMemory ? "mload" : "calldataload"); templ("allocate", m_utils.allocationFunction()); templ("allocationSize", m_utils.arrayAllocationSizeFunction(_type)); templ("copyToMemFun", m_utils.copyToMemoryFunction(!_fromMemory)); diff --git a/libsolidity/codegen/ABIFunctions.h b/libsolidity/codegen/ABIFunctions.h index e34abe852..2b5bffd46 100644 --- a/libsolidity/codegen/ABIFunctions.h +++ b/libsolidity/codegen/ABIFunctions.h @@ -165,6 +165,11 @@ public: EncodingOptions const& _options ); + /// Decodes array in case of dynamic arrays with offset pointing to + /// data and length already on stack + /// signature: (dataOffset, length, dataEnd) -> decodedArray + std::string abiDecodingFunctionArrayAvailableLength(ArrayType const& _type, bool _fromMemory); + private: /// Part of @a abiEncodingFunction for array target type and given calldata array. /// Uses calldatacopy and does not perform cleanup or validation and can therefore only @@ -234,15 +239,14 @@ private: std::string abiDecodingFunctionArray(ArrayType const& _type, bool _fromMemory); /// Part of @a abiDecodingFunction for calldata array types. std::string abiDecodingFunctionCalldataArray(ArrayType const& _type); - /// Part of @a abiDecodingFunction for byte array types. - std::string abiDecodingFunctionByteArray(ArrayType const& _type, bool _fromMemory); + /// Part of @a abiDecodingFunctionArrayWithAvailableLength + std::string abiDecodingFunctionByteArrayAvailableLength(ArrayType const& _type, bool _fromMemory); /// Part of @a abiDecodingFunction for calldata struct types. std::string abiDecodingFunctionCalldataStruct(StructType const& _type); - /// Part of @a abiDecodingFunction for struct types. - std::string abiDecodingFunctionStruct(StructType const& _type, bool _fromMemory); /// Part of @a abiDecodingFunction for array types. std::string abiDecodingFunctionFunctionType(FunctionType const& _type, bool _fromMemory, bool _forUseOnStack); - + /// Part of @a abiDecodingFunction for struct types. + std::string abiDecodingFunctionStruct(StructType const& _type, bool _fromMemory); /// @returns the name of a function that retrieves an element from calldata. std::string calldataAccessFunction(Type const& _type); diff --git a/libsolidity/codegen/YulUtilFunctions.cpp b/libsolidity/codegen/YulUtilFunctions.cpp index 28c72ad05..202f95499 100644 --- a/libsolidity/codegen/YulUtilFunctions.cpp +++ b/libsolidity/codegen/YulUtilFunctions.cpp @@ -3090,7 +3090,8 @@ string YulUtilFunctions::conversionFunction(Type const& _from, Type const& _to) string YulUtilFunctions::arrayConversionFunction(ArrayType const& _from, ArrayType const& _to) { - solUnimplementedAssert(_to.location() != DataLocation::CallData, "Conversion of calldata types not yet implemented."); + solAssert(_to.location() != DataLocation::CallData, ""); + // Other cases are done explicitly in LValue::storeValue, and only possible by assignment. if (_to.location() == DataLocation::Storage) solAssert( @@ -3098,12 +3099,6 @@ string YulUtilFunctions::arrayConversionFunction(ArrayType const& _from, ArrayTy _from.location() == DataLocation::Storage, "Invalid conversion to storage type." ); - if (_to.location() == DataLocation::Memory && _from.location() == DataLocation::CallData) - { - solUnimplementedAssert(_from.isDynamicallySized(), ""); - solUnimplementedAssert(!_from.baseType()->isDynamicallyEncoded(), ""); - solUnimplementedAssert(_from.isByteArray() && _to.isByteArray() && _to.isDynamicallySized(), ""); - } string functionName = "convert_array_" + @@ -3131,19 +3126,31 @@ string YulUtilFunctions::arrayConversionFunction(ArrayType const& _from, ArrayTy "body", Whiskers(R"( // Copy the array to a free position in memory + converted := - converted := (value) + (value) - converted := (length) - (value, add(converted, 0x20), length) + (value, , calldatasize()) )") ("fromStorage", _from.dataStoredIn(DataLocation::Storage)) ("fromCalldata", _from.dataStoredIn(DataLocation::CallData)) - ("allocateMemoryArray", _from.dataStoredIn(DataLocation::CallData) ? allocateMemoryArrayFunction(_to) : "") - ("copyToMemory", _from.dataStoredIn(DataLocation::CallData) ? copyToMemoryFunction(true) : "") - ("arrayStorageToMem", _from.dataStoredIn(DataLocation::Storage) ? copyArrayFromStorageToMemoryFunction(_from, _to) : "") + ("length", _from.isDynamicallySized() ? "length" : _from.length().str()) + ( + "abiDecode", + _from.dataStoredIn(DataLocation::CallData) ? + ABIFunctions( + m_evmVersion, + m_revertStrings, + m_functionCollector + ).abiDecodingFunctionArrayAvailableLength(_to, false) : + "" + ) + ( + "arrayStorageToMem", + _from.dataStoredIn(DataLocation::Storage) ? copyArrayFromStorageToMemoryFunction(_from, _to) : "" + ) .render() ); else diff --git a/test/cmdlineTests/name_simplifier/output b/test/cmdlineTests/name_simplifier/output index 4ba58b829..9b2cd9281 100644 --- a/test/cmdlineTests/name_simplifier/output +++ b/test/cmdlineTests/name_simplifier/output @@ -19,52 +19,49 @@ object "C_56" { object "C_56_deployed" { code { { - mstore(64, 128) + let _1 := 64 + mstore(_1, 128) if iszero(lt(calldatasize(), 4)) { - let _1 := 0 - if eq(0xf8eddcc6, shr(224, calldataload(_1))) + let _2 := 0 + if eq(0xf8eddcc6, shr(224, calldataload(_2))) { - if callvalue() { revert(_1, _1) } - let _2 := 32 - if slt(add(calldatasize(), not(3)), _2) { revert(_1, _1) } + if callvalue() { revert(_2, _2) } + let _3 := 32 + if slt(add(calldatasize(), not(3)), _3) { revert(_2, _2) } let offset := calldataload(4) - let _3 := 0xffffffffffffffff - if gt(offset, _3) { revert(_1, _1) } - if iszero(slt(add(offset, 35), calldatasize())) { revert(_1, _1) } - let length := calldataload(add(4, offset)) - if gt(length, _3) { invalid() } - let _4 := mul(length, _2) - let dst := allocateMemory(add(_4, _2)) + let _4 := 0xffffffffffffffff + if gt(offset, _4) { revert(_2, _2) } + if iszero(slt(add(offset, 35), calldatasize())) { revert(_2, _2) } + let _5 := calldataload(add(4, offset)) + if gt(_5, _4) { invalid() } + let _6 := mul(_5, _3) + let dst := allocateMemory(add(_6, _3)) let dst_1 := dst - mstore(dst, length) - dst := add(dst, _2) + mstore(dst, _5) + dst := add(dst, _3) let src := add(offset, 36) - if gt(add(add(offset, _4), 36), calldatasize()) { revert(_1, _1) } - let i := _1 - for { } lt(i, length) { i := add(i, 1) } + if gt(add(add(offset, _6), 36), calldatasize()) { revert(_2, _2) } + let i := _2 + for { } lt(i, _5) { i := add(i, 1) } { - mstore(dst, abi_decode_t_struct$_S(src, calldatasize())) - dst := add(dst, _2) - src := add(src, _2) + if slt(sub(calldatasize(), src), _3) { revert(_2, _2) } + let memPtr := mload(_1) + let newFreePtr := add(memPtr, _3) + if or(gt(newFreePtr, _4), lt(newFreePtr, memPtr)) { invalid() } + mstore(_1, newFreePtr) + mstore(memPtr, calldataload(src)) + mstore(dst, memPtr) + dst := add(dst, _3) + src := add(src, _3) } let ret, ret_1 := fun_sumArray_55(dst_1) - let memPos := allocateMemory(_1) + let memPos := allocateMemory(_2) return(memPos, sub(abi_encode_uint256_t_string(memPos, ret, ret_1), memPos)) } } revert(0, 0) } - function abi_decode_t_struct$_S(headStart, end) -> value - { - if slt(sub(end, headStart), 0x20) { revert(value, value) } - let memPtr := mload(64) - let newFreePtr := add(memPtr, 0x20) - if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() } - mstore(64, newFreePtr) - value := memPtr - mstore(memPtr, calldataload(headStart)) - } function abi_encode_uint256_t_string(headStart, value0, value1) -> tail { mstore(headStart, value0) diff --git a/test/cmdlineTests/standard_generatedSources/output.json b/test/cmdlineTests/standard_generatedSources/output.json index c154f364c..ee8f8df93 100644 --- a/test/cmdlineTests/standard_generatedSources/output.json +++ b/test/cmdlineTests/standard_generatedSources/output.json @@ -1,12 +1,10 @@ -{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:2555:1","statements":[{"body":{"nodeType":"YulBlock","src":"101:684:1","statements":[{"body":{"nodeType":"YulBlock","src":"150:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"159:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"162:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"152:6:1"},"nodeType":"YulFunctionCall","src":"152:12:1"},"nodeType":"YulExpressionStatement","src":"152:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"129:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"137:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"125:3:1"},"nodeType":"YulFunctionCall","src":"125:17:1"},{"name":"end","nodeType":"YulIdentifier","src":"144:3:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"121:3:1"},"nodeType":"YulFunctionCall","src":"121:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"114:6:1"},"nodeType":"YulFunctionCall","src":"114:35:1"},"nodeType":"YulIf","src":"111:2:1"},{"nodeType":"YulVariableDeclaration","src":"175:34:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"202:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"189:12:1"},"nodeType":"YulFunctionCall","src":"189:20:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"179:6:1","type":""}]},{"nodeType":"YulAssignment","src":"218:89:1","value":{"arguments":[{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"299:6:1"}],"functionName":{"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"242:56:1"},"nodeType":"YulFunctionCall","src":"242:64:1"}],"functionName":{"name":"allocateMemory","nodeType":"YulIdentifier","src":"227:14:1"},"nodeType":"YulFunctionCall","src":"227:80:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"218:5:1"}]},{"nodeType":"YulVariableDeclaration","src":"316:16:1","value":{"name":"array","nodeType":"YulIdentifier","src":"327:5:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"320:3:1","type":""}]},{"expression":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"348:5:1"},{"name":"length","nodeType":"YulIdentifier","src":"355:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"341:6:1"},"nodeType":"YulFunctionCall","src":"341:21:1"},"nodeType":"YulExpressionStatement","src":"341:21:1"},{"nodeType":"YulAssignment","src":"363:27:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"377:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"385:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"373:3:1"},"nodeType":"YulFunctionCall","src":"373:17:1"},"variableNames":[{"name":"offset","nodeType":"YulIdentifier","src":"363:6:1"}]},{"nodeType":"YulAssignment","src":"391:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"402:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"407:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"398:3:1"},"nodeType":"YulFunctionCall","src":"398:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"391:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"452:17:1","value":{"name":"offset","nodeType":"YulIdentifier","src":"463:6:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"456:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"518:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"527:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"530:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"520:6:1"},"nodeType":"YulFunctionCall","src":"520:12:1"},"nodeType":"YulExpressionStatement","src":"520:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"488:3:1"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"497:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"505:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"493:3:1"},"nodeType":"YulFunctionCall","src":"493:17:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"484:3:1"},"nodeType":"YulFunctionCall","src":"484:27:1"},{"name":"end","nodeType":"YulIdentifier","src":"513:3:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"481:2:1"},"nodeType":"YulFunctionCall","src":"481:36:1"},"nodeType":"YulIf","src":"478:2:1"},{"body":{"nodeType":"YulBlock","src":"603:176:1","statements":[{"nodeType":"YulVariableDeclaration","src":"617:21:1","value":{"name":"src","nodeType":"YulIdentifier","src":"635:3:1"},"variables":[{"name":"elementPos","nodeType":"YulTypedName","src":"621:10:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"658:3:1"},{"arguments":[{"name":"elementPos","nodeType":"YulIdentifier","src":"684:10:1"},{"name":"end","nodeType":"YulIdentifier","src":"696:3:1"}],"functionName":{"name":"abi_decode_t_uint256","nodeType":"YulIdentifier","src":"663:20:1"},"nodeType":"YulFunctionCall","src":"663:37:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"651:6:1"},"nodeType":"YulFunctionCall","src":"651:50:1"},"nodeType":"YulExpressionStatement","src":"651:50:1"},{"nodeType":"YulAssignment","src":"714:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"725:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"730:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"721:3:1"},"nodeType":"YulFunctionCall","src":"721:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"714:3:1"}]},{"nodeType":"YulAssignment","src":"748:21:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"759:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"764:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"755:3:1"},"nodeType":"YulFunctionCall","src":"755:14:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"748:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"565:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"568:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"562:2:1"},"nodeType":"YulFunctionCall","src":"562:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"576:18:1","statements":[{"nodeType":"YulAssignment","src":"578:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"587:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"590:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"583:3:1"},"nodeType":"YulFunctionCall","src":"583:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"578:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"547:14:1","statements":[{"nodeType":"YulVariableDeclaration","src":"549:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"558:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"553:1:1","type":""}]}]},"src":"543:236:1"}]},"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"79:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"87:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"95:5:1","type":""}],"src":"24:761:1"},{"body":{"nodeType":"YulBlock","src":"843:87:1","statements":[{"nodeType":"YulAssignment","src":"853:29:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"875:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"862:12:1"},"nodeType":"YulFunctionCall","src":"862:20:1"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"853:5:1"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"918:5:1"}],"functionName":{"name":"validator_revert_t_uint256","nodeType":"YulIdentifier","src":"891:26:1"},"nodeType":"YulFunctionCall","src":"891:33:1"},"nodeType":"YulExpressionStatement","src":"891:33:1"}]},"name":"abi_decode_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"821:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"829:3:1","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"837:5:1","type":""}],"src":"791:139:1"},{"body":{"nodeType":"YulBlock","src":"1027:312:1","statements":[{"body":{"nodeType":"YulBlock","src":"1073:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1082:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1085:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1075:6:1"},"nodeType":"YulFunctionCall","src":"1075:12:1"},"nodeType":"YulExpressionStatement","src":"1075:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"1048:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"1057:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"1044:3:1"},"nodeType":"YulFunctionCall","src":"1044:23:1"},{"kind":"number","nodeType":"YulLiteral","src":"1069:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"1040:3:1"},"nodeType":"YulFunctionCall","src":"1040:32:1"},"nodeType":"YulIf","src":"1037:2:1"},{"nodeType":"YulBlock","src":"1099:233:1","statements":[{"nodeType":"YulVariableDeclaration","src":"1113:45:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1144:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1155:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1140:3:1"},"nodeType":"YulFunctionCall","src":"1140:17:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1127:12:1"},"nodeType":"YulFunctionCall","src":"1127:31:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"1117:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1205:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1214:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1217:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1207:6:1"},"nodeType":"YulFunctionCall","src":"1207:12:1"},"nodeType":"YulExpressionStatement","src":"1207:12:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1177:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1185:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1174:2:1"},"nodeType":"YulFunctionCall","src":"1174:30:1"},"nodeType":"YulIf","src":"1171:2:1"},{"nodeType":"YulAssignment","src":"1234:88:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1294:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"1305:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1290:3:1"},"nodeType":"YulFunctionCall","src":"1290:22:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1314:7:1"}],"functionName":{"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"1244:45:1"},"nodeType":"YulFunctionCall","src":"1244:78:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1234:6:1"}]}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"997:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"1008:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"1020:6:1","type":""}],"src":"936:403:1"},{"body":{"nodeType":"YulBlock","src":"1410:53:1","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1427:3:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1450:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"1432:17:1"},"nodeType":"YulFunctionCall","src":"1432:24:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1420:6:1"},"nodeType":"YulFunctionCall","src":"1420:37:1"},"nodeType":"YulExpressionStatement","src":"1420:37:1"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1398:5:1","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1405:3:1","type":""}],"src":"1345:118:1"},{"body":{"nodeType":"YulBlock","src":"1567:124:1","statements":[{"nodeType":"YulAssignment","src":"1577:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1589:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1600:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1585:3:1"},"nodeType":"YulFunctionCall","src":"1585:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1577:4:1"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"1657:6:1"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1670:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1681:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1666:3:1"},"nodeType":"YulFunctionCall","src":"1666:17:1"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulIdentifier","src":"1613:43:1"},"nodeType":"YulFunctionCall","src":"1613:71:1"},"nodeType":"YulExpressionStatement","src":"1613:71:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1539:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1551:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1562:4:1","type":""}],"src":"1469:222:1"},{"body":{"nodeType":"YulBlock","src":"1737:238:1","statements":[{"nodeType":"YulAssignment","src":"1747:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1763:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"1757:5:1"},"nodeType":"YulFunctionCall","src":"1757:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1747:6:1"}]},{"nodeType":"YulVariableDeclaration","src":"1775:35:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1797:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"1805:4:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1793:3:1"},"nodeType":"YulFunctionCall","src":"1793:17:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"1779:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1921:17:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error","nodeType":"YulIdentifier","src":"1923:11:1"},"nodeType":"YulFunctionCall","src":"1923:13:1"},"nodeType":"YulExpressionStatement","src":"1923:13:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"1864:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"1876:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1861:2:1"},"nodeType":"YulFunctionCall","src":"1861:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"1900:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"1912:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"1897:2:1"},"nodeType":"YulFunctionCall","src":"1897:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"1858:2:1"},"nodeType":"YulFunctionCall","src":"1858:62:1"},"nodeType":"YulIf","src":"1855:2:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1954:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"1958:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1947:6:1"},"nodeType":"YulFunctionCall","src":"1947:22:1"},"nodeType":"YulExpressionStatement","src":"1947:22:1"}]},"name":"allocateMemory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"1721:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"1730:6:1","type":""}],"src":"1697:278:1"},{"body":{"nodeType":"YulBlock","src":"2063:224:1","statements":[{"body":{"nodeType":"YulBlock","src":"2168:17:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error","nodeType":"YulIdentifier","src":"2170:11:1"},"nodeType":"YulFunctionCall","src":"2170:13:1"},"nodeType":"YulExpressionStatement","src":"2170:13:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2140:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2148:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2137:2:1"},"nodeType":"YulFunctionCall","src":"2137:30:1"},"nodeType":"YulIf","src":"2134:2:1"},{"nodeType":"YulAssignment","src":"2195:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2207:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2215:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"2203:3:1"},"nodeType":"YulFunctionCall","src":"2203:17:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2195:4:1"}]},{"nodeType":"YulAssignment","src":"2257:23:1","value":{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2269:4:1"},{"kind":"number","nodeType":"YulLiteral","src":"2275:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2265:3:1"},"nodeType":"YulFunctionCall","src":"2265:15:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2257:4:1"}]}]},"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nodeType":"YulTypedName","src":"2047:6:1","type":""}],"returnVariables":[{"name":"size","nodeType":"YulTypedName","src":"2058:4:1","type":""}],"src":"1981:306:1"},{"body":{"nodeType":"YulBlock","src":"2338:32:1","statements":[{"nodeType":"YulAssignment","src":"2348:16:1","value":{"name":"value","nodeType":"YulIdentifier","src":"2359:5:1"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"2348:7:1"}]}]},"name":"cleanup_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2320:5:1","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"2330:7:1","type":""}],"src":"2293:77:1"},{"body":{"nodeType":"YulBlock","src":"2399:25:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"invalid","nodeType":"YulIdentifier","src":"2409:7:1"},"nodeType":"YulFunctionCall","src":"2409:9:1"},"nodeType":"YulExpressionStatement","src":"2409:9:1"}]},"name":"panic_error","nodeType":"YulFunctionDefinition","src":"2376:48:1"},{"body":{"nodeType":"YulBlock","src":"2473:79:1","statements":[{"body":{"nodeType":"YulBlock","src":"2530:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2539:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"2542:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"2532:6:1"},"nodeType":"YulFunctionCall","src":"2532:12:1"},"nodeType":"YulExpressionStatement","src":"2532:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2496:5:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2521:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"2503:17:1"},"nodeType":"YulFunctionCall","src":"2503:24:1"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"2493:2:1"},"nodeType":"YulFunctionCall","src":"2493:35:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"2486:6:1"},"nodeType":"YulFunctionCall","src":"2486:43:1"},"nodeType":"YulIf","src":"2483:2:1"}]},"name":"validator_revert_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2466:5:1","type":""}],"src":"2430:122:1"}]},"contents":"{ +{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:2742:1","statements":[{"body":{"nodeType":"YulBlock","src":"126:520:1","statements":[{"nodeType":"YulAssignment","src":"136:89:1","value":{"arguments":[{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"217:6:1"}],"functionName":{"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"160:56:1"},"nodeType":"YulFunctionCall","src":"160:64:1"}],"functionName":{"name":"allocateMemory","nodeType":"YulIdentifier","src":"145:14:1"},"nodeType":"YulFunctionCall","src":"145:80:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"136:5:1"}]},{"nodeType":"YulVariableDeclaration","src":"234:16:1","value":{"name":"array","nodeType":"YulIdentifier","src":"245:5:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"238:3:1","type":""}]},{"expression":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"266:5:1"},{"name":"length","nodeType":"YulIdentifier","src":"273:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"259:6:1"},"nodeType":"YulFunctionCall","src":"259:21:1"},"nodeType":"YulExpressionStatement","src":"259:21:1"},{"nodeType":"YulAssignment","src":"281:23:1","value":{"arguments":[{"name":"array","nodeType":"YulIdentifier","src":"292:5:1"},{"kind":"number","nodeType":"YulLiteral","src":"299:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"288:3:1"},"nodeType":"YulFunctionCall","src":"288:16:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"281:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"313:17:1","value":{"name":"offset","nodeType":"YulIdentifier","src":"324:6:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"317:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"379:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"388:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"391:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"381:6:1"},"nodeType":"YulFunctionCall","src":"381:12:1"},"nodeType":"YulExpressionStatement","src":"381:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"349:3:1"},{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"358:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"366:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"354:3:1"},"nodeType":"YulFunctionCall","src":"354:17:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"345:3:1"},"nodeType":"YulFunctionCall","src":"345:27:1"},{"name":"end","nodeType":"YulIdentifier","src":"374:3:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"342:2:1"},"nodeType":"YulFunctionCall","src":"342:36:1"},"nodeType":"YulIf","src":"339:2:1"},{"body":{"nodeType":"YulBlock","src":"464:176:1","statements":[{"nodeType":"YulVariableDeclaration","src":"478:21:1","value":{"name":"src","nodeType":"YulIdentifier","src":"496:3:1"},"variables":[{"name":"elementPos","nodeType":"YulTypedName","src":"482:10:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"519:3:1"},{"arguments":[{"name":"elementPos","nodeType":"YulIdentifier","src":"545:10:1"},{"name":"end","nodeType":"YulIdentifier","src":"557:3:1"}],"functionName":{"name":"abi_decode_t_uint256","nodeType":"YulIdentifier","src":"524:20:1"},"nodeType":"YulFunctionCall","src":"524:37:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"512:6:1"},"nodeType":"YulFunctionCall","src":"512:50:1"},"nodeType":"YulExpressionStatement","src":"512:50:1"},{"nodeType":"YulAssignment","src":"575:21:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"586:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"591:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"582:3:1"},"nodeType":"YulFunctionCall","src":"582:14:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"575:3:1"}]},{"nodeType":"YulAssignment","src":"609:21:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"620:3:1"},{"kind":"number","nodeType":"YulLiteral","src":"625:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"616:3:1"},"nodeType":"YulFunctionCall","src":"616:14:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"609:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"426:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"429:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"423:2:1"},"nodeType":"YulFunctionCall","src":"423:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"437:18:1","statements":[{"nodeType":"YulAssignment","src":"439:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"448:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"451:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"444:3:1"},"nodeType":"YulFunctionCall","src":"444:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"439:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"408:14:1","statements":[{"nodeType":"YulVariableDeclaration","src":"410:10:1","value":{"kind":"number","nodeType":"YulLiteral","src":"419:1:1","type":"","value":"0"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"414:1:1","type":""}]}]},"src":"404: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:622:1"},{"body":{"nodeType":"YulBlock","src":"746:226:1","statements":[{"body":{"nodeType":"YulBlock","src":"795:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"804:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"807:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"797:6:1"},"nodeType":"YulFunctionCall","src":"797:12:1"},"nodeType":"YulExpressionStatement","src":"797:12:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"774:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"782:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"770:3:1"},"nodeType":"YulFunctionCall","src":"770:17:1"},{"name":"end","nodeType":"YulIdentifier","src":"789:3:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"766:3:1"},"nodeType":"YulFunctionCall","src":"766:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"759:6:1"},"nodeType":"YulFunctionCall","src":"759:35:1"},"nodeType":"YulIf","src":"756:2:1"},{"nodeType":"YulVariableDeclaration","src":"820:34:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"847:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"834:12:1"},"nodeType":"YulFunctionCall","src":"834:20:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"824:6:1","type":""}]},{"nodeType":"YulAssignment","src":"863:103:1","value":{"arguments":[{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"939:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"947:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"935:3:1"},"nodeType":"YulFunctionCall","src":"935:17:1"},{"name":"length","nodeType":"YulIdentifier","src":"954:6:1"},{"name":"end","nodeType":"YulIdentifier","src":"962:3:1"}],"functionName":{"name":"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"872:62:1"},"nodeType":"YulFunctionCall","src":"872:94:1"},"variableNames":[{"name":"array","nodeType":"YulIdentifier","src":"863:5:1"}]}]},"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"724:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"732:3:1","type":""}],"returnVariables":[{"name":"array","nodeType":"YulTypedName","src":"740:5:1","type":""}],"src":"669:303:1"},{"body":{"nodeType":"YulBlock","src":"1030:87:1","statements":[{"nodeType":"YulAssignment","src":"1040:29:1","value":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1062:6:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1049:12:1"},"nodeType":"YulFunctionCall","src":"1049:20:1"},"variableNames":[{"name":"value","nodeType":"YulIdentifier","src":"1040:5:1"}]},{"expression":{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1105:5:1"}],"functionName":{"name":"validator_revert_t_uint256","nodeType":"YulIdentifier","src":"1078:26:1"},"nodeType":"YulFunctionCall","src":"1078:33:1"},"nodeType":"YulExpressionStatement","src":"1078:33:1"}]},"name":"abi_decode_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"offset","nodeType":"YulTypedName","src":"1008:6:1","type":""},{"name":"end","nodeType":"YulTypedName","src":"1016:3:1","type":""}],"returnVariables":[{"name":"value","nodeType":"YulTypedName","src":"1024:5:1","type":""}],"src":"978:139:1"},{"body":{"nodeType":"YulBlock","src":"1214:312:1","statements":[{"body":{"nodeType":"YulBlock","src":"1260:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1269:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1272:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1262:6:1"},"nodeType":"YulFunctionCall","src":"1262:12:1"},"nodeType":"YulExpressionStatement","src":"1262:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"1235:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"1244:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"1231:3:1"},"nodeType":"YulFunctionCall","src":"1231:23:1"},{"kind":"number","nodeType":"YulLiteral","src":"1256:2:1","type":"","value":"32"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"1227:3:1"},"nodeType":"YulFunctionCall","src":"1227:32:1"},"nodeType":"YulIf","src":"1224:2:1"},{"nodeType":"YulBlock","src":"1286:233:1","statements":[{"nodeType":"YulVariableDeclaration","src":"1300:45:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1331:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1342:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1327:3:1"},"nodeType":"YulFunctionCall","src":"1327:17:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1314:12:1"},"nodeType":"YulFunctionCall","src":"1314:31:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"1304:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1392:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1401:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"1404:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"1394:6:1"},"nodeType":"YulFunctionCall","src":"1394:12:1"},"nodeType":"YulExpressionStatement","src":"1394:12:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"1364:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"1372:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1361:2:1"},"nodeType":"YulFunctionCall","src":"1361:30:1"},"nodeType":"YulIf","src":"1358:2:1"},{"nodeType":"YulAssignment","src":"1421:88:1","value":{"arguments":[{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1481:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"1492:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1477:3:1"},"nodeType":"YulFunctionCall","src":"1477:22:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"1501:7:1"}],"functionName":{"name":"abi_decode_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulIdentifier","src":"1431:45:1"},"nodeType":"YulFunctionCall","src":"1431:78:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1421:6:1"}]}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1184:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"1195:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"1207:6:1","type":""}],"src":"1123:403:1"},{"body":{"nodeType":"YulBlock","src":"1597:53:1","statements":[{"expression":{"arguments":[{"name":"pos","nodeType":"YulIdentifier","src":"1614:3:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"1637:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"1619:17:1"},"nodeType":"YulFunctionCall","src":"1619:24:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1607:6:1"},"nodeType":"YulFunctionCall","src":"1607:37:1"},"nodeType":"YulExpressionStatement","src":"1607:37:1"}]},"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"1585:5:1","type":""},{"name":"pos","nodeType":"YulTypedName","src":"1592:3:1","type":""}],"src":"1532:118:1"},{"body":{"nodeType":"YulBlock","src":"1754:124:1","statements":[{"nodeType":"YulAssignment","src":"1764:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1776:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1787:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1772:3:1"},"nodeType":"YulFunctionCall","src":"1772:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1764:4:1"}]},{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"1844:6:1"},{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1857:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1868:1:1","type":"","value":"0"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1853:3:1"},"nodeType":"YulFunctionCall","src":"1853:17:1"}],"functionName":{"name":"abi_encode_t_uint256_to_t_uint256_fromStack","nodeType":"YulIdentifier","src":"1800:43:1"},"nodeType":"YulFunctionCall","src":"1800:71:1"},"nodeType":"YulExpressionStatement","src":"1800:71:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1726:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1738:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1749:4:1","type":""}],"src":"1656:222:1"},{"body":{"nodeType":"YulBlock","src":"1924:238:1","statements":[{"nodeType":"YulAssignment","src":"1934:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1950:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"1944:5:1"},"nodeType":"YulFunctionCall","src":"1944:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1934:6:1"}]},{"nodeType":"YulVariableDeclaration","src":"1962:35:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1984:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"1992:4:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1980:3:1"},"nodeType":"YulFunctionCall","src":"1980:17:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"1966:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"2108:17:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error","nodeType":"YulIdentifier","src":"2110:11:1"},"nodeType":"YulFunctionCall","src":"2110:13:1"},"nodeType":"YulExpressionStatement","src":"2110:13:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2051:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"2063:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2048:2:1"},"nodeType":"YulFunctionCall","src":"2048:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2087:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"2099:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"2084:2:1"},"nodeType":"YulFunctionCall","src":"2084:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"2045:2:1"},"nodeType":"YulFunctionCall","src":"2045:62:1"},"nodeType":"YulIf","src":"2042:2:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2141:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"2145:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"2134:6:1"},"nodeType":"YulFunctionCall","src":"2134:22:1"},"nodeType":"YulExpressionStatement","src":"2134:22:1"}]},"name":"allocateMemory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"1908:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"1917:6:1","type":""}],"src":"1884:278:1"},{"body":{"nodeType":"YulBlock","src":"2250:224:1","statements":[{"body":{"nodeType":"YulBlock","src":"2355:17:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"panic_error","nodeType":"YulIdentifier","src":"2357:11:1"},"nodeType":"YulFunctionCall","src":"2357:13:1"},"nodeType":"YulExpressionStatement","src":"2357:13:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2327:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2335:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"2324:2:1"},"nodeType":"YulFunctionCall","src":"2324:30:1"},"nodeType":"YulIf","src":"2321:2:1"},{"nodeType":"YulAssignment","src":"2382:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"2394:6:1"},{"kind":"number","nodeType":"YulLiteral","src":"2402:4:1","type":"","value":"0x20"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"2390:3:1"},"nodeType":"YulFunctionCall","src":"2390:17:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2382:4:1"}]},{"nodeType":"YulAssignment","src":"2444:23:1","value":{"arguments":[{"name":"size","nodeType":"YulIdentifier","src":"2456:4:1"},{"kind":"number","nodeType":"YulLiteral","src":"2462:4:1","type":"","value":"0x20"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"2452:3:1"},"nodeType":"YulFunctionCall","src":"2452:15:1"},"variableNames":[{"name":"size","nodeType":"YulIdentifier","src":"2444:4:1"}]}]},"name":"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"length","nodeType":"YulTypedName","src":"2234:6:1","type":""}],"returnVariables":[{"name":"size","nodeType":"YulTypedName","src":"2245:4:1","type":""}],"src":"2168:306:1"},{"body":{"nodeType":"YulBlock","src":"2525:32:1","statements":[{"nodeType":"YulAssignment","src":"2535:16:1","value":{"name":"value","nodeType":"YulIdentifier","src":"2546:5:1"},"variableNames":[{"name":"cleaned","nodeType":"YulIdentifier","src":"2535:7:1"}]}]},"name":"cleanup_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2507:5:1","type":""}],"returnVariables":[{"name":"cleaned","nodeType":"YulTypedName","src":"2517:7:1","type":""}],"src":"2480:77:1"},{"body":{"nodeType":"YulBlock","src":"2586:25:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"invalid","nodeType":"YulIdentifier","src":"2596:7:1"},"nodeType":"YulFunctionCall","src":"2596:9:1"},"nodeType":"YulExpressionStatement","src":"2596:9:1"}]},"name":"panic_error","nodeType":"YulFunctionDefinition","src":"2563:48:1"},{"body":{"nodeType":"YulBlock","src":"2660:79:1","statements":[{"body":{"nodeType":"YulBlock","src":"2717:16:1","statements":[{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"2726:1:1","type":"","value":"0"},{"kind":"number","nodeType":"YulLiteral","src":"2729:1:1","type":"","value":"0"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"2719:6:1"},"nodeType":"YulFunctionCall","src":"2719:12:1"},"nodeType":"YulExpressionStatement","src":"2719:12:1"}]},"condition":{"arguments":[{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2683:5:1"},{"arguments":[{"name":"value","nodeType":"YulIdentifier","src":"2708:5:1"}],"functionName":{"name":"cleanup_t_uint256","nodeType":"YulIdentifier","src":"2690:17:1"},"nodeType":"YulFunctionCall","src":"2690:24:1"}],"functionName":{"name":"eq","nodeType":"YulIdentifier","src":"2680:2:1"},"nodeType":"YulFunctionCall","src":"2680:35:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"2673:6:1"},"nodeType":"YulFunctionCall","src":"2673:43:1"},"nodeType":"YulIf","src":"2670:2:1"}]},"name":"validator_revert_t_uint256","nodeType":"YulFunctionDefinition","parameters":[{"name":"value","nodeType":"YulTypedName","src":"2653:5:1","type":""}],"src":"2617:122:1"}]},"contents":"{ // uint256[] - function abi_decode_t_array$_t_uint256_$dyn_memory_ptr(offset, end) -> array { - if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) } - let length := calldataload(offset) + function abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr(offset, length, end) -> array { array := allocateMemory(array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr(length)) let dst := array - mstore(array, length) offset := add(offset, 0x20) dst := add(dst, 0x20) // might update offset and dst + mstore(array, length) dst := add(array, 0x20) let src := offset if gt(add(src, mul(length, 0x20)), end) { revert(0, 0) } for { let i := 0 } lt(i, length) { i := add(i, 1) } @@ -18,6 +16,13 @@ } } + // uint256[] + function abi_decode_t_array$_t_uint256_$dyn_memory_ptr(offset, end) -> array { + if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) } + let length := calldataload(offset) + array := abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr(add(offset, 0x20), length, end) + } + function abi_decode_t_uint256(offset, end) -> value { value := calldataload(offset) validator_revert_t_uint256(value) @@ -77,5 +82,5 @@ } } -","id":1,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":"70:74:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:59;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;130:7;83:59;;;:::o;24:761:1:-;;144:3;137:4;129:6;125:17;121:27;111:2;;162:1;159;152:12;111:2;202:6;189:20;227:80;242:64;299:6;242:64;:::i;:::-;227:80;:::i;:::-;218:89;;327:5;355:6;348:5;341:21;385:4;377:6;373:17;363:27;;407:4;402:3;398:14;391:21;;463:6;513:3;505:4;497:6;493:17;488:3;484:27;481:36;478:2;;;530:1;527;520:12;478:2;558:1;543:236;568:6;565:1;562:13;543:236;;;635:3;663:37;696:3;684:10;663:37;:::i;:::-;658:3;651:50;730:4;725:3;721:14;714:21;;764:4;759:3;755:14;748:21;;603:176;590:1;587;583:9;578:14;;543:236;;;547:14;101:684;;;;;;;:::o;791:139::-;;875:6;862:20;853:29;;891:33;918:5;891:33;:::i;:::-;843:87;;;;:::o;936:403::-;;1069:2;1057:9;1048:7;1044:23;1040:32;1037:2;;;1085:1;1082;1075:12;1037:2;1155:1;1144:9;1140:17;1127:31;1185:18;1177:6;1174:30;1171:2;;;1217:1;1214;1207:12;1171:2;1244:78;1314:7;1305:6;1294:9;1290:22;1244:78;:::i;:::-;1234:88;;1099:233;1027:312;;;;:::o;1345:118::-;1432:24;1450:5;1432:24;:::i;:::-;1427:3;1420:37;1410:53;;:::o;1469:222::-;;1600:2;1589:9;1585:18;1577:26;;1613:71;1681:1;1670:9;1666:17;1657:6;1613:71;:::i;:::-;1567:124;;;;:::o;1697:278::-;;1763:2;1757:9;1747:19;;1805:4;1797:6;1793:17;1912:6;1900:10;1897:22;1876:18;1864:10;1861:34;1858:62;1855:2;;;1923:13;;:::i;:::-;1855:2;1958:10;1954:2;1947:22;1737:238;;;;:::o;1981:306::-;;2148:18;2140:6;2137:30;2134:2;;;2170:13;;:::i;:::-;2134:2;2215:4;2207:6;2203:17;2195:25;;2275:4;2269;2265:15;2257:23;;2063:224;;;:::o;2293:77::-;;2359:5;2348:16;;2338:32;;;:::o;2376:48::-;2409:9;2430:122;2503:24;2521:5;2503:24;:::i;:::-;2496:5;2493:35;2483:2;;2542:1;2539;2532:12;2483:2;2473:79;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +","id":1,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":"70:74:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:59;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;130:7;83:59;;;:::o;24:622:1:-;;145:80;160:64;217:6;160:64;:::i;:::-;145:80;:::i;:::-;136:89;;245:5;273:6;266:5;259:21;299:4;292:5;288:16;281:23;;324:6;374:3;366:4;358:6;354:17;349:3;345:27;342:36;339:2;;;391:1;388;381:12;339:2;419:1;404:236;429:6;426:1;423:13;404:236;;;496:3;524:37;557:3;545:10;524:37;:::i;:::-;519:3;512:50;591:4;586:3;582:14;575:21;;625:4;620:3;616:14;609:21;;464:176;451:1;448;444:9;439:14;;404:236;;;408:14;126:520;;;;;;;:::o;669:303::-;;789:3;782:4;774:6;770:17;766:27;756:2;;807:1;804;797:12;756:2;847:6;834:20;872:94;962:3;954:6;947:4;939:6;935:17;872:94;:::i;:::-;863:103;;746:226;;;;;:::o;978:139::-;;1062:6;1049:20;1040:29;;1078:33;1105:5;1078:33;:::i;:::-;1030:87;;;;:::o;1123:403::-;;1256:2;1244:9;1235:7;1231:23;1227:32;1224:2;;;1272:1;1269;1262:12;1224:2;1342:1;1331:9;1327:17;1314:31;1372:18;1364:6;1361:30;1358:2;;;1404:1;1401;1394:12;1358:2;1431:78;1501:7;1492:6;1481:9;1477:22;1431:78;:::i;:::-;1421:88;;1286:233;1214:312;;;;:::o;1532:118::-;1619:24;1637:5;1619:24;:::i;:::-;1614:3;1607:37;1597:53;;:::o;1656:222::-;;1787:2;1776:9;1772:18;1764:26;;1800:71;1868:1;1857:9;1853:17;1844:6;1800:71;:::i;:::-;1754:124;;;;:::o;1884:278::-;;1950:2;1944:9;1934:19;;1992:4;1984:6;1980:17;2099:6;2087:10;2084:22;2063:18;2051:10;2048:34;2045:62;2042:2;;;2110:13;;:::i;:::-;2042:2;2145:10;2141:2;2134:22;1924:238;;;;:::o;2168:306::-;;2335:18;2327:6;2324:30;2321:2;;;2357:13;;:::i;:::-;2321:2;2402:4;2394:6;2390:17;2382:25;;2462:4;2456;2452:15;2444:23;;2250:224;;;:::o;2480:77::-;;2546:5;2535:16;;2525:32;;;:::o;2563:48::-;2596:9;2617:122;2690:24;2708:5;2690:24;:::i;:::-;2683:5;2680:35;2670:2;;2729:1;2726;2719:12;2670:2;2660:79;:::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0}}} diff --git a/test/cmdlineTests/standard_optimizer_generatedSources/output.json b/test/cmdlineTests/standard_optimizer_generatedSources/output.json index de9cccc84..9f4936877 100644 --- a/test/cmdlineTests/standard_optimizer_generatedSources/output.json +++ b/test/cmdlineTests/standard_optimizer_generatedSources/output.json @@ -1,4 +1,4 @@ -{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:1458:1","statements":[{"nodeType":"YulBlock","src":"6:3:1","statements":[]},{"body":{"nodeType":"YulBlock","src":"109:918:1","statements":[{"nodeType":"YulVariableDeclaration","src":"119:12:1","value":{"kind":"number","nodeType":"YulLiteral","src":"129:2:1","type":"","value":"32"},"variables":[{"name":"_1","nodeType":"YulTypedName","src":"123:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"176:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"185:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"193:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"178:6:1"},"nodeType":"YulFunctionCall","src":"178:22:1"},"nodeType":"YulExpressionStatement","src":"178:22:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"151:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"160:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"147:3:1"},"nodeType":"YulFunctionCall","src":"147:23:1"},{"name":"_1","nodeType":"YulIdentifier","src":"172:2:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"143:3:1"},"nodeType":"YulFunctionCall","src":"143:32:1"},"nodeType":"YulIf","src":"140:2:1"},{"nodeType":"YulVariableDeclaration","src":"211:37:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"238:9:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"225:12:1"},"nodeType":"YulFunctionCall","src":"225:23:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"215:6:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"257:28:1","value":{"kind":"number","nodeType":"YulLiteral","src":"267:18:1","type":"","value":"0xffffffffffffffff"},"variables":[{"name":"_2","nodeType":"YulTypedName","src":"261:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"312:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"321:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"329:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"314:6:1"},"nodeType":"YulFunctionCall","src":"314:22:1"},"nodeType":"YulExpressionStatement","src":"314:22:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"300:6:1"},{"name":"_2","nodeType":"YulIdentifier","src":"308:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"297:2:1"},"nodeType":"YulFunctionCall","src":"297:14:1"},"nodeType":"YulIf","src":"294:2:1"},{"nodeType":"YulVariableDeclaration","src":"347:32:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"361:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"372:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"357:3:1"},"nodeType":"YulFunctionCall","src":"357:22:1"},"variables":[{"name":"_3","nodeType":"YulTypedName","src":"351:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"427:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"436:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"444:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"429:6:1"},"nodeType":"YulFunctionCall","src":"429:22:1"},"nodeType":"YulExpressionStatement","src":"429:22:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"406:2:1"},{"kind":"number","nodeType":"YulLiteral","src":"410:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"402:3:1"},"nodeType":"YulFunctionCall","src":"402:13:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"417:7:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"398:3:1"},"nodeType":"YulFunctionCall","src":"398:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"391:6:1"},"nodeType":"YulFunctionCall","src":"391:35:1"},"nodeType":"YulIf","src":"388:2:1"},{"nodeType":"YulVariableDeclaration","src":"462:30:1","value":{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"489:2:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"476:12:1"},"nodeType":"YulFunctionCall","src":"476:16:1"},"variables":[{"name":"length","nodeType":"YulTypedName","src":"466:6:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"519:13:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"invalid","nodeType":"YulIdentifier","src":"521:7:1"},"nodeType":"YulFunctionCall","src":"521:9:1"},"nodeType":"YulExpressionStatement","src":"521:9:1"}]},"condition":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"507:6:1"},{"name":"_2","nodeType":"YulIdentifier","src":"515:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"504:2:1"},"nodeType":"YulFunctionCall","src":"504:14:1"},"nodeType":"YulIf","src":"501:2:1"},{"nodeType":"YulVariableDeclaration","src":"541:25:1","value":{"arguments":[{"name":"length","nodeType":"YulIdentifier","src":"555:6:1"},{"name":"_1","nodeType":"YulIdentifier","src":"563:2:1"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"551:3:1"},"nodeType":"YulFunctionCall","src":"551:15:1"},"variables":[{"name":"_4","nodeType":"YulTypedName","src":"545:2:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"575:38:1","value":{"arguments":[{"arguments":[{"name":"_4","nodeType":"YulIdentifier","src":"605:2:1"},{"name":"_1","nodeType":"YulIdentifier","src":"609:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"601:3:1"},"nodeType":"YulFunctionCall","src":"601:11:1"}],"functionName":{"name":"allocateMemory","nodeType":"YulIdentifier","src":"586:14:1"},"nodeType":"YulFunctionCall","src":"586:27:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"579:3:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"622:16:1","value":{"name":"dst","nodeType":"YulIdentifier","src":"635:3:1"},"variables":[{"name":"dst_1","nodeType":"YulTypedName","src":"626:5:1","type":""}]},{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"654:3:1"},{"name":"length","nodeType":"YulIdentifier","src":"659:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"647:6:1"},"nodeType":"YulFunctionCall","src":"647:19:1"},"nodeType":"YulExpressionStatement","src":"647:19:1"},{"nodeType":"YulAssignment","src":"675:19:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"686:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"691:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"682:3:1"},"nodeType":"YulFunctionCall","src":"682:12:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"675:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"703:22:1","value":{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"718:2:1"},{"name":"_1","nodeType":"YulIdentifier","src":"722:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"714:3:1"},"nodeType":"YulFunctionCall","src":"714:11:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"707:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"771:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"780:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"788:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"773:6:1"},"nodeType":"YulFunctionCall","src":"773:22:1"},"nodeType":"YulExpressionStatement","src":"773:22:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"748:2:1"},{"name":"_4","nodeType":"YulIdentifier","src":"752:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"744:3:1"},"nodeType":"YulFunctionCall","src":"744:11:1"},{"name":"_1","nodeType":"YulIdentifier","src":"757:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"740:3:1"},"nodeType":"YulFunctionCall","src":"740:20:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"762:7:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"737:2:1"},"nodeType":"YulFunctionCall","src":"737:33:1"},"nodeType":"YulIf","src":"734:2:1"},{"nodeType":"YulVariableDeclaration","src":"806:15:1","value":{"name":"value0","nodeType":"YulIdentifier","src":"815:6:1"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"810:1:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"879:118:1","statements":[{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"900:3:1"},{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"918:3:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"905:12:1"},"nodeType":"YulFunctionCall","src":"905:17:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"893:6:1"},"nodeType":"YulFunctionCall","src":"893:30:1"},"nodeType":"YulExpressionStatement","src":"893:30:1"},{"nodeType":"YulAssignment","src":"936:19:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"947:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"952:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"943:3:1"},"nodeType":"YulFunctionCall","src":"943:12:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"936:3:1"}]},{"nodeType":"YulAssignment","src":"968:19:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"979:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"984:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"975:3:1"},"nodeType":"YulFunctionCall","src":"975:12:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"968:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"841:1:1"},{"name":"length","nodeType":"YulIdentifier","src":"844:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"838:2:1"},"nodeType":"YulFunctionCall","src":"838:13:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"852:18:1","statements":[{"nodeType":"YulAssignment","src":"854:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"863:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"866:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"859:3:1"},"nodeType":"YulFunctionCall","src":"859:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"854:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"834:3:1","statements":[]},"src":"830:167:1"},{"nodeType":"YulAssignment","src":"1006:15:1","value":{"name":"dst_1","nodeType":"YulIdentifier","src":"1016:5:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1006:6:1"}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"75:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"86:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"98:6:1","type":""}],"src":"14:1013:1"},{"body":{"nodeType":"YulBlock","src":"1133:76:1","statements":[{"nodeType":"YulAssignment","src":"1143:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1155:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1166:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1151:3:1"},"nodeType":"YulFunctionCall","src":"1151:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1143:4:1"}]},{"expression":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1185:9:1"},{"name":"value0","nodeType":"YulIdentifier","src":"1196:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1178:6:1"},"nodeType":"YulFunctionCall","src":"1178:25:1"},"nodeType":"YulExpressionStatement","src":"1178:25:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1102:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1113:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1124:4:1","type":""}],"src":"1032:177:1"},{"body":{"nodeType":"YulBlock","src":"1258:198:1","statements":[{"nodeType":"YulAssignment","src":"1268:19:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1284:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"1278:5:1"},"nodeType":"YulFunctionCall","src":"1278:9:1"},"variableNames":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1268:6:1"}]},{"nodeType":"YulVariableDeclaration","src":"1296:35:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"1318:6:1"},{"name":"size","nodeType":"YulIdentifier","src":"1326:4:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1314:3:1"},"nodeType":"YulFunctionCall","src":"1314:17:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"1300:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1406:13:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"invalid","nodeType":"YulIdentifier","src":"1408:7:1"},"nodeType":"YulFunctionCall","src":"1408:9:1"},"nodeType":"YulExpressionStatement","src":"1408:9:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"1349:10:1"},{"kind":"number","nodeType":"YulLiteral","src":"1361:18:1","type":"","value":"0xffffffffffffffff"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"1346:2:1"},"nodeType":"YulFunctionCall","src":"1346:34:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"1385:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"1397:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"1382:2:1"},"nodeType":"YulFunctionCall","src":"1382:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"1343:2:1"},"nodeType":"YulFunctionCall","src":"1343:62:1"},"nodeType":"YulIf","src":"1340:2:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"1435:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"1439:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1428:6:1"},"nodeType":"YulFunctionCall","src":"1428:22:1"},"nodeType":"YulExpressionStatement","src":"1428:22:1"}]},"name":"allocateMemory","nodeType":"YulFunctionDefinition","parameters":[{"name":"size","nodeType":"YulTypedName","src":"1238:4:1","type":""}],"returnVariables":[{"name":"memPtr","nodeType":"YulTypedName","src":"1247:6:1","type":""}],"src":"1214:242:1"}]},"contents":"{ +{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"","opcodes":"","sourceMap":""},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:1338:1","statements":[{"nodeType":"YulBlock","src":"6:3:1","statements":[]},{"body":{"nodeType":"YulBlock","src":"109:1045:1","statements":[{"nodeType":"YulVariableDeclaration","src":"119:12:1","value":{"kind":"number","nodeType":"YulLiteral","src":"129:2:1","type":"","value":"32"},"variables":[{"name":"_1","nodeType":"YulTypedName","src":"123:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"176:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"185:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"193:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"178:6:1"},"nodeType":"YulFunctionCall","src":"178:22:1"},"nodeType":"YulExpressionStatement","src":"178:22:1"}]},"condition":{"arguments":[{"arguments":[{"name":"dataEnd","nodeType":"YulIdentifier","src":"151:7:1"},{"name":"headStart","nodeType":"YulIdentifier","src":"160:9:1"}],"functionName":{"name":"sub","nodeType":"YulIdentifier","src":"147:3:1"},"nodeType":"YulFunctionCall","src":"147:23:1"},{"name":"_1","nodeType":"YulIdentifier","src":"172:2:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"143:3:1"},"nodeType":"YulFunctionCall","src":"143:32:1"},"nodeType":"YulIf","src":"140:2:1"},{"nodeType":"YulVariableDeclaration","src":"211:37:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"238:9:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"225:12:1"},"nodeType":"YulFunctionCall","src":"225:23:1"},"variables":[{"name":"offset","nodeType":"YulTypedName","src":"215:6:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"257:28:1","value":{"kind":"number","nodeType":"YulLiteral","src":"267:18:1","type":"","value":"0xffffffffffffffff"},"variables":[{"name":"_2","nodeType":"YulTypedName","src":"261:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"312:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"321:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"329:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"314:6:1"},"nodeType":"YulFunctionCall","src":"314:22:1"},"nodeType":"YulExpressionStatement","src":"314:22:1"}]},"condition":{"arguments":[{"name":"offset","nodeType":"YulIdentifier","src":"300:6:1"},{"name":"_2","nodeType":"YulIdentifier","src":"308:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"297:2:1"},"nodeType":"YulFunctionCall","src":"297:14:1"},"nodeType":"YulIf","src":"294:2:1"},{"nodeType":"YulVariableDeclaration","src":"347:32:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"361:9:1"},{"name":"offset","nodeType":"YulIdentifier","src":"372:6:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"357:3:1"},"nodeType":"YulFunctionCall","src":"357:22:1"},"variables":[{"name":"_3","nodeType":"YulTypedName","src":"351:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"427:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"436:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"444:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"429:6:1"},"nodeType":"YulFunctionCall","src":"429:22:1"},"nodeType":"YulExpressionStatement","src":"429:22:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"406:2:1"},{"kind":"number","nodeType":"YulLiteral","src":"410:4:1","type":"","value":"0x1f"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"402:3:1"},"nodeType":"YulFunctionCall","src":"402:13:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"417:7:1"}],"functionName":{"name":"slt","nodeType":"YulIdentifier","src":"398:3:1"},"nodeType":"YulFunctionCall","src":"398:27:1"}],"functionName":{"name":"iszero","nodeType":"YulIdentifier","src":"391:6:1"},"nodeType":"YulFunctionCall","src":"391:35:1"},"nodeType":"YulIf","src":"388:2:1"},{"nodeType":"YulVariableDeclaration","src":"462:26:1","value":{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"485:2:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"472:12:1"},"nodeType":"YulFunctionCall","src":"472:16:1"},"variables":[{"name":"_4","nodeType":"YulTypedName","src":"466:2:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"511:13:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"invalid","nodeType":"YulIdentifier","src":"513:7:1"},"nodeType":"YulFunctionCall","src":"513:9:1"},"nodeType":"YulExpressionStatement","src":"513:9:1"}]},"condition":{"arguments":[{"name":"_4","nodeType":"YulIdentifier","src":"503:2:1"},{"name":"_2","nodeType":"YulIdentifier","src":"507:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"500:2:1"},"nodeType":"YulFunctionCall","src":"500:10:1"},"nodeType":"YulIf","src":"497:2:1"},{"nodeType":"YulVariableDeclaration","src":"533:21:1","value":{"arguments":[{"name":"_4","nodeType":"YulIdentifier","src":"547:2:1"},{"name":"_1","nodeType":"YulIdentifier","src":"551:2:1"}],"functionName":{"name":"mul","nodeType":"YulIdentifier","src":"543:3:1"},"nodeType":"YulFunctionCall","src":"543:11:1"},"variables":[{"name":"_5","nodeType":"YulTypedName","src":"537:2:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"563:23:1","value":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"583:2:1","type":"","value":"64"}],"functionName":{"name":"mload","nodeType":"YulIdentifier","src":"577:5:1"},"nodeType":"YulFunctionCall","src":"577:9:1"},"variables":[{"name":"memPtr","nodeType":"YulTypedName","src":"567:6:1","type":""}]},{"nodeType":"YulVariableDeclaration","src":"595:42:1","value":{"arguments":[{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"621:6:1"},{"name":"_5","nodeType":"YulIdentifier","src":"629:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"617:3:1"},"nodeType":"YulFunctionCall","src":"617:15:1"},{"name":"_1","nodeType":"YulIdentifier","src":"634:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"613:3:1"},"nodeType":"YulFunctionCall","src":"613:24:1"},"variables":[{"name":"newFreePtr","nodeType":"YulTypedName","src":"599:10:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"696:13:1","statements":[{"expression":{"arguments":[],"functionName":{"name":"invalid","nodeType":"YulIdentifier","src":"698:7:1"},"nodeType":"YulFunctionCall","src":"698:9:1"},"nodeType":"YulExpressionStatement","src":"698:9:1"}]},"condition":{"arguments":[{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"655:10:1"},{"name":"_2","nodeType":"YulIdentifier","src":"667:2:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"652:2:1"},"nodeType":"YulFunctionCall","src":"652:18:1"},{"arguments":[{"name":"newFreePtr","nodeType":"YulIdentifier","src":"675:10:1"},{"name":"memPtr","nodeType":"YulIdentifier","src":"687:6:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"672:2:1"},"nodeType":"YulFunctionCall","src":"672:22:1"}],"functionName":{"name":"or","nodeType":"YulIdentifier","src":"649:2:1"},"nodeType":"YulFunctionCall","src":"649:46:1"},"nodeType":"YulIf","src":"646:2:1"},{"expression":{"arguments":[{"kind":"number","nodeType":"YulLiteral","src":"725:2:1","type":"","value":"64"},{"name":"newFreePtr","nodeType":"YulIdentifier","src":"729:10:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"718:6:1"},"nodeType":"YulFunctionCall","src":"718:22:1"},"nodeType":"YulExpressionStatement","src":"718:22:1"},{"nodeType":"YulVariableDeclaration","src":"749:17:1","value":{"name":"memPtr","nodeType":"YulIdentifier","src":"760:6:1"},"variables":[{"name":"dst","nodeType":"YulTypedName","src":"753:3:1","type":""}]},{"expression":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"782:6:1"},{"name":"_4","nodeType":"YulIdentifier","src":"790:2:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"775:6:1"},"nodeType":"YulFunctionCall","src":"775:18:1"},"nodeType":"YulExpressionStatement","src":"775:18:1"},{"nodeType":"YulAssignment","src":"802:22:1","value":{"arguments":[{"name":"memPtr","nodeType":"YulIdentifier","src":"813:6:1"},{"name":"_1","nodeType":"YulIdentifier","src":"821:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"809:3:1"},"nodeType":"YulFunctionCall","src":"809:15:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"802:3:1"}]},{"nodeType":"YulVariableDeclaration","src":"833:22:1","value":{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"848:2:1"},{"name":"_1","nodeType":"YulIdentifier","src":"852:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"844:3:1"},"nodeType":"YulFunctionCall","src":"844:11:1"},"variables":[{"name":"src","nodeType":"YulTypedName","src":"837:3:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"901:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"910:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"918:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"903:6:1"},"nodeType":"YulFunctionCall","src":"903:22:1"},"nodeType":"YulExpressionStatement","src":"903:22:1"}]},"condition":{"arguments":[{"arguments":[{"arguments":[{"name":"_3","nodeType":"YulIdentifier","src":"878:2:1"},{"name":"_5","nodeType":"YulIdentifier","src":"882:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"874:3:1"},"nodeType":"YulFunctionCall","src":"874:11:1"},{"name":"_1","nodeType":"YulIdentifier","src":"887:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"870:3:1"},"nodeType":"YulFunctionCall","src":"870:20:1"},{"name":"dataEnd","nodeType":"YulIdentifier","src":"892:7:1"}],"functionName":{"name":"gt","nodeType":"YulIdentifier","src":"867:2:1"},"nodeType":"YulFunctionCall","src":"867:33:1"},"nodeType":"YulIf","src":"864:2:1"},{"nodeType":"YulVariableDeclaration","src":"936:15:1","value":{"name":"value0","nodeType":"YulIdentifier","src":"945:6:1"},"variables":[{"name":"i","nodeType":"YulTypedName","src":"940:1:1","type":""}]},{"body":{"nodeType":"YulBlock","src":"1005:118:1","statements":[{"expression":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1026:3:1"},{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"1044:3:1"}],"functionName":{"name":"calldataload","nodeType":"YulIdentifier","src":"1031:12:1"},"nodeType":"YulFunctionCall","src":"1031:17:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1019:6:1"},"nodeType":"YulFunctionCall","src":"1019:30:1"},"nodeType":"YulExpressionStatement","src":"1019:30:1"},{"nodeType":"YulAssignment","src":"1062:19:1","value":{"arguments":[{"name":"dst","nodeType":"YulIdentifier","src":"1073:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"1078:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1069:3:1"},"nodeType":"YulFunctionCall","src":"1069:12:1"},"variableNames":[{"name":"dst","nodeType":"YulIdentifier","src":"1062:3:1"}]},{"nodeType":"YulAssignment","src":"1094:19:1","value":{"arguments":[{"name":"src","nodeType":"YulIdentifier","src":"1105:3:1"},{"name":"_1","nodeType":"YulIdentifier","src":"1110:2:1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1101:3:1"},"nodeType":"YulFunctionCall","src":"1101:12:1"},"variableNames":[{"name":"src","nodeType":"YulIdentifier","src":"1094:3:1"}]}]},"condition":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"971:1:1"},{"name":"_4","nodeType":"YulIdentifier","src":"974:2:1"}],"functionName":{"name":"lt","nodeType":"YulIdentifier","src":"968:2:1"},"nodeType":"YulFunctionCall","src":"968:9:1"},"nodeType":"YulForLoop","post":{"nodeType":"YulBlock","src":"978:18:1","statements":[{"nodeType":"YulAssignment","src":"980:14:1","value":{"arguments":[{"name":"i","nodeType":"YulIdentifier","src":"989:1:1"},{"kind":"number","nodeType":"YulLiteral","src":"992:1:1","type":"","value":"1"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"985:3:1"},"nodeType":"YulFunctionCall","src":"985:9:1"},"variableNames":[{"name":"i","nodeType":"YulIdentifier","src":"980:1:1"}]}]},"pre":{"nodeType":"YulBlock","src":"964:3:1","statements":[]},"src":"960:163:1"},{"nodeType":"YulAssignment","src":"1132:16:1","value":{"name":"memPtr","nodeType":"YulIdentifier","src":"1142:6:1"},"variableNames":[{"name":"value0","nodeType":"YulIdentifier","src":"1132:6:1"}]}]},"name":"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"75:9:1","type":""},{"name":"dataEnd","nodeType":"YulTypedName","src":"86:7:1","type":""}],"returnVariables":[{"name":"value0","nodeType":"YulTypedName","src":"98:6:1","type":""}],"src":"14:1140:1"},{"body":{"nodeType":"YulBlock","src":"1260:76:1","statements":[{"nodeType":"YulAssignment","src":"1270:26:1","value":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1282:9:1"},{"kind":"number","nodeType":"YulLiteral","src":"1293:2:1","type":"","value":"32"}],"functionName":{"name":"add","nodeType":"YulIdentifier","src":"1278:3:1"},"nodeType":"YulFunctionCall","src":"1278:18:1"},"variableNames":[{"name":"tail","nodeType":"YulIdentifier","src":"1270:4:1"}]},{"expression":{"arguments":[{"name":"headStart","nodeType":"YulIdentifier","src":"1312:9:1"},{"name":"value0","nodeType":"YulIdentifier","src":"1323:6:1"}],"functionName":{"name":"mstore","nodeType":"YulIdentifier","src":"1305:6:1"},"nodeType":"YulFunctionCall","src":"1305:25:1"},"nodeType":"YulExpressionStatement","src":"1305:25:1"}]},"name":"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed","nodeType":"YulFunctionDefinition","parameters":[{"name":"headStart","nodeType":"YulTypedName","src":"1229:9:1","type":""},{"name":"value0","nodeType":"YulTypedName","src":"1240:6:1","type":""}],"returnVariables":[{"name":"tail","nodeType":"YulTypedName","src":"1251:4:1","type":""}],"src":"1159:177:1"}]},"contents":"{ { } function abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr(headStart, dataEnd) -> value0 { @@ -9,35 +9,31 @@ if gt(offset, _2) { revert(value0, value0) } let _3 := add(headStart, offset) if iszero(slt(add(_3, 0x1f), dataEnd)) { revert(value0, value0) } - let length := calldataload(_3) - if gt(length, _2) { invalid() } - let _4 := mul(length, _1) - let dst := allocateMemory(add(_4, _1)) - let dst_1 := dst - mstore(dst, length) - dst := add(dst, _1) + let _4 := calldataload(_3) + if gt(_4, _2) { invalid() } + let _5 := mul(_4, _1) + let memPtr := mload(64) + let newFreePtr := add(add(memPtr, _5), _1) + if or(gt(newFreePtr, _2), lt(newFreePtr, memPtr)) { invalid() } + mstore(64, newFreePtr) + let dst := memPtr + mstore(memPtr, _4) + dst := add(memPtr, _1) let src := add(_3, _1) - if gt(add(add(_3, _4), _1), dataEnd) { revert(value0, value0) } + if gt(add(add(_3, _5), _1), dataEnd) { revert(value0, value0) } let i := value0 - for { } lt(i, length) { i := add(i, 1) } + for { } lt(i, _4) { i := add(i, 1) } { mstore(dst, calldataload(src)) dst := add(dst, _1) src := add(src, _1) } - value0 := dst_1 + value0 := memPtr } function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart, value0) -> tail { tail := add(headStart, 32) mstore(headStart, value0) } - function allocateMemory(size) -> memPtr - { - memPtr := mload(64) - let newFreePtr := add(memPtr, size) - if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() } - mstore(64, newFreePtr) - } -}","id":1,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":"70:74:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:59;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;130:7:0;;83:59::o;14:1013:1:-;;129:2;172;160:9;151:7;147:23;143:32;140:2;;;193:6;185;178:22;140:2;238:9;225:23;267:18;308:2;300:6;297:14;294:2;;;329:6;321;314:22;294:2;372:6;361:9;357:22;347:32;;417:7;410:4;406:2;402:13;398:27;388:2;;444:6;436;429:22;388:2;489;476:16;515:2;507:6;504:14;501:2;;;521:9;501:2;563;555:6;551:15;541:25;;586:27;609:2;605;601:11;586:27;:::i;:::-;647:19;;;682:12;;;;714:11;;;744;;;740:20;;737:33;-1:-1:-1;734:2:1;;;788:6;780;773:22;734:2;815:6;806:15;;830:167;844:6;841:1;838:13;830:167;;;905:17;;893:30;;866:1;859:9;;;;;943:12;;;;975;;830:167;;;-1:-1:-1;1016:5:1;109:918;-1:-1:-1;;;;;;;;109:918:1:o;1032:177::-;1178:25;;;1166:2;1151:18;;1133:76::o;1214:242::-;1284:2;1278:9;1314:17;;;1361:18;1346:34;;1382:22;;;1343:62;1340:2;;;1408:9;1340:2;1435;1428:22;1258:198;;-1:-1:-1;1258:198:1:o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! +}","id":1,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"","opcodes":"","sourceMap":"70:74:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:59;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;130:7:0;;83:59::o;14:1140:1:-;;129:2;172;160:9;151:7;147:23;143:32;140:2;;;193:6;185;178:22;140:2;238:9;225:23;267:18;308:2;300:6;297:14;294:2;;;329:6;321;314:22;294:2;372:6;361:9;357:22;347:32;;417:7;410:4;406:2;402:13;398:27;388:2;;444:6;436;429:22;388:2;485;472:16;507:2;503;500:10;497:2;;;513:9;497:2;551;547;543:11;583:2;577:9;634:2;629;621:6;617:15;613:24;687:6;675:10;672:22;667:2;655:10;652:18;649:46;646:2;;;698:9;646:2;725;718:22;775:18;;;809:15;;;;-1:-1:-1;844:11:1;;;874;;;870:20;;867:33;-1:-1:-1;864:2:1;;;918:6;910;903:22;864:2;945:6;936:15;;960:163;974:2;971:1;968:9;960:163;;;1031:17;;1019:30;;992:1;985:9;;;;;1069:12;;;;1101;;960:163;;;-1:-1:-1;1142:6:1;109:1045;-1:-1:-1;;;;;;;;109:1045:1:o;1159:177::-;1305:25;;;1293:2;1278:18;;1260:76::o"}}}}},"errors":[{"component":"general","errorCode":"3420","formattedMessage":"a.sol: Warning: Source file does not specify required compiler version! ","message":"Source file does not specify required compiler version!","severity":"warning","sourceLocation":{"end":-1,"file":"a.sol","start":-1},"type":"Warning"}],"sources":{"a.sol":{"id":0}}} diff --git a/test/libsolidity/gasTests/abiv2.sol b/test/libsolidity/gasTests/abiv2.sol index 8d4569947..8995be072 100644 --- a/test/libsolidity/gasTests/abiv2.sol +++ b/test/libsolidity/gasTests/abiv2.sol @@ -14,9 +14,9 @@ contract C { } // ---- // creation: -// codeDepositCost: 1107400 -// executionCost: 1154 -// totalCost: 1108554 +// codeDepositCost: 1164600 +// executionCost: 1207 +// totalCost: 1165807 // external: // a(): 1130 // b(uint256): infinite diff --git a/test/libsolidity/gasTests/abiv2_optimised.sol b/test/libsolidity/gasTests/abiv2_optimised.sol index ada98be00..e7b8ba94f 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: 605000 -// executionCost: 638 -// totalCost: 605638 +// codeDepositCost: 578200 +// executionCost: 613 +// totalCost: 578813 // external: // a(): 1029 // b(uint256): 2084 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol index 6a1bbcffa..e950959a9 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol @@ -15,6 +15,7 @@ contract C { } } // ==== +// compileViaYul: also // EVMVersion: >homestead // ---- // f(uint256[][1]): 32, 32, 0 -> true diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_memory.sol b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_memory.sol new file mode 100644 index 000000000..6759b7e81 --- /dev/null +++ b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_memory.sol @@ -0,0 +1,38 @@ +pragma experimental ABIEncoderV2; + +contract c { + function test1(uint256[][] calldata c) external returns (uint256, uint256) { + uint256[][] memory a1 = c; + assert(a1[0][0] == c[0][0]); + assert(a1[0][1] == c[0][1]); + return (a1.length, a1[0][0] + a1[1][1]); + } + + function test2(uint256[][2] calldata c) external returns (uint256, uint256) { + uint256[][2] memory a2 = c; + assert(a2[0][0] == c[0][0]); + assert(a2[0][1] == c[0][1]); + return (a2[0].length, a2[0][0] + a2[1][1]); + } + + function test3(uint256[2][] calldata c) external returns (uint256, uint256) { + uint256[2][] memory a3 = c; + assert(a3[0][0] == c[0][0]); + assert(a3[0][1] == c[0][1]); + return (a3.length, a3[0][0] + a3[1][1]); + } + + function test4(uint256[2][2] calldata c) external returns (uint256) { + uint256[2][2] memory a4 = c; + assert(a4[0][0] == c[0][0]); + assert(a4[0][1] == c[0][1]); + return (a4[0][0] + a4[1][1]); + } +} +// ==== +// compileViaYul: true +// ---- +// test1(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 23, 42 -> 2, 65 +// test2(uint256[][2]): 0x20, 0x40, 0x40, 2, 23, 42 -> 2, 65 +// test3(uint256[2][]): 0x20, 2, 23, 42, 23, 42 -> 2, 65 +// test4(uint256[2][2]): 23, 42, 23, 42 -> 65 diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol index 279237836..aaeba2ad6 100644 --- a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol @@ -10,28 +10,28 @@ contract c { a1 = c; assert(a1[0][0] == c[0][0]); assert(a1[0][1] == c[0][1]); - return (a1.length, a1[1][0] + a1[1][1]); + return (a1.length, a1[0][0] + a1[1][1]); } function test2(uint256[][2] calldata c) external returns (uint256, uint256) { a2 = c; assert(a2[0][0] == c[0][0]); assert(a2[0][1] == c[0][1]); - return (a2[0].length, a2[1][0] + a2[1][1]); + return (a2[0].length, a2[0][0] + a2[1][1]); } function test3(uint256[2][] calldata c) external returns (uint256, uint256) { a3 = c; assert(a3[0][0] == c[0][0]); assert(a3[0][1] == c[0][1]); - return (a3.length, a3[1][0] + a3[1][1]); + return (a3.length, a3[0][0] + a3[1][1]); } function test4(uint256[2][2] calldata c) external returns (uint256) { a4 = c; assert(a4[0][0] == c[0][0]); assert(a4[0][1] == c[0][1]); - return (a4[1][0] + a4[1][1]); + return (a4[0][0] + a4[1][1]); } } // ==== @@ -39,5 +39,5 @@ contract c { // ---- // test1(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 23, 42 -> 2, 65 // test2(uint256[][2]): 0x20, 0x40, 0x40, 2, 23, 42 -> 2, 65 -// test3(uint256[2][]): 0x20, 2, 0x40, 0x40, 23, 42 -> 2, 65 +// test3(uint256[2][]): 0x20, 2, 23, 42, 23, 42 -> 2, 65 // test4(uint256[2][2]): 23, 42, 23, 42 -> 65 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_memory.sol b/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_memory.sol new file mode 100644 index 000000000..e7c39f3f3 --- /dev/null +++ b/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_memory.sol @@ -0,0 +1,22 @@ +pragma experimental ABIEncoderV2; + +contract C { + struct S { + uint128 a; + uint64 b; + uint128 c; + } + function f(S[3] calldata c) public returns (uint128, uint64, uint128) { + S[3] memory m = c; + return (m[2].a, m[1].b, m[0].c); + } + function g(S[] calldata c) public returns (uint128, uint64, uint128) { + S[] memory m = c; + return (m[2].a, m[1].b, m[0].c); + } +} +// ==== +// compileViaYul: also +// ---- +// f((uint128, uint64, uint128)[3]): 0, 0, 12, 0, 11, 0, 10, 0, 0 -> 10, 11, 12 +// g((uint128, uint64, uint128)[]): 0x20, 3, 0, 0, 12, 0, 11, 0, 10, 0, 0 -> 10, 11, 12 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_memory.sol b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_memory.sol new file mode 100644 index 000000000..e1f2c76e2 --- /dev/null +++ b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_memory.sol @@ -0,0 +1,23 @@ +pragma experimental ABIEncoderV2; + +contract C { + struct S { + uint256[] a; + } + + function f(S[] calldata c) external returns (uint256, uint256) { + S[] memory s = c; + assert(s.length == c.length); + for (uint i = 0; i < s.length; i++) { + assert(s[i].a.length == c[i].a.length); + for (uint j = 0; j < s[i].a.length; j++) { + assert(s[i].a[j] == c[i].a[j]); + } + } + return (s[1].a.length, s[1].a[0]); + } +} +// ==== +// compileViaYul: true +// ---- +// f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1 \ No newline at end of file diff --git a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol index dba6af8ef..4aeed91f6 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol @@ -9,6 +9,13 @@ contract C { function f(S[] calldata c) external returns (uint256, uint256) { s = c; + assert(s.length == c.length); + for (uint i = 0; i < s.length; i++) { + assert(s[i].a.length == c[i].a.length); + for (uint j = 0; j < s[i].a.length; j++) { + assert(s[i].a[j] == c[i].a[j]); + } + } return (s[1].a.length, s[1].a[0]); } } diff --git a/test/libsolidity/semanticTests/array/copying/calldata_array_of_struct_to_memory.sol b/test/libsolidity/semanticTests/array/copying/calldata_array_of_struct_to_memory.sol index f408746f5..21feb2790 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_array_of_struct_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_array_of_struct_to_memory.sol @@ -21,5 +21,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f((uint256,uint256)[]): 0x20, 0x2, 0x1, 0x2, 0x3, 0x4 -> 2, 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol b/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol new file mode 100644 index 000000000..0d7d6f1f8 --- /dev/null +++ b/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol @@ -0,0 +1,10 @@ +contract C { + function f(uint256[2] calldata c) public returns (uint256, uint256) { + uint256[2] memory m1 = c; + return (m1[0], m1[1]); + } +} +// ==== +// compileViaYul: also +// ---- +// f(uint256[2]): 43, 57 -> 43, 57 diff --git a/test/libsolidity/semanticTests/array/copying/calldata_dynamic_array_to_memory.sol b/test/libsolidity/semanticTests/array/copying/calldata_dynamic_array_to_memory.sol index 7b225a33b..81ae5e2d9 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_dynamic_array_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_dynamic_array_to_memory.sol @@ -11,5 +11,7 @@ contract C { } } +// ==== +// compileViaYul: also // ---- // f(uint256[][]): 0x20, 0x1, 0x20, 0x2, 0x17, 0x2a -> 0x1, 0x40, 0x2, 0x17, 0x2a diff --git a/test/libsolidity/semanticTests/inlineAssembly/calldata_array_assign.sol b/test/libsolidity/semanticTests/inlineAssembly/calldata_array_assign.sol index 631e61fe0..91eff04e0 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/calldata_array_assign.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/calldata_array_assign.sol @@ -4,5 +4,7 @@ contract C { r = x; } } +// ==== +// compileViaYul: also // ---- // f(uint256[2][]): 0x0, 1, 8, 7, 6, 5 -> 0x20, 2, 8, 7, 6, 5 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol new file mode 100644 index 000000000..5f6aaa07d --- /dev/null +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol @@ -0,0 +1,23 @@ +pragma experimental ABIEncoderV2; + +contract C { + struct S { + uint256 a; + uint256[2] b; + uint256 c; + } + + function f(S calldata c) + external + pure + returns (uint256, uint256, uint256, uint256) + { + S memory m = c; + return (m.a, m.b[0], m.b[1], m.c); + } +} + +// ==== +// compileViaYul: also +// ---- +// f((uint256,uint256[2],uint256)): 42, 1, 2, 23 -> 42, 1, 2, 23