diff --git a/docs/protocols/beta.rst b/docs/protocols/beta.rst index 0c751d5d2dc8f68ae64edba7e1ec973537fb7858..c956c191e3975cdc84f90d8a6695626b85b12554 100644 --- a/docs/protocols/beta.rst +++ b/docs/protocols/beta.rst @@ -55,9 +55,18 @@ Adaptive Issuance Gas improvements ---------------- +.. _breaking_changes_beta: + Breaking Changes ---------------- +- Reworked RPC ``GET + /chains//blocks//context/delegates/``, + which returns a lot of information about a given baker. Its fields + now match all non-deprecated ``delegates//...`` RPCs + one-for-one. This change is breaking for both JSON and binary + encodings. (MR :gl:`!14209`) + RPC Changes ----------- @@ -132,6 +141,10 @@ RPC Changes * Added RPC ``GET ../spendable_and_frozen_bonds`` which is identical to ``GET ../balance_and_frozen_bonds``. (MR :gl:`!14154`) +- Reworked RPC ``GET + /chains//blocks//context/delegates/``; + see :ref:`breaking_changes_beta`. + Operation receipts ------------------ diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index 3de62cf9d19095600811cf08e0ab2fb491870b69..36d24f1b9ec0d3837f336f0a850281dcab8ac543 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -3948,314 +3948,6 @@ module Validators = struct () end -module Delegates = struct - 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; - frozen_deposits : Tez.t; - staking_balance : Tez.t; - frozen_deposits_limit : Tez.t option; - delegated_contracts : Alpha_context.Contract.t list; - delegated_balance : 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; - grace_period : Cycle.t; - pending_denunciations : bool; - voting_info : Vote.delegate_info; - active_consensus_key : Signature.Public_key_hash.t; - pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; - } - - let info_encoding = - let open Data_encoding in - conv - (fun { - full_balance; - current_frozen_deposits; - frozen_deposits; - staking_balance; - frozen_deposits_limit; - delegated_contracts; - delegated_balance; - min_delegated_in_current_cycle; - total_delegated_stake; - staking_denominator; - deactivated; - grace_period; - pending_denunciations; - voting_info; - active_consensus_key; - pending_consensus_keys; - } -> - ( ( full_balance, - current_frozen_deposits, - frozen_deposits, - staking_balance, - frozen_deposits_limit, - delegated_contracts, - delegated_balance, - min_delegated_in_current_cycle, - deactivated, - grace_period ), - ( (pending_denunciations, total_delegated_stake, staking_denominator), - (voting_info, (active_consensus_key, pending_consensus_keys)) ) )) - (fun ( ( full_balance, - current_frozen_deposits, - frozen_deposits, - staking_balance, - frozen_deposits_limit, - delegated_contracts, - delegated_balance, - min_delegated_in_current_cycle, - deactivated, - grace_period ), - ( ( pending_denunciations, - total_delegated_stake, - staking_denominator ), - (voting_info, (active_consensus_key, pending_consensus_keys)) ) - ) -> - { - full_balance; - current_frozen_deposits; - frozen_deposits; - staking_balance; - frozen_deposits_limit; - delegated_contracts; - delegated_balance; - min_delegated_in_current_cycle; - total_delegated_stake; - staking_denominator; - deactivated; - grace_period; - pending_denunciations; - voting_info; - active_consensus_key; - pending_consensus_keys; - }) - (merge_objs - (obj10 - (req "full_balance" Tez.encoding) - (req "current_frozen_deposits" Tez.encoding) - (req "frozen_deposits" Tez.encoding) - (req "staking_balance" Tez.encoding) - (opt "frozen_deposits_limit" Tez.encoding) - (req "delegated_contracts" (list Alpha_context.Contract.encoding)) - (req "delegated_balance" Tez.encoding) - (req - "min_delegated_in_current_cycle" - min_delegated_in_current_cycle_encoding) - (req "deactivated" bool) - (req "grace_period" Cycle.encoding)) - (merge_objs - (obj3 - (req "pending_denunciations" bool) - (req "total_delegated_stake" Tez.encoding) - (req "staking_denominator" Staking_pseudotoken.For_RPC.encoding)) - (merge_objs - Vote.delegate_info_encoding - (obj2 - (req - "active_consensus_key" - Signature.Public_key_hash.encoding) - (dft - "pending_consensus_keys" - (list - (obj2 - (req "cycle" Cycle.encoding) - (req "pkh" Signature.Public_key_hash.encoding))) - []))))) - - let check_delegate_registered ctxt pkh = - let open Lwt_result_syntax in - let*! result = Delegate.registered ctxt pkh in - if result then return_unit - else Environment.Error_monad.tzfail (Delegate_services.Not_registered pkh) - - module S = struct - let path = - RPC_path.( - open_root / "context" / "delegates" /: Signature.Public_key_hash.rpc_arg) - - let info = - RPC_service.get_service - ~description:"Everything about a delegate." - ~query:RPC_query.empty - ~output:info_encoding - path - - let min_delegated_in_current_cycle = - RPC_service.get_service - ~description: - "Returns the minimum of delegated tez (in mutez) during the current \ - cycle and the block level at the end of which the minimum was \ - reached. This only takes into account the value of \ - `total_delegated` at the end of each block, not in the middle of \ - applying operations. This is the delegated amount that would be \ - used to compute the delegate's future baking rights if the cycle \ - ended at the current block. If the minimum was reached multiple \ - times, the returned level is the earliest level of the current \ - cycle that reached this minimum. For instance, if `total_delegated` \ - hasn't changed at all since the beginning of the current cycle, \ - returns the first level of the current cycle. (If the contract is \ - not registered as a delegate, returns 0 mutez and omits the level.)" - ~query:RPC_query.empty - ~output:min_delegated_in_current_cycle_encoding - RPC_path.(path / "min_delegated_in_current_cycle") - end - - let info ctxt pkh = - let open Lwt_result_syntax in - let* () = check_delegate_registered ctxt pkh in - let* full_balance = Delegate.For_RPC.full_balance ctxt pkh in - let* current_frozen_deposits = Delegate.current_frozen_deposits ctxt pkh in - let* frozen_deposits = Delegate.initial_frozen_deposits ctxt pkh in - let* staking_balance = Delegate.For_RPC.staking_balance ctxt pkh in - let* frozen_deposits_limit = Delegate.frozen_deposits_limit ctxt pkh in - let*! delegated_contracts = Delegate.delegated_contracts ctxt pkh in - let* delegated_balance = - Delegate_services.external_staked_and_delegated ctxt pkh - in - let* min_delegated_in_current_cycle = - Delegate.For_RPC.min_delegated_in_current_cycle ctxt pkh - in - let* total_delegated_stake = - Staking_pseudotokens.For_RPC.get_frozen_deposits_staked_tez - ctxt - ~delegate:pkh - in - let* staking_denominator = - Staking_pseudotokens.For_RPC.get_frozen_deposits_pseudotokens - ctxt - ~delegate:pkh - in - let* deactivated = Delegate.deactivated ctxt pkh in - let* grace_period = Delegate.last_cycle_before_deactivation ctxt pkh in - let*! pending_denunciations = - Delegate.For_RPC.has_pending_denunciations ctxt pkh - in - let* voting_info = Vote.get_delegate_info ctxt pkh in - let* consensus_key = Delegate.Consensus_key.active_pubkey ctxt pkh in - let+ pendings = Delegate.Consensus_key.pending_updates ctxt pkh in - let pending_consensus_keys = - List.map (fun (cycle, pkh, _) -> (cycle, pkh)) pendings - in - { - full_balance; - current_frozen_deposits; - frozen_deposits; - staking_balance; - frozen_deposits_limit; - delegated_contracts; - delegated_balance; - min_delegated_in_current_cycle; - total_delegated_stake; - staking_denominator; - deactivated; - grace_period; - pending_denunciations; - voting_info; - active_consensus_key = consensus_key.consensus_pkh; - pending_consensus_keys; - } - - let register () = - let open Lwt_result_syntax in - Registration.register1 ~chunked:false S.info (fun ctxt pkh () () -> - info ctxt pkh) ; - Registration.register1 - ~chunked:false - S.min_delegated_in_current_cycle - (fun ctxt pkh () () -> - let* () = check_delegate_registered ctxt pkh in - Delegate.For_RPC.min_delegated_in_current_cycle ctxt pkh) - - let info ctxt block pkh = RPC_context.make_call1 S.info ctxt block pkh () () - - let min_delegated_in_current_cycle_encoding ctxt block pkh = - RPC_context.make_call1 S.min_delegated_in_current_cycle ctxt block pkh () () -end - -module Staking = struct - let path = - RPC_path.( - open_root / "context" / "delegates" /: Signature.Public_key_hash.rpc_arg) - - let stakers_encoding = - let open Data_encoding in - let staker_enconding = - obj2 - (req "staker" Alpha_context.Contract.implicit_encoding) - (req "frozen_deposits" Tez.encoding) - in - list staker_enconding - - module S = struct - let stakers = - RPC_service.get_service - ~description: - "Returns the list of accounts that stake to a given delegate \ - together with their share of the frozen deposits." - ~query:RPC_query.empty - ~output:stakers_encoding - RPC_path.(path / "stakers") - - let is_forbidden = - RPC_service.get_service - ~description: - "Returns true if the delegate is forbidden to participate in \ - consensus." - ~query:RPC_query.empty - ~output:Data_encoding.bool - RPC_path.(path / "is_forbidden") - end - - let contract_stake ctxt ~delegator_contract ~delegate = - let open Alpha_context in - let open Lwt_result_syntax in - let* staked_balance = - Staking_pseudotokens.For_RPC.staked_balance - ctxt - ~contract:delegator_contract - ~delegate - in - if not Tez.(staked_balance = zero) then - let delegator_pkh = - match delegator_contract with - | Contract.Implicit pkh -> pkh - | Contract.Originated _ -> assert false - (* Originated contracts cannot stake *) - in - return @@ Some (delegator_pkh, staked_balance) - else return_none - - let register () = - let open Lwt_result_syntax in - Registration.register1 ~chunked:false S.is_forbidden (fun ctxt pkh () () -> - return @@ Delegate.is_forbidden_delegate ctxt pkh) ; - Registration.register1 ~chunked:true S.stakers (fun ctxt pkh () () -> - let* () = Delegates.check_delegate_registered ctxt pkh in - let*! delegators = Delegate.delegated_contracts ctxt pkh in - List.filter_map_es - (fun delegator_contract -> - contract_stake ctxt ~delegator_contract ~delegate:pkh) - delegators) - - let stakers ctxt block pkh = - RPC_context.make_call1 S.stakers ctxt block pkh () () - - let is_forbidden ctxt block pkh = - RPC_context.make_call1 S.is_forbidden ctxt block pkh () () -end - let get_blocks_preservation_cycles ~get_context = let open Lwt_option_syntax in let constants_key = [Constants_repr.version; "constants"] in @@ -4335,8 +4027,6 @@ let register () = Validators.register () ; Sc_rollup.register () ; Dal.register () ; - Staking.register () ; - Delegates.register () ; Registration.register0 ~chunked:false S.current_level (fun ctxt q () -> if q.offset < 0l then Environment.Error_monad.tzfail Negative_level_offset else diff --git a/src/proto_alpha/lib_plugin/delegate_services.ml b/src/proto_alpha/lib_plugin/delegate_services.ml index 759f73ec419a5f8e8375c2df3e3803f0247c5248..ce4f5e83be2fbd61040cb4c1a8bc3fa5ba7a41de 100644 --- a/src/proto_alpha/lib_plugin/delegate_services.ml +++ b/src/proto_alpha/lib_plugin/delegate_services.ml @@ -58,6 +58,15 @@ let () = (function Balance_rpc_non_delegate pkh -> Some pkh | _ -> None) (fun pkh -> Balance_rpc_non_delegate pkh) +let stakers_encoding = + let open Data_encoding in + let staker_enconding = + obj2 + (req "staker" Alpha_context.Contract.implicit_encoding) + (req "frozen_deposits" Tez.encoding) + in + list staker_enconding + type consensus_key = { consensus_key_pkh : Signature.Public_key_hash.t; consensus_key_pk : Signature.Public_key.t; @@ -143,6 +152,8 @@ let deposit_per_cycle_encoding : deposit_per_cycle Data_encoding.t = (fun (cycle, deposit) -> {cycle; deposit}) (obj2 (req "cycle" Cycle.encoding) (req "deposit" Tez.encoding)) +type unstaked_per_cycle = deposit_per_cycle list + let unstaked_per_cycle_encoding = Data_encoding.list deposit_per_cycle_encoding type pending_staking_parameters = Cycle.t * Staking_parameters_repr.t @@ -154,6 +165,314 @@ let pending_staking_parameters_encoding : (req "cycle" Cycle.encoding) (req "parameters" Staking_parameters_repr.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)) + +(* TODO: https://gitlab.com/tezos/tezos/-/issues/7369 + update tests to use new_info instead, then remove this type *) +type info = { + full_balance : Tez.t; + current_frozen_deposits : Tez.t; + frozen_deposits : Tez.t; + staking_balance : Tez.t; + frozen_deposits_limit : Tez.t option; + delegated_contracts : Alpha_context.Contract.t list; + delegated_balance : 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; + grace_period : Cycle.t; + pending_denunciations : bool; + voting_info : Vote.delegate_info; + active_consensus_key : Signature.Public_key_hash.t; + pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; +} + +type new_info = { + (* + General baking information *) + deactivated : bool; + is_forbidden : bool; + participation : Delegate.For_RPC.participation_info; + grace_period : Cycle.t; + active_staking_parameters : Staking_parameters_repr.t; + pending_staking_parameters : pending_staking_parameters list; + (* + Baking rights *) + baking_power : int64; + total_staked (* old name: current_frozen_deposits *) : Tez.t; + total_delegated (* new *) : Tez.t; + min_delegated_in_current_cycle : Tez.t * Level_repr.t option; + own_full_balance (* old name: full_balance *) : Tez.t; + own_staked (* new *) : Tez.t; + own_delegated (* new *) : Tez.t; + external_staked (* old name: total_delegated_stake *) : Tez.t; + external_delegated (* new *) : Tez.t; + total_unstaked_per_cycle + (* old RPC name: unstaked_frozen_deposits; was not in info *) : + unstaked_per_cycle; + denunciations (* replaces pending_denunciations *) : Denunciations_repr.t; + estimated_shared_pending_slashed_amount (* new *) : Tez.t; + staking_denominator : Staking_pseudotoken.t; + (* + Voting *) + current_voting_power : int64; + voting_power : int64; + voting_info : Vote.delegate_info; + (* + Consensus key *) + consensus_key + (* corresponds to old active_consensus_key and pending_consensus_keys *) : + consensus_keys_info; + (* + Chunked RPCs at the end, because they might be arbitrarily large *) + stakers : (public_key_hash * Tez.t) list; + delegators (* old name: delegated_contracts *) : Contract.t list; +} +(* Removed: + - frozen_deposits_limit (has no effects) + - frozen_deposits (equals total_staked on last block three cycles ago) + - staking_balance (equals total_staked + total_delegated + - delegated_balance (equals external_staked + external_delegated) *) + +let conv25 ty = + Data_encoding.conv + (fun ( x0, + x1, + x2, + x3, + x4, + x5, + x6, + x7, + x8, + x9, + x10, + x11, + x12, + x13, + x14, + x15, + x16, + x17, + x18, + x19, + x20, + x21, + x22, + x23, + x24 ) -> + ( (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9), + ( (x10, x11, x12, x13, x14, x15, x16, x17, x18, x19), + (x20, x21, x22, x23, x24) ) )) + (fun ( (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9), + ( (x10, x11, x12, x13, x14, x15, x16, x17, x18, x19), + (x20, x21, x22, x23, x24) ) ) -> + ( x0, + x1, + x2, + x3, + x4, + x5, + x6, + x7, + x8, + x9, + x10, + x11, + x12, + x13, + x14, + x15, + x16, + x17, + x18, + x19, + x20, + x21, + x22, + x23, + x24 )) + ty + +let obj25 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 + f20 f21 f22 f23 f24 = + conv25 + Data_encoding.( + merge_objs + (obj10 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9) + (merge_objs + (obj10 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19) + (obj5 f20 f21 f22 f23 f24))) + +let info_encoding = + let open Data_encoding in + conv + (fun { + (* General baking information *) + deactivated; + is_forbidden; + participation; + grace_period; + active_staking_parameters; + pending_staking_parameters; + (* Baking rights *) + baking_power; + total_staked; + total_delegated; + min_delegated_in_current_cycle; + own_full_balance; + own_staked; + own_delegated; + external_staked; + external_delegated; + total_unstaked_per_cycle; + denunciations; + estimated_shared_pending_slashed_amount; + staking_denominator; + (* Voting *) + current_voting_power; + voting_power; + voting_info; + (* Consensus key *) + consensus_key; + (* Chunked RPCs *) + stakers; + delegators; + } -> + ( (* General baking information *) + deactivated, + is_forbidden, + participation, + grace_period, + active_staking_parameters, + pending_staking_parameters, + (* Baking rights *) + baking_power, + total_staked, + total_delegated, + min_delegated_in_current_cycle, + own_full_balance, + own_staked, + own_delegated, + external_staked, + external_delegated, + total_unstaked_per_cycle, + denunciations, + estimated_shared_pending_slashed_amount, + staking_denominator, + (* Voting *) + current_voting_power, + voting_power, + voting_info, + (* Consensus key *) + consensus_key, + (* Chunked RPCs *) + stakers, + delegators )) + (fun ( (* General baking information *) + deactivated, + is_forbidden, + participation, + grace_period, + active_staking_parameters, + pending_staking_parameters, + (* Baking rights *) + baking_power, + total_staked, + total_delegated, + min_delegated_in_current_cycle, + own_full_balance, + own_staked, + own_delegated, + external_staked, + external_delegated, + total_unstaked_per_cycle, + denunciations, + estimated_shared_pending_slashed_amount, + staking_denominator, + (* Voting *) + current_voting_power, + voting_power, + voting_info, + (* Consensus key *) + consensus_key, + (* Chunked RPCs *) + stakers, + delegators ) -> + { + (* General baking information *) + deactivated; + is_forbidden; + participation; + grace_period; + active_staking_parameters; + pending_staking_parameters; + (* Baking rights *) + baking_power; + total_staked; + total_delegated; + min_delegated_in_current_cycle; + own_full_balance; + own_staked; + own_delegated; + external_staked; + external_delegated; + total_unstaked_per_cycle; + denunciations; + estimated_shared_pending_slashed_amount; + staking_denominator; + (* Voting *) + current_voting_power; + voting_power; + voting_info; + (* Consensus key *) + consensus_key; + (* Chunked RPCs *) + stakers; + delegators; + }) + (obj25 + (* General baking information *) + (req "deactivated" bool) + (req "is_forbidden" bool) + (req "participation" participation_info_encoding) + (req "grace_period" Cycle.encoding) + (req "active_staking_parameters" Staking_parameters_repr.encoding) + (req + "pending_staking_parameters" + (list pending_staking_parameters_encoding)) + (* Baking rights *) + (req "baking_power" int64) + (req "total_staked" Tez.encoding) + (req "total_delegated" Tez.encoding) + (req + "min_delegated_in_current_cycle" + min_delegated_in_current_cycle_encoding) + (req "own_full_balance" Tez.encoding) + (req "own_staked" Tez.encoding) + (req "own_delegated" Tez.encoding) + (req "external_staked" Tez.encoding) + (req "external_delegated" Tez.encoding) + (req "total_unstaked_per_cycle" unstaked_per_cycle_encoding) + (req "denunciations" Denunciations_repr.encoding) + (req "estimated_shared_pending_slashed_amount" Tez.encoding) + (req "staking_denominator" Staking_pseudotoken.For_RPC.encoding) + (* Voting *) + (req "current_voting_power" int64) + (req "voting_power" int64) + (req "voting_info" Vote.delegate_info_encoding) + (* Consensus key *) + (req "consensus_key" consensus_key_info_encoding) + (* Chunked RPCs *) + (req "stakers" stakers_encoding) + (req "delegators" (list Contract.encoding))) + module S = struct let raw_path = RPC_path.(open_root / "context" / "delegates") @@ -276,6 +595,23 @@ module S = struct RPC_path.(path / "unstaked_frozen_deposits") end + let is_forbidden = + RPC_service.get_service + ~description: + "Returns true if the delegate is forbidden to participate in consensus." + ~query:RPC_query.empty + ~output:Data_encoding.bool + RPC_path.(path / "is_forbidden") + + let stakers = + RPC_service.get_service + ~description: + "Returns the list of accounts that stake to a given delegate together \ + with their share of the frozen deposits." + ~query:RPC_query.empty + ~output:stakers_encoding + RPC_path.(path / "stakers") + let own_full_balance = RPC_service.get_service ~description: @@ -522,6 +858,34 @@ module S = struct ~query:RPC_query.empty ~output:Tez.encoding RPC_path.(path / "estimated_shared_pending_slashed_amount") + + let min_delegated_in_current_cycle = + RPC_service.get_service + ~description: + "Returns the minimum of delegated tez (in mutez) during the current \ + cycle and the block level at the end of which the minimum was \ + reached. This only takes into account the value of `total_delegated` \ + at the end of each block, not in the middle of applying operations. \ + This is the delegated amount that would be used to compute the \ + delegate's future baking rights if the cycle ended at the current \ + block. If the minimum was reached multiple times, the returned level \ + is the earliest level of the current cycle that reached this minimum. \ + For instance, if `total_delegated` hasn't changed at all since the \ + beginning of the current cycle, returns the first level of the \ + current cycle. (If the contract is not registered as a delegate, \ + returns 0 mutez and omits the level.)" + ~query:RPC_query.empty + ~output:min_delegated_in_current_cycle_encoding + RPC_path.(path / "min_delegated_in_current_cycle") + + let info = + RPC_service.get_service + ~description: + "Everything about a delegate. Gathers the outputs of all RPCs with the \ + ../delegates/ prefix." + ~query:RPC_query.empty + ~output:info_encoding + path end let check_delegate_registered ctxt pkh = @@ -531,6 +895,47 @@ let check_delegate_registered ctxt pkh = | true -> return_unit | false -> tzfail (Not_registered pkh) +let consensus_key ctxt pkh = + let open Lwt_result_syntax in + let* {consensus_pk = consensus_key_pk; consensus_pkh = consensus_key_pkh; _} = + Delegate.Consensus_key.active_pubkey ctxt pkh + in + let* pendings = Delegate.Consensus_key.pending_updates ctxt pkh in + let pendings = + List.map + (fun (cycle, consensus_key_pkh, consensus_key_pk) -> + (cycle, {consensus_key_pk; consensus_key_pkh})) + pendings + in + return {active = {consensus_key_pk; consensus_key_pkh}; pendings} + +let contract_stake ctxt ~delegator_contract ~delegate = + let open Alpha_context in + let open Lwt_result_syntax in + let* staked_balance = + Staking_pseudotokens.For_RPC.staked_balance + ctxt + ~contract:delegator_contract + ~delegate + in + if not Tez.(staked_balance = zero) then + let delegator_pkh = + match delegator_contract with + | Contract.Implicit pkh -> pkh + | Contract.Originated _ -> assert false + (* Originated contracts cannot stake *) + in + return @@ Some (delegator_pkh, staked_balance) + else return_none + +let stakers ctxt pkh = + let open Lwt_result_syntax in + let*! delegators = Delegate.delegated_contracts ctxt pkh in + List.filter_map_es + (fun delegator_contract -> + contract_stake ctxt ~delegator_contract ~delegate:pkh) + delegators + let f_own_full_balance ctxt pkh () () = let open Lwt_result_syntax in let* () = @@ -683,6 +1088,86 @@ let f_delegators ctxt pkh () () = let*! contracts = Delegate.delegated_contracts ctxt pkh in return contracts +let info ctxt pkh = + let open Lwt_result_syntax in + (* General baking information *) + let* deactivated = Delegate.deactivated ctxt pkh in + let is_forbidden = Delegate.is_forbidden_delegate ctxt pkh in + let* participation = Delegate.For_RPC.participation_info ctxt pkh in + let* grace_period = Delegate.last_cycle_before_deactivation ctxt pkh in + let* active_staking_parameters = + Delegate.Staking_parameters.of_delegate ctxt pkh + in + let* pending_staking_parameters = + Delegate.Staking_parameters.pending_updates ctxt pkh + in + (* Baking rights *) + let* baking_power = + Stake_distribution.For_RPC.delegate_current_baking_power ctxt pkh + in + let* total_staked = total_staked ctxt pkh in + let* total_delegated = total_delegated ctxt pkh in + let* min_delegated_in_current_cycle = + Delegate.For_RPC.min_delegated_in_current_cycle ctxt pkh + in + let* own_full_balance = Delegate.For_RPC.full_balance ctxt pkh in + let* own_staked = own_staked ctxt pkh in + let* own_delegated = own_delegated ctxt pkh in + let* external_staked = external_staked ctxt pkh in + let* external_delegated = external_delegated ctxt pkh in + let* total_unstaked_per_cycle = total_unstaked_per_cycle ctxt pkh in + let* denunciations = Delegate.For_RPC.pending_denunciations ctxt pkh in + let* estimated_shared_pending_slashed_amount = + Delegate.For_RPC.get_estimated_shared_pending_slashed_amount ctxt pkh + in + let* staking_denominator = + Staking_pseudotokens.For_RPC.get_frozen_deposits_pseudotokens + ctxt + ~delegate:pkh + in + (* Voting *) + let* current_voting_power = Vote.get_current_voting_power_free ctxt pkh in + let* voting_power = Vote.get_voting_power_free ctxt pkh in + let* voting_info = Vote.get_delegate_info ctxt pkh in + (* Consensus key *) + let* consensus_key = consensus_key ctxt pkh in + (* Chunked RPCs *) + let* stakers = stakers ctxt pkh in + let*! delegators = Delegate.delegated_contracts ctxt pkh in + return + { + (* General baking information *) + deactivated; + is_forbidden; + participation; + grace_period; + active_staking_parameters; + pending_staking_parameters; + (* Baking rights *) + baking_power; + total_staked; + total_delegated; + min_delegated_in_current_cycle; + own_full_balance; + own_staked; + own_delegated; + external_staked; + external_delegated; + total_unstaked_per_cycle; + denunciations; + estimated_shared_pending_slashed_amount; + staking_denominator; + (* Voting *) + current_voting_power; + voting_power; + voting_info; + (* Consensus key *) + consensus_key; + (* Chunked RPCs *) + stakers; + delegators; + } + let wrap_check_registered ~chunked s f = register1 ~chunked s (fun ctxt pkh () () -> let open Lwt_result_syntax in @@ -729,6 +1214,9 @@ let register () = | {with_minimal_stake = true; without_minimal_stake = true; _} | {with_minimal_stake = false; without_minimal_stake = false; _} -> return delegates) ; + register1 ~chunked:false S.is_forbidden (fun ctxt pkh () () -> + return @@ Delegate.is_forbidden_delegate ctxt pkh) ; + wrap_check_registered ~chunked:true S.stakers stakers ; register1 ~chunked:false S.Deprecated.full_balance f_own_full_balance ; register1 ~chunked:false S.own_full_balance f_own_full_balance ; register1 ~chunked:false S.Deprecated.current_frozen_deposits f_total_staked ; @@ -787,21 +1275,7 @@ let register () = let* () = check_delegate_registered ctxt pkh in Vote.get_delegate_info ctxt pkh) ; register1 ~chunked:false S.consensus_key (fun ctxt pkh () () -> - let* { - consensus_pk = consensus_key_pk; - consensus_pkh = consensus_key_pkh; - _; - } = - Delegate.Consensus_key.active_pubkey ctxt pkh - in - let* pendings = Delegate.Consensus_key.pending_updates ctxt pkh in - let pendings = - List.map - (fun (cycle, consensus_key_pkh, consensus_key_pk) -> - (cycle, {consensus_key_pk; consensus_key_pkh})) - pendings - in - return {active = {consensus_key_pk; consensus_key_pkh}; pendings}) ; + consensus_key ctxt pkh) ; register1 ~chunked:false S.participation (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.For_RPC.participation_info ctxt pkh) ; @@ -816,7 +1290,14 @@ let register () = S.estimated_shared_pending_slashed_amount (fun ctxt delegate () () -> let* () = check_delegate_registered ctxt delegate in - Delegate.For_RPC.get_estimated_shared_pending_slashed_amount ctxt delegate) + Delegate.For_RPC.get_estimated_shared_pending_slashed_amount ctxt delegate) ; + register1 + ~chunked:false + S.min_delegated_in_current_cycle + (fun ctxt pkh () () -> + let* () = check_delegate_registered ctxt pkh in + Delegate.For_RPC.min_delegated_in_current_cycle ctxt pkh) ; + wrap_check_registered ~chunked:true S.info info let list ctxt block ?(active = true) ?(inactive = false) ?(with_minimal_stake = true) ?(without_minimal_stake = false) () = @@ -827,6 +1308,9 @@ let list ctxt block ?(active = true) ?(inactive = false) {active; inactive; with_minimal_stake; without_minimal_stake} () +let is_forbidden ctxt block pkh = + RPC_context.make_call1 S.is_forbidden ctxt block pkh () () + let full_balance ctxt block pkh = RPC_context.make_call1 S.own_full_balance ctxt block pkh () () @@ -901,3 +1385,70 @@ let estimated_shared_pending_slashed_amount ctxt block pkh = pkh () () + +let info ctxt block pkh = + let open Lwt_result_syntax in + let* { + (* General baking information *) + deactivated; + is_forbidden = _; + participation = _; + grace_period; + active_staking_parameters = _; + pending_staking_parameters = _; + (* Baking rights *) + baking_power = _; + total_staked; + total_delegated; + min_delegated_in_current_cycle; + own_full_balance; + own_staked = _; + own_delegated = _; + external_staked; + external_delegated; + total_unstaked_per_cycle = _; + denunciations; + estimated_shared_pending_slashed_amount = _; + staking_denominator; + (* Voting *) + current_voting_power = _; + voting_power = _; + voting_info; + (* Consensus key *) + consensus_key; + (* Chunked RPCs *) + stakers = _; + delegators; + } = + RPC_context.make_call1 S.info ctxt block pkh () () + in + let* frozen_deposits = frozen_deposits ctxt block pkh in + let*? staking_balance = + Environment.wrap_tzresult Tez.(total_staked +? total_delegated) + in + let* frozen_deposits_limit = frozen_deposits_limit ctxt block pkh in + let*? delegated_balance = + Environment.wrap_tzresult Tez.(external_staked +? external_delegated) + in + return + { + full_balance = own_full_balance; + current_frozen_deposits = total_staked; + frozen_deposits; + staking_balance; + frozen_deposits_limit; + delegated_contracts = delegators; + delegated_balance; + min_delegated_in_current_cycle; + total_delegated_stake = external_staked; + staking_denominator; + deactivated; + grace_period; + pending_denunciations = not (List.is_empty denunciations); + voting_info; + active_consensus_key = consensus_key.active.consensus_key_pkh; + pending_consensus_keys = + List.map + (fun (cyc, ck) -> (cyc, ck.consensus_key_pkh)) + consensus_key.pendings; + } diff --git a/src/proto_alpha/lib_plugin/delegate_services.mli b/src/proto_alpha/lib_plugin/delegate_services.mli index dbd102e32076b745c07aab8cad3093dc096acfd4..dde556a498debb1cf97719d2bbda135c814706d5 100644 --- a/src/proto_alpha/lib_plugin/delegate_services.mli +++ b/src/proto_alpha/lib_plugin/delegate_services.mli @@ -60,6 +60,28 @@ type deposit_per_cycle = {cycle : Cycle.t; deposit : Tez.t} val deposit_per_cycle_encoding : deposit_per_cycle Data_encoding.t +type info = { + full_balance : Tez.t; + current_frozen_deposits : Tez.t; + frozen_deposits : Tez.t; + staking_balance : Tez.t; + frozen_deposits_limit : Tez.t option; + delegated_contracts : Alpha_context.Contract.t list; + delegated_balance : 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; + grace_period : Cycle.t; + pending_denunciations : bool; + voting_info : Vote.delegate_info; + active_consensus_key : Signature.Public_key_hash.t; + pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; +} + +val is_forbidden : + 'a #RPC_context.simple -> 'a -> public_key_hash -> bool shell_tzresult Lwt.t + val full_balance : 'a #RPC_context.simple -> 'a -> @@ -171,6 +193,9 @@ val pending_denunciations : val estimated_shared_pending_slashed_amount : 'a #RPC_context.simple -> 'a -> public_key_hash -> Tez.t shell_tzresult Lwt.t +val info : + 'a #RPC_context.simple -> 'a -> public_key_hash -> info shell_tzresult Lwt.t + val register : unit -> unit (** For RPC.ml *) diff --git a/src/proto_alpha/lib_protocol/test/helpers/block.ml b/src/proto_alpha/lib_protocol/test/helpers/block.ml index 6cd9bea7ea7353688cc09a0a64c88d062d597ec1..7da1a73c2a8d3176146c315a085fb355632d995d 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/block.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/block.ml @@ -140,9 +140,9 @@ let get_next_baker_excluding excludes block = let* baker_opt = List.find_es (fun {Plugin.RPC.Baking_rights.consensus_key; delegate; _} -> - let* info = Plugin.RPC.Delegates.info rpc_ctxt block delegate in + let* info = Delegate_services.info rpc_ctxt block delegate in let* forbidden = - Plugin.RPC.Staking.is_forbidden rpc_ctxt block delegate + Delegate_services.is_forbidden rpc_ctxt block delegate in return @@ ((not info.deactivated) && (not forbidden) diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index 05385d298e6322f54bea90b70b9a13226d13ffef..3d8b29d8b9971dc92a8cdf8e45c717ae24b8aae8 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -524,7 +524,7 @@ module Contract = struct end module Delegate = struct - type info = Plugin.RPC.Delegates.info = { + type info = Delegate_services.info = { full_balance : Tez.t; current_frozen_deposits : Tez.t; frozen_deposits : Tez.t; @@ -547,7 +547,7 @@ module Delegate = struct let grace_period ctxt pkh = Delegate_services.grace_period rpc_ctxt ctxt pkh - let info ctxt pkh = Plugin.RPC.Delegates.info rpc_ctxt ctxt pkh + let info ctxt pkh = Delegate_services.info rpc_ctxt ctxt pkh let full_balance ?(__LOC__ = __LOC__) ctxt pkh = get_delegate_own_full_balance_and_check ~__LOC__ ctxt pkh @@ -582,7 +582,7 @@ module Delegate = struct let participation ctxt pkh = Delegate_services.participation rpc_ctxt ctxt pkh - let is_forbidden ctxt pkh = Plugin.RPC.Staking.is_forbidden rpc_ctxt ctxt pkh + let is_forbidden ctxt pkh = Delegate_services.is_forbidden rpc_ctxt ctxt pkh let stake_for_cycle ctxt cycle pkh = let open Lwt_result_wrap_syntax in diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.mli b/src/proto_alpha/lib_protocol/test/helpers/context.mli index dbe3c6333c1666e3b5022ae8e8356330ad725567..6fe83b81197a6d2b46d650a97e3910da2e172d76 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/context.mli @@ -258,7 +258,7 @@ module Contract : sig end module Delegate : sig - type info = Plugin.RPC.Delegates.info = { + type info = Delegate_services.info = { full_balance : Tez.t; current_frozen_deposits : Tez.t; frozen_deposits : Tez.t; @@ -279,7 +279,7 @@ module Delegate : sig type stake = {frozen : Tez.t; weighted_delegated : Tez.t} - val info : t -> public_key_hash -> Plugin.RPC.Delegates.info tzresult Lwt.t + val info : t -> public_key_hash -> Delegate_services.info tzresult Lwt.t (** Calls RPCs [/chains//blocks//contracts/ (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; - frozen_deposits : Tez.t; - staking_balance : Tez.t; - frozen_deposits_limit : Tez.t option; - delegated_contracts : Alpha_context.Contract.t list; - delegated_balance : 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; - grace_period : Cycle.t; - pending_denunciations : bool; - voting_info : Vote.delegate_info; - active_consensus_key : Signature.Public_key_hash.t; - pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; - } - - let info_encoding = - let open Data_encoding in - conv - (fun { - full_balance; - current_frozen_deposits; - frozen_deposits; - staking_balance; - frozen_deposits_limit; - delegated_contracts; - delegated_balance; - min_delegated_in_current_cycle; - total_delegated_stake; - staking_denominator; - deactivated; - grace_period; - pending_denunciations; - voting_info; - active_consensus_key; - pending_consensus_keys; - } -> - ( ( full_balance, - current_frozen_deposits, - frozen_deposits, - staking_balance, - frozen_deposits_limit, - delegated_contracts, - delegated_balance, - min_delegated_in_current_cycle, - deactivated, - grace_period ), - ( (pending_denunciations, total_delegated_stake, staking_denominator), - (voting_info, (active_consensus_key, pending_consensus_keys)) ) )) - (fun ( ( full_balance, - current_frozen_deposits, - frozen_deposits, - staking_balance, - frozen_deposits_limit, - delegated_contracts, - delegated_balance, - min_delegated_in_current_cycle, - deactivated, - grace_period ), - ( ( pending_denunciations, - total_delegated_stake, - staking_denominator ), - (voting_info, (active_consensus_key, pending_consensus_keys)) ) - ) -> - { - full_balance; - current_frozen_deposits; - frozen_deposits; - staking_balance; - frozen_deposits_limit; - delegated_contracts; - delegated_balance; - min_delegated_in_current_cycle; - total_delegated_stake; - staking_denominator; - deactivated; - grace_period; - pending_denunciations; - voting_info; - active_consensus_key; - pending_consensus_keys; - }) - (merge_objs - (obj10 - (req "full_balance" Tez.encoding) - (req "current_frozen_deposits" Tez.encoding) - (req "frozen_deposits" Tez.encoding) - (req "staking_balance" Tez.encoding) - (opt "frozen_deposits_limit" Tez.encoding) - (req "delegated_contracts" (list Alpha_context.Contract.encoding)) - (req "delegated_balance" Tez.encoding) - (req - "min_delegated_in_current_cycle" - min_delegated_in_current_cycle_encoding) - (req "deactivated" bool) - (req "grace_period" Cycle.encoding)) - (merge_objs - (obj3 - (req "pending_denunciations" bool) - (req "total_delegated_stake" Tez.encoding) - (req "staking_denominator" Staking_pseudotoken.For_RPC.encoding)) - (merge_objs - Vote.delegate_info_encoding - (obj2 - (req - "active_consensus_key" - Signature.Public_key_hash.encoding) - (dft - "pending_consensus_keys" - (list - (obj2 - (req "cycle" Cycle.encoding) - (req "pkh" Signature.Public_key_hash.encoding))) - []))))) - - let check_delegate_registered ctxt pkh = - let open Lwt_result_syntax in - let*! result = Delegate.registered ctxt pkh in - if result then return_unit - else Environment.Error_monad.tzfail (Delegate_services.Not_registered pkh) - - module S = struct - let path = - RPC_path.( - open_root / "context" / "delegates" /: Signature.Public_key_hash.rpc_arg) - - let info = - RPC_service.get_service - ~description:"Everything about a delegate." - ~query:RPC_query.empty - ~output:info_encoding - path - - let min_delegated_in_current_cycle = - RPC_service.get_service - ~description: - "Returns the minimum of delegated tez (in mutez) during the current \ - cycle and the block level at the end of which the minimum was \ - reached. This only takes into account the value of \ - `total_delegated` at the end of each block, not in the middle of \ - applying operations. This is the delegated amount that would be \ - used to compute the delegate's future baking rights if the cycle \ - ended at the current block. If the minimum was reached multiple \ - times, the returned level is the earliest level of the current \ - cycle that reached this minimum. For instance, if `total_delegated` \ - hasn't changed at all since the beginning of the current cycle, \ - returns the first level of the current cycle. (If the contract is \ - not registered as a delegate, returns 0 mutez and omits the level.)" - ~query:RPC_query.empty - ~output:min_delegated_in_current_cycle_encoding - RPC_path.(path / "min_delegated_in_current_cycle") - end - - let info ctxt pkh = - let open Lwt_result_syntax in - let* () = check_delegate_registered ctxt pkh in - let* full_balance = Delegate.For_RPC.full_balance ctxt pkh in - let* current_frozen_deposits = Delegate.current_frozen_deposits ctxt pkh in - let* frozen_deposits = Delegate.initial_frozen_deposits ctxt pkh in - let* staking_balance = Delegate.For_RPC.staking_balance ctxt pkh in - let* frozen_deposits_limit = Delegate.frozen_deposits_limit ctxt pkh in - let*! delegated_contracts = Delegate.delegated_contracts ctxt pkh in - let* delegated_balance = - Delegate_services.external_staked_and_delegated ctxt pkh - in - let* min_delegated_in_current_cycle = - Delegate.For_RPC.min_delegated_in_current_cycle ctxt pkh - in - let* total_delegated_stake = - Staking_pseudotokens.For_RPC.get_frozen_deposits_staked_tez - ctxt - ~delegate:pkh - in - let* staking_denominator = - Staking_pseudotokens.For_RPC.get_frozen_deposits_pseudotokens - ctxt - ~delegate:pkh - in - let* deactivated = Delegate.deactivated ctxt pkh in - let* grace_period = Delegate.last_cycle_before_deactivation ctxt pkh in - let*! pending_denunciations = - Delegate.For_RPC.has_pending_denunciations ctxt pkh - in - let* voting_info = Vote.get_delegate_info ctxt pkh in - let* consensus_key = Delegate.Consensus_key.active_pubkey ctxt pkh in - let+ pendings = Delegate.Consensus_key.pending_updates ctxt pkh in - let pending_consensus_keys = - List.map (fun (cycle, pkh, _) -> (cycle, pkh)) pendings - in - { - full_balance; - current_frozen_deposits; - frozen_deposits; - staking_balance; - frozen_deposits_limit; - delegated_contracts; - delegated_balance; - min_delegated_in_current_cycle; - total_delegated_stake; - staking_denominator; - deactivated; - grace_period; - pending_denunciations; - voting_info; - active_consensus_key = consensus_key.consensus_pkh; - pending_consensus_keys; - } - - let register () = - let open Lwt_result_syntax in - Registration.register1 ~chunked:false S.info (fun ctxt pkh () () -> - info ctxt pkh) ; - Registration.register1 - ~chunked:false - S.min_delegated_in_current_cycle - (fun ctxt pkh () () -> - let* () = check_delegate_registered ctxt pkh in - Delegate.For_RPC.min_delegated_in_current_cycle ctxt pkh) - - let info ctxt block pkh = RPC_context.make_call1 S.info ctxt block pkh () () - - let min_delegated_in_current_cycle_encoding ctxt block pkh = - RPC_context.make_call1 S.min_delegated_in_current_cycle ctxt block pkh () () -end - -module Staking = struct - let path = - RPC_path.( - open_root / "context" / "delegates" /: Signature.Public_key_hash.rpc_arg) - - let stakers_encoding = - let open Data_encoding in - let staker_enconding = - obj2 - (req "staker" Alpha_context.Contract.implicit_encoding) - (req "frozen_deposits" Tez.encoding) - in - list staker_enconding - - module S = struct - let stakers = - RPC_service.get_service - ~description: - "Returns the list of accounts that stake to a given delegate \ - together with their share of the frozen deposits." - ~query:RPC_query.empty - ~output:stakers_encoding - RPC_path.(path / "stakers") - - let is_forbidden = - RPC_service.get_service - ~description: - "Returns true if the delegate is forbidden to participate in \ - consensus." - ~query:RPC_query.empty - ~output:Data_encoding.bool - RPC_path.(path / "is_forbidden") - end - - let contract_stake ctxt ~delegator_contract ~delegate = - let open Alpha_context in - let open Lwt_result_syntax in - let* staked_balance = - Staking_pseudotokens.For_RPC.staked_balance - ctxt - ~contract:delegator_contract - ~delegate - in - if not Tez.(staked_balance = zero) then - let delegator_pkh = - match delegator_contract with - | Contract.Implicit pkh -> pkh - | Contract.Originated _ -> assert false - (* Originated contracts cannot stake *) - in - return @@ Some (delegator_pkh, staked_balance) - else return_none - - let register () = - let open Lwt_result_syntax in - Registration.register1 ~chunked:false S.is_forbidden (fun ctxt pkh () () -> - return @@ Delegate.is_forbidden_delegate ctxt pkh) ; - Registration.register1 ~chunked:true S.stakers (fun ctxt pkh () () -> - let* () = Delegates.check_delegate_registered ctxt pkh in - let*! delegators = Delegate.delegated_contracts ctxt pkh in - List.filter_map_es - (fun delegator_contract -> - contract_stake ctxt ~delegator_contract ~delegate:pkh) - delegators) - - let stakers ctxt block pkh = - RPC_context.make_call1 S.stakers ctxt block pkh () () - - let is_forbidden ctxt block pkh = - RPC_context.make_call1 S.is_forbidden ctxt block pkh () () -end - let get_blocks_preservation_cycles ~get_context = let open Lwt_option_syntax in let constants_key = [Constants_repr.version; "constants"] in @@ -4335,8 +4027,6 @@ let register () = Validators.register () ; Sc_rollup.register () ; Dal.register () ; - Staking.register () ; - Delegates.register () ; Registration.register0 ~chunked:false S.current_level (fun ctxt q () -> if q.offset < 0l then Environment.Error_monad.tzfail Negative_level_offset else diff --git a/src/proto_beta/lib_plugin/delegate_services.ml b/src/proto_beta/lib_plugin/delegate_services.ml index 759f73ec419a5f8e8375c2df3e3803f0247c5248..ce4f5e83be2fbd61040cb4c1a8bc3fa5ba7a41de 100644 --- a/src/proto_beta/lib_plugin/delegate_services.ml +++ b/src/proto_beta/lib_plugin/delegate_services.ml @@ -58,6 +58,15 @@ let () = (function Balance_rpc_non_delegate pkh -> Some pkh | _ -> None) (fun pkh -> Balance_rpc_non_delegate pkh) +let stakers_encoding = + let open Data_encoding in + let staker_enconding = + obj2 + (req "staker" Alpha_context.Contract.implicit_encoding) + (req "frozen_deposits" Tez.encoding) + in + list staker_enconding + type consensus_key = { consensus_key_pkh : Signature.Public_key_hash.t; consensus_key_pk : Signature.Public_key.t; @@ -143,6 +152,8 @@ let deposit_per_cycle_encoding : deposit_per_cycle Data_encoding.t = (fun (cycle, deposit) -> {cycle; deposit}) (obj2 (req "cycle" Cycle.encoding) (req "deposit" Tez.encoding)) +type unstaked_per_cycle = deposit_per_cycle list + let unstaked_per_cycle_encoding = Data_encoding.list deposit_per_cycle_encoding type pending_staking_parameters = Cycle.t * Staking_parameters_repr.t @@ -154,6 +165,314 @@ let pending_staking_parameters_encoding : (req "cycle" Cycle.encoding) (req "parameters" Staking_parameters_repr.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)) + +(* TODO: https://gitlab.com/tezos/tezos/-/issues/7369 + update tests to use new_info instead, then remove this type *) +type info = { + full_balance : Tez.t; + current_frozen_deposits : Tez.t; + frozen_deposits : Tez.t; + staking_balance : Tez.t; + frozen_deposits_limit : Tez.t option; + delegated_contracts : Alpha_context.Contract.t list; + delegated_balance : 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; + grace_period : Cycle.t; + pending_denunciations : bool; + voting_info : Vote.delegate_info; + active_consensus_key : Signature.Public_key_hash.t; + pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; +} + +type new_info = { + (* + General baking information *) + deactivated : bool; + is_forbidden : bool; + participation : Delegate.For_RPC.participation_info; + grace_period : Cycle.t; + active_staking_parameters : Staking_parameters_repr.t; + pending_staking_parameters : pending_staking_parameters list; + (* + Baking rights *) + baking_power : int64; + total_staked (* old name: current_frozen_deposits *) : Tez.t; + total_delegated (* new *) : Tez.t; + min_delegated_in_current_cycle : Tez.t * Level_repr.t option; + own_full_balance (* old name: full_balance *) : Tez.t; + own_staked (* new *) : Tez.t; + own_delegated (* new *) : Tez.t; + external_staked (* old name: total_delegated_stake *) : Tez.t; + external_delegated (* new *) : Tez.t; + total_unstaked_per_cycle + (* old RPC name: unstaked_frozen_deposits; was not in info *) : + unstaked_per_cycle; + denunciations (* replaces pending_denunciations *) : Denunciations_repr.t; + estimated_shared_pending_slashed_amount (* new *) : Tez.t; + staking_denominator : Staking_pseudotoken.t; + (* + Voting *) + current_voting_power : int64; + voting_power : int64; + voting_info : Vote.delegate_info; + (* + Consensus key *) + consensus_key + (* corresponds to old active_consensus_key and pending_consensus_keys *) : + consensus_keys_info; + (* + Chunked RPCs at the end, because they might be arbitrarily large *) + stakers : (public_key_hash * Tez.t) list; + delegators (* old name: delegated_contracts *) : Contract.t list; +} +(* Removed: + - frozen_deposits_limit (has no effects) + - frozen_deposits (equals total_staked on last block three cycles ago) + - staking_balance (equals total_staked + total_delegated + - delegated_balance (equals external_staked + external_delegated) *) + +let conv25 ty = + Data_encoding.conv + (fun ( x0, + x1, + x2, + x3, + x4, + x5, + x6, + x7, + x8, + x9, + x10, + x11, + x12, + x13, + x14, + x15, + x16, + x17, + x18, + x19, + x20, + x21, + x22, + x23, + x24 ) -> + ( (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9), + ( (x10, x11, x12, x13, x14, x15, x16, x17, x18, x19), + (x20, x21, x22, x23, x24) ) )) + (fun ( (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9), + ( (x10, x11, x12, x13, x14, x15, x16, x17, x18, x19), + (x20, x21, x22, x23, x24) ) ) -> + ( x0, + x1, + x2, + x3, + x4, + x5, + x6, + x7, + x8, + x9, + x10, + x11, + x12, + x13, + x14, + x15, + x16, + x17, + x18, + x19, + x20, + x21, + x22, + x23, + x24 )) + ty + +let obj25 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 + f20 f21 f22 f23 f24 = + conv25 + Data_encoding.( + merge_objs + (obj10 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9) + (merge_objs + (obj10 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19) + (obj5 f20 f21 f22 f23 f24))) + +let info_encoding = + let open Data_encoding in + conv + (fun { + (* General baking information *) + deactivated; + is_forbidden; + participation; + grace_period; + active_staking_parameters; + pending_staking_parameters; + (* Baking rights *) + baking_power; + total_staked; + total_delegated; + min_delegated_in_current_cycle; + own_full_balance; + own_staked; + own_delegated; + external_staked; + external_delegated; + total_unstaked_per_cycle; + denunciations; + estimated_shared_pending_slashed_amount; + staking_denominator; + (* Voting *) + current_voting_power; + voting_power; + voting_info; + (* Consensus key *) + consensus_key; + (* Chunked RPCs *) + stakers; + delegators; + } -> + ( (* General baking information *) + deactivated, + is_forbidden, + participation, + grace_period, + active_staking_parameters, + pending_staking_parameters, + (* Baking rights *) + baking_power, + total_staked, + total_delegated, + min_delegated_in_current_cycle, + own_full_balance, + own_staked, + own_delegated, + external_staked, + external_delegated, + total_unstaked_per_cycle, + denunciations, + estimated_shared_pending_slashed_amount, + staking_denominator, + (* Voting *) + current_voting_power, + voting_power, + voting_info, + (* Consensus key *) + consensus_key, + (* Chunked RPCs *) + stakers, + delegators )) + (fun ( (* General baking information *) + deactivated, + is_forbidden, + participation, + grace_period, + active_staking_parameters, + pending_staking_parameters, + (* Baking rights *) + baking_power, + total_staked, + total_delegated, + min_delegated_in_current_cycle, + own_full_balance, + own_staked, + own_delegated, + external_staked, + external_delegated, + total_unstaked_per_cycle, + denunciations, + estimated_shared_pending_slashed_amount, + staking_denominator, + (* Voting *) + current_voting_power, + voting_power, + voting_info, + (* Consensus key *) + consensus_key, + (* Chunked RPCs *) + stakers, + delegators ) -> + { + (* General baking information *) + deactivated; + is_forbidden; + participation; + grace_period; + active_staking_parameters; + pending_staking_parameters; + (* Baking rights *) + baking_power; + total_staked; + total_delegated; + min_delegated_in_current_cycle; + own_full_balance; + own_staked; + own_delegated; + external_staked; + external_delegated; + total_unstaked_per_cycle; + denunciations; + estimated_shared_pending_slashed_amount; + staking_denominator; + (* Voting *) + current_voting_power; + voting_power; + voting_info; + (* Consensus key *) + consensus_key; + (* Chunked RPCs *) + stakers; + delegators; + }) + (obj25 + (* General baking information *) + (req "deactivated" bool) + (req "is_forbidden" bool) + (req "participation" participation_info_encoding) + (req "grace_period" Cycle.encoding) + (req "active_staking_parameters" Staking_parameters_repr.encoding) + (req + "pending_staking_parameters" + (list pending_staking_parameters_encoding)) + (* Baking rights *) + (req "baking_power" int64) + (req "total_staked" Tez.encoding) + (req "total_delegated" Tez.encoding) + (req + "min_delegated_in_current_cycle" + min_delegated_in_current_cycle_encoding) + (req "own_full_balance" Tez.encoding) + (req "own_staked" Tez.encoding) + (req "own_delegated" Tez.encoding) + (req "external_staked" Tez.encoding) + (req "external_delegated" Tez.encoding) + (req "total_unstaked_per_cycle" unstaked_per_cycle_encoding) + (req "denunciations" Denunciations_repr.encoding) + (req "estimated_shared_pending_slashed_amount" Tez.encoding) + (req "staking_denominator" Staking_pseudotoken.For_RPC.encoding) + (* Voting *) + (req "current_voting_power" int64) + (req "voting_power" int64) + (req "voting_info" Vote.delegate_info_encoding) + (* Consensus key *) + (req "consensus_key" consensus_key_info_encoding) + (* Chunked RPCs *) + (req "stakers" stakers_encoding) + (req "delegators" (list Contract.encoding))) + module S = struct let raw_path = RPC_path.(open_root / "context" / "delegates") @@ -276,6 +595,23 @@ module S = struct RPC_path.(path / "unstaked_frozen_deposits") end + let is_forbidden = + RPC_service.get_service + ~description: + "Returns true if the delegate is forbidden to participate in consensus." + ~query:RPC_query.empty + ~output:Data_encoding.bool + RPC_path.(path / "is_forbidden") + + let stakers = + RPC_service.get_service + ~description: + "Returns the list of accounts that stake to a given delegate together \ + with their share of the frozen deposits." + ~query:RPC_query.empty + ~output:stakers_encoding + RPC_path.(path / "stakers") + let own_full_balance = RPC_service.get_service ~description: @@ -522,6 +858,34 @@ module S = struct ~query:RPC_query.empty ~output:Tez.encoding RPC_path.(path / "estimated_shared_pending_slashed_amount") + + let min_delegated_in_current_cycle = + RPC_service.get_service + ~description: + "Returns the minimum of delegated tez (in mutez) during the current \ + cycle and the block level at the end of which the minimum was \ + reached. This only takes into account the value of `total_delegated` \ + at the end of each block, not in the middle of applying operations. \ + This is the delegated amount that would be used to compute the \ + delegate's future baking rights if the cycle ended at the current \ + block. If the minimum was reached multiple times, the returned level \ + is the earliest level of the current cycle that reached this minimum. \ + For instance, if `total_delegated` hasn't changed at all since the \ + beginning of the current cycle, returns the first level of the \ + current cycle. (If the contract is not registered as a delegate, \ + returns 0 mutez and omits the level.)" + ~query:RPC_query.empty + ~output:min_delegated_in_current_cycle_encoding + RPC_path.(path / "min_delegated_in_current_cycle") + + let info = + RPC_service.get_service + ~description: + "Everything about a delegate. Gathers the outputs of all RPCs with the \ + ../delegates/ prefix." + ~query:RPC_query.empty + ~output:info_encoding + path end let check_delegate_registered ctxt pkh = @@ -531,6 +895,47 @@ let check_delegate_registered ctxt pkh = | true -> return_unit | false -> tzfail (Not_registered pkh) +let consensus_key ctxt pkh = + let open Lwt_result_syntax in + let* {consensus_pk = consensus_key_pk; consensus_pkh = consensus_key_pkh; _} = + Delegate.Consensus_key.active_pubkey ctxt pkh + in + let* pendings = Delegate.Consensus_key.pending_updates ctxt pkh in + let pendings = + List.map + (fun (cycle, consensus_key_pkh, consensus_key_pk) -> + (cycle, {consensus_key_pk; consensus_key_pkh})) + pendings + in + return {active = {consensus_key_pk; consensus_key_pkh}; pendings} + +let contract_stake ctxt ~delegator_contract ~delegate = + let open Alpha_context in + let open Lwt_result_syntax in + let* staked_balance = + Staking_pseudotokens.For_RPC.staked_balance + ctxt + ~contract:delegator_contract + ~delegate + in + if not Tez.(staked_balance = zero) then + let delegator_pkh = + match delegator_contract with + | Contract.Implicit pkh -> pkh + | Contract.Originated _ -> assert false + (* Originated contracts cannot stake *) + in + return @@ Some (delegator_pkh, staked_balance) + else return_none + +let stakers ctxt pkh = + let open Lwt_result_syntax in + let*! delegators = Delegate.delegated_contracts ctxt pkh in + List.filter_map_es + (fun delegator_contract -> + contract_stake ctxt ~delegator_contract ~delegate:pkh) + delegators + let f_own_full_balance ctxt pkh () () = let open Lwt_result_syntax in let* () = @@ -683,6 +1088,86 @@ let f_delegators ctxt pkh () () = let*! contracts = Delegate.delegated_contracts ctxt pkh in return contracts +let info ctxt pkh = + let open Lwt_result_syntax in + (* General baking information *) + let* deactivated = Delegate.deactivated ctxt pkh in + let is_forbidden = Delegate.is_forbidden_delegate ctxt pkh in + let* participation = Delegate.For_RPC.participation_info ctxt pkh in + let* grace_period = Delegate.last_cycle_before_deactivation ctxt pkh in + let* active_staking_parameters = + Delegate.Staking_parameters.of_delegate ctxt pkh + in + let* pending_staking_parameters = + Delegate.Staking_parameters.pending_updates ctxt pkh + in + (* Baking rights *) + let* baking_power = + Stake_distribution.For_RPC.delegate_current_baking_power ctxt pkh + in + let* total_staked = total_staked ctxt pkh in + let* total_delegated = total_delegated ctxt pkh in + let* min_delegated_in_current_cycle = + Delegate.For_RPC.min_delegated_in_current_cycle ctxt pkh + in + let* own_full_balance = Delegate.For_RPC.full_balance ctxt pkh in + let* own_staked = own_staked ctxt pkh in + let* own_delegated = own_delegated ctxt pkh in + let* external_staked = external_staked ctxt pkh in + let* external_delegated = external_delegated ctxt pkh in + let* total_unstaked_per_cycle = total_unstaked_per_cycle ctxt pkh in + let* denunciations = Delegate.For_RPC.pending_denunciations ctxt pkh in + let* estimated_shared_pending_slashed_amount = + Delegate.For_RPC.get_estimated_shared_pending_slashed_amount ctxt pkh + in + let* staking_denominator = + Staking_pseudotokens.For_RPC.get_frozen_deposits_pseudotokens + ctxt + ~delegate:pkh + in + (* Voting *) + let* current_voting_power = Vote.get_current_voting_power_free ctxt pkh in + let* voting_power = Vote.get_voting_power_free ctxt pkh in + let* voting_info = Vote.get_delegate_info ctxt pkh in + (* Consensus key *) + let* consensus_key = consensus_key ctxt pkh in + (* Chunked RPCs *) + let* stakers = stakers ctxt pkh in + let*! delegators = Delegate.delegated_contracts ctxt pkh in + return + { + (* General baking information *) + deactivated; + is_forbidden; + participation; + grace_period; + active_staking_parameters; + pending_staking_parameters; + (* Baking rights *) + baking_power; + total_staked; + total_delegated; + min_delegated_in_current_cycle; + own_full_balance; + own_staked; + own_delegated; + external_staked; + external_delegated; + total_unstaked_per_cycle; + denunciations; + estimated_shared_pending_slashed_amount; + staking_denominator; + (* Voting *) + current_voting_power; + voting_power; + voting_info; + (* Consensus key *) + consensus_key; + (* Chunked RPCs *) + stakers; + delegators; + } + let wrap_check_registered ~chunked s f = register1 ~chunked s (fun ctxt pkh () () -> let open Lwt_result_syntax in @@ -729,6 +1214,9 @@ let register () = | {with_minimal_stake = true; without_minimal_stake = true; _} | {with_minimal_stake = false; without_minimal_stake = false; _} -> return delegates) ; + register1 ~chunked:false S.is_forbidden (fun ctxt pkh () () -> + return @@ Delegate.is_forbidden_delegate ctxt pkh) ; + wrap_check_registered ~chunked:true S.stakers stakers ; register1 ~chunked:false S.Deprecated.full_balance f_own_full_balance ; register1 ~chunked:false S.own_full_balance f_own_full_balance ; register1 ~chunked:false S.Deprecated.current_frozen_deposits f_total_staked ; @@ -787,21 +1275,7 @@ let register () = let* () = check_delegate_registered ctxt pkh in Vote.get_delegate_info ctxt pkh) ; register1 ~chunked:false S.consensus_key (fun ctxt pkh () () -> - let* { - consensus_pk = consensus_key_pk; - consensus_pkh = consensus_key_pkh; - _; - } = - Delegate.Consensus_key.active_pubkey ctxt pkh - in - let* pendings = Delegate.Consensus_key.pending_updates ctxt pkh in - let pendings = - List.map - (fun (cycle, consensus_key_pkh, consensus_key_pk) -> - (cycle, {consensus_key_pk; consensus_key_pkh})) - pendings - in - return {active = {consensus_key_pk; consensus_key_pkh}; pendings}) ; + consensus_key ctxt pkh) ; register1 ~chunked:false S.participation (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.For_RPC.participation_info ctxt pkh) ; @@ -816,7 +1290,14 @@ let register () = S.estimated_shared_pending_slashed_amount (fun ctxt delegate () () -> let* () = check_delegate_registered ctxt delegate in - Delegate.For_RPC.get_estimated_shared_pending_slashed_amount ctxt delegate) + Delegate.For_RPC.get_estimated_shared_pending_slashed_amount ctxt delegate) ; + register1 + ~chunked:false + S.min_delegated_in_current_cycle + (fun ctxt pkh () () -> + let* () = check_delegate_registered ctxt pkh in + Delegate.For_RPC.min_delegated_in_current_cycle ctxt pkh) ; + wrap_check_registered ~chunked:true S.info info let list ctxt block ?(active = true) ?(inactive = false) ?(with_minimal_stake = true) ?(without_minimal_stake = false) () = @@ -827,6 +1308,9 @@ let list ctxt block ?(active = true) ?(inactive = false) {active; inactive; with_minimal_stake; without_minimal_stake} () +let is_forbidden ctxt block pkh = + RPC_context.make_call1 S.is_forbidden ctxt block pkh () () + let full_balance ctxt block pkh = RPC_context.make_call1 S.own_full_balance ctxt block pkh () () @@ -901,3 +1385,70 @@ let estimated_shared_pending_slashed_amount ctxt block pkh = pkh () () + +let info ctxt block pkh = + let open Lwt_result_syntax in + let* { + (* General baking information *) + deactivated; + is_forbidden = _; + participation = _; + grace_period; + active_staking_parameters = _; + pending_staking_parameters = _; + (* Baking rights *) + baking_power = _; + total_staked; + total_delegated; + min_delegated_in_current_cycle; + own_full_balance; + own_staked = _; + own_delegated = _; + external_staked; + external_delegated; + total_unstaked_per_cycle = _; + denunciations; + estimated_shared_pending_slashed_amount = _; + staking_denominator; + (* Voting *) + current_voting_power = _; + voting_power = _; + voting_info; + (* Consensus key *) + consensus_key; + (* Chunked RPCs *) + stakers = _; + delegators; + } = + RPC_context.make_call1 S.info ctxt block pkh () () + in + let* frozen_deposits = frozen_deposits ctxt block pkh in + let*? staking_balance = + Environment.wrap_tzresult Tez.(total_staked +? total_delegated) + in + let* frozen_deposits_limit = frozen_deposits_limit ctxt block pkh in + let*? delegated_balance = + Environment.wrap_tzresult Tez.(external_staked +? external_delegated) + in + return + { + full_balance = own_full_balance; + current_frozen_deposits = total_staked; + frozen_deposits; + staking_balance; + frozen_deposits_limit; + delegated_contracts = delegators; + delegated_balance; + min_delegated_in_current_cycle; + total_delegated_stake = external_staked; + staking_denominator; + deactivated; + grace_period; + pending_denunciations = not (List.is_empty denunciations); + voting_info; + active_consensus_key = consensus_key.active.consensus_key_pkh; + pending_consensus_keys = + List.map + (fun (cyc, ck) -> (cyc, ck.consensus_key_pkh)) + consensus_key.pendings; + } diff --git a/src/proto_beta/lib_plugin/delegate_services.mli b/src/proto_beta/lib_plugin/delegate_services.mli index dbd102e32076b745c07aab8cad3093dc096acfd4..dde556a498debb1cf97719d2bbda135c814706d5 100644 --- a/src/proto_beta/lib_plugin/delegate_services.mli +++ b/src/proto_beta/lib_plugin/delegate_services.mli @@ -60,6 +60,28 @@ type deposit_per_cycle = {cycle : Cycle.t; deposit : Tez.t} val deposit_per_cycle_encoding : deposit_per_cycle Data_encoding.t +type info = { + full_balance : Tez.t; + current_frozen_deposits : Tez.t; + frozen_deposits : Tez.t; + staking_balance : Tez.t; + frozen_deposits_limit : Tez.t option; + delegated_contracts : Alpha_context.Contract.t list; + delegated_balance : 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; + grace_period : Cycle.t; + pending_denunciations : bool; + voting_info : Vote.delegate_info; + active_consensus_key : Signature.Public_key_hash.t; + pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; +} + +val is_forbidden : + 'a #RPC_context.simple -> 'a -> public_key_hash -> bool shell_tzresult Lwt.t + val full_balance : 'a #RPC_context.simple -> 'a -> @@ -171,6 +193,9 @@ val pending_denunciations : val estimated_shared_pending_slashed_amount : 'a #RPC_context.simple -> 'a -> public_key_hash -> Tez.t shell_tzresult Lwt.t +val info : + 'a #RPC_context.simple -> 'a -> public_key_hash -> info shell_tzresult Lwt.t + val register : unit -> unit (** For RPC.ml *) diff --git a/src/proto_beta/lib_protocol/test/helpers/block.ml b/src/proto_beta/lib_protocol/test/helpers/block.ml index 794b2c1342f92f06405ea770e867ed33cb32c0bb..763aac2384f4198eec1c9af0bf7f90a8e005187c 100644 --- a/src/proto_beta/lib_protocol/test/helpers/block.ml +++ b/src/proto_beta/lib_protocol/test/helpers/block.ml @@ -140,9 +140,9 @@ let get_next_baker_excluding excludes block = let* baker_opt = List.find_es (fun {Plugin.RPC.Baking_rights.consensus_key; delegate; _} -> - let* info = Plugin.RPC.Delegates.info rpc_ctxt block delegate in + let* info = Delegate_services.info rpc_ctxt block delegate in let* forbidden = - Plugin.RPC.Staking.is_forbidden rpc_ctxt block delegate + Delegate_services.is_forbidden rpc_ctxt block delegate in return @@ ((not info.deactivated) && (not forbidden) diff --git a/src/proto_beta/lib_protocol/test/helpers/context.ml b/src/proto_beta/lib_protocol/test/helpers/context.ml index 8a51a59bf8a93194d967ef5c6a38c5b8ba14306c..61ba6a57a3b06336ff8a66d0786fb93c5c3c98c7 100644 --- a/src/proto_beta/lib_protocol/test/helpers/context.ml +++ b/src/proto_beta/lib_protocol/test/helpers/context.ml @@ -524,7 +524,7 @@ module Contract = struct end module Delegate = struct - type info = Plugin.RPC.Delegates.info = { + type info = Delegate_services.info = { full_balance : Tez.t; current_frozen_deposits : Tez.t; frozen_deposits : Tez.t; @@ -547,7 +547,7 @@ module Delegate = struct let grace_period ctxt pkh = Delegate_services.grace_period rpc_ctxt ctxt pkh - let info ctxt pkh = Plugin.RPC.Delegates.info rpc_ctxt ctxt pkh + let info ctxt pkh = Delegate_services.info rpc_ctxt ctxt pkh let full_balance ?(__LOC__ = __LOC__) ctxt pkh = get_delegate_own_full_balance_and_check ~__LOC__ ctxt pkh @@ -582,7 +582,7 @@ module Delegate = struct let participation ctxt pkh = Delegate_services.participation rpc_ctxt ctxt pkh - let is_forbidden ctxt pkh = Plugin.RPC.Staking.is_forbidden rpc_ctxt ctxt pkh + let is_forbidden ctxt pkh = Delegate_services.is_forbidden rpc_ctxt ctxt pkh let stake_for_cycle ctxt cycle pkh = let open Lwt_result_wrap_syntax in diff --git a/src/proto_beta/lib_protocol/test/helpers/context.mli b/src/proto_beta/lib_protocol/test/helpers/context.mli index dbe3c6333c1666e3b5022ae8e8356330ad725567..6fe83b81197a6d2b46d650a97e3910da2e172d76 100644 --- a/src/proto_beta/lib_protocol/test/helpers/context.mli +++ b/src/proto_beta/lib_protocol/test/helpers/context.mli @@ -258,7 +258,7 @@ module Contract : sig end module Delegate : sig - type info = Plugin.RPC.Delegates.info = { + type info = Delegate_services.info = { full_balance : Tez.t; current_frozen_deposits : Tez.t; frozen_deposits : Tez.t; @@ -279,7 +279,7 @@ module Delegate : sig type stake = {frozen : Tez.t; weighted_delegated : Tez.t} - val info : t -> public_key_hash -> Plugin.RPC.Delegates.info tzresult Lwt.t + val info : t -> public_key_hash -> Delegate_services.info tzresult Lwt.t (** Calls RPCs [/chains//blocks//contracts/ ?block:string -> string -> JSON.t t +(** RPC: [GET /chains//blocks//context/delegates//consensus_key] + + [chain] defaults to ["main"]. + [block] defaults to ["head"]. *) +val get_chain_block_context_delegate_consensus_key : + ?chain:string -> ?block:string -> string -> JSON.t t + (** RPC: [GET /chains//blocks//context/total_supply] [chain] defaults to ["main"]. diff --git a/tezt/tests/consensus_key.ml b/tezt/tests/consensus_key.ml index ef2b0ba972ac3a3d75c2233255f45db76b0a012f..76f2b5693bf8f7602e517813912d2be322316a08 100644 --- a/tezt/tests/consensus_key.ml +++ b/tezt/tests/consensus_key.ml @@ -524,17 +524,17 @@ let consensus_key_typ : consensus_key Check.typ = (tuple2 string (list (tuple2 int string)))) let get_consensus_key client (delegate : Account.key) : consensus_key Lwt.t = - let* delegate_json = + let* json = Client.RPC.call client - @@ RPC.get_chain_block_context_delegate delegate.public_key_hash + @@ RPC.get_chain_block_context_delegate_consensus_key + delegate.public_key_hash in return JSON. { - active_consensus_key = - delegate_json |-> "active_consensus_key" |> as_string; + active_consensus_key = json |-> "active" |-> "pkh" |> as_string; pending_consensus_keys = - delegate_json |-> "pending_consensus_keys" |> as_list + json |-> "pendings" |> as_list |> List.map (fun pending_key -> ( pending_key |-> "cycle" |> as_int, pending_key |-> "pkh" |> as_string )); 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 29602dc55a142c53e37b467120970e13c4e5ad95..28829e740f34e22dda685e509d7e416b54821f8d 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 @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" 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 d3577edcf2c118f6708f122400183f745bcfaee5..c7e8cc22050588faa60f5901564134a483d96031 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 @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" 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 6982ef2ae258d70a82143ca34669eacf515ae1c2..02c772dc091bf8f316c3150d5ea7712a957ce3da 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 @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" 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 29602dc55a142c53e37b467120970e13c4e5ad95..28829e740f34e22dda685e509d7e416b54821f8d 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 @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" 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 29602dc55a142c53e37b467120970e13c4e5ad95..28829e740f34e22dda685e509d7e416b54821f8d 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 @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" diff --git a/tezt/tests/expected/RPC_test.ml/Beta-- (mode client) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Beta-- (mode client) RPC regression tests- delegates.out index 29602dc55a142c53e37b467120970e13c4e5ad95..28829e740f34e22dda685e509d7e416b54821f8d 100644 --- a/tezt/tests/expected/RPC_test.ml/Beta-- (mode client) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Beta-- (mode client) RPC regression tests- delegates.out @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" diff --git a/tezt/tests/expected/RPC_test.ml/Beta-- (mode light) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Beta-- (mode light) RPC regression tests- delegates.out index d3577edcf2c118f6708f122400183f745bcfaee5..c7e8cc22050588faa60f5901564134a483d96031 100644 --- a/tezt/tests/expected/RPC_test.ml/Beta-- (mode light) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Beta-- (mode light) RPC regression tests- delegates.out @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" diff --git a/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy) RPC regression tests- delegates.out index 6982ef2ae258d70a82143ca34669eacf515ae1c2..02c772dc091bf8f316c3150d5ea7712a957ce3da 100644 --- a/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy) RPC regression tests- delegates.out @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" diff --git a/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy_server_data_dir) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy_server_data_dir) RPC regression tests- delegates.out index 29602dc55a142c53e37b467120970e13c4e5ad95..28829e740f34e22dda685e509d7e416b54821f8d 100644 --- a/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy_server_data_dir) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy_server_data_dir) RPC regression tests- delegates.out @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" diff --git a/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy_server_rpc) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy_server_rpc) RPC regression tests- delegates.out index 29602dc55a142c53e37b467120970e13c4e5ad95..28829e740f34e22dda685e509d7e416b54821f8d 100644 --- a/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy_server_rpc) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Beta-- (mode proxy_server_rpc) RPC regression tests- delegates.out @@ -17,19 +17,39 @@ "[PUBLIC_KEY_HASH]" ] ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 409, "minimal_cycle_activity": 272, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 137, + "expected_attesting_rewards": "1065036" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' "4000000000000" 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 04ed113bd1c04c747cea3e1333a28ef083bf755f..6f1be69be9dbca52a11c8370a7196798704fe423 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 @@ -26,66 +26,149 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000333333", "current_frozen_deposits": "200000016667", - "frozen_deposits": "200000000000", "staking_balance": "4000000333333", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000016667", + "total_staked": "200000016667", "total_delegated": "3800000316666", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "4000000333333", "own_staked": "200000016667", + "own_delegated": "3800000316666", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000333333", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000016667" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "3800003133203" @@ -119,19 +202,40 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "238000528932", "current_frozen_deposits": "200000181573", - "frozen_deposits": "200000083983", "staking_balance": "238000528932", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 59, "missed_levels": 1, + "remaining_allowed_missed_slots": 9, + "expected_attesting_rewards": "531216" }, "grace_period": 4, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "238000528932", + "total_staked": "200000181573", "total_delegated": "38000347359", "min_delegated_in_current_cycle": { "amount": "38000347359", "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]" } + "expected_commitment": false } }, + "own_full_balance": "238000528932", "own_staked": "200000181573", + "own_delegated": "38000347359", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" }, + { "cycle": 2, "deposit": "3" } ], "denunciations": [], + "estimated_shared_pending_slashed_amount": "0", "staking_denominator": "0", + "current_voting_power": "238000528932", "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000181573" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "38000347355" 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 86e6fa7b4e571c134d4c67e991206e783f13c766..57703d4fdd4a6c81d0e19d59d95e5c8dfba5ea1b 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 @@ -26,66 +26,149 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000333333", "current_frozen_deposits": "200000016667", - "frozen_deposits": "200000000000", "staking_balance": "4000000333333", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000016667", + "total_staked": "200000016667", "total_delegated": "3800000316666", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "4000000333333", "own_staked": "200000016667", + "own_delegated": "3800000316666", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000333333", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000016667" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "3800003133203" @@ -119,19 +202,40 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "238000528932", "current_frozen_deposits": "200000181573", - "frozen_deposits": "200000083983", "staking_balance": "238000528932", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 59, "missed_levels": 1, + "remaining_allowed_missed_slots": 9, + "expected_attesting_rewards": "531216" }, "grace_period": 4, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "238000528932", + "total_staked": "200000181573", "total_delegated": "38000347359", "min_delegated_in_current_cycle": { "amount": "38000347359", "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]" } + "expected_commitment": false } }, + "own_full_balance": "238000528932", "own_staked": "200000181573", + "own_delegated": "38000347359", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" }, + { "cycle": 2, "deposit": "3" } ], "denunciations": [], + "estimated_shared_pending_slashed_amount": "0", "staking_denominator": "0", + "current_voting_power": "238000528932", "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000181573" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "38000347355" 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 1f609f596616c14d1ca122e0252c61a7b46954a6..68170ba4a1b250a751b8331d5931cbc0e310cd19 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 @@ -26,66 +26,149 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "3999999999716", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "3999999999716", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "3999999999716", + "total_staked": "200000000000", "total_delegated": "3799999999716", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "3999999999716", "own_staked": "200000000000", + "own_delegated": "3799999999716", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "3999999999716", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "3800002816253" @@ -119,19 +202,40 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "238000509096", "current_frozen_deposits": "200000164892", - "frozen_deposits": "200000067302", "staking_balance": "238000509096", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 59, "missed_levels": 1, + "remaining_allowed_missed_slots": 9, + "expected_attesting_rewards": "531216" }, "grace_period": 4, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "238000509096", + "total_staked": "200000164892", "total_delegated": "38000344204", "min_delegated_in_current_cycle": { "amount": "38000344204", "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]" } + "expected_commitment": false } }, + "own_full_balance": "238000509096", "own_staked": "200000164892", + "own_delegated": "38000344204", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" }, + { "cycle": 2, "deposit": "3" } ], "denunciations": [], + "estimated_shared_pending_slashed_amount": "0", "staking_denominator": "0", + "current_voting_power": "238000509096", "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164892" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "38000344186" 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 eab9a7f599ca82595d7b1a335401bd29bad504f2..ff88f0e793b34a53e03dc62626ea29eaa4997d79 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 @@ -26,66 +26,149 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "3999999999716", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "3999999999716", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "3999999999716", + "total_staked": "200000000000", "total_delegated": "3799999999716", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "3999999999716", "own_staked": "200000000000", + "own_delegated": "3799999999716", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "3999999999716", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "3800002816253" @@ -119,19 +202,40 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "238000509096", "current_frozen_deposits": "200000164892", - "frozen_deposits": "200000067302", "staking_balance": "238000509096", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 59, "missed_levels": 1, + "remaining_allowed_missed_slots": 9, + "expected_attesting_rewards": "531216" }, "grace_period": 4, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "238000509096", + "total_staked": "200000164892", "total_delegated": "38000344204", "min_delegated_in_current_cycle": { "amount": "38000344204", "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]" } + "expected_commitment": false } }, + "own_full_balance": "238000509096", "own_staked": "200000164892", + "own_delegated": "38000344204", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" }, + { "cycle": 2, "deposit": "3" } ], "denunciations": [], + "estimated_shared_pending_slashed_amount": "0", "staking_denominator": "0", + "current_voting_power": "238000509096", "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164892" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "38000344186" 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 e486972489952089276e75838b28842fa07b24fa..b755654ea33ae74d36e3e2f56d9f5083b1cf292a 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 @@ -61,34 +61,71 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "999999999385", "current_frozen_deposits": "0", - "frozen_deposits": "0", "staking_balance": "999999999385", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 0, + "expected_attesting_rewards": "0" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "0", "total_staked": "0", + "total_delegated": "999999999385", "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": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "999999999385", "own_staked": "0", + "own_delegated": "999999999385", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "999999999385", + "voting_power": "0", "voting_info": {}, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": [], "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]' { "balance": "0", "counter": "4" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "999999999385", "current_frozen_deposits": "49999999970", - "frozen_deposits": "0", "staking_balance": "999999999385", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 0, + "expected_attesting_rewards": "0" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "999999999385", + "total_staked": "49999999970", "total_delegated": "949999999415", "min_delegated_in_current_cycle": { "amount": "949999999415", "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", - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "999999999385", "own_staked": "49999999970", + "own_delegated": "949999999415", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "999999999385", + "voting_power": "0", "voting_info": {}, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "49999999970" } ], + "delegators": [ "[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 0672d6768a3cde500530be5ee40e0af91a2bef13..eaf6da79c5a63546b2673c2fc08b9462982be628 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 @@ -26,48 +26,110 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000333333", "current_frozen_deposits": "200000016667", - "frozen_deposits": "200000000000", "staking_balance": "4000000333333", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000016667", + "total_staked": "200000016667", "total_delegated": "3800000316666", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "4000000333333", "own_staked": "200000016667", + "own_delegated": "3800000316666", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000333333", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000016667" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } 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 4e4583b1817d6dbb944169c77de6a76b588e25f7..0f778295f5ee749bfbc955a651e9b90c4de417c1 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 @@ -26,48 +26,110 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "3999999999716", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "3999999999716", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "3999999999716", + "total_staked": "200000000000", "total_delegated": "3799999999716", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "3999999999716", "own_staked": "200000000000", + "own_delegated": "3799999999716", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "3999999999716", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } diff --git a/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker - delegate - consensus - destination).out b/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker - delegate - consensus - destination).out index 04ed113bd1c04c747cea3e1333a28ef083bf755f..6f1be69be9dbca52a11c8370a7196798704fe423 100644 --- a/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker - delegate - consensus - destination).out +++ b/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker - delegate - consensus - destination).out @@ -26,66 +26,149 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000333333", "current_frozen_deposits": "200000016667", - "frozen_deposits": "200000000000", "staking_balance": "4000000333333", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000016667", + "total_staked": "200000016667", "total_delegated": "3800000316666", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "4000000333333", "own_staked": "200000016667", + "own_delegated": "3800000316666", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000333333", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000016667" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "3800003133203" @@ -119,19 +202,40 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "238000528932", "current_frozen_deposits": "200000181573", - "frozen_deposits": "200000083983", "staking_balance": "238000528932", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 59, "missed_levels": 1, + "remaining_allowed_missed_slots": 9, + "expected_attesting_rewards": "531216" }, "grace_period": 4, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "238000528932", + "total_staked": "200000181573", "total_delegated": "38000347359", "min_delegated_in_current_cycle": { "amount": "38000347359", "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]" } + "expected_commitment": false } }, + "own_full_balance": "238000528932", "own_staked": "200000181573", + "own_delegated": "38000347359", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" }, + { "cycle": 2, "deposit": "3" } ], "denunciations": [], + "estimated_shared_pending_slashed_amount": "0", "staking_denominator": "0", + "current_voting_power": "238000528932", "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000181573" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "38000347355" diff --git a/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker - delegate - consensus -- destination).out b/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker - delegate - consensus -- destination).out index 86e6fa7b4e571c134d4c67e991206e783f13c766..57703d4fdd4a6c81d0e19d59d95e5c8dfba5ea1b 100644 --- a/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker - delegate - consensus -- destination).out +++ b/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker - delegate - consensus -- destination).out @@ -26,66 +26,149 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000333333", "current_frozen_deposits": "200000016667", - "frozen_deposits": "200000000000", "staking_balance": "4000000333333", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000016667", + "total_staked": "200000016667", "total_delegated": "3800000316666", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "4000000333333", "own_staked": "200000016667", + "own_delegated": "3800000316666", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000333333", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000016667" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "3800003133203" @@ -119,19 +202,40 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "238000528932", "current_frozen_deposits": "200000181573", - "frozen_deposits": "200000083983", "staking_balance": "238000528932", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 59, "missed_levels": 1, + "remaining_allowed_missed_slots": 9, + "expected_attesting_rewards": "531216" }, "grace_period": 4, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "238000528932", + "total_staked": "200000181573", "total_delegated": "38000347359", "min_delegated_in_current_cycle": { "amount": "38000347359", "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]" } + "expected_commitment": false } }, + "own_full_balance": "238000528932", "own_staked": "200000181573", + "own_delegated": "38000347359", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" }, + { "cycle": 2, "deposit": "3" } ], "denunciations": [], + "estimated_shared_pending_slashed_amount": "0", "staking_denominator": "0", + "current_voting_power": "238000528932", "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000181573" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "38000347355" diff --git a/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker -- delegate - consensus - destination).out b/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker -- delegate - consensus - destination).out index 1f609f596616c14d1ca122e0252c61a7b46954a6..68170ba4a1b250a751b8331d5931cbc0e310cd19 100644 --- a/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker -- delegate - consensus - destination).out +++ b/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker -- delegate - consensus - destination).out @@ -26,66 +26,149 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "3999999999716", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "3999999999716", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "3999999999716", + "total_staked": "200000000000", "total_delegated": "3799999999716", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "3999999999716", "own_staked": "200000000000", + "own_delegated": "3799999999716", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "3999999999716", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "3800002816253" @@ -119,19 +202,40 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "238000509096", "current_frozen_deposits": "200000164892", - "frozen_deposits": "200000067302", "staking_balance": "238000509096", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 59, "missed_levels": 1, + "remaining_allowed_missed_slots": 9, + "expected_attesting_rewards": "531216" }, "grace_period": 4, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "238000509096", + "total_staked": "200000164892", "total_delegated": "38000344204", "min_delegated_in_current_cycle": { "amount": "38000344204", "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]" } + "expected_commitment": false } }, + "own_full_balance": "238000509096", "own_staked": "200000164892", + "own_delegated": "38000344204", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" }, + { "cycle": 2, "deposit": "3" } ], "denunciations": [], + "estimated_shared_pending_slashed_amount": "0", "staking_denominator": "0", + "current_voting_power": "238000509096", "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164892" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "38000344186" diff --git a/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker -- delegate - consensus -- destination).out b/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker -- delegate - consensus -- destination).out index eab9a7f599ca82595d7b1a335401bd29bad504f2..ff88f0e793b34a53e03dc62626ea29eaa4997d79 100644 --- a/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker -- delegate - consensus -- destination).out +++ b/tezt/tests/expected/consensus_key.ml/Beta-- Test drain delegate with (baker -- delegate - consensus -- destination).out @@ -26,66 +26,149 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "3999999999716", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "3999999999716", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "3999999999716", + "total_staked": "200000000000", "total_delegated": "3799999999716", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "3999999999716", "own_staked": "200000000000", + "own_delegated": "3799999999716", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "3999999999716", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "3800002816253" @@ -119,19 +202,40 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "238000509096", "current_frozen_deposits": "200000164892", - "frozen_deposits": "200000067302", "staking_balance": "238000509096", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 59, "missed_levels": 1, + "remaining_allowed_missed_slots": 9, + "expected_attesting_rewards": "531216" }, "grace_period": 4, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "238000509096", + "total_staked": "200000164892", "total_delegated": "38000344204", "min_delegated_in_current_cycle": { "amount": "38000344204", "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]" } + "expected_commitment": false } }, + "own_full_balance": "238000509096", "own_staked": "200000164892", + "own_delegated": "38000344204", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" }, + { "cycle": 2, "deposit": "3" } ], "denunciations": [], + "estimated_shared_pending_slashed_amount": "0", "staking_denominator": "0", + "current_voting_power": "238000509096", "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164892" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' "38000344186" diff --git a/tezt/tests/expected/consensus_key.ml/Beta-- Test register with consensus key.out b/tezt/tests/expected/consensus_key.ml/Beta-- Test register with consensus key.out index e486972489952089276e75838b28842fa07b24fa..b755654ea33ae74d36e3e2f56d9f5083b1cf292a 100644 --- a/tezt/tests/expected/consensus_key.ml/Beta-- Test register with consensus key.out +++ b/tezt/tests/expected/consensus_key.ml/Beta-- Test register with consensus key.out @@ -61,34 +61,71 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "999999999385", "current_frozen_deposits": "0", - "frozen_deposits": "0", "staking_balance": "999999999385", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 0, + "expected_attesting_rewards": "0" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "0", "total_staked": "0", + "total_delegated": "999999999385", "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": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "999999999385", "own_staked": "0", + "own_delegated": "999999999385", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "999999999385", + "voting_power": "0", "voting_info": {}, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": [], "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]' { "balance": "0", "counter": "4" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "999999999385", "current_frozen_deposits": "49999999970", - "frozen_deposits": "0", "staking_balance": "999999999385", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 0, + "expected_attesting_rewards": "0" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "999999999385", + "total_staked": "49999999970", "total_delegated": "949999999415", "min_delegated_in_current_cycle": { "amount": "949999999415", "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", - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "999999999385", "own_staked": "49999999970", + "own_delegated": "949999999415", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "999999999385", + "voting_power": "0", "voting_info": {}, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "49999999970" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } diff --git a/tezt/tests/expected/consensus_key.ml/Beta-- Test set consensus key - baker is delegate.out b/tezt/tests/expected/consensus_key.ml/Beta-- Test set consensus key - baker is delegate.out index 0672d6768a3cde500530be5ee40e0af91a2bef13..eaf6da79c5a63546b2673c2fc08b9462982be628 100644 --- a/tezt/tests/expected/consensus_key.ml/Beta-- Test set consensus key - baker is delegate.out +++ b/tezt/tests/expected/consensus_key.ml/Beta-- Test set consensus key - baker is delegate.out @@ -26,48 +26,110 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000333333", "current_frozen_deposits": "200000016667", - "frozen_deposits": "200000000000", "staking_balance": "4000000333333", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000016667", + "total_staked": "200000016667", "total_delegated": "3800000316666", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "4000000333333", "own_staked": "200000016667", + "own_delegated": "3800000316666", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000333333", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000016667" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000003298113", "current_frozen_deposits": "200000164906", - "frozen_deposits": "200000000000", "staking_balance": "4000003298113", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000002150209", + "total_staked": "200000164906", "total_delegated": "3800003133207", "min_delegated_in_current_cycle": { "amount": "3800001985303", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000003298113", "own_staked": "200000164906", + "own_delegated": "3800003133207", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "1" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000003298113", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000164906" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } diff --git a/tezt/tests/expected/consensus_key.ml/Beta-- Test set consensus key - baker is not delegate.out b/tezt/tests/expected/consensus_key.ml/Beta-- Test set consensus key - baker is not delegate.out index 4e4583b1817d6dbb944169c77de6a76b588e25f7..0f778295f5ee749bfbc955a651e9b90c4de417c1 100644 --- a/tezt/tests/expected/consensus_key.ml/Beta-- Test set consensus key - baker is not delegate.out +++ b/tezt/tests/expected/consensus_key.ml/Beta-- Test set consensus key - baker is not delegate.out @@ -26,48 +26,110 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000000000000", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "4000000000000", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000000000000", + "total_staked": "200000000000", "total_delegated": "3800000000000", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000000000000", "own_staked": "200000000000", + "own_delegated": "3800000000000", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000000000000", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "3999999999716", "current_frozen_deposits": "200000000000", - "frozen_deposits": "200000000000", "staking_balance": "3999999999716", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "3999999999716", + "total_staked": "200000000000", "total_delegated": "3799999999716", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]", - "pending_consensus_keys": - [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]" } ] } + "expected_commitment": false } }, + "own_full_balance": "3999999999716", "own_staked": "200000000000", + "own_delegated": "3799999999716", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "3999999999716", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" }, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } ] }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "4000002964496", "current_frozen_deposits": "200000148225", - "frozen_deposits": "200000000000", "staking_balance": "4000002964496", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 204, "minimal_cycle_activity": 136, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 68, + "expected_attesting_rewards": "531216" }, "grace_period": 3, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "4000001816592", + "total_staked": "200000148225", "total_delegated": "3800002816271", "min_delegated_in_current_cycle": { "amount": "3800001668367", "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, - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": false } }, + "own_full_balance": "4000002964496", "own_staked": "200000148225", + "own_delegated": "3800002816271", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": + [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "15" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "4000002964496", + "voting_power": "4000000000000", + "voting_info": + { "voting_power": "4000000000000", "remaining_proposals": 20 }, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "200000148225" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } diff --git a/tezt/tests/expected/dal.ml/Alpha- Test following dal and baker tutorial commands.out b/tezt/tests/expected/dal.ml/Alpha- Test following dal and baker tutorial commands.out index d9d3a08feb101a4f1569b65440f24854819bfae9..a25c95310583afac867abb7feb65c03e35e57d2a 100644 --- a/tezt/tests/expected/dal.ml/Alpha- Test following dal and baker tutorial commands.out +++ b/tezt/tests/expected/dal.ml/Alpha- Test following dal and baker tutorial commands.out @@ -111,15 +111,34 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "499999998943", "current_frozen_deposits": "499900000000", - "frozen_deposits": "0", "staking_balance": "499999998943", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 0, + "expected_attesting_rewards": "0" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "499949999471", + "total_staked": "499900000000", "total_delegated": "99998943", "min_delegated_in_current_cycle": { "amount": "99998943", "level": { "level": 4, "level_position": 3, "cycle": 0, "cycle_position": 3, - "expected_commitment": true } }, "deactivated": false, - "grace_period": 5, "pending_denunciations": false, - "total_delegated_stake": "0", "staking_denominator": "0", - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": true } }, + "own_full_balance": "499999998943", "own_staked": "499900000000", + "own_delegated": "99998943", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "499999998943", + "voting_power": "0", "voting_info": {}, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "499900000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } diff --git a/tezt/tests/expected/dal.ml/Beta-- Test following dal and baker tutorial commands.out b/tezt/tests/expected/dal.ml/Beta-- Test following dal and baker tutorial commands.out index d9d3a08feb101a4f1569b65440f24854819bfae9..a25c95310583afac867abb7feb65c03e35e57d2a 100644 --- a/tezt/tests/expected/dal.ml/Beta-- Test following dal and baker tutorial commands.out +++ b/tezt/tests/expected/dal.ml/Beta-- Test following dal and baker tutorial commands.out @@ -111,15 +111,34 @@ This sequence of operations was run: ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' -{ "full_balance": "499999998943", "current_frozen_deposits": "499900000000", - "frozen_deposits": "0", "staking_balance": "499999998943", - "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], - "delegated_balance": "0", +{ "deactivated": false, "is_forbidden": false, + "participation": + { "expected_cycle_activity": 0, "minimal_cycle_activity": 0, + "missed_slots": 0, "missed_levels": 0, + "remaining_allowed_missed_slots": 0, + "expected_attesting_rewards": "0" }, "grace_period": 5, + "active_staking_parameters": + { "limit_of_staking_over_baking_millionth": 0, + "edge_of_baking_over_staking_billionth": 1000000000 }, + "pending_staking_parameters": [], "baking_power": "499949999471", + "total_staked": "499900000000", "total_delegated": "99998943", "min_delegated_in_current_cycle": { "amount": "99998943", "level": { "level": 4, "level_position": 3, "cycle": 0, "cycle_position": 3, - "expected_commitment": true } }, "deactivated": false, - "grace_period": 5, "pending_denunciations": false, - "total_delegated_stake": "0", "staking_denominator": "0", - "active_consensus_key": "[PUBLIC_KEY_HASH]" } + "expected_commitment": true } }, + "own_full_balance": "499999998943", "own_staked": "499900000000", + "own_delegated": "99998943", "external_staked": "0", + "external_delegated": "0", + "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], + "denunciations": [], "estimated_shared_pending_slashed_amount": "0", + "staking_denominator": "0", "current_voting_power": "499999998943", + "voting_power": "0", "voting_info": {}, + "consensus_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } }, + "stakers": + [ { "staker": "[PUBLIC_KEY_HASH]", + "frozen_deposits": "499900000000" } ], + "delegators": [ "[PUBLIC_KEY_HASH]" ] }