Library QedkConcrete.consensusconditions

Premises of the concrete QEDK window theorem

These group the existing premises; neither transaction validation nor successful execution is assumed. State conditions are required once and preserved. The CREATE exclusion concerns only reached execution states.
From Stdlib Require Import List ZArith.
Set Default Goal Selector "!".
Require Export QedkConcrete.concreteexecutor.
Require Export QedkConcrete.consensusrequirements.
Require Import QedkConcrete.supply QedkConcrete.hostaccountformat
  QedkConcrete.blockpersistentcode QedkConcrete.wordrange QedkConcrete.credits.
Import ListNotations.
Local Open Scope Z_scope.
Module E := Execution.Make.
Module W := State.WorldState.
Module A := Chain.Ethereum.Account.
Module Block := Chain.Ethereum.Block.

Section Runtime.
F supplies the configured executor (chain ID, revision and tracing flag). Each predicate below states conditions; it does not perform execution.
Context {F : E.FArgs}.
Local Abbreviation args := E.Instantiation_fargs.
Local Abbreviation params := args.(Host.Instantiate.ChainParams).
Local Abbreviation readAccount := (fun world addr ⇒ State.op_pointcaretlparenrparen
  world (@W.account None addr)).
Local Abbreviation native := (@Reserve_balance.precompile_address).
Local Abbreviation staking := (@MonadVM.Staking.staking_address).
Local Abbreviation systemSender := (@Chain.Monad.system_sender).

Require revision Eleven and a U256 chain ID for configuration F. There is no account-state or block-list argument. These are configuration restrictions, not missing library proofs.
The hash-size contracts and temporary BLS assumptions are separate named axioms in vendorAssumptions. No fee solvency, validation success or VM balance property is assumed.
Record ProtocolConditions : Prop := {
  
Enable the account-configurable reserve implementation.
The configured chain ID satisfies 0 <= chain_id < 2^256.
Conditions on an initial execution state.
  • signers: addresses for which the theorem will preserve sender nonce, code and balance properties. All window transaction senders must be included; authorization signers need not be included unless also senders.
  • snapshot: the execution state S_h before the window.
Result: a proposition requiring the state/representation conditions below. Delegated senders are permitted. No future transaction is assumed valid.
Record SnapshotConditions (signers : list Chain.Ethereum.Address.t) (snapshot : W.t) : Prop := {
  
Stored values have 32 bytes and account code lengths are below 2^62 (native OCaml int).
Listed senders have empty code or an EIP-7702 delegation marker.
  snapshot_senders : ∀ a, In a signers →
    @A.is_smart_contract (readAccount snapshot a) = false;
  
None of these senders is the reserve precompile at 0x1001 or the staking precompile at 0x1000. Chain.Monad.system_sender may belong to signers so that blocks can include Monad staking system transactions.
  snapshot_reserved_address : ∀ a, In a signers →
    a ≠ native ∧ a ≠ staking;
  
Well-formed account map, nonnegative balances and total below 2^256.
The map recording each address's earliest emptying block is well formed.
EIP-4788/EIP-2935 accounts contain their prescribed bytecode.
The reserve precompile has empty account code and a well-formed storage map.
External supply allowance of one transaction: Monad system transactions (such as syscall_reward) mint Transaction.value wei into the staking account, whereas user EOA transactions only redistribute existing balances.
blocks is the block list to execute. Return the sum, in wei, of all its Monad system-transaction credits and end-of-block withdrawals (converting withdrawal amounts from gwei). It bounds external balance increases for the no-overflow condition; it is not a gas budget.
Definition windowCredits (blocks : list Block.t) : Z :=
  fold_right (fun block total ⇒
    fold_right (fun tx subtotal ⇒ systemTxCredit tx + subtotal) 0
      (Block.t.transactions block) +
    fold_right (fun wd subtotal ⇒ withdrawalWei wd + subtotal) 0
      (Block.t.withdrawals block) + total) 0 blocks.

State the assumptions for executing a particular list of blocks.
  • signers: list containing the recovered senders of these transactions.
  • until: upper window height; every block height b must satisfy b <= until < b+3, so the list spans at most three heights.
  • verify: block-result verification flag for the execution considered by the CREATE/CREATE2 exclusion.
  • snapshot: initial execution state for these blocks.
  • blocks: the ordered block list; it may be empty.
Result: the conjunction of the fields below. Neither consensus acceptance nor transaction-validation success nor successful execution is assumed.
Initial state conditions, required only at the supplied snapshot.
Decoded-input bounds (including calldata/initcode length at most 2^57 - 9 bytes, the native OCaml string limit), sender membership and the three-height restriction.
Block heights are nondecreasing in the supplied list.
Along this run, creation cannot create a listed non-contract sender or the staking account 0x1000 while it has no ordinary contract code.
Along this run, reached Monad system transactions carry valid staking syscall calldata and satisfy their staking-storage preconditions.
Initial total balance plus all system-transaction and withdrawal credits is below 2^256.
Height of the first block in blocks. For a nonempty valid sequence, subtracting one gives the preceding snapshot's height. Return 0 for an empty list; there is then no transaction whose budget uses this height.
Definition firstBlockHeight (blocks : list Block.t) : N :=
  match blocks with
  | [] ⇒ 0%N
  | first :: _ ⇒ Block.Header.t.number (Block.t.header first)
  end.

Height of the last block in the ordered list blocks, or 0 if empty. This supplies the upper height in WindowConditions, so callers need not provide a separate window endpoint.
Definition lastBlockHeight (blocks : list Block.t) : N :=
  firstBlockHeight (rev blocks).

After executing a prefix, choose the height whose effective reserve thresholds determine the remaining blocks' initial gas budgets. blocks is the remaining list; return its first block's height. If it is empty, return fallback, the height used before executing the prefix; no transactions remain, so this choice cannot affect acceptance. Account balances and configuration come from the post-prefix state: choosing a threshold's height does not select a different execution state.
Definition remainingHeight (fallback : N) (blocks : list Block.t) : N :=
  match blocks with
  | [] ⇒ fallback
  | first :: _ ⇒ Block.Header.t.number (Block.t.header first)
  end.
End Runtime.

Execute a block list using the generated OCaml implementation.
This is a wrapper over E.process_block, automatically translated from OCaml by rocq-of-ocaml, with LLM-supplied termination proofs checked by Rocq. It incorporates the reserve-configuration changes from PR 75 and the staking changes listed in the main theorem's source note.
  • params: the executor's chain ID, revision and tracing flag.
  • verify: whether to compare computed block results with the input block; transaction validation is always performed.
  • snapshot: the execution state before the first block.
  • blocks: the blocks to execute in the supplied order.
Result: inl post is the execution state after all blocks succeed; inr error is the first block-processing error, with no returned post-state. An empty list returns inl snapshot. A transaction's VM revert alone is not a block-processing error. There are no exceptional-result arguments.
This fold calls the generated implementation directly.