Library QedkConcrete.transactionhistoryprojection

Consensus history agrees with concrete transaction prefixes

Consensus simulates nonce consumption and applied-authority activity, not VM balances or storage. This invariant is derived by executing the actual transaction fold. The snapshot may precede the current block; until bounds the blocks for which earlier activity still forbids emptying.
From Stdlib Require Import List String ZArith Lia Bool.
Require Import RocqOfOCaml.RocqOfOCaml.
Require Import MonadVM.Execution QedkConcrete.consensushistory
  QedkConcrete.consensushistoryproofs
  QedkConcrete.transactionnonces QedkConcrete.authorizationnonces
  QedkConcrete.transactionstage QedkConcrete.transactioncode
  QedkConcrete.transactionhistory QedkConcrete.authorizationcode
  QedkConcrete.transactionpersistentcode QedkConcrete.transactionchecked
  QedkConcrete.publictransaction QedkConcrete.protectedstorageboundary
  QedkConcrete.transactionformat QedkConcrete.stakingsystem.
Set Default Goal Selector "!".
#[local] Hint Extern 100 (Basics.Unreachable _) ⇒
  (apply Opaque.legacy_witness; Opaque.opaque_inhabit 64%nat) : typeclass_instances.
Import ListNotations.
Local Open Scope Z_scope.
Module E := Execution.Make.
Module S := State.TransactionState.
Module B := State.BlockState.
Module W := State.WorldState.
Module A := Chain.Ethereum.Account.
Module T := Chain.Ethereum.Transaction.
Module Addr := Chain.Ethereum.Address.

Section Execution.
Context {F : E.FArgs}.

Local Abbreviation args := (@E.Instantiation_fargs F).
Local Abbreviation params := args.(Host.Instantiate.ChainParams).

Context {UI0 : Basics.Unreachable Support.UintN.Impl.t}
  {UB : Basics.Unreachable Bloom.t}
  {U8 : Basics.Unreachable Byte_string.B8.(Byte_string.Fixed.Fixed_result.t)}.

Local Abbreviation prefix := (@transactionPrefix F).
Local Abbreviation vmInput := (@transactionVmInput F).
Local Abbreviation callFromEoa := (@E.Host.call_from_eoa F).
Local Abbreviation processTransaction := (@E.process_transaction F).
Local Abbreviation readAccount := (fun world addr ⇒ State.op_pointcaretlparenrparen
  world (@W.account None addr)).

Local Abbreviation native := (@Reserve_balance.precompile_address).
Local Abbreviation systemSender := (@Chain.Monad.system_sender).

Local Abbreviation recoveredAuthority := (@Chain.Ethereum.Transaction.Authorization.authority).

Local Abbreviation blockNumber := (fun block ⇒ Chain.Ethereum.Block.Header.t.number
  (Chain.Ethereum.Block.t.header (B.t.current_block block))).
Local Abbreviation emptying := (@Reserve_balance.is_emptying_tx).

Record HistoryMatches (snapshot : W.t) (history : ConsensusHistory)
    (world : W.t) (signers : list Addr.t) (until : N) : Prop := {
  history_accounts_wf : stringmaps.WellFormed (W.t.accounts world);
  history_counters_wf : stringmaps.WellFormed (W.t.next_emptying_transaction_block world);
  history_noncontract : ∀ a, List.In a signers →
    @A.is_smart_contract (readAccount world a) = false;
  history_nonce_agreement : ∀ a, List.In a signers →
    A.t.nonce (readAccount world a) = historyNonces history a;
  history_emptying_agreement : ∀ a, List.In a signers →
    a ≠ systemSender → ∀ future,
    (future ≤ until)%N →
    @emptyingEligible world a future = historyAllowsEmptying snapshot history a future
}.

