From 39fad85b72c1a8e0660d68709942fa6ee8a7c780 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 19 Jun 2023 16:48:45 +0200 Subject: [PATCH 1/9] proto_alpha/lib_delegate: rename attestation in highwatermarks error --- .../lib_delegate/baking_actions.ml | 4 +-- .../lib_delegate/baking_highwatermarks.ml | 31 +++++++++---------- .../lib_delegate/baking_highwatermarks.mli | 4 +-- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/proto_alpha/lib_delegate/baking_actions.ml b/src/proto_alpha/lib_delegate/baking_actions.ml index 3a1e0c4e2cbd..e900271b7d60 100644 --- a/src/proto_alpha/lib_delegate/baking_actions.ml +++ b/src/proto_alpha/lib_delegate/baking_actions.ml @@ -434,7 +434,7 @@ let inject_preendorsements state ~preendorsements = in Client_keys.sign cctxt ~watermark sk_uri unsigned_operation_bytes else - fail (Baking_highwatermarks.Block_previously_preendorsed {round; level})) + fail (Baking_highwatermarks.Block_previously_preattested {round; level})) >>= function | Error err -> Events.(emit skipping_preendorsement (delegate, err)) >>= fun () -> @@ -514,7 +514,7 @@ let sign_endorsements state endorsements = unsigned_operation in Client_keys.sign cctxt ~watermark sk_uri unsigned_operation_bytes - else fail (Baking_highwatermarks.Block_previously_endorsed {round; level})) + else fail (Baking_highwatermarks.Block_previously_attested {round; level})) >>= function | Error err -> Events.(emit skipping_endorsement (delegate, err)) >>= fun () -> diff --git a/src/proto_alpha/lib_delegate/baking_highwatermarks.ml b/src/proto_alpha/lib_delegate/baking_highwatermarks.ml index 91b56b3e50b1..0691308a9071 100644 --- a/src/proto_alpha/lib_delegate/baking_highwatermarks.ml +++ b/src/proto_alpha/lib_delegate/baking_highwatermarks.ml @@ -42,9 +42,9 @@ let pp_highwatermark fmt {round; level} = type error += Block_previously_baked of highwatermark -type error += Block_previously_preendorsed of highwatermark +type error += Block_previously_preattested of highwatermark -type error += Block_previously_endorsed of highwatermark +type error += Block_previously_attested of highwatermark let () = register_error_kind @@ -65,39 +65,38 @@ let () = (fun highwatermark -> Block_previously_baked highwatermark) ; register_error_kind `Permanent - ~id:"highwatermarks.block_previously_preendorsed" - ~title:"Block previously preendorsed" - ~description: - "Trying to preendorse a block at a level previously preendorsed" + ~id:"highwatermarks.block_previously_preattested" + ~title:"Block previously preattested" + ~description:"Trying to preattest a block at a level previously preattested" ~pp:(fun ppf highwatermark -> Format.fprintf ppf - "A preendorsement with a higher watermark than the current one (%a) \ - was already produced." + "A preattestaion with a higher watermark than the current one (%a) was \ + already produced." pp_highwatermark highwatermark) highwatermark_encoding (function - | Block_previously_preendorsed highwatermark -> Some highwatermark + | Block_previously_preattested highwatermark -> Some highwatermark | _ -> None) - (fun highwatermark -> Block_previously_preendorsed highwatermark) ; + (fun highwatermark -> Block_previously_preattested highwatermark) ; register_error_kind `Permanent - ~id:"highwatermarks.block_previously_endorsed" - ~title:"Block previously endorsed" - ~description:"Trying to endorse a block at a level previously endorsed" + ~id:"highwatermarks.block_previously_attested" + ~title:"Block previously attested" + ~description:"Trying to attest a block at a level previously attested" ~pp:(fun ppf highwatermark -> Format.fprintf ppf - "An endorsement with a higher watermark than the current one (%a) was \ + "An attestation with a higher watermark than the current one (%a) was \ already produced." pp_highwatermark highwatermark) highwatermark_encoding (function - | Block_previously_endorsed highwatermark -> Some highwatermark + | Block_previously_attested highwatermark -> Some highwatermark | _ -> None) - (fun highwatermark -> Block_previously_endorsed highwatermark) + (fun highwatermark -> Block_previously_attested highwatermark) module DelegateMap = Map.Make (struct type t = Signature.Public_key_hash.t diff --git a/src/proto_alpha/lib_delegate/baking_highwatermarks.mli b/src/proto_alpha/lib_delegate/baking_highwatermarks.mli index 757b667c58bb..eca9165cdcca 100644 --- a/src/proto_alpha/lib_delegate/baking_highwatermarks.mli +++ b/src/proto_alpha/lib_delegate/baking_highwatermarks.mli @@ -29,9 +29,9 @@ type highwatermark = {round : Round.t; level : int32} type error += Block_previously_baked of highwatermark -type error += Block_previously_preendorsed of highwatermark +type error += Block_previously_preattested of highwatermark -type error += Block_previously_endorsed of highwatermark +type error += Block_previously_attested of highwatermark type t -- GitLab From 082af91045096bd330a614c8c8004c0189661119 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 19 Jun 2023 16:58:52 +0200 Subject: [PATCH 2/9] proto_alpha/lib_delegate: rename attestation in transition and lib events --- src/proto_alpha/lib_delegate/baking_events.ml | 24 +++++++++---------- src/proto_alpha/lib_delegate/baking_lib.ml | 4 ++-- .../lib_delegate/state_transitions.ml | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/proto_alpha/lib_delegate/baking_events.ml b/src/proto_alpha/lib_delegate/baking_events.ml index 3bc53556b7b7..790f71be2196 100644 --- a/src/proto_alpha/lib_delegate/baking_events.ml +++ b/src/proto_alpha/lib_delegate/baking_events.ml @@ -279,12 +279,12 @@ module State_transitions = struct ~msg:"different branch proposal has the same prequorum" () - let attempting_preendorse_proposal = + let attempting_preattest_proposal = declare_1 ~section - ~name:"attempting_preendorsing_proposal" + ~name:"attempting_preattest_proposal" ~level:Info - ~msg:"attempting to preendorse proposal {block_hash}" + ~msg:"attempting to preattest proposal {block_hash}" ~pp1:Block_hash.pp ("block_hash", Block_hash.encoding) @@ -316,12 +316,12 @@ module State_transitions = struct ~pp2:Round.pp ("round", Round.encoding) - let no_endorsable_payload_fresh_block = + let no_attestable_payload_fresh_block = declare_0 ~section - ~name:"no_endorsable_payload_fresh_block" + ~name:"no_attestable_payload_fresh_block" ~level:Info - ~msg:"no endorsable payload, proposing fresh block" + ~msg:"no attestable payload, proposing fresh block" () let repropose_block = @@ -545,21 +545,21 @@ module Lib = struct let section = section @ ["lib"] - let attempting_preendorse_proposal = + let attempting_preattest_proposal = declare_1 ~section - ~name:"attempting_preendorsing_proposal" + ~name:"attempting_preattest_proposal" ~level:Debug - ~msg:"attempting to preendorse proposal {proposal}" + ~msg:"attempting to preattest proposal {proposal}" ~pp1:Baking_state.pp_proposal ("proposal", Baking_state.proposal_encoding) - let attempting_endorse_proposal = + let attempting_attest_proposal = declare_1 ~section - ~name:"attempting_endorsing_proposal" + ~name:"attempting_attest_proposal" ~level:Debug - ~msg:"attempting to endorse proposal {proposal}" + ~msg:"attempting to attest proposal {proposal}" ~pp1:Baking_state.pp_proposal ("proposal", Baking_state.proposal_encoding) end diff --git a/src/proto_alpha/lib_delegate/baking_lib.ml b/src/proto_alpha/lib_delegate/baking_lib.ml index e646d82e62ff..3c943c884a13 100644 --- a/src/proto_alpha/lib_delegate/baking_lib.ml +++ b/src/proto_alpha/lib_delegate/baking_lib.ml @@ -66,7 +66,7 @@ let preendorse (cctxt : Protocol_client_context.full) ?(force = false) delegates let proposal = state.level_state.latest_proposal in let*! () = Events.( - emit attempting_preendorse_proposal state.level_state.latest_proposal) + emit attempting_preattest_proposal state.level_state.latest_proposal) in let* () = if force then return_unit @@ -98,7 +98,7 @@ let endorse (cctxt : Protocol_client_context.full) ?(force = false) delegates = create_state cctxt ~config ~current_proposal delegates >>=? fun state -> let proposal = state.level_state.latest_proposal in let*! () = - Events.(emit attempting_endorse_proposal state.level_state.latest_proposal) + Events.(emit attempting_attest_proposal state.level_state.latest_proposal) in let* () = if force then return_unit diff --git a/src/proto_alpha/lib_delegate/state_transitions.ml b/src/proto_alpha/lib_delegate/state_transitions.ml index 88df8e76f37c..f462710ba872 100644 --- a/src/proto_alpha/lib_delegate/state_transitions.ml +++ b/src/proto_alpha/lib_delegate/state_transitions.ml @@ -130,7 +130,7 @@ let preendorse state proposal = let new_state = update_current_phase state Idle in Lwt.return (new_state, Do_nothing) else - Events.(emit attempting_preendorse_proposal proposal.block.hash) + Events.(emit attempting_preattest_proposal proposal.block.hash) >>= fun () -> let new_state = (* We await for the block to be applied before updating its @@ -510,7 +510,7 @@ let propose_block_action state delegate round (proposal : proposal) = may be older. *) match state.level_state.endorsable_payload with | None -> - Events.(emit no_endorsable_payload_fresh_block ()) >>= fun () -> + Events.(emit no_attestable_payload_fresh_block ()) >>= fun () -> (* For case 1, we may re-inject with the same payload or a fresh one. We make the choice of baking a fresh one: the previous proposal may have been rejected because the block may have been -- GitLab From 14d547ef6b8cc58a04ca84ed137a7e9df69c996b Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 19 Jun 2023 17:07:15 +0200 Subject: [PATCH 3/9] proto_alpha/lib_delegate: rename attestation in actions events --- .../lib_delegate/baking_actions.ml | 24 ++++---- src/proto_alpha/lib_delegate/baking_events.ml | 61 ++++++++++--------- 2 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/proto_alpha/lib_delegate/baking_actions.ml b/src/proto_alpha/lib_delegate/baking_actions.ml index e900271b7d60..2430fb0ab971 100644 --- a/src/proto_alpha/lib_delegate/baking_actions.ml +++ b/src/proto_alpha/lib_delegate/baking_actions.ml @@ -155,8 +155,8 @@ type t = action let pp_action fmt = function | Do_nothing -> Format.fprintf fmt "do nothing" | Inject_block _ -> Format.fprintf fmt "inject block" - | Inject_preendorsements _ -> Format.fprintf fmt "inject preendorsements" - | Inject_endorsements _ -> Format.fprintf fmt "inject endorsements" + | Inject_preendorsements _ -> Format.fprintf fmt "inject preattestations" + | Inject_endorsements _ -> Format.fprintf fmt "inject attestations" | Update_to_level _ -> Format.fprintf fmt "update to level" | Synchronize_round _ -> Format.fprintf fmt "synchronize round" | Watch_proposal -> Format.fprintf fmt "watch proposal" @@ -394,7 +394,7 @@ let inject_preendorsements state ~preendorsements = in List.filter_map_es (fun (((consensus_key, _) as delegate), consensus_content) -> - Events.(emit signing_preendorsement delegate) >>= fun () -> + Events.(emit signing_preattestation delegate) >>= fun () -> let shell = (* The branch is the latest finalized block. *) { @@ -437,7 +437,7 @@ let inject_preendorsements state ~preendorsements = fail (Baking_highwatermarks.Block_previously_preattested {round; level})) >>= function | Error err -> - Events.(emit skipping_preendorsement (delegate, err)) >>= fun () -> + Events.(emit skipping_preattestation (delegate, err)) >>= fun () -> return_none | Ok signature -> let protocol_data = @@ -452,12 +452,12 @@ let inject_preendorsements state ~preendorsements = (fun (delegate, operation, level, round) -> protect ~on_error:(fun err -> - Events.(emit failed_to_inject_preendorsement (delegate, err)) + Events.(emit failed_to_inject_preattestation (delegate, err)) >>= fun () -> return_unit) (fun () -> Node_rpc.inject_operation cctxt ~chain:(`Hash chain_id) operation >>=? fun oph -> - Events.(emit preendorsement_injected (oph, delegate, level, round)) + Events.(emit preattestation_injected (oph, delegate, level, round)) >>= fun () -> return_unit)) signed_operations @@ -472,7 +472,7 @@ let sign_endorsements state endorsements = in List.filter_map_es (fun (((consensus_key, _) as delegate), consensus_content) -> - Events.(emit signing_endorsement delegate) >>= fun () -> + Events.(emit signing_attestation delegate) >>= fun () -> let shell = (* The branch is the latest finalized block. *) { @@ -517,7 +517,7 @@ let sign_endorsements state endorsements = else fail (Baking_highwatermarks.Block_previously_attested {round; level})) >>= function | Error err -> - Events.(emit skipping_endorsement (delegate, err)) >>= fun () -> + Events.(emit skipping_attestation (delegate, err)) >>= fun () -> return_none | Ok signature -> let protocol_data = @@ -556,7 +556,7 @@ let sign_dal_attestations state attestations = unsigned_operation_bytes >>= function | Error err -> - Events.(emit skipping_attestation (delegate, err)) >>= fun () -> + Events.(emit skipping_dal_attestation (delegate, err)) >>= fun () -> return_none | Ok signature -> let protocol_data = @@ -576,12 +576,12 @@ let inject_endorsements state ~endorsements = (fun (delegate, operation, level, round) -> protect ~on_error:(fun err -> - Events.(emit failed_to_inject_endorsement (delegate, err)) + Events.(emit failed_to_inject_attestation (delegate, err)) >>= fun () -> return_unit) (fun () -> Node_rpc.inject_operation cctxt ~chain:(`Hash chain_id) operation >>=? fun oph -> - Events.(emit endorsement_injected (oph, delegate, level, round)) + Events.(emit attestation_injected (oph, delegate, level, round)) >>= fun () -> return_unit)) signed_operations @@ -602,7 +602,7 @@ let inject_dal_attestations state attestations = encoded_op >>=? fun oph -> let bitset_int = Bitset.to_z (attestation :> Bitset.t) in - Events.(emit attestation_injected (oph, delegate, bitset_int)) + Events.(emit dal_attestation_injected (oph, delegate, bitset_int)) >>= fun () -> return_unit) signed_operations diff --git a/src/proto_alpha/lib_delegate/baking_events.ml b/src/proto_alpha/lib_delegate/baking_events.ml index 790f71be2196..393dec0eb44a 100644 --- a/src/proto_alpha/lib_delegate/baking_events.ml +++ b/src/proto_alpha/lib_delegate/baking_events.ml @@ -569,56 +569,56 @@ module Actions = struct let section = section @ ["actions"] - let skipping_preendorsement = + let skipping_preattestation = declare_2 ~section - ~name:"skipping_preendorsement" + ~name:"skipping_preattestation" ~level:Error - ~msg:"unable to sign preendorsement for {delegate} -- {trace}" + ~msg:"unable to sign preattestation for {delegate} -- {trace}" ~pp1:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) ~pp2:Error_monad.pp_print_trace ("trace", Error_monad.trace_encoding) - let skipping_endorsement = + let skipping_attestation = declare_2 ~section - ~name:"skipping_endorsement" + ~name:"skipping_attestation" ~level:Error - ~msg:"unable to sign endorsement for {delegate} -- {trace}" + ~msg:"unable to sign attestation for {delegate} -- {trace}" ~pp1:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) ~pp2:Error_monad.pp_print_trace ("trace", Error_monad.trace_encoding) - let skipping_attestation = + let skipping_dal_attestation = declare_2 ~section - ~name:"skipping_attestation" + ~name:"skipping_dal_attestation" ~level:Error - ~msg:"unable to sign attestation for {delegate} -- {trace}" + ~msg:"unable to sign dal attestation for {delegate} -- {trace}" ~pp1:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) ~pp2:Error_monad.pp_print_trace ("trace", Error_monad.trace_encoding) - let failed_to_inject_preendorsement = + let failed_to_inject_preattestation = declare_2 ~section - ~name:"failed_to_inject_preendorsement" + ~name:"failed_to_inject_preattestation" ~level:Error - ~msg:"failed to inject preendorsement for {delegate} -- {trace}" + ~msg:"failed to inject preattestation for {delegate} -- {trace}" ~pp1:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) ~pp2:Error_monad.pp_print_trace ("trace", Error_monad.trace_encoding) - let failed_to_inject_endorsement = + let failed_to_inject_attestation = declare_2 ~section - ~name:"failed_to_inject_endorsement" + ~name:"failed_to_inject_attestation" ~level:Error - ~msg:"failed to inject endorsement for {delegate} -- {trace}" + ~msg:"failed to inject attestation for {delegate} -- {trace}" ~pp1:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) ~pp2:Error_monad.pp_print_trace @@ -635,13 +635,13 @@ module Actions = struct ("level", Data_encoding.int32) ("round", Round.encoding) - let preendorsement_injected = + let preattestation_injected = declare_4 ~section - ~name:"preendorsement_injected" + ~name:"preattestation_injected" ~level:Notice ~msg: - "injected preendorsement {ophash} for {delegate} for level {level}, \ + "injected preattestation {ophash} for {delegate} for level {level}, \ round {round}" ~pp1:Operation_hash.pp ("ophash", Operation_hash.encoding) @@ -652,13 +652,13 @@ module Actions = struct ~pp4:Round.pp ("round", Round.encoding) - let endorsement_injected = + let attestation_injected = declare_4 ~section - ~name:"endorsement_injected" + ~name:"attestation_injected" ~level:Notice ~msg: - "injected endorsement {ophash} for {delegate} for level {level}, round \ + "injected attestation {ophash} for {delegate} for level {level}, round \ {round}" ~pp1:Operation_hash.pp ("ophash", Operation_hash.encoding) @@ -669,12 +669,13 @@ module Actions = struct ~pp4:Round.pp ("round", Round.encoding) - let attestation_injected = + let dal_attestation_injected = declare_3 ~section - ~name:"attestation_injected" + ~name:"dal_attestation_injected" ~level:Notice - ~msg:"injected attestation {ophash} with bitset {bitset} for {delegate}" + ~msg: + "injected dal attestation {ophash} with bitset {bitset} for {delegate}" ~pp1:Operation_hash.pp ("ophash", Operation_hash.encoding) ~pp2:Baking_state.pp_consensus_key_and_delegate @@ -747,21 +748,21 @@ module Actions = struct ("round", Round.encoding) ("delegate", Baking_state.consensus_key_and_delegate_encoding) - let signing_preendorsement = + let signing_preattestation = declare_1 ~section - ~name:"signing_preendorsement" + ~name:"signing_preattestation" ~level:Info - ~msg:"signing preendorsement for {delegate}" + ~msg:"signing preattestation for {delegate}" ~pp1:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) - let signing_endorsement = + let signing_attestation = declare_1 ~section - ~name:"signing_endorsement" + ~name:"signing_attestation" ~level:Info - ~msg:"signing endorsement for {delegate}" + ~msg:"signing attestation for {delegate}" ~pp1:Baking_state.pp_consensus_key_and_delegate ("delegate", Baking_state.consensus_key_and_delegate_encoding) -- GitLab From 5b4d5b222f77a0deba7ef4b069ee68459db14004 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Tue, 20 Jun 2023 16:54:43 +0200 Subject: [PATCH 4/9] proto_alpha/lib_delegate: rename attestation in operation_worker events --- .../lib_delegate/operation_worker.ml | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/proto_alpha/lib_delegate/operation_worker.ml b/src/proto_alpha/lib_delegate/operation_worker.ml index 24a90fc0abbe..e4c53d7e28b9 100644 --- a/src/proto_alpha/lib_delegate/operation_worker.ml +++ b/src/proto_alpha/lib_delegate/operation_worker.ml @@ -57,21 +57,21 @@ module Events = struct ~name:"pqc_reached" ~level:Debug ~msg: - "prequorum reached (voting power: {voting_power}, {preendorsements} \ - preendorsements)" + "prequorum reached (voting power: {voting_power}, {preattestations} \ + preattestations)" ~pp1:pp_int ("voting_power", Data_encoding.int31) ~pp2:pp_int - ("preendorsements", Data_encoding.int31) + ("preattestations", Data_encoding.int31) - let preendorsements_received = + let preattestations_received = declare_4 ~section - ~name:"preendorsements_received" + ~name:"preattestations_received" ~level:Debug ~msg: - "received {count} preendorsements (power: {delta_power}) (total voting \ - power: {voting_power}, {preendorsements} preendorsements)" + "received {count} preattestations (power: {delta_power}) (total voting \ + power: {voting_power}, {preattestations} preattestations)" ~pp1:pp_int ("count", Data_encoding.int31) ~pp2:pp_int @@ -79,7 +79,7 @@ module Events = struct ~pp3:pp_int ("voting_power", Data_encoding.int31) ~pp4:pp_int - ("preendorsements", Data_encoding.int31) + ("preattestations", Data_encoding.int31) let qc_reached = declare_2 @@ -87,21 +87,21 @@ module Events = struct ~name:"qc_reached" ~level:Debug ~msg: - "quorum reached (voting power: {voting_power}, {endorsements} \ - endorsements)" + "quorum reached (voting power: {voting_power}, {attestations} \ + attestations)" ~pp1:pp_int ("voting_power", Data_encoding.int31) ~pp2:pp_int - ("endorsements", Data_encoding.int31) + ("attestations", Data_encoding.int31) - let endorsements_received = + let attestations_received = declare_4 ~section - ~name:"endorsements_received" + ~name:"attestations_received" ~level:Debug ~msg: - "received {count} endorsements (power: {delta_power}) (total voting \ - power: {voting_power}, {endorsements} endorsements)" + "received {count} attestations (power: {delta_power}) (total voting \ + power: {voting_power}, {attestations} attestations)" ~pp1:pp_int ("count", Data_encoding.int31) ~pp2:pp_int @@ -109,7 +109,7 @@ module Events = struct ~pp3:pp_int ("voting_power", Data_encoding.int31) ~pp4:pp_int - ("endorsements", Data_encoding.int31) + ("attestations", Data_encoding.int31) let starting_new_monitoring = declare_0 @@ -364,7 +364,7 @@ let update_monitoring ?(should_lock = true) state ops = else Events.( emit - preendorsements_received + preattestations_received ( preendorsements_count, voting_power, proposal_watched.current_voting_power, @@ -436,7 +436,7 @@ let update_monitoring ?(should_lock = true) state ops = else Events.( emit - endorsements_received + attestations_received ( endorsements_count, voting_power, proposal_watched.current_voting_power, -- GitLab From 29a0b258d3b6eb5e42d3400db224d8a1eaf31883 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 19 Jun 2023 17:26:18 +0200 Subject: [PATCH 5/9] proto_alpha/lib_delegate: rename attestation inf baking lib event and errors --- src/proto_alpha/lib_delegate/baking_lib.ml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/proto_alpha/lib_delegate/baking_lib.ml b/src/proto_alpha/lib_delegate/baking_lib.ml index 3c943c884a13..2677f6cf8fd9 100644 --- a/src/proto_alpha/lib_delegate/baking_lib.ml +++ b/src/proto_alpha/lib_delegate/baking_lib.ml @@ -72,15 +72,14 @@ let preendorse (cctxt : Protocol_client_context.full) ?(force = false) delegates if force then return_unit else is_acceptable_proposal_for_current_level state proposal >>= function - | Invalid -> cctxt#error "Cannot preendorse an invalid proposal" - | Outdated_proposal -> - cctxt#error "Cannot preendorse an outdated proposal" + | Invalid -> cctxt#error "Cannot preattest an invalid proposal" + | Outdated_proposal -> cctxt#error "Cannot preattest an outdated proposal" | Valid_proposal -> return_unit in let consensus_list = make_consensus_list state proposal in let*! () = cctxt#message - "@[Preendorsing for:@ %a@]" + "@[Preattesting for:@ %a@]" Format.( pp_print_list ~pp_sep:pp_print_space @@ -104,14 +103,14 @@ let endorse (cctxt : Protocol_client_context.full) ?(force = false) delegates = if force then return_unit else is_acceptable_proposal_for_current_level state proposal >>= function - | Invalid -> cctxt#error "Cannot endorse an invalid proposal" - | Outdated_proposal -> cctxt#error "Cannot endorse an outdated proposal" + | Invalid -> cctxt#error "Cannot attest an invalid proposal" + | Outdated_proposal -> cctxt#error "Cannot attest an outdated proposal" | Valid_proposal -> return_unit in let consensus_list = make_consensus_list state proposal in let*! () = cctxt#message - "@[Endorsing for:@ %a@]" + "@[Attesting for:@ %a@]" Format.( pp_print_list ~pp_sep:pp_print_space -- GitLab From aee102eb8ae25d01d375d08c6fbdac15fc3f8f8d Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 19 Jun 2023 17:36:19 +0200 Subject: [PATCH 6/9] proto_alpha/lib_delegate: rename attestation in logging --- src/proto_alpha/lib_delegate/logging.ml | 28 ++++++++++++------------ src/proto_alpha/lib_delegate/logging.mli | 10 ++++----- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/proto_alpha/lib_delegate/logging.ml b/src/proto_alpha/lib_delegate/logging.ml index ed9cb18c9db3..e948fe0fc7bb 100644 --- a/src/proto_alpha/lib_delegate/logging.ml +++ b/src/proto_alpha/lib_delegate/logging.ml @@ -89,19 +89,19 @@ let raw_operations_tag = let bake_op_count_tag = Tag.def ~doc:"Bake Operation Count" "operation_count" Format.pp_print_int -let endorsement_slot_tag = - Tag.def ~doc:"Endorsement Slot" "endorsement_slot" Format.pp_print_int +let attestation_slot_tag = + Tag.def ~doc:"Attestation Slot" "attestation_slot" Format.pp_print_int -let endorsement_slots_tag = +let attestation_slots_tag = Tag.def - ~doc:"Endorsement Slots" - "endorsement_slots" + ~doc:"Attestation Slots" + "attestation_slots" Format.(fun ppf v -> pp_print_int ppf (List.length v)) -let denounced_endorsements_slots_tag = +let denounced_attestations_slots_tag = Tag.def - ~doc:"Endorsement Slots" - "denounced_endorsement_slots" + ~doc:"Attestation Slots" + "denounced_attestation_slots" Format.(pp_print_list pp_print_int) let denouncement_source_tag = @@ -138,10 +138,10 @@ let block_header_tag = Tag.def ~doc:"Raw block header" "block_header" (fun ppf _ -> Format.fprintf ppf "[raw block header]") -let conflicting_endorsements_tag = +let conflicting_attestations_tag = Tag.def - ~doc:"Two conflicting endorsements signed by the same key" - "conflicting_endorsements" + ~doc:"Two conflicting attestations signed by the same key" + "conflicting_attestations" Format.( fun ppf (a, b) -> fprintf @@ -152,10 +152,10 @@ let conflicting_endorsements_tag = Operation_hash.pp (Operation.hash b)) -let conflicting_preendorsements_tag = +let conflicting_preattestations_tag = Tag.def - ~doc:"Two conflicting preendorsements signed by the same key" - "conflicting_preendorsements" + ~doc:"Two conflicting preattestations signed by the same key" + "conflicting_preattestations" Format.( fun ppf (a, b) -> fprintf diff --git a/src/proto_alpha/lib_delegate/logging.mli b/src/proto_alpha/lib_delegate/logging.mli index 5e10680ae612..b1753fbe8cb0 100644 --- a/src/proto_alpha/lib_delegate/logging.mli +++ b/src/proto_alpha/lib_delegate/logging.mli @@ -56,11 +56,11 @@ val raw_operations_tag : Operation.raw list Tag.def val bake_op_count_tag : int Tag.def -val endorsement_slot_tag : int Tag.def +val attestation_slot_tag : int Tag.def -val endorsement_slots_tag : int list Tag.def +val attestation_slots_tag : int list Tag.def -val denounced_endorsements_slots_tag : int list Tag.def +val denounced_attestations_slots_tag : int list Tag.def val denouncement_source_tag : string Tag.def @@ -76,8 +76,8 @@ val worker_tag : string Tag.def val block_header_tag : Block_header.t Tag.def -val conflicting_endorsements_tag : +val conflicting_attestations_tag : (Kind.endorsement operation * Kind.endorsement operation) Tag.def -val conflicting_preendorsements_tag : +val conflicting_preattestations_tag : (Kind.preendorsement operation * Kind.preendorsement operation) Tag.def -- GitLab From 85bcdf9f1f5826d240de5bd7801819d1b41aaba2 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Tue, 20 Jun 2023 17:00:57 +0200 Subject: [PATCH 7/9] proto_alpha/lib_delegate: rename attestation in baking state encoding and pretty printing --- src/proto_alpha/lib_delegate/baking_state.ml | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/proto_alpha/lib_delegate/baking_state.ml b/src/proto_alpha/lib_delegate/baking_state.ml index e846d9097f7e..3009cb53ba40 100644 --- a/src/proto_alpha/lib_delegate/baking_state.ml +++ b/src/proto_alpha/lib_delegate/baking_state.ml @@ -158,7 +158,7 @@ let prequorum_encoding = (req "round" Round.encoding) (req "block_payload_hash" Block_payload_hash.encoding) (req - "preendorsements" + "attestations" (list (dynamic_size Operation.encoding_with_legacy_attestation_name)))) let block_info_encoding = @@ -324,9 +324,9 @@ let phase_encoding = (function Idle -> Some () | _ -> None) (fun () -> Idle); case - ~title:"Awaiting_preendorsements" + ~title:"Awaiting_preattestations" (Tag 1) - (constant "Awaiting_preendorsements") + (constant "Awaiting_preattestations") (function Awaiting_preendorsements -> Some () | _ -> None) (fun () -> Awaiting_preendorsements); case @@ -336,9 +336,9 @@ let phase_encoding = (function Awaiting_application -> Some () | _ -> None) (fun () -> Awaiting_application); case - ~title:"Awaiting_endorsements" + ~title:"Awaiting_attestationss" (Tag 3) - (constant "Awaiting_endorsements") + (constant "Awaiting_attestationss") (function Awaiting_endorsements -> Some () | _ -> None) (fun () -> Awaiting_endorsements); ] @@ -484,7 +484,7 @@ let state_data_encoding = (obj3 (req "level" int32) (req "locked_round" (option locked_round_encoding)) - (req "endorsable_payload" (option endorsable_payload_encoding))) + (req "attestable_payload" (option endorsable_payload_encoding))) let record_state (state : state) = let cctxt = state.global_state.cctxt in @@ -732,7 +732,7 @@ let pp_option pp fmt = function let pp_prequorum fmt {level; round; block_payload_hash; preendorsements} = Format.fprintf fmt - "level: %ld, round: %a, payload_hash: %a, preendorsements: %d" + "level: %ld, round: %a, payload_hash: %a, preattestations: %d" level Round.pp round @@ -755,7 +755,7 @@ let pp_block_info fmt Format.fprintf fmt "@[Block:@ hash: %a@ payload_hash: %a@ level: %ld@ round: %a@ \ - prequorum: %a@ quorum: %d endorsements@ dal_attestations: %d@ payload: \ + prequorum: %a@ quorum: %d attestations@ dal_attestations: %d@ payload: \ %a@ payload round: %a@]" Block_hash.pp hash @@ -796,7 +796,7 @@ let pp_endorsable_payload fmt {proposal; prequorum} = let pp_elected_block fmt {proposal; endorsement_qc} = Format.fprintf fmt - "@[%a@ nb quorum endorsements: %d@]" + "@[%a@ nb quorum attestations: %d@]" pp_block_info proposal.block (List.length endorsement_qc) @@ -805,7 +805,7 @@ let pp_endorsing_slot fmt (consensus_key_and_delegate, {first_slot; endorsing_power}) = Format.fprintf fmt - "slots: @[first_slot: %a@],@ delegate: %a,@ endorsing_power: %d" + "slots: @[first_slot: %a@],@ delegate: %a,@ attestation_power: %d" Slot.pp first_slot pp_consensus_key_and_delegate @@ -842,7 +842,7 @@ let pp_level_state fmt Format.fprintf fmt "@[Level state:@ current level: %ld@ @[proposal (applied:%b):@ \ - %a@]@ locked round: %a@ endorsable payload: %a@ elected block: %a@ @[own delegate slots:@ %a@]@ @[next level own delegate slots:@ %a@]@ \ next level proposed round: %a@]" current_level @@ -864,9 +864,9 @@ let pp_level_state fmt let pp_phase fmt = function | Idle -> Format.fprintf fmt "idle" - | Awaiting_preendorsements -> Format.fprintf fmt "awaiting preendorsements" + | Awaiting_preendorsements -> Format.fprintf fmt "awaiting preattestations" | Awaiting_application -> Format.fprintf fmt "awaiting application" - | Awaiting_endorsements -> Format.fprintf fmt "awaiting endorsements" + | Awaiting_endorsements -> Format.fprintf fmt "awaiting attestations" let pp_round_state fmt {current_round; current_phase; delayed_prequorum} = Format.fprintf @@ -911,7 +911,7 @@ let pp_event fmt = function | Prequorum_reached (candidate, preendos) -> Format.fprintf fmt - "prequorum reached with %d preendorsements for %a at round %a" + "prequorum reached with %d preattestations for %a at round %a" (List.length preendos) Block_hash.pp candidate.Operation_worker.hash @@ -920,7 +920,7 @@ let pp_event fmt = function | Quorum_reached (candidate, endos) -> Format.fprintf fmt - "quorum reached with %d endorsements for %a at round %a" + "quorum reached with %d attestations for %a at round %a" (List.length endos) Block_hash.pp candidate.Operation_worker.hash -- GitLab From a8f428002855ce87533e1b6e0e4989c684fb5737 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Wed, 21 Jun 2023 10:37:50 +0200 Subject: [PATCH 8/9] tezt/manual_test: fix baker_test.ml --- tezt/manual_tests/baker_test.ml | 136 ++++++++++++++++---------------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/tezt/manual_tests/baker_test.ml b/tezt/manual_tests/baker_test.ml index 00fa446f4d1c..07930b6b6235 100644 --- a/tezt/manual_tests/baker_test.ml +++ b/tezt/manual_tests/baker_test.ml @@ -56,8 +56,8 @@ type status = { validated : (string * bool) option; applied : string option; expected_consensus_ops : int; - endorsements : String_set.t; - preendorsements : String_set.t; + attestations : String_set.t; + preattestations : String_set.t; } let init_status expected_consensus_ops = @@ -65,8 +65,8 @@ let init_status expected_consensus_ops = validated = None; applied = None; expected_consensus_ops; - endorsements = String_set.empty; - preendorsements = String_set.empty; + attestations = String_set.empty; + preattestations = String_set.empty; } (* This function only returns when all operations have been processed by the @@ -102,15 +102,15 @@ let check_ophs_in_mempool ~applied ophs (mempool : Mempool.t) = "Not all expected operations are classified as %s in the mempool" (if applied then "applied" else "branch_delayed")) -(* This test checks that the baker can start to pre-endorse a proposal before - the block application finishes in the node. On Mumbai, pre-endorsement should +(* This test checks that the baker can start to pre-attest a proposal before + the block application finishes in the node. On Mumbai, pre-attestation should not be propagated and PQC should not be reached before the block application. *) -let baker_early_preendorsement_test = +let baker_early_preattestation_test = Protocol.register_test ~__FILE__ - ~title:"Test baker early pre-endorsement" - ~tags:["node"; "baker"; "early"; "preendorsement"] + ~title:"Test baker early pre-attestation" + ~tags:["node"; "baker"; "early"; "preattestation"] ~supports:(Protocol.From_protocol 16) @@ fun protocol -> Log.info @@ -224,12 +224,12 @@ let baker_early_preendorsement_test = in return @@ List.filter_map - (fun endorsing_right -> - let round = JSON.(endorsing_right |-> "round" |> as_int) in + (fun attestation_right -> + let round = JSON.(attestation_right |-> "round" |> as_int) in if round > max_round then None else let key = - JSON.(endorsing_right |-> "consensus_key" |> as_string) + JSON.(attestation_right |-> "consensus_key" |> as_string) in List.find_map (fun (bootstrap : Account.key) -> @@ -352,7 +352,7 @@ let baker_early_preendorsement_test = let* () = baker_t in let baker_on_event ?(log = false) (status : status ref) - preendorsements_resolver pqc_resolver endorsements_resolver + preattestations_resolver pqc_resolver attestations_resolver Baker.{name; value; timestamp = _} = match name with | "new_valid_proposal.v0" -> @@ -367,47 +367,47 @@ let baker_early_preendorsement_test = Option.map (fun v -> (fst v, true)) !status.validated in status := {!status with validated} - | "preendorsement_injected.v0" -> ( + | "preattestation_injected.v0" | "preendorsement_injected.v0" -> ( match (!status.validated, !status.applied) with | Some (_, false), Some _ -> failwith - "Pre-endorsement should be injected before application of the \ + "Pre-attestation should be injected before application of the \ block" | Some (_, false), None -> status := { !status with - preendorsements = + preattestations = String_set.add JSON.(value |-> "ophash" |> as_string) - !status.preendorsements; + !status.preattestations; } ; if - String_set.cardinal !status.preendorsements + String_set.cardinal !status.preattestations = !status.expected_consensus_ops - then Lwt.wakeup preendorsements_resolver () + then Lwt.wakeup preattestations_resolver () | None, _ | Some (_, true), _ -> - () (* Only pre-endorsement for the wanted proposal are recorded *)) - | "endorsement_injected.v0" -> ( + () (* Only pre-attestation for the wanted proposal are recorded *)) + | "attestation_injected.v0" | "endorsement_injected.v0" -> ( match (!status.validated, !status.applied) with | Some (_, false), None -> failwith - "Endorsement can only be injected once the block is applied" + "Attestation can only be injected once the block is applied" | Some (b1, false), Some b2 when String.equal b1 b2 -> status := { !status with - endorsements = + attestations = String_set.add JSON.(value |-> "ophash" |> as_string) - !status.endorsements; + !status.attestations; } ; if - String_set.cardinal !status.endorsements + String_set.cardinal !status.attestations = !status.expected_consensus_ops - then Lwt.wakeup endorsements_resolver () + then Lwt.wakeup attestations_resolver () | None, _ | Some (_, true), _ | Some (_, false), Some _ -> - () (* Only endorsement for the wanted proposal are recorded *)) + () (* Only attestation for the wanted proposal are recorded *)) | "pqc_while_waiting_for_application.v0" -> ( (* This will never be reached on Mumbai *) match (!status.validated, !status.applied) with @@ -438,22 +438,22 @@ let baker_early_preendorsement_test = (* Watch the baker events until the new block is applied and consensus operations from their delegates are injected in the node *) let status1 = ref (init_status 3) in - let preendorsement_t1, preendorsement_u1 = Lwt.task () in + let preattestation_t1, preattestation_u1 = Lwt.task () in let pqc_t1, pqc_u1 = Lwt.task () in - let endorsements_t1, endorsements_u1 = Lwt.task () in + let attestations_t1, attestations_u1 = Lwt.task () in Baker.on_event baker1 - (baker_on_event ~log:true status1 preendorsement_u1 pqc_u1 endorsements_u1) ; + (baker_on_event ~log:true status1 preattestation_u1 pqc_u1 attestations_u1) ; (* Watch the baker events until the new block is applied and consensus operations from their delegates are injected in the node *) let status2 = ref (init_status 2) in - let preendorsement_t2, preendorsement_u2 = Lwt.task () in + let preattestation_t2, preattestation_u2 = Lwt.task () in let pqc_t2, pqc_u2 = Lwt.task () in - let endorsements_t2, endorsements_u2 = Lwt.task () in + let attestations_t2, attestations_u2 = Lwt.task () in Baker.on_event baker2 - (baker_on_event status2 preendorsement_u2 pqc_u2 endorsements_u2) ; + (baker_on_event status2 preattestation_u2 pqc_u2 attestations_u2) ; Log.info "Continue %s and wait for it to propose a block at level:%d that contains \ @@ -462,74 +462,74 @@ let baker_early_preendorsement_test = test_lvl ; let* _baker = Baker.continue baker1 in - let preendorsement_should_be_applied = Protocol.(number protocol > 16) in + let preattestation_should_be_applied = Protocol.(number protocol > 16) in - (* Wait for the pre-endorsements to be included and for the pqc to be reached + (* Wait for the pre-attestations to be included and for the pqc to be reached before application *) - let get_preendorsement_mempool = + let get_preattestation_mempool = get_mempool - ~applied:preendorsement_should_be_applied - ~branch_delayed:(not preendorsement_should_be_applied) + ~applied:preattestation_should_be_applied + ~branch_delayed:(not preattestation_should_be_applied) in - let* () = if preendorsement_should_be_applied then pqc_t1 else unit - and* () = preendorsement_t1 in - let* mempool1 = get_preendorsement_mempool client1 in + let* () = if preattestation_should_be_applied then pqc_t1 else unit + and* () = preattestation_t1 in + let* mempool1 = get_preattestation_mempool client1 in - let* () = if preendorsement_should_be_applied then pqc_t2 else unit - and* () = preendorsement_t2 in - let* mempool2 = get_preendorsement_mempool client2 in + let* () = if preattestation_should_be_applied then pqc_t2 else unit + and* () = preattestation_t2 in + let* mempool2 = get_preattestation_mempool client2 in Log.info - "%s have proposed, both baker have pre-endorsed for their delegates%s" + "%s have proposed, both baker have pre-attested for their delegates%s" (Baker.name baker1) - (if preendorsement_should_be_applied then - " and the pqc is reached. Ensure that the pre-endorsements are injected \ + (if preattestation_should_be_applied then + " and the pqc is reached. Ensure that the pre-attestations are injected \ in the nodes as applied operation" else - ". Ensure that the pre-endorsements are injected in the nodes as \ + ". Ensure that the pre-attestations are injected in the nodes as \ branch_delayed operation") ; - let expected_preendorsements status_a status_b = + let expected_preattestations status_a status_b = List.of_seq @@ - if preendorsement_should_be_applied then + if preattestation_should_be_applied then String_set.to_seq - (String_set.union !status_a.preendorsements !status_b.preendorsements) - else String_set.to_seq !status_a.preendorsements + (String_set.union !status_a.preattestations !status_b.preattestations) + else String_set.to_seq !status_a.preattestations in check_ophs_in_mempool - ~applied:preendorsement_should_be_applied - (expected_preendorsements status1 status2) + ~applied:preattestation_should_be_applied + (expected_preattestations status1 status2) mempool1 ; check_ophs_in_mempool - ~applied:preendorsement_should_be_applied - (expected_preendorsements status2 status1) + ~applied:preattestation_should_be_applied + (expected_preattestations status2 status1) mempool2 ; Log.info - "Wait for the block to be applied by the nodes and wait for them to \ - endorse it." ; - (* Wait for the endorsements to be included *) - let* () = endorsements_t1 in + "Wait for the block to be applied by the nodes and wait for them to attest \ + it." ; + (* Wait for the attestations to be included *) + let* () = attestations_t1 in let* mempool1 = get_mempool ~applied:true ~branch_delayed:false client1 in - let* () = endorsements_t2 in + let* () = attestations_t2 in let* mempool2 = get_mempool ~applied:true ~branch_delayed:false client2 in Log.info - "Ensure that the endorsements as well as the pre-endorsements are applied \ + "Ensure that the attestations as well as the pre-attestations are applied \ in the mempools" ; check_ophs_in_mempool ~applied:true (List.of_seq @@ Seq.append - (String_set.to_seq !status1.preendorsements) - (String_set.to_seq !status1.endorsements)) + (String_set.to_seq !status1.preattestations) + (String_set.to_seq !status1.attestations)) mempool1 ; check_ophs_in_mempool ~applied:true (List.of_seq @@ Seq.append - (String_set.to_seq !status2.preendorsements) - (String_set.to_seq !status2.endorsements)) + (String_set.to_seq !status2.preattestations) + (String_set.to_seq !status2.attestations)) mempool2 ; Log.info @@ -546,7 +546,7 @@ let baker_early_preendorsement_test = ~error_msg:"Block should contain all the transactions" ; Log.info - "Wait for lvl %d and ensure that it contain all the endorsements" + "Wait for lvl %d and ensure that it contain all the attestations" next_lvl ; let* _ = Node.wait_for_level node2 5 in let* consensus_ops = @@ -560,4 +560,4 @@ let baker_early_preendorsement_test = ~error_msg:(sf "Block should contain 5 consensus operations") ; unit -let register ~protocols = baker_early_preendorsement_test protocols +let register ~protocols = baker_early_preattestation_test protocols -- GitLab From f077860f1a7d21881558a7d954bb7f5d3cea5e44 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Tue, 20 Jun 2023 14:25:29 +0200 Subject: [PATCH 9/9] changelog: add entry for attestation renaming in baker events and errors --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 354c21641461..c4eeb3572b1f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -191,6 +191,9 @@ Baker adaptive inflation feature. They may use the per block votes file, or CLI option ``--adaptive-inflation-vote``. +- Rename ``endorsement`` into ``attestation`` for baker errors and events. + (MR :gl:`!9195`) + Accuser ------- -- GitLab