Module Octez_baking_common.Signing_delay

val env_var : string
val enforce_signing_delay_gating : allow:bool -> unit

Enforce that if the environment variable signing_delay_env_var is set, then signing delay is allowed in the current configuration.

If not, print an error message and exit the program with code 1.

val pp_float : Stdlib.Format.formatter -> float -> unit
val section : string list
module Events : sig ... end
val artificial_delay_opt : float option

artificial_delay_opt is None if no artificial delay is configured, or Some d where d is a random delay in seconds to wait before signing.

The environment variable TEZOS_SIGN_DELAY_I_KNOW_WHAT_I_AM_DOING can be set to configure an artificial delay. Its value must be either:

  • a single non-negative float d, in which case the delay will be a random value uniformly distributed in 0, d;
  • two non-negative floats d1, d2 separated by a comma, with d1 <= d2, in which case the delay will be a random value uniformly distributed in d1, d2.

If the environment variable is set but has an invalid value, then no delay is configured and an error message is printed.

val sign_with_minimum_duration : (module Tezos_profiler.Profiler.GLOBAL_PROFILER) -> (unit -> 'a Lwt.t) -> 'a Lwt.t

sign_with_minimum_duration (module Profiler) sign_f runs sign_f () and ensures the call takes at least the configured artificial delay. A profiler module is needed to ensure correct profiling of the signature.

If artificial_delay_opt = Some d, it runs sign_f () and waits for a delay of d seconds concurrently. The function returns the result of the signing only after both the signing operation and the delay have elapsed. This makes the total duration of the call at least d seconds.

If no delay is configured, it just runs sign_f ().