Module Tezos_raw_protocol_alpha.Nonce_storage

This module provides types and functions to manipulate nonces.

A nonce is a byte sequence of fixed length, which is supposed to be random and used only once, provided by a block producer and used to generate a random seed (see Seed_repr).

type nonce = t
type Tezos_protocol_environment_alpha.Error_monad.error +=
  1. | Too_late_revelation
  2. | Too_early_revelation
  3. | Already_revealed_nonce
  4. | Inconsistent_nonce
type status =
  1. | Unrevealed of unrevealed
  2. | Revealed of Seed_repr.nonce
type nonce_presence =
  1. | No_nonce_expected
  2. | Nonce_expected of status

Checks that a nonce revelation operation can be safely applied.

  • returns

    Error Too_early_revelation if the current cycle is the cycle 0 or if the previous cycle is lesser than the cycle of the input level.

  • returns

    Error Too_late_revelation if the previous cycle is greater than the cycle of the input level. This error is also returned if the current level cycle position is greater or equal to the nonce revelation threshold.

  • returns

    Error Already_revealed_nonce if a nonce is already revealed in the context for the input level.

  • returns

    Error Inconsistent_nonce if the hash of the input nonce does not correspond to the nonce recover from the context for the given level.

val hash : nonce -> Nonce_hash.t
val check_hash : nonce -> Nonce_hash.t -> bool