Skip to main content

🎛️ Constants_storage.v

Proofs

See code, Gitlab , OCaml

Most of the functions in [Context_storage] module are projections the [ctxt.back.constants] field. This tactic works by destructing the context simulation up to the [constants] field and then applying it

#[local] Ltac ctxt_trivial :=
  match goal with
  | |- Raw_context.Valid.t ?ctxt _
      intros H_ctxt;
      Raw_context.Valid.destruct_rewrite H_ctxt
  end;
  destruct_by_type (Raw_context.Valid.simulation _);
  destruct_by_type (Raw_context.config.Valid.simulation _);
  apply_by_type (Constants_parametric_repr.Valid.t _).

The function [preserved_cycles] is valid
The function [blocks_per_cycles] is valid
The function [blocks_per_commitment] is valid
The function [nonce_revelation_threshold] is valid
The function [blocks_per_stake_snapshot] is valid
The function [cycles_per_voting_period] is valid
The function [hard_gas_limit_per_operation] is valid
Lemma hard_gas_limit_per_operation_is_valid ctxt :
  Raw_context.Valid.simulation ctxt
  Saturation_repr.Valid.t
    ctxt.(Raw_context.config)
      .(Raw_context_aux.config.constants)
        .(Constants_parametric_repr.t.hard_gas_limit_per_operation).
Proof.
  intros [].
  destruct config, constants.
  unfold Gas_limit_repr.Arith.Integral.Valid.t in ×.
  lia.
Qed.

The function [hard_storage_limit_per_operation] is valid
The function [proof_of_work_threshold] is valid
The function [minimal_stake] is valid
The function [vdf_difficulty] is valid
The function [origination_size] is valid
The function [hard_gas_limit_per_block] is valid
Lemma hard_gas_limit_per_block_is_valid ctxt :
  Raw_context.Valid.simulation ctxt
  Saturation_repr.Valid.t
    ctxt.(Raw_context.config)
      .(Raw_context_aux.config.constants)
        .(Constants_parametric_repr.t.hard_gas_limit_per_block).
Proof.
  intros [].
  destruct config, constants.
  unfold Gas_limit_repr.Arith.Integral.Valid.t in ×.
  lia.
Qed.

The function [cost_per_byte] is valid
Lemma cost_per_byte_is_valid ctxt :
  Raw_context.Valid.t ctxt
  Tez_repr.Valid.t
    (Constants_storage.cost_per_byte ctxt).
Proof.
  ctxt_trivial.
Qed.

The function [seed_nonce_revelation_tip] is valid
The function [baking_reward_fixed_portion] is valid
The function [baking_reward_bonus_per_slot] is valid
The function [endorsing_reward_per_slot] is valid
The function [min_proposal_quorum] is valid
Lemma min_proposal_quorum_is_valid ctxt :
  Raw_context.Valid.t ctxt
  Int32.Valid.t (
      Constants_storage.min_proposal_quorum ctxt).
Proof.
  ctxt_trivial.
Qed.

The function [quorum_min] is valid
Lemma quorum_min_is_valid ctxt :
  Raw_context.Valid.t ctxt
  Int32.Valid.t (
      Constants_storage.quorum_min ctxt).
Proof.
  ctxt_trivial.
Qed.

The function [quorum_max] is valid
Lemma quorum_max_is_valid ctxt :
  Raw_context.Valid.t ctxt
  Int32.Valid.t (
      Constants_storage.quorum_max ctxt).
Proof.
  ctxt_trivial.
Qed.

The function [liquidity_baking_subsidy] is valid
The function [liquidity_baking_toggle_ema_threshold] is valid
The function [parametric] is valid
The function [tx_rollup] is valid
The function [sc_rollup] is valid
The function [consensus_committee_size] is valid
[concensus_threshold] is valid
The function [minimal_participation_ratio] is valid
The function [max_slashing_period] is valid
The function [frozen_deposits_percentage] is valid
The function [double_baking_punishment] is valid
Lemma double_baking_punishment_is_valid ctxt :
  Raw_context.Valid.t ctxt
  Tez_repr.Valid.t
    (Constants_storage.double_baking_punishment ctxt).
Proof.
  ctxt_trivial.
Qed.

(* The function [tx_rollup_enable] returns bool, bools are always
   valid, so no need for [tx_rollup_enable_is_valid *)


The function [tx_rollup_sunset_level] is valid
The function [tx_rollup_origination_size] is valid
The function [tx_rollup_hard_size_limit_per_inbox] is valid
The function [tx_rollup_hard_size_limit_per_message] is valid
The function [tx_rollup_max_withdrawals_per_batch] is valid
The function [tx_rollup_commitment_bond] is valid.
The function [tx_rollup_finality_period] is valid
The function [tx_rollup_withdraw_period_is_valid] is valid
The function [tx_rollup_max_inboxes_count] is valid
The function [tx_rollup_max_messages_per_inbox] is valid
The function [tx_rollup_max_commitments_count] is valid
The function [tx_rollup_cost_per_byte_ema_factor] is valid
The function [tx_rollup_max_ticket_payload_size] is valid
The function [tx_rollup_rejection_max_proof_size] is valid
The function [ratio_of_frozen_deposits_slashed_per_double_endorsement] is valid
Lemma ratio_of_frozen_deposits_slashed_per_double_endorsement_is_valid
  ctxt :
  Raw_context.Valid.t ctxt
  Ratio_repr.Valid.t
    (Constants_storage
      .ratio_of_frozen_deposits_slashed_per_double_endorsement ctxt).
Proof.
  ctxt_trivial.
Qed.

(* The function [testnet_dictator] returns [option Signature.public_key_hash],
    there is no validity predicate for hashes, so no
    [testnet_dictator_is_valid] lemma *)


(* The function [sc_rollup_enable] returns a bool, bools are always
   valid, so no [sc_rollup_enable_is_valid] lemma *)


The function [sc_rollup_origination_size] is valid
The function [sc_rollup_challenge_window_in_blocks] is valid
The function [sc_rollup_max_number_of_messages_per_commitment_period] is valid
The function [sc_rollup_stake_amount] is valid
The function [sc_rollup_commitment_period_in_blocks] is valid
The function [sc_rollup_max_lookahead_in_blocks] is valid
The function [sc_rollup_max_active_outbox_levels] is valid
The function [sc_rollup_max_outbox_messages_per_level] is valid
The function [sc_rollup_number_of_sections_in_dissection] is valid
The function [sc_rollup_timeout_period_in_blocks] is valid
The function [max_number_of_stored_cemented_commitments] is valid
The function [dal_number_of_slots] is valid
Lemma dal_number_of_slots_is_valid ctxt :
  Raw_context.Valid.t ctxt
  Pervasives.UInt8.Valid.positive
    (Constants_storage.dal_number_of_slots ctxt).
Proof.
Admitted.

(* The function [dal_enable] returns bool, which is always valid, so
   no need for a [dal_enable_is_valid] lemma *)


(* The function [zk_rollup_enable] returns bool, which is always
   valid, so no need for a [zk_rollup_enable_is_valid] lemma *)


The function [zk_rollup_min_pending_to_process] is valid
The function [zk_rollup_origination_size] is valid
The function [minimal_block_delay] is valid
The function [delay_increment_per_round] is valid