Skip to content

Commit

Permalink
support create2
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyShi22 committed Oct 31, 2023
1 parent e0d2568 commit 1b7a0c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bcos-crypto/bcos-crypto/ChecksumAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ inline std::string newEVMAddress(
inline std::string newEVMAddress(bcos::crypto::Hash::Ptr _hashImpl, const std::string_view& _sender,
bytesConstRef _init, u256 const& _salt)
{
auto hash =
_hashImpl->hash(bytes{0xff} + _sender + toBigEndian(_salt) + _hashImpl->hash(_init));
auto hash = _hashImpl->hash(
bytes{0xff} + fromHex(_sender) + toBigEndian(_salt) + _hashImpl->hash(_init));

std::string hexAddress;
hexAddress.reserve(40);
boost::algorithm::hex(hash.data(), hash.data() + 20, std::back_inserter(hexAddress));
boost::algorithm::hex(hash.data() + 12, hash.data() + 32, std::back_inserter(hexAddress));

toAddress(hexAddress, _hashImpl);

Expand Down
2 changes: 2 additions & 0 deletions bcos-executor/src/vm/HostContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ evmc_result HostContext::externalRequest(const evmc_message* _msg)
{
case EVMC_CREATE2:
request->createSalt = fromEvmC(_msg->create2_salt);
request->data.assign(_msg->input_data, _msg->input_data + _msg->input_size);
request->create = true;
break;
case EVMC_CALL:
if (blockContext.isWasm())
Expand Down

0 comments on commit 1b7a0c6

Please sign in to comment.