revm_handler/
execution.rs1use context_interface::Transaction;
2use interpreter::{
3 CallInput, CallInputs, CallScheme, CallValue, CreateInputs, CreateScheme, FrameInput,
4};
5use primitives::{TxKind, B256};
6use state::Bytecode;
7use std::boxed::Box;
8
9#[inline]
11pub fn create_init_frame(
12 tx: &impl Transaction,
13 bytecode: Option<(Bytecode, B256)>,
14 gas_limit: u64,
15) -> FrameInput {
16 let input = tx.input().clone();
17
18 match tx.kind() {
19 TxKind::Call(target_address) => {
20 let (bytecode, bytecode_hash) = bytecode.unwrap_or_default();
21 FrameInput::Call(Box::new(CallInputs {
22 input: CallInput::Bytes(input),
23 gas_limit,
24 target_address,
25 bytecode_address: target_address,
26 bytecode,
27 bytecode_hash,
28 caller: tx.caller(),
29 value: CallValue::Transfer(tx.value()),
30 scheme: CallScheme::Call,
31 is_static: false,
32 return_memory_offset: 0..0,
33 }))
34 }
35 TxKind::Create => FrameInput::Create(Box::new(CreateInputs {
36 caller: tx.caller(),
37 scheme: CreateScheme::Create,
38 value: tx.value(),
39 init_code: input,
40 gas_limit,
41 })),
42 }
43}