Skip to main content

normalize_failed_batch_result_gas

Function normalize_failed_batch_result_gas 

Source
fn normalize_failed_batch_result_gas(
    frame_result: &mut FrameResult,
    final_gas_limit: u64,
    accumulated_state_gas_spent: u64,
)
Expand description

Rewrites a failed batch step’s gas accounting to match whole-transaction semantics.

frame_result initially only reflects the final failed step. For atomic AA batches we surface one top-level transaction result instead, so the gas field must be normalized to the full tx budget. Reverts preserve the exact gas spent across prior successful steps plus the failed step, while halts such as OOG consume the entire remaining transaction budget.

NOTE: in AA batches, non-refundable state-gas charges that are known upfront, are already included in initial_state_gas, so this only refunds per-step execution state gas on failure.