From 2662e35b612e88ab2bc6c47be66edde9341f96fc Mon Sep 17 00:00:00 2001 From: phink Date: Fri, 16 Feb 2024 09:51:49 +0100 Subject: [PATCH 1/5] Proto/alpha_context: add Delegate.For_RPC.has_pending_denunciations --- src/proto_alpha/lib_protocol/alpha_context.ml | 3 +++ src/proto_alpha/lib_protocol/alpha_context.mli | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/proto_alpha/lib_protocol/alpha_context.ml b/src/proto_alpha/lib_protocol/alpha_context.ml index 2b93ccec6ba3..f60dd9f9987f 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.ml +++ b/src/proto_alpha/lib_protocol/alpha_context.ml @@ -582,6 +582,9 @@ module Delegate = struct include Pending_denunciations_storage.For_RPC let pending_denunciations = Pending_denunciations_storage.find + + let has_pending_denunciations = + Pending_denunciations_storage.has_pending_denunciations end end diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 8e0f633b6f7f..bd74853aa924 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2497,6 +2497,8 @@ module Delegate : sig val min_delegated_in_current_cycle : context -> public_key_hash -> Tez.t tzresult Lwt.t + val has_pending_denunciations : context -> public_key_hash -> bool Lwt.t + val pending_denunciations : context -> public_key_hash -> Denunciations_repr.t tzresult Lwt.t -- GitLab From f0a5f20bfd3101b0d2a275418d69274b82d0c26d Mon Sep 17 00:00:00 2001 From: phink Date: Fri, 16 Feb 2024 09:55:23 +0100 Subject: [PATCH 2/5] Proto/delegate_services: add pending_denunciations field in Delegate_services.info --- .../lib_protocol/delegate_services.ml | 16 +++++++++++++--- .../lib_protocol/delegate_services.mli | 1 + .../lib_protocol/test/helpers/context.ml | 1 + .../lib_protocol/test/helpers/context.mli | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/proto_alpha/lib_protocol/delegate_services.ml b/src/proto_alpha/lib_protocol/delegate_services.ml index ddfea5600563..04d42661a9bd 100644 --- a/src/proto_alpha/lib_protocol/delegate_services.ml +++ b/src/proto_alpha/lib_protocol/delegate_services.ml @@ -121,6 +121,7 @@ type info = { 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; @@ -142,6 +143,7 @@ let info_encoding = staking_denominator; deactivated; grace_period; + pending_denunciations; voting_info; active_consensus_key; pending_consensus_keys; @@ -155,7 +157,8 @@ let info_encoding = delegated_balance, min_delegated_in_current_cycle, deactivated, - grace_period ), + grace_period, + pending_denunciations ), ( (total_delegated_stake, staking_denominator), (voting_info, (active_consensus_key, pending_consensus_keys)) ) )) (fun ( ( full_balance, @@ -167,7 +170,8 @@ let info_encoding = delegated_balance, min_delegated_in_current_cycle, deactivated, - grace_period ), + grace_period, + pending_denunciations ), ( (total_delegated_stake, staking_denominator), (voting_info, (active_consensus_key, pending_consensus_keys)) ) ) -> { @@ -183,6 +187,7 @@ let info_encoding = staking_denominator; deactivated; grace_period; + pending_denunciations; voting_info; active_consensus_key; pending_consensus_keys; @@ -198,7 +203,8 @@ let info_encoding = (req "delegated_balance" Tez.encoding) (req "min_delegated_in_current_cycle" Tez.encoding) (req "deactivated" bool) - (req "grace_period" Cycle.encoding)) + (req "grace_period" Cycle.encoding) + (req "pending_denunciations" bool)) (merge_objs (obj2 (req "total_delegated_stake" Tez.encoding) @@ -617,6 +623,9 @@ let register () = 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 @@ -636,6 +645,7 @@ let register () = staking_denominator; deactivated; grace_period; + pending_denunciations; voting_info; active_consensus_key = consensus_key.consensus_pkh; pending_consensus_keys; diff --git a/src/proto_alpha/lib_protocol/delegate_services.mli b/src/proto_alpha/lib_protocol/delegate_services.mli index 3289cf9cd98a..16bdf5f9dd9c 100644 --- a/src/proto_alpha/lib_protocol/delegate_services.mli +++ b/src/proto_alpha/lib_protocol/delegate_services.mli @@ -66,6 +66,7 @@ type info = { 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; diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index d36166a0fb9d..a5f8122cbe84 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -492,6 +492,7 @@ module Delegate = struct staking_denominator : Staking_pseudotoken.t; deactivated : bool; grace_period : Cycle.t; + pending_denunciations : bool; voting_info : Alpha_context.Vote.delegate_info; active_consensus_key : Signature.Public_key_hash.t; pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.mli b/src/proto_alpha/lib_protocol/test/helpers/context.mli index 3939caf4de83..05737069baf7 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/context.mli @@ -261,6 +261,7 @@ module Delegate : sig 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; -- GitLab From bca37601529b24ac3c462f119726afbc907342b2 Mon Sep 17 00:00:00 2001 From: phink Date: Fri, 16 Feb 2024 14:51:15 +0100 Subject: [PATCH 3/5] Tests/tezt: update regression tests --- .../lib_protocol/delegate_services.ml | 16 +++++----- ...lient) RPC regression tests- delegates.out | 6 ++-- ...light) RPC regression tests- delegates.out | 6 ++-- ...proxy) RPC regression tests- delegates.out | 6 ++-- ...a_dir) RPC regression tests- delegates.out | 6 ++-- ...r_rpc) RPC regression tests- delegates.out | 6 ++-- ... - delegate - consensus - destination).out | 30 +++++++++---------- ...- delegate - consensus -- destination).out | 30 +++++++++---------- ...-- delegate - consensus - destination).out | 30 +++++++++---------- ...- delegate - consensus -- destination).out | 30 +++++++++---------- ...lpha- Test register with consensus key.out | 8 ++--- ... set consensus key - baker is delegate.out | 18 +++++------ ... consensus key - baker is not delegate.out | 18 +++++------ 13 files changed, 104 insertions(+), 106 deletions(-) diff --git a/src/proto_alpha/lib_protocol/delegate_services.ml b/src/proto_alpha/lib_protocol/delegate_services.ml index 04d42661a9bd..b8e5ac3a68c5 100644 --- a/src/proto_alpha/lib_protocol/delegate_services.ml +++ b/src/proto_alpha/lib_protocol/delegate_services.ml @@ -157,9 +157,8 @@ let info_encoding = delegated_balance, min_delegated_in_current_cycle, deactivated, - grace_period, - pending_denunciations ), - ( (total_delegated_stake, staking_denominator), + grace_period ), + ( (pending_denunciations, total_delegated_stake, staking_denominator), (voting_info, (active_consensus_key, pending_consensus_keys)) ) )) (fun ( ( full_balance, current_frozen_deposits, @@ -170,9 +169,8 @@ let info_encoding = delegated_balance, min_delegated_in_current_cycle, deactivated, - grace_period, - pending_denunciations ), - ( (total_delegated_stake, staking_denominator), + grace_period ), + ( (pending_denunciations, total_delegated_stake, staking_denominator), (voting_info, (active_consensus_key, pending_consensus_keys)) ) ) -> { full_balance; @@ -203,10 +201,10 @@ let info_encoding = (req "delegated_balance" Tez.encoding) (req "min_delegated_in_current_cycle" Tez.encoding) (req "deactivated" bool) - (req "grace_period" Cycle.encoding) - (req "pending_denunciations" bool)) + (req "grace_period" Cycle.encoding)) (merge_objs - (obj2 + (obj3 + (req "pending_denunciations" bool) (req "total_delegated_stake" Tez.encoding) (req "staking_denominator" Staking_pseudotoken.For_RPC.encoding)) (merge_objs 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 6b257eca7b6f..c1abbfa75d2a 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 @@ -22,9 +22,9 @@ "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 5, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' 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 a6d3e60d3c92..746c00447034 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 @@ -22,9 +22,9 @@ "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 5, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' 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 eb6bf7c4a23e..71334ef90f47 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 @@ -22,9 +22,9 @@ "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 5, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' 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 6b257eca7b6f..c1abbfa75d2a 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 @@ -22,9 +22,9 @@ "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 5, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' 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 6b257eca7b6f..c1abbfa75d2a 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 @@ -22,9 +22,9 @@ "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 5, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/full_balance' 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 704b30d6e9d3..cb0219480fd4 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 @@ -31,9 +31,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -42,9 +42,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ] } @@ -55,9 +55,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -66,9 +66,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' @@ -107,9 +107,9 @@ This sequence of operations was run: "frozen_deposits": "200000083984", "staking_balance": "238000528932", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "4", - "deactivated": false, "grace_period": 4, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' 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 dbbd212eaff6..2f3c81352c2a 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 @@ -31,9 +31,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -42,9 +42,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ] } @@ -55,9 +55,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -66,9 +66,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' @@ -107,9 +107,9 @@ This sequence of operations was run: "frozen_deposits": "200000083984", "staking_balance": "238000528932", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "4", - "deactivated": false, "grace_period": 4, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' 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 97a61ff6bc64..7efa88268e39 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 @@ -31,9 +31,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -42,9 +42,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ] } @@ -55,9 +55,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -66,9 +66,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' @@ -107,9 +107,9 @@ This sequence of operations was run: "frozen_deposits": "200000067317", "staking_balance": "238000509096", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "18", - "deactivated": false, "grace_period": 4, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' 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 0ae5f6b77c13..44c911183185 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 @@ -31,9 +31,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -42,9 +42,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ] } @@ -55,9 +55,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -66,9 +66,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' @@ -107,9 +107,9 @@ This sequence of operations was run: "frozen_deposits": "200000067317", "staking_balance": "238000509096", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "18", - "deactivated": false, "grace_period": 4, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]/balance' 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 7bea90479067..668993b15b0e 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 @@ -65,8 +65,8 @@ This sequence of operations was run: "frozen_deposits": "0", "staking_balance": "999999999385", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "999999999385", - "deactivated": false, "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", + "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]" } ] } @@ -79,6 +79,6 @@ This sequence of operations was run: "frozen_deposits": "0", "staking_balance": "999999999385", "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "949999999415", - "deactivated": false, "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", + "deactivated": false, "grace_period": 3, "pending_denunciations": false, + "total_delegated_stake": "0", "staking_denominator": "0", "active_consensus_key": "[PUBLIC_KEY_HASH]" } diff --git a/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out b/tezt/tests/expected/consensus_key.ml/Alpha- Test set consensus key - baker is delegate.out index 1eb937a52cbe..ce52bbd3718f 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 @@ -31,9 +31,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -42,9 +42,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ] } @@ -55,7 +55,7 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001595660", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } 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 4444e752bbec..f4f8eb4a0091 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 @@ -31,9 +31,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800000000000", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -42,9 +42,9 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3799999999716", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } ] } @@ -55,7 +55,7 @@ This sequence of operations was run: "delegated_contracts": [ "[PUBLIC_KEY_HASH]" ], "delegated_balance": "0", "min_delegated_in_current_cycle": "3800001278724", "deactivated": false, - "grace_period": 3, "total_delegated_stake": "0", - "staking_denominator": "0", "voting_power": "4000000000000", - "remaining_proposals": 20, + "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]" } -- GitLab From eceee1eed1f5bbe4fb35dc104a3261939258beaf Mon Sep 17 00:00:00 2001 From: phink Date: Fri, 16 Feb 2024 12:57:54 +0100 Subject: [PATCH 4/5] Doc/Proto: update with the new field pending_denunciations --- docs/protocols/alpha.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index daf6522e2e71..7b6d118aa51a 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -125,12 +125,19 @@ RPC Changes This changes the JSON from the RPC ``/chains/main/blocks/head/context/constants`` and ``/chains/main/blocks/head/context/issuance/expected_issuance``. -- Add RPC to get contract's estimated own pending slashed amount according to the currently available denunciations. +- Add RPC to get contract's estimated own pending slashed amount according to the currently + available denunciations. ``GET /chains//blocks//context/contracts//estimated_own_pending_slashed_amount``. (MR :gl:`!12016`) -- Add RPC to get delegate's estimated shared pending slashed amount according to the currently available denunciations. +- Add RPC to get delegate's estimated shared pending slashed amount according to the + currently available denunciations. ``GET /chains//blocks//context/delegates//estimated_shared_pending_slashed_amount``. (MR :gl:`!12016`) +- Extend the delegate info RPC response by adding a new boolean field named 'pending_denunciations'. + This field is set to true if there are any pending denunciations associated with the + specified delegate, and set to false otherwise. + ``GET /chains//blocks//context/delegates//``. (MR :gl:`!12042`) + Operation receipts ------------------ -- GitLab From 25cfffc5b987a556d1ec7409b740ad098e167fcf Mon Sep 17 00:00:00 2001 From: phink Date: Fri, 16 Feb 2024 12:59:20 +0100 Subject: [PATCH 5/5] Doc/Proto: new RPC listing the pending denunciations --- docs/protocols/alpha.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index 7b6d118aa51a..be92fd1226ba 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -138,6 +138,10 @@ RPC Changes specified delegate, and set to false otherwise. ``GET /chains//blocks//context/delegates//``. (MR :gl:`!12042`) +- New RPC to list the pending denunciations of a given delegate. + ``GET /chains//blocks//context/delegates//denunciations``. (MR :gl:`!11885`) + + Operation receipts ------------------ -- GitLab