Library QedkConcrete.stakingcreation

Reached-state creation exclusion for the staking address

The cryptographic premise covers transaction senders and 0x1000 independently. It does not require a positive nonce or make the staking account subject to a sender's reserve check.
From Stdlib Require Import List.
Require Import QedkConcrete.consensusrequirements QedkConcrete.blocknumbers.
Set Default Goal Selector "!".
Import ListNotations.

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

Even an empty sender list retains the exclusion for 0x1000. The execution prefix and validation equations select the actual reached state; no exclusion is required in unrelated starting states.
Lemma prefix_excludes_staking_creation signers block txs first tx last before validation :
  prefixAvoidsSignerCreation signers block txs →
  txs = first ++ tx :: last →
  Result.List.fold_leftM (@Execution.Make.dispatch_transaction F) block first = inl before →
  @Execution.Make.validate_transaction F before tx = inl validation →
  Chain.Ethereum.Account.is_smart_contract
    (State.op_pointcaretlparenrparen (State.BlockState.t.world_state before)
      (State.WorldState.account None stakingAddress)) = false →
  let '(msg, entry) := transactionstage.transactionVmInput before tx validation in
  ¬ List.In stakingAddress (State.TransactionState.t.accounts_created_in_current_transaction
      (snd (@Execution.Make.Host.call_from_eoa F tx msg entry))).
Proof.
  intros Hsafe Hsplit Hrun Hvalid Hcode.
  exact (Hsafe first tx last before Hsplit Hrun validation stakingAddress
    (or_intror eq_refl) Hvalid Hcode).
Qed.

Reuse the same exclusion after any successfully executed block prefix. In particular, the staking-address part is not a new assumption at each block. This does not assume or prove that the prefix succeeds.
Lemma creation_exclusion_after_prefix signers verify world prefix rest post :
  windowAvoidsSignerCreation signers verify world (prefix ++ rest) →
  Result.List.fold_leftM (@Execution.Make.process_block F verify) world prefix = inl post →
  windowAvoidsSignerCreation signers verify post rest.
Proof.
  intros Hsafe Hrun before block after reached Hsplit Hprefix.
  apply (Hsafe (prefix ++ before) block after reached).
  - rewrite <- app_assoc, <- Hsplit. reflexivity.
  - rewrite result_fold_leftM_app, Hrun. exact Hprefix.
Qed.
End Execution.

Print Assumptions prefix_excludes_staking_creation.
Print Assumptions creation_exclusion_after_prefix.