Merge pull request #9394 from ethereum/fix-9391

Yul interpreter: Return addresses of type u160 for create and create2…
This commit is contained in:
chriseth 2020-07-20 18:38:43 +02:00 committed by GitHub
commit 2c7359de1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 2 deletions

View 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:

View 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:

View File

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