Update tests

This commit is contained in:
chriseth 2020-09-24 15:45:45 +02:00
parent 1e3596ec71
commit b5c340cd66
15 changed files with 75 additions and 37 deletions

View File

@ -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)
}
}

View File

@ -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)
}

View File

@ -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
{

View File

@ -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)
}
}

File diff suppressed because one or more lines are too long

View File

@ -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) }
}

View File

@ -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 :=

File diff suppressed because one or more lines are too long

View File

@ -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))
}

View File

@ -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 :=

View File

@ -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 :=

View File

@ -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))
}

View File

@ -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 :=

View File

@ -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

View File

@ -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