diff --git a/src/http_info.ml b/src/http_info.ml index 97b80e03..ad4fc4e7 100644 --- a/src/http_info.ml +++ b/src/http_info.ml @@ -83,7 +83,7 @@ let mk_keys ~db_conn (module Keys : Keys.S) ~last_issue_date = | None -> denom_l | Some timestamp -> List.filter - (fun v -> Timestamp.geq v.Denomination.stamp_start timestamp) + (fun v -> Timestamp.compare timestamp v.Denomination.stamp_start <= 0) denom_l in let* denominations = Denomination.make_denom_group_sorted denom_l in diff --git a/src/http_management.ml b/src/http_management.ml index f1b67201..04fc9a51 100644 --- a/src/http_management.ml +++ b/src/http_management.ml @@ -122,7 +122,7 @@ module Auditors = struct Logs.info (fun m -> m "enabled auditor"); () | Some auditor -> - if Timestamp.geq auditor.last_change validity_start then + if Timestamp.compare validity_start auditor.last_change <= 0 then Error "replay detected on enable-auditor" else let+ () = Pg.update_auditor db_conn auditor |> unwrap_err_caqti in @@ -157,7 +157,7 @@ module Auditors_disable = struct match opt with | None -> Error "auditor not found" | Some auditor -> ( - if Timestamp.geq auditor.last_change validity_end then + if Timestamp.compare validity_end auditor.last_change <= 0 then Error "replay detected on disable-auditor" else match auditor.is_active with @@ -384,7 +384,7 @@ module Wire = struct Logs.info (fun m -> m "added wire method"); () | Some (wire, _is_active, last_change) -> - if Timestamp.geq last_change validity_start then + if Timestamp.compare validity_start last_change <= 0 then Error "replay detected on enable-wire" else let+ () = @@ -423,7 +423,7 @@ module Wire_disable = struct match opt with | None -> Error "wire not found" | Some (wire, _is_active, last_change) -> - if Timestamp.geq last_change validity_end then + if Timestamp.compare validity_end last_change <= 0 then Error "replay detected on disable-wire" else let+ () = diff --git a/src/signkey.ml b/src/signkey.ml index 78e4ea46..2f0763be 100644 --- a/src/signkey.ml +++ b/src/signkey.ml @@ -19,4 +19,5 @@ let verify_exchange_signing_key_validity ~key sk = } let is_valid_at ~timestamp sk = - Timestamp.geq sk.stamp_start timestamp && Timestamp.lt timestamp sk.stamp_end + Timestamp.compare sk.stamp_start timestamp <= 0 + && Timestamp.compare timestamp sk.stamp_end < 0 diff --git a/src/time.ml b/src/time.ml index b05cf5fb..634a9dff 100644 --- a/src/time.ml +++ b/src/time.ml @@ -97,10 +97,6 @@ module Timestamp = struct let never = uint64_max let zero = 0L let compare = Int64.unsigned_compare - let gt a b = compare a b > 0 - let geq a b = compare a b >= 0 - let lt a b = compare a b < 0 - let leq a b = compare a b <= 0 let equal a b = compare a b = 0 let min a b = if compare a b < 0 then a else b let max a b = if compare a b > 0 then a else b diff --git a/src/time.mli b/src/time.mli index dc4bd841..a7c038b3 100644 --- a/src/time.mli +++ b/src/time.mli @@ -37,10 +37,6 @@ module Timestamp : sig val never : t val zero : t val compare : t -> t -> int - val gt : t -> t -> bool - val geq : t -> t -> bool - val lt : t -> t -> bool - val leq : t -> t -> bool val equal : t -> t -> bool val min : t -> t -> t val max : t -> t -> t