diff --git a/CHANGELOG.md b/CHANGELOG.md index 99c56cff..da1d0cfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,7 @@ This name should be decided amongst the team before the release. - [#705](https://github.com/tweag/topiary/pull/705) Added support for Nickel 1.7 extended pattern formatting ### Fixed -- [#720](https://github.com/tweag/topiary/pull/720) [#722](https://github.com/tweag/topiary/pull/722) [#723](https://github.com/tweag/topiary/pull/723) [#724](https://github.com/tweag/topiary/pull/724) Various OCaml improvements +- [#720](https://github.com/tweag/topiary/pull/720) [#722](https://github.com/tweag/topiary/pull/722) [#723](https://github.com/tweag/topiary/pull/723) [#724](https://github.com/tweag/topiary/pull/724) [#735](https://github.com/tweag/topiary/pull/735) Various OCaml improvements ### Changed - [#704](https://github.com/tweag/topiary/pull/704) Refactors our postprocessing code to be more versatile. diff --git a/topiary-cli/tests/samples/expected/ocaml-interface.mli b/topiary-cli/tests/samples/expected/ocaml-interface.mli index baa0c195..78bed214 100644 --- a/topiary-cli/tests/samples/expected/ocaml-interface.mli +++ b/topiary-cli/tests/samples/expected/ocaml-interface.mli @@ -66,7 +66,7 @@ type public_key_hash = Signature.Public_key_hash.t type signature = Signature.t (** This module re-exports definitions from {!Slot_repr}. *) -module Slot: sig +module Slot : sig type t type slot = t @@ -83,7 +83,7 @@ module Slot: sig val encoding : t Data_encoding.encoding - module Range: sig + module Range : sig type t val create : min: int -> count: int -> t tzresult @@ -97,20 +97,20 @@ module Slot: sig ('a -> slot -> 'a tzresult Lwt.t) -> 'a -> t -> 'a tzresult Lwt.t end - module Map: Map.S with type key = t + module Map : Map.S with type key = t - module Set: Set.S with type elt = t + module Set : Set.S with type elt = t - module Internal_for_tests: sig + module Internal_for_tests : sig val of_int : int -> t tzresult end end (** This module re-exports definitions from {!Tez_repr}. *) -module Tez: sig +module Tez : sig type repr - type t = Tez_tag of repr [@@ocaml.unboxed ] + type t = Tez_tag of repr [@@ocaml.unboxed] include BASIC_DATA with type t := t @@ -126,15 +126,15 @@ module Tez: sig val one : tez - val ( -? ): tez -> tez -> tez tzresult + val (-?): tez -> tez -> tez tzresult val sub_opt : tez -> tez -> tez option - val ( +? ): tez -> tez -> tez tzresult + val (+?): tez -> tez -> tez tzresult - val ( *? ): tez -> int64 -> tez tzresult + val (*?): tez -> int64 -> tez tzresult - val ( /? ): tez -> int64 -> tez tzresult + val (/?): tez -> int64 -> tez tzresult val of_string : string -> tez option @@ -152,7 +152,7 @@ module Tez: sig end (** This module re-exports definitions from {!Period_repr}. *) -module Period: sig +module Period : sig include BASIC_DATA type period = t @@ -181,16 +181,16 @@ module Period: sig end (** This module re-exports definitions from {!Time_repr}. *) -module Timestamp: sig +module Timestamp : sig include BASIC_DATA with type t = Time.t type time = t - val ( +? ): time -> Period.t -> time tzresult + val (+?): time -> Period.t -> time tzresult - val ( -? ): time -> time -> Period.t tzresult + val (-?): time -> time -> Period.t tzresult - val ( - ): time -> Period.t -> time + val (-): time -> Period.t -> time val of_notation : string -> time option @@ -212,8 +212,8 @@ module Timestamp: sig end (** This module re-exports definitions from {!Ratio_repr}. *) -module Ratio: sig - type t = { numerator: int; denominator: int } +module Ratio : sig + type t = {numerator: int; denominator: int} val encoding : t Data_encoding.t @@ -221,7 +221,7 @@ module Ratio: sig end (** This module re-exports definitions from {!Raw_level_repr}. *) -module Raw_level: sig +module Raw_level : sig include BASIC_DATA type raw_level = t @@ -242,11 +242,11 @@ module Raw_level: sig val of_int32_exn : int32 -> raw_level - module Set: Set.S with type elt = raw_level + module Set : Set.S with type elt = raw_level - module Map: Map.S with type key = raw_level + module Map : Map.S with type key = raw_level - module Internal_for_tests: sig + module Internal_for_tests : sig val add : raw_level -> int -> raw_level val sub : raw_level -> int -> raw_level option @@ -254,7 +254,7 @@ module Raw_level: sig end (** This module re-exports definitions from {!Cycle_repr}. *) -module Cycle: sig +module Cycle : sig include BASIC_DATA type cycle = t @@ -273,11 +273,11 @@ module Cycle: sig val to_int32 : cycle -> int32 - module Map: Map.S with type key = cycle + module Map : Map.S with type key = cycle end (** This module re-exports definitions from {!Round_repr}. *) -module Round: sig +module Round : sig (* A round represents an iteration of the single-shot consensus algorithm. This mostly simply re-exports [Round_repr]. See [Round_repr] for additional documentation of this module *) @@ -306,7 +306,7 @@ module Round: sig include Compare.S with type t := t - module Map: Map.S with type key = t + module Map : Map.S with type key = t (** See {!Round_repr.Durations.t}. *) type round_durations @@ -320,7 +320,7 @@ module Round: sig (** See {!Round_repr.Durations.round_duration}. *) val round_duration : round_durations -> t -> Period.t - module Durations: sig + module Durations : sig val create : first_round_duration: Period.t -> delay_increment_per_round: Period.t -> @@ -362,7 +362,7 @@ module Round: sig val update : context -> t -> context tzresult Lwt.t end -module Gas: sig +module Gas : sig (** This module implements the gas subsystem of the context. Gas reflects the computational cost of each operation to limit @@ -376,14 +376,14 @@ module Gas: sig *) - module Arith: + module Arith : Fixed_point_repr.Safe with type 'a t = private Saturation_repr.may_saturate Saturation_repr.t (** For maintenance operations or for testing, gas can be [Unaccounted]. Otherwise, the computation is [Limited] by the [remaining] gas in the context. *) - type t = private Unaccounted | Limited of { remaining: Arith.fp } + type t = private Unaccounted | Limited of {remaining: Arith.fp} val encoding : t Data_encoding.encoding @@ -513,21 +513,21 @@ module Gas: sig (** Multiply a cost by a factor. Both arguments are saturated arithmetic values, so no negative numbers are involved. *) - val ( *@ ): _ Saturation_repr.t -> cost -> cost + val (*@): _ Saturation_repr.t -> cost -> cost (** Add two costs together. *) - val ( +@ ): cost -> cost -> cost + val (+@): cost -> cost -> cost (** [cost_of_repr] is an internal operation needed to inject costs for Storage_costs into Gas.cost. *) val cost_of_repr : Gas_limit_repr.cost -> cost end -module Entrypoint: module type of Entrypoint_repr +module Entrypoint : module type of Entrypoint_repr (** This module re-exports definitions from {!Script_repr} and {!Michelson_v1_primitives}. *) -module Script: sig +module Script : sig type error += Lazy_script_decode type prim = Michelson_v1_primitives.prim = @@ -703,7 +703,7 @@ module Script: sig type node = location michelson_node - type t = { code: lazy_expr; storage: lazy_expr } + type t = {code: lazy_expr; storage: lazy_expr} val location_encoding : location Data_encoding.t @@ -766,7 +766,7 @@ end (** This module re-exports definitions from {!Constants_repr} and {!Constants_storage}. *) -module Constants: sig +module Constants : sig (** Fixed constants *) type fixed @@ -791,7 +791,7 @@ module Constants: sig val sc_rollup_max_number_of_messages_per_level : Z.t (** Constants parameterized by context. See {!Constants_parametric_repr}. *) - module Parametric: sig + module Parametric : sig type dal = { feature_enable: bool; number_of_slots: int; @@ -891,7 +891,7 @@ module Constants: sig val encoding : t Data_encoding.t end - module Generated: sig + module Generated : sig type t = { consensus_threshold: int; baking_reward_fixed_portion: Tez.t; @@ -1033,7 +1033,7 @@ module Constants: sig val zk_rollup_min_pending_to_process : context -> int (** All constants: fixed and parametric *) - type t = private { fixed: fixed; parametric: Parametric.t } + type t = private {fixed: fixed; parametric: Parametric.t} val all : context -> t @@ -1041,7 +1041,7 @@ module Constants: sig end (** See the definitions inside the module. *) -module Global_constants_storage: sig +module Global_constants_storage : sig type error += Expression_too_deep type error += Expression_already_registered @@ -1100,7 +1100,7 @@ module Global_constants_storage: sig (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) - module Internal_for_tests: sig + module Internal_for_tests : sig (** [node_too_large node] returns true if: - The number of sub-nodes in the [node] exceeds [Global_constants_storage.node_size_limit]. @@ -1142,13 +1142,13 @@ end (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) -module Internal_for_tests: sig +module Internal_for_tests : sig val to_raw : context -> Raw_context.t end (** This module re-exports definitions from {!Level_repr} and {!Level_storage}. *) -module Level: sig +module Level : sig type t = private { level: Raw_level.t; level_position: int32; @@ -1201,7 +1201,7 @@ module Level: sig end (** This module re-exports definitions from {!Fitness_repr}. *) -module Fitness: sig +module Fitness : sig type error += Invalid_fitness | Wrong_fitness | Outdated_fitness type raw = Fitness.t @@ -1240,14 +1240,14 @@ module Fitness: sig end (** This module re-exports definitions from {!Nonce_storage}. *) -module Nonce: sig +module Nonce : sig type t type nonce = t val encoding : nonce Data_encoding.t - type unrevealed = { nonce_hash: Nonce_hash.t; delegate: public_key_hash } + type unrevealed = {nonce_hash: Nonce_hash.t; delegate: public_key_hash} val record_hash : context -> unrevealed -> context tzresult Lwt.t @@ -1268,7 +1268,7 @@ module Nonce: sig end (** This module re-exports definitions from {!Seed_repr} and {!Seed_storage}. *) -module Seed: sig +module Seed : sig type seed val seed_encoding : seed Data_encoding.t @@ -1282,7 +1282,7 @@ module Seed: sig type vdf_setup = Vdf.discriminant * Vdf.challenge type error += - | Unknown of { oldest: Cycle.t; cycle: Cycle.t; latest: Cycle.t } + | Unknown of {oldest: Cycle.t; cycle: Cycle.t; latest: Cycle.t} | Already_accepted | Unverified_vdf | Too_early_revelation @@ -1304,7 +1304,7 @@ module Seed: sig (* RPC *) type seed_computation_status = | Nonce_revelation_stage - | Vdf_revelation_stage of { seed_discriminant: seed; seed_challenge: seed } + | Vdf_revelation_stage of {seed_discriminant: seed; seed_challenge: seed} | Computation_finished val for_cycle : context -> Cycle.t -> seed tzresult Lwt.t @@ -1318,9 +1318,9 @@ end memory when interacting with it. They are thus suitable for a Michelson contract, for instance, when there are a lot of bindings, but only a few items are accessed at each contract call. *) -module Big_map: sig +module Big_map : sig (** A big map is referenced in the storage by its identifier. *) - module Id: sig + module Id : sig type t = Lazy_storage_kind.Big_map.Id.t val encoding : t Data_encoding.t @@ -1384,14 +1384,14 @@ module Big_map: sig type updates = update list (** The types of keys and values in a big map. *) - type alloc = { key_type: Script_repr.expr; value_type: Script_repr.expr } + type alloc = {key_type: Script_repr.expr; value_type: Script_repr.expr} end (** This module re-exports definitions from {!Sapling_repr}, {!Sapling_storage} and {!Sapling_validator}. *) -module Sapling: sig +module Sapling : sig (** See {!Sapling_state.Id}. *) - module Id: sig + module Id : sig type t val encoding : t Data_encoding.t @@ -1416,7 +1416,7 @@ module Sapling: sig val diff_encoding : diff Data_encoding.t - module Memo_size: sig + module Memo_size : sig type t val encoding : t Data_encoding.t @@ -1430,7 +1430,7 @@ module Sapling: sig val in_memory_size : t -> Cache_memory_helpers.sint end - type state = private { id: Id.t option; diff: diff; memo_size: Memo_size.t } + type state = private {id: Id.t option; diff: diff; memo_size: Memo_size.t} (** Returns a [state] with fields filled accordingly. @@ -1473,7 +1473,7 @@ module Sapling: sig (context * (Int64.t * state) option) tzresult Lwt.t (** See {!Lazy_storage_kind.Sapling_state.alloc}. *) - type alloc = { memo_size: Memo_size.t } + type alloc = {memo_size: Memo_size.t} type updates = diff @@ -1481,7 +1481,7 @@ module Sapling: sig val diff_in_memory_size : diff -> Cache_memory_helpers.sint - module Legacy: sig + module Legacy : sig type transaction = Sapling.UTXO.Legacy.transaction val transaction_encoding : transaction Data_encoding.t @@ -1501,19 +1501,19 @@ module Sapling: sig end (** This module re-exports definitions from {!Lazy_storage_diff}. *) -module Lazy_storage: sig +module Lazy_storage : sig (** This module re-exports definitions from {!Lazy_storage_kind}. *) - module Kind: sig + module Kind : sig type ('id, 'alloc, 'updates) t = | Big_map : (Big_map.Id.t, Big_map.alloc, Big_map.updates) t | Sapling_state : (Sapling.Id.t, Sapling.alloc, Sapling.updates) t end (** This module re-exports definitions from {!Lazy_storage_kind.IdSet}. *) - module IdSet: sig + module IdSet : sig type t - type 'acc fold_f = { f: 'i 'a 'u. ('i, 'a, 'u) Kind.t -> 'i -> 'acc -> 'acc } + type 'acc fold_f = {f: 'i 'a 'u. ('i, 'a, 'u) Kind.t -> 'i -> 'acc -> 'acc} val empty : t @@ -1528,11 +1528,11 @@ module Lazy_storage: sig val fold_all : 'acc fold_f -> t -> 'acc -> 'acc end - type ('id, 'alloc) init = Existing | Copy of { src: 'id } | Alloc of 'alloc + type ('id, 'alloc) init = Existing | Copy of {src: 'id} | Alloc of 'alloc type ('id, 'alloc, 'updates) diff = | Remove - | Update of { init: ('id, 'alloc) init; updates: 'updates } + | Update of {init: ('id, 'alloc) init; updates: 'updates} type diffs_item = private @@ -1556,7 +1556,7 @@ module Lazy_storage: sig end (** See the definitions inside the module. *) -module Origination_nonce: sig +module Origination_nonce : sig (** See {!Raw_context.init_origination_nonce}. *) val init : context -> Operation_hash.t -> context @@ -1565,7 +1565,7 @@ module Origination_nonce: sig (** This module discloses definitions that are only useful for tests and must not be used otherwise. See {!Origination_nonce}. *) - module Internal_for_tests: sig + module Internal_for_tests : sig type t val initial : Operation_hash.t -> t @@ -1575,7 +1575,7 @@ module Origination_nonce: sig end (** This module re-exports definitions from {!Ticket_hash_repr}. *) -module Ticket_hash: sig +module Ticket_hash : sig type t val encoding : t Data_encoding.t @@ -1610,7 +1610,7 @@ module Ticket_hash: sig (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) - module Internal_for_tests: sig + module Internal_for_tests : sig val make_uncarbonated : ticketer: Script.node -> ty: Script.node -> @@ -1621,7 +1621,7 @@ module Ticket_hash: sig end (** This module re-exports definitions from {!Manager_counter_repr}. *) -module Manager_counter: sig +module Manager_counter : sig include Compare.S val succ : t -> t @@ -1630,11 +1630,11 @@ module Manager_counter: sig val encoding_for_RPCs : t Data_encoding.t - module Internal_for_injection: sig + module Internal_for_injection : sig val of_string : string -> t option end - module Internal_for_tests: sig + module Internal_for_tests : sig val of_int : int -> t val to_int : t -> int @@ -1645,7 +1645,7 @@ end (** This module re-exports definitions from {!Contract_repr} and {!Contract_storage}. *) -module Contract: sig +module Contract : sig type t = Implicit of public_key_hash | Originated of Contract_hash.t (** Functions related to contracts address. *) @@ -1770,7 +1770,7 @@ module Contract: sig script: Script.t * Lazy_storage.diffs option -> context tzresult Lwt.t - module Legacy_big_map_diff: sig + module Legacy_big_map_diff : sig type item = private | Update of @@ -1781,7 +1781,7 @@ module Contract: sig diff_value: Script.expr option; } | Clear of Z.t - | Copy of { src: Z.t; dst: Z.t } + | Copy of {src: Z.t; dst: Z.t} | Alloc of { big_map: Z.t; @@ -1795,7 +1795,7 @@ module Contract: sig end (** Functions for handling the delegate of a contract.*) - module Delegate: sig + module Delegate : sig (** See {!Contract_delegate_storage.find}. *) val find : context -> t -> public_key_hash option tzresult Lwt.t @@ -1808,7 +1808,7 @@ module Contract: sig (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) - module Internal_for_tests: sig + module Internal_for_tests : sig (** See {!Contract_repr.originated_contract}. *) val originated_contract : Origination_nonce.Internal_for_tests.t -> t @@ -1817,7 +1817,7 @@ module Contract: sig end (** This module re-exports definitions from {!Tx_rollup_level_repr}. *) -module Tx_rollup_level: sig +module Tx_rollup_level : sig include BASIC_DATA type level = t @@ -1839,7 +1839,7 @@ end (** This module re-exports definitions from {!Tx_rollup_repr} and {!Tx_rollup_storage}. *) -module Tx_rollup: sig +module Tx_rollup : sig include BASIC_DATA val in_memory_size : t -> Cache_memory_helpers.sint @@ -1858,18 +1858,18 @@ module Tx_rollup: sig val originate : context -> (context * t) tzresult Lwt.t - module Set: Set.S with type elt = t + module Set : Set.S with type elt = t (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) - module Internal_for_tests: sig + module Internal_for_tests : sig (** See {!Tx_rollup_repr.originated_tx_rollup}. *) val originated_tx_rollup : Origination_nonce.Internal_for_tests.t -> t end end (** This module re-exports definitions from {!Tx_rollup_withdraw_repr}. *) -module Tx_rollup_withdraw: sig +module Tx_rollup_withdraw : sig type order = { claimer: public_key_hash; ticket_hash: Ticket_hash.t; @@ -1883,7 +1883,7 @@ end (** This module re-exports definitions from {!Tx_rollup_withdraw_list_hash_repr}. *) -module Tx_rollup_withdraw_list_hash: sig +module Tx_rollup_withdraw_list_hash : sig include S.HASH val hash_uncarbonated : Tx_rollup_withdraw.t list -> t @@ -1892,7 +1892,7 @@ module Tx_rollup_withdraw_list_hash: sig end (** This module re-exports definitions from {!Tx_rollup_message_result_repr}. *) -module Tx_rollup_message_result: sig +module Tx_rollup_message_result : sig type t = { context_hash: Context_hash.t; withdraw_list_hash: Tx_rollup_withdraw_list_hash.t; @@ -1907,7 +1907,7 @@ end (** This module re-exports definitions from {!Tx_rollup_message_result_hash_repr}. *) -module Tx_rollup_message_result_hash: sig +module Tx_rollup_message_result_hash : sig include S.HASH val hash_uncarbonated : Tx_rollup_message_result.t -> t @@ -1917,7 +1917,7 @@ end (** This module re-exports definitions from {!Tx_rollup_commitment_repr.Hash}. *) -module Tx_rollup_commitment_hash: sig +module Tx_rollup_commitment_hash : sig val commitment_hash : string include S.HASH @@ -1925,7 +1925,7 @@ end (** This module re-exports definitions from {!Tx_rollup_state_repr} and {!Tx_rollup_state_storage}. *) -module Tx_rollup_state: sig +module Tx_rollup_state : sig type t val initial_state : pre_allocated_storage: Z.t -> t @@ -1955,7 +1955,7 @@ module Tx_rollup_state: sig (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) - module Internal_for_tests: sig + module Internal_for_tests : sig val make : ?burn_per_byte: Tez.t -> ?inbox_ema: int -> @@ -1999,7 +1999,7 @@ end (** This module re-exports definitions from {!Tx_rollup_reveal_repr} and {!Tx_rollup_reveal_storage}. *) -module Tx_rollup_reveal: sig +module Tx_rollup_reveal : sig type t = { contents: Script.lazy_expr; ty: Script.lazy_expr; @@ -2029,7 +2029,7 @@ module Tx_rollup_reveal: sig end (** This module re-exports definitions from {!Tx_rollup_message_repr}. *) -module Tx_rollup_message: sig +module Tx_rollup_message : sig type deposit = { sender: public_key_hash; destination: Tx_rollup_l2_address.Indexable.value; @@ -2061,7 +2061,7 @@ module Tx_rollup_message: sig end (** This module re-exports definitions from {!Tx_rollup_message_hash_repr}. *) -module Tx_rollup_message_hash: sig +module Tx_rollup_message_hash : sig include S.HASH val hash_uncarbonated : Tx_rollup_message.t -> t @@ -2069,8 +2069,8 @@ end (** This module re-exports definitions from {!Tx_rollup_inbox_repr} and {!Tx_rollup_inbox_storage}. *) -module Tx_rollup_inbox: sig - module Merkle: sig +module Tx_rollup_inbox : sig + module Merkle : sig type root type path @@ -2088,11 +2088,11 @@ module Tx_rollup_inbox: sig val path_depth : path -> int end - type t = { inbox_length: int; cumulated_size: int; merkle_root: Merkle.root } + type t = {inbox_length: int; cumulated_size: int; merkle_root: Merkle.root} val size : Z.t - val ( = ): t -> t -> bool + val (=): t -> t -> bool val pp : Format.formatter -> t -> unit @@ -2125,10 +2125,10 @@ module Tx_rollup_inbox: sig end (** This module re-exports definitions from {!Tx_rollup_commitment_repr}. *) -module Tx_rollup_commitment: sig - module Merkle_hash: S.HASH +module Tx_rollup_commitment : sig + module Merkle_hash : S.HASH - module Merkle: + module Merkle : Merkle_list.T with type elt = Tx_rollup_message_result_hash.t and type h = Merkle_hash.t @@ -2140,7 +2140,7 @@ module Tx_rollup_commitment: sig inbox_merkle_root: Tx_rollup_inbox.Merkle.root; } - module Compact: sig + module Compact : sig type excerpt = { count: int; root: Merkle.h; @@ -2156,7 +2156,7 @@ module Tx_rollup_commitment: sig val hash : t -> Tx_rollup_commitment_hash.t end - module Submitted_commitment: sig + module Submitted_commitment : sig type nonrec t = { commitment: Compact.t; commitment_hash: Tx_rollup_commitment_hash.t; @@ -2168,7 +2168,7 @@ module Tx_rollup_commitment: sig val encoding : t Data_encoding.t end - module Full: sig + module Full : sig type t = Tx_rollup_message_result_hash.t list template val encoding : t Data_encoding.t @@ -2261,7 +2261,7 @@ module Tx_rollup_commitment: sig end (** This module re-exports definitions from {!Tx_rollup_hash_builder}. *) -module Tx_rollup_hash: sig +module Tx_rollup_hash : sig val message_result : context -> Tx_rollup_message_result.t -> @@ -2279,11 +2279,11 @@ module Tx_rollup_hash: sig end (** This module re-exports definitions from {!Tx_rollup_errors_repr}. *) -module Tx_rollup_errors: sig +module Tx_rollup_errors : sig type error += | Tx_rollup_already_exists of Tx_rollup.t | Tx_rollup_does_not_exist of Tx_rollup.t - | Submit_batch_burn_exceeded of { burn: Tez.t; limit: Tez.t } + | Submit_batch_burn_exceeded of {burn: Tez.t; limit: Tez.t} | Inbox_does_not_exist of Tx_rollup.t * Tx_rollup_level.t | Inbox_size_would_exceed_limit of Tx_rollup.t | Inbox_count_would_exceed_limit of Tx_rollup.t @@ -2325,7 +2325,7 @@ module Tx_rollup_errors: sig provided: int; limit: int; } - | Wrong_message_path of { expected: Tx_rollup_inbox.Merkle.root } + | Wrong_message_path of {expected: Tx_rollup_inbox.Merkle.root} | No_finalized_commitment_for_level of { level: Tx_rollup_level.t; @@ -2365,14 +2365,14 @@ end Use module [Sc_rollup] instead whenever possible. TODO : find a better way to resolve the circular dependency https://gitlab.com/tezos/tezos/-/issues/3147 *) -module Sc_rollup_repr: sig - module Address: S.HASH +module Sc_rollup_repr : sig + module Address : S.HASH type t = Address.t end (** This module re-exports definitions from {!Bond_id_repr}. *) -module Bond_id: sig +module Bond_id : sig type t = | Tx_rollup_bond_id of Tx_rollup.t | Sc_rollup_bond_id of Sc_rollup_repr.t @@ -2383,7 +2383,7 @@ module Bond_id: sig (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) - module Internal_for_tests: sig + module Internal_for_tests : sig val fold_on_bond_ids : context -> Contract.t -> @@ -2396,8 +2396,8 @@ end (** This module re-exports definitions from {!Zk_rollup_repr} and {!Zk_rollup_storage}. *) -module Zk_rollup: sig - module Address: S.HASH +module Zk_rollup : sig + module Address : S.HASH type t = Address.t @@ -2406,15 +2406,15 @@ module Zk_rollup: sig val to_scalar : t -> scalar (** This module re-exports definitions from {!Zk_rollup_state_repr}. *) - module State: sig + module State : sig type t = scalar array val encoding : t Data_encoding.t end (** This module re-exports definitions from {!Zk_rollup_account_repr}. *) - module Account: sig - module SMap: Map.S with type key = string + module Account : sig + module SMap : Map.S with type key = string type static = { public_parameters: Plonk.public_parameters; @@ -2429,7 +2429,7 @@ module Zk_rollup: sig used_l2_operations_storage_space: Z.t; } - type t = { static: static; dynamic: dynamic } + type t = {static: static; dynamic: dynamic} val encoding : t Data_encoding.t @@ -2438,8 +2438,8 @@ module Zk_rollup: sig end (** This module re-exports definitions from {!Zk_rollup_operation_repr}. *) - module Operation: sig - type price = { id: Ticket_hash.t; amount: Z.t } + module Operation : sig + type price = {id: Ticket_hash.t; amount: Z.t} type t = { op_code: int; @@ -2454,13 +2454,13 @@ module Zk_rollup: sig val to_scalar_array : t -> scalar array end - module Ticket: sig - type t = { contents: Script.expr; ty: Script.expr; ticketer: Contract.t } + module Ticket : sig + type t = {contents: Script.expr; ty: Script.expr; ticketer: Contract.t} val encoding : t Data_encoding.t end - module Circuit_public_inputs: sig + module Circuit_public_inputs : sig type pending_op_public_inputs = { old_state: State.t; new_state: State.t; @@ -2491,12 +2491,12 @@ module Zk_rollup: sig val to_scalar_array : t -> scalar array end - module Update: sig - type op_pi = { new_state: State.t; fee: scalar; exit_validity: bool } + module Update : sig + type op_pi = {new_state: State.t; fee: scalar; exit_validity: bool} - type private_inner_pi = { new_state: State.t; fees: scalar } + type private_inner_pi = {new_state: State.t; fees: scalar} - type fee_pi = { new_state: State.t } + type fee_pi = {new_state: State.t} type t = { pending_pis: (string * op_pi) list; @@ -2509,8 +2509,8 @@ module Zk_rollup: sig end type pending_list = - | Empty of { next_index: int64 } - | Pending of { next_index: int64; length: int } + | Empty of {next_index: int64} + | Pending of {next_index: int64; length: int} val pending_list_encoding : pending_list Data_encoding.t @@ -2558,7 +2558,7 @@ module Zk_rollup: sig val exists : context -> t -> (context * bool) tzresult Lwt.t - module Errors: sig + module Errors : sig type error += | Deposit_as_external | Invalid_deposit_amount @@ -2575,13 +2575,13 @@ module Zk_rollup: sig | Pending_bound end - module Internal_for_tests: sig + module Internal_for_tests : sig val originated_zk_rollup : Origination_nonce.Internal_for_tests.t -> t end end (** This module re-exports definitions from {!Receipt_repr}. *) -module Receipt: sig +module Receipt : sig type balance = | Contract of Contract.t | Block_fees @@ -2627,7 +2627,7 @@ module Receipt: sig end (** This module re-exports definitions from {!Delegate_consensus_key}. *) -module Consensus_key: sig +module Consensus_key : sig type pk = { delegate: Signature.Public_key_hash.t; consensus_pk: Signature.Public_key.t; @@ -2649,7 +2649,7 @@ end (** This module re-exports definitions from {!Delegate_storage}, {!Delegate_consensus_key}, {!Delegate_missed_endorsements_storage}, {!Delegate_slashed_deposits_storage}, {!Delegate_cycles}. *) -module Delegate: sig +module Delegate : sig val check_not_tz4 : Signature.public_key_hash -> unit tzresult val frozen_deposits_limit : @@ -2727,7 +2727,7 @@ module Delegate: sig endorsing_power: int -> context tzresult Lwt.t - type deposits = { initial_amount: Tez.t; current_amount: Tez.t } + type deposits = {initial_amount: Tez.t; current_amount: Tez.t} val frozen_deposits : context -> public_key_hash -> deposits tzresult Lwt.t @@ -2746,7 +2746,7 @@ module Delegate: sig val last_cycle_before_deactivation : context -> public_key_hash -> Cycle.t tzresult Lwt.t - module Consensus_key: sig + module Consensus_key : sig val check_not_tz4 : Signature.public_key -> unit tzresult val active_pubkey : @@ -2767,7 +2767,7 @@ end (** This module re-exports definitions from {!Voting_period_repr} and {!Voting_period_storage}. *) -module Voting_period: sig +module Voting_period : sig type kind = Proposal | Exploration | Cooldown | Promotion | Adoption val kind_encoding : kind Data_encoding.encoding @@ -2799,7 +2799,7 @@ module Voting_period: sig val is_last_block : context -> bool tzresult Lwt.t - type info = { voting_period: t; position: int32; remaining: int32 } + type info = {voting_period: t; position: int32; remaining: int32} val info_encoding : info Data_encoding.t @@ -2809,7 +2809,7 @@ module Voting_period: sig val get_rpc_succ_info : context -> info tzresult Lwt.t - module Testnet_dictator: sig + module Testnet_dictator : sig (** See {!Voting_period_storage.Testnet_dictator.overwrite_current_kind}. *) val overwrite_current_kind : context -> Chain_id.t -> Voting_period_repr.kind -> context tzresult Lwt.t @@ -2817,7 +2817,7 @@ module Voting_period: sig end (** This module re-exports definitions from {!Vote_repr} and {!Vote_storage}. *) -module Vote: sig +module Vote : sig type proposal = Protocol_hash.t (** See {!Vote_storage.get_delegate_proposal_count}. *) @@ -2877,7 +2877,7 @@ module Vote: sig val ballot_encoding : ballot Data_encoding.t - type ballots = { yay: int64; nay: int64; pass: int64 } + type ballots = {yay: int64; nay: int64; pass: int64} (** See {!Vote_storage.ballots_zero}. *) val ballots_zero : ballots @@ -2925,7 +2925,7 @@ module Vote: sig end (** This module exposes definitions for the data-availability layer. *) -module Dal: sig +module Dal : sig type parameters = Dal.parameters = { redundancy_factor: int; page_size: int; @@ -2940,7 +2940,7 @@ module Dal: sig val number_of_slots : context -> int (** This module re-exports definitions from {!Dal_slot_index_repr}. *) - module Slot_index: sig + module Slot_index : sig type t val pp : Format.formatter -> t -> unit @@ -2968,7 +2968,7 @@ module Dal: sig (** This module re-exports definitions from {!Dal_attestation_repr} and {!Raw_context.Dal}. *) - module Attestation: sig + module Attestation : sig type t type operation = { @@ -2979,7 +2979,7 @@ module Dal: sig type shard_index = int - module Shard_map: Map.S with type key = shard_index + module Shard_map : Map.S with type key = shard_index val encoding : t Data_encoding.t @@ -3009,14 +3009,14 @@ module Dal: sig val init_committee : context -> committee -> context end - type slot_id = { published_level: Raw_level.t; index: Slot_index.t } + type slot_id = {published_level: Raw_level.t; index: Slot_index.t} - module Page: sig + module Page : sig type content = bytes val pages_per_slot : parameters -> int - module Index: sig + module Index : sig type t = int val encoding : int Data_encoding.t @@ -3028,7 +3028,7 @@ module Dal: sig val equal : int -> int -> bool end - type t = { slot_id: slot_id; page_index: Index.t } + type t = {slot_id: slot_id; page_index: Index.t} val content_encoding : content Data_encoding.t @@ -3043,9 +3043,9 @@ module Dal: sig (** This module re-exports definitions from {!Dal_slot_repr}, {!Dal_slot_storage} and {!Raw_context.Dal}. *) - module Slot: sig + module Slot : sig (** This module re-exports definitions from {!Dal_slot_repr.Header}. *) - module Commitment: sig + module Commitment : sig type t = Dal.commitment val encoding : t Data_encoding.t @@ -3053,7 +3053,7 @@ module Dal: sig val zero : t end - module Commitment_proof: sig + module Commitment_proof : sig type t = Dal.commitment_proof val encoding : t Data_encoding.t @@ -3061,10 +3061,10 @@ module Dal: sig val zero : t end - module Header: sig - type id = slot_id = { published_level: Raw_level.t; index: Slot_index.t } + module Header : sig + type id = slot_id = {published_level: Raw_level.t; index: Slot_index.t} - type t = { id: id; commitment: Commitment.t } + type t = {id: id; commitment: Commitment.t} val id_encoding : id Data_encoding.t @@ -3088,8 +3088,8 @@ module Dal: sig context -> (context * Attestation.t) tzresult Lwt.t end - module Operations: sig - module Publish_slot_header: sig + module Operations : sig + module Publish_slot_header : sig type t = { published_level: Raw_level.t; slot_index: Slot_index.t; @@ -3112,7 +3112,7 @@ module Dal: sig end end - module Slots_history: sig + module Slots_history : sig type t type hash @@ -3127,7 +3127,7 @@ module Dal: sig val hash : t -> hash - module History_cache: + module History_cache : Bounded_history_repr.S with type key = hash and type value = t val add_confirmed_slot_headers_no_cache : @@ -3142,20 +3142,20 @@ module Dal: sig type proof end - module Slots_storage: sig + module Slots_storage : sig val get_slot_headers_history : context -> Slots_history.t tzresult Lwt.t end end (** This module re-exports definitions from {!Dal_errors_repr}. *) -module Dal_errors: sig +module Dal_errors : sig (* DAL/FIXME: https://gitlab.com/tezos/tezos/-/issues/3168 do not expose these errors and return them in functions from Dal_slot_repr or Dal_attestation_repr. *) type error += | Dal_feature_disabled | Dal_slot_index_above_hard_limit - | Dal_attestation_unexpected_size of { expected: int; got: int } + | Dal_attestation_unexpected_size of {expected: int; got: int} | Dal_publish_slot_header_future_level of { provided: Raw_level.t; @@ -3171,9 +3171,9 @@ module Dal_errors: sig given: Dal.Slot_index.t; maximum: Dal.Slot_index.t; } - | Dal_publish_slot_header_candidate_with_low_fees of { proposed_fees: Tez.t } - | Dal_attestation_size_limit_exceeded of { maximum_size: int; got: int } - | Dal_publish_slot_header_duplicate of { slot_header: Dal.Slot.Header.t } + | Dal_publish_slot_header_candidate_with_low_fees of {proposed_fees: Tez.t} + | Dal_attestation_size_limit_exceeded of {maximum_size: int; got: int} + | Dal_publish_slot_header_duplicate of {slot_header: Dal.Slot.Header.t} | Dal_publish_slot_header_invalid_proof of { commitment: Dal.Slot.Commitment.t; @@ -3194,14 +3194,14 @@ module Dal_errors: sig current: Raw_level.t; given: Raw_level.t; } - | Dal_cryptobox_error of { explanation: string } + | Dal_cryptobox_error of {explanation: string} end (** This module re-exports definitions from {!Sc_rollup_storage} and {!Sc_rollup_repr}. *) -module Sc_rollup: sig +module Sc_rollup : sig (** See {!Sc_rollup_tick_repr}. *) - module Tick: sig + module Tick : sig type t val initial : t @@ -3226,7 +3226,7 @@ module Sc_rollup: sig include Compare.S with type t := t - module Map: Map.S with type key = t + module Map : Map.S with type key = t end module Address = Sc_rollup_repr.Address @@ -3239,9 +3239,9 @@ module Sc_rollup: sig val must_exist : context -> t -> context tzresult Lwt.t - module Staker: S.SIGNATURE_PUBLIC_KEY_HASH with type t = public_key_hash + module Staker : S.SIGNATURE_PUBLIC_KEY_HASH with type t = public_key_hash - module State_hash: sig + module State_hash : sig include S.HASH val context_hash_to_state_hash : Context_hash.t -> t @@ -3254,8 +3254,8 @@ module Sc_rollup: sig end (** See {!Sc_rollup_metadata_repr}. *) - module Metadata: sig - type t = { address: rollup; origination_level: Raw_level.t } + module Metadata : sig + type t = {address: rollup; origination_level: Raw_level.t} val pp : Format.formatter -> t -> unit @@ -3265,7 +3265,7 @@ module Sc_rollup: sig end (** See {!Sc_rollup_inbox_message_repr}. *) - module Inbox_message: sig + module Inbox_message : sig type internal_inbox_message = | Transfer of { @@ -3296,13 +3296,13 @@ module Sc_rollup: sig val deserialize : serialized -> t tzresult - module Hash: S.HASH + module Hash : S.HASH val hash_serialized_message : serialized -> Hash.t end - module Inbox_merkelized_payload_hashes: sig - module Hash: S.HASH + module Inbox_merkelized_payload_hashes : sig + module Hash : S.HASH type t @@ -3321,7 +3321,7 @@ module Sc_rollup: sig payload: Inbox_message.serialized; } - module History: sig + module History : sig include Bounded_history_repr.S with type key = Hash.t and type value = merkelized_and_payload @@ -3344,7 +3344,7 @@ module Sc_rollup: sig val verify_proof : proof -> (t * t) tzresult - module Internal_for_tests: sig + module Internal_for_tests : sig val find_predecessor_payload : History.t -> index: Z.t -> t -> t option val make_proof : t list -> proof @@ -3376,7 +3376,7 @@ module Sc_rollup: sig val input_encoding : input Data_encoding.t - module Input_hash: S.HASH + module Input_hash : S.HASH type reveal = | Reveal_raw_data of Sc_rollup_reveal_hash.t @@ -3395,7 +3395,7 @@ module Sc_rollup: sig val pp_input_request : Format.formatter -> input_request -> unit - module Inbox: sig + module Inbox : sig type t val pp : Format.formatter -> t -> unit @@ -3414,9 +3414,9 @@ module Sc_rollup: sig val pp_history_proof : Format.formatter -> history_proof -> unit - module Hash: S.HASH + module Hash : S.HASH - module History: + module History : Bounded_history_repr.S with type key = Hash.t and type value = history_proof @@ -3493,7 +3493,7 @@ module Sc_rollup: sig Raw_level.t -> t tzresult - module Internal_for_tests: sig + module Internal_for_tests : sig val produce_inclusion_proof : (Hash.t -> history_proof option Lwt.t) -> history_proof -> @@ -3521,16 +3521,16 @@ module Sc_rollup: sig val get_inbox : context -> (t * context) tzresult Lwt.t end - module Outbox: sig + module Outbox : sig (** See {!Sc_rollup_outbox_message_repr}. *) - module Message: sig + module Message : sig type transaction = { unparsed_parameters: Script.expr; destination: Contract_hash.t; entrypoint: Entrypoint.t; } - type t = Atomic_transaction_batch of { transactions: transaction list } + type t = Atomic_transaction_batch of {transactions: transaction list} type serialized @@ -3559,15 +3559,15 @@ module Sc_rollup: sig val output_encoding : output Data_encoding.t - module Dissection_chunk: sig - type t = { state_hash: State_hash.t option; tick: Tick.t } + module Dissection_chunk : sig + type t = {state_hash: State_hash.t option; tick: Tick.t} val equal : t -> t -> bool val pp : Format.formatter -> t -> unit type error += - | Dissection_number_of_sections_mismatch of { expected: Z.t; given: Z.t } + | Dissection_number_of_sections_mismatch of {expected: Z.t; given: Z.t} | Dissection_invalid_number_of_sections of Z.t | Dissection_start_hash_mismatch of { @@ -3587,7 +3587,7 @@ module Sc_rollup: sig | Dissection_invalid_successive_states_shape end - module PVM: sig + module PVM : sig type boot_sector = string module type S = sig @@ -3654,7 +3654,7 @@ module Sc_rollup: sig val get_current_level : state -> Raw_level.t option Lwt.t - module Internal_for_tests: sig + module Internal_for_tests : sig val insert_failure : state -> state Lwt.t end end @@ -3669,10 +3669,10 @@ module Sc_rollup: sig type t = Packed : ('state, 'proof, 'output) implementation -> t - [@@unboxed ] + [@@unboxed] end - module Kind: sig + module Kind : sig type t = Example_arith | Wasm_2_0_0 val encoding : t Data_encoding.t @@ -3690,9 +3690,9 @@ module Sc_rollup: sig val equal : t -> t -> bool end - module ArithPVM: sig + module ArithPVM : sig module type P = sig - module Tree: + module Tree : Context.TREE with type key = string list and type value = bytes type tree = Tree.tree @@ -3713,7 +3713,7 @@ module Sc_rollup: sig (proof * 'a) option Lwt.t end - module Make (C: P) : sig + module Make (C : P) : sig include PVM.S with type context = C.Tree.t and type state = C.tree @@ -3736,14 +3736,14 @@ module Sc_rollup: sig val reference_initial_state_hash : State_hash.t - module Protocol_implementation: + module Protocol_implementation : PVM.S with type context = Context.t and type state = Context.tree and type proof = Context.Proof.tree Context.Proof.t end - module Wasm_2_0_0PVM: sig + module Wasm_2_0_0PVM : sig val ticks_per_snapshot : Z.t val outbox_validity_period : int32 @@ -3755,7 +3755,7 @@ module Sc_rollup: sig val well_known_reveal_hash : Sc_rollup_reveal_hash.t module type P = sig - module Tree: + module Tree : Context.TREE with type key = string list and type value = bytes type tree = Tree.tree @@ -3780,7 +3780,7 @@ module Sc_rollup: sig module type Make_wasm = module type of Wasm_2_0_0.Make - module Make (Wasm_backend: Make_wasm) (C: P) : sig + module Make (Wasm_backend : Make_wasm) (C : P) : sig include PVM.S with type context = C.Tree.t and type state = C.tree @@ -3801,7 +3801,7 @@ module Sc_rollup: sig context -> input option -> state -> proof tzresult Lwt.t end - module Protocol_implementation: + module Protocol_implementation : PVM.S with type context = Context.t and type state = Context.tree @@ -3810,14 +3810,14 @@ module Sc_rollup: sig val reference_initial_state_hash : State_hash.t end - module Number_of_ticks: sig + module Number_of_ticks : sig include Bounded.S with type ocaml_type := int64 val zero : t end - module Commitment: sig - module Hash: S.HASH + module Commitment : sig + module Hash : S.HASH type t = { compressed_state: State_hash.t; @@ -3837,7 +3837,7 @@ module Sc_rollup: sig val genesis_commitment : origination_level: Raw_level.t -> genesis_state_hash: State_hash.t -> t - type genesis_info = { level: Raw_level.t; commitment_hash: Hash.t } + type genesis_info = {level: Raw_level.t; commitment_hash: Hash.t} val genesis_info_encoding : genesis_info Data_encoding.t @@ -3867,11 +3867,11 @@ module Sc_rollup: sig val kind : context -> t -> (context * Kind.t) tzresult Lwt.t - module Errors: sig + module Errors : sig type error += Sc_rollup_does_not_exist of t end - module Proof: sig + module Proof : sig type reveal_proof = | Raw_data_proof of string | Metadata_proof @@ -3891,7 +3891,7 @@ module Sc_rollup: sig | Reveal_proof of reveal_proof | First_inbox_message - type 'proof t = { pvm_step: 'proof; input_proof: input_proof option } + type 'proof t = {pvm_step: 'proof; input_proof: input_proof option} type serialized = private string @@ -3920,7 +3920,7 @@ module Sc_rollup: sig val reveal : Sc_rollup_reveal_hash.t -> string option Lwt.t - module Inbox_with_history: sig + module Inbox_with_history : sig val inbox : Inbox.history_proof val get_history : Inbox.Hash.t -> Inbox.history_proof option Lwt.t @@ -3930,7 +3930,7 @@ module Sc_rollup: sig Inbox_merkelized_payload_hashes.History.t Lwt.t end - module Dal_with_history: sig + module Dal_with_history : sig val confirmed_slots_history : Dal.Slots_history.t val get_history : @@ -3964,7 +3964,7 @@ module Sc_rollup: sig serialized t tzresult Lwt.t end - module Game: sig + module Game : sig type player = Alice | Bob val player_equal : player -> player -> bool @@ -4002,8 +4002,8 @@ module Sc_rollup: sig val pp : Format.formatter -> t -> unit - module Index: sig - type t = private { alice: Staker.t; bob: Staker.t } + module Index : sig + type t = private {alice: Staker.t; bob: Staker.t} val encoding : t Data_encoding.t @@ -4024,7 +4024,7 @@ module Sc_rollup: sig player_commitment_hash: Commitment.Hash.t; opponent_commitment_hash: Commitment.Hash.t; } - | Move of { choice: Tick.t; step: step } + | Move of {choice: Tick.t; step: step} val refutation_encoding : refutation Data_encoding.t @@ -4036,7 +4036,7 @@ module Sc_rollup: sig val reason_encoding : reason Data_encoding.t - type game_result = Loser of { reason: reason; loser: Staker.t } | Draw + type game_result = Loser of {reason: reason; loser: Staker.t} | Draw val pp_game_result : Format.formatter -> game_result -> unit @@ -4070,7 +4070,7 @@ module Sc_rollup: sig choice: Tick.t -> (game_result, t) Either.t tzresult Lwt.t - type timeout = { alice: int; bob: int; last_turn_level: Raw_level.t } + type timeout = {alice: int; bob: int; last_turn_level: Raw_level.t} val timeout_encoding : timeout Data_encoding.t @@ -4094,7 +4094,7 @@ module Sc_rollup: sig } | Dissecting_during_final_move - module Internal_for_tests: sig + module Internal_for_tests : sig val check_dissection : default_number_of_sections: int -> start_chunk: dissection_chunk -> @@ -4104,7 +4104,7 @@ module Sc_rollup: sig end end - module Stake_storage: sig + module Stake_storage : sig val find_staker : context -> t -> @@ -4134,8 +4134,8 @@ module Sc_rollup: sig context -> t -> (Staker.t * Commitment.Hash.t option) list tzresult Lwt.t end - module Refutation_storage: sig - type point = { commitment: Commitment.t; hash: Commitment.Hash.t } + module Refutation_storage : sig + type point = {commitment: Commitment.t; hash: Commitment.Hash.t} type conflict_point = point * point @@ -4189,7 +4189,7 @@ module Sc_rollup: sig Game.game_result -> (Game.status * context * Receipt.balance_updates) tzresult Lwt.t - module Internal_for_tests: sig + module Internal_for_tests : sig val get_conflict_point : context -> t -> @@ -4208,13 +4208,13 @@ module Sc_rollup: sig (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) - module Internal_for_tests: sig + module Internal_for_tests : sig val originated_sc_rollup : Origination_nonce.Internal_for_tests.t -> t end end (** This module re-exports definitions from {!Destination_repr}. *) -module Destination: sig +module Destination : sig type t = | Contract of Contract.t | Tx_rollup of Tx_rollup.t @@ -4241,7 +4241,7 @@ module Destination: sig end (** See {!Block_payload_repr}. *) -module Block_payload: sig +module Block_payload : sig (** See {!Block_payload_repr.hash}. *) val hash : predecessor_hash: Block_hash.t -> @@ -4251,7 +4251,7 @@ module Block_payload: sig end (** This module re-exports definitions from {!Block_header_repr}. *) -module Block_header: sig +module Block_header : sig type contents = { payload_hash: Block_payload_hash.t; payload_round: Round.t; @@ -4261,9 +4261,9 @@ module Block_header: sig Liquidity_baking_repr.liquidity_baking_toggle_vote; } - type protocol_data = { contents: contents; signature: signature } + type protocol_data = {contents: contents; signature: signature} - type t = { shell: Block_header.shell_header; protocol_data: protocol_data } + type t = {shell: Block_header.shell_header; protocol_data: protocol_data} type block_header = t @@ -4277,7 +4277,7 @@ module Block_header: sig val of_watermark : Signature.watermark -> block_watermark option - module Proof_of_work: sig + module Proof_of_work : sig val check_hash : Block_hash.t -> int64 -> bool val check_header_proof_of_work_stamp : @@ -4353,14 +4353,14 @@ module Block_header: sig end (** This module re-exports definitions from {!Cache_repr}. *) -module Cache: sig +module Cache : sig type size = int type index = int type cache_nonce - module Admin: sig + module Admin : sig type key type value @@ -4426,7 +4426,7 @@ module Cache: sig end (** This module re-exports definitions from {!Lazy_storage_kind}. *) -module Kind: sig +module Kind : sig type preendorsement_consensus_kind = Preendorsement_consensus_kind type endorsement_consensus_kind = Endorsement_consensus_kind @@ -4869,7 +4869,7 @@ type packed_operation = { val manager_kind : 'kind manager_operation -> 'kind Kind.manager (** This module re-exports definitions from {!Operation_repr}. *) -module Operation: sig +module Operation : sig type nonrec 'kind contents = 'kind contents type nonrec packed_contents = packed_contents @@ -4894,7 +4894,7 @@ module Operation: sig val unsigned_encoding : (Operation.shell_header * packed_contents_list) Data_encoding.t - type raw = Operation.t = { shell: Operation.shell_header; proto: bytes } + type raw = Operation.t = {shell: Operation.shell_header; proto: bytes} val raw_encoding : raw Data_encoding.t @@ -4940,7 +4940,7 @@ module Operation: sig val equal : 'a operation -> 'b operation -> ('a, 'b) eq option - module Encoding: sig + module Encoding : sig type 'b case = | Case : { @@ -5051,7 +5051,7 @@ module Operation: sig val zk_rollup_update_case : Kind.zk_rollup_update Kind.manager case - module Manager_operations: sig + module Manager_operations : sig type 'b case = | MCase : { @@ -5136,7 +5136,7 @@ end (** This module re-exports definitions from {!Stake_storage}, {!Delegate_storage} and {!Delegate}. *) -module Stake_distribution: sig +module Stake_distribution : sig val snapshot : context -> context tzresult Lwt.t val compute_snapshot_index : @@ -5154,7 +5154,7 @@ end (** This module re-exports definitions from {!Commitment_repr} and, {!Commitment_storage}. *) -module Commitment: sig +module Commitment : sig type t = { blinded_public_key_hash: Blinded_public_key_hash.t; amount: Tez.tez; @@ -5167,12 +5167,12 @@ module Commitment: sig end (** This module re-exports definitions from {!Bootstrap_storage}. *) -module Bootstrap: sig +module Bootstrap : sig val cycle_end : context -> Cycle.t -> context tzresult Lwt.t end (** This module re-exports definitions from {!Migration_repr}. *) -module Migration: sig +module Migration : sig type origination_result = { balance_updates: Receipt.balance_updates; originated_contracts: Contract_hash.t list; @@ -5233,7 +5233,7 @@ val finalize : val current_context : context -> Context.t (** This module re-exports definitions from {!Parameters_repr}. *) -module Parameters: sig +module Parameters : sig type bootstrap_account = { public_key_hash: public_key_hash; public_key: public_key option; @@ -5264,7 +5264,7 @@ end (** This module re-exports definitions from {!Liquidity_baking_repr} and {!Liquidity_baking_storage}. *) -module Liquidity_baking: sig +module Liquidity_baking : sig type liquidity_baking_toggle_vote = Liquidity_baking_repr.liquidity_baking_toggle_vote = | LB_on @@ -5276,7 +5276,7 @@ module Liquidity_baking: sig val get_cpmm_address : context -> Contract_hash.t tzresult Lwt.t - module Toggle_EMA: sig + module Toggle_EMA : sig type t val zero : t @@ -5294,9 +5294,9 @@ module Liquidity_baking: sig end (** This module re-exports definitions from {!Ticket_storage}. *) -module Ticket_balance: sig +module Ticket_balance : sig type error += - | Negative_ticket_balance of { key: Ticket_hash.t; balance: Z.t } + | Negative_ticket_balance of {key: Ticket_hash.t; balance: Z.t} | Used_storage_space_underflow val adjust_balance : @@ -5310,20 +5310,20 @@ module Ticket_balance: sig (** This module discloses definitions that are only useful for tests and must not be used otherwise. *) - module Internal_for_tests: sig + module Internal_for_tests : sig val used_storage_space : context -> Z.t tzresult Lwt.t val paid_storage_space : context -> Z.t tzresult Lwt.t end end -module First_level_of_protocol: sig +module First_level_of_protocol : sig (** Get the level of the first block of this protocol. *) val get : context -> Raw_level.t tzresult Lwt.t end (** This module re-exports definitions from {!Raw_context.Consensus}. *) -module Consensus: sig +module Consensus : sig include Raw_context.CONSENSUS with type t := t and type slot := Slot.t @@ -5346,7 +5346,7 @@ module Consensus: sig end (** This module re-exports definitions from {!Token}. *) -module Token: sig +module Token : sig type container = [`Contract of Contract.t | `Collected_commitments of Blinded_public_key_hash.t | `Delegate_balance of public_key_hash @@ -5397,7 +5397,7 @@ module Token: sig end (** This module re-exports definitions from {!Fees_storage}. *) -module Fees: sig +module Fees : sig val record_paid_storage_space : context -> Contract_hash.t -> (context * Z.t * Z.t) tzresult Lwt.t diff --git a/topiary-cli/tests/samples/expected/ocaml.ml b/topiary-cli/tests/samples/expected/ocaml.ml index c6c7048d..833beb3b 100644 --- a/topiary-cli/tests/samples/expected/ocaml.ml +++ b/topiary-cli/tests/samples/expected/ocaml.ml @@ -73,7 +73,7 @@ let create n = let n = if n < 1 then 1 else n in let n = if n > Sys.max_string_length then Sys.max_string_length else n in let s = Bytes.create n in - { buffer = s; position = 0; length = n; initial_buffer = s } + {buffer = s; position = 0; length = n; initial_buffer = s} let contents b = Bytes.sub_string b.buffer 0 b.position let to_bytes b = Bytes.sub b.buffer 0 b.position @@ -510,7 +510,7 @@ end module My_types = struct type nonrec t = t - type my_rec = { my_bool: bool; } + type my_rec = {my_bool: bool;} end module type Printer = sig @@ -576,7 +576,7 @@ let is_prime n = !no_divisor let unbox_rec = function - | Some My_types.{ my_bool } -> my_bool + | Some My_types.{my_bool} -> my_bool | _ -> false let unbox_bool = function @@ -682,7 +682,7 @@ type a = int and b = float (* Messing around with quoted strings and curly brackets *) -type string_record = { my_string: string; } +type string_record = {my_string: string;} let quoted_string = {|Hello|} and quoted_string_multiline_with_id = @@ -771,9 +771,9 @@ end module type T2 = sig end -module M: T2 = struct end +module M : T2 = struct end -module F (X: T1) (Y: T1 with type t := X.t) = struct +module F (X : T1) (Y : T1 with type t := X.t) = struct module type S = sig type t = X.t @@ -830,7 +830,7 @@ let x = function bar let _ = - foo <- { slug; }; + foo <- {slug;}; bar let _ = 12 [@deprecated "12 is deprecated, use 13 instead"] @@ -971,20 +971,20 @@ let x = (* Multi-line functor signatures *) module Lift - (Credit: module type of CreditSignature) - (Dance: module type of DanceSignature) - (Tune: module type of TuneSignature) - (Version: module type of VersionSignature) + (Credit : module type of CreditSignature) + (Dance : module type of DanceSignature) + (Tune : module type of TuneSignature) + (Version : module type of VersionSignature) = struct let foo = x end -module MOption: - functor (A: SERIALISABLE) -> +module MOption : + functor (A : SERIALISABLE) -> SERIALISABLE with type t = A.t option -module MUnit: SERIALISABLE with +module MUnit : SERIALISABLE with type t = unit (* Ensure labelled arguments are correctly spaced *) @@ -995,7 +995,7 @@ let _ = type query = (string * string list) list type x = ('any Slug.t -> bool) -> float let id (type s) (x : s) : s = x -type foo = { a: 'a. ('a, mandatory) arg -> 'a; } +type foo = {a: 'a. ('a, mandatory) arg -> 'a;} type foo = (int, int) result (* types with constraints *) @@ -1020,7 +1020,7 @@ let x = ] (* New line for structures in module definitions *) -module MFloat: SERIALISABLE with +module MFloat : SERIALISABLE with type t = float = struct type t = float [@@deriving yojson] @@ -1028,9 +1028,9 @@ module MFloat: SERIALISABLE with end module Make - (R: sig end) - (S: sig end) - (T: sig end) + (R : sig end) + (S : sig end) + (T : sig end) (* Showcase usage of line number directive. Line breaks could be improved. *) module Foo = struct @@ -1134,7 +1134,7 @@ let () = foo; bar;%lwt baz (* #644: softlines before module definition in a module type *) module type F = sig - module G: sig val h : string end + module G : sig val h : string end type ('state, 'proof, 'output) implementation = ( @@ -1150,9 +1150,9 @@ let peer_functor : (module Peer.F) = if !listening then (module Server) else (module Client) (* #646: multi-line functor type formatted as single-line*) -module Make: - functor (I: Interface.S) -> - functor (_: Transport.S with type payload = I.data Payload.t) -> +module Make : + functor (I : Interface.S) -> + functor (_ : Transport.S with type payload = I.data Payload.t) -> S (* #647: missing space for pattern matching of constructor holding list *) @@ -1163,14 +1163,14 @@ let _ = (* #719: missing space for pattern matching of constructor holding record *) let _ = match foo with - | Bar { baz } -> qux + | Bar {baz} -> qux (* #721: unbalanced spacing around parenthesized expressions *) let _ = (begin end) (* #718: indentations and newlines around final-argument continuations *) let eval_tree ~addr ~source_path (tree : Syn.tree) = - let fm = { T.empty_frontmatter with addr; source_path } in + let fm = {T.empty_frontmatter with addr; source_path} in Frontmatter.run ~init: fm @@ fun () -> Emitted_trees.run ~init: [] @@ fun () -> Jobs.run ~init: [] @@ fun () -> @@ -1180,7 +1180,7 @@ let eval_tree ~addr ~source_path (tree : Syn.tree) = let main = eval_tree_inner ~addr tree in let side = Emitted_trees.get () in let jobs = Jobs.get () in - { main; side; jobs } + {main; side; jobs} (* #660 dangling functions *) let foo x = fun y -> @@ -1219,6 +1219,22 @@ let () = | u -> vvvvvvvvv ) +(* #728 missing space in module function arguments *) +let foo + (bar : int) + (module Baz : BAZTYPE) + = + Baz.foo bar + +(* #729 Spacing in single-line records *) +let _ = [a; b; c] +let _ = [|a; b; c|] +let _ = {a; b; c} +type x = [`Foo | `Bar] +type x = [> `Foo | `Bar] +type x = [< `Foo | `Bar] +type x = {a: int; b: int; c: int} + (* #659 handling of the `;;` separator *) let bonjour () = "Bonjour" diff --git a/topiary-cli/tests/samples/input/ocaml.ml b/topiary-cli/tests/samples/input/ocaml.ml index 886acceb..dfaabc9d 100644 --- a/topiary-cli/tests/samples/input/ocaml.ml +++ b/topiary-cli/tests/samples/input/ocaml.ml @@ -1151,6 +1151,22 @@ let () = | u -> vvvvvvvvv ) +(* #728 missing space in module function arguments *) +let foo + (bar : int) + (module Baz : BAZTYPE) + = + Baz.foo bar + +(* #729 Spacing in single-line records *) +let _ = [a; b; c] +let _ = [|a; b; c|] +let _ = { a; b; c } +type x = [`Foo | `Bar] +type x = [> `Foo | `Bar] +type x = [< `Foo | `Bar] +type x = { a: int; b: int; c: int } + (* #659 handling of the `;;` separator *) let bonjour () = "Bonjour" diff --git a/topiary-queries/queries/ocaml.scm b/topiary-queries/queries/ocaml.scm index c0a1ee8c..5bf75d2f 100644 --- a/topiary-queries/queries/ocaml.scm +++ b/topiary-queries/queries/ocaml.scm @@ -214,7 +214,6 @@ "|" "->" "<-" - "{" ":" ";" "+=" @@ -412,6 +411,7 @@ [ (constructor_name) (fun_expression) + (module_name) (parenthesized_expression) (value_name) (value_pattern) @@ -447,7 +447,6 @@ "struct" "then" "with" - "{" ";" ] @append_spaced_softline . @@ -467,7 +466,6 @@ "struct" "then" "with" - "{" ";" ] . @@ -527,11 +525,11 @@ (item_attribute) "*" "|" - "}" ] @prepend_spaced_softline [ (match_expression) + "}" ] @prepend_empty_softline ; Softline before the first match case @@ -784,7 +782,7 @@ ) (record_declaration - (field_declaration) @prepend_spaced_softline + (field_declaration) @prepend_empty_softline ) ; Allow multi-line attributes after field declaratioms, such as: @@ -835,7 +833,7 @@ ) (record_expression - (field_expression) @prepend_spaced_softline + (field_expression) @prepend_empty_softline ) (record_expression @@ -1624,6 +1622,23 @@ "<-" @append_spaced_softline @append_indent_start ) @append_indent_end +; Antispaces for brackets and parentheses +( + [ + "(" + "[" + "[|" + "{" + ] @append_antispace +) +( + [ + ")" + "]" + "|]" + "}" + ] @prepend_antispace +) ; Input softlines before and after all comments. This means that the input ; decides if a comment should have line breaks before or after. But don't put a ; softline directly in front of commas or semicolons.