Raw File
delegate_cycles.mli
(*****************************************************************************)
(*                                                                           *)
(* Open Source License                                                       *)
(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com>     *)
(* Copyright (c) 2021 Nomadic Labs, <contact@nomadic-labs.com>               *)
(* Copyright (c) 2022 G.B. Fefe, <gb.fefe@protonmail.com>                    *)
(*                                                                           *)
(* Permission is hereby granted, free of charge, to any person obtaining a   *)
(* copy of this software and associated documentation files (the "Software"),*)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense,  *)
(* and/or sell copies of the Software, and to permit persons to whom the     *)
(* Software is furnished to do so, subject to the following conditions:      *)
(*                                                                           *)
(* The above copyright notice and this permission notice shall be included   *)
(* in all copies or substantial portions of the Software.                    *)
(*                                                                           *)
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL   *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING   *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER       *)
(* DEALINGS IN THE SOFTWARE.                                                 *)
(*                                                                           *)
(*****************************************************************************)

(** Per-cycle management of delegates. *)

(** Trigger the context maintenance at the end of cycle 'n', i.e.:
    unfreeze the endorsing rewards, potentially deactivate delegates.
    Return the corresponding balances updates and the list of
    deactivated delegates. *)
val cycle_end :
  Raw_context.t ->
  Cycle_repr.t ->
  (Raw_context.t
  * Receipt_repr.balance_updates
  * Signature.Public_key_hash.t list)
  tzresult
  Lwt.t

(** [init_first_cycles ctxt ~origin] computes and records the distribution of
    the total active stake among active delegates. This concerns the total
    active stake involved in the calculation of baking rights for all cycles
    in the range [0, preserved_cycles]. It also freezes the deposits for all
    the active delegates. *)
val init_first_cycles :
  Raw_context.t ->
  origin:Receipt_repr.update_origin ->
  (Raw_context.t * Receipt_repr.balance_updates) tzresult Lwt.t

module Migration_from_Kathmandu : sig
  val update : Raw_context.t -> Raw_context.t tzresult Lwt.t
end
back to top