Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
evmc_message::salt renamed to create2_salt
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Jul 25, 2018
1 parent 02d25b6 commit 16a573e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion evmc
Submodule evmc updated 1 files
+2 −2 include/evmc/evmc.h
4 changes: 2 additions & 2 deletions libaleth-interpreter/VMCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ void VM::caseCreate()

msg.input_data = &m_mem[off];
msg.input_size = size;
msg.salt = toEvmC(salt);
msg.create2_salt = toEvmC(salt);
msg.sender = m_message->destination;
msg.depth = m_message->depth + 1;
msg.kind = m_OP == Instruction::CREATE ? EVMC_CREATE : EVMC_CREATE2; // FIXME: In EVM-C move the kind to the top.
msg.kind = m_OP == Instruction::CREATE ? EVMC_CREATE : EVMC_CREATE2; // FIXME: In EVMC move the kind to the top.
msg.value = toEvmC(endowment);

evmc_result result;
Expand Down
2 changes: 1 addition & 1 deletion libevm/ExtVMFace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void create(evmc_result* o_result, ExtVMFace& _env, evmc_message const* _msg) no
u256 gas = _msg->gas;
u256 value = fromEvmC(_msg->value);
bytesConstRef init = {_msg->input_data, _msg->input_size};
u256 salt = fromEvmC(_msg->salt);
u256 salt = fromEvmC(_msg->create2_salt);
Instruction opcode = _msg->kind == EVMC_CREATE ? Instruction::CREATE : Instruction::CREATE2;

// ExtVM::create takes the sender address from .myAddress.
Expand Down
1 change: 1 addition & 0 deletions libevm/ExtVMFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ class ExtVMFace: public evmc_context
bytesConstRef data; ///< Current input data.
bytes code; ///< Current code that is executing.
h256 codeHash; ///< SHA3 hash of the executing code
u256 salt; ///< Values used in new address construction by CREATE2
SubState sub; ///< Sub-band VM state (suicides, refund counter, logs).
unsigned depth = 0; ///< Depth of the present call.
bool isCreate = false; ///< Is this a CREATE call?
Expand Down
10 changes: 10 additions & 0 deletions test/unittests/libevm/VMTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,15 @@ BOOST_AUTO_TEST_CASE(AlethInterpreterCreate2isForbiddenInStaticCall)
testCreate2isForbiddenInStaticCall();
}

BOOST_AUTO_TEST_CASE(AlethInterpreterCreate2DirectExec)
{
ExtVM extVm(state, envInfo, *se, address, address, address, value, gasPrice, ref(inputData),
ref(code), sha3(code), depth, isCreate, staticCall);

vm->exec(gas, extVm, OnOpFunc{});

BOOST_REQUIRE(state.addressHasCode(expectedAddress));
}

BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 16a573e

Please sign in to comment.