From 5c68ecb2fb66aca958774a597f04db49544875ec Mon Sep 17 00:00:00 2001 From: Diane Gallois-Wong Date: Thu, 18 Jul 2024 16:08:08 +0200 Subject: [PATCH 1/8] Plugin: deprecate RPC frozen_deposits Rationale: It's confusing to have both this RPC and total_staked. Moreover, this value is not often useful. The rare cases where it is useful are advanced enough that calling total_staked on the last block three cycles before should not be an issue. --- .../lib_plugin/delegate_services.ml | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/proto_alpha/lib_plugin/delegate_services.ml b/src/proto_alpha/lib_plugin/delegate_services.ml index c3856607687e..b63510dd922a 100644 --- a/src/proto_alpha/lib_plugin/delegate_services.ml +++ b/src/proto_alpha/lib_plugin/delegate_services.ml @@ -235,6 +235,18 @@ module S = struct ~query:RPC_query.empty ~output:Tez.encoding RPC_path.(path / "delegated_balance") + + let frozen_deposits = + RPC_service.get_service + ~description: + "DEPRECATED; call RPC total_staked on the last block of \ + (current_cycle - 3) instead. Returns the total amount (in mutez) \ + that was staked for the baker by all stakers (including the baker \ + itself) at the time the staking rights for the current cycle were \ + computed." + ~query:RPC_query.empty + ~output:Tez.encoding + RPC_path.(path / "frozen_deposits") end let total_staked = @@ -248,15 +260,6 @@ module S = struct ~output:Tez.encoding RPC_path.(path / "total_staked") - let frozen_deposits = - RPC_service.get_service - ~description: - "Returns the amount (in mutez) frozen as a deposit at the time the \ - staking rights for the current cycle were computed." - ~query:RPC_query.empty - ~output:Tez.encoding - RPC_path.(path / "frozen_deposits") - let unstaked_frozen_deposits = RPC_service.get_service ~description: @@ -612,7 +615,7 @@ let register () = Delegate.For_RPC.full_balance ctxt pkh) ; register1 ~chunked:false S.Deprecated.current_frozen_deposits f_total_staked ; register1 ~chunked:false S.total_staked f_total_staked ; - register1 ~chunked:false S.frozen_deposits (fun ctxt pkh () () -> + register1 ~chunked:false S.Deprecated.frozen_deposits (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.initial_frozen_deposits ctxt pkh) ; register1 ~chunked:false S.unstaked_frozen_deposits (fun ctxt pkh () () -> @@ -719,7 +722,7 @@ let current_frozen_deposits ctxt block pkh = RPC_context.make_call1 S.total_staked ctxt block pkh () () let frozen_deposits ctxt block pkh = - RPC_context.make_call1 S.frozen_deposits ctxt block pkh () () + RPC_context.make_call1 S.Deprecated.frozen_deposits ctxt block pkh () () let unstaked_frozen_deposits ctxt block pkh = RPC_context.make_call1 S.unstaked_frozen_deposits ctxt block pkh () () -- GitLab From c53978621237b758336ca210db97b37b33be54f6 Mon Sep 17 00:00:00 2001 From: Julien Tesson Date: Thu, 18 Jul 2024 22:09:48 +0200 Subject: [PATCH 2/8] Beta/Plugin: deprecate RPC frozen_deposits Porting to proto beta 5c68ecb2fb66aca958774a597f04db49544875ec - Plugin: deprecate RPC frozen_deposits --- .../lib_plugin/delegate_services.ml | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/proto_beta/lib_plugin/delegate_services.ml b/src/proto_beta/lib_plugin/delegate_services.ml index c3856607687e..b63510dd922a 100644 --- a/src/proto_beta/lib_plugin/delegate_services.ml +++ b/src/proto_beta/lib_plugin/delegate_services.ml @@ -235,6 +235,18 @@ module S = struct ~query:RPC_query.empty ~output:Tez.encoding RPC_path.(path / "delegated_balance") + + let frozen_deposits = + RPC_service.get_service + ~description: + "DEPRECATED; call RPC total_staked on the last block of \ + (current_cycle - 3) instead. Returns the total amount (in mutez) \ + that was staked for the baker by all stakers (including the baker \ + itself) at the time the staking rights for the current cycle were \ + computed." + ~query:RPC_query.empty + ~output:Tez.encoding + RPC_path.(path / "frozen_deposits") end let total_staked = @@ -248,15 +260,6 @@ module S = struct ~output:Tez.encoding RPC_path.(path / "total_staked") - let frozen_deposits = - RPC_service.get_service - ~description: - "Returns the amount (in mutez) frozen as a deposit at the time the \ - staking rights for the current cycle were computed." - ~query:RPC_query.empty - ~output:Tez.encoding - RPC_path.(path / "frozen_deposits") - let unstaked_frozen_deposits = RPC_service.get_service ~description: @@ -612,7 +615,7 @@ let register () = Delegate.For_RPC.full_balance ctxt pkh) ; register1 ~chunked:false S.Deprecated.current_frozen_deposits f_total_staked ; register1 ~chunked:false S.total_staked f_total_staked ; - register1 ~chunked:false S.frozen_deposits (fun ctxt pkh () () -> + register1 ~chunked:false S.Deprecated.frozen_deposits (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.initial_frozen_deposits ctxt pkh) ; register1 ~chunked:false S.unstaked_frozen_deposits (fun ctxt pkh () () -> @@ -719,7 +722,7 @@ let current_frozen_deposits ctxt block pkh = RPC_context.make_call1 S.total_staked ctxt block pkh () () let frozen_deposits ctxt block pkh = - RPC_context.make_call1 S.frozen_deposits ctxt block pkh () () + RPC_context.make_call1 S.Deprecated.frozen_deposits ctxt block pkh () () let unstaked_frozen_deposits ctxt block pkh = RPC_context.make_call1 S.unstaked_frozen_deposits ctxt block pkh () () -- GitLab From 95c1169d138f17852bdab2b0379e7f56ecb207da Mon Sep 17 00:00:00 2001 From: Diane Gallois-Wong Date: Thu, 18 Jul 2024 16:52:39 +0200 Subject: [PATCH 3/8] Plugin: deprecate RPC frozen_deposits_limit --- .../lib_plugin/delegate_services.ml | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/proto_alpha/lib_plugin/delegate_services.ml b/src/proto_alpha/lib_plugin/delegate_services.ml index b63510dd922a..41037adedda4 100644 --- a/src/proto_alpha/lib_plugin/delegate_services.ml +++ b/src/proto_alpha/lib_plugin/delegate_services.ml @@ -247,6 +247,16 @@ module S = struct ~query:RPC_query.empty ~output:Tez.encoding RPC_path.(path / "frozen_deposits") + + let frozen_deposits_limit = + RPC_service.get_service + ~description: + "DEPRECATED; the frozen deposits limit has no effects since the \ + activation of Adaptive Issuance and Staking during the Paris \ + protocol." + ~query:RPC_query.empty + ~output:(Data_encoding.option Tez.encoding) + RPC_path.(path / "frozen_deposits_limit") end let total_staked = @@ -286,15 +296,6 @@ module S = struct ~output:Tez.encoding RPC_path.(path / "total_delegated") - let frozen_deposits_limit = - RPC_service.get_service - ~description: - "Returns the frozen deposits limit for the given delegate or none if \ - no limit is set." - ~query:RPC_query.empty - ~output:(Data_encoding.option Tez.encoding) - RPC_path.(path / "frozen_deposits_limit") - let delegated_contracts = RPC_service.get_service ~description: @@ -638,7 +639,10 @@ let register () = register1 ~chunked:false S.Deprecated.staking_balance (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.For_RPC.staking_balance ctxt pkh) ; - register1 ~chunked:false S.frozen_deposits_limit (fun ctxt pkh () () -> + register1 + ~chunked:false + S.Deprecated.frozen_deposits_limit + (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.frozen_deposits_limit ctxt pkh) ; register1 ~chunked:true S.delegated_contracts (fun ctxt pkh () () -> @@ -731,7 +735,7 @@ let staking_balance ctxt block pkh = RPC_context.make_call1 S.Deprecated.staking_balance ctxt block pkh () () let frozen_deposits_limit ctxt block pkh = - RPC_context.make_call1 S.frozen_deposits_limit ctxt block pkh () () + RPC_context.make_call1 S.Deprecated.frozen_deposits_limit ctxt block pkh () () let delegated_contracts ctxt block pkh = RPC_context.make_call1 S.delegated_contracts ctxt block pkh () () -- GitLab From a3a682db58e01e4b07a3fa6543523223f755df4b Mon Sep 17 00:00:00 2001 From: Julien Tesson Date: Thu, 18 Jul 2024 22:09:50 +0200 Subject: [PATCH 4/8] Beta/Plugin: deprecate RPC frozen_deposits_limit Porting to proto beta 15dba3eef6c368e9683b56ee59f01654cc3e8335 - Plugin: deprecate RPC frozen_deposits_limit --- .../lib_plugin/delegate_services.ml | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/proto_beta/lib_plugin/delegate_services.ml b/src/proto_beta/lib_plugin/delegate_services.ml index b63510dd922a..41037adedda4 100644 --- a/src/proto_beta/lib_plugin/delegate_services.ml +++ b/src/proto_beta/lib_plugin/delegate_services.ml @@ -247,6 +247,16 @@ module S = struct ~query:RPC_query.empty ~output:Tez.encoding RPC_path.(path / "frozen_deposits") + + let frozen_deposits_limit = + RPC_service.get_service + ~description: + "DEPRECATED; the frozen deposits limit has no effects since the \ + activation of Adaptive Issuance and Staking during the Paris \ + protocol." + ~query:RPC_query.empty + ~output:(Data_encoding.option Tez.encoding) + RPC_path.(path / "frozen_deposits_limit") end let total_staked = @@ -286,15 +296,6 @@ module S = struct ~output:Tez.encoding RPC_path.(path / "total_delegated") - let frozen_deposits_limit = - RPC_service.get_service - ~description: - "Returns the frozen deposits limit for the given delegate or none if \ - no limit is set." - ~query:RPC_query.empty - ~output:(Data_encoding.option Tez.encoding) - RPC_path.(path / "frozen_deposits_limit") - let delegated_contracts = RPC_service.get_service ~description: @@ -638,7 +639,10 @@ let register () = register1 ~chunked:false S.Deprecated.staking_balance (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.For_RPC.staking_balance ctxt pkh) ; - register1 ~chunked:false S.frozen_deposits_limit (fun ctxt pkh () () -> + register1 + ~chunked:false + S.Deprecated.frozen_deposits_limit + (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.frozen_deposits_limit ctxt pkh) ; register1 ~chunked:true S.delegated_contracts (fun ctxt pkh () () -> @@ -731,7 +735,7 @@ let staking_balance ctxt block pkh = RPC_context.make_call1 S.Deprecated.staking_balance ctxt block pkh () () let frozen_deposits_limit ctxt block pkh = - RPC_context.make_call1 S.frozen_deposits_limit ctxt block pkh () () + RPC_context.make_call1 S.Deprecated.frozen_deposits_limit ctxt block pkh () () let delegated_contracts ctxt block pkh = RPC_context.make_call1 S.delegated_contracts ctxt block pkh () () -- GitLab From a51ffc25623443f44c263cf13621948f6a1be098 Mon Sep 17 00:00:00 2001 From: Diane Gallois-Wong Date: Thu, 18 Jul 2024 17:00:57 +0200 Subject: [PATCH 5/8] Plugin: rename RPC current_baking_power to baking_power Rationale: "current" is more confusing than helpful, since it could be understood as "baking power to bake blocks in the current cycle", whereas it actually means "baking power based on current balances" --- .../lib_plugin/delegate_services.ml | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/proto_alpha/lib_plugin/delegate_services.ml b/src/proto_alpha/lib_plugin/delegate_services.ml index 41037adedda4..c6be8895681c 100644 --- a/src/proto_alpha/lib_plugin/delegate_services.ml +++ b/src/proto_alpha/lib_plugin/delegate_services.ml @@ -257,6 +257,13 @@ module S = struct ~query:RPC_query.empty ~output:(Data_encoding.option Tez.encoding) RPC_path.(path / "frozen_deposits_limit") + + let current_baking_power = + RPC_service.get_service + ~description:"DEPRECATED; use baking_power instead." + ~query:RPC_query.empty + ~output:Data_encoding.int64 + RPC_path.(path / "current_baking_power") end let total_staked = @@ -375,16 +382,16 @@ module S = struct ~output:Data_encoding.int64 RPC_path.(path / "voting_power") - let current_baking_power = + let baking_power = RPC_service.get_service ~description: - "The baking power of a delegate, as computed from its current stake. \ - This value is not used for computing baking rights but only reflects \ - the baking power that the delegate would have if the cycle ended at \ - the current block." + "The current baking power of a delegate, using the current staked and \ + delegated balances of the baker and its delegators. In other words, \ + the baking rights that the baker would get for a future cycle if the \ + current cycle ended right at the current block." ~query:RPC_query.empty ~output:Data_encoding.int64 - RPC_path.(path / "current_baking_power") + RPC_path.(path / "baking_power") let voting_info = RPC_service.get_service @@ -567,6 +574,11 @@ let f_external_delegated ctxt pkh () () = let* () = check_delegate_registered ctxt pkh in external_delegated ctxt pkh +let f_baking_power ctxt pkh () () = + let open Lwt_result_syntax in + let* () = check_delegate_registered ctxt pkh in + Stake_distribution.For_RPC.delegate_current_baking_power ctxt pkh + let register () = let open Lwt_result_syntax in register0 ~chunked:true S.list_delegate (fun ctxt q () -> @@ -672,9 +684,8 @@ let register () = register1 ~chunked:false S.voting_power (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Vote.get_voting_power_free ctxt pkh) ; - register1 ~chunked:false S.current_baking_power (fun ctxt pkh () () -> - let* () = check_delegate_registered ctxt pkh in - Stake_distribution.For_RPC.delegate_current_baking_power ctxt pkh) ; + register1 ~chunked:false S.Deprecated.current_baking_power f_baking_power ; + register1 ~chunked:false S.baking_power f_baking_power ; register1 ~chunked:false S.voting_info (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Vote.get_delegate_info ctxt pkh) ; @@ -759,7 +770,7 @@ let current_voting_power ctxt block pkh = RPC_context.make_call1 S.current_voting_power ctxt block pkh () () let current_baking_power ctxt block pkh = - RPC_context.make_call1 S.current_baking_power ctxt block pkh () () + RPC_context.make_call1 S.baking_power ctxt block pkh () () let voting_info ctxt block pkh = RPC_context.make_call1 S.voting_info ctxt block pkh () () -- GitLab From 08c704f35b5b8a16a9443af46db852f745f9988d Mon Sep 17 00:00:00 2001 From: Julien Tesson Date: Thu, 18 Jul 2024 22:09:55 +0200 Subject: [PATCH 6/8] Beta/Plugin: rename RPC current_baking_power to baking_power Porting to proto beta 21425fc33eede33d84d8f3597ce722c8284abe72 - Plugin: rename RPC current_baking_power to baking_power --- .../lib_plugin/delegate_services.ml | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/proto_beta/lib_plugin/delegate_services.ml b/src/proto_beta/lib_plugin/delegate_services.ml index 41037adedda4..c6be8895681c 100644 --- a/src/proto_beta/lib_plugin/delegate_services.ml +++ b/src/proto_beta/lib_plugin/delegate_services.ml @@ -257,6 +257,13 @@ module S = struct ~query:RPC_query.empty ~output:(Data_encoding.option Tez.encoding) RPC_path.(path / "frozen_deposits_limit") + + let current_baking_power = + RPC_service.get_service + ~description:"DEPRECATED; use baking_power instead." + ~query:RPC_query.empty + ~output:Data_encoding.int64 + RPC_path.(path / "current_baking_power") end let total_staked = @@ -375,16 +382,16 @@ module S = struct ~output:Data_encoding.int64 RPC_path.(path / "voting_power") - let current_baking_power = + let baking_power = RPC_service.get_service ~description: - "The baking power of a delegate, as computed from its current stake. \ - This value is not used for computing baking rights but only reflects \ - the baking power that the delegate would have if the cycle ended at \ - the current block." + "The current baking power of a delegate, using the current staked and \ + delegated balances of the baker and its delegators. In other words, \ + the baking rights that the baker would get for a future cycle if the \ + current cycle ended right at the current block." ~query:RPC_query.empty ~output:Data_encoding.int64 - RPC_path.(path / "current_baking_power") + RPC_path.(path / "baking_power") let voting_info = RPC_service.get_service @@ -567,6 +574,11 @@ let f_external_delegated ctxt pkh () () = let* () = check_delegate_registered ctxt pkh in external_delegated ctxt pkh +let f_baking_power ctxt pkh () () = + let open Lwt_result_syntax in + let* () = check_delegate_registered ctxt pkh in + Stake_distribution.For_RPC.delegate_current_baking_power ctxt pkh + let register () = let open Lwt_result_syntax in register0 ~chunked:true S.list_delegate (fun ctxt q () -> @@ -672,9 +684,8 @@ let register () = register1 ~chunked:false S.voting_power (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Vote.get_voting_power_free ctxt pkh) ; - register1 ~chunked:false S.current_baking_power (fun ctxt pkh () () -> - let* () = check_delegate_registered ctxt pkh in - Stake_distribution.For_RPC.delegate_current_baking_power ctxt pkh) ; + register1 ~chunked:false S.Deprecated.current_baking_power f_baking_power ; + register1 ~chunked:false S.baking_power f_baking_power ; register1 ~chunked:false S.voting_info (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Vote.get_delegate_info ctxt pkh) ; @@ -759,7 +770,7 @@ let current_voting_power ctxt block pkh = RPC_context.make_call1 S.current_voting_power ctxt block pkh () () let current_baking_power ctxt block pkh = - RPC_context.make_call1 S.current_baking_power ctxt block pkh () () + RPC_context.make_call1 S.baking_power ctxt block pkh () () let voting_info ctxt block pkh = RPC_context.make_call1 S.voting_info ctxt block pkh () () -- GitLab From 163c3813d745224e059fa0c63b55915fb3a10fdc Mon Sep 17 00:00:00 2001 From: Diane Gallois-Wong Date: Thu, 18 Jul 2024 17:17:11 +0200 Subject: [PATCH 7/8] Plugin: rename RPC delegated_contracts to delegators Rationale: - This is the term we usually use in other RPCs and doc - Reduces overload on the "delegated" term --- .../lib_plugin/delegate_services.ml | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/proto_alpha/lib_plugin/delegate_services.ml b/src/proto_alpha/lib_plugin/delegate_services.ml index c6be8895681c..98cd735f3614 100644 --- a/src/proto_alpha/lib_plugin/delegate_services.ml +++ b/src/proto_alpha/lib_plugin/delegate_services.ml @@ -264,6 +264,13 @@ module S = struct ~query:RPC_query.empty ~output:Data_encoding.int64 RPC_path.(path / "current_baking_power") + + let delegated_contracts = + RPC_service.get_service + ~description:"DEPRECATED; use delegators instead." + ~query:RPC_query.empty + ~output:(list Contract.encoding) + RPC_path.(path / "delegated_contracts") end let total_staked = @@ -303,13 +310,15 @@ module S = struct ~output:Tez.encoding RPC_path.(path / "total_delegated") - let delegated_contracts = + let delegators = RPC_service.get_service ~description: - "Returns the list of contracts that delegate to a given delegate." + "The list of all contracts that are currently delegating to the \ + delegate. Includes both user accounts and smart contracts. Includes \ + the delegate itself." ~query:RPC_query.empty ~output:(list Contract.encoding) - RPC_path.(path / "delegated_contracts") + RPC_path.(path / "delegators") let external_staked = RPC_service.get_service @@ -579,6 +588,12 @@ let f_baking_power ctxt pkh () () = let* () = check_delegate_registered ctxt pkh in Stake_distribution.For_RPC.delegate_current_baking_power ctxt pkh +let f_delegators ctxt pkh () () = + let open Lwt_result_syntax in + let* () = check_delegate_registered ctxt pkh in + let*! contracts = Delegate.delegated_contracts ctxt pkh in + return contracts + let register () = let open Lwt_result_syntax in register0 ~chunked:true S.list_delegate (fun ctxt q () -> @@ -657,10 +672,8 @@ let register () = (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.frozen_deposits_limit ctxt pkh) ; - register1 ~chunked:true S.delegated_contracts (fun ctxt pkh () () -> - let* () = check_delegate_registered ctxt pkh in - let*! contracts = Delegate.delegated_contracts ctxt pkh in - return contracts) ; + register1 ~chunked:true S.Deprecated.delegated_contracts f_delegators ; + register1 ~chunked:true S.delegators f_delegators ; register1 ~chunked:false S.Deprecated.total_delegated_stake f_external_staked ; register1 ~chunked:false S.external_staked f_external_staked ; register1 ~chunked:false S.external_delegated f_external_delegated ; @@ -749,7 +762,7 @@ let frozen_deposits_limit ctxt block pkh = RPC_context.make_call1 S.Deprecated.frozen_deposits_limit ctxt block pkh () () let delegated_contracts ctxt block pkh = - RPC_context.make_call1 S.delegated_contracts ctxt block pkh () () + RPC_context.make_call1 S.delegators ctxt block pkh () () let total_delegated_stake ctxt block pkh = RPC_context.make_call1 S.external_staked ctxt block pkh () () -- GitLab From 07ef85fdbb743cf8ba9be99b79f73070cdca16d7 Mon Sep 17 00:00:00 2001 From: Julien Tesson Date: Thu, 18 Jul 2024 22:09:59 +0200 Subject: [PATCH 8/8] Beta/Plugin: rename RPC delegated_contracts to delegators Porting to proto beta 03744bc664efa4e5986003d68e95ff7721abb3ff - Plugin: rename RPC delegated_contracts to delegators --- .../lib_plugin/delegate_services.ml | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/proto_beta/lib_plugin/delegate_services.ml b/src/proto_beta/lib_plugin/delegate_services.ml index c6be8895681c..98cd735f3614 100644 --- a/src/proto_beta/lib_plugin/delegate_services.ml +++ b/src/proto_beta/lib_plugin/delegate_services.ml @@ -264,6 +264,13 @@ module S = struct ~query:RPC_query.empty ~output:Data_encoding.int64 RPC_path.(path / "current_baking_power") + + let delegated_contracts = + RPC_service.get_service + ~description:"DEPRECATED; use delegators instead." + ~query:RPC_query.empty + ~output:(list Contract.encoding) + RPC_path.(path / "delegated_contracts") end let total_staked = @@ -303,13 +310,15 @@ module S = struct ~output:Tez.encoding RPC_path.(path / "total_delegated") - let delegated_contracts = + let delegators = RPC_service.get_service ~description: - "Returns the list of contracts that delegate to a given delegate." + "The list of all contracts that are currently delegating to the \ + delegate. Includes both user accounts and smart contracts. Includes \ + the delegate itself." ~query:RPC_query.empty ~output:(list Contract.encoding) - RPC_path.(path / "delegated_contracts") + RPC_path.(path / "delegators") let external_staked = RPC_service.get_service @@ -579,6 +588,12 @@ let f_baking_power ctxt pkh () () = let* () = check_delegate_registered ctxt pkh in Stake_distribution.For_RPC.delegate_current_baking_power ctxt pkh +let f_delegators ctxt pkh () () = + let open Lwt_result_syntax in + let* () = check_delegate_registered ctxt pkh in + let*! contracts = Delegate.delegated_contracts ctxt pkh in + return contracts + let register () = let open Lwt_result_syntax in register0 ~chunked:true S.list_delegate (fun ctxt q () -> @@ -657,10 +672,8 @@ let register () = (fun ctxt pkh () () -> let* () = check_delegate_registered ctxt pkh in Delegate.frozen_deposits_limit ctxt pkh) ; - register1 ~chunked:true S.delegated_contracts (fun ctxt pkh () () -> - let* () = check_delegate_registered ctxt pkh in - let*! contracts = Delegate.delegated_contracts ctxt pkh in - return contracts) ; + register1 ~chunked:true S.Deprecated.delegated_contracts f_delegators ; + register1 ~chunked:true S.delegators f_delegators ; register1 ~chunked:false S.Deprecated.total_delegated_stake f_external_staked ; register1 ~chunked:false S.external_staked f_external_staked ; register1 ~chunked:false S.external_delegated f_external_delegated ; @@ -749,7 +762,7 @@ let frozen_deposits_limit ctxt block pkh = RPC_context.make_call1 S.Deprecated.frozen_deposits_limit ctxt block pkh () () let delegated_contracts ctxt block pkh = - RPC_context.make_call1 S.delegated_contracts ctxt block pkh () () + RPC_context.make_call1 S.delegators ctxt block pkh () () let total_delegated_stake ctxt block pkh = RPC_context.make_call1 S.external_staked ctxt block pkh () () -- GitLab