diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index d221f48d6fab6b39306ef53989f75308807cb4f3..42af03252fa682cc80f9721a18c59364fb5010c9 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -41,6 +41,16 @@ Breaking Changes RPC Changes ----------- +- Added ``GET + /chains//blocks//delegate//companion_key``, + which returns the active companion key of the given delegate. Returns ``none`` + if key is not yet set. (MR :gl:`!17236`) + +- Updated ``GET /chains//blocks//delegate//`` + with the new field ``companion_key`` which returns the active companion key of + a given delegate (``none`` if not yet set), and the list of pending updates to + that key in the following cycles. (MR :gl:`!17236`) + Operation receipts ------------------ diff --git a/src/proto_alpha/lib_plugin/delegate_services.ml b/src/proto_alpha/lib_plugin/delegate_services.ml index f44a88bd99114b0cf9b23c770277db469263b5a9..4cf1206ebcadf6898dfca40d6f6d8492884b3e35 100644 --- a/src/proto_alpha/lib_plugin/delegate_services.ml +++ b/src/proto_alpha/lib_plugin/delegate_services.ml @@ -103,6 +103,44 @@ let consensus_key_info_encoding = consensus_key_encoding)) [])) +type companion_key = { + companion_key_pkh : Bls.Public_key_hash.t; + companion_key_pk : Bls.Public_key.t; +} + +let companion_key_encoding = + let open Data_encoding in + conv + (fun {companion_key_pkh; companion_key_pk} -> + (companion_key_pkh, companion_key_pk)) + (fun (companion_key_pkh, companion_key_pk) -> + {companion_key_pkh; companion_key_pk}) + (obj2 + (req "pkh" Bls.Public_key_hash.encoding) + (req "pk" Bls.Public_key.encoding)) + +type companion_keys_info = { + active_companion_key : companion_key option; + pending_companion_keys : (Cycle.t * companion_key) list; +} + +let companion_key_info_encoding = + let open Data_encoding in + conv + (fun {active_companion_key; pending_companion_keys} -> + (active_companion_key, pending_companion_keys)) + (fun (active_companion_key, pending_companion_keys) -> + {active_companion_key; pending_companion_keys}) + (obj2 + (req "active" (option companion_key_encoding)) + (dft + "pendings" + (list + (merge_objs + (obj1 (req "cycle" Cycle.encoding)) + companion_key_encoding)) + [])) + let participation_info_encoding = let open Data_encoding in conv @@ -231,6 +269,8 @@ type info = { voting_info : Vote.delegate_info; active_consensus_key : Signature.Public_key_hash.t; pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; + active_companion_key : Bls.Public_key_hash.t option; + pending_companion_keys : (Cycle.t * Bls.Public_key_hash.t) list; } type new_info = { @@ -272,6 +312,11 @@ type new_info = { consensus_key (* corresponds to old active_consensus_key and pending_consensus_keys *) : consensus_keys_info; + (* + Companion key *) + companion_key + (* corresponds to active_companion_key and pending_companion_keys *) : + companion_keys_info; (* Chunked RPCs at the end, because they might be arbitrarily large *) stakers : (public_key_hash * Tez.t) list; @@ -283,7 +328,7 @@ type new_info = { - staking_balance (equals total_staked + total_delegated - delegated_balance (equals external_staked + external_delegated) *) -let conv26 ty = +let conv27 ty = Data_encoding.conv (fun ( x0, x1, @@ -310,13 +355,14 @@ let conv26 ty = x22, x23, x24, - x25 ) -> + x25, + x26 ) -> ( (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, x25) ) )) + (x20, x21, x22, x23, x24, x25, x26) ) )) (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, x25) ) ) -> + (x20, x21, x22, x23, x24, x25, x26) ) ) -> ( x0, x1, x2, @@ -342,18 +388,19 @@ let conv26 ty = x22, x23, x24, - x25 )) + x25, + x26 )) ty -let obj26 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 f25 = - conv26 +let obj27 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 f25 f26 = + conv27 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) - (obj6 f20 f21 f22 f23 f24 f25))) + (obj7 f20 f21 f22 f23 f24 f25 f26))) let info_encoding = let open Data_encoding in @@ -387,6 +434,7 @@ let info_encoding = voting_info; (* Consensus key *) consensus_key; + companion_key; (* Chunked RPCs *) stakers; delegators; @@ -419,6 +467,7 @@ let info_encoding = voting_info, (* Consensus key *) consensus_key, + companion_key, (* Chunked RPCs *) stakers, delegators )) @@ -450,6 +499,7 @@ let info_encoding = voting_info, (* Consensus key *) consensus_key, + companion_key, (* Chunked RPCs *) stakers, delegators ) -> @@ -482,11 +532,12 @@ let info_encoding = voting_info; (* Consensus key *) consensus_key; + companion_key; (* Chunked RPCs *) stakers; delegators; }) - (obj26 + (obj27 (* General baking information *) (req "deactivated" bool) (req "is_forbidden" bool) @@ -519,6 +570,7 @@ let info_encoding = (req "voting_info" Vote.delegate_info_encoding) (* Consensus key *) (req "consensus_key" consensus_key_info_encoding) + (req "companion_key" companion_key_info_encoding) (* Chunked RPCs *) (req "stakers" stakers_encoding) (req "delegators" (list Contract.encoding))) @@ -872,6 +924,15 @@ module S = struct ~output:consensus_key_info_encoding RPC_path.(path / "consensus_key") + let companion_key = + RPC_service.get_service + ~description: + "The active companion key (if set) for a given delegate and the \ + pending companion keys." + ~query:RPC_query.empty + ~output:companion_key_info_encoding + RPC_path.(path / "companion_key") + let participation = RPC_service.get_service ~description: @@ -1007,6 +1068,28 @@ let consensus_key ctxt pkh = in return {active = {consensus_key_pk; consensus_key_pkh}; pendings} +let companion_key ctxt pkh = + let open Lwt_result_syntax in + let* {companion_pk = companion_key_pk; companion_pkh = companion_key_pkh; _} = + Delegate.Consensus_key.active_pubkey ctxt pkh + in + let* pending_companion_keys = + Delegate.Consensus_key.pending_companion_updates ctxt pkh + in + let pending_companion_keys = + List.map + (fun (cycle, companion_key_pkh, companion_key_pk) -> + (cycle, {companion_key_pk; companion_key_pkh})) + pending_companion_keys + in + let active_companion_key = + match (companion_key_pk, companion_key_pkh) with + | Some companion_key_pk, Some companion_key_pkh -> + Some {companion_key_pk; companion_key_pkh} + | _ -> None + in + return {active_companion_key; pending_companion_keys} + let contract_stake ctxt ~delegator_contract ~delegate = let open Alpha_context in let open Lwt_result_syntax in @@ -1270,6 +1353,7 @@ let info ctxt pkh = let* voting_info = Vote.get_delegate_info ctxt pkh in (* Consensus key *) let* consensus_key = consensus_key ctxt pkh in + let* companion_key = companion_key ctxt pkh in (* Chunked RPCs *) let* stakers = stakers ctxt pkh in let*! delegators = Delegate.delegated_contracts ctxt pkh in @@ -1303,6 +1387,7 @@ let info ctxt pkh = voting_info; (* Consensus key *) consensus_key; + companion_key; (* Chunked RPCs *) stakers; delegators; @@ -1416,6 +1501,8 @@ let register () = Vote.get_delegate_info ctxt pkh) ; register1 ~chunked:false S.consensus_key (fun ctxt pkh () () -> consensus_key ctxt pkh) ; + register1 ~chunked:false S.companion_key (fun ctxt pkh () () -> + companion_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) ; @@ -1510,6 +1597,9 @@ let voting_info ctxt block pkh = let consensus_key ctxt block pkh = RPC_context.make_call1 S.consensus_key ctxt block pkh () () +let companion_key ctxt block pkh = + RPC_context.make_call1 S.companion_key ctxt block pkh () () + let participation ctxt block pkh = RPC_context.make_call1 S.participation ctxt block pkh () () @@ -1565,6 +1655,7 @@ let info ctxt block pkh = voting_info; (* Consensus key *) consensus_key; + companion_key; (* Chunked RPCs *) stakers = _; delegators; @@ -1600,4 +1691,12 @@ let info ctxt block pkh = List.map (fun (cyc, ck) -> (cyc, ck.consensus_key_pkh)) consensus_key.pendings; + active_companion_key = + Option.map + (fun x -> x.companion_key_pkh) + companion_key.active_companion_key; + pending_companion_keys = + List.map + (fun (cyc, ck) -> (cyc, ck.companion_key_pkh)) + companion_key.pending_companion_keys; } diff --git a/src/proto_alpha/lib_plugin/delegate_services.mli b/src/proto_alpha/lib_plugin/delegate_services.mli index 2967d93fbfc6ee55e56a603d295dc1254e34ea63..2f5e7d9dc8fbca05a982e33aa3da846c3f9f3e59 100644 --- a/src/proto_alpha/lib_plugin/delegate_services.mli +++ b/src/proto_alpha/lib_plugin/delegate_services.mli @@ -56,6 +56,16 @@ type consensus_keys_info = { pendings : (Cycle.t * consensus_key) list; } +type companion_key = { + companion_key_pkh : Bls.Public_key_hash.t; + companion_key_pk : Bls.Public_key.t; +} + +type companion_keys_info = { + active_companion_key : companion_key option; + pending_companion_keys : (Cycle.t * companion_key) list; +} + type deposit_per_cycle = {cycle : Cycle.t; deposit : Tez.t} val deposit_per_cycle_encoding : deposit_per_cycle Data_encoding.t @@ -77,6 +87,8 @@ type info = { voting_info : Vote.delegate_info; active_consensus_key : Signature.Public_key_hash.t; pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; + active_companion_key : Bls.Public_key_hash.t option; + pending_companion_keys : (Cycle.t * Bls.Public_key_hash.t) list; } val is_forbidden : @@ -166,6 +178,12 @@ val consensus_key : Signature.Public_key_hash.t -> consensus_keys_info shell_tzresult Lwt.t +val companion_key : + 'a #RPC_context.simple -> + 'a -> + Signature.Public_key_hash.t -> + companion_keys_info shell_tzresult Lwt.t + val participation : 'a #RPC_context.simple -> 'a -> diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 97bc7c722db7be752ad8df41aadc6e897f9654c1..69ba51ebc5336bc2d3de40e2d634dc76c97666d4 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2382,6 +2382,11 @@ module Delegate : sig public_key_hash -> (Cycle.t * public_key_hash * public_key) list tzresult Lwt.t + val pending_companion_updates : + context -> + public_key_hash -> + (Cycle.t * Bls.Public_key_hash.t * Bls.Public_key.t) list tzresult Lwt.t + val register_update : context -> public_key_hash -> public_key -> context tzresult Lwt.t end diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index 9bd9e187b5663dcbc2d5e8c1b1b240d4f8befe9d..958df8d16a1a9f146a2fa61c06cdac89a09c411c 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -544,6 +544,8 @@ module Delegate = struct 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; + active_companion_key : Signature.Bls.Public_key_hash.t option; + pending_companion_keys : (Cycle.t * Signature.Bls.Public_key_hash.t) list; } type stake = {frozen : Tez.t; weighted_delegated : Tez.t} @@ -583,6 +585,8 @@ module Delegate = struct let consensus_key ctxt pkh = Delegate_services.consensus_key rpc_ctxt ctxt pkh + let companion_key ctxt pkh = Delegate_services.companion_key rpc_ctxt ctxt pkh + let participation ctxt pkh = Delegate_services.participation rpc_ctxt ctxt pkh let dal_participation ctxt pkh = diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.mli b/src/proto_alpha/lib_protocol/test/helpers/context.mli index 0df81f0445f72f9be0477100de1dab00b37ebb97..cb78d287f28ec4c7a9f322098ab3725e827b182f 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.mli +++ b/src/proto_alpha/lib_protocol/test/helpers/context.mli @@ -277,6 +277,8 @@ module Delegate : sig voting_info : Vote.delegate_info; active_consensus_key : Signature.Public_key_hash.t; pending_consensus_keys : (Cycle.t * Signature.Public_key_hash.t) list; + active_companion_key : Bls.Public_key_hash.t option; + pending_companion_keys : (Cycle.t * Bls.Public_key_hash.t) list; } type stake = {frozen : Tez.t; weighted_delegated : Tez.t} @@ -319,6 +321,9 @@ module Delegate : sig val consensus_key : t -> public_key_hash -> Delegate_services.consensus_keys_info tzresult Lwt.t + val companion_key : + t -> public_key_hash -> Delegate_services.companion_keys_info tzresult Lwt.t + val participation : t -> public_key_hash -> Delegate.For_RPC.participation_info tzresult Lwt.t diff --git a/tezt/lib_tezos/RPC.ml b/tezt/lib_tezos/RPC.ml index 317868aed10a766c32a8b854b0b66bb64b4db358..485f8a65da37d669f2c8a1b6b42feb3addc739d4 100644 --- a/tezt/lib_tezos/RPC.ml +++ b/tezt/lib_tezos/RPC.ml @@ -1693,6 +1693,22 @@ let get_chain_block_context_delegate_consensus_key ?(chain = "main") ] Fun.id +let get_chain_block_context_delegate_companion_key ?(chain = "main") + ?(block = "head") pkh = + make + GET + [ + "chains"; + chain; + "blocks"; + block; + "context"; + "delegates"; + pkh; + "companion_key"; + ] + Fun.id + let get_chain_block_context_total_supply ?(chain = "main") ?(block = "head") () = make GET ["chains"; chain; "blocks"; block; "context"; "total_supply"] Fun.id diff --git a/tezt/lib_tezos/RPC.mli b/tezt/lib_tezos/RPC.mli index e6080e870b9e128c768b2fe14dc1ae3ea46076a2..73567d52a93ca50f10b41a60ff56c9e33bcc04a2 100644 --- a/tezt/lib_tezos/RPC.mli +++ b/tezt/lib_tezos/RPC.mli @@ -1237,6 +1237,13 @@ val get_chain_block_context_delegate_voting_power : val get_chain_block_context_delegate_consensus_key : ?chain:string -> ?block:string -> string -> JSON.t t +(** RPC: [GET /chains//blocks//context/delegates//companion_key] + + [chain] defaults to ["main"]. + [block] defaults to ["head"]. *) +val get_chain_block_context_delegate_companion_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/RPC_test.ml b/tezt/tests/RPC_test.ml index 04cd6a3e62f8a06968c67e32a709d413f19d845a..1bbc6abd2dd1d23242b7d4a65afe8d5d80b2c17d 100644 --- a/tezt/tests/RPC_test.ml +++ b/tezt/tests/RPC_test.ml @@ -349,7 +349,7 @@ let test_contracts _test_mode_tag protocol ?endpoint client = in unit -let test_delegates_on_registered_alpha ~contracts ?endpoint client = +let test_delegates_on_registered_alpha protocol ~contracts ?endpoint client = Log.info "Test implicit baker contract" ; let bootstrap = List.hd contracts in @@ -389,6 +389,19 @@ let test_delegates_on_registered_alpha ~contracts ?endpoint client = Client.RPC.call ?endpoint ~hooks client @@ RPC.get_chain_block_context_delegate_voting_power bootstrap in + let* _ = + Client.RPC.call ?endpoint ~hooks client + @@ RPC.get_chain_block_context_delegate_consensus_key bootstrap + in + let* _ = + if Protocol.(number protocol >= 023) then + let* _ = + Client.RPC.call ?endpoint ~hooks client + @@ RPC.get_chain_block_context_delegate_companion_key bootstrap + in + unit + else unit + in unit let test_adaptive_issuance ~contracts ?endpoint client = @@ -507,7 +520,7 @@ let test_delegates_on_registered_hangzhou ~contracts ?endpoint client = unit (* Test the delegates RPC with unregistered baker for Tenderbake protocols. *) -let test_delegates_on_unregistered_alpha ~contracts ?endpoint client = +let test_delegates_on_unregistered_alpha protocol ~contracts ?endpoint client = Log.info "Test with a PKH that is not a registered baker contract" ; let unregistered_baker = "tz1c5BVkpwCiaPHJBzyjg7UHpJEMPTYA1bHG" in @@ -552,6 +565,19 @@ let test_delegates_on_unregistered_alpha ~contracts ?endpoint client = check_failure @@ RPC.get_chain_block_context_delegate_voting_power unregistered_baker in + let* () = + check_failure + @@ RPC.get_chain_block_context_delegate_consensus_key unregistered_baker + in + let* () = + if Protocol.(number protocol >= 023) then + let* () = + check_failure + @@ RPC.get_chain_block_context_delegate_companion_key unregistered_baker + in + unit + else unit + in unit (* Test the delegates RPC with unregistered baker for Emmy protocols. *) @@ -623,10 +649,12 @@ let get_contracts ?endpoint client = Lwt.return contracts (* Test the delegates RPC for the specified protocol. *) -let test_delegates _test_mode_tag _protocol ?endpoint client = +let test_delegates _test_mode_tag protocol ?endpoint client = let* contracts = get_contracts ?endpoint client in - let* () = test_delegates_on_registered_alpha ~contracts ?endpoint client in - test_delegates_on_unregistered_alpha ~contracts ?endpoint client + let* () = + test_delegates_on_registered_alpha protocol ~contracts ?endpoint client + in + test_delegates_on_unregistered_alpha protocol ~contracts ?endpoint client (* Test the adaptive issuance RPC. *) let test_adaptive_issuance _test_mode_tag (_ : Protocol.t) ?endpoint client = 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 7d5a299c3b3680e8f924c6a72fe2d3b2c712d381..cbaa5f5251f3fb18c5819070d6839e8c847fc5da 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 @@ -51,6 +51,7 @@ { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -80,6 +81,14 @@ false ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + +./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/companion_key' +{ "active": null } + ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -125,3 +134,15 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + + +./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/companion_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + 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 a40052ec4bd688224307e26c70f5003f2ff4b01a..8bb3a697b4a0b11fa5e01976268a3e8ff6af2ec2 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 @@ -51,6 +51,7 @@ { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -80,6 +81,14 @@ false ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + +./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/companion_key' +{ "active": null } + ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -125,3 +134,15 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + + +./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/companion_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + 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 884c401000f6b2c61500a69dbcad83ed3a5e0fe2..1f9cd758327752cc1d271437e2ee8b9bd4425a76 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 @@ -51,6 +51,7 @@ { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -80,6 +81,14 @@ false ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + +./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/companion_key' +{ "active": null } + ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -125,3 +134,15 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + + +./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/companion_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + diff --git a/tezt/tests/expected/RPC_test.ml/Quebec- (mode client) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Quebec- (mode client) RPC regression tests- delegates.out index 28829e740f34e22dda685e509d7e416b54821f8d..750e71453979ad51791444d5cfb911189c36656f 100644 --- a/tezt/tests/expected/RPC_test.ml/Quebec- (mode client) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Quebec- (mode client) RPC regression tests- delegates.out @@ -75,6 +75,11 @@ false ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -120,3 +125,9 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + diff --git a/tezt/tests/expected/RPC_test.ml/Quebec- (mode light) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Quebec- (mode light) RPC regression tests- delegates.out index c7e8cc22050588faa60f5901564134a483d96031..0ee7fef2684a06f0ffe943d5ae6473b980592331 100644 --- a/tezt/tests/expected/RPC_test.ml/Quebec- (mode light) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Quebec- (mode light) RPC regression tests- delegates.out @@ -75,6 +75,11 @@ false ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -120,3 +125,9 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + diff --git a/tezt/tests/expected/RPC_test.ml/Quebec- (mode proxy) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/Quebec- (mode proxy) RPC regression tests- delegates.out index 02c772dc091bf8f316c3150d5ea7712a957ce3da..1363878f098500707a66bf048a7c0a4749832c41 100644 --- a/tezt/tests/expected/RPC_test.ml/Quebec- (mode proxy) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/Quebec- (mode proxy) RPC regression tests- delegates.out @@ -75,6 +75,11 @@ false ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -120,3 +125,9 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + diff --git a/tezt/tests/expected/RPC_test.ml/R022-- (mode client) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/R022-- (mode client) RPC regression tests- delegates.out index 7d5a299c3b3680e8f924c6a72fe2d3b2c712d381..0cd50545ebe0785026752057f069faf1b7a8519b 100644 --- a/tezt/tests/expected/RPC_test.ml/R022-- (mode client) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/R022-- (mode client) RPC regression tests- delegates.out @@ -80,6 +80,11 @@ false ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -125,3 +130,9 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + diff --git a/tezt/tests/expected/RPC_test.ml/R022-- (mode light) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/R022-- (mode light) RPC regression tests- delegates.out index a40052ec4bd688224307e26c70f5003f2ff4b01a..865871a395ca723100eac3af88405ff8f7529660 100644 --- a/tezt/tests/expected/RPC_test.ml/R022-- (mode light) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/R022-- (mode light) RPC regression tests- delegates.out @@ -80,6 +80,11 @@ false ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + ./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -125,3 +130,9 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client --mode light rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + diff --git a/tezt/tests/expected/RPC_test.ml/R022-- (mode proxy) RPC regression tests- delegates.out b/tezt/tests/expected/RPC_test.ml/R022-- (mode proxy) RPC regression tests- delegates.out index 884c401000f6b2c61500a69dbcad83ed3a5e0fe2..194787c49b570f930c90ee3bae9919c72479b37a 100644 --- a/tezt/tests/expected/RPC_test.ml/R022-- (mode proxy) RPC regression tests- delegates.out +++ b/tezt/tests/expected/RPC_test.ml/R022-- (mode proxy) RPC regression tests- delegates.out @@ -80,6 +80,11 @@ false ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/voting_power' "4000000000000" +./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +{ "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": "[PUBLIC_KEY]" } } + ./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. @@ -125,3 +130,9 @@ Fatal error: Fatal error: Command failed: The provided public key hash ([PUBLIC_KEY_HASH]) is not the address of a registered delegate. If you own this account and want to register it as a delegate, use a delegation operation to delegate the account to itself. + +./octez-client --mode proxy rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]/consensus_key' +Fatal error: + Command failed: Storage error: + Missing key 'contracts/index/0000b443c2c85e0aeb6a4c0a37783f4d8251a956e8ad/consensus_key/active'. + 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 1f5149d2b3921f7c8fdc5e75c9f3ec0fd9aa17f7..801e5d68fad41b9949af7506f7fb947ccdc6a261 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 @@ -60,6 +60,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -103,6 +104,7 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } ] }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000015001" } ], @@ -144,6 +146,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000159015" } ], @@ -185,6 +188,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000159015" } ], @@ -257,6 +261,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000160086" } ], 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 a651ab6098de7964eb5525d6f88c43f7825242de..e170ef49608fa5e5d2bf6dab6c33b49d61368243 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 @@ -60,6 +60,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -103,6 +104,7 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } ] }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000015001" } ], @@ -144,6 +146,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000159015" } ], @@ -185,6 +188,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000159015" } ], @@ -257,6 +261,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000160086" } ], 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 477ca3cc082b6a58caf2cd5a482de0b03c925e79..7d1f00844b2485c99ee4ba874a212aa3259faaa9 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 @@ -60,6 +60,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -103,6 +104,7 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } ] }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -144,6 +146,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000144014" } ], @@ -185,6 +188,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000144014" } ], @@ -257,6 +261,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000145085" } ], 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 d265883cc0674c49d36afc066695d54ea9e392fd..96d234c73506ee8d88a3d10c57afa3e410cb818a 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 @@ -60,6 +60,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -103,6 +104,7 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } ] }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -144,6 +146,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000144014" } ], @@ -185,6 +188,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000144014" } ], @@ -257,6 +261,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000145085" } ], 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 69dce6a7ff25fb3cb96ca2836e18780ee77bbf5c..58266e525f61821fcaa74e2754e6d65e61b94ded 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 @@ -96,7 +96,8 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } ] }, - "stakers": [], "delegators": [ "[PUBLIC_KEY_HASH]" ] } + "companion_key": { "active": null }, "stakers": [], + "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]' { "balance": "0", "counter": "4" } @@ -135,6 +136,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "500000000000" } ], 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 e68d67fe0179335647a6165d4dac70463385e7d5..357946eb55a3d2a662f5f7aaa024ecb4be33a669 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 @@ -60,6 +60,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -103,6 +104,7 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } ] }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000015001" } ], @@ -144,6 +146,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000159015" } ], 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 747df4f9215335857be4e04a6396c2ee7f3e6a7b..2066c348c18a88075bcc022a3e87ff8a5c1f8b58 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 @@ -60,6 +60,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -103,6 +104,7 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } ] }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000000000" } ], @@ -144,6 +146,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "200000144014" } ], 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 a55d4f012489eeb99117e48a733b6ba2f4ea67ac..2f4e15d86bb011bc5264b098471d567cabe0bc76 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 @@ -143,6 +143,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, + "companion_key": { "active": null }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "499900000000" } ], diff --git a/tezt/tests/protocol_migration.ml b/tezt/tests/protocol_migration.ml index e69728f1e692f85867fc95be2c244f9afc62a85c..f650580d8925ac935372f5c80c09e52f54c0bca8 100644 --- a/tezt/tests/protocol_migration.ml +++ b/tezt/tests/protocol_migration.ml @@ -130,6 +130,60 @@ let check_adaptive_issuance_launch_cycle ~loc ~migrate_from client = ~error_msg:"Expected adaptive_issuance_launch_cycle = %R but got %L") ; unit +(* Check for R to S migration. Remove after S. *) +let check_delegate_sampler_state client = + let check_failure rpc = + let*? process = Client.RPC.spawn client @@ rpc in + Process.check ~expect_failure:true process + in + let check_success rpc = + let*? process = Client.RPC.spawn client @@ rpc in + Process.check ~expect_failure:false process + in + let* constants = + Client.RPC.call client @@ RPC.get_chain_block_context_constants () + in + let blocks_per_cycle = JSON.(constants |-> "blocks_per_cycle" |> as_int) in + let consensus_rights_delay = + JSON.(constants |-> "consensus_rights_delay" |> as_int) + in + let* level = Client.level client in + let current_cycle = level / blocks_per_cycle in + let* () = + Tezos_base.TzPervasives.List.iter_s + (fun cycle -> + let* () = + check_success + @@ RPC.get_chain_block_context_raw_json + ~path:["cycle"; string_of_int cycle; "delegate_sampler_state"] + () + in + unit) + (List.init (consensus_rights_delay + 2) (fun x -> + max 0 (current_cycle - 1 + x))) + in + let* () = + check_failure + @@ RPC.get_chain_block_context_raw_json + ~path: + [ + "cycle"; + string_of_int (current_cycle + consensus_rights_delay + 1); + "delegate_sampler_state"; + ] + () + in + let* () = + check_failure + @@ RPC.get_chain_block_context_raw_json + ~path: + [ + "cycle"; string_of_int (current_cycle - 2); "delegate_sampler_state"; + ] + () + in + unit + (* Migration to Tenderbake is only supported after the first cycle, therefore at [migration_level >= blocks_per_cycle]. *) let perform_protocol_migration ?node_name ?client_name ?parameter_file @@ -171,6 +225,8 @@ let perform_protocol_migration ?node_name ?client_name ?parameter_file let* () = check_adaptive_issuance_launch_cycle ~loc:__LOC__ ~migrate_from client in + (* Remove check_delegate_sampler_state after S. *) + let* () = check_delegate_sampler_state client in let* () = Client.bake_for_and_wait client in (* Ensure that we migrated *) Log.info "Checking migration block consistency" ; @@ -182,6 +238,9 @@ let perform_protocol_migration ?node_name ?client_name ?parameter_file ~migrate_to ~level:(migration_level + 1) in + (* Test that R to S stitching for Delegate_sampler worked correctly. + Remove after S. *) + let* () = check_delegate_sampler_state client in (* Test that we can still bake after migration *) let* () = repeat baked_blocks_after_migration (fun () -> @@ -190,6 +249,8 @@ let perform_protocol_migration ?node_name ?client_name ?parameter_file let* () = check_adaptive_issuance_launch_cycle ~loc:__LOC__ ~migrate_from client in + (* Remove check_delegate_sampler_state after S. *) + let* () = check_delegate_sampler_state client in return (client, node) (** Test all levels for one cycle, after the first cycle. *)