mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9394 from ethereum/fix-9391
Yul interpreter: Return addresses of type u160 for create and create2…
This commit is contained in:
commit
2c7359de1e
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:
|
@ -304,11 +304,11 @@ u256 EVMInstructionInterpreter::eval(
|
|||||||
case Instruction::CREATE:
|
case Instruction::CREATE:
|
||||||
accessMemory(arg[1], arg[2]);
|
accessMemory(arg[1], arg[2]);
|
||||||
logTrace(_instruction, arg);
|
logTrace(_instruction, arg);
|
||||||
return 0xcccccc + arg[1];
|
return u160(0xcccccc + arg[1]);
|
||||||
case Instruction::CREATE2:
|
case Instruction::CREATE2:
|
||||||
accessMemory(arg[2], arg[3]);
|
accessMemory(arg[2], arg[3]);
|
||||||
logTrace(_instruction, arg);
|
logTrace(_instruction, arg);
|
||||||
return 0xdddddd + arg[1];
|
return u160(0xdddddd + arg[1]);
|
||||||
case Instruction::CALL:
|
case Instruction::CALL:
|
||||||
case Instruction::CALLCODE:
|
case Instruction::CALLCODE:
|
||||||
// TODO assign returndata
|
// TODO assign returndata
|
||||||
|
Loading…
Reference in New Issue
Block a user