mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #14138 from ethereum/evmHostCalldataFix
Fix calldata handling during creation in EVMHost.
This commit is contained in:
commit
3f04f00bdc
@ -366,6 +366,11 @@ evmc::Result EVMHost::call(evmc_message const& _message) noexcept
|
||||
access_account(tx_context.block_coinbase);
|
||||
}
|
||||
|
||||
if (message.kind == EVMC_CREATE || message.kind == EVMC_CREATE2)
|
||||
{
|
||||
message.input_data = nullptr;
|
||||
message.input_size = 0;
|
||||
}
|
||||
evmc::Result result = m_vm.execute(*this, m_evmRevision, message, code.data(), code.size());
|
||||
|
||||
if (message.kind == EVMC_CREATE || message.kind == EVMC_CREATE2)
|
||||
|
14
test/libsolidity/semanticTests/various/create_calldata.sol
Normal file
14
test/libsolidity/semanticTests/various/create_calldata.sol
Normal file
@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
bytes public s;
|
||||
constructor(uint256 x) {
|
||||
// Due to a bug in EVMHost, msg.data used to contain initcode and constructor arguments.
|
||||
s = msg.data;
|
||||
assert(msg.data.length == 0);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// constructor(): 42 ->
|
||||
// gas irOptimized: 147541
|
||||
// gas legacy: 177488
|
||||
// gas legacyOptimized: 140089
|
||||
// s() -> 0x20, 0
|
Loading…
Reference in New Issue
Block a user