Lemma initial_history_matches snapshot signers until :
  stringmaps.WellFormed (W.t.accounts snapshot) →
  stringmaps.WellFormed (W.t.next_emptying_transaction_block snapshot) →
  (∀ a, List.In a signers → @A.is_smart_contract (readAccount snapshot a) = false) →
  HistoryMatches snapshot (initialHistory snapshot) snapshot signers until.
Proof.
  intros Hmap Hcounters Hsc. constructor; try assumption.
  - intros a Ha. reflexivity.
  - intros a Ha HnotSys future Hfuture. symmetry. apply initial_history_emptying.
Qed.

Only the tracked senders need nonce and applied-authorization membership correspondence. An authorization for an untracked address may apply in only one execution without changing any tracked sender's history.
Lemma history_authorizations snapshot history signers until block tx validation :
  HistoryMatches snapshot history (B.t.world_state block) signers until →
  (∀ a, List.In a signers → @A.is_smart_contract (readAccount snapshot a) = false) →
  Forall (fun auth ⇒ OCamlString.length (T.Authorization.t.address auth) = 20) (T.authorization_list tx) →
  let sender := E.transaction_validation.sender validation in
  let predicted := advanceHistory snapshot history sender tx in
  (∀ a, List.In a signers →
    existsb (fun b ⇒ String.eqb b a) (fst (prefix block tx validation)) =
      existsb (fun b ⇒ String.eqb b a) (fst predicted)) ∧
  ∀ a, List.In a signers →
    snd (@transactionAuthorizationNonces F (B.t.world_state block) sender tx) a =
      historyNonces (snd predicted) a.
Proof.
  intros Hhistory Hsnapshot Hwidth.
  pose proof (advance_history_projection (fun a ⇒ List.In a signers) snapshot history
    (B.t.world_state block) (E.transaction_validation.sender validation) tx) as Hprediction.
  specialize (Hprediction ltac:(intros a Ha; split;
    [rewrite (history_noncontract _ _ _ _ _ Hhistory a Ha), (Hsnapshot a Ha); reflexivity|
     exact (history_nonce_agreement _ _ _ _ _ Hhistory a Ha)])).
  pose proof (proj1 (@transaction_authorization_nonce_projection F block tx validation
    (history_accounts_wf _ _ _ _ _ Hhistory) Hwidth)) as Hprefix.
  cbn zeta in Hprediction |- ×.
  split; [intros a Ha; rewrite Hprefix; exact (proj1 Hprediction a Ha)|exact (proj2 Hprediction)].
Qed.

The candidate's own valid authorizations must also be checked, before the sender itself is recorded as activity. No VM execution or successful validation is needed to establish this equality.
Theorem history_current_emptying snapshot history signers until block tx validation :
  HistoryMatches snapshot history (B.t.world_state block) signers until →
  (∀ a, List.In a signers → @A.is_smart_contract (readAccount snapshot a) = false) →
  Forall (fun auth ⇒ OCamlString.length (T.Authorization.t.address auth) = 20) (T.authorization_list tx) →
  List.In (E.transaction_validation.sender validation) signers →
  E.transaction_validation.sender validation ≠ systemSender →
  (blockNumber block ≤ until)%N →
  let sender := E.transaction_validation.sender validation in
  fst (emptying (snd (vmInput block tx validation))) =
    historyAllowsEmptying snapshot history sender (blockNumber block) &&
    negb (existsb (fun a ⇒ String.eqb a sender) (fst (advanceHistory snapshot history sender tx))).
