mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9886 from ethereum/develop
Merge develop into breaking.
This commit is contained in:
29 files changed
+218
-133
No files matched your search
@@ -118,10 +118,10 @@ string YulUtilFunctions::requireOrAssertFunction(bool _assert, Type const* _mess
|
||||
if (!_messageType)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(condition) {
|
||||
if iszero(condition) { <invalidOrRevert> }
|
||||
if iszero(condition) { <error> }
|
||||
}
|
||||
)")
|
||||
("invalidOrRevert", _assert ? "invalid()" : "revert(0, 0)")
|
||||
("error", _assert ? panicFunction() + "()" : "revert(0, 0)")
|
||||
("functionName", functionName)
|
||||
.render();
|
||||
|
||||
@@ -457,7 +457,7 @@ string YulUtilFunctions::overflowCheckedIntAddFunction(IntegerType const& _type)
|
||||
string functionName = "checked_add_" + _type.identifier();
|
||||
// TODO: Consider to add a special case for unsigned 256-bit integers
|
||||
// and use the following instead:
|
||||
// sum := add(x, y) if lt(sum, x) { revert(0, 0) }
|
||||
// sum := add(x, y) if lt(sum, x) { <panic>() }
|
||||
return m_functionCollector.createFunction(functionName, [&]() {
|
||||
return
|
||||
Whiskers(R"(
|
||||
@@ -466,12 +466,12 @@ string YulUtilFunctions::overflowCheckedIntAddFunction(IntegerType const& _type)
|
||||
y := <cleanupFunction>(y)
|
||||
<?signed>
|
||||
// overflow, if x >= 0 and y > (maxValue - x)
|
||||
if and(iszero(slt(x, 0)), sgt(y, sub(<maxValue>, x))) { revert(0, 0) }
|
||||
if and(iszero(slt(x, 0)), sgt(y, sub(<maxValue>, x))) { <panic>() }
|
||||
// underflow, if x < 0 and y < (minValue - x)
|
||||
if and(slt(x, 0), slt(y, sub(<minValue>, x))) { revert(0, 0) }
|
||||
if and(slt(x, 0), slt(y, sub(<minValue>, x))) { <panic>() }
|
||||
<!signed>
|
||||
// overflow, if x > (maxValue - y)
|
||||
if gt(x, sub(<maxValue>, y)) { revert(0, 0) }
|
||||
if gt(x, sub(<maxValue>, y)) { <panic>() }
|
||||
</signed>
|
||||
sum := add(x, y)
|
||||
}
|
||||
@@ -481,6 +481,7 @@ string YulUtilFunctions::overflowCheckedIntAddFunction(IntegerType const& _type)
|
||||
("maxValue", toCompactHexWithPrefix(u256(_type.maxValue())))
|
||||
("minValue", toCompactHexWithPrefix(u256(_type.minValue())))
|
||||
("cleanupFunction", cleanupFunction(_type))
|
||||
("panic", panicFunction())
|
||||
.render();
|
||||
});
|
||||
}
|
||||
@@ -497,16 +498,16 @@ string YulUtilFunctions::overflowCheckedIntMulFunction(IntegerType const& _type)
|
||||
y := <cleanupFunction>(y)
|
||||
<?signed>
|
||||
// overflow, if x > 0, y > 0 and x > (maxValue / y)
|
||||
if and(and(sgt(x, 0), sgt(y, 0)), gt(x, div(<maxValue>, y))) { revert(0, 0) }
|
||||
if and(and(sgt(x, 0), sgt(y, 0)), gt(x, div(<maxValue>, y))) { <panic>() }
|
||||
// underflow, if x > 0, y < 0 and y < (minValue / x)
|
||||
if and(and(sgt(x, 0), slt(y, 0)), slt(y, sdiv(<minValue>, x))) { revert(0, 0) }
|
||||
if and(and(sgt(x, 0), slt(y, 0)), slt(y, sdiv(<minValue>, x))) { <panic>() }
|
||||
// underflow, if x < 0, y > 0 and x < (minValue / y)
|
||||
if and(and(slt(x, 0), sgt(y, 0)), slt(x, sdiv(<minValue>, y))) { revert(0, 0) }
|
||||
if and(and(slt(x, 0), sgt(y, 0)), slt(x, sdiv(<minValue>, y))) { <panic>() }
|
||||
// overflow, if x < 0, y < 0 and x < (maxValue / y)
|
||||
if and(and(slt(x, 0), slt(y, 0)), slt(x, sdiv(<maxValue>, y))) { revert(0, 0) }
|
||||
if and(and(slt(x, 0), slt(y, 0)), slt(x, sdiv(<maxValue>, y))) { <panic>() }
|
||||
<!signed>
|
||||
// overflow, if x != 0 and y > (maxValue / x)
|
||||
if and(iszero(iszero(x)), gt(y, div(<maxValue>, x))) { revert(0, 0) }
|
||||
if and(iszero(iszero(x)), gt(y, div(<maxValue>, x))) { <panic>() }
|
||||
</signed>
|
||||
product := mul(x, y)
|
||||
}
|
||||
@@ -516,6 +517,7 @@ string YulUtilFunctions::overflowCheckedIntMulFunction(IntegerType const& _type)
|
||||
("maxValue", toCompactHexWithPrefix(u256(_type.maxValue())))
|
||||
("minValue", toCompactHexWithPrefix(u256(_type.minValue())))
|
||||
("cleanupFunction", cleanupFunction(_type))
|
||||
("panic", panicFunction())
|
||||
.render();
|
||||
});
|
||||
}
|
||||
@@ -529,13 +531,13 @@ string YulUtilFunctions::overflowCheckedIntDivFunction(IntegerType const& _type)
|
||||
function <functionName>(x, y) -> r {
|
||||
x := <cleanupFunction>(x)
|
||||
y := <cleanupFunction>(y)
|
||||
if iszero(y) { revert(0, 0) }
|
||||
if iszero(y) { <panic>() }
|
||||
<?signed>
|
||||
// overflow for minVal / -1
|
||||
if and(
|
||||
eq(x, <minVal>),
|
||||
eq(y, sub(0, 1))
|
||||
) { revert(0, 0) }
|
||||
) { <panic>() }
|
||||
</signed>
|
||||
r := <?signed>s</signed>div(x, y)
|
||||
}
|
||||
@@ -544,6 +546,7 @@ string YulUtilFunctions::overflowCheckedIntDivFunction(IntegerType const& _type)
|
||||
("signed", _type.isSigned())
|
||||
("minVal", toCompactHexWithPrefix(u256(_type.minValue())))
|
||||
("cleanupFunction", cleanupFunction(_type))
|
||||
("panic", panicFunction())
|
||||
.render();
|
||||
});
|
||||
}
|
||||
@@ -557,13 +560,14 @@ string YulUtilFunctions::checkedIntModFunction(IntegerType const& _type)
|
||||
function <functionName>(x, y) -> r {
|
||||
x := <cleanupFunction>(x)
|
||||
y := <cleanupFunction>(y)
|
||||
if iszero(y) { revert(0, 0) }
|
||||
if iszero(y) { <panic>() }
|
||||
r := <?signed>s</signed>mod(x, y)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("signed", _type.isSigned())
|
||||
("cleanupFunction", cleanupFunction(_type))
|
||||
("panic", panicFunction())
|
||||
.render();
|
||||
});
|
||||
}
|
||||
@@ -579,11 +583,11 @@ string YulUtilFunctions::overflowCheckedIntSubFunction(IntegerType const& _type)
|
||||
y := <cleanupFunction>(y)
|
||||
<?signed>
|
||||
// underflow, if y >= 0 and x < (minValue + y)
|
||||
if and(iszero(slt(y, 0)), slt(x, add(<minValue>, y))) { revert(0, 0) }
|
||||
if and(iszero(slt(y, 0)), slt(x, add(<minValue>, y))) { <panic>() }
|
||||
// overflow, if y < 0 and x > (maxValue + y)
|
||||
if and(slt(y, 0), sgt(x, add(<maxValue>, y))) { revert(0, 0) }
|
||||
if and(slt(y, 0), sgt(x, add(<maxValue>, y))) { <panic>() }
|
||||
<!signed>
|
||||
if lt(x, y) { revert(0, 0) }
|
||||
if lt(x, y) { <panic>() }
|
||||
</signed>
|
||||
diff := sub(x, y)
|
||||
}
|
||||
@@ -593,6 +597,7 @@ string YulUtilFunctions::overflowCheckedIntSubFunction(IntegerType const& _type)
|
||||
("maxValue", toCompactHexWithPrefix(u256(_type.maxValue())))
|
||||
("minValue", toCompactHexWithPrefix(u256(_type.minValue())))
|
||||
("cleanupFunction", cleanupFunction(_type))
|
||||
("panic", panicFunction())
|
||||
.render();
|
||||
});
|
||||
}
|
||||
@@ -660,9 +665,9 @@ string YulUtilFunctions::overflowCheckedUnsignedExpFunction()
|
||||
case 1 { power := 1 leave }
|
||||
case 2
|
||||
{
|
||||
if gt(exponent, 255) { revert(0, 0) }
|
||||
if gt(exponent, 255) { <panic>() }
|
||||
power := exp(2, exponent)
|
||||
if gt(power, max) { revert(0, 0) }
|
||||
if gt(power, max) { <panic>() }
|
||||
leave
|
||||
}
|
||||
if or(
|
||||
@@ -671,17 +676,18 @@ string YulUtilFunctions::overflowCheckedUnsignedExpFunction()
|
||||
)
|
||||
{
|
||||
power := exp(base, exponent)
|
||||
if gt(power, max) { revert(0, 0) }
|
||||
if gt(power, max) { <panic>() }
|
||||
leave
|
||||
}
|
||||
|
||||
power, base := <expLoop>(1, base, exponent, max)
|
||||
|
||||
if gt(power, div(max, base)) { revert(0, 0) }
|
||||
if gt(power, div(max, base)) { <panic>() }
|
||||
power := mul(power, base)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("expLoop", overflowCheckedExpLoopFunction())
|
||||
("shr_1", shiftRightFunction(1))
|
||||
.render();
|
||||
@@ -712,8 +718,8 @@ string YulUtilFunctions::overflowCheckedSignedExpFunction()
|
||||
|
||||
// overflow check for base * base
|
||||
switch sgt(base, 0)
|
||||
case 1 { if gt(base, div(max, base)) { revert(0, 0) } }
|
||||
case 0 { if slt(base, sdiv(max, base)) { revert(0, 0) } }
|
||||
case 1 { if gt(base, div(max, base)) { <panic>() } }
|
||||
case 0 { if slt(base, sdiv(max, base)) { <panic>() } }
|
||||
if and(exponent, 1)
|
||||
{
|
||||
power := base
|
||||
@@ -725,12 +731,13 @@ string YulUtilFunctions::overflowCheckedSignedExpFunction()
|
||||
|
||||
power, base := <expLoop>(power, base, exponent, max)
|
||||
|
||||
if and(sgt(power, 0), gt(power, div(max, base))) { revert(0, 0) }
|
||||
if and(slt(power, 0), slt(power, sdiv(min, base))) { revert(0, 0) }
|
||||
if and(sgt(power, 0), gt(power, div(max, base))) { <panic>() }
|
||||
if and(slt(power, 0), slt(power, sdiv(min, base))) { <panic>() }
|
||||
power := mul(power, base)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("expLoop", overflowCheckedExpLoopFunction())
|
||||
("shr_1", shiftRightFunction(1))
|
||||
.render();
|
||||
@@ -755,7 +762,7 @@ string YulUtilFunctions::overflowCheckedExpLoopFunction()
|
||||
for { } gt(exponent, 1) {}
|
||||
{
|
||||
// overflow check for base * base
|
||||
if gt(base, div(max, base)) { revert(0, 0) }
|
||||
if gt(base, div(max, base)) { <panic>() }
|
||||
if and(exponent, 1)
|
||||
{
|
||||
// No checks for power := mul(power, base) needed, because the check
|
||||
@@ -771,6 +778,7 @@ string YulUtilFunctions::overflowCheckedExpLoopFunction()
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("shr_1", shiftRightFunction(1))
|
||||
.render();
|
||||
});
|
||||
@@ -850,7 +858,7 @@ std::string YulUtilFunctions::resizeDynamicArrayFunction(ArrayType const& _type)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(array, newLen) {
|
||||
if gt(newLen, <maxArrayLength>) {
|
||||
invalid()
|
||||
<panic>()
|
||||
}
|
||||
|
||||
let oldLen := <fetchLength>(array)
|
||||
@@ -869,6 +877,7 @@ std::string YulUtilFunctions::resizeDynamicArrayFunction(ArrayType const& _type)
|
||||
}
|
||||
})")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("fetchLength", arrayLengthFunction(_type))
|
||||
("convertToSize", arrayConvertLengthToSize(_type))
|
||||
("dataPosition", arrayDataAreaFunction(_type))
|
||||
@@ -891,13 +900,14 @@ string YulUtilFunctions::storageArrayPopFunction(ArrayType const& _type)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(array) {
|
||||
let oldLen := <fetchLength>(array)
|
||||
if iszero(oldLen) { invalid() }
|
||||
if iszero(oldLen) { <panic>() }
|
||||
let newLen := sub(oldLen, 1)
|
||||
let slot, offset := <indexAccess>(array, newLen)
|
||||
<setToZero>(slot, offset)
|
||||
sstore(array, newLen)
|
||||
})")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("fetchLength", arrayLengthFunction(_type))
|
||||
("indexAccess", storageArrayIndexAccessFunction(_type))
|
||||
("setToZero", storageSetToZeroFunction(*_type.baseType()))
|
||||
@@ -917,7 +927,7 @@ string YulUtilFunctions::storageByteArrayPopFunction(ArrayType const& _type)
|
||||
function <functionName>(array) {
|
||||
let data := sload(array)
|
||||
let oldLen := <extractByteArrayLength>(data)
|
||||
if iszero(oldLen) { invalid() }
|
||||
if iszero(oldLen) { <panic>() }
|
||||
|
||||
switch eq(oldLen, 32)
|
||||
case 1 {
|
||||
@@ -946,6 +956,7 @@ string YulUtilFunctions::storageByteArrayPopFunction(ArrayType const& _type)
|
||||
sstore(array, data)
|
||||
})")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("extractByteArrayLength", extractByteArrayLengthFunction())
|
||||
("dataAreaFunction", arrayDataAreaFunction(_type))
|
||||
("indexAccess", storageArrayIndexAccessFunction(_type))
|
||||
@@ -968,7 +979,7 @@ string YulUtilFunctions::storageArrayPushFunction(ArrayType const& _type)
|
||||
<?isByteArray>
|
||||
let data := sload(array)
|
||||
let oldLen := <extractByteArrayLength>(data)
|
||||
if iszero(lt(oldLen, <maxArrayLength>)) { invalid() }
|
||||
if iszero(lt(oldLen, <maxArrayLength>)) { <panic>() }
|
||||
|
||||
switch gt(oldLen, 31)
|
||||
case 0 {
|
||||
@@ -999,13 +1010,14 @@ string YulUtilFunctions::storageArrayPushFunction(ArrayType const& _type)
|
||||
}
|
||||
<!isByteArray>
|
||||
let oldLen := sload(array)
|
||||
if iszero(lt(oldLen, <maxArrayLength>)) { invalid() }
|
||||
if iszero(lt(oldLen, <maxArrayLength>)) { <panic>() }
|
||||
sstore(array, add(oldLen, 1))
|
||||
let slot, offset := <indexAccess>(array, oldLen)
|
||||
<storeValue>(slot, offset, value)
|
||||
</isByteArray>
|
||||
})")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("extractByteArrayLength", _type.isByteArray() ? extractByteArrayLengthFunction() : "")
|
||||
("dataAreaFunction", arrayDataAreaFunction(_type))
|
||||
("isByteArray", _type.isByteArray())
|
||||
@@ -1032,12 +1044,13 @@ string YulUtilFunctions::storageArrayPushZeroFunction(ArrayType const& _type)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(array) -> slot, offset {
|
||||
let oldLen := <fetchLength>(array)
|
||||
if iszero(lt(oldLen, <maxArrayLength>)) { invalid() }
|
||||
if iszero(lt(oldLen, <maxArrayLength>)) { <panic>() }
|
||||
sstore(array, add(oldLen, 1))
|
||||
slot, offset := <indexAccess>(array, oldLen)
|
||||
<storeValue>(slot, offset, <zeroValueFunction>())
|
||||
})")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("fetchLength", arrayLengthFunction(_type))
|
||||
("indexAccess", storageArrayIndexAccessFunction(_type))
|
||||
("storeValue", updateStorageValueFunction(*_type.baseType(), *_type.baseType()))
|
||||
@@ -1172,7 +1185,7 @@ string YulUtilFunctions::arrayAllocationSizeFunction(ArrayType const& _type)
|
||||
Whiskers w(R"(
|
||||
function <functionName>(length) -> size {
|
||||
// Make sure we can allocate memory without overflow
|
||||
if gt(length, 0xffffffffffffffff) { revert(0, 0) }
|
||||
if gt(length, 0xffffffffffffffff) { <panic>() }
|
||||
<?byteArray>
|
||||
// round up
|
||||
size := and(add(length, 0x1f), not(0x1f))
|
||||
@@ -1186,6 +1199,7 @@ string YulUtilFunctions::arrayAllocationSizeFunction(ArrayType const& _type)
|
||||
}
|
||||
)");
|
||||
w("functionName", functionName);
|
||||
w("panic", panicFunction());
|
||||
w("byteArray", _type.isByteArray());
|
||||
w("dynamic", _type.isDynamicallySized());
|
||||
return w.render();
|
||||
@@ -1230,7 +1244,7 @@ string YulUtilFunctions::storageArrayIndexAccessFunction(ArrayType const& _type)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(array, index) -> slot, offset {
|
||||
let arrayLength := <arrayLen>(array)
|
||||
if iszero(lt(index, arrayLength)) { invalid() }
|
||||
if iszero(lt(index, arrayLength)) { <panic>() }
|
||||
|
||||
<?multipleItemsPerSlot>
|
||||
<?isBytesArray>
|
||||
@@ -1256,6 +1270,7 @@ string YulUtilFunctions::storageArrayIndexAccessFunction(ArrayType const& _type)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("arrayLen", arrayLengthFunction(_type))
|
||||
("dataAreaFunc", arrayDataAreaFunction(_type))
|
||||
("multipleItemsPerSlot", _type.baseType()->storageBytes() <= 16)
|
||||
@@ -1274,7 +1289,7 @@ string YulUtilFunctions::memoryArrayIndexAccessFunction(ArrayType const& _type)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(baseRef, index) -> addr {
|
||||
if iszero(lt(index, <arrayLen>(baseRef))) {
|
||||
invalid()
|
||||
<panic>()
|
||||
}
|
||||
|
||||
let offset := mul(index, <stride>)
|
||||
@@ -1285,6 +1300,7 @@ string YulUtilFunctions::memoryArrayIndexAccessFunction(ArrayType const& _type)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("arrayLen", arrayLengthFunction(_type))
|
||||
("stride", to_string(_type.memoryStride()))
|
||||
("dynamicallySized", _type.isDynamicallySized())
|
||||
@@ -1299,7 +1315,7 @@ string YulUtilFunctions::calldataArrayIndexAccessFunction(ArrayType const& _type
|
||||
return m_functionCollector.createFunction(functionName, [&]() {
|
||||
return Whiskers(R"(
|
||||
function <functionName>(base_ref<?dynamicallySized>, length</dynamicallySized>, index) -> addr<?dynamicallySizedBase>, len</dynamicallySizedBase> {
|
||||
if iszero(lt(index, <?dynamicallySized>length<!dynamicallySized><arrayLen></dynamicallySized>)) { invalid() }
|
||||
if iszero(lt(index, <?dynamicallySized>length<!dynamicallySized><arrayLen></dynamicallySized>)) { <panic>() }
|
||||
addr := add(base_ref, mul(index, <stride>))
|
||||
<?dynamicallyEncodedBase>
|
||||
addr<?dynamicallySizedBase>, len</dynamicallySizedBase> := <accessCalldataTail>(base_ref, addr)
|
||||
@@ -1307,6 +1323,7 @@ string YulUtilFunctions::calldataArrayIndexAccessFunction(ArrayType const& _type
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("stride", to_string(_type.calldataStride()))
|
||||
("dynamicallySized", _type.isDynamicallySized())
|
||||
("dynamicallyEncodedBase", _type.baseType()->isDynamicallyEncoded())
|
||||
@@ -1852,12 +1869,13 @@ string YulUtilFunctions::allocationFunction()
|
||||
memPtr := mload(<freeMemoryPointer>)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
// protect against overflow
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { <panic>() }
|
||||
mstore(<freeMemoryPointer>, newFreePtr)
|
||||
}
|
||||
)")
|
||||
("freeMemoryPointer", to_string(CompilerUtils::freeMemoryPointer))
|
||||
("functionName", functionName)
|
||||
("freeMemoryPointer", to_string(CompilerUtils::freeMemoryPointer))
|
||||
("panic", panicFunction())
|
||||
.render();
|
||||
});
|
||||
}
|
||||
@@ -2427,7 +2445,7 @@ string YulUtilFunctions::validatorFunction(Type const& _type, bool _revertOnFail
|
||||
if (_revertOnFailure)
|
||||
templ("failure", "revert(0, 0)");
|
||||
else
|
||||
templ("failure", "invalid()");
|
||||
templ("failure", panicFunction() + "()");
|
||||
|
||||
switch (_type.category())
|
||||
{
|
||||
@@ -2538,11 +2556,12 @@ std::string YulUtilFunctions::decrementCheckedFunction(Type const& _type)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(value) -> ret {
|
||||
value := <cleanupFunction>(value)
|
||||
if <lt>(value, <minval>) { revert(0,0) }
|
||||
if <lt>(value, <minval>) { <panic>() }
|
||||
ret := sub(value, 1)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("panic", panicFunction())
|
||||
("minval", toCompactHexWithPrefix(minintval))
|
||||
("lt", type.isSigned() ? "slt" : "lt")
|
||||
("cleanupFunction", cleanupFunction(_type))
|
||||
@@ -2568,13 +2587,14 @@ std::string YulUtilFunctions::incrementCheckedFunction(Type const& _type)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(value) -> ret {
|
||||
value := <cleanupFunction>(value)
|
||||
if <gt>(value, <maxval>) { revert(0,0) }
|
||||
if <gt>(value, <maxval>) { <panic>() }
|
||||
ret := add(value, 1)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("maxval", toCompactHexWithPrefix(maxintval))
|
||||
("gt", type.isSigned() ? "sgt" : "gt")
|
||||
("panic", panicFunction())
|
||||
("cleanupFunction", cleanupFunction(_type))
|
||||
.render();
|
||||
});
|
||||
@@ -2593,13 +2613,14 @@ string YulUtilFunctions::negateNumberCheckedFunction(Type const& _type)
|
||||
return Whiskers(R"(
|
||||
function <functionName>(value) -> ret {
|
||||
value := <cleanupFunction>(value)
|
||||
if slt(value, <minval>) { revert(0,0) }
|
||||
if slt(value, <minval>) { <panic>() }
|
||||
ret := sub(0, value)
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("minval", toCompactHexWithPrefix(minintval))
|
||||
("cleanupFunction", cleanupFunction(_type))
|
||||
("panic", panicFunction())
|
||||
.render();
|
||||
});
|
||||
}
|
||||
@@ -2935,6 +2956,20 @@ string YulUtilFunctions::revertReasonIfDebug(string const& _message)
|
||||
return revertReasonIfDebug(m_revertStrings, _message);
|
||||
}
|
||||
|
||||
string YulUtilFunctions::panicFunction()
|
||||
{
|
||||
string functionName = "panic_error";
|
||||
return m_functionCollector.createFunction(functionName, [&]() {
|
||||
return Whiskers(R"(
|
||||
function <functionName>() {
|
||||
invalid()
|
||||
}
|
||||
)")
|
||||
("functionName", functionName)
|
||||
.render();
|
||||
});
|
||||
}
|
||||
|
||||
string YulUtilFunctions::tryDecodeErrorMessageFunction()
|
||||
{
|
||||
string const functionName = "try_decode_error_message";
|
||||
|
||||
@@ -373,6 +373,10 @@ public:
|
||||
|
||||
std::string revertReasonIfDebug(std::string const& _message = "");
|
||||
|
||||
/// Executes the invalid opcode.
|
||||
/// Might use revert with special error code in the future.
|
||||
std::string panicFunction();
|
||||
|
||||
/// Returns the name of a function that decodes an error message.
|
||||
/// signature: () -> arrayPtr
|
||||
///
|
||||
|
||||
@@ -204,10 +204,11 @@ InternalDispatchMap IRGenerator::generateInternalDispatchFunctions()
|
||||
<?+out> <out> :=</+out> <name>(<in>)
|
||||
}
|
||||
</cases>
|
||||
default { invalid() }
|
||||
default { <panic>() }
|
||||
}
|
||||
)");
|
||||
templ("functionName", funName);
|
||||
templ("panic", m_utils.panicFunction());
|
||||
templ("in", suffixedVariableNameList("in_", 0, arity.in));
|
||||
templ("out", suffixedVariableNameList("out_", 0, arity.out));
|
||||
|
||||
|
||||
@@ -1247,8 +1247,10 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
|
||||
IRVariable modulus(m_context.newYulVariable(), *(parameterTypes[2]));
|
||||
define(modulus, *arguments[2]);
|
||||
Whiskers templ("if iszero(<modulus>) { invalid() }\n");
|
||||
m_code << templ("modulus", modulus.name()).render();
|
||||
Whiskers templ("if iszero(<modulus>) { <panic>() }\n");
|
||||
templ("modulus", modulus.name());
|
||||
templ("panic", m_utils.panicFunction());
|
||||
m_code << templ.render();
|
||||
|
||||
string args;
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
@@ -1325,7 +1327,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
Whiskers t(R"(
|
||||
let <memPos> := <allocateTemporaryMemory>()
|
||||
let <memEnd> := add(<memPos>, datasize("<object>"))
|
||||
if or(gt(<memEnd>, 0xffffffffffffffff), lt(<memEnd>, <memPos>)) { revert(0, 0) }
|
||||
if or(gt(<memEnd>, 0xffffffffffffffff), lt(<memEnd>, <memPos>)) { <panic>() }
|
||||
datacopy(<memPos>, dataoffset("<object>"), datasize("<object>"))
|
||||
<memEnd> := <abiEncode>(<memEnd><constructorParams>)
|
||||
<?saltSet>
|
||||
@@ -1340,6 +1342,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
t("allocateTemporaryMemory", m_utils.allocationTemporaryMemoryFunction());
|
||||
t("releaseTemporaryMemory", m_utils.releaseTemporaryMemoryFunction());
|
||||
t("object", IRNames::creationObject(*contract));
|
||||
t("panic", m_utils.panicFunction());
|
||||
t("abiEncode",
|
||||
m_context.abiFunctions().tupleEncoder(argumentTypes, functionType->parameterTypes(), false)
|
||||
);
|
||||
@@ -1987,11 +1990,12 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
|
||||
IRVariable index{m_context.newYulVariable(), *TypeProvider::uint256()};
|
||||
define(index, *_indexAccess.indexExpression());
|
||||
m_code << Whiskers(R"(
|
||||
if iszero(lt(<index>, <length>)) { invalid() }
|
||||
if iszero(lt(<index>, <length>)) { <panic>() }
|
||||
let <result> := <shl248>(byte(<index>, <array>))
|
||||
)")
|
||||
("index", index.name())
|
||||
("length", to_string(fixedBytesType.numBytes()))
|
||||
("panic", m_utils.panicFunction())
|
||||
("array", IRVariable(_indexAccess.baseExpression()).name())
|
||||
("shl248", m_utils.shiftLeftFunction(256 - 8))
|
||||
("result", IRVariable(_indexAccess).name())
|
||||
|
||||
@@ -748,6 +748,13 @@ void SMTEncoder::endVisit(Identifier const& _identifier)
|
||||
defineExpr(_identifier, m_context.state().thisAddress());
|
||||
m_uninterpretedTerms.insert(&_identifier);
|
||||
}
|
||||
// Ignore the builtin abi, it is handled in FunctionCall.
|
||||
// TODO: ignore MagicType in general (abi, block, msg, tx, type)
|
||||
else if (auto magicType = dynamic_cast<MagicType const*>(_identifier.annotation().type); magicType && magicType->kind() == MagicType::Kind::ABI)
|
||||
{
|
||||
solAssert(_identifier.name() == "abi", "");
|
||||
return;
|
||||
}
|
||||
else
|
||||
createExpr(_identifier);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ object "D_13" {
|
||||
if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) }
|
||||
let _3 := datasize("C_2")
|
||||
let _4 := add(_1, _3)
|
||||
if or(gt(_4, 0xffffffffffffffff), lt(_4, _1)) { revert(_2, _2) }
|
||||
if or(gt(_4, 0xffffffffffffffff), lt(_4, _1)) { invalid() }
|
||||
datacopy(_1, dataoffset("C_2"), _3)
|
||||
pop(create(_2, _1, sub(_4, _1)))
|
||||
return(allocateMemory(_2), _2)
|
||||
@@ -70,7 +70,7 @@ object "D_13" {
|
||||
{
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ object "D_11" {
|
||||
{
|
||||
if callvalue() { revert(_2, _2) }
|
||||
if slt(add(calldatasize(), not(3)), _2) { revert(_2, _2) }
|
||||
if gt(_1, 0xffffffffffffffff) { revert(_2, _2) }
|
||||
if gt(_1, 0xffffffffffffffff) { invalid() }
|
||||
mstore(64, _1)
|
||||
return(_1, _2)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ object "C_56" {
|
||||
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) { revert(_1, _1) }
|
||||
if gt(length, _3) { invalid() }
|
||||
let _4 := mul(length, _2)
|
||||
let dst := allocateMemory(add(_4, _2))
|
||||
let dst_1 := dst
|
||||
@@ -58,8 +58,12 @@ object "C_56" {
|
||||
function abi_decode_t_struct$_S(headStart, end) -> value
|
||||
{
|
||||
if slt(sub(end, headStart), 0x20) { revert(value, value) }
|
||||
value := allocateMemory(0x20)
|
||||
mstore(value, calldataload(headStart))
|
||||
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
|
||||
{
|
||||
@@ -83,17 +87,21 @@ object "C_56" {
|
||||
{
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
function convert_t_stringliteral_6490_to_t_string() -> converted
|
||||
{
|
||||
converted := allocateMemory(160)
|
||||
mstore(converted, 100)
|
||||
mstore(add(converted, 32), "longstringlongstringlongstringlo")
|
||||
mstore(add(converted, 64), "ngstringlongstringlongstringlong")
|
||||
mstore(add(converted, 96), "stringlongstringlongstringlongst")
|
||||
mstore(add(converted, 128), "ring")
|
||||
let memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, 160)
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() }
|
||||
mstore(64, newFreePtr)
|
||||
converted := memPtr
|
||||
mstore(memPtr, 100)
|
||||
mstore(add(memPtr, 32), "longstringlongstringlongstringlo")
|
||||
mstore(add(memPtr, 64), "ngstringlongstringlongstringlong")
|
||||
mstore(add(memPtr, 96), "stringlongstringlongstringlongst")
|
||||
mstore(add(memPtr, 128), "ring")
|
||||
}
|
||||
function extract_from_storage_value_dynamict_uint256(slot_value, offset) -> value
|
||||
{
|
||||
|
||||
@@ -33,13 +33,13 @@ object "Arraysum_33" {
|
||||
for { }
|
||||
lt(vloc_i, _2)
|
||||
{
|
||||
if gt(vloc_i, not(1)) { revert(_1, _1) }
|
||||
if gt(vloc_i, not(1)) { invalid() }
|
||||
vloc_i := add(vloc_i, 1)
|
||||
}
|
||||
{
|
||||
mstore(_1, _1)
|
||||
let _3 := sload(add(keccak256(_1, 0x20), vloc_i))
|
||||
if gt(vloc_sum, not(_3)) { revert(_1, _1) }
|
||||
if gt(vloc_sum, not(_3)) { invalid() }
|
||||
vloc_sum := add(vloc_sum, _3)
|
||||
}
|
||||
let memPos := allocateMemory(_1)
|
||||
@@ -57,7 +57,7 @@ object "Arraysum_33" {
|
||||
{
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:2499: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":"4Line truncated
|
||||
{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"},"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":"4Line truncated
|
||||
|
||||
// uint256[]
|
||||
function abi_decode_t_array$_t_uint256_$dyn_memory_ptr(offset, end) -> array {
|
||||
@@ -49,13 +49,13 @@
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
// protect against overflow
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
function array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr(length) -> size {
|
||||
// Make sure we can allocate memory without overflow
|
||||
if gt(length, 0xffffffffffffffff) { revert(0, 0) }
|
||||
if gt(length, 0xffffffffffffffff) { panic_error() }
|
||||
|
||||
size := mul(length, 0x20)
|
||||
|
||||
@@ -68,10 +68,14 @@
|
||||
cleaned := value
|
||||
}
|
||||
|
||||
function panic_error() {
|
||||
invalid()
|
||||
}
|
||||
|
||||
function validator_revert_t_uint256(value) {
|
||||
if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }
|
||||
}
|
||||
|
||||
}
|
||||
","id":1,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","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:277::-;;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;;;1933:1;1930;1923:12;1855:2;1957:10;1953:2;1946:22;1737:237;;;;:::o;1980:305::-;;2147:18;2139:6;2136:30;2133:2;;;2179:1;2176;2169:12;2133:2;2213:4;2205:6;2201:17;2193:25;;2273:4;2267;2263:15;2255:23;;2062:223;;;:::o;2291:77::-;;2357:5;2346:16;;2336:32;;;:::o;2374:122::-;2447:24;2465:5;2447:24;:::i;:::-;2440:5;2437:35;2427:2;;2486:1;2483;2476:12;2427:2;2417: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":"bytecode removed","opcodes":"opcodes removed","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!
|
||||
","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}}}
|
||||
@@ -44,11 +44,13 @@ object \"C_6\" {
|
||||
{
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
function fun_f_5()
|
||||
{ }
|
||||
function panic_error()
|
||||
{ invalid() }
|
||||
function shift_right_224_unsigned(value) -> newValue
|
||||
{ newValue := shr(224, value) }
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ object \"C_6\" {
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
// protect against overflow
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
@@ -69,6 +69,10 @@ object \"C_6\" {
|
||||
|
||||
}
|
||||
|
||||
function panic_error() {
|
||||
invalid()
|
||||
}
|
||||
|
||||
function shift_right_224_unsigned(value) -> newValue {
|
||||
newValue :=
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"},"deployedBytecode":{"generatedSources":[{"ast":{"nodeType":"YulBlock","src":"0:1474:1","statements":[{"nodeType":"YulBlock","src":"6:3:1","statements":[]},{"body":{"nodeType":"YulBlock","src":"109:931: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:26:1","statements":[{"expression":{"arguments":[{"name":"value0","nodeType":"YulIdentifier","src":"528:6:1"},{"name":"value0","nodeType":"YulIdentifier","src":"536:6:1"}],"functionName":{"name":"revert","nodeType":"YulIdentifier","src":"521:6:1"},"nodeType":"YulFunctionCall","src":"521:22:1"},"nodeType":"YulExpressionStatement","src":"521:22:1"}]},"coLine truncated
|
||||
{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"generatedSources":[],"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"sourceMap removed"},"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":"YulIdentifierLine truncated
|
||||
{ }
|
||||
function abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr(headStart, dataEnd) -> value0
|
||||
{
|
||||
@@ -10,7 +10,7 @@
|
||||
let _3 := add(headStart, offset)
|
||||
if iszero(slt(add(_3, 0x1f), dataEnd)) { revert(value0, value0) }
|
||||
let length := calldataload(_3)
|
||||
if gt(length, _2) { revert(value0, value0) }
|
||||
if gt(length, _2) { invalid() }
|
||||
let _4 := mul(length, _1)
|
||||
let dst := allocateMemory(add(_4, _1))
|
||||
let dst_1 := dst
|
||||
@@ -36,8 +36,8 @@
|
||||
{
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { invalid() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
}","id":1,"language":"Yul","name":"#utility.yul"}],"immutableReferences":{},"linkReferences":{},"object":"bytecode removed","opcodes":"opcodes removed","sourceMap":"70:74:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;83:59;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;130:7:0;;83:59::o;14:1026: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;;;536:6;528;521:22;501:2;576;568:6;564:15;554:25;;599:27;622:2;618;614:11;599:27;:::i;:::-;660:19;;;695:12;;;;727:11;;;757;;;753:20;;750:33;-1:-1:-1;747:2:1;;;801:6;793;786:22;747:2;828:6;819:15;;843:167;857:6;854:1;851:13;843:167;;;918:17;;906:30;;879:1;872:9;;;;;956:12;;;;988;;843:167;;;-1:-1:-1;1029:5:1;109:931;-1:-1:-1;;;;;;;;109:931:1:o;1045:177::-;1191:25;;;1179:2;1164:18;;1146:76::o;1227:245::-;1297:2;1291:9;1327:17;;;1374:18;1359:34;;1395:22;;;1356:62;1353:2;;;1431:1;1428;1421:12;1353:2;1451;1444:22;1271:201;;-1:-1:-1;1271:201: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":"bytecode removed","opcodes":"opcodes removed","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!
|
||||
","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}}}
|
||||
@@ -71,7 +71,7 @@ object \"C_10\" {
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
// protect against overflow
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
@@ -116,6 +116,10 @@ object \"C_10\" {
|
||||
|
||||
}
|
||||
|
||||
function panic_error() {
|
||||
invalid()
|
||||
}
|
||||
|
||||
function round_up_to_mul_of_32(value) -> result {
|
||||
result := and(add(value, 31), not(31))
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ object \"C_10\" {
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
// protect against overflow
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
@@ -88,6 +88,10 @@ object \"C_10\" {
|
||||
|
||||
}
|
||||
|
||||
function panic_error() {
|
||||
invalid()
|
||||
}
|
||||
|
||||
function shift_right_224_unsigned(value) -> newValue {
|
||||
newValue :=
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ object \"C_10\" {
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
// protect against overflow
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@ object \"C_10\" {
|
||||
|
||||
}
|
||||
|
||||
function panic_error() {
|
||||
invalid()
|
||||
}
|
||||
|
||||
function shift_left_224(value) -> newValue {
|
||||
newValue :=
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ object \"C_10\" {
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
// protect against overflow
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
@@ -120,6 +120,10 @@ object \"C_10\" {
|
||||
|
||||
}
|
||||
|
||||
function panic_error() {
|
||||
invalid()
|
||||
}
|
||||
|
||||
function round_up_to_mul_of_32(value) -> result {
|
||||
result := and(add(value, 31), not(31))
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ object \"C_10\" {
|
||||
memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, size)
|
||||
// protect against overflow
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { revert(0, 0) }
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@ object \"C_10\" {
|
||||
|
||||
}
|
||||
|
||||
function panic_error() {
|
||||
invalid()
|
||||
}
|
||||
|
||||
function shift_left_224(value) -> newValue {
|
||||
newValue :=
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// creation:
|
||||
// codeDepositCost: 1094400
|
||||
// executionCost: 1134
|
||||
// totalCost: 1095534
|
||||
// codeDepositCost: 1106800
|
||||
// executionCost: 1147
|
||||
// totalCost: 1107947
|
||||
// external:
|
||||
// a(): 1130
|
||||
// b(uint256): infinite
|
||||
|
||||
@@ -17,9 +17,9 @@ contract C {
|
||||
// optimize-yul: true
|
||||
// ----
|
||||
// creation:
|
||||
// codeDepositCost: 597000
|
||||
// executionCost: 632
|
||||
// totalCost: 597632
|
||||
// codeDepositCost: 604400
|
||||
// executionCost: 638
|
||||
// totalCost: 605038
|
||||
// external:
|
||||
// a(): 1029
|
||||
// b(uint256): 2084
|
||||
|
||||
@@ -34,7 +34,5 @@ library MerkleProof {
|
||||
}
|
||||
|
||||
// ----
|
||||
// Warning 8364: (988-991): Assertion checker does not yet implement type abi
|
||||
// Warning 4588: (988-1032): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 8364: (1175-1178): Assertion checker does not yet implement type abi
|
||||
// Warning 4588: (1175-1219): Assertion checker does not yet implement this type of function call.
|
||||
@@ -83,7 +83,6 @@ contract InternalCall {
|
||||
// Warning 2018: (1144-1206): Function state mutability can be restricted to pure
|
||||
// Warning 2018: (1212-1274): Function state mutability can be restricted to pure
|
||||
// Warning 2018: (1280-1342): Function state mutability can be restricted to pure
|
||||
// Warning 8364: (771-774): Assertion checker does not yet implement type abi
|
||||
// Warning 5084: (782-813): Type conversion is not yet fully supported and might yield false positives.
|
||||
// Warning 4588: (771-814): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 5729: (1403-1408): Assertion checker does not yet implement this type of function call.
|
||||
@@ -5,7 +5,5 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 8364: (162-165): Assertion checker does not yet implement type abi
|
||||
// Warning 4588: (162-176): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 8364: (178-181): Assertion checker does not yet implement type abi
|
||||
// Warning 4588: (178-203): Assertion checker does not yet implement this type of function call.
|
||||
@@ -2,14 +2,13 @@ pragma experimental SMTChecker;
|
||||
pragma experimental "ABIEncoderV2";
|
||||
|
||||
contract C {
|
||||
struct S { uint x; uint[] b; }
|
||||
function f() public pure returns (S memory, bytes memory, uint[][2] memory) {
|
||||
return abi.decode("abc", (S, bytes, uint[][2]));
|
||||
}
|
||||
struct S { uint x; uint[] b; }
|
||||
function f() public pure returns (S memory, bytes memory, uint[][2] memory) {
|
||||
return abi.decode("abc", (S, bytes, uint[][2]));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 8364: (206-209): Assertion checker does not yet implement type abi
|
||||
// Warning 8364: (225-226): Assertion checker does not yet implement type type(struct C.S storage pointer)
|
||||
// Warning 8364: (235-241): Assertion checker does not yet implement type type(uint256[] memory)
|
||||
// Warning 8364: (235-244): Assertion checker does not yet implement type type(uint256[] memory[2] memory)
|
||||
// Warning 4588: (206-246): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 8364: (221-222): Assertion checker does not yet implement type type(struct C.S storage pointer)
|
||||
// Warning 8364: (231-237): Assertion checker does not yet implement type type(uint256[] memory)
|
||||
// Warning 8364: (231-240): Assertion checker does not yet implement type type(uint256[] memory[2] memory)
|
||||
// Warning 4588: (202-242): Assertion checker does not yet implement this type of function call.
|
||||
@@ -2,18 +2,16 @@ pragma experimental SMTChecker;
|
||||
pragma experimental "ABIEncoderV2";
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
(uint x1, bool b1) = abi.decode("abc", (uint, bool));
|
||||
(uint x2, bool b2) = abi.decode("abc", (uint, bool));
|
||||
// False positive until abi.* are implemented as uninterpreted functions.
|
||||
assert(x1 == x2);
|
||||
}
|
||||
function f() public pure {
|
||||
(uint x1, bool b1) = abi.decode("abc", (uint, bool));
|
||||
(uint x2, bool b2) = abi.decode("abc", (uint, bool));
|
||||
// False positive until abi.* are implemented as uninterpreted functions.
|
||||
assert(x1 == x2);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2072: (125-132): Unused local variable.
|
||||
// Warning 2072: (183-190): Unused local variable.
|
||||
// Warning 6328: (303-319): Assertion violation happens here.
|
||||
// Warning 8364: (136-139): Assertion checker does not yet implement type abi
|
||||
// Warning 4588: (136-167): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 8364: (194-197): Assertion checker does not yet implement type abi
|
||||
// Warning 4588: (194-225): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 2072: (122-129): Unused local variable.
|
||||
// Warning 2072: (178-185): Unused local variable.
|
||||
// Warning 6328: (300-316): Assertion violation happens here.
|
||||
// Warning 4588: (133-164): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 4588: (189-220): Assertion checker does not yet implement this type of function call.
|
||||
@@ -1,24 +1,21 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f() public pure {
|
||||
(uint a1, bytes32 b1, C c1) = abi.decode("abc", (uint, bytes32, C));
|
||||
(uint a2, bytes32 b2, C c2) = abi.decode("abc", (uint, bytes32, C));
|
||||
// False positive until abi.* are implemented as uninterpreted functions.
|
||||
assert(a1 == a2);
|
||||
assert(a1 != a2);
|
||||
}
|
||||
|
||||
function f() public pure {
|
||||
(uint a1, bytes32 b1, C c1) = abi.decode("abc", (uint, bytes32, C));
|
||||
(uint a2, bytes32 b2, C c2) = abi.decode("abc", (uint, bytes32, C));
|
||||
// False positive until abi.* are implemented as uninterpreted functions.
|
||||
assert(a1 == a2);
|
||||
assert(a1 != a2);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2072: (88-98): Unused local variable.
|
||||
// Warning 2072: (100-104): Unused local variable.
|
||||
// Warning 2072: (161-171): Unused local variable.
|
||||
// Warning 2072: (173-177): Unused local variable.
|
||||
// Warning 6328: (296-312): Assertion violation happens here.
|
||||
// Warning 6328: (315-331): Assertion violation happens here.
|
||||
// Warning 8364: (108-111): Assertion checker does not yet implement type abi
|
||||
// Warning 8364: (142-143): Assertion checker does not yet implement type type(contract C)
|
||||
// Warning 4588: (108-145): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 8364: (181-184): Assertion checker does not yet implement type abi
|
||||
// Warning 8364: (215-216): Assertion checker does not yet implement type type(contract C)
|
||||
// Warning 4588: (181-218): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 2072: (85-95): Unused local variable.
|
||||
// Warning 2072: (97-101): Unused local variable.
|
||||
// Warning 2072: (156-166): Unused local variable.
|
||||
// Warning 2072: (168-172): Unused local variable.
|
||||
// Warning 6328: (293-309): Assertion violation happens here.
|
||||
// Warning 6328: (313-329): Assertion violation happens here.
|
||||
// Warning 8364: (139-140): Assertion checker does not yet implement type type(contract C)
|
||||
// Warning 4588: (105-142): Assertion checker does not yet implement this type of function call.
|
||||
// Warning 8364: (210-211): Assertion checker does not yet implement type type(contract C)
|
||||
// Warning 4588: (176-213): Assertion checker does not yet implement this type of function call.
|
||||
@@ -0,0 +1,9 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract C {
|
||||
function f(bytes calldata data) external pure returns (bytes memory) {
|
||||
return abi.encode(bytes(data[:32]));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2923: (143-152): Assertion checker does not yet implement this expression.
|
||||
// Warning 4588: (126-154): Assertion checker does not yet implement this type of function call.
|
||||
@@ -7,4 +7,3 @@ contract K {
|
||||
}
|
||||
// ----
|
||||
// Warning 6133: (76-91): Statement has no effect.
|
||||
// Warning 8364: (77-80): Assertion checker does not yet implement type abi
|
||||
@@ -7,4 +7,3 @@ contract K {
|
||||
}
|
||||
// ----
|
||||
// Warning 6133: (76-92): Statement has no effect.
|
||||
// Warning 8364: (77-80): Assertion checker does not yet implement type abi
|
||||
Reference in new issue
Block a user