@@ -36,7 +36,6 @@ consteval evmc_call_kind to_call_kind(Opcode op) noexcept
36
36
case OP_CREATE2:
37
37
return EVMC_CREATE2;
38
38
case OP_EOFCREATE:
39
- case OP_TXCREATE:
40
39
return EVMC_EOFCREATE;
41
40
default :
42
41
intx::unreachable ();
@@ -332,17 +331,12 @@ Result create_impl(StackTop stack, int64_t gas_left, ExecutionState& state) noex
332
331
return {EVMC_SUCCESS, gas_left};
333
332
}
334
333
335
- template <Opcode Op>
336
- Result create_eof_impl (
334
+ Result eofcreate (
337
335
StackTop stack, int64_t gas_left, ExecutionState& state, code_iterator& pos) noexcept
338
336
{
339
- static_assert (Op == OP_EOFCREATE || Op == OP_TXCREATE);
340
-
341
337
if (state.in_static_mode ())
342
338
return {EVMC_STATIC_MODE_VIOLATION, gas_left};
343
339
344
- const auto initcode_hash =
345
- (Op == OP_TXCREATE) ? intx::be::store<evmc::bytes32>(stack.pop ()) : evmc::bytes32{};
346
340
const auto endowment = stack.pop ();
347
341
const auto salt = stack.pop ();
348
342
const auto input_offset_u256 = stack.pop ();
@@ -354,32 +348,11 @@ Result create_eof_impl(
354
348
if (!check_memory (gas_left, state.memory , input_offset_u256, input_size_u256))
355
349
return {EVMC_OUT_OF_GAS, gas_left};
356
350
357
- bytes_view initcontainer;
358
- if constexpr (Op == OP_EOFCREATE)
359
- {
360
- const auto initcontainer_index = pos[1 ];
361
- pos += 2 ;
362
- const auto & container = state.original_code ;
363
- const auto & eof_header = state.analysis .baseline ->eof_header ;
364
- initcontainer = eof_header.get_container (container, initcontainer_index);
365
- }
366
- else
367
- {
368
- pos += 1 ;
369
-
370
- initcontainer = state.get_tx_initcode_by_hash (initcode_hash);
371
- // In case initcode was not found, empty bytes_view was returned.
372
- // Transaction initcodes are not allowed to be empty.
373
- if (initcontainer.empty ())
374
- return {EVMC_SUCCESS, gas_left}; // "Light" failure
375
-
376
- // Charge for initcode validation.
377
- constexpr auto initcode_word_cost_validation = 2 ;
378
- const auto initcode_cost_validation =
379
- num_words (initcontainer.size ()) * initcode_word_cost_validation;
380
- if ((gas_left -= initcode_cost_validation) < 0 )
381
- return {EVMC_OUT_OF_GAS, gas_left};
382
- }
351
+ const auto initcontainer_index = pos[1 ];
352
+ pos += 2 ;
353
+ const auto & container = state.original_code ;
354
+ const auto & eof_header = state.analysis .baseline ->eof_header ;
355
+ const auto initcontainer = eof_header.get_container (container, initcontainer_index);
383
356
384
357
// Charge for initcode hashing.
385
358
constexpr auto initcode_word_cost_hashing = 6 ;
@@ -397,14 +370,7 @@ Result create_eof_impl(
397
370
intx::be::load<uint256>(state.host .get_balance (state.msg ->recipient )) < endowment)
398
371
return {EVMC_SUCCESS, gas_left}; // "Light" failure.
399
372
400
- if constexpr (Op == OP_TXCREATE)
401
- {
402
- const auto error_subcont = validate_eof (state.rev , ContainerKind::initcode, initcontainer);
403
- if (error_subcont != EOFValidationError::success)
404
- return {EVMC_SUCCESS, gas_left}; // "Light" failure.
405
- }
406
-
407
- evmc_message msg{.kind = to_call_kind (Op)};
373
+ evmc_message msg{.kind = EVMC_EOFCREATE};
408
374
msg.gas = gas_left - gas_left / 64 ;
409
375
if (input_size > 0 )
410
376
{
@@ -436,8 +402,4 @@ template Result create_impl<OP_CREATE>(
436
402
StackTop stack, int64_t gas_left, ExecutionState& state) noexcept ;
437
403
template Result create_impl<OP_CREATE2>(
438
404
StackTop stack, int64_t gas_left, ExecutionState& state) noexcept ;
439
- template Result create_eof_impl<OP_EOFCREATE>(
440
- StackTop stack, int64_t gas_left, ExecutionState& state, code_iterator& pos) noexcept ;
441
- template Result create_eof_impl<OP_TXCREATE>(
442
- StackTop stack, int64_t gas_left, ExecutionState& state, code_iterator& pos) noexcept ;
443
405
} // namespace evmone::instr::core
0 commit comments