revm_handler/
execution.rs1use bytecode::EOF_MAGIC_BYTES;
2use context_interface::Transaction;
3use interpreter::{
4 CallInputs, CallScheme, CallValue, CreateInputs, CreateScheme, EOFCreateInputs, EOFCreateKind,
5 FrameInput,
6};
7use primitives::{hardfork::SpecId, TxKind};
8use std::boxed::Box;
9
10pub fn create_init_frame(tx: &impl Transaction, spec: SpecId, gas_limit: u64) -> FrameInput {
12 let input = tx.input().clone();
13
14 match tx.kind() {
15 TxKind::Call(target_address) => FrameInput::Call(Box::new(CallInputs {
16 input,
17 gas_limit,
18 target_address,
19 bytecode_address: target_address,
20 caller: tx.caller(),
21 value: CallValue::Transfer(tx.value()),
22 scheme: CallScheme::Call,
23 is_static: false,
24 is_eof: false,
25 return_memory_offset: 0..0,
26 })),
27 TxKind::Create => {
28 if spec.is_enabled_in(SpecId::OSAKA) && input.starts_with(&EOF_MAGIC_BYTES) {
30 FrameInput::EOFCreate(Box::new(EOFCreateInputs::new(
31 tx.caller(),
32 tx.value(),
33 gas_limit,
34 EOFCreateKind::Tx { initdata: input },
35 )))
36 } else {
37 FrameInput::Create(Box::new(CreateInputs {
38 caller: tx.caller(),
39 scheme: CreateScheme::Create,
40 value: tx.value(),
41 init_code: input,
42 gas_limit,
43 }))
44 }
45 }
46 }
47}