mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Yul interpreter: Return addresses of type u160 for create and create2 calls
This commit is contained in:
parent
d808302c62
commit
deffb7ffc8
13
test/libyul/yulInterpreterTests/and_create.yul
Normal file
13
test/libyul/yulInterpreterTests/and_create.yul
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
let u160max := 0xffffffffffffffffffffffffffffffffffffffff
|
||||
let a := create(0, u160max, 0)
|
||||
let b := and(u160max, create(0, u160max, 0))
|
||||
mstore(0, eq(a, b))
|
||||
}
|
||||
// ----
|
||||
// Trace:
|
||||
// CREATE(0, 0xffffffffffffffffffffffffffffffffffffffff, 0)
|
||||
// CREATE(0, 0xffffffffffffffffffffffffffffffffffffffff, 0)
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
15
test/libyul/yulInterpreterTests/and_create2.yul
Normal file
15
test/libyul/yulInterpreterTests/and_create2.yul
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
let u160max := 0xffffffffffffffffffffffffffffffffffffffff
|
||||
let a := create2(0, u160max, 0, 0)
|
||||
let b := and(u160max, create2(0, u160max, 0, 0))
|
||||
mstore(0, eq(a, b))
|
||||
}
|
||||
// ====
|
||||
// EVMVersion: >=constantinople
|
||||
// ----
|
||||
// Trace:
|
||||
// CREATE2(0, 0xffffffffffffffffffffffffffffffffffffffff, 0, 0)
|
||||
// CREATE2(0, 0xffffffffffffffffffffffffffffffffffffffff, 0, 0)
|
||||
// Memory dump:
|
||||
// 0: 0000000000000000000000000000000000000000000000000000000000000001
|
||||
// Storage dump:
|
@ -303,11 +303,11 @@ u256 EVMInstructionInterpreter::eval(
|
||||
case Instruction::CREATE:
|
||||
accessMemory(arg[1], arg[2]);
|
||||
logTrace(_instruction, arg);
|
||||
return 0xcccccc + arg[1];
|
||||
return u160(0xcccccc + arg[1]);
|
||||
case Instruction::CREATE2:
|
||||
accessMemory(arg[2], arg[3]);
|
||||
logTrace(_instruction, arg);
|
||||
return 0xdddddd + arg[1];
|
||||
return u160(0xdddddd + arg[1]);
|
||||
case Instruction::CALL:
|
||||
case Instruction::CALLCODE:
|
||||
// TODO assign returndata
|
||||
|
Loading…
Reference in New Issue
Block a user