Proof.
  intros Hhistory Hsnapshot Hwidth Hsender HnotSys Htime sender.
  pose proof (@transaction_prefix_emptying F block tx validation
    (history_accounts_wf _ _ _ _ _ Hhistory) (history_counters_wf _ _ _ _ _ Hhistory)) as Hentry.
  pose proof (proj1 (history_authorizations snapshot history signers until block tx validation
    Hhistory Hsnapshot Hwidth)) as Hauthorities.
  cbn zeta in Hentry. rewrite Bool.andb_assoc in Hentry.
  assert (HinputEmpty : fst (emptying (snd (vmInput block tx validation))) =
    fst (emptying (@E.bump_emptying_transaction_counters F
      (fst (prefix block tx validation)) (snd (prefix block tx validation))))).
  { unfold transactionVmInput. destruct (prefix block tx validation) as [authorities prepared]. reflexivity. }
  rewrite HinputEmpty.
  change (fst (emptying (@E.bump_emptying_transaction_counters F
      (fst (prefix block tx validation)) (snd (prefix block tx validation)))) =
    @emptyingEligible (B.t.world_state block) sender (blockNumber block) &&
    negb (existsb (fun a ⇒ String.eqb a sender) (fst (prefix block tx validation)))) in Hentry.
  rewrite (Hauthorities sender Hsender) in Hentry.
  rewrite (history_emptying_agreement _ _ _ _ _ Hhistory sender Hsender HnotSys (blockNumber block) Htime) in Hentry.
  exact Hentry.
Qed.

One actual execution step preserves the simulated nonce and activity history. The cryptographic exclusion concerns contract creation at signer addresses, not any assumed balance or nonce postcondition.
Theorem process_transaction_history_projection snapshot history signers until block tx validation post :
  (@E.Params F).(Execution.Make_Params_signature.revision) = Support.Variants.Revision.Eleven →
  HistoryMatches snapshot history (B.t.world_state block) signers until →
  (∀ a, List.In a signers → @A.is_smart_contract (readAccount snapshot a) = false) →
  (∀ a, List.In a signers → a ≠ native) →
  Forall (fun auth ⇒ OCamlString.length (T.Authorization.t.address auth) = 20) (T.authorization_list tx) →
  @E.validate_transaction F block tx = inl validation →
  processTransaction block tx = inl post →
  (until < blockNumber block + 3)%N →
  let '(msg, entry) := vmInput block tx validation in
  (∀ a, List.In a signers →
    ¬ List.In a (S.t.accounts_created_in_current_transaction (snd (callFromEoa tx msg entry)))) →
  HistoryMatches snapshot (snd (advanceHistory snapshot history (E.transaction_validation.sender validation) tx))
    (B.t.world_state post) signers until.
Proof.
  intros Hrevision Hhistory Hsnapshot Hnative Hwidth Hvalidation Hrun Htime.
  pose proof (history_authorizations snapshot history signers until block tx validation
    Hhistory Hsnapshot Hwidth) as [Hauthorities Hnonces].
  destruct (vmInput block tx validation) as [msg entry] eqn:Hinput. intro Hcreated.
  constructor.
  - exact (@process_transaction_account_map F
      block tx validation post Hrevision
      (history_accounts_wf _ _ _ _ _ Hhistory) Hvalidation Hrun).
  - exact (proj1 (proj2 (@process_transaction_activity_history F
      block tx validation post Hrevision
      (history_counters_wf _ _ _ _ _ Hhistory) Hvalidation Hrun))).
  - intros a Ha.
    pose proof (@process_transaction_noncontract F
      block tx validation post a Hrevision
      (history_accounts_wf _ _ _ _ _ Hhistory) Hwidth Hvalidation Hrun
      (history_noncontract _ _ _ _ _ Hhistory a Ha)) as Hsc.
    rewrite Hinput in Hsc. apply Hsc, Hcreated, Ha.
  - intros a Ha.
    pose proof (@process_transaction_nonce_projection F
      block tx validation post a (Hnative a Ha) Hrevision
      (history_accounts_wf _ _ _ _ _ Hhistory) Hwidth Hvalidation Hrun
      (history_noncontract _ _ _ _ _ Hhistory a Ha)) as Hnonce.
    rewrite Hinput in Hnonce. specialize (Hnonce (Hcreated a Ha)).
    etransitivity; [exact Hnonce|exact (Hnonces a Ha)].
  - intros a Ha HnotSys future Hfuture.
    pose proof (@process_transaction_future_emptying F
      block tx validation post a future Hrevision
      (history_accounts_wf _ _ _ _ _ Hhistory) (history_counters_wf _ _ _ _ _ Hhistory)
      Hvalidation Hrun ltac:(lia)) as Hemptying.
    rewrite Hinput in Hemptying. specialize (Hemptying (Hcreated a Ha)).
    rewrite advance_history_emptying.
    rewrite (history_emptying_agreement _ _ _ _ _ Hhistory a Ha HnotSys future Hfuture) in Hemptying.
    cbn [existsb] in Hemptying |- ×. rewrite (Hauthorities a Ha) in Hemptying.
    exact Hemptying.
