Library SetcodeConcrete.validatedexecution

Processing returns a state once transaction validation succeeds

This is a property of the generated, total Rocq function. A VM revert, including the migrated-sender outcome, is a receipt, not a transaction- processing error. The result does not establish native exception freedom or validate an arbitrary transaction.
From Stdlib Require Import List.
Require Import RocqOfOCaml.RocqOfOCaml MonadVM.Execution.
Set Default Goal Selector "!".
Module E := Execution.Make.
Section Execution.
Context {F : E.FArgs}.
Lemma validated_transaction_returns state tx validation :
  E.validate_transaction state tx = inl validation →
  ∃ post, E.process_transaction state tx = inl post.
Proof.
  intro Hv. unfold E.process_transaction. rewrite Hv.
  destruct validation as [sender fee price intrinsic].
  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.
  match goal with |- context [Result.List.fold_left ?step ?initial ?auths] ⇒
    destruct (Result.List.fold_left step initial auths) as [authorities authorized] end.
  cbn beta iota zeta.
  match goal with |- context [E.Host.call_from_eoa tx ?msg ?entry] ⇒
    destruct (E.Host.call_from_eoa tx msg entry) as [result after] end.
  repeat match goal with |- context [if ?flag then _ else _] ⇒
    destruct flag; cbn beta iota zeta end.
  all: eexists; reflexivity.
Qed.
Lemma transaction_error_from_validation state tx error :
  E.process_transaction state tx = inr error →
  E.validate_transaction state tx = inr error.
Proof.
  intro Hrun. destruct (E.validate_transaction state tx) as [validation|failure] eqn:Hv.
  - destruct (validated_transaction_returns _ _ _ Hv) as [post Hpost].
    rewrite Hpost in Hrun. discriminate.
  - unfold E.process_transaction in Hrun. rewrite Hv in Hrun.
    injection Hrun as <-. reflexivity.
Qed.
End Execution.
Print Assumptions validated_transaction_returns.