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 known_bytecode = bytecode.map(|(code, hash)| (hash, code));
21 FrameInput::Call(Box::new(CallInputs {
22 input: CallInput::Bytes(input),
23 gas_limit,
24 target_address,
25 bytecode_address: target_address,
26 known_bytecode,
27 caller: tx.caller(),
28 value: CallValue::Transfer(tx.value()),
29 scheme: CallScheme::Call,
30 is_static: false,
31 return_memory_offset: 0..0,
32 }))
33 }
34 TxKind::Create => FrameInput::Create(Box::new(CreateInputs {
35 caller: tx.caller(),
36 scheme: CreateScheme::Create,
37 value: tx.value(),
38 init_code: input,
39 gas_limit,
40 })),
41 }
42}