Library SetcodeConcrete.included

An in-flight transaction after sender migration is included as failed

This is the concrete executor, not a substitute transaction function. state is the state immediately before tx, not the admission snapshot. validation is its successful native validation result. The admission theorem in validation supplies this result from public checks, balance coverage and the actual-nonce limit.
The conclusion gives successful transaction processing and an appended failed receipt. It does not claim VM success or whole-window solvency.
From Stdlib Require Import Bool List.
Require Import RocqOfOCaml.RocqOfOCaml MonadVM.Execution.
Set Default Goal Selector "!".
Import ListNotations.
Module E := Execution.Make.
Module B := State.BlockState.
Module A := Chain.Ethereum.Account.
Module R := Chain.Ethereum.Receipt.

Theorem migrated_transaction_is_included {F : E.FArgs} state tx validation :
  Setcode_rules.enabled E.Params.(Execution.Make_Params_signature.revision) = true →
  E.validate_transaction state tx = inl validation →
  A.is_smart_contract (State.op_pointcaretlparenrparen state
    (B.account None (E.transaction_validation.sender validation))) = true →
  ∃ post receipt,
    E.process_transaction state tx = inl post ∧
    List.In (tx, receipt) (B.t.transactions_processed post) ∧
    R.t.succeeded receipt = false ∧
    R.t.cumulative_gas_used receipt = B.t.gas_used post.
Proof.
  intros Henabled Hvalidation Hcode.
  unfold E.process_transaction. rewrite Hvalidation.
  destruct validation as [sender fee price intrinsic].
  cbn [E.transaction_validation.sender] in Hcode.
  change (@Result.op_letdollar) with
    (fun (A Error C : Set) (first : A + Error) (next : A → C + Error) ⇒
      match first with inl value ⇒ next value | inr error ⇒ inr error end).
  cbn beta iota zeta in Hcode |- ×.
  rewrite Henabled, Hcode. cbn [andb].
  match goal with |- context [Result.List.fold_left ?step ?initial ?auths] ⇒
    destruct (Result.List.fold_left step initial auths) as [authorities authorized] eqn:Hauth end.
  cbn beta iota zeta.
  match goal with |- context [Evmc.Message.CallKind.is_create ?kind] ⇒
    destruct (Evmc.Message.CallKind.is_create kind) eqn:Hcreate end.
  all: cbn beta iota zeta.
  all: eexists; eexists; split; [reflexivity|].
  all: split.
  all: try (apply List.in_or_app; right; left; reflexivity).
  all: split; reflexivity.
Qed.

Print Assumptions migrated_transaction_is_included.