Update tests

This commit is contained in:
Alex Beregszaszi 2021-05-26 17:14:02 +01:00
parent cc8d341e28
commit 47167a42a7
16 changed files with 137 additions and 57 deletions

View File

@ -35,13 +35,13 @@
},
"abi_decode_tuple_t_array$_t_uint256_$dyn_calldata_ptr":
{
"entryPoint": 178,
"entryPoint": 164,
"parameterSlots": 2,
"returnSlots": 2
},
"abi_decode_tuple_t_uint256":
{
"entryPoint": 295,
"entryPoint": 281,
"parameterSlots": 2,
"returnSlots": 1
},
@ -49,6 +49,12 @@
{
"parameterSlots": 2,
"returnSlots": 1
},
"panic_error_0x32":
{
"entryPoint": 306,
"parameterSlots": 0,
"returnSlots": 0
}
}
}

View File

@ -145,9 +145,11 @@ sub_0: assembly {
/* "optimizer_inliner_dynamic_reference/input.sol":310:365 function f() internal pure returns (uint) { return 6; } */
jump // out
tag_20:
mstore(0x00, shl(0xe0, 0x4e487b71))
mstore(0x04, 0x51)
revert(0x00, 0x24)
tag_25
tag_26
jump // in
tag_25:
jump // out
/* "#utility.yul":196:421 */
tag_22:
/* "#utility.yul":236:239 */
@ -162,7 +164,7 @@ sub_0: assembly {
gt
/* "#utility.yul":254:256 */
iszero
tag_28
tag_30
jumpi
/* "#utility.yul":312:322 */
0x4e487b71
@ -187,13 +189,37 @@ sub_0: assembly {
/* "#utility.yul":365:380 */
revert
/* "#utility.yul":254:256 */
tag_28:
tag_30:
pop
/* "#utility.yul":406:415 */
add
swap1
/* "#utility.yul":244:421 */
jump // out
/* "#utility.yul":426:553 */
tag_26:
/* "#utility.yul":487:497 */
0x4e487b71
/* "#utility.yul":482:485 */
0xe0
/* "#utility.yul":478:498 */
shl
/* "#utility.yul":475:476 */
0x00
/* "#utility.yul":468:499 */
mstore
/* "#utility.yul":518:522 */
0x51
/* "#utility.yul":515:516 */
0x04
/* "#utility.yul":508:523 */
mstore
/* "#utility.yul":542:546 */
0x24
/* "#utility.yul":539:540 */
0x00
/* "#utility.yul":532:547 */
revert
auxdata: <AUXDATA REMOVED>
}

View File

@ -150,9 +150,11 @@ sub_0: assembly {
/* "optimizer_inliner_dynamic_reference_constructor/input.sol":304:359 function f() internal pure returns (uint) { return 6; } */
jump // out
tag_17:
mstore(0x00, shl(0xe0, 0x4e487b71))
mstore(0x04, 0x51)
revert(0x00, 0x24)
tag_21
tag_22
jump // in
tag_21:
jump // out
/* "#utility.yul":196:421 */
tag_19:
/* "#utility.yul":236:239 */
@ -167,7 +169,7 @@ sub_0: assembly {
gt
/* "#utility.yul":254:256 */
iszero
tag_24
tag_26
jumpi
/* "#utility.yul":312:322 */
0x4e487b71
@ -192,13 +194,37 @@ sub_0: assembly {
/* "#utility.yul":365:380 */
revert
/* "#utility.yul":254:256 */
tag_24:
tag_26:
pop
/* "#utility.yul":406:415 */
add
swap1
/* "#utility.yul":244:421 */
jump // out
/* "#utility.yul":426:553 */
tag_22:
/* "#utility.yul":487:497 */
0x4e487b71
/* "#utility.yul":482:485 */
0xe0
/* "#utility.yul":478:498 */
shl
/* "#utility.yul":475:476 */
0x00
/* "#utility.yul":468:499 */
mstore
/* "#utility.yul":518:522 */
0x51
/* "#utility.yul":515:516 */
0x04
/* "#utility.yul":508:523 */
mstore
/* "#utility.yul":542:546 */
0x24
/* "#utility.yul":539:540 */
0x00
/* "#utility.yul":532:547 */
revert
auxdata: <AUXDATA REMOVED>
}

View File

@ -1 +1 @@
{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"functionDebugData":{}},"deployedBytecode":{"functionDebugData":{"@f_19":{"entryPoint":96,"id":19,"parameterSlots":1,"returnSlots":1},"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":247,"id":null,"parameterSlots":3,"returnSlots":1},"abi_decode_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":359,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_uint256":{"entryPoint":405,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":426,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_uint256_to_t_uint256_fromStack":{"entryPoint":499,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed":{"entryPoint":514,"id":null,"parameterSlots":2,"returnSlots":1},"allocate_memory":{"entryPoint":541,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_unbounded":{"entryPoint":568,"id":null,"parameterSlots":0,"returnSlots":1},"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":578,"id":null,"parameterSlots":1,"returnSlots":1},"checked_add_t_uint256":{"entryPoint":622,"id":null,"parameterSlots":2,"returnSlots":1},"cleanup_t_uint256":{"entryPoint":708,"id":null,"parameterSlots":1,"returnSlots":1},"finalize_allocation":{"entryPoint":718,"id":null,"parameterSlots":2,"returnSlots":0},"panic_error_0x11":{"entryPoint":767,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x41":{"entryPoint":814,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d":{"entryPoint":861,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef":{"entryPoint":866,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db":{"entryPoint":871,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b":{"entryPoint":876,"id":null,"parameterSlots":0,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":881,"id":null,"parameterSlots":1,"returnSlots":1},"validator_revert_t_uint256":{"entryPoint":898,"id":null,"parameterSlots":1,"returnSlots":0}}}}}}},"sources":{"a.sol":{"id":0}}}
{"contracts":{"a.sol":{"A":{"evm":{"bytecode":{"functionDebugData":{}},"deployedBytecode":{"functionDebugData":{"@f_19":{"entryPoint":96,"id":19,"parameterSlots":1,"returnSlots":1},"abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":171,"id":null,"parameterSlots":3,"returnSlots":1},"abi_decode_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":283,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_t_uint256":{"entryPoint":329,"id":null,"parameterSlots":2,"returnSlots":1},"abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":350,"id":null,"parameterSlots":2,"returnSlots":1},"abi_encode_t_uint256_to_t_uint256_fromStack":{"entryPoint":423,"id":null,"parameterSlots":2,"returnSlots":0},"abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed":{"entryPoint":438,"id":null,"parameterSlots":2,"returnSlots":1},"allocate_memory":{"entryPoint":465,"id":null,"parameterSlots":1,"returnSlots":1},"allocate_unbounded":{"entryPoint":492,"id":null,"parameterSlots":0,"returnSlots":1},"array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr":{"entryPoint":502,"id":null,"parameterSlots":1,"returnSlots":1},"checked_add_t_uint256":{"entryPoint":546,"id":null,"parameterSlots":2,"returnSlots":1},"cleanup_t_uint256":{"entryPoint":632,"id":null,"parameterSlots":1,"returnSlots":1},"finalize_allocation":{"entryPoint":642,"id":null,"parameterSlots":2,"returnSlots":0},"panic_error_0x11":{"entryPoint":691,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x32":{"entryPoint":738,"id":null,"parameterSlots":0,"returnSlots":0},"panic_error_0x41":{"entryPoint":785,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d":{"entryPoint":832,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef":{"entryPoint":837,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db":{"entryPoint":842,"id":null,"parameterSlots":0,"returnSlots":0},"revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b":{"entryPoint":847,"id":null,"parameterSlots":0,"returnSlots":0},"round_up_to_mul_of_32":{"entryPoint":852,"id":null,"parameterSlots":1,"returnSlots":1},"validator_revert_t_uint256":{"entryPoint":869,"id":null,"parameterSlots":1,"returnSlots":0}}}}}}},"sources":{"a.sol":{"id":0}}}

View File

@ -342,7 +342,10 @@ BOOST_AUTO_TEST_CASE(arithmetic)
bytes code = compileFirstExpression(sourceCode, {}, {{"test", "f", "y"}});
bytes panic =
bytes{uint8_t(Instruction::PUSH32)} +
bytes{
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::PUSH32)
} +
fromHex("4E487B7100000000000000000000000000000000000000000000000000000000") +
bytes{
uint8_t(Instruction::PUSH1), 0x0,
@ -352,7 +355,10 @@ BOOST_AUTO_TEST_CASE(arithmetic)
uint8_t(Instruction::MSTORE),
uint8_t(Instruction::PUSH1), 0x24,
uint8_t(Instruction::PUSH1), 0x0,
uint8_t(Instruction::REVERT)
uint8_t(Instruction::REVERT),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::JUMP),
uint8_t(Instruction::JUMPDEST)
};
bytes expectation;
@ -374,22 +380,30 @@ BOOST_AUTO_TEST_CASE(arithmetic)
uint8_t(Instruction::DUP2),
uint8_t(Instruction::ISZERO),
uint8_t(Instruction::ISZERO),
uint8_t(Instruction::PUSH1), 0x48,
uint8_t(Instruction::JUMPI)
} + panic + bytes{
uint8_t(Instruction::PUSH1), 0x20,
uint8_t(Instruction::JUMPI),
uint8_t(Instruction::PUSH1), 0x1f,
uint8_t(Instruction::PUSH1), 0x36,
uint8_t(Instruction::JUMP),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::MOD),
uint8_t(Instruction::DUP2),
uint8_t(Instruction::ISZERO),
uint8_t(Instruction::ISZERO),
uint8_t(Instruction::PUSH1), 0x7e,
uint8_t(Instruction::JUMPI)
} + panic + bytes{
uint8_t(Instruction::PUSH1), 0x2e,
uint8_t(Instruction::JUMPI),
uint8_t(Instruction::PUSH1), 0x2d,
uint8_t(Instruction::PUSH1), 0x36,
uint8_t(Instruction::JUMP),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::DIV),
uint8_t(Instruction::PUSH1), 0x1,
uint8_t(Instruction::MUL)
};
uint8_t(Instruction::MUL),
uint8_t(Instruction::PUSH1), 0x67,
uint8_t(Instruction::JUMP)
} + panic;
else
expectation = bytes{
uint8_t(Instruction::PUSH1), 0x1,
@ -409,21 +423,29 @@ BOOST_AUTO_TEST_CASE(arithmetic)
uint8_t(Instruction::DUP2),
uint8_t(Instruction::ISZERO),
uint8_t(Instruction::ISZERO),
uint8_t(Instruction::PUSH1), 0x4a,
uint8_t(Instruction::JUMPI)
} + panic + bytes{
uint8_t(Instruction::PUSH1), 0x22,
uint8_t(Instruction::JUMPI),
uint8_t(Instruction::PUSH1), 0x21,
uint8_t(Instruction::PUSH1), 0x36,
uint8_t(Instruction::JUMP),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::MOD),
uint8_t(Instruction::DUP2),
uint8_t(Instruction::ISZERO),
uint8_t(Instruction::ISZERO),
uint8_t(Instruction::PUSH1), 0x80,
uint8_t(Instruction::JUMPI)
} + panic + bytes{
uint8_t(Instruction::PUSH1), 0x30,
uint8_t(Instruction::JUMPI),
uint8_t(Instruction::PUSH1), 0x2f,
uint8_t(Instruction::PUSH1), 0x36,
uint8_t(Instruction::JUMP),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::JUMPDEST),
uint8_t(Instruction::DIV),
uint8_t(Instruction::MUL)
};
uint8_t(Instruction::MUL),
uint8_t(Instruction::PUSH1), 0x67,
uint8_t(Instruction::JUMP)
} + panic;
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());
}

View File

@ -24,9 +24,9 @@ contract Large {
}
// ----
// creation:
// codeDepositCost: 904400
// executionCost: 942
// totalCost: 905342
// codeDepositCost: 640200
// executionCost: 676
// totalCost: 640876
// external:
// a(): 2475
// b(uint256): infinite

View File

@ -27,9 +27,9 @@ contract Large {
// optimize-runs: 2
// ----
// creation:
// codeDepositCost: 256400
// executionCost: 300
// totalCost: 256700
// codeDepositCost: 232800
// executionCost: 275
// totalCost: 233075
// external:
// a(): 2283
// b(uint256): 4937

View File

@ -11,9 +11,9 @@ contract Medium {
}
// ----
// creation:
// codeDepositCost: 351400
// executionCost: 386
// totalCost: 351786
// codeDepositCost: 269600
// executionCost: 312
// totalCost: 269912
// external:
// a(): 2452
// b(uint256): infinite

View File

@ -14,9 +14,9 @@ contract Medium {
// optimize-runs: 2
// ----
// creation:
// codeDepositCost: 146800
// executionCost: 190
// totalCost: 146990
// codeDepositCost: 131600
// executionCost: 177
// totalCost: 131777
// external:
// a(): 2283
// b(uint256): 4695

View File

@ -6,9 +6,9 @@ contract Small {
}
// ----
// creation:
// codeDepositCost: 114600
// executionCost: 159
// totalCost: 114759
// codeDepositCost: 108800
// executionCost: 153
// totalCost: 108953
// external:
// fallback: 129
// a(): 2407

View File

@ -9,9 +9,9 @@ contract Small {
// optimize-runs: 2
// ----
// creation:
// codeDepositCost: 62000
// codeDepositCost: 60800
// executionCost: 111
// totalCost: 62111
// totalCost: 60911
// external:
// fallback: 118
// a(): 2261

View File

@ -22,5 +22,5 @@ contract B {
// ----
// f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004
// gas irOptimized: 133483
// gas legacy: 263810
// gas legacy: 235167
// gas legacyOptimized: 133299

View File

@ -46,5 +46,5 @@ contract C {
// ----
// test() -> 5, 6, 7
// gas irOptimized: 337455
// gas legacy: 499937
// gas legacyOptimized: 300513
// gas legacy: 463662
// gas legacyOptimized: 296513

View File

@ -27,5 +27,5 @@ contract Creator {
// ----
// f(uint256,address[]): 7, 0x40, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 -> 7, 8
// gas irOptimized: 486618
// gas legacy: 590826
// gas legacyOptimized: 448624
// gas legacy: 592626
// gas legacyOptimized: 450224

View File

@ -27,5 +27,5 @@ contract Creator {
// ----
// f(uint256,bytes): 7, 0x40, 78, "abcdefghijklmnopqrstuvwxyzabcdef", "ghijklmnopqrstuvwxyzabcdefghijkl", "mnopqrstuvwxyz" -> 7, "h"
// gas irOptimized: 336157
// gas legacy: 427373
// gas legacyOptimized: 296781
// gas legacy: 429173
// gas legacyOptimized: 298384

View File

@ -19,8 +19,8 @@ contract C {
// test_boundary_check(uint256,uint256): 10, 10 -> FAILURE, hex"4e487b71", 0x32
// test_boundary_check(uint256,uint256): 256, 256 -> FAILURE, hex"4e487b71", 0x32
// gas irOptimized: 151436
// gas legacy: 131815
// gas legacyOptimized: 112039
// gas legacy: 131830
// gas legacyOptimized: 112054
// test_boundary_check(uint256,uint256): 256, 255 -> 0
// gas irOptimized: 153717
// gas legacy: 134149