From 7d786bd116a20c496565fdc82c463e06212516cb Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Wed, 7 May 2025 15:17:34 +0200 Subject: [PATCH 1/4] Proto/client: add register companion key at self delegation time Both standalone and with consensus key --- .../lib_client/client_proto_context.ml | 87 ++++++++++-- .../lib_client/client_proto_context.mli | 3 +- .../client_proto_context_commands.ml | 134 +++++++++++++++++- 3 files changed, 210 insertions(+), 14 deletions(-) diff --git a/src/proto_alpha/lib_client/client_proto_context.ml b/src/proto_alpha/lib_client/client_proto_context.ml index 5b682f90559d..2099e9334a14 100644 --- a/src/proto_alpha/lib_client/client_proto_context.ml +++ b/src/proto_alpha/lib_client/client_proto_context.ml @@ -380,12 +380,13 @@ let build_update_consensus_key cctxt ?fee ?gas_limit ?storage_limit operation let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run - ?verbose_signing ?fee ~manager_sk ~fee_parameter ?consensus_keys src_pk = + ?verbose_signing ?fee ~manager_sk ~fee_parameter ?consensus_keys + ?companion_keys src_pk = let open Lwt_result_syntax in let source = Signature.Public_key.hash src_pk in let delegate_op = build_delegate_operation ?fee (Some source) in - match consensus_keys with - | None -> ( + match (consensus_keys, companion_keys) with + | None, None -> ( let operation = Annotated_manager_operation.Single_manager delegate_op in let* oph, _, op, result = Injection.inject_manager_operation @@ -406,16 +407,16 @@ let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run in match Apply_results.pack_contents_list op result with | Apply_results.Single_and_result ((Manager_operation _ as op), result) -> - return ((oph, op, result), None)) - | Some (public_key, secret_key_uri) -> ( + return ((oph, op, result), [])) + | Some (public_key, secret_key_uri), None + | None, Some (public_key, secret_key_uri) -> ( let* operation = + let kind = + if Option.is_some consensus_keys then Operation_repr.Consensus + else Companion + in let+ operation_content = - build_update_consensus_key - cctxt - ~kind:Consensus - ?fee - ?secret_key_uri - public_key + build_update_consensus_key cctxt ~kind ?fee ?secret_key_uri public_key in Annotated_manager_operation.Cons_manager ( delegate_op, @@ -447,7 +448,69 @@ let register_as_delegate cctxt ~chain ~block ?confirmations ?dry_run ( (Manager_operation _ as op1), res1, Single_and_result ((Manager_operation _ as op2), res2) ) -> - return ((oph, op1, res1), Some (op2, res2))) + return ((oph, op1, res1), [(op2, res2)])) + | ( Some (public_key_consensus, secret_key_uri_consensus), + Some (public_key_companion, secret_key_uri_companion) ) -> ( + let* operation = + let* operation_consensus = + build_update_consensus_key + cctxt + ~kind:Consensus + ?fee + ?secret_key_uri:secret_key_uri_consensus + public_key_consensus + in + let* operation_companion = + build_update_consensus_key + cctxt + ~kind:Companion + ?fee + ?secret_key_uri:secret_key_uri_companion + public_key_companion + in + return + @@ Annotated_manager_operation.( + Cons_manager + ( delegate_op, + Cons_manager + (operation_consensus, Single_manager operation_companion) )) + in + let* oph, _, op, result = + Injection.inject_manager_operation + cctxt + ~chain + ~block + ?confirmations + ?dry_run + ?verbose_signing + ~successor_level:true + ~source + ~fee:(Limit.of_option fee) + ~gas_limit:Limit.unknown + ~storage_limit:Limit.unknown + ~src_pk + ~src_sk:manager_sk + ~fee_parameter + operation + in + match Apply_results.pack_contents_list op result with + | Apply_results.Single_and_result + (Manager_operation _, Manager_operation_result _) -> + . + | Apply_results.Cons_and_result + ( Manager_operation _, + Manager_operation_result _, + Single_and_result (Manager_operation _, Manager_operation_result _) + ) -> + . + | Apply_results.Cons_and_result + ( (Manager_operation _ as op1), + res1, + Cons_and_result + ( (Manager_operation _ as op2), + res2, + Single_and_result ((Manager_operation _ as op3), res3) ) ) -> + return ((oph, op1, res1), [(op2, res2); (op3, res3)])) let update_consensus_or_companion_key ~kind cctxt ~chain ~block ?confirmations ?dry_run ?verbose_signing ?simulation ?fee ?secret_key_uri ~public_key diff --git a/src/proto_alpha/lib_client/client_proto_context.mli b/src/proto_alpha/lib_client/client_proto_context.mli index 37aaf126b72c..edebab05a427 100644 --- a/src/proto_alpha/lib_client/client_proto_context.mli +++ b/src/proto_alpha/lib_client/client_proto_context.mli @@ -301,11 +301,12 @@ val register_as_delegate : manager_sk:Client_keys.sk_uri -> fee_parameter:Injection.fee_parameter -> ?consensus_keys:public_key * Client_keys.sk_uri option -> + ?companion_keys:public_key * Client_keys.sk_uri option -> public_key -> (Kind.delegation Kind.manager Injection.result * (Kind.update_consensus_key Kind.manager contents * Kind.update_consensus_key Kind.manager Apply_results.contents_result) - option) + list) tzresult Lwt.t diff --git a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml index d39934e44203..0cf2a0be80ec 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml @@ -2324,7 +2324,7 @@ let commands_rw () = | Error el -> Lwt.return_error el); command ~group - ~desc:"Register the public key hash as a delegate." + ~desc:"Register the public key hash as a delegate with a consensus key." (args4 fee_arg dry_run_switch verbose_signing_switch fee_parameter_args) (prefixes ["register"; "key"] @@ Public_key_hash.source_param ~name:"mgr" ~desc:"the delegate key" @@ -2377,6 +2377,138 @@ let commands_rw () = let*! () = cctxt#message "Delegate already activated." in return_unit | Error el -> Lwt.return_error el); + command + ~group + ~desc:"Register the public key hash as a delegate with a companion key." + (args4 fee_arg dry_run_switch verbose_signing_switch fee_parameter_args) + (prefixes ["register"; "key"] + @@ Public_key_hash.source_param ~name:"mgr" ~desc:"the delegate key" + @@ prefixes ["as"; "delegate"; "with"; "companion"; "key"] + @@ Public_key.source_param ~name:"key" ~desc:"the companion key" + @@ stop) + (fun (fee, dry_run, verbose_signing, fee_parameter) + src_pkh + (name_pk, public_key) + cctxt -> + let open Lwt_result_syntax in + let* _, src_pk, src_sk = Client_keys.get_key cctxt src_pkh in + let* companion_keys = + let* public_key = + match public_key with + | Some pk -> return pk + | None -> Client_keys.public_key name_pk + in + let* secret_key_uri = + match public_key with + | Bls _ -> + let pkh = Signature.Public_key.hash public_key in + let* _, _, secret_key_uri = Client_keys.get_key cctxt pkh in + return_some secret_key_uri + | _ -> return_none + in + return (public_key, secret_key_uri) + in + let*! r = + register_as_delegate + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + ?confirmations:cctxt#confirmations + ~dry_run + ~fee_parameter + ~verbose_signing + ?fee + ~manager_sk:src_sk + ~companion_keys + src_pk + in + match r with + | Ok _ -> return_unit + | Error + [ + Environment.Ecoproto_error + Delegate_storage.Contract.Active_delegate; + ] -> + let*! () = cctxt#message "Delegate already activated." in + return_unit + | Error el -> Lwt.return_error el); + command + ~group + ~desc: + "Register the public key hash as a delegate with a consensus and a \ + companion key." + (args4 fee_arg dry_run_switch verbose_signing_switch fee_parameter_args) + (prefixes ["register"; "key"] + @@ Public_key_hash.source_param ~name:"mgr" ~desc:"the delegate key" + @@ prefixes ["as"; "delegate"; "with"; "consensus"; "key"] + @@ Public_key.source_param ~name:"key" ~desc:"the consensus key" + @@ prefixes ["and"; "companion"; "key"] + @@ Public_key.source_param ~name:"key" ~desc:"the companion key" + @@ stop) + (fun (fee, dry_run, verbose_signing, fee_parameter) + src_pkh + (name_pk_consensus, public_key_consensus) + (name_pk_companion, public_key_companion) + cctxt -> + let open Lwt_result_syntax in + let* _, src_pk, src_sk = Client_keys.get_key cctxt src_pkh in + let* consensus_keys = + let* public_key = + match public_key_consensus with + | Some pk -> return pk + | None -> Client_keys.public_key name_pk_consensus + in + let* secret_key_uri = + match public_key with + | Bls _ -> + let pkh = Signature.Public_key.hash public_key in + let* _, _, secret_key_uri = Client_keys.get_key cctxt pkh in + return_some secret_key_uri + | _ -> return_none + in + return (public_key, secret_key_uri) + in + let* companion_keys = + let* public_key = + match public_key_companion with + | Some pk -> return pk + | None -> Client_keys.public_key name_pk_companion + in + let* secret_key_uri = + match public_key with + | Bls _ -> + let pkh = Signature.Public_key.hash public_key in + let* _, _, secret_key_uri = Client_keys.get_key cctxt pkh in + return_some secret_key_uri + | _ -> return_none + in + return (public_key, secret_key_uri) + in + let*! r = + register_as_delegate + cctxt + ~chain:cctxt#chain + ~block:cctxt#block + ?confirmations:cctxt#confirmations + ~dry_run + ~fee_parameter + ~verbose_signing + ?fee + ~manager_sk:src_sk + ~consensus_keys + ~companion_keys + src_pk + in + match r with + | Ok _ -> return_unit + | Error + [ + Environment.Ecoproto_error + Delegate_storage.Contract.Active_delegate; + ] -> + let*! () = cctxt#message "Delegate already activated." in + return_unit + | Error el -> Lwt.return_error el); command ~group ~desc:"Update the consensus key of a delegate." -- GitLab From 668c108a160a05223f2058fc6020da0e3386d310 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Tue, 13 May 2025 10:58:43 +0200 Subject: [PATCH 2/4] Docs: update changelog --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 8508d4983bd7..ff9ce6f980f2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -76,6 +76,11 @@ Client - Add a new command ``threshold bls signatures`` to recover a BLS threshold signature. (MR :gl:`!17467`) +- Added ``octez-client register key as delegate with companion key ``, + and ``octez-client register key as delegate with consensus key and companion key ``, + setting a companion key at the same time as registering a given key as a delegate. + (MR :gl:`!17960`) + Signer ------ -- GitLab From c8d6cf2b557114788d5f25c8aea7ca14eb96d87f Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Wed, 7 May 2025 16:23:51 +0200 Subject: [PATCH 3/4] Tezt: update some tests with new command --- tezt/lib_tezos/client.ml | 17 +++-- tezt/lib_tezos/client.mli | 8 +- tezt/tests/consensus_key.ml | 74 +++++++++++++------ ...lpha- Test register with consensus key.out | 63 +++++++++++----- 4 files changed, 114 insertions(+), 48 deletions(-) diff --git a/tezt/lib_tezos/client.ml b/tezt/lib_tezos/client.ml index eb4b0e8f4978..10ec35f23ae6 100644 --- a/tezt/lib_tezos/client.ml +++ b/tezt/lib_tezos/client.ml @@ -3167,18 +3167,21 @@ let init_with_protocol ?path ?admin_path ?name ?node_name ?color ?base_dir let* _ = Node.wait_for_level node 1 in return (node, client) -let spawn_register_key ?hooks ?consensus owner client = +let spawn_register_key ?hooks ?consensus ?companion owner client = spawn_command ?hooks client (["--wait"; "none"; "register"; "key"; owner; "as"; "delegate"] @ - match consensus with - | None -> [] - | Some pk -> ["with"; "consensus"; "key"; pk]) - -let register_key ?hooks ?expect_failure ?consensus owner client = - spawn_register_key ?hooks ?consensus owner client + match (consensus, companion) with + | None, None -> [] + | Some pk, None -> ["with"; "consensus"; "key"; pk] + | None, Some pk -> ["with"; "companion"; "key"; pk] + | Some pk1, Some pk2 -> + ["with"; "consensus"; "key"; pk1; "and"; "companion"; "key"; pk2]) + +let register_key ?hooks ?expect_failure ?consensus ?companion owner client = + spawn_register_key ?hooks ?consensus ?companion owner client |> Process.check ?expect_failure let contract_storage ?hooks ?unparsing_mode address client = diff --git a/tezt/lib_tezos/client.mli b/tezt/lib_tezos/client.mli index 7d8e8b62a11f..079322697e3c 100644 --- a/tezt/lib_tezos/client.mli +++ b/tezt/lib_tezos/client.mli @@ -2687,13 +2687,19 @@ val spawn_command_with_stdin : (** Register public key for given account with given client. *) val spawn_register_key : - ?hooks:Process.hooks -> ?consensus:string -> string -> t -> Process.t + ?hooks:Process.hooks -> + ?consensus:string -> + ?companion:string -> + string -> + t -> + Process.t (** Register public key for given account with given client. *) val register_key : ?hooks:Process.hooks -> ?expect_failure:bool -> ?consensus:string -> + ?companion:string -> string -> t -> unit Lwt.t diff --git a/tezt/tests/consensus_key.ml b/tezt/tests/consensus_key.ml index 82d3af10693e..c45a3d415dd9 100644 --- a/tezt/tests/consensus_key.ml +++ b/tezt/tests/consensus_key.ml @@ -571,18 +571,28 @@ let check_consensus_key ~__LOC__ delegate ?(expected_active = delegate) let register_key_as_delegate ?(expect_failure = false) ?(baker = Constant.bootstrap1.alias) ~(owner : Account.key) - ~(consensus_key : Account.key) client = + ~(consensus_key : Account.key) ~(companion_key : Account.key) ~protocol + client = let* _ = Client.RPC.call ~hooks client @@ RPC.get_chain_block_context_contract ~id:consensus_key.public_key_hash () in let* () = - Client.register_key - ~hooks - ~expect_failure - ~consensus:consensus_key.alias - owner.alias - client + if Protocol.(number protocol >= 023) then + Client.register_key + ~hooks + ~expect_failure + ~consensus:consensus_key.alias + ~companion:companion_key.alias + owner.alias + client + else + Client.register_key + ~hooks + ~expect_failure + ~consensus:consensus_key.alias + owner.alias + client in let* () = Client.bake_for_and_wait ~keys:[baker] client in let* _ = @@ -656,11 +666,15 @@ let register ?(regression = true) title test = let baker_1 = Constant.bootstrap2 in let* account_0 = Client.gen_and_show_keys ~alias:"dummy_account_0" client in let* account_1 = Client.gen_and_show_keys ~alias:"dummy_account_1" client in - test client baker_0 baker_1 account_0 account_1 + let* account_2 = + Client.gen_and_show_keys ~alias:"dummy_account_2" ~sig_alg:"bls" client + in + test protocol client baker_0 baker_1 account_0 account_1 account_2 let test_register_delegate_with_consensus_key ?(expect_failure = false) ?(baker = Constant.bootstrap1.alias) ~(new_delegate : Account.key) - ~(new_consensus_key : Account.key) client = + ~(new_consensus_key : Account.key) ~(new_companion_key : Account.key) + ~protocol client = let* () = transfer ~source:baker @@ -674,7 +688,9 @@ let test_register_delegate_with_consensus_key ?(expect_failure = false) ~expect_failure ~owner:new_delegate ~consensus_key:new_consensus_key + ~companion_key:new_companion_key ~baker + ~protocol client in @@ -688,9 +704,16 @@ let test_register_delegate_with_consensus_key ?(expect_failure = false) does not store a regression trace. Instead, it [Check]s that the new consensus key is as expected. *) let register_key_as_delegate_no_reg ?(baker = Constant.bootstrap1.alias) - ~(owner : Account.key) ~(consensus_key : Account.key) client = - let* () = - Client.register_key ~consensus:consensus_key.alias owner.alias client + ~(owner : Account.key) ~(consensus_key : Account.key) + ~(companion_key : Account.key) ~protocol client = + let* () = + if Protocol.(number protocol >= 023) then + Client.register_key + ~consensus:consensus_key.alias + ~companion:companion_key.alias + owner.alias + client + else Client.register_key ~consensus:consensus_key.alias owner.alias client in let* level_information = Helpers.get_current_level client in let* () = Client.bake_for_and_wait ~keys:[baker] client in @@ -751,7 +774,8 @@ let update_consensus_key_no_reg ?(baker = Constant.bootstrap1.alias) client let test_revert_to_unique_consensus_key ?(baker = Constant.bootstrap1.alias) - ~(new_delegate : Account.key) ~(new_consensus_key : Account.key) client = + ~(new_delegate : Account.key) ~(new_consensus_key : Account.key) + ~(new_companion_key : Account.key) ~protocol client = (* Set a new consensus key *) Log.info "Transfer 1_000_000 tez from baker to new_delegate" ; let* () = @@ -767,7 +791,9 @@ let test_revert_to_unique_consensus_key ?(baker = Constant.bootstrap1.alias) register_key_as_delegate_no_reg ~owner:new_delegate ~consensus_key:new_consensus_key + ~companion_key:new_companion_key ~baker + ~protocol client in let* () = Client.bake_for_and_wait client in @@ -857,7 +883,7 @@ let register ~protocols = let () = register "Test set consensus key - baker is not delegate" - (fun client baker_0 baker_1 account_0 _account_1 -> + (fun _protocol client baker_0 baker_1 account_0 _account_1 _account_2 -> let baker_0_consensus_key = account_0 in let* () = test_consensus_key_update @@ -872,7 +898,7 @@ let register ~protocols = let () = register "Test set consensus key - baker is delegate" - (fun client baker_0 _baker_1 account_0 _account_1 -> + (fun _protocol client baker_0 _baker_1 account_0 _account_1 _account_2 -> let baker_0_consensus_key = account_0 in let* () = test_consensus_key_update @@ -887,13 +913,16 @@ let register ~protocols = let () = register "Test register with consensus key" - (fun client baker_0 _baker_1 account_0 account_1 -> + (fun protocol client baker_0 _baker_1 account_0 account_1 account_2 -> let new_delegate = account_0 in let new_consensus_key = account_1 in + let new_companion_key = account_2 in test_register_delegate_with_consensus_key ~baker:baker_0.alias ~new_delegate ~new_consensus_key + ~new_companion_key + ~protocol client) protocols in @@ -901,20 +930,23 @@ let register ~protocols = register "Test revert to unique consensus key" ~regression:false - (fun client baker_0 _baker_1 account_0 account_1 -> + (fun protocol client baker_0 _baker_1 account_0 account_1 account_2 -> let new_delegate = account_0 in let new_consensus_key = account_1 in + let new_companion_key = account_2 in test_revert_to_unique_consensus_key ~baker:baker_0.alias ~new_delegate ~new_consensus_key + ~new_companion_key + ~protocol client) protocols in let () = register "Test drain delegate with (baker = delegate & consensus = destination)" - (fun client baker_0 _baker_1 account_0 _account_1 -> + (fun _protocol client baker_0 _baker_1 account_0 _account_1 _account_2 -> let delegate = baker_0 in let consensus = account_0 in let destination = account_0 in @@ -929,7 +961,7 @@ let register ~protocols = let () = register "Test drain delegate with (baker = delegate & consensus <> destination)" - (fun client baker_0 _baker_1 account_0 account_1 -> + (fun _protocol client baker_0 _baker_1 account_0 account_1 _account_2 -> let delegate = baker_0 in let consensus = account_0 in let destination = account_1 in @@ -944,7 +976,7 @@ let register ~protocols = let () = register "Test drain delegate with (baker <> delegate & consensus = destination)" - (fun client baker_0 baker_1 account_0 _account_1 -> + (fun _protocol client baker_0 baker_1 account_0 _account_1 _account_2 -> let delegate = baker_0 in let consensus = account_0 in let destination = account_0 in @@ -959,7 +991,7 @@ let register ~protocols = let () = register "Test drain delegate with (baker <> delegate & consensus <> destination)" - (fun client baker_0 baker_1 account_0 account_1 -> + (fun _protocol client baker_0 baker_1 account_0 account_1 _account_2 -> let delegate = baker_0 in let consensus = account_0 in let destination = account_1 in 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 58266e525f61..28ef4e00157a 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 @@ -2,14 +2,16 @@ ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]' { "balance": "0", "counter": "1" } -./octez-client --wait none register key dummy_account_0 as delegate with consensus key dummy_account_1 +./octez-client --wait none register key dummy_account_0 as delegate with consensus key dummy_account_1 and companion key dummy_account_2 Node is bootstrapped. -Estimated gas: 172.789 units (will add 0 for safety) +Estimated gas: 178.751 units (will add 0 for safety) Estimated storage: no bytes added Estimated gas: 100 units (will add 0 for safety) Estimated storage: no bytes added Estimated gas: 100 units (will add 100 for safety) Estimated storage: no bytes added +Estimated gas: 1671.680 units (will add 100 for safety) +Estimated storage: no bytes added Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' NOT waiting for the operation to be included. @@ -21,7 +23,7 @@ This sequence of operations was run: From: [PUBLIC_KEY_HASH] Fee to the baker: ꜩ0.000275 Expected counter: 2 - Gas limit: 173 + Gas limit: 179 Storage limit: 0 bytes Balance updates: [PUBLIC_KEY_HASH] ... -ꜩ0.000275 @@ -30,7 +32,7 @@ This sequence of operations was run: Contract: [PUBLIC_KEY_HASH] Key: [PUBLIC_KEY] This revelation was successfully applied - Consumed gas: 172.557 + Consumed gas: 178.453 Manager signed operations: From: [PUBLIC_KEY_HASH] Fee to the baker: ꜩ0.000159 @@ -58,6 +60,20 @@ This sequence of operations was run: Public key hash: [PUBLIC_KEY_HASH] This consensus key update was successfully applied Consumed gas: 100 + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000456 + Expected counter: 5 + Gas limit: 1772 + Storage limit: 0 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000456 + payload fees(the block proposer) ....... +ꜩ0.000456 + Update_companion_key: + Public key hash: [PUBLIC_KEY_HASH] + Proof of possession: [BLS_SIGNATURE] + This companion key update was successfully applied + Consumed gas: 1671.680 ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' @@ -76,18 +92,18 @@ This sequence of operations was run: { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, "pending_staking_parameters": [], "baking_power": "0", "total_staked": "0", - "total_delegated": "999999999384", + "total_delegated": "999999998928", "min_delegated_in_current_cycle": - { "amount": "999999999384", + { "amount": "999999998928", "level": { "level": 3, "level_position": 2, "cycle": 0, "cycle_position": 2, "expected_commitment": false } }, - "own_full_balance": "999999999384", "own_staked": "0", - "own_delegated": "999999999384", "external_staked": "0", + "own_full_balance": "999999998928", "own_staked": "0", + "own_delegated": "999999998928", "external_staked": "0", "external_delegated": "0", "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" } ], "denunciations": [], "estimated_shared_pending_slashed_amount": "0", - "staking_denominator": "0", "current_voting_power": "999999999384", + "staking_denominator": "0", "current_voting_power": "999999998928", "voting_power": "0", "voting_info": {}, "consensus_key": { "active": @@ -96,11 +112,16 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } ] }, - "companion_key": { "active": null }, "stakers": [], - "delegators": [ "[PUBLIC_KEY_HASH]" ] } + "companion_key": + { "active": null, + "pendings": + [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", + "pk": + "BLpk1x5uxfAqDWG8YstPwCAYZfEwGHr5YbKWdFUi1NZQiueTqy825JbJsmwCDDcTWQ6LKmLkRHfn" } ] }, + "stakers": [], "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]' -{ "balance": "0", "counter": "4" } +{ "balance": "0", "counter": "5" } ./octez-client rpc get '/chains/main/blocks/head/context/delegates/[PUBLIC_KEY_HASH]' { "deactivated": false, "is_forbidden": false, @@ -117,26 +138,30 @@ This sequence of operations was run: "active_staking_parameters": { "limit_of_staking_over_baking_millionth": 0, "edge_of_baking_over_staking_billionth": 1000000000 }, - "pending_staking_parameters": [], "baking_power": "666666666253", - "total_staked": "500000000000", "total_delegated": "499999998761", + "pending_staking_parameters": [], "baking_power": "666666666101", + "total_staked": "500000000000", "total_delegated": "499999998305", "min_delegated_in_current_cycle": - { "amount": "499999998761", + { "amount": "499999998305", "level": { "level": 5, "level_position": 4, "cycle": 1, "cycle_position": 0, "expected_commitment": false } }, - "own_full_balance": "999999998761", "own_staked": "500000000000", - "own_delegated": "499999998761", "external_staked": "0", + "own_full_balance": "999999998305", "own_staked": "500000000000", + "own_delegated": "499999998305", "external_staked": "0", "external_delegated": "0", "total_unstaked_per_cycle": [ { "cycle": 0, "deposit": "0" }, { "cycle": 1, "deposit": "0" } ], "denunciations": [], "estimated_shared_pending_slashed_amount": "0", - "staking_denominator": "0", "current_voting_power": "999999998761", + "staking_denominator": "0", "current_voting_power": "999999998305", "voting_power": "0", "voting_info": {}, "consensus_key": { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": "[PUBLIC_KEY]" } }, - "companion_key": { "active": null }, + "companion_key": + { "active": + { "pkh": "[PUBLIC_KEY_HASH]", + "pk": + "BLpk1x5uxfAqDWG8YstPwCAYZfEwGHr5YbKWdFUi1NZQiueTqy825JbJsmwCDDcTWQ6LKmLkRHfn" } }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "500000000000" } ], -- GitLab From 8da6d7cc9b4b84794aa5c7ae9dd2011a0fe03747 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Tue, 20 May 2025 09:49:27 +0200 Subject: [PATCH 4/4] Tezt/tests: add BLS pk replacement hook --- tezt/tests/consensus_key.ml | 1 + .../Alpha- Test register with consensus key.out | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tezt/tests/consensus_key.ml b/tezt/tests/consensus_key.ml index c45a3d415dd9..9f304ac9fafe 100644 --- a/tezt/tests/consensus_key.ml +++ b/tezt/tests/consensus_key.ml @@ -38,6 +38,7 @@ let hooks = let replacements = ("edsig\\w{94}", "[SIGNATURE]") :: ("BLsig\\w{137}", "[BLS_SIGNATURE]") + :: ("BLpk\\w{72}", "[BLS_PUBLIC_KEY]") :: Tezos_regression.replacements in Tezos_regression.hooks_custom 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 28ef4e00157a..7c3cca390fb9 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 @@ -117,7 +117,7 @@ This sequence of operations was run: "pendings": [ { "cycle": 2, "pkh": "[PUBLIC_KEY_HASH]", "pk": - "BLpk1x5uxfAqDWG8YstPwCAYZfEwGHr5YbKWdFUi1NZQiueTqy825JbJsmwCDDcTWQ6LKmLkRHfn" } ] }, + "[BLS_PUBLIC_KEY]" } ] }, "stakers": [], "delegators": [ "[PUBLIC_KEY_HASH]" ] } ./octez-client rpc get '/chains/main/blocks/head/context/contracts/[PUBLIC_KEY_HASH]' @@ -161,7 +161,7 @@ This sequence of operations was run: { "active": { "pkh": "[PUBLIC_KEY_HASH]", "pk": - "BLpk1x5uxfAqDWG8YstPwCAYZfEwGHr5YbKWdFUi1NZQiueTqy825JbJsmwCDDcTWQ6LKmLkRHfn" } }, + "[BLS_PUBLIC_KEY]" } }, "stakers": [ { "staker": "[PUBLIC_KEY_HASH]", "frozen_deposits": "500000000000" } ], -- GitLab