Skip to content

Commit

Permalink
Merge pull request ethereum#13514 from ethereum/yul-interpreter-create2
Browse files Browse the repository at this point in the history
Fix create2 memory access in yul interpreter.
  • Loading branch information
ekpyron authored Sep 14, 2022
2 parents f05cbb9 + 69d9869 commit 1730e43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions test/libyul/yulInterpreterTests/create2.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
pop(create2(0, 0, 32, 32))
// This used to store 64
sstore(0, msize())
}
// ====
// EVMVersion: >=constantinople
// ----
// Trace:
// CREATE2(0, 0, 32, 32)
// Memory dump:
// Storage dump:
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000020
2 changes: 1 addition & 1 deletion test/tools/yulInterpreter/EVMInstructionInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ u256 EVMInstructionInterpreter::eval(
logTrace(_instruction, arg);
return (0xcccccc + arg[1]) & u256("0xffffffffffffffffffffffffffffffffffffffff");
case Instruction::CREATE2:
accessMemory(arg[2], arg[3]);
accessMemory(arg[1], arg[2]);
logTrace(_instruction, arg);
return (0xdddddd + arg[1]) & u256("0xffffffffffffffffffffffffffffffffffffffff");
case Instruction::CALL:
Expand Down

0 comments on commit 1730e43

Please sign in to comment.