diff --git a/src/lib_crypto_dal/cryptobox.ml b/src/lib_crypto_dal/cryptobox.ml index 218c9c189bace0c29198e3d6db93f9c024ca0d8e..d798653b61f928838080a0f9cb1dcd5a2b619de9 100644 --- a/src/lib_crypto_dal/cryptobox.ml +++ b/src/lib_crypto_dal/cryptobox.ml @@ -196,6 +196,8 @@ module Inner = struct let zero = Bls12_381.G1.zero + let equal = Bls12_381.G1.eq + let commitment_to_bytes = Bls12_381.G1.to_compressed_bytes let commitment_of_bytes_opt = Bls12_381.G1.of_compressed_bytes_opt diff --git a/src/lib_crypto_dal/cryptobox_intf.ml b/src/lib_crypto_dal/cryptobox_intf.ml index 6504a0cfc0d279e870f45183df1c90df3bad1b7b..a7db897600a60e33277795e98a032c7a26b5d709 100644 --- a/src/lib_crypto_dal/cryptobox_intf.ml +++ b/src/lib_crypto_dal/cryptobox_intf.ml @@ -41,6 +41,8 @@ module type COMMITMENT = sig val pp : Format.formatter -> t -> unit + val equal : t -> t -> bool + val zero : t end diff --git a/src/lib_protocol_environment/sigs/v7.ml b/src/lib_protocol_environment/sigs/v7.ml index 1532e3d519a7807e978c7f76fdbf0426671c3df8..858a6365c4010a1f70629deb959d52df2beb4789 100644 --- a/src/lib_protocol_environment/sigs/v7.ml +++ b/src/lib_protocol_environment/sigs/v7.ml @@ -11768,6 +11768,8 @@ module Commitment : sig val zero : commitment + val equal : commitment -> commitment -> bool + val pp : Format.formatter -> commitment -> unit end diff --git a/src/lib_protocol_environment/sigs/v7/dal.mli b/src/lib_protocol_environment/sigs/v7/dal.mli index 3435c92f28f749e43a735eea7650eb1407e06d7d..60680553abc09c6085e56420d50d7ac896deb85a 100644 --- a/src/lib_protocol_environment/sigs/v7/dal.mli +++ b/src/lib_protocol_environment/sigs/v7/dal.mli @@ -56,6 +56,8 @@ module Commitment : sig val zero : commitment + val equal : commitment -> commitment -> bool + val pp : Format.formatter -> commitment -> unit end diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 2d05931eb1db4156b72d8048060e7a7d59f1f6b9..1aed19be761840a4372ff588ca59bdb0c28d725d 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2817,6 +2817,8 @@ module Dal : sig val pp : Format.formatter -> t -> unit + val equal : t -> t -> bool + val register_slot : context -> t -> (context * bool) tzresult val find : context -> Raw_level.t -> t list option tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index 4cbcbf56a6da534807f877235406c65d2f8b1124..252986e9be9300c2e3ccc0b74d918ab67d2864c1 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -30,6 +30,8 @@ module Header = struct commitment should be given here. *) type t = Dal.commitment + let equal = Dal.Commitment.equal + let encoding = Dal.Commitment.encoding let pp ppf commitment = @@ -55,6 +57,8 @@ module Index = struct let to_int slot_index = slot_index [@@ocaml.inline always] let compare = Compare.Int.compare + + let equal = Compare.Int.equal end type header = Header.t @@ -65,6 +69,11 @@ type t = {level : Raw_level_repr.t; index : Index.t; header : header} type slot = t +let equal ({level; index; header} : t) s2 = + Raw_level_repr.equal level s2.level + && Index.equal index s2.index + && Header.equal header s2.header + let encoding = let open Data_encoding in conv diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.mli b/src/proto_alpha/lib_protocol/dal_slot_repr.mli index 7dd3e921990c75a6d88f7e299ae943a4cccb5574..6ea6004d57e6c3801fc7ed02b4adf8e29ebaf3f2 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.mli +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.mli @@ -80,6 +80,8 @@ module Index : sig val to_int : t -> int val compare : t -> t -> int + + val equal : t -> t -> bool end type header = Header.t @@ -88,6 +90,8 @@ type t = {level : Raw_level_repr.t; index : Index.t; header : header} type slot = t +val equal : t -> t -> bool + (** The encoding ensures the slot is always a non-negative number. *) val encoding : t Data_encoding.t