Qed.

Lemma process_monad_system_transaction_no_authorizations block tx post :
  @E.process_monad_system_transaction F block tx = inl post →
  T.authorization_list tx = [].
Proof.
  unfold E.process_monad_system_transaction.
  destruct (@E.validate_monad_system_transaction F block tx systemSender)
    as [[]|] eqn:Hval; [|discriminate].
  intros _.
  unfold E.validate_monad_system_transaction in Hval.
  change (@Result.op_letdollar) with
    (fun (A B C : Set) (r : A + B) (f : A → C + B) ⇒
      match r with inl value ⇒ f value | inr error ⇒ inr error end) in Hval.
  cbn beta iota zeta in Hval.
  destruct (Result.when_ _ _) as [[]|]; [|discriminate Hval].
  destruct tx as [| | |]; try discriminate Hval.
  reflexivity.
Qed.

Lemma system_sender_kind_recovered tx :
  @E.sender_kind_value F tx = Some E.System →
  transactionSender tx = Some systemSender.
Proof.
  unfold E.sender_kind_value.
  fold (transactionSender tx).
  destruct (T.chain_id tx) as [cid|];
    [destruct (Support.UintN.op_ltgt cid (@E.Params F).(Execution.Make_Params_signature.chain_id));
      [discriminate|]|].
  all: destruct (transactionSender tx) as [sender|]; [|discriminate];
    destruct (Chain.Ethereum.Address.op_eq sender systemSender) eqn:Heq; [|discriminate];
    intros _;
    change (Z.eqb (OCamlString.compare sender systemSender) 0 = true) in Heq;
    apply Z.eqb_eq in Heq;
    apply reservecheck.address_compare_eq in Heq;
    subst sender; reflexivity.
Qed.

Monad system transactions increment systemSender's nonce by 1, carry no EIP-7702 authorizations, and preserve code and emptying counters.
Theorem process_monad_system_transaction_history_projection snapshot history signers until block tx post :
  HistoryMatches snapshot history (B.t.world_state block) signers until →
  @E.process_monad_system_transaction F block tx = inl post →
  HistoryMatches snapshot (snd (advanceHistory snapshot history systemSender tx))
    (B.t.world_state post) signers until.
Proof.
  intros Hhistory Hrun.
  pose proof (process_monad_system_transaction_no_authorizations block tx post Hrun) as Hno_auth.
  destruct (@process_monad_system_transaction_frame F block tx post
    (history_accounts_wf _ _ _ _ _ Hhistory) Hrun)
    as [Hwf_post [_ [Hcounters_eq [_ [Hcode_eq [Hsc_eq [Hnonce_eq _]]]]]]].
  constructor.
  - exact Hwf_post.
  - rewrite Hcounters_eq. exact (history_counters_wf _ _ _ _ _ Hhistory).
  - intros a Ha. rewrite Hsc_eq. exact (history_noncontract _ _ _ _ _ Hhistory a Ha).
  - intros a Ha.
    rewrite Hnonce_eq.
    unfold advanceHistory. rewrite Hno_auth.
    cbn [authorizationNonces OCamlList.fold_left snd historyNonces].
    rewrite (history_nonce_agreement _ _ _ _ _ Hhistory a Ha).
    reflexivity.
  - intros a Ha HnotSys future Hfuture.
    transitivity (@emptyingEligible (B.t.world_state block) a future).
    + unfold emptyingEligible. cbv beta. rewrite Hcode_eq.
      rewrite (read_counter_same_map _ _ a Hcounters_eq). reflexivity.
    + rewrite advance_history_emptying.
      unfold advanceHistory. rewrite Hno_auth.
      cbn [authorizationNonces OCamlList.fold_left fst existsb].
      assert (Hneq : String.eqb systemSender a = false).
      { apply String.eqb_neq. intro Heq; apply HnotSys; symmetry; exact Heq. }
      rewrite Hneq, Bool.orb_false_l; cbn [negb].
      rewrite Bool.andb_true_r.
      exact (history_emptying_agreement _ _ _ _ _ Hhistory a Ha HnotSys future Hfuture).
