Skip to main content

Module execute_precompile

Module execute_precompile 

Source
Expand description

EXECUTE precompile for Native Rollups — aligned with the l2beat spec.

This is a thin wrapper around verify_stateless_new_payload (accessed via the StatelessValidator trait). The precompile:

  1. Deserializes SSZ StatelessInput once (to read gas_limit and check L2 constraints)
  2. Validates L2-specific constraints (no blobs, no withdrawals, etc.)
  3. Charges gas equal to gas_limit + calldata.len() * EXECUTE_GAS_PER_WITNESS_BYTE
  4. Delegates to the StatelessValidator trait, passing the already-decoded input
  5. On success returns the SSZ-encoded StatelessValidationResult.

Fail-closed semantics: both invalid input and a failed validation return an ExceptionalHalt (CALL-level success=false), so a require(success) caller is safe. Invalid input (undecodable SSZ or an L2-constraint violation) is rejected in steps 1-2, before the step-3 gas charge — those checks are cheap and already priced by the L1 calldata gas the attacker paid to submit the blob. A failed validation (step 4) is rejected after the step-3 charge, so an attacker who forces full re-execution still pays for it: that is the DoS bound.

Constants§

EXECUTE_GAS_PER_WITNESS_BYTE
WIP DA/decode cost — the SSZ witness decode + trie rebuild scales with input size; 16 mirrors calldata non-zero byte cost. Tune when EIP-8079 pricing is finalized.

Functions§

execute_precompile
EXECUTE precompile entrypoint.