From 7dd6ece6e4b7f59d7a461cfd34846de6dd1a89bf Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 12 Feb 2024 10:53:36 +0100 Subject: [PATCH 1/3] alpha/plugin: remove endorsing rights rpc --- src/proto_alpha/lib_plugin/RPC.ml | 45 ++++--------------------------- 1 file changed, 5 insertions(+), 40 deletions(-) diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index a8636332df76..339eaec8cf30 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -3788,7 +3788,7 @@ module Attestation_rights = struct estimated_time : Time.t option; } - let delegate_rights_encoding use_legacy_attestation_name = + let delegate_rights_encoding = let open Data_encoding in conv (fun {delegate; consensus_key; first_slot; attestation_power} -> @@ -3798,13 +3798,10 @@ module Attestation_rights = struct (obj4 (req "delegate" Signature.Public_key_hash.encoding) (req "first_slot" Slot.encoding) - (req - (if use_legacy_attestation_name then "endorsing_power" - else "attestation_power") - uint16) + (req "attestation_power" uint16) (req "consensus_key" Signature.Public_key_hash.encoding)) - let encoding ~use_legacy_attestation_name = + let encoding = let open Data_encoding in conv (fun {level; delegates_rights; estimated_time} -> @@ -3813,9 +3810,7 @@ module Attestation_rights = struct {level; delegates_rights; estimated_time}) (obj3 (req "level" Raw_level.encoding) - (req - "delegates" - (list (delegate_rights_encoding use_legacy_attestation_name))) + (req "delegates" (list delegate_rights_encoding)) (opt "estimated_time" Timestamp.encoding)) module S = struct @@ -3823,8 +3818,6 @@ 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; @@ -3863,34 +3856,8 @@ module Attestation_rights = struct 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:false)) + ~output:(list encoding) 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 = @@ -3961,8 +3928,6 @@ 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 889cc4ce54996cae9ba95bf6089c5dcc21a52c33 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 12 Feb 2024 10:56:47 +0100 Subject: [PATCH 2/3] tezt: fix endorsing rights tests --- tezt/tests/RPC_test.ml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tezt/tests/RPC_test.ml b/tezt/tests/RPC_test.ml index 9a80b2ce6907..8ace061ee07e 100644 --- a/tezt/tests/RPC_test.ml +++ b/tezt/tests/RPC_test.ml @@ -707,7 +707,7 @@ let test_misc_protocol _test_mode_tag protocol ?endpoint client = @@ RPC.get_chain_block_helper_current_level () in let* () = - if Protocol.(number protocol >= number Nairobi + 1) then + if Protocol.(number protocol >= number Oxford) then let* _ = Client.RPC.call ?endpoint ~hooks client @@ RPC.get_chain_block_context_denunciations () @@ -716,12 +716,10 @@ let test_misc_protocol _test_mode_tag protocol ?endpoint client = else unit in let* () = - if Protocol.(number protocol <= number Nairobi + 1) then + if Protocol.(number protocol <= number Oxford) then let* _ = Client.RPC.call ?endpoint ~hooks client @@ RPC.get_chain_block_helper_endorsing_rights () - (* TODO: https://gitlab.com/tezos/tezos/-/issues/6227 - This RPC helper should be removed once Oxford will be frozen. *) in let* _ = Client.RPC.call ?endpoint ~hooks client -- GitLab From bc1e5d8703d2dbf52f2d88dcae2300521d3ee4ff Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 12 Feb 2024 10:54:49 +0100 Subject: [PATCH 3/3] changes: add entry for endorsing rights rpc removal --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 6faf2a116bd3..d02d0cd3b312 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -50,6 +50,9 @@ Node ../helpers/scripts/simulate_operation`` default version to version ``1``. Version ``0`` can still be used with ``?version=0`` argument. (MR :gl:`!11889`) +- **Breaking change** Removed the deprecated ``endorsing_rights`` RPC, + use ``attestation_rights`` instead. (MR :gl:`!11952`) + Client ------ -- GitLab