Qed.

Theorem dispatched_transactions_history_projection snapshot signers until txs :
  (@E.Params F).(Execution.Make_Params_signature.revision) = Support.Variants.Revision.Eleven →
  (∀ a, List.In a signers → @A.is_smart_contract (readAccount snapshot a) = false) →
  (∀ a, List.In a signers → a ≠ native) →
  Forall (fun tx ⇒
    Forall (fun auth ⇒ OCamlString.length (T.Authorization.t.address auth) = 20)
      (T.authorization_list tx)) txs →
  (∀ block tx validation a,
    List.In tx txs → List.In a signers →
    @E.validate_transaction F block tx = inl validation →
    @A.is_smart_contract (readAccount (B.t.world_state block) a) = false →
    let '(msg, entry) := vmInput block tx validation in
    ¬ List.In a (S.t.accounts_created_in_current_transaction (snd (callFromEoa tx msg entry)))) →
  ∀ history block post,
    HistoryMatches snapshot history (B.t.world_state block) signers until →
    (until < blockNumber block + 3)%N →
    Result.List.fold_leftM (@E.dispatch_transaction F) block txs = inl post →
    ∃ after, scanHistory snapshot history txs = Some after ∧
      HistoryMatches snapshot after (B.t.world_state post) signers until.
Proof.
  intros Hrevision Hsnapshot Hnative Hinputs Hsafe.
  revert Hinputs Hsafe.
  induction txs as [|tx rest IH]; intros Hinputs Hsafe history block post Hhistory Htime Hrun.
  - cbn [Result.List.fold_leftM] in Hrun. injection Hrun as <-.
    ∃ history. split; [reflexivity|exact Hhistory].
  - inversion Hinputs as [|? ? Hwidth Hrest]; subst.
    change (Result.op_letdollar (@E.dispatch_transaction F block tx)
      (fun next ⇒ Result.List.fold_leftM (@E.dispatch_transaction F) next rest) = inl post) in Hrun.
    destruct (@E.dispatch_transaction F block tx) as [next|error] eqn:Hstep; [|discriminate Hrun].
    destruct (@dispatch_transaction_cases F block tx next Hstep)
      as [[sender_eoa [_ Hproc]] | [HsysKind Hsys]].
    + assert (Hvalid : ∃ validation, @E.validate_transaction F block tx = inl validation).
      { unfold E.process_transaction in Hproc.
        destruct (@E.validate_transaction F block tx) as [validation|error] eqn:Hvalidation;
          [∃ validation; reflexivity|discriminate Hproc]. }
      destruct Hvalid as [validation Hvalidation].
      assert (Hsender : transactionSender tx = Some (E.transaction_validation.sender validation)).
      { exact (@validated_sender_recovered F block tx validation Hvalidation). }
      pose proof (process_transaction_history_projection snapshot history signers until block tx validation next
        Hrevision Hhistory Hsnapshot Hnative Hwidth Hvalidation Hproc Htime) as Hadvance.
      destruct (vmInput block tx validation) as [msg entry] eqn:Hinput.
      assert (Hcreated : ∀ a, List.In a signers →
        ¬ List.In a (S.t.accounts_created_in_current_transaction (snd (callFromEoa tx msg entry)))).
      { intros a Ha.
        pose proof (Hsafe block tx validation a (or_introl eq_refl) Ha Hvalidation
          (history_noncontract _ _ _ _ _ Hhistory a Ha)) as Hcreation.
        rewrite Hinput in Hcreation. exact Hcreation. }
      specialize (Hadvance Hcreated).
      assert (Hblock : B.t.current_block next = B.t.current_block block).
      { exact (@process_transaction_current_block F block tx next Hproc). }
      destruct (IH Hrest ltac:(intros b t v a Hin; apply Hsafe; right; exact Hin)
        (snd (advanceHistory snapshot history (E.transaction_validation.sender validation) tx)) next post
        Hadvance ltac:(cbv beta; rewrite Hblock; exact Htime) Hrun) as [after [Hscan Hafter]].
      ∃ after. split; [|exact Hafter].
      cbn [scanHistory]. rewrite Hsender. exact Hscan.
    + pose proof (system_sender_kind_recovered tx HsysKind) as Hsender.
      pose proof (process_monad_system_transaction_history_projection
        snapshot history signers until block tx next Hhistory Hsys) as Hadvance.
      assert (Hblock : B.t.current_block next = B.t.current_block block).
      { exact (@process_monad_system_transaction_current_block F block tx next Hsys). }
      destruct (IH Hrest ltac:(intros b t v a Hin; apply Hsafe; right; exact Hin)
        (snd (advanceHistory snapshot history systemSender tx)) next post
        Hadvance ltac:(cbv beta; rewrite Hblock; exact Htime) Hrun) as [after [Hscan Hafter]].
      ∃ after. split; [|exact Hafter].
      cbn [scanHistory]. rewrite Hsender. exact Hscan.
