Skip to main content

create_init_frame

Function create_init_frame 

Source
pub fn create_init_frame<CTX: ContextTr>(
    ctx: &mut CTX,
    gas: &mut GasTracker,
) -> Result<Option<FrameInput>, <<CTX::Journal as JournalTr>::Database as Database>::Error>
Expand description

Creates the first FrameInput from the transaction and the transaction-level gas, forwarding all remaining regular gas and the reservoir to the frame.

Under EIP-2780 this completes the runtime gas phase started at pre-execution (the authorization charges): the target is loaded once and its state-dependent charges are recorded on gas:

  • A value transfer to a non-existent recipient grows the state by one account leaf and pays the new-account state gas. The charge stays deducted and only the decision travels on the frame inputs (charged_new_account_state_gas), so the handler refunds it at frame settle when no account leaf ends up created. Checked before the delegation resolution, matching the spec’s prepare_dispatch order.
  • An EIP-7702 delegated recipient pays the delegation-target access following the standard EIP-2929 warm/cold model. The charge must be covered before the delegate is read, so an out-of-gas here leaves a cold delegate out of the EIP-7928 block access list.
  • A create transaction whose deployment target does not already exist pays the account-creation state gas (charged_create_state_gas), decided by the single read that also warms the target.

The recipient is evaluated after the authorizations were applied, so a recipient materialized or delegated by an authorization in this transaction is seen in its post-authorization state. A self-transfer recipient is the (non-empty) sender, so the new-account charge never fires for it, while a delegated sender still pays for resolving its delegation.

Returns None when the charges run out of gas: the transaction stays valid but must be included as an out-of-gas halt without entering execution (runtime_oog_unwind).