From afe112f42fc867f5e8a4969b565c81e24fae3e7e Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 8 Nov 2023 16:29:19 +0100 Subject: [PATCH 1/2] Revert "alpha: remove endorsing_rights RPC" This reverts commit 95dd0f5c2abeaa3702f4f1c8ca5f4a63f22b58f6. --- src/proto_alpha/lib_plugin/RPC.ml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index 3f30818975bb..bb312ff9d105 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -3684,6 +3684,8 @@ module Attestation_rights = struct let attestation_path = RPC_path.(path / "attestation_rights") + let endorsing_path = RPC_path.(path / "endorsing_rights") + type attestation_rights_query = { levels : Raw_level.t list; cycle : Cycle.t option; @@ -3724,6 +3726,32 @@ module Attestation_rights = struct ~query:attestation_rights_query ~output:(list (encoding ~use_legacy_attestation_name:false)) attestation_path + + (* TODO: https://gitlab.com/tezos/tezos/-/issues/5156 + endorsing_rights RPC should be removed once the depreciation period + will be over *) + let endorsing_rights = + RPC_service.get_service + ~description: + "Deprecated: use `attestation_rights` instead.\n\ + Retrieves the delegates allowed to endorse a block.\n\ + By default, it gives the endorsing power for delegates that have at \ + least one endorsing slot for the next block.\n\ + Parameters `level` and `cycle` can be used to specify the (valid) \ + level(s) in the past or future at which the endorsing rights have \ + to be returned. Parameter `delegate` can be used to restrict the \ + results to the given delegates.\n\ + Parameter `consensus_key` can be used to restrict the results to \ + the given consensus_keys. \n\ + Returns the smallest endorsing slots and the endorsing power. Also \ + returns the minimal timestamp that corresponds to endorsing at the \ + given level. The timestamps are omitted for levels in the past, and \ + are only estimates for levels higher that the next block's, based \ + on the hypothesis that all predecessor blocks were baked at the \ + first round." + ~query:attestation_rights_query + ~output:(list (encoding ~use_legacy_attestation_name:true)) + endorsing_path end let attestation_rights_at_level ctxt level = @@ -3794,6 +3822,8 @@ module Attestation_rights = struct let register () = Registration.register0 ~chunked:true S.attestation_rights (fun ctxt q () -> + get_attestation_rights ctxt q) ; + Registration.register0 ~chunked:true S.endorsing_rights (fun ctxt q () -> get_attestation_rights ctxt q) let get ctxt ?(levels = []) ?cycle ?(delegates = []) ?(consensus_keys = []) -- GitLab From 5521cd5e1aad04229bb30bb8e2a6cf524df42a5f Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 8 Nov 2023 16:17:21 +0100 Subject: [PATCH 2/2] Tezt/RPC: denunciations are available from Alpha (to be refined in next MR) This partly reverts commit 972c06dc041acdb07d426d6a1af74aed057b6bed. --- tezt/tests/RPC_test.ml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tezt/tests/RPC_test.ml b/tezt/tests/RPC_test.ml index 924e38ed0fc3..35c00b96d889 100644 --- a/tezt/tests/RPC_test.ml +++ b/tezt/tests/RPC_test.ml @@ -705,7 +705,16 @@ let test_misc_protocol _test_mode_tag protocol ?endpoint client = @@ RPC.get_chain_block_helper_current_level () in let* () = - if Protocol.(number protocol <= number Oxford) then + if Protocol.(number protocol >= number Alpha) then + let* _ = + Client.RPC.call ?endpoint ~hooks client + @@ RPC.get_chain_block_context_denunciations () + in + unit + else unit + in + let* () = + if Protocol.(number protocol <= number Nairobi + 1) then let* _ = Client.RPC.call ?endpoint ~hooks client @@ RPC.get_chain_block_helper_endorsing_rights () @@ -719,12 +728,7 @@ let test_misc_protocol _test_mode_tag protocol ?endpoint client = () in unit - else - let* _ = - Client.RPC.call ?endpoint ~hooks client - @@ RPC.get_chain_block_context_denunciations () - in - unit + else unit in let* () = let* _ = -- GitLab