Some docstrings in src/proto/alpha
This commit is contained in:
parent
3e1c4008c3
commit
472f1d53d1
@ -78,7 +78,7 @@ let () =
|
|||||||
~id:"baking.cannot_pay_baking_bond"
|
~id:"baking.cannot_pay_baking_bond"
|
||||||
~title:"Cannot pay baking bond"
|
~title:"Cannot pay baking bond"
|
||||||
~description:
|
~description:
|
||||||
"Impossible to take the required tokens on the baker's contract"
|
"Impossible to debit the required tokens on the baker's contract"
|
||||||
~pp:(fun ppf () -> Format.fprintf ppf "Cannot pay the baking bond")
|
~pp:(fun ppf () -> Format.fprintf ppf "Cannot pay the baking bond")
|
||||||
Data_encoding.unit
|
Data_encoding.unit
|
||||||
(function Cannot_pay_baking_bond -> Some () | _ -> None)
|
(function Cannot_pay_baking_bond -> Some () | _ -> None)
|
||||||
@ -88,7 +88,7 @@ let () =
|
|||||||
~id:"baking.cannot_pay_endorsement_bond"
|
~id:"baking.cannot_pay_endorsement_bond"
|
||||||
~title:"Cannot pay endorsement bond"
|
~title:"Cannot pay endorsement bond"
|
||||||
~description:
|
~description:
|
||||||
"Impossible to take the required tokens on the endorser's contract"
|
"Impossible to debit the required tokens on the endorser's contract"
|
||||||
~pp:(fun ppf () -> Format.fprintf ppf "Cannot pay the endorsement bond")
|
~pp:(fun ppf () -> Format.fprintf ppf "Cannot pay the endorsement bond")
|
||||||
Data_encoding.unit
|
Data_encoding.unit
|
||||||
(function Cannot_pay_endorsement_bond -> Some () | _ -> None)
|
(function Cannot_pay_endorsement_bond -> Some () | _ -> None)
|
||||||
|
@ -20,19 +20,31 @@ type error += Cannot_pay_endorsement_bond (* `Permanent *)
|
|||||||
|
|
||||||
val paying_priorities: context -> int list
|
val paying_priorities: context -> int list
|
||||||
|
|
||||||
val minimal_time: context -> int -> Time.t -> Time.t tzresult Lwt.t
|
|
||||||
(** [minimal_time ctxt priority pred_block_time] returns the minimal
|
(** [minimal_time ctxt priority pred_block_time] returns the minimal
|
||||||
time, given the predecessor block timestamp [pred_block_time],
|
time, given the predecessor block timestamp [pred_block_time],
|
||||||
after which a baker with priority [priority] is allowed to
|
after which a baker with priority [priority] is allowed to
|
||||||
mine. Fail with [Invalid_slot_durations_constant] if the minimal
|
mine. Fail with [Invalid_slot_durations_constant] if the minimal
|
||||||
time cannot be computed. *)
|
time cannot be computed. *)
|
||||||
|
val minimal_time: context -> int -> Time.t -> Time.t tzresult Lwt.t
|
||||||
|
|
||||||
|
(** [pay_baking_bond: cxt baker] Debit the baking bond (See
|
||||||
|
!Constants.baking_bond_cost) from the default account of the
|
||||||
|
[baker]. No bond is debited if the baking priority of this block is
|
||||||
|
greater than the maximum number of paying baking in the network
|
||||||
|
(meaning that n. bakers skipped their turn).
|
||||||
|
|
||||||
|
Raise an error if the baker account does not have enough
|
||||||
|
funds to claim baking rights. *)
|
||||||
val pay_baking_bond:
|
val pay_baking_bond:
|
||||||
context ->
|
context ->
|
||||||
Block_header.proto_header ->
|
Block_header.proto_header ->
|
||||||
public_key_hash ->
|
public_key_hash ->
|
||||||
context tzresult Lwt.t
|
context tzresult Lwt.t
|
||||||
|
|
||||||
|
(** [pay_endorsement_bond: cxt baker] Debit the endorsement bond
|
||||||
|
(See !Constants.endorsement_bond_cost) from the default account
|
||||||
|
of the [baker]. Raise an error if the baker account does not
|
||||||
|
have enough funds to claim endorsement rights *)
|
||||||
val pay_endorsement_bond:
|
val pay_endorsement_bond:
|
||||||
context -> public_key_hash -> (context * Tez.t) tzresult Lwt.t
|
context -> public_key_hash -> (context * Tez.t) tzresult Lwt.t
|
||||||
|
|
||||||
@ -57,27 +69,30 @@ val check_signing_rights:
|
|||||||
reward and the bond, or just the base reward otherwise *)
|
reward and the bond, or just the base reward otherwise *)
|
||||||
val base_baking_reward: context -> priority:int -> Tez.t
|
val base_baking_reward: context -> priority:int -> Tez.t
|
||||||
|
|
||||||
|
(** Returns the endorsement reward calculated w.r.t a given priotiry. *)
|
||||||
val endorsement_reward: block_priority:int -> Tez.t tzresult Lwt.t
|
val endorsement_reward: block_priority:int -> Tez.t tzresult Lwt.t
|
||||||
|
|
||||||
val baking_priorities:
|
|
||||||
context -> Level.t -> public_key_hash lazy_list
|
|
||||||
(** [baking_priorities ctxt level] is the lazy list of contract's
|
(** [baking_priorities ctxt level] is the lazy list of contract's
|
||||||
public key hashes that are allowed to mine for [level]. *)
|
public key hashes that are allowed to mine for [level]. *)
|
||||||
|
val baking_priorities:
|
||||||
|
context -> Level.t -> public_key_hash lazy_list
|
||||||
|
|
||||||
|
(** [endorsement_priorities ctxt level] is the lazy list of contract's
|
||||||
|
public key hashes that are allowed to endorse for [level]. *)
|
||||||
val endorsement_priorities:
|
val endorsement_priorities:
|
||||||
context -> Level.t -> public_key_hash lazy_list
|
context -> Level.t -> public_key_hash lazy_list
|
||||||
|
|
||||||
|
(** [first_baking_priorities ctxt ?max_priority contract_hash level]
|
||||||
|
is a list of priorities of max [?max_priority] elements, where the
|
||||||
|
delegate of [contract_hash] is allowed to mine for [level]. If
|
||||||
|
[?max_priority] is [None], a sensible number of priorities is
|
||||||
|
returned. *)
|
||||||
val first_baking_priorities:
|
val first_baking_priorities:
|
||||||
context ->
|
context ->
|
||||||
?max_priority:int ->
|
?max_priority:int ->
|
||||||
public_key_hash ->
|
public_key_hash ->
|
||||||
Level.t ->
|
Level.t ->
|
||||||
int list tzresult Lwt.t
|
int list tzresult Lwt.t
|
||||||
(** [first_baking_priorities ctxt ?max_priority contract_hash level]
|
|
||||||
is a list of priorities of max [?max_priority] elements, where the
|
|
||||||
delegate of [contract_hash] is allowed to mine for [level]. If
|
|
||||||
[?max_priority] is [None], a sensible number of priorities is
|
|
||||||
returned. *)
|
|
||||||
|
|
||||||
val first_endorsement_slots:
|
val first_endorsement_slots:
|
||||||
context ->
|
context ->
|
||||||
@ -85,13 +100,19 @@ val first_endorsement_slots:
|
|||||||
public_key_hash ->
|
public_key_hash ->
|
||||||
Level.t -> int list tzresult Lwt.t
|
Level.t -> int list tzresult Lwt.t
|
||||||
|
|
||||||
|
(** [check_signature ctxt block id] check if the block is signed with
|
||||||
|
the given key *)
|
||||||
val check_signature:
|
val check_signature:
|
||||||
context -> Block_header.t -> public_key_hash -> unit tzresult Lwt.t
|
context -> Block_header.t -> public_key_hash -> unit tzresult Lwt.t
|
||||||
|
|
||||||
val check_hash: Block_hash.t -> int64 -> bool
|
val check_hash: Block_hash.t -> int64 -> bool
|
||||||
|
|
||||||
|
(** verify if the proof of work stamp is valid *)
|
||||||
val check_proof_of_work_stamp:
|
val check_proof_of_work_stamp:
|
||||||
context -> Block_header.t -> unit tzresult Lwt.t
|
context -> Block_header.t -> unit tzresult Lwt.t
|
||||||
|
|
||||||
|
(** check if the gap between the fitness of the current context
|
||||||
|
and the given block is within the protocol parameters *)
|
||||||
val check_fitness_gap:
|
val check_fitness_gap:
|
||||||
context -> Block_header.t -> unit tzresult Lwt.t
|
context -> Block_header.t -> unit tzresult Lwt.t
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user