Qed.
Lift the correspondence through the transaction fold used by process_block. The input contains signed transactions, not execution receipts or a supplied list of applied authorizations. Both that list and the next nonce map are derived by scanHistory.
Theorem transactions_history_projection snapshot signers until txs :
  (@E.Params F).(Execution.Make_Params_signature.revision) = Support.Variants.Revision.Eleven →
  (∀ a, List.In a signers → @A.is_smart_contract (readAccount snapshot a) = false) →
  (∀ a, List.In a signers → a ≠ native) →
  Forall (fun tx ⇒
    Forall (fun auth ⇒ OCamlString.length (T.Authorization.t.address auth) = 20)
      (T.authorization_list tx)) txs →
  (∀ block tx validation a,
    List.In tx txs → List.In a signers →
    @E.validate_transaction F block tx = inl validation →
    @A.is_smart_contract (readAccount (B.t.world_state block) a) = false →
    let '(msg, entry) := vmInput block tx validation in
    ¬ List.In a (S.t.accounts_created_in_current_transaction (snd (callFromEoa tx msg entry)))) →
  ∀ history block post,
    HistoryMatches snapshot history (B.t.world_state block) signers until →
    (until < blockNumber block + 3)%N →
    Result.List.fold_leftM processTransaction block txs = inl post →
    ∃ after, scanHistory snapshot history txs = Some after ∧
      HistoryMatches snapshot after (B.t.world_state post) signers until.
