Proto_alpha/levels: added documentation

This commit is contained in:
Raphaël Proust 2018-05-30 15:40:03 +08:00
parent 17457ef0a3
commit f647404739
2 changed files with 23 additions and 4 deletions

View File

@ -8,15 +8,31 @@
(**************************************************************************)
type t = private {
level: Raw_level_repr.t ;
level_position: int32 ;
cycle: Cycle_repr.t ;
cycle_position: int32 ;
level: Raw_level_repr.t (** The level of the block relative to genesis. This
is also the Shell's notion of level. *);
level_position: int32 (** The level of the block relative to the block that
starts protocol alpha. This is specific to the
protocol alpha. Other protocols might or might not
include a similar notion. *);
cycle: Cycle_repr.t (** The current cycle's number. Note that cycles are a
protocol-specific notion. As a result, the cycle
number starts at 0 with the first block of protocol
alpha. *);
cycle_position: int32 (** The current level of the block relative to the first
block of the current cycle. *);
voting_period: Voting_period_repr.t ;
voting_period_position: int32 ;
expected_commitment: bool ;
}
(* Note that, the type `t` above must respect some invariants (hence the
`private` annotation). Notably:
level_position = cycle * blocks_per_cycle + cycle_position
*)
type level = t
include Compare.S with type t := level

View File

@ -7,6 +7,9 @@
(* *)
(**************************************************************************)
(** The shell's notion of a level: an integer indicating the number of blocks
since genesis: genesis is 0, all other blocks have increasing levels from
there. *)
type t
type raw_level = t
val encoding: raw_level Data_encoding.t