diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 8ab973a73d011edd39f2c4bb1043dc9c0849bbb8..e6ecfa1eec42368269e5e0f417dc09f8c33cecc7 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2500,7 +2500,7 @@ module Delegate : sig val staking_balance : context -> public_key_hash -> Tez.t tzresult Lwt.t val min_delegated_in_current_cycle : - context -> public_key_hash -> Tez.t tzresult Lwt.t + context -> public_key_hash -> (Tez.t * Level_repr.t option) tzresult Lwt.t val has_pending_denunciations : context -> public_key_hash -> bool Lwt.t diff --git a/src/proto_alpha/lib_protocol/delegate_services.ml b/src/proto_alpha/lib_protocol/delegate_services.ml index b8e5ac3a68c52faa0e64481a5d412251c261914c..e48962d5b71811ad0958ce78eaebc761e07388c9 100644 --- a/src/proto_alpha/lib_protocol/delegate_services.ml +++ b/src/proto_alpha/lib_protocol/delegate_services.ml @@ -108,6 +108,13 @@ let consensus_key_info_encoding = consensus_key_encoding)) [])) +let min_delegated_in_current_cycle_encoding = + let open Data_encoding in + conv + (fun (min_delegated, anchor) -> (min_delegated, anchor)) + (fun (min_delegated, anchor) -> (min_delegated, anchor)) + (obj2 (req "amount" Tez.encoding) (opt "level" Level_repr.encoding)) + type info = { full_balance : Tez.t; current_frozen_deposits : Tez.t; @@ -116,7 +123,7 @@ type info = { frozen_deposits_limit : Tez.t option; delegated_contracts : Contract.t list; delegated_balance : Tez.t; - min_delegated_in_current_cycle : Tez.t; + min_delegated_in_current_cycle : Tez.t * Level_repr.t option; total_delegated_stake : Tez.t; staking_denominator : Staking_pseudotoken.t; deactivated : bool; @@ -199,7 +206,9 @@ let info_encoding = (opt "frozen_deposits_limit" Tez.encoding) (req "delegated_contracts" (list Contract.encoding)) (req "delegated_balance" Tez.encoding) - (req "min_delegated_in_current_cycle" Tez.encoding) + (req + "min_delegated_in_current_cycle" + min_delegated_in_current_cycle_encoding) (req "deactivated" bool) (req "grace_period" Cycle.encoding)) (merge_objs @@ -419,9 +428,10 @@ module S = struct RPC_service.get_service ~description: "Returns the minimum of delegated tez (in mutez) over the current \ - cycle." + cycle and the block level where this value was last updated (* Level \ + is `None` when decoding values from protocol O)." ~query:RPC_query.empty - ~output:Tez.encoding + ~output:min_delegated_in_current_cycle_encoding RPC_path.(path / "min_delegated_in_current_cycle") let deactivated = diff --git a/src/proto_alpha/lib_protocol/delegate_services.mli b/src/proto_alpha/lib_protocol/delegate_services.mli index 16bdf5f9dd9c02b9f9a03d08f0716df4a550cd83..60b8df658ecf86ff1be99a807898e291e8e3e6fe 100644 --- a/src/proto_alpha/lib_protocol/delegate_services.mli +++ b/src/proto_alpha/lib_protocol/delegate_services.mli @@ -61,7 +61,7 @@ type info = { frozen_deposits_limit : Tez.t option; delegated_contracts : Contract.t list; delegated_balance : Tez.t; - min_delegated_in_current_cycle : Tez.t; + min_delegated_in_current_cycle : Tez.t * Level_repr.t option; total_delegated_stake : Tez.t; staking_denominator : Staking_pseudotoken.t; deactivated : bool; diff --git a/src/proto_alpha/lib_protocol/delegate_storage.ml b/src/proto_alpha/lib_protocol/delegate_storage.ml index 75fea2802c5cee71cab82b933eebafbcf421252d..f978a854ecb8e978db2f74bc04165bc40e892098 100644 --- a/src/proto_alpha/lib_protocol/delegate_storage.ml +++ b/src/proto_alpha/lib_protocol/delegate_storage.ml @@ -400,10 +400,24 @@ module For_RPC = struct let+ staking_balance = Stake_storage.get_full_staking_balance ctxt delegate in - Full_staking_balance_repr.min_delegated_in_cycle - ~current_cycle - staking_balance - else return Tez_repr.zero + let min_delegated = + Full_staking_balance_repr.min_delegated_in_cycle + ~current_cycle + staking_balance + in + let level_of_min_delegated = + match + Full_staking_balance_repr.Internal_for_tests_and_RPCs + .level_of_min_delegated + staking_balance + with + | None -> None + | Some level -> + if Cycle_repr.(level.cycle < current_cycle) then None + else Some level + in + (min_delegated, level_of_min_delegated) + else return (Tez_repr.zero, None) let delegated_balance ctxt delegate = let open Lwt_result_syntax in diff --git a/src/proto_alpha/lib_protocol/delegate_storage.mli b/src/proto_alpha/lib_protocol/delegate_storage.mli index 58c91f85e8e53aa60c8252bd332f4c54671c17b7..a5ef9fd9f9e26fcfa5526be27e9de777bf7be092 100644 --- a/src/proto_alpha/lib_protocol/delegate_storage.mli +++ b/src/proto_alpha/lib_protocol/delegate_storage.mli @@ -162,5 +162,7 @@ module For_RPC : sig Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t tzresult Lwt.t val min_delegated_in_current_cycle : - Raw_context.t -> Signature.Public_key_hash.t -> Tez_repr.t tzresult Lwt.t + Raw_context.t -> + Signature.Public_key_hash.t -> + (Tez_repr.t * Level_repr.t option) tzresult Lwt.t end diff --git a/src/proto_alpha/lib_protocol/full_staking_balance_repr.ml b/src/proto_alpha/lib_protocol/full_staking_balance_repr.ml index d2cf0eb1c75b2684c056fda70d30b0bbd96e4d63..4322c273bdc9e2a4d150bb21b4465951eee4dc2f 100644 --- a/src/proto_alpha/lib_protocol/full_staking_balance_repr.ml +++ b/src/proto_alpha/lib_protocol/full_staking_balance_repr.ml @@ -5,21 +5,39 @@ (* *) (*****************************************************************************) +(** This module is responsible for the construction, observation and encoding of + full staking balances that are maintained to be used at cycle end to compute + staking rights. + + The module will handle a lazy migration starting at protocol P that adds two + new fields to the balance, the minimal delegated balance over the cycle and + the last level at which it has been modified. + As there is no trivial default value for Level_repr, the + level_of_min_delegated is optional but the module must preserve the + invariant that if a min_delegated_in_cycle has been stored, a level is + stored with it. +*) + type t = { own_frozen : Tez_repr.t; staked_frozen : Tez_repr.t; delegated : Tez_repr.t; min_delegated_in_cycle : Tez_repr.t; - cycle_of_min_delegated : Cycle_repr.t; + level_of_min_delegated : Level_repr.t option; } -let init ~own_frozen ~staked_frozen ~delegated ~current_cycle = +let cycle_of_min_delegated (level_of_min_delegated : Level_repr.t option) = + match level_of_min_delegated with + | None -> Cycle_repr.root + | Some l -> l.cycle + +let init ~own_frozen ~staked_frozen ~delegated ~current_level = { own_frozen; staked_frozen; delegated; min_delegated_in_cycle = delegated; - cycle_of_min_delegated = current_cycle; + level_of_min_delegated = Some current_level; } let encoding = @@ -27,12 +45,13 @@ let encoding = (* This encoding is backward-compatible with the encoding used in Oxford, so as to avoid a stitching in P. It will act as a lazy migration. The case in which [added_in_p] is [None] happen only for pre-existing - values in the storage. For them, using [(delegated, Cycle_repr.root)] - should behave correctly. *) + values in the storage. + For them, using [(delegated, None)] and using Cycle_repr.root when no level + is set will behave correctly. *) let added_in_p = obj2 (req "min_delegated_in_cycle" Tez_repr.encoding) - (req "cycle_of_min_delegated" Cycle_repr.encoding) + (req "level_of_min_delegated" (option Level_repr.encoding)) in conv (fun { @@ -40,28 +59,28 @@ let encoding = staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } -> ( own_frozen, staked_frozen, delegated, - Some (min_delegated_in_cycle, cycle_of_min_delegated) )) + Some (min_delegated_in_cycle, level_of_min_delegated) )) (fun (own_frozen, staked_frozen, delegated, added_in_p_opt) -> - let min_delegated_in_cycle, cycle_of_min_delegated = - added_in_p_opt |> Option.value ~default:(delegated, Cycle_repr.root) + let min_delegated_in_cycle, level_of_min_delegated = + added_in_p_opt |> Option.value ~default:(delegated, None) in { own_frozen; staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; }) (obj4 (req "own_frozen" Tez_repr.encoding) (req "staked_frozen" Tez_repr.encoding) (req "delegated" Tez_repr.encoding) - (varopt "min_delegated_in_cycle_and_cycle" added_in_p)) + (varopt "min_delegated_in_cycle_and_level" added_in_p)) let voting_weight { @@ -69,7 +88,7 @@ let voting_weight staked_frozen; delegated; min_delegated_in_cycle = _; - cycle_of_min_delegated = _; + level_of_min_delegated = _; } = let open Result_syntax in let* frozen = Tez_repr.(own_frozen +? staked_frozen) in @@ -82,7 +101,7 @@ let apply_slashing ~percentage staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } = let remaining_percentage = Percentage.neg percentage in let own_frozen = @@ -96,7 +115,7 @@ let apply_slashing ~percentage staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } let own_frozen @@ -105,7 +124,7 @@ let own_frozen staked_frozen = _; delegated = _; min_delegated_in_cycle = _; - cycle_of_min_delegated = _; + level_of_min_delegated = _; } = own_frozen @@ -115,7 +134,7 @@ let staked_frozen staked_frozen; delegated = _; min_delegated_in_cycle = _; - cycle_of_min_delegated = _; + level_of_min_delegated = _; } = staked_frozen @@ -125,7 +144,7 @@ let total_frozen staked_frozen; delegated = _; min_delegated_in_cycle = _; - cycle_of_min_delegated = _; + level_of_min_delegated = _; } = Tez_repr.(own_frozen +? staked_frozen) @@ -135,7 +154,7 @@ let current_delegated staked_frozen = _; delegated; min_delegated_in_cycle = _; - cycle_of_min_delegated = _; + level_of_min_delegated = _; } = delegated @@ -150,8 +169,9 @@ let min_delegated_in_cycle ~current_cycle staked_frozen = _; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } = + let cycle_of_min_delegated = cycle_of_min_delegated level_of_min_delegated in if Cycle_repr.(cycle_of_min_delegated < current_cycle) then delegated else ( assert (Cycle_repr.(cycle_of_min_delegated = current_cycle)) ; @@ -163,7 +183,7 @@ let current_total staked_frozen; delegated; min_delegated_in_cycle = _; - cycle_of_min_delegated = _; + level_of_min_delegated = _; } = let open Result_syntax in let* total_frozen = Tez_repr.(own_frozen +? staked_frozen) in @@ -175,7 +195,7 @@ let own_ratio staked_frozen; delegated = _; min_delegated_in_cycle = _; - cycle_of_min_delegated = _; + level_of_min_delegated = _; } = if Tez_repr.(staked_frozen = zero) then (1L, 1L) else if Tez_repr.(own_frozen = zero) then (0L, 1L) @@ -201,29 +221,35 @@ let has_minimal_stake_to_be_considered ~minimal_stake full_staking_balance = (* If the total overflows, we are definitely over the minimal stake. *) | Ok staking_balance -> Tez_repr.(staking_balance >= minimal_stake) -let remove_delegated ~current_cycle ~amount +let remove_delegated ~(current_level : Level_repr.t) ~amount { own_frozen; staked_frozen; delegated; - min_delegated_in_cycle; - cycle_of_min_delegated; + min_delegated_in_cycle = old_min_delegated_in_cycle; + level_of_min_delegated; } = let open Result_syntax in let+ delegated = Tez_repr.(delegated -? amount) in - let min_delegated_in_cycle = + let cycle_of_min_delegated = cycle_of_min_delegated level_of_min_delegated in + let current_cycle = current_level.cycle in + let min_delegated_in_cycle, level_of_min_delegated = if Cycle_repr.(cycle_of_min_delegated < current_cycle) then - (* after decrease *) delegated + (* after decrease *) (delegated, Some current_level) else ( assert (Cycle_repr.(cycle_of_min_delegated = current_cycle)) ; - Tez_repr.min delegated min_delegated_in_cycle) + let minimum = Tez_repr.min delegated old_min_delegated_in_cycle in + ( minimum, + if Tez_repr.(minimum = old_min_delegated_in_cycle) then + level_of_min_delegated + else Some current_level )) in { own_frozen; staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated = current_cycle; + level_of_min_delegated; } let remove_own_frozen ~amount @@ -232,7 +258,7 @@ let remove_own_frozen ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } = let open Result_syntax in let+ own_frozen = Tez_repr.(own_frozen -? amount) in @@ -241,7 +267,7 @@ let remove_own_frozen ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } let remove_staked_frozen ~amount @@ -250,7 +276,7 @@ let remove_staked_frozen ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } = let open Result_syntax in let+ staked_frozen = Tez_repr.(staked_frozen -? amount) in @@ -259,24 +285,26 @@ let remove_staked_frozen ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } -let add_delegated ~current_cycle ~amount +let add_delegated ~(current_level : Level_repr.t) ~amount { own_frozen; staked_frozen; delegated; - min_delegated_in_cycle; - cycle_of_min_delegated; + min_delegated_in_cycle = old_min_delegated_in_cycle; + level_of_min_delegated; } = let open Result_syntax in - let min_delegated_in_cycle = + let cycle_of_min_delegated = cycle_of_min_delegated level_of_min_delegated in + let current_cycle = current_level.cycle in + let min_delegated_in_cycle, level_of_min_delegated = if Cycle_repr.(cycle_of_min_delegated < current_cycle) then - (* before increase *) delegated + (* before increase *) (delegated, Some current_level) else ( assert (Cycle_repr.(cycle_of_min_delegated = current_cycle)) ; - min_delegated_in_cycle) + (old_min_delegated_in_cycle, level_of_min_delegated)) in let+ delegated = Tez_repr.(delegated +? amount) in { @@ -284,7 +312,7 @@ let add_delegated ~current_cycle ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated = current_cycle; + level_of_min_delegated; } let add_own_frozen ~amount @@ -293,7 +321,7 @@ let add_own_frozen ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } = let open Result_syntax in let+ own_frozen = Tez_repr.(own_frozen +? amount) in @@ -302,7 +330,7 @@ let add_own_frozen ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } let add_staked_frozen ~amount @@ -311,7 +339,7 @@ let add_staked_frozen ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } = let open Result_syntax in let+ staked_frozen = Tez_repr.(staked_frozen +? amount) in @@ -320,27 +348,27 @@ let add_staked_frozen ~amount staked_frozen; delegated; min_delegated_in_cycle; - cycle_of_min_delegated; + level_of_min_delegated; } -module Internal_for_tests = struct +module Internal_for_tests_and_RPCs = struct let min_delegated_in_cycle { own_frozen = _; staked_frozen = _; delegated = _; min_delegated_in_cycle; - cycle_of_min_delegated = _; + level_of_min_delegated = _; } = min_delegated_in_cycle - let cycle_of_min_delegated + let level_of_min_delegated { own_frozen = _; staked_frozen = _; delegated = _; min_delegated_in_cycle = _; - cycle_of_min_delegated; + level_of_min_delegated; } = - cycle_of_min_delegated + level_of_min_delegated end diff --git a/src/proto_alpha/lib_protocol/full_staking_balance_repr.mli b/src/proto_alpha/lib_protocol/full_staking_balance_repr.mli index 8ff2033e76b74d0842775d33df302d61e1879b49..c628320ce32888240e5ac3de496dcd1b8cb4b0b3 100644 --- a/src/proto_alpha/lib_protocol/full_staking_balance_repr.mli +++ b/src/proto_alpha/lib_protocol/full_staking_balance_repr.mli @@ -11,7 +11,7 @@ val init : own_frozen:Tez_repr.t -> staked_frozen:Tez_repr.t -> delegated:Tez_repr.t -> - current_cycle:Cycle_repr.t -> + current_level:Level_repr.t -> t val encoding : t Data_encoding.t @@ -45,21 +45,21 @@ val has_minimal_frozen_stake : minimal_frozen_stake:Tez_repr.t -> t -> bool val has_minimal_stake_to_be_considered : minimal_stake:Tez_repr.t -> t -> bool val remove_delegated : - current_cycle:Cycle_repr.t -> amount:Tez_repr.t -> t -> t tzresult + current_level:Level_repr.t -> amount:Tez_repr.t -> t -> t tzresult val remove_own_frozen : amount:Tez_repr.t -> t -> t tzresult val remove_staked_frozen : amount:Tez_repr.t -> t -> t tzresult val add_delegated : - current_cycle:Cycle_repr.t -> amount:Tez_repr.t -> t -> t tzresult + current_level:Level_repr.t -> amount:Tez_repr.t -> t -> t tzresult val add_own_frozen : amount:Tez_repr.t -> t -> t tzresult val add_staked_frozen : amount:Tez_repr.t -> t -> t tzresult -module Internal_for_tests : sig +module Internal_for_tests_and_RPCs : sig val min_delegated_in_cycle : t -> Tez_repr.t - val cycle_of_min_delegated : t -> Cycle_repr.t + val level_of_min_delegated : t -> Level_repr.t option end diff --git a/src/proto_alpha/lib_protocol/level_repr.ml b/src/proto_alpha/lib_protocol/level_repr.ml index f3daac4d0d5ec87649d484fab32c89e0ff2efbac..7805ce15cf2c2d08ad7fb76b4df7398ee7c343f4 100644 --- a/src/proto_alpha/lib_protocol/level_repr.ml +++ b/src/proto_alpha/lib_protocol/level_repr.ml @@ -355,4 +355,13 @@ module Internal_for_tests = struct level_position = Int32.add level.level_position (Int32.of_int (n * blocks_per_cycle)); } + + let root = + { + level = Raw_level_repr.root; + level_position = 0l; + cycle = Cycle_repr.root; + cycle_position = 0l; + expected_commitment = false; + } end diff --git a/src/proto_alpha/lib_protocol/level_repr.mli b/src/proto_alpha/lib_protocol/level_repr.mli index 0c2800556dc296a572ae84f080a6e0f93a58e060..7b208cd6ecf104e09f05957f1c00fdb5453aaf52 100644 --- a/src/proto_alpha/lib_protocol/level_repr.mli +++ b/src/proto_alpha/lib_protocol/level_repr.mli @@ -116,6 +116,8 @@ module Internal_for_tests : sig val add_level : t -> int -> t val add_cycles : blocks_per_cycle:int -> t -> int -> t + + val root : t end (**/**) diff --git a/src/proto_alpha/lib_protocol/stake_storage.ml b/src/proto_alpha/lib_protocol/stake_storage.ml index 50c81bae2dbb3cb99be794f0938a70b5741123e3..53ad57c4fe74e8f6917a5c321b1f0f7b2d1aacf5 100644 --- a/src/proto_alpha/lib_protocol/stake_storage.ml +++ b/src/proto_alpha/lib_protocol/stake_storage.ml @@ -92,13 +92,13 @@ let has_minimal_stake ctxt staking_balance = let initialize_delegate ctxt delegate ~delegated = let open Lwt_result_syntax in - let current_cycle = (Raw_context.current_level ctxt).cycle in + let current_level = Raw_context.current_level ctxt in let balance = Full_staking_balance_repr.init ~own_frozen:Tez_repr.zero ~staked_frozen:Tez_repr.zero ~delegated - ~current_cycle + ~current_level in let* ctxt = Storage.Stake.Staking_balance.init ctxt delegate balance in if has_minimal_stake ctxt balance then @@ -150,8 +150,8 @@ let update_stake ~f ctxt delegate = | false, false | true, true -> return ctxt let remove_delegated_stake ctxt delegate amount = - let current_cycle = (Raw_context.current_level ctxt).cycle in - let f = Full_staking_balance_repr.remove_delegated ~current_cycle ~amount in + let current_level = Raw_context.current_level ctxt in + let f = Full_staking_balance_repr.remove_delegated ~current_level ~amount in update_stake ctxt delegate ~f let remove_own_frozen_stake ctxt delegate amount = @@ -174,8 +174,8 @@ let remove_frozen_stake_only_call_from_token ctxt staker amount = remove_staked_frozen_stake ctxt delegate amount let add_delegated_stake ctxt delegate amount = - let current_cycle = (Raw_context.current_level ctxt).cycle in - let f = Full_staking_balance_repr.add_delegated ~current_cycle ~amount in + let current_level = Raw_context.current_level ctxt in + let f = Full_staking_balance_repr.add_delegated ~current_level ~amount in update_stake ctxt delegate ~f let add_own_frozen_stake ctxt delegate amount = diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index a5f8122cbe842a5334a6e20a86dd81c10cdb3864..cf48ec07fd3467c6b30961ba666524700ef90af5 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -487,7 +487,7 @@ module Delegate = struct frozen_deposits_limit : Tez.t option; delegated_contracts : Alpha_context.Contract.t list; delegated_balance : Tez.t; - min_delegated_in_current_cycle : Tez.t; + min_delegated_in_current_cycle : Tez.t * Level_repr.t option; total_delegated_stake : Tez.t; staking_denominator : Staking_pseudotoken.t; deactivated : bool; diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.mli b/src/proto_alpha/lib_protocol/test/helpers/context.mli index 67429874ad712c7bf7de84e03e03bfba0e0c0fd7..c6593218e140dba410168db0cafcdcfc89e6ba49 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/context.mli @@ -257,7 +257,7 @@ module Delegate : sig frozen_deposits_limit : Tez.t option; delegated_contracts : Alpha_context.Contract.t list; delegated_balance : Tez.t; - min_delegated_in_current_cycle : Tez.t; + min_delegated_in_current_cycle : Tez.t * Level_repr.t option; total_delegated_stake : Tez.t; staking_denominator : Staking_pseudotoken.t; deactivated : bool; diff --git a/src/proto_alpha/lib_protocol/test/unit/test_full_staking_balance_repr.ml b/src/proto_alpha/lib_protocol/test/unit/test_full_staking_balance_repr.ml index 3bcfa0b873780b7e04ff6b848eeb9f311da56877..6c9f2a893580a54e1f0f1fb8b5823d88b128a408 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_full_staking_balance_repr.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_full_staking_balance_repr.ml @@ -45,7 +45,7 @@ let equal_full_staking_balance (a : Full_staking_balance_repr.t) (b : Full_staking_balance_repr.t) = let open Lwt_result_syntax in let open Full_staking_balance_repr in - let open Full_staking_balance_repr.Internal_for_tests in + let open Full_staking_balance_repr.Internal_for_tests_and_RPCs in let equal_tez_repr ~loc a b = Assert.equal_int64 ~loc (Tez_repr.to_mutez a) (Tez_repr.to_mutez b) in @@ -65,10 +65,12 @@ let equal_full_staking_balance (a : Full_staking_balance_repr.t) (min_delegated_in_cycle b) in let* () = - equal_cycle_repr - ~loc:__LOC__ - (cycle_of_min_delegated a) - (cycle_of_min_delegated b) + let cycle s = + match level_of_min_delegated s with + | None -> Cycle_repr.root + | Some l -> l.cycle + in + equal_cycle_repr ~loc:__LOC__ (cycle a) (cycle b) in return_unit @@ -100,7 +102,7 @@ let test_encodings () = ~own_frozen ~staked_frozen ~delegated - ~current_cycle:Cycle_repr.root + ~current_level:Level_repr.Internal_for_tests.root in let encoding = Full_staking_balance_repr.encoding in let sb_bytes = Binary.to_bytes_exn encoding staking_balance in diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- delegates.out index c1abbfa75d2ad572971f2855c275b85d972fe115..29602dc55a142c53e37b467120970e13c4e5ad95 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode client) RPC regression tests- delegates.out @@ -21,7 +21,11 @@ "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 5, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- delegates.out index 746c00447034f896be4ae2a3e45503fd14740408..d3577edcf2c118f6708f122400183f745bcfaee5 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode light) RPC regression tests- delegates.out @@ -21,7 +21,11 @@ "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 5, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- delegates.out index 71334ef90f47b854c0d57d18f3025c935d09761e..6982ef2ae258d70a82143ca34669eacf515ae1c2 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy) RPC regression tests- delegates.out @@ -21,7 +21,11 @@ "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 5, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- delegates.out index c1abbfa75d2ad572971f2855c275b85d972fe115..29602dc55a142c53e37b467120970e13c4e5ad95 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_data_dir) RPC regression tests- delegates.out @@ -21,7 +21,11 @@ "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 5, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, diff --git a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- delegates.out index c1abbfa75d2ad572971f2855c275b85d972fe115..29602dc55a142c53e37b467120970e13c4e5ad95 100644 --- a/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Alpha- (mode proxy_server_rpc) RPC regression tests- delegates.out @@ -21,7 +21,11 @@ "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 5, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus - destination).out b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus - destination).out index 5cdd1a09377af71b0f5465d23d7cd7bae0158d91..6c45d78fb53022a565cbb7b4b0187e8fe1062fdc 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus - destination).out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus - destination).out @@ -30,7 +30,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -41,7 +45,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000333333", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3799999999716", + "level": + { "level": 2, "level_position": 1, "cycle": 0, "cycle_position": 1, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -54,7 +62,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000003298113", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001595660", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -65,7 +77,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000003298113", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001595660", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -106,8 +122,13 @@ This sequence of operations was run: { "full_balance": "238000528932", "current_frozen_deposits": "200000181573", "frozen_deposits": "200000083983", "staking_balance": "238000528932", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", "min_delegated_in_current_cycle": "4", - "deactivated": false, "grace_period": 4, "pending_denunciations": false, + "delegated_balance": "0", + "min_delegated_in_current_cycle": + { "amount": "4", + "level": + { "level": 9, "level_position": 8, "cycle": 2, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, + "grace_period": 4, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, "active_consensus_key": "[PUBLIC_KEY_HASH]" } diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus -- destination).out b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus -- destination).out index 945261d8da9ecd83c182990e665d3d03798dcc56..181861305420bd8379b873bd4fb3d966b9ccf293 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus -- destination).out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker - delegate - consensus -- destination).out @@ -30,7 +30,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -41,7 +45,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000333333", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3799999999716", + "level": + { "level": 2, "level_position": 1, "cycle": 0, "cycle_position": 1, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -54,7 +62,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000003298113", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001595660", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -65,7 +77,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000003298113", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001595660", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -106,8 +122,13 @@ This sequence of operations was run: { "full_balance": "238000528932", "current_frozen_deposits": "200000181573", "frozen_deposits": "200000083983", "staking_balance": "238000528932", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", "min_delegated_in_current_cycle": "4", - "deactivated": false, "grace_period": 4, "pending_denunciations": false, + "delegated_balance": "0", + "min_delegated_in_current_cycle": + { "amount": "4", + "level": + { "level": 9, "level_position": 8, "cycle": 2, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, + "grace_period": 4, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, "active_consensus_key": "[PUBLIC_KEY_HASH]" } diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus - destination).out b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus - destination).out index e86e3964537fdbfd963b51d9d12b96cf3ae3db7e..3a0272bda3bb286fc205e3e3e7fcb6e164217d91 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus - destination).out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus - destination).out @@ -30,7 +30,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -41,7 +45,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "3999999999716", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3799999999716", + "level": + { "level": 2, "level_position": 1, "cycle": 0, "cycle_position": 1, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -54,7 +62,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000002964496", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001278724", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -65,7 +77,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000002964496", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001278724", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -106,8 +122,13 @@ This sequence of operations was run: { "full_balance": "238000509096", "current_frozen_deposits": "200000164892", "frozen_deposits": "200000067302", "staking_balance": "238000509096", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", "min_delegated_in_current_cycle": "18", - "deactivated": false, "grace_period": 4, "pending_denunciations": false, + "delegated_balance": "0", + "min_delegated_in_current_cycle": + { "amount": "18", + "level": + { "level": 9, "level_position": 8, "cycle": 2, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, + "grace_period": 4, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, "active_consensus_key": "[PUBLIC_KEY_HASH]" } diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus -- destination).out b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus -- destination).out index f845c4c2c4eed7c1bf12fb364ae71425833fc893..77a75198688fcff55e059df8846293314615f088 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus -- destination).out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test drain delegate with (baker -- delegate - consensus -- destination).out @@ -30,7 +30,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -41,7 +45,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "3999999999716", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3799999999716", + "level": + { "level": 2, "level_position": 1, "cycle": 0, "cycle_position": 1, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -54,7 +62,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000002964496", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001278724", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -65,7 +77,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000002964496", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001278724", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -106,8 +122,13 @@ This sequence of operations was run: { "full_balance": "238000509096", "current_frozen_deposits": "200000164892", "frozen_deposits": "200000067302", "staking_balance": "238000509096", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", "min_delegated_in_current_cycle": "18", - "deactivated": false, "grace_period": 4, "pending_denunciations": false, + "delegated_balance": "0", + "min_delegated_in_current_cycle": + { "amount": "18", + "level": + { "level": 9, "level_position": 8, "cycle": 2, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, + "grace_period": 4, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, "active_consensus_key": "[PUBLIC_KEY_HASH]" } diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test register with consensus key.out b/tezt/tests/expected/consensus_key.ml/Alpha- Test register with consensus key.out index 668993b15b0e07f5640132105f8f8a0dc2195a25..4430708cc7461bd8752d3bd6370c6f1acd1c6381 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test register with consensus key.out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test register with consensus key.out @@ -64,8 +64,13 @@ This sequence of operations was run: { "full_balance": "999999999385", "current_frozen_deposits": "0", "frozen_deposits": "0", "staking_balance": "999999999385", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", "min_delegated_in_current_cycle": "999999999385", - "deactivated": false, "grace_period": 3, "pending_denunciations": false, + "delegated_balance": "0", + "min_delegated_in_current_cycle": + { "amount": "999999999385", + "level": + { "level": 3, "level_position": 2, "cycle": 0, "cycle_position": 2, + "expected_commitment": false } }, "deactivated": false, + "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "active_consensus_key": "[PUBLIC_KEY_HASH]", "pending_consensus_keys": @@ -78,7 +83,8 @@ This sequence of operations was run: { "full_balance": "999999999385", "current_frozen_deposits": "49999999970", "frozen_deposits": "0", "staking_balance": "999999999385", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", "min_delegated_in_current_cycle": "949999999415", + "delegated_balance": "0", + "min_delegated_in_current_cycle": { "amount": "949999999415" }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "active_consensus_key": "[PUBLIC_KEY_HASH]" } diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out index ce52bbd3718f475ed39cbcbf4c3f0c4d6e395c31..b410b3ee2c9eee814d21f63c3886beee474bd985 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out @@ -30,7 +30,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -41,7 +45,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000333333", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3799999999716", + "level": + { "level": 2, "level_position": 1, "cycle": 0, "cycle_position": 1, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -54,7 +62,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000003298113", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001595660", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is not delegate.out b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is not delegate.out index f4f8eb4a0091fcb47fe25e9605a866f38fea432f..bc49237f11bc75d0a93ae6ea78a4a74befb45435 100644 --- a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is not delegate.out +++ b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is not delegate.out @@ -30,7 +30,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000000000000", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800000000000", + "level": + { "level": 1, "level_position": 0, "cycle": 0, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -41,7 +45,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "3999999999716", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3799999999716", + "level": + { "level": 2, "level_position": 1, "cycle": 0, "cycle_position": 1, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20, @@ -54,7 +62,11 @@ This sequence of operations was run: "frozen_deposits": "200000000000", "staking_balance": "4000002964496", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", - "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, + "min_delegated_in_current_cycle": + { "amount": "3800001278724", + "level": + { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, + "expected_commitment": false } }, "deactivated": false, "grace_period": 3, "pending_denunciations": false, "total_delegated_stake": "0", "staking_denominator": "0", "voting_power": "4000000000000", "remaining_proposals": 20,