Proof.
  intros Hrevision Hsnapshot Hnative Hinputs Hsafe.
  revert Hinputs Hsafe.
  induction txs as [|tx rest IH]; intros Hinputs Hsafe history block post Hhistory Htime Hrun.
  - cbn [Result.List.fold_leftM] in Hrun. injection Hrun as <-.
    ∃ history. split; [reflexivity|exact Hhistory].
  - inversion Hinputs as [|? ? Hwidth Hrest]; subst.
    change (Result.op_letdollar (processTransaction block tx)
      (fun next ⇒ Result.List.fold_leftM processTransaction next rest) = inl post) in Hrun.
    destruct (processTransaction block tx) as [next|error] eqn:Hstep; [|discriminate Hrun].
    assert (Hvalid : ∃ validation, @E.validate_transaction F block tx = inl validation).
    { unfold E.process_transaction in Hstep.
      destruct (@E.validate_transaction F block tx) as [validation|error] eqn:Hvalidation;
        [∃ validation; reflexivity|discriminate Hstep]. }
    destruct Hvalid as [validation Hvalidation].
    assert (Hsender : transactionSender tx = Some (E.transaction_validation.sender validation)).
    { exact (@validated_sender_recovered F block tx validation Hvalidation). }
    pose proof (process_transaction_history_projection snapshot history signers until block tx validation next
      Hrevision Hhistory Hsnapshot Hnative Hwidth Hvalidation Hstep Htime) as Hadvance.
    destruct (vmInput block tx validation) as [msg entry] eqn:Hinput.
    assert (Hcreated : ∀ a, List.In a signers →
      ¬ List.In a (S.t.accounts_created_in_current_transaction (snd (callFromEoa tx msg entry)))).
    { intros a Ha.
      pose proof (Hsafe block tx validation a (or_introl eq_refl) Ha Hvalidation
        (history_noncontract _ _ _ _ _ Hhistory a Ha)) as Hcreation.
      rewrite Hinput in Hcreation. exact Hcreation. }
    specialize (Hadvance Hcreated).
    assert (Hblock : B.t.current_block next = B.t.current_block block).
    { exact (@process_transaction_current_block F
        block tx next Hstep). }
    destruct (IH Hrest ltac:(intros b t v a Hin; apply Hsafe; right; exact Hin)
      (snd (advanceHistory snapshot history (E.transaction_validation.sender validation) tx)) next post
      Hadvance ltac:(cbv beta; rewrite Hblock; exact Htime) Hrun) as [after [Hscan Hafter]].
    ∃ after. split; [|exact Hafter].
    cbn [scanHistory]. rewrite Hsender. exact Hscan.
Qed.

Starting with the concrete snapshot initializes the invariant rather than assuming it at intermediate transactions. Consequently consensus can recover exact signer nonces and emptying eligibility after any successfully processed prefix without executing its VM calls.
Corollary transactions_history_from_snapshot signers until txs block post :
  (@E.Params F).(Execution.Make_Params_signature.revision) = Support.Variants.Revision.Eleven →
  stringmaps.WellFormed (W.t.accounts (B.t.world_state block)) →
  stringmaps.WellFormed (W.t.next_emptying_transaction_block (B.t.world_state block)) →
  (∀ a, List.In a signers → @A.is_smart_contract (readAccount (B.t.world_state block) a) = false) →
  (∀ a, List.In a signers → a ≠ native) →
  Forall (fun tx ⇒
    Forall (fun auth ⇒ OCamlString.length (T.Authorization.t.address auth) = 20)
      (T.authorization_list tx)) txs →
  (∀ before tx validation a,
    List.In tx txs → List.In a signers →
    @E.validate_transaction F before tx = inl validation →
    @A.is_smart_contract (readAccount (B.t.world_state before) a) = false →
    let '(msg, entry) := vmInput before tx validation in
    ¬ List.In a (S.t.accounts_created_in_current_transaction (snd (callFromEoa tx msg entry)))) →
  (until < blockNumber block + 3)%N →
  Result.List.fold_leftM processTransaction block txs = inl post →
  ∃ after, scanHistory (B.t.world_state block) (initialHistory (B.t.world_state block)) txs = Some after ∧
    HistoryMatches (B.t.world_state block) after (B.t.world_state post) signers until.
Proof.
  intros Hrevision Hmap Hcounters Hsc Hnative Hinputs Hsafe Htime Hrun.
  apply (transactions_history_projection (B.t.world_state block) signers until txs
    Hrevision Hsc Hnative Hinputs Hsafe (initialHistory (B.t.world_state block)) block post).
  - apply initial_history_matches; assumption.
  - exact Htime.
  - exact Hrun.
Qed.

End Execution.