From cda4041216bb2dc57982f76124f66172c4e5c4d4 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 3 Jul 2023 13:59:09 +0200 Subject: [PATCH 1/9] alpha: rename preendorsement in consensus_operation_type --- .../lib_delegate/client_baking_denunciation.ml | 14 +++++++------- src/proto_alpha/lib_protocol/alpha_context.mli | 2 +- src/proto_alpha/lib_protocol/operation_repr.ml | 2 +- src/proto_alpha/lib_protocol/operation_repr.mli | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml index bf70015af1d1..25ca449e4d2f 100644 --- a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml @@ -138,14 +138,14 @@ let get_block_offset level = let get_payload_hash (type kind) (op_kind : kind consensus_operation_type) (op : kind Operation.t) = match (op_kind, op.protocol_data.contents) with - | Preendorsement, Single (Preendorsement consensus_content) + | Preattestation, Single (Preendorsement consensus_content) | Endorsement, Single (Endorsement consensus_content) -> consensus_content.block_payload_hash let get_slot (type kind) (op_kind : kind consensus_operation_type) (op : kind Operation.t) = match (op_kind, op.protocol_data.contents) with - | Preendorsement, Single (Preendorsement consensus_content) + | Preattestation, Single (Preendorsement consensus_content) | Endorsement, Single (Endorsement consensus_content) -> consensus_content.slot @@ -159,7 +159,7 @@ let double_consensus_op_evidence (type kind) : unit -> bytes Environment.Error_monad.shell_tzresult Lwt.t = function | Endorsement -> Plugin.RPC.Forge.double_endorsement_evidence - | Preendorsement -> Plugin.RPC.Forge.double_preendorsement_evidence + | Preattestation -> Plugin.RPC.Forge.double_preendorsement_evidence let lookup_recorded_consensus (type kind) consensus_key (op_kind : kind consensus_operation_type) map : kind recorded_consensus = @@ -168,7 +168,7 @@ let lookup_recorded_consensus (type kind) consensus_key | Some {endorsement; preendorsement} -> ( match op_kind with | Endorsement -> endorsement - | Preendorsement -> preendorsement) + | Preattestation -> preendorsement) let add_consensus_operation (type kind) consensus_key (op_kind : kind consensus_operation_type) @@ -187,7 +187,7 @@ let add_consensus_operation (type kind) consensus_key in match op_kind with | Endorsement -> Some {record with endorsement = recorded_operation} - | Preendorsement -> Some {record with preendorsement = recorded_operation}) + | Preattestation -> Some {record with preendorsement = recorded_operation}) map let get_validator_rights state cctxt level = @@ -292,7 +292,7 @@ let process_consensus_op (type kind) state cctxt match op_kind with | Endorsement -> (double_attestation_detected, double_attestation_denounced) - | Preendorsement -> + | Preattestation -> ( double_preattestation_detected, double_preattestation_denounced )) in @@ -338,7 +338,7 @@ let process_operations (cctxt : #Protocol_client_context.full) state process_consensus_op state cctxt - Preendorsement + Preattestation new_preendorsement chain_id level diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index e756cc8d55bd..7de70776b5fe 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -4120,7 +4120,7 @@ end type 'a consensus_operation_type = | Endorsement : Kind.attestation consensus_operation_type - | Preendorsement : Kind.preattestation consensus_operation_type + | Preattestation : Kind.preattestation consensus_operation_type type consensus_content = { slot : Slot.t; diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index bcc30c07a45c..e8e2107a2470 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -136,7 +136,7 @@ end type 'a consensus_operation_type = | Endorsement : Kind.attestation consensus_operation_type - | Preendorsement : Kind.preattestation consensus_operation_type + | Preattestation : Kind.preattestation consensus_operation_type type consensus_content = { slot : Slot_repr.t; diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index 6198049308b8..c2027496fc04 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -170,7 +170,7 @@ end type 'a consensus_operation_type = | Endorsement : Kind.attestation consensus_operation_type - | Preendorsement : Kind.preattestation consensus_operation_type + | Preattestation : Kind.preattestation consensus_operation_type type consensus_content = { slot : Slot_repr.t; -- GitLab From d7d5ea29ebe269e54e9f9c009d8e24b6adacc944 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 3 Jul 2023 14:07:11 +0200 Subject: [PATCH 2/9] alpha: rename preendorsement in contents type --- .../lib_client/operation_result.ml | 2 +- .../lib_delegate/baking_actions.ml | 2 +- src/proto_alpha/lib_delegate/block_forge.ml | 2 +- .../client_baking_denunciation.ml | 6 ++-- src/proto_alpha/lib_delegate/node_rpc.ml | 2 +- .../lib_delegate/operation_pool.ml | 10 +++--- .../lib_delegate/operation_worker.ml | 6 ++-- .../lib_delegate/state_transitions.ml | 2 +- .../test/mockup_simulator/mockup_simulator.ml | 4 +-- src/proto_alpha/lib_plugin/RPC.ml | 2 +- src/proto_alpha/lib_plugin/mempool.ml | 4 +-- .../lib_protocol/alpha_context.mli | 2 +- src/proto_alpha/lib_protocol/apply.ml | 8 ++--- src/proto_alpha/lib_protocol/apply_results.ml | 8 ++--- .../lib_protocol/operation_repr.ml | 36 +++++++++---------- .../lib_protocol/operation_repr.mli | 10 +++--- .../lib_protocol/test/helpers/op.ml | 2 +- .../test/helpers/operation_generator.ml | 2 +- .../validate/generator_descriptors.ml | 2 +- .../integration/validate/test_covalidity.ml | 2 +- .../test/integration/validate/test_sanity.ml | 4 +-- src/proto_alpha/lib_protocol/validate.ml | 28 +++++++-------- 22 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 6c8a04c2dd07..78a69b171498 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -871,7 +871,7 @@ let pp_contents_and_result : (Block_header.hash bh2) pp_balance_updates bus - | ( Preendorsement {level; _}, + | ( Preattestation {level; _}, Preendorsement_result {balance_updates; delegate; consensus_key; consensus_power} ) -> Format.fprintf diff --git a/src/proto_alpha/lib_delegate/baking_actions.ml b/src/proto_alpha/lib_delegate/baking_actions.ml index 86bc953a83d4..ad5750003bd4 100644 --- a/src/proto_alpha/lib_delegate/baking_actions.ml +++ b/src/proto_alpha/lib_delegate/baking_actions.ml @@ -402,7 +402,7 @@ let inject_preendorsements state ~preendorsements = state.level_state.latest_proposal.predecessor.shell.predecessor; } in - let contents = Single (Preendorsement consensus_content) in + let contents = Single (Preattestation consensus_content) in let level = Raw_level.to_int32 consensus_content.level in let round = consensus_content.round in let sk_uri = consensus_key.secret_key_uri in diff --git a/src/proto_alpha/lib_delegate/block_forge.ml b/src/proto_alpha/lib_delegate/block_forge.ml index 81cdb4699a31..124131a087c9 100644 --- a/src/proto_alpha/lib_delegate/block_forge.ml +++ b/src/proto_alpha/lib_delegate/block_forge.ml @@ -360,7 +360,7 @@ let apply_with_context ~chain_id ~faked_protocol_data ~user_activated_upgrades List.find_map (fun {protocol_data = Operation_data protocol_data; _} -> match protocol_data.contents with - | Single (Preendorsement {round; _}) -> Some round + | Single (Preattestation {round; _}) -> Some round | _ -> None) (Option.value (List.hd operations) ~default:[]) in diff --git a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml index 25ca449e4d2f..3bee80abdedc 100644 --- a/src/proto_alpha/lib_delegate/client_baking_denunciation.ml +++ b/src/proto_alpha/lib_delegate/client_baking_denunciation.ml @@ -138,14 +138,14 @@ let get_block_offset level = let get_payload_hash (type kind) (op_kind : kind consensus_operation_type) (op : kind Operation.t) = match (op_kind, op.protocol_data.contents) with - | Preattestation, Single (Preendorsement consensus_content) + | Preattestation, Single (Preattestation consensus_content) | Endorsement, Single (Endorsement consensus_content) -> consensus_content.block_payload_hash let get_slot (type kind) (op_kind : kind consensus_operation_type) (op : kind Operation.t) = match (op_kind, op.protocol_data.contents) with - | Preattestation, Single (Preendorsement consensus_content) + | Preattestation, Single (Preattestation consensus_content) | Endorsement, Single (Endorsement consensus_content) -> consensus_content.slot @@ -330,7 +330,7 @@ let process_operations (cctxt : #Protocol_client_context.full) state let {shell; protocol_data; _} = packed_op op in match protocol_data with | Operation_data - ({contents = Single (Preendorsement {round; slot; level; _}); _} as + ({contents = Single (Preattestation {round; slot; level; _}); _} as protocol_data) -> let new_preendorsement : Kind.preattestation Alpha_context.operation = {shell; protocol_data} diff --git a/src/proto_alpha/lib_delegate/node_rpc.ml b/src/proto_alpha/lib_delegate/node_rpc.ml index b1d990b11939..2717b35e622a 100644 --- a/src/proto_alpha/lib_delegate/node_rpc.ml +++ b/src/proto_alpha/lib_delegate/node_rpc.ml @@ -62,7 +62,7 @@ let preapply_block cctxt ~chain ~head ~timestamp ~protocol_data operations = let extract_prequorum preendorsements = match preendorsements with | h :: _ -> - let ({protocol_data = {contents = Single (Preendorsement content); _}; _}) + let ({protocol_data = {contents = Single (Preattestation content); _}; _}) = (h : Kind.preattestation Operation.t) in diff --git a/src/proto_alpha/lib_delegate/operation_pool.ml b/src/proto_alpha/lib_delegate/operation_pool.ml index 2aafc9cfbf66..6a60da07cc14 100644 --- a/src/proto_alpha/lib_delegate/operation_pool.ml +++ b/src/proto_alpha/lib_delegate/operation_pool.ml @@ -224,12 +224,12 @@ let filter_with_relevant_consensus_ops ~(endorsement_filter : consensus_filter) (fun {protocol_data; _} -> match (protocol_data, preendorsement_filter) with (* 1a. Remove preendorsements. *) - | Operation_data {contents = Single (Preendorsement _); _}, None -> false + | Operation_data {contents = Single (Preattestation _); _}, None -> false (* 1b. Filter preendorsements. *) | ( Operation_data { contents = - Single (Preendorsement {level; round; block_payload_hash; _}); + Single (Preattestation {level; round; block_payload_hash; _}); _; }, Some @@ -257,7 +257,7 @@ let filter_with_relevant_consensus_ops ~(endorsement_filter : consensus_filter) let unpack_preendorsement packed_preendorsement = let {shell; protocol_data = Operation_data data} = packed_preendorsement in match data with - | {contents = Single (Preendorsement _); _} -> + | {contents = Single (Preattestation _); _} -> Some ({shell; protocol_data = data} : Kind.preattestation Operation.t) | _ -> None @@ -282,7 +282,7 @@ let filter_preendorsements ops = shell = {branch}; protocol_data = Operation_data - ({contents = Single (Preendorsement _); _} as content); + ({contents = Single (Preattestation _); _} as content); _; } -> Some @@ -340,7 +340,7 @@ let extract_operations_of_list_list = function packed_op -> let {shell; protocol_data = Operation_data data} = packed_op in match data with - | {contents = Single (Preendorsement _); _} -> + | {contents = Single (Preattestation _); _} -> ( {shell; protocol_data = data} :: preendorsements, endorsements, dal_attestations ) diff --git a/src/proto_alpha/lib_delegate/operation_worker.ml b/src/proto_alpha/lib_delegate/operation_worker.ml index 3e4544814e5d..6440698effc3 100644 --- a/src/proto_alpha/lib_delegate/operation_worker.ml +++ b/src/proto_alpha/lib_delegate/operation_worker.ml @@ -170,9 +170,9 @@ module Preendorsement_set = Set.Make (struct type t = Kind.preattestation operation let compare - ({protocol_data = {contents = Single (Preendorsement op1); _}; shell = _} : + ({protocol_data = {contents = Single (Preattestation op1); _}; shell = _} : t) - ({protocol_data = {contents = Single (Preendorsement op2); _}; shell = _} : + ({protocol_data = {contents = Single (Preattestation op2); _}; shell = _} : t) = compare_consensus_contents op1 op2 end) @@ -319,7 +319,7 @@ let update_monitoring ?(should_lock = true) state ops = let { shell = _; protocol_data = - {contents = Single (Preendorsement consensus_content); _}; + {contents = Single (Preattestation consensus_content); _}; _; } = op diff --git a/src/proto_alpha/lib_delegate/state_transitions.ml b/src/proto_alpha/lib_delegate/state_transitions.ml index 5d5c71950176..fca825fe9946 100644 --- a/src/proto_alpha/lib_delegate/state_transitions.ml +++ b/src/proto_alpha/lib_delegate/state_transitions.ml @@ -149,7 +149,7 @@ let extract_pqc state (new_proposal : proposal) = let open Protocol.Alpha_context.Operation in let { shell = _; - protocol_data = {contents = Single (Preendorsement {slot; _}); _}; + protocol_data = {contents = Single (Preattestation {slot; _}); _}; _; } = op diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml index 3b4acac0c286..43b83d46061c 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -1344,7 +1344,7 @@ let op_is_signed_by ~public_key (op_hash : Operation_hash.t) (match op_contents with | Endorsement _ -> Alpha_context.Operation.to_watermark (Endorsement chain_id) - | Preendorsement _ -> + | Preattestation _ -> Alpha_context.Operation.to_watermark (Preendorsement chain_id) | _ -> Signature.Generic_operation) | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) @@ -1375,7 +1375,7 @@ let op_is_preendorsement ?level ?round (op_hash : Operation_hash.t) match d.contents with | Single op_contents -> ( match op_contents with - | Preendorsement consensus_content -> + | Preattestation consensus_content -> let right_level = match level with | None -> true diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index 56ff0b679a31..9dff9734bbbb 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -1036,7 +1036,7 @@ module Scripts = struct let {Services_registration.context; block_header; _} = rpc_ctxt in let*? () = match packed_operation.protocol_data with - | Operation_data {contents = Single (Preendorsement _); _} + | Operation_data {contents = Single (Preattestation _); _} | Operation_data {contents = Single (Endorsement _); _} | Operation_data {contents = Single (Dal_attestation _); _} -> error Run_operation_does_not_support_consensus_operations diff --git a/src/proto_alpha/lib_plugin/mempool.ml b/src/proto_alpha/lib_plugin/mempool.ml index 15077dd9dafc..bd939bf6d5dd 100644 --- a/src/proto_alpha/lib_plugin/mempool.ml +++ b/src/proto_alpha/lib_plugin/mempool.ml @@ -534,7 +534,7 @@ let pre_filter filter_info config match contents with | Single (Failing_noop _) -> Lwt.return (`Refused [Environment.wrap_tzerror Wrong_operation]) - | Single (Preendorsement consensus_content) + | Single (Preattestation consensus_content) | Single (Endorsement consensus_content) -> pre_filter_far_future_consensus_ops filter_info config consensus_content >>= fun keep -> @@ -679,7 +679,7 @@ let find_manager {shell = _; protocol_data = Operation_data {contents; _}} = | Single (Manager_operation {source; _}) -> Some source | Cons (Manager_operation {source; _}, _) -> Some source | Single - ( Preendorsement _ | Endorsement _ | Dal_attestation _ | Proposals _ + ( Preattestation _ | Endorsement _ | Dal_attestation _ | Proposals _ | Ballot _ | Seed_nonce_revelation _ | Vdf_revelation _ | Double_baking_evidence _ | Double_preendorsement_evidence _ | Double_endorsement_evidence _ | Activate_account _ | Drain_delegate _ diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 7de70776b5fe..eaf03fd11d61 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -4153,7 +4153,7 @@ and _ contents_list = -> ('kind * 'rest) Kind.manager contents_list and _ contents = - | Preendorsement : consensus_content -> Kind.preattestation contents + | Preattestation : consensus_content -> Kind.preattestation contents | Endorsement : consensus_content -> Kind.attestation contents | Dal_attestation : Dal.Attestation.operation -> Kind.dal_attestation contents | Seed_nonce_revelation : { diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 045681d9a784..9cc465118e16 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1977,7 +1977,7 @@ type application_state = { let record_operation (type kind) ctxt hash (operation : kind operation) : context = match operation.protocol_data.contents with - | Single (Preendorsement _) -> ctxt + | Single (Preattestation _) -> ctxt | Single (Endorsement _) -> ctxt | Single (Dal_attestation _) -> ctxt | Single @@ -2134,13 +2134,13 @@ let punish_double_endorsement_or_preendorsement (type kind) ctxt let mk_result (balance_updates : Receipt.balance_updates) : kind Kind.double_consensus_operation_evidence contents_result = match op1.protocol_data.contents with - | Single (Preendorsement _) -> + | Single (Preattestation _) -> Double_preendorsement_evidence_result balance_updates | Single (Endorsement _) -> Double_endorsement_evidence_result balance_updates in match op1.protocol_data.contents with - | Single (Preendorsement e1) | Single (Endorsement e1) -> + | Single (Preattestation e1) | Single (Endorsement e1) -> let level = Level.from_raw ctxt e1.level in Stake_distribution.slot_owner ctxt level e1.slot >>=? fun (ctxt, consensus_pk1) -> @@ -2178,7 +2178,7 @@ let apply_contents_list (type kind) ctxt chain_id (mode : mode) | Full_construction _ | Application _ -> false in match contents_list with - | Single (Preendorsement consensus_content) -> + | Single (Preattestation consensus_content) -> record_preendorsement ctxt mode consensus_content | Single (Endorsement consensus_content) -> record_endorsement ctxt mode consensus_content diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 8e3c3148090d..188b9b23dee9 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -1029,7 +1029,7 @@ module Encoding = struct | _ -> None); mselect = (function - | Contents_and_result ((Preendorsement _ as op), res) -> Some (op, res) + | Contents_and_result ((Preattestation _ as op), res) -> Some (op, res) | _ -> None); proj = (function @@ -1053,7 +1053,7 @@ module Encoding = struct | _ -> None); mselect = (function - | Contents_and_result ((Preendorsement _ as op), res) -> Some (op, res) + | Contents_and_result ((Preattestation _ as op), res) -> Some (op, res) | _ -> None); proj = (function @@ -1896,8 +1896,8 @@ let kind_equal : match (op, res) with | Endorsement _, Endorsement_result _ -> Some Eq | Endorsement _, _ -> None - | Preendorsement _, Preendorsement_result _ -> Some Eq - | Preendorsement _, _ -> None + | Preattestation _, Preendorsement_result _ -> Some Eq + | Preattestation _, _ -> None | Dal_attestation _, Dal_attestation_result _ -> Some Eq | Dal_attestation _, _ -> None | Seed_nonce_revelation _, Seed_nonce_revelation_result _ -> Some Eq diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index e8e2107a2470..f2541469c263 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -234,7 +234,7 @@ and _ contents_list = -> ('kind * 'rest) Kind.manager contents_list and _ contents = - | Preendorsement : consensus_content -> Kind.preattestation contents + | Preattestation : consensus_content -> Kind.preattestation contents | Endorsement : consensus_content -> Kind.attestation contents | Dal_attestation : Dal_attestation_repr.operation @@ -998,9 +998,9 @@ module Encoding = struct name = "preendorsement"; encoding = consensus_content_encoding; select = - (function Contents (Preendorsement _ as op) -> Some op | _ -> None); - proj = (fun (Preendorsement preendorsement) -> preendorsement); - inj = (fun preendorsement -> Preendorsement preendorsement); + (function Contents (Preattestation _ as op) -> Some op | _ -> None); + proj = (fun (Preattestation preattestation) -> preattestation); + inj = (fun preattestation -> Preattestation preattestation); } let preattestation_case = @@ -1010,9 +1010,9 @@ module Encoding = struct name = "preattestation"; encoding = consensus_content_encoding; select = - (function Contents (Preendorsement _ as op) -> Some op | _ -> None); - proj = (fun (Preendorsement preendorsement) -> preendorsement); - inj = (fun preendorsement -> Preendorsement preendorsement); + (function Contents (Preattestation _ as op) -> Some op | _ -> None); + proj = (fun (Preattestation preattestation) -> preattestation); + inj = (fun preattestation -> Preattestation preattestation); } let preendorsement_encoding = @@ -1846,7 +1846,7 @@ let acceptable_pass (op : packed_operation) = let (Operation_data protocol_data) = op.protocol_data in match protocol_data.contents with | Single (Failing_noop _) -> None - | Single (Preendorsement _) -> Some consensus_pass + | Single (Preattestation _) -> Some consensus_pass | Single (Endorsement _) -> Some consensus_pass | Single (Dal_attestation _) -> Some consensus_pass | Single (Proposals _) -> Some voting_pass @@ -1936,7 +1936,7 @@ let check_signature (type kind) key chain_id (op : kind operation) = | Some signature -> let watermark = match op.protocol_data.contents with - | Single (Preendorsement _) -> to_watermark (Preendorsement chain_id) + | Single (Preattestation _) -> to_watermark (Preendorsement chain_id) | Single (Endorsement _) -> to_watermark (Endorsement chain_id) | Single (Dal_attestation _) -> to_watermark (Dal_attestation chain_id) | Single @@ -2017,8 +2017,8 @@ let equal_contents_kind : type a b. a contents -> b contents -> (a, b) eq option = fun op1 op2 -> match (op1, op2) with - | Preendorsement _, Preendorsement _ -> Some Eq - | Preendorsement _, _ -> None + | Preattestation _, Preattestation _ -> Some Eq + | Preattestation _, _ -> None | Endorsement _, Endorsement _ -> Some Eq | Endorsement _, _ -> None | Dal_attestation _, Dal_attestation _ -> Some Eq @@ -2147,10 +2147,10 @@ let round_infos_from_consensus_content (c : consensus_content) = | Error _ -> {level; round = -1} (** Compute a {!endorsement_infos} from a {!consensus_content}. It is - used to compute the weight of {!Endorsement} and {!Preendorsement}. + used to compute the weight of {!Endorsement} and {!Preattestation}. Precondition: [c] comes from a valid operation. The {!Endorsement} - or {!Preendorsement} is valid, so its [round] must succeed to + or {!Preattestation} is valid, so its [round] must succeed to convert into an {!int}. Hence, for the unreachable path where the convertion fails, we put (-1) as [round] value (see {!round_infos_from_consensus_content}). *) @@ -2188,7 +2188,7 @@ let consensus_infos_and_hash_from_block_header (bh : Block_header_repr.t) = is used to compare it to an operation of the same pass. Operation weight are defined by validation pass. - The [weight] of an {!Endorsement} or {!Preendorsement} depends on + The [weight] of an {!Endorsement} or {!Preattestation} depends on its {!endorsement_infos}. The [weight] of a {!Dal_attestation} depends on the pair of @@ -2315,7 +2315,7 @@ let weight_of : packed_operation -> operation_weight = let (Operation_data protocol_data) = op.protocol_data in match protocol_data.contents with | Single (Failing_noop _) -> W (Noop, Weight_noop) - | Single (Preendorsement consensus_content) -> + | Single (Preattestation consensus_content) -> W ( Consensus, Weight_preendorsement @@ -2350,7 +2350,7 @@ let weight_of : packed_operation -> operation_weight = (round_infos_from_consensus_content consensus_content) )) | Single (Double_preendorsement_evidence {op1; _}) -> ( match op1.protocol_data.contents with - | Single (Preendorsement consensus_content) -> + | Single (Preattestation consensus_content) -> W ( Anonymous, Weight_double_preendorsement @@ -2412,7 +2412,7 @@ let compare_round_infos infos1 infos2 = (infos1.level, infos1.round) (infos2.level, infos2.round) -(** When comparing {!Endorsement} to {!Preendorsement} or +(** When comparing {!Endorsement} to {!Preattestation} or {!Double_endorsement_evidence} to {!Double_preendorsement}, in case of {!round_infos} equality, the position is relevant to compute the order. *) @@ -2479,7 +2479,7 @@ let compare_dal_attestation (attestor1, endorsements1, level1) (** Comparing consensus operations by their [weight] uses the comparison on {!endorsement_infos} for {!Endorsement} and - {!Preendorsement}: see {!endorsement_infos} for more details. + {!Preattestation}: see {!endorsement_infos} for more details. {!Dal_attestation} is smaller than the other kinds of consensus operations. Two valid {!Dal_attestation} are diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index c2027496fc04..6d0c0b4aa158 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -228,9 +228,9 @@ and _ contents_list = (** A value of type [contents] an operation related to whether consensus, governance or contract management. *) and _ contents = - (* Preendorsement: About consensus, preendorsement of a block held by a + (* Preattestation: About consensus, preattestation of a block held by a validator (specific to Tenderbake). *) - | Preendorsement : consensus_content -> Kind.preattestation contents + | Preattestation : consensus_content -> Kind.preattestation contents (* Endorsement: About consensus, endorsement of a block held by a validator. *) | Endorsement : consensus_content -> Kind.attestation contents @@ -594,20 +594,20 @@ val compare_by_passes : packed_operation -> packed_operation -> int The global order is as follows: - {!Endorsement} and {!Preendorsement} > {!Dal_attestation} > + {!Endorsement} and {!Preattestation} > {!Dal_attestation} > {!Proposals} > {!Ballot} > {!Double_preendorsement_evidence} > {!Double_endorsement_evidence} > {!Double_baking_evidence} > {!Vdf_revelation} > {!Seed_nonce_revelation} > {!Activate_account} > {!Drain_delegate} > {!Manager_operation}. - {!Endorsement} and {!Preendorsement} are compared by the pair of + {!Endorsement} and {!Preattestation} are compared by the pair of their [level] and [round] such as the farther to the current state [level] and [round] is greater; e.g. the greater pair in lexicographic order being the better. When equal and both operations being of the same kind, we compare their [slot]: the The smaller being the better, assuming that the more slots an endorser has, the smaller is its smallest [slot]. When the pair is equal - and comparing an {!Endorsement] to a {!Preendorsement}, the + and comparing an {!Endorsement] to a {!Preattestation}, the {!Endorsement} is better. Two {!Dal_attestation} ops are compared in the lexicographic diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index cdaee86a52ce..e175549ef682 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -146,7 +146,7 @@ let raw_preendorsement ?delegate ?slot ?level ?round ?block_payload_hash ?branch ?branch endorsed_block in - let op = Single (Preendorsement consensus_content) in + let op = Single (Preattestation consensus_content) in return (sign ~watermark:Operation.(to_watermark (Preendorsement Chain_id.zero)) diff --git a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml index 8b30784ba6d3..d049ee52e515 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml @@ -380,7 +380,7 @@ let generate_operation gen_op = let generate_preendorsement = let open QCheck2.Gen in let+ cc = generate_consensus_content in - Preendorsement cc + Preattestation cc let generate_endorsement = let open QCheck2.Gen in diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml index 9c2bdf022ec8..682a7a769eb0 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/generator_descriptors.ml @@ -836,7 +836,7 @@ type op_kind = let op_kind_of_packed_operation op = let (Operation_data {contents; _}) = op.protocol_data in match contents with - | Single (Preendorsement _) -> KPreendorsement + | Single (Preattestation _) -> KPreendorsement | Single (Endorsement _) -> KEndorsement | Single (Dal_attestation _) -> KDalattestation | Single (Seed_nonce_revelation _) -> KNonce diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/test_covalidity.ml b/src/proto_alpha/lib_protocol/test/integration/validate/test_covalidity.ml index ba203fe8242d..a2e5e88fb495 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/test_covalidity.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/test_covalidity.ml @@ -62,7 +62,7 @@ let op_of_seed_gen = function Nonce -> KNonce | Vdf -> KVdf let is_not_preendorsement op = let open Protocol.Alpha_context in let (Operation_data {contents; _}) = op.protocol_data in - match contents with Single (Preendorsement _) -> false | _ -> true + match contents with Single (Preattestation _) -> false | _ -> true module OpkindMap = Map.Make (struct type t = op_kind diff --git a/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml b/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml index 78b62dac2021..eee04bcceff3 100644 --- a/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml +++ b/src/proto_alpha/lib_protocol/test/integration/validate/test_sanity.ml @@ -118,8 +118,8 @@ let covalidation_sanity () = failwith "no candidates was generated for kind '%a'" pp_op_kind kind | Some {protocol_data = Operation_data {contents; _}; _} -> ( match (contents, kind) with - | Single (Preendorsement _), KPreendorsement -> return_unit - | Single (Preendorsement _), _ -> assert false + | Single (Preattestation _), KPreendorsement -> return_unit + | Single (Preattestation _), _ -> assert false | Single (Endorsement _), KEndorsement -> return_unit | Single (Endorsement _), _ -> assert false | Single (Dal_attestation _), KDalattestation -> return_unit diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index 57ac60568147..95f2f16c365e 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -585,7 +585,7 @@ module Consensus = struct ~error:(trace_of_error Consensus_operation_not_allowed) vi.consensus_info in - let (Single (Preendorsement consensus_content)) = + let (Single (Preattestation consensus_content)) = operation.protocol_data.contents in let* consensus_key, voting_power = @@ -621,7 +621,7 @@ module Consensus = struct let check_preendorsement_conflict vs oph (op : Kind.preattestation operation) = - let (Single (Preendorsement {slot; level; round; _})) = + let (Single (Preattestation {slot; level; round; _})) = op.protocol_data.contents in match @@ -641,7 +641,7 @@ module Consensus = struct Conflicting_consensus_operation {kind = Preattestation; conflict}) let add_preendorsement vs oph (op : Kind.preattestation operation) = - let (Single (Preendorsement {slot; level; round; _})) = + let (Single (Preattestation {slot; level; round; _})) = op.protocol_data.contents in let preendorsements_seen = @@ -675,7 +675,7 @@ module Consensus = struct let remove_preendorsement vs (operation : Kind.preattestation operation) = (* As we are in mempool mode, we do not update [locked_round_evidence]. *) - let (Single (Preendorsement {slot; level; round; _})) = + let (Single (Preattestation {slot; level; round; _})) = operation.protocol_data.contents in let preendorsements_seen = @@ -898,7 +898,7 @@ module Consensus = struct let validate_preendorsement ~check_signature info operation_state block_state oph (operation : Kind.preattestation operation) = let open Lwt_result_syntax in - let (Single (Preendorsement consensus_content)) = + let (Single (Preattestation consensus_content)) = operation.protocol_data.contents in let* voting_power = check_preendorsement info ~check_signature operation in @@ -1336,7 +1336,7 @@ module Anonymous = struct (op2 : kind Kind.consensus Operation.t) = let open Lwt_result_syntax in match (op1.protocol_data.contents, op2.protocol_data.contents) with - | Single (Preendorsement e1), Single (Preendorsement e2) + | Single (Preattestation e1), Single (Preattestation e2) | Single (Endorsement e1), Single (Endorsement e2) -> let op1_hash = Operation.hash op1 in let op2_hash = Operation.hash op2 in @@ -1425,7 +1425,7 @@ module Anonymous = struct let check_double_endorsing_evidence_conflict (type kind) vs oph (op1 : kind Kind.consensus Operation.t) = match op1.protocol_data.contents with - | Single (Preendorsement e1) | Single (Endorsement e1) -> ( + | Single (Preattestation e1) | Single (Endorsement e1) -> ( match Double_endorsing_evidence_map.find (e1.level, e1.round, e1.slot) @@ -1456,7 +1456,7 @@ module Anonymous = struct let add_double_endorsing_evidence (type kind) vs oph (op1 : kind Kind.consensus Operation.t) = match op1.protocol_data.contents with - | Single (Preendorsement e1) | Single (Endorsement e1) -> + | Single (Preattestation e1) | Single (Endorsement e1) -> let double_endorsing_evidences_seen = Double_endorsing_evidence_map.add (e1.level, e1.round, e1.slot) @@ -1486,7 +1486,7 @@ module Anonymous = struct let remove_double_endorsing_evidence (type kind) vs (op : kind Kind.consensus Operation.t) = match op.protocol_data.contents with - | Single (Endorsement e) | Single (Preendorsement e) -> + | Single (Endorsement e) | Single (Preattestation e) -> let double_endorsing_evidences_seen = Double_endorsing_evidence_map.remove (e.level, e.round, e.slot) @@ -2447,7 +2447,7 @@ let check_operation ?(check_signature = true) info (type kind) (operation : kind operation) : unit tzresult Lwt.t = let open Lwt_result_syntax in match operation.protocol_data.contents with - | Single (Preendorsement _) -> + | Single (Preattestation _) -> let* (_voting_power : int) = Consensus.check_preendorsement info ~check_signature operation in @@ -2503,7 +2503,7 @@ let check_operation ?(check_signature = true) info (type kind) let check_operation_conflict (type kind) operation_conflict_state oph (operation : kind operation) = match operation.protocol_data.contents with - | Single (Preendorsement _) -> + | Single (Preattestation _) -> Consensus.check_preendorsement_conflict operation_conflict_state oph @@ -2569,7 +2569,7 @@ let check_operation_conflict (type kind) operation_conflict_state oph let add_valid_operation operation_conflict_state oph (type kind) (operation : kind operation) = match operation.protocol_data.contents with - | Single (Preendorsement _) -> + | Single (Preattestation _) -> Consensus.add_preendorsement operation_conflict_state oph operation | Single (Endorsement _) -> Consensus.add_endorsement operation_conflict_state oph operation @@ -2614,7 +2614,7 @@ let add_valid_operation operation_conflict_state oph (type kind) let remove_operation operation_conflict_state (type kind) (operation : kind operation) = match operation.protocol_data.contents with - | Single (Preendorsement _) -> + | Single (Preattestation _) -> Consensus.remove_preendorsement operation_conflict_state operation | Single (Endorsement _) -> Consensus.remove_endorsement operation_conflict_state operation @@ -2700,7 +2700,7 @@ let validate_operation ?(check_signature = true) return {info; operation_state; block_state} | (Application _ | Partial_validation _ | Construction _ | Mempool), _ -> ( match operation.protocol_data.contents with - | Single (Preendorsement _) -> + | Single (Preattestation _) -> Consensus.validate_preendorsement ~check_signature info -- GitLab From 16faa716b87c732a27c54c9072cc70d34860a46a Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 3 Jul 2023 14:09:24 +0200 Subject: [PATCH 3/9] alpha: rename preendorsement in operation weight --- src/proto_alpha/lib_protocol/operation_repr.ml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index f2541469c263..5cbb1df8ec84 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -2222,7 +2222,7 @@ let consensus_infos_and_hash_from_block_header (bh : Block_header_repr.t) = [gas_limit] ratio expressed in {!Q.t}. *) type _ weight = | Weight_endorsement : endorsement_infos -> consensus_pass_type weight - | Weight_preendorsement : endorsement_infos -> consensus_pass_type weight + | Weight_preattestation : endorsement_infos -> consensus_pass_type weight | Weight_dal_attestation : (* attestor * num_attestations * level *) (Signature.Public_key_hash.t * int * int32) @@ -2318,7 +2318,7 @@ let weight_of : packed_operation -> operation_weight = | Single (Preattestation consensus_content) -> W ( Consensus, - Weight_preendorsement + Weight_preattestation (endorsement_infos_from_consensus_content consensus_content) ) | Single (Endorsement consensus_content) -> W @@ -2488,19 +2488,19 @@ let compare_consensus_weight w1 w2 = match (w1, w2) with | Weight_endorsement infos1, Weight_endorsement infos2 -> compare_endorsement_infos ~prioritized_position:Nopos infos1 infos2 - | Weight_preendorsement infos1, Weight_preendorsement infos2 -> + | Weight_preattestation infos1, Weight_preattestation infos2 -> compare_endorsement_infos ~prioritized_position:Nopos infos1 infos2 - | Weight_endorsement infos1, Weight_preendorsement infos2 -> + | Weight_endorsement infos1, Weight_preattestation infos2 -> compare_endorsement_infos ~prioritized_position:Fstpos infos1 infos2 - | Weight_preendorsement infos1, Weight_endorsement infos2 -> + | Weight_preattestation infos1, Weight_endorsement infos2 -> compare_endorsement_infos ~prioritized_position:Sndpos infos1 infos2 | ( Weight_dal_attestation (attestor1, size1, lvl1), Weight_dal_attestation (attestor2, size2, lvl2) ) -> compare_dal_attestation (attestor1, size1, lvl1) (attestor2, size2, lvl2) - | Weight_dal_attestation _, (Weight_endorsement _ | Weight_preendorsement _) + | Weight_dal_attestation _, (Weight_endorsement _ | Weight_preattestation _) -> -1 - | (Weight_endorsement _ | Weight_preendorsement _), Weight_dal_attestation _ + | (Weight_endorsement _ | Weight_preattestation _), Weight_dal_attestation _ -> 1 -- GitLab From 3fe171fe5422678e1a5db0fe487afcf77ea3a9fa Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 3 Jul 2023 14:12:11 +0200 Subject: [PATCH 4/9] alpha: rename preendorsement in raw_context --- src/proto_alpha/lib_protocol/apply.ml | 8 +-- src/proto_alpha/lib_protocol/main.ml | 6 +- src/proto_alpha/lib_protocol/raw_context.ml | 76 ++++++++++---------- src/proto_alpha/lib_protocol/raw_context.mli | 32 ++++----- src/proto_alpha/lib_protocol/validate.ml | 2 +- 5 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 9cc465118e16..af3a88272765 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -2004,8 +2004,8 @@ let record_preendorsement ctxt (mode : mode) (content : consensus_content) : let ctxt = match mode with | Full_construction _ -> ( - match Consensus.get_preendorsements_quorum_round ctxt with - | None -> Consensus.set_preendorsements_quorum_round ctxt content.round + match Consensus.get_preattestations_quorum_round ctxt with + | None -> Consensus.set_preattestations_quorum_round ctxt content.round | Some _ -> ctxt) | Application _ | Partial_construction _ -> ctxt in @@ -2023,10 +2023,10 @@ let record_preendorsement ctxt (mode : mode) (content : consensus_content) : match mode with | Application _ | Full_construction _ -> let*? consensus_key, power = - find_in_slot_map content (Consensus.allowed_preendorsements ctxt) + find_in_slot_map content (Consensus.allowed_preattestations ctxt) in let*? ctxt = - Consensus.record_preendorsement + Consensus.record_preattestation ctxt ~initial_slot:content.slot ~power diff --git a/src/proto_alpha/lib_protocol/main.ml b/src/proto_alpha/lib_protocol/main.ml index 741d14c1518c..923ea9f6a972 100644 --- a/src/proto_alpha/lib_protocol/main.ml +++ b/src/proto_alpha/lib_protocol/main.ml @@ -144,7 +144,7 @@ let init_consensus_rights_for_block ctxt mode ~predecessor_level = in return (Option.is_some locked_round) in - let* ctxt, allowed_preendorsements = + let* ctxt, allowed_preattestations = if can_contain_preendorsements then let* ctxt, preendorsements_map = Baking.endorsing_rights_by_first_slot ctxt (Level.current ctxt) @@ -156,7 +156,7 @@ let init_consensus_rights_for_block ctxt mode ~predecessor_level = Consensus.initialize_consensus_operation ctxt ~allowed_endorsements:(Some endorsements_map) - ~allowed_preendorsements + ~allowed_preattestations in return ctxt @@ -178,7 +178,7 @@ let init_consensus_rights_for_mempool ctxt ~predecessor_level = Consensus.initialize_consensus_operation ctxt ~allowed_endorsements:None - ~allowed_preendorsements:None + ~allowed_preattestations:None in (* However, we want to ensure that the cycle rights are loaded in the context, so that {!Stake_distribution.slot_owner} doesn't diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 356b4914fb91..24b6db99a3e7 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -92,26 +92,26 @@ module Raw_consensus = struct for the lowest slot in the block can be recorded. The map associates to each initial slot the [pkh] associated to this slot with its power. This is [None] only in mempool mode. *) - allowed_preendorsements : (consensus_pk * int) Slot_repr.Map.t option; - (** Preendorsements rights for the current block. Only a preendorsement + allowed_preattestations : (consensus_pk * int) Slot_repr.Map.t option; + (** Preattestations rights for the current block. Only a preattestation for the lowest slot in the block can be recorded. The map associates to each initial slot the [pkh] associated to this slot with its power. This is [None] only in mempool mode, or in application mode when there is no locked round (so the block - cannot contain any preendorsements). *) + cannot contain any preattestations). *) forbidden_delegates : Signature.Public_key_hash.Set.t; (** Delegates that are not allowed to bake or endorse blocks; i.e., delegates which have zero frozen deposit due to a previous slashing. *) endorsements_seen : Slot_repr.Set.t; (** Record the endorsements already seen. Only initial slots are indexed. *) - preendorsements_seen : Slot_repr.Set.t; - (** Record the preendorsements already seen. Only initial slots + preattestations_seen : Slot_repr.Set.t; + (** Record the preattestations already seen. Only initial slots are indexed. *) locked_round_evidence : (Round_repr.t * int) option; - (** Record the preendorsement power for a locked round. *) - preendorsements_quorum_round : Round_repr.t option; - (** in block construction mode, record the round of preendorsements + (** Record the preattestation power for a locked round. *) + preattestations_quorum_round : Round_repr.t option; + (** in block construction mode, record the round of preattestations included in a block. *) endorsement_branch : (Block_hash.t * Block_payload_hash.t) option; } @@ -120,7 +120,7 @@ module Raw_consensus = struct - [slot \in endorsements_seen => Int_map.mem slot allowed_endorsements] - - [slot \in preendorsements_seen => Int_map.mem slot allowed_preendorsements] + - [slot \in preattestations_seen => Int_map.mem slot allowed_preattestations] - [ |endorsements_seen| > 0 => |included endorsements| > 0] @@ -130,12 +130,12 @@ module Raw_consensus = struct { current_endorsement_power = 0; allowed_endorsements = Some Slot_repr.Map.empty; - allowed_preendorsements = Some Slot_repr.Map.empty; + allowed_preattestations = Some Slot_repr.Map.empty; forbidden_delegates = Signature.Public_key_hash.Set.empty; endorsements_seen = Slot_repr.Set.empty; - preendorsements_seen = Slot_repr.Set.empty; + preattestations_seen = Slot_repr.Set.empty; locked_round_evidence = None; - preendorsements_quorum_round = None; + preattestations_quorum_round = None; endorsement_branch = None; } @@ -165,9 +165,9 @@ module Raw_consensus = struct endorsements_seen = Slot_repr.Set.add initial_slot t.endorsements_seen; } - let record_preendorsement ~initial_slot ~power round t = + let record_preattestation ~initial_slot ~power round t = error_when - (Slot_repr.Set.mem initial_slot t.preendorsements_seen) + (Slot_repr.Set.mem initial_slot t.preattestations_seen) Double_inclusion_of_consensus_operation >|? fun () -> let locked_round_evidence = @@ -183,8 +183,8 @@ module Raw_consensus = struct { t with locked_round_evidence; - preendorsements_seen = - Slot_repr.Set.add initial_slot t.preendorsements_seen; + preattestations_seen = + Slot_repr.Set.add initial_slot t.preattestations_seen; } let set_forbidden_delegates delegates t = @@ -197,18 +197,18 @@ module Raw_consensus = struct Signature.Public_key_hash.Set.add delegate t.forbidden_delegates; } - let set_preendorsements_quorum_round round t = - match t.preendorsements_quorum_round with + let set_preattestations_quorum_round round t = + match t.preattestations_quorum_round with | Some round' -> (* If the rounds are different, an error should have already been raised. *) assert (Round_repr.equal round round') ; t - | None -> {t with preendorsements_quorum_round = Some round} + | None -> {t with preattestations_quorum_round = Some round} - let initialize_with_endorsements_and_preendorsements ~allowed_endorsements - ~allowed_preendorsements t = - {t with allowed_endorsements; allowed_preendorsements} + let initialize_with_endorsements_and_preattestations ~allowed_endorsements + ~allowed_preattestations t = + {t with allowed_endorsements; allowed_preattestations} let locked_round_evidence t = t.locked_round_evidence @@ -1401,7 +1401,7 @@ module type CONSENSUS = sig val allowed_endorsements : t -> (consensus_pk * int) slot_map option - val allowed_preendorsements : t -> (consensus_pk * int) slot_map option + val allowed_preattestations : t -> (consensus_pk * int) slot_map option val forbidden_delegates : t -> Signature.Public_key_hash.Set.t @@ -1412,12 +1412,12 @@ module type CONSENSUS = sig val initialize_consensus_operation : t -> allowed_endorsements:(consensus_pk * int) slot_map option -> - allowed_preendorsements:(consensus_pk * int) slot_map option -> + allowed_preattestations:(consensus_pk * int) slot_map option -> t val record_endorsement : t -> initial_slot:slot -> power:int -> t tzresult - val record_preendorsement : + val record_preattestation : t -> initial_slot:slot -> power:int -> round -> t tzresult val forbid_delegate : t -> Signature.Public_key_hash.t -> t @@ -1426,9 +1426,9 @@ module type CONSENSUS = sig val endorsements_seen : t -> slot_set - val get_preendorsements_quorum_round : t -> round option + val get_preattestations_quorum_round : t -> round option - val set_preendorsements_quorum_round : t -> round -> t + val set_preattestations_quorum_round : t -> round -> t val locked_round_evidence : t -> (round * int) option @@ -1455,8 +1455,8 @@ module Consensus : let[@inline] allowed_endorsements ctxt = ctxt.back.consensus.allowed_endorsements - let[@inline] allowed_preendorsements ctxt = - ctxt.back.consensus.allowed_preendorsements + let[@inline] allowed_preattestations ctxt = + ctxt.back.consensus.allowed_preattestations let[@inline] forbidden_delegates ctxt = ctxt.back.consensus.forbidden_delegates @@ -1467,24 +1467,24 @@ module Consensus : let[@inline] current_endorsement_power ctxt = ctxt.back.consensus.current_endorsement_power - let[@inline] get_preendorsements_quorum_round ctxt = - ctxt.back.consensus.preendorsements_quorum_round + let[@inline] get_preattestations_quorum_round ctxt = + ctxt.back.consensus.preattestations_quorum_round let[@inline] locked_round_evidence ctxt = Raw_consensus.locked_round_evidence ctxt.back.consensus let[@inline] initialize_consensus_operation ctxt ~allowed_endorsements - ~allowed_preendorsements = + ~allowed_preattestations = update_consensus_with ctxt - (Raw_consensus.initialize_with_endorsements_and_preendorsements + (Raw_consensus.initialize_with_endorsements_and_preattestations ~allowed_endorsements - ~allowed_preendorsements) + ~allowed_preattestations) - let[@inline] record_preendorsement ctxt ~initial_slot ~power round = + let[@inline] record_preattestation ctxt ~initial_slot ~power round = update_consensus_with_tzresult ctxt - (Raw_consensus.record_preendorsement ~initial_slot ~power round) + (Raw_consensus.record_preattestation ~initial_slot ~power round) let[@inline] record_endorsement ctxt ~initial_slot ~power = update_consensus_with_tzresult @@ -1496,10 +1496,10 @@ module Consensus : let[@inline] endorsements_seen ctxt = ctxt.back.consensus.endorsements_seen - let[@inline] set_preendorsements_quorum_round ctxt round = + let[@inline] set_preattestations_quorum_round ctxt round = update_consensus_with ctxt - (Raw_consensus.set_preendorsements_quorum_round round) + (Raw_consensus.set_preattestations_quorum_round round) let[@inline] endorsement_branch ctxt = Raw_consensus.endorsement_branch ctxt.back.consensus diff --git a/src/proto_alpha/lib_protocol/raw_context.mli b/src/proto_alpha/lib_protocol/raw_context.mli index 7c5f51083641..9dffd3b57ccc 100644 --- a/src/proto_alpha/lib_protocol/raw_context.mli +++ b/src/proto_alpha/lib_protocol/raw_context.mli @@ -329,7 +329,7 @@ module type CONSENSUS = sig (** Returns a map where each endorser's pkh is associated to the list of its endorsing slots (in decreasing order) for a given level. *) - val allowed_preendorsements : t -> (consensus_pk * int) slot_map option + val allowed_preattestations : t -> (consensus_pk * int) slot_map option (** Returns the set of delegates that are not allowed to bake or endorse blocks; i.e., delegates which have zero frozen deposit @@ -343,13 +343,13 @@ module type CONSENSUS = sig current block. *) val current_endorsement_power : t -> int - (** Initializes the map of allowed endorsements and preendorsements, + (** Initializes the map of allowed endorsements and preattestations, this function must be called only once and before applying any consensus operation. *) val initialize_consensus_operation : t -> allowed_endorsements:(consensus_pk * int) slot_map option -> - allowed_preendorsements:(consensus_pk * int) slot_map option -> + allowed_preattestations:(consensus_pk * int) slot_map option -> t (** [record_endorsement ctx ~initial_slot ~power] records an @@ -360,14 +360,14 @@ module type CONSENSUS = sig (pkh, power)]. *) val record_endorsement : t -> initial_slot:slot -> power:int -> t tzresult - (** [record_preendorsement ctx ~initial_slot ~power round - payload_hash power] records a preendorsement for a proposal at + (** [record_preattestation ctx ~initial_slot ~power round + payload_hash power] records a preattestation for a proposal at [round] with payload [payload_hash]. - The preendorsement should be valid in the sense that - [Int_map.find_opt initial_slot allowed_preendorsement ctx = Some + The preattestation should be valid in the sense that + [Int_map.find_opt initial_slot allowed_preattestation ctx = Some (pkh, power)]. *) - val record_preendorsement : + val record_preattestation : t -> initial_slot:slot -> power:int -> round -> t tzresult (** [forbid_delegate ctx delegate] adds [delegate] to the set of @@ -381,21 +381,21 @@ module type CONSENSUS = sig val endorsements_seen : t -> slot_set - (** [get_preendorsements_quorum_round ctx] returns [None] if no - preendorsement are included in the current block. Otherwise, - return [Some r] where [r] is the round of the preendorsements + (** [get_preattestations_quorum_round ctx] returns [None] if no + preattestation are included in the current block. Otherwise, + return [Some r] where [r] is the round of the preattestations included in the block. *) - val get_preendorsements_quorum_round : t -> round option + val get_preattestations_quorum_round : t -> round option - (** [set_preendorsements_quorum_round ctx round] sets the round for - preendorsements included in this block. This function should be + (** [set_preattestations_quorum_round ctx round] sets the round for + preattestations included in this block. This function should be called only once. This function is only used in [Full_construction] mode. *) - val set_preendorsements_quorum_round : t -> round -> t + val set_preattestations_quorum_round : t -> round -> t (** [locked_round_evidence ctx] returns the round of the recorded - preendorsements as well as their power. *) + preattestations as well as their power. *) val locked_round_evidence : t -> (round * int) option val set_endorsement_branch : t -> Block_hash.t * Block_payload_hash.t -> t diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index 95f2f16c365e..1938d970bbd4 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -37,7 +37,7 @@ let init_consensus_info ctxt (predecessor_level, predecessor_round) = { predecessor_level; predecessor_round; - preendorsement_slot_map = Consensus.allowed_preendorsements ctxt; + preendorsement_slot_map = Consensus.allowed_preattestations ctxt; endorsement_slot_map = Consensus.allowed_endorsements ctxt; } -- GitLab From 6bb65b29e70ab7f4e88cd1e08a1deea1c4a80e54 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 3 Jul 2023 14:13:52 +0200 Subject: [PATCH 5/9] alpha: rename preendorsement in validate --- src/proto_alpha/lib_protocol/validate.ml | 146 +++++++++++----------- src/proto_alpha/lib_protocol/validate.mli | 2 +- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index 1938d970bbd4..13f1c73de486 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -29,7 +29,7 @@ open Alpha_context type consensus_info = { predecessor_level : Raw_level.t; predecessor_round : Round.t; - preendorsement_slot_map : (Consensus_key.pk * int) Slot.Map.t option; + preattestation_slot_map : (Consensus_key.pk * int) Slot.Map.t option; endorsement_slot_map : (Consensus_key.pk * int) Slot.Map.t option; } @@ -37,17 +37,17 @@ let init_consensus_info ctxt (predecessor_level, predecessor_round) = { predecessor_level; predecessor_round; - preendorsement_slot_map = Consensus.allowed_preattestations ctxt; + preattestation_slot_map = Consensus.allowed_preattestations ctxt; endorsement_slot_map = Consensus.allowed_endorsements ctxt; } (** Map used to detect consensus operation conflicts. Each delegate may (pre)endorse at most once for each level and round, so two - endorsements (resp. two preendorsements) conflict when they have + endorsements (resp. two preattestations) conflict when they have the same slot, level, and round. Note that when validating a block, all endorsements (resp. all - preendorsements) must have the same level and round anyway, so only + preattestations) must have the same level and round anyway, so only the slot is relevant. Taking the level and round into account is useful in mempool mode, because we want to be able to accept and propagate consensus operations for multiple close @@ -62,7 +62,7 @@ module Consensus_conflict_map = Map.Make (struct end) type consensus_state = { - preendorsements_seen : Operation_hash.t Consensus_conflict_map.t; + preattestations_seen : Operation_hash.t Consensus_conflict_map.t; endorsements_seen : Operation_hash.t Consensus_conflict_map.t; dal_attestation_seen : Operation_hash.t Signature.Public_key_hash.Map.t; } @@ -83,10 +83,10 @@ let consensus_state_encoding = let open Data_encoding in def "consensus_state" @@ conv - (fun {preendorsements_seen; endorsements_seen; dal_attestation_seen} -> - (preendorsements_seen, endorsements_seen, dal_attestation_seen)) - (fun (preendorsements_seen, endorsements_seen, dal_attestation_seen) -> - {preendorsements_seen; endorsements_seen; dal_attestation_seen}) + (fun {preattestations_seen; endorsements_seen; dal_attestation_seen} -> + (preattestations_seen, endorsements_seen, dal_attestation_seen)) + (fun (preattestations_seen, endorsements_seen, dal_attestation_seen) -> + {preattestations_seen; endorsements_seen; dal_attestation_seen}) (obj3 (req "preendorsements_seen" consensus_conflict_map_encoding) (req "endorsements_seen" consensus_conflict_map_encoding) @@ -96,7 +96,7 @@ let consensus_state_encoding = let empty_consensus_state = { - preendorsements_seen = Consensus_conflict_map.empty; + preattestations_seen = Consensus_conflict_map.empty; endorsements_seen = Consensus_conflict_map.empty; dal_attestation_seen = Signature.Public_key_hash.Map.empty; } @@ -424,7 +424,7 @@ let init_block_state vi = let get_initial_ctxt {info; _} = info.ctxt (** Validation of consensus operations (validation pass [0]): - preendorsement, endorsement, and dal_attestation. *) + preattestation, endorsement, and dal_attestation. *) module Consensus = struct open Validate_errors.Consensus @@ -443,7 +443,7 @@ module Consensus = struct (** When validating a block (ie. in [Application], [Partial_validation], and [Construction] modes), any - preendorsements must point to a round that is strictly before the + preattestations must point to a round that is strictly before the block's round. *) let check_round_before_block ~block_round provided = error_unless @@ -471,11 +471,11 @@ module Consensus = struct (Block_payload_hash.equal expected provided) (Wrong_payload_hash_for_consensus_operation {kind; expected; provided}) - (** Preendorsement checks for both [Application] and + (** Preattestation checks for both [Application] and [Partial_validation] modes. Return the slot owner's consensus key and voting power. *) - let check_preexisting_block_preendorsement vi consensus_info block_info + let check_preexisting_block_preattestation vi consensus_info block_info {level; round; block_payload_hash = bph; slot} = let open Lwt_result_syntax in let*? locked_round = @@ -483,7 +483,7 @@ module Consensus = struct | Some locked_round -> ok locked_round | None -> (* A preexisting block whose fitness has no locked round - should contain no preendorsements. *) + should contain no preattestations. *) error Unexpected_preattestation_in_block in let kind = Preattestation in @@ -493,24 +493,24 @@ module Consensus = struct let expected_payload_hash = block_info.header_contents.payload_hash in let*? () = check_payload_hash kind expected_payload_hash bph in let*? consensus_key, voting_power = - get_delegate_details consensus_info.preendorsement_slot_map kind slot + get_delegate_details consensus_info.preattestation_slot_map kind slot in let* () = check_frozen_deposits_are_positive vi.ctxt consensus_key.delegate in return (consensus_key, voting_power) - (** Preendorsement checks for Construction mode. + (** Preattestation checks for Construction mode. Return the slot owner's consensus key and voting power. *) - let check_constructed_block_preendorsement vi consensus_info cons_info + let check_constructed_block_preattestation vi consensus_info cons_info {level; round; block_payload_hash = bph; slot} = let open Lwt_result_syntax in let expected_payload_hash = cons_info.header_contents.payload_hash in let*? () = (* When the proposal is fresh, a fake [payload_hash] of [zero] has been provided. In this case, the block should not contain - any preendorsements. *) + any preattestations. *) error_when Block_payload_hash.(expected_payload_hash = zero) Unexpected_preattestation_in_block @@ -521,17 +521,17 @@ module Consensus = struct (* We cannot check the exact round here in construction mode, because there is no preexisting fitness to provide the locked_round. We do however check that all preendorments have the same round in - [check_construction_preendorsement_round_consistency] further below. *) + [check_construction_preattestation_round_consistency] further below. *) let*? () = check_payload_hash kind expected_payload_hash bph in let*? consensus_key, voting_power = - get_delegate_details consensus_info.preendorsement_slot_map kind slot + get_delegate_details consensus_info.preattestation_slot_map kind slot in let* () = check_frozen_deposits_are_positive vi.ctxt consensus_key.delegate in return (consensus_key, voting_power) - (** Preendorsement/endorsement checks for Mempool mode. + (** Preattestation/endorsement checks for Mempool mode. We want this mode to be very permissive, to allow the mempool to accept and propagate consensus operations even if they point to a @@ -577,7 +577,7 @@ module Consensus = struct contains the operation, which may not be the same as the current mempool's context. *) - let check_preendorsement vi ~check_signature + let check_preattestation vi ~check_signature (operation : Kind.preattestation operation) = let open Lwt_result_syntax in let*? consensus_info = @@ -591,13 +591,13 @@ module Consensus = struct let* consensus_key, voting_power = match vi.mode with | Application block_info | Partial_validation block_info -> - check_preexisting_block_preendorsement + check_preexisting_block_preattestation vi consensus_info block_info consensus_content | Construction construction_info -> - check_constructed_block_preendorsement + check_constructed_block_preattestation vi consensus_info construction_info @@ -619,7 +619,7 @@ module Consensus = struct in return voting_power - let check_preendorsement_conflict vs oph (op : Kind.preattestation operation) + let check_preattestation_conflict vs oph (op : Kind.preattestation operation) = let (Single (Preattestation {slot; level; round; _})) = op.protocol_data.contents @@ -627,30 +627,30 @@ module Consensus = struct match Consensus_conflict_map.find_opt (slot, level, round) - vs.consensus_state.preendorsements_seen + vs.consensus_state.preattestations_seen with | Some existing -> Error (Operation_conflict {existing; new_operation = oph}) | None -> ok_unit - let wrap_preendorsement_conflict = function + let wrap_preattestation_conflict = function | Ok () -> ok_unit | Error conflict -> error Validate_errors.Consensus.( Conflicting_consensus_operation {kind = Preattestation; conflict}) - let add_preendorsement vs oph (op : Kind.preattestation operation) = + let add_preattestation vs oph (op : Kind.preattestation operation) = let (Single (Preattestation {slot; level; round; _})) = op.protocol_data.contents in - let preendorsements_seen = + let preattestations_seen = Consensus_conflict_map.add (slot, level, round) oph - vs.consensus_state.preendorsements_seen + vs.consensus_state.preattestations_seen in - {vs with consensus_state = {vs.consensus_state with preendorsements_seen}} + {vs with consensus_state = {vs.consensus_state with preattestations_seen}} let may_update_locked_round_evidence block_state mode (consensus_content : consensus_content) voting_power = @@ -663,27 +663,27 @@ module Consensus = struct | Some (_stored_round, evidences) -> (* [_stored_round] is always equal to [consensus_content.round]. Indeed, this is ensured by - {!check_preendorsement_content_preexisting_block} in + {!check_preattestation_content_preexisting_block} in application and partial validation modes, and by - {!check_construction_preendorsement_round_consistency} in + {!check_construction_preattestation_round_consistency} in construction mode. *) Some (consensus_content.round, evidences + voting_power)) in {block_state with locked_round_evidence} (* Hypothesis: this function will only be called in mempool mode *) - let remove_preendorsement vs (operation : Kind.preattestation operation) = + let remove_preattestation vs (operation : Kind.preattestation operation) = (* As we are in mempool mode, we do not update [locked_round_evidence]. *) let (Single (Preattestation {slot; level; round; _})) = operation.protocol_data.contents in - let preendorsements_seen = + let preattestations_seen = Consensus_conflict_map.remove (slot, level, round) - vs.consensus_state.preendorsements_seen + vs.consensus_state.preattestations_seen in - {vs with consensus_state = {vs.consensus_state with preendorsements_seen}} + {vs with consensus_state = {vs.consensus_state with preattestations_seen}} (** Endorsement checks for all modes that involve a block: Application, Partial_validation, and Construction. @@ -870,47 +870,47 @@ module Consensus = struct in {vs with consensus_state = {vs.consensus_state with dal_attestation_seen}} - (** In Construction mode, check that the preendorsement has the same - round as any previously validated preendorsements. + (** In Construction mode, check that the preattestation has the same + round as any previously validated preattestations. This check is not needed in other modes because - {!check_preendorsement} already checks that all preendorsements + {!check_preattestation} already checks that all preattestations have the same expected round (the locked_round in Application and Partial_validation modes when there is one (otherwise all - preendorsements are rejected so the point is moot), or the + preattestations are rejected so the point is moot), or the predecessor_round in Mempool mode). *) - let check_construction_preendorsement_round_consistency vi block_state + let check_construction_preattestation_round_consistency vi block_state (consensus_content : consensus_content) = let open Result_syntax in match vi.mode with | Construction _ -> ( match block_state.locked_round_evidence with | None -> - (* This is the first validated preendorsement: + (* This is the first validated preattestation: there is nothing to check. *) return_unit | Some (expected, _power) -> - (* Other preendorsements have already been validated: we check + (* Other preattestations have already been validated: we check that the current operation has the same round as them. *) check_round Preattestation expected consensus_content.round) | Application _ | Partial_validation _ | Mempool -> return_unit - let validate_preendorsement ~check_signature info operation_state block_state + let validate_preattestation ~check_signature info operation_state block_state oph (operation : Kind.preattestation operation) = let open Lwt_result_syntax in let (Single (Preattestation consensus_content)) = operation.protocol_data.contents in - let* voting_power = check_preendorsement info ~check_signature operation in + let* voting_power = check_preattestation info ~check_signature operation in let*? () = - check_construction_preendorsement_round_consistency + check_construction_preattestation_round_consistency info block_state consensus_content in let*? () = - check_preendorsement_conflict operation_state oph operation - |> wrap_preendorsement_conflict + check_preattestation_conflict operation_state oph operation + |> wrap_preattestation_conflict in (* We need to update the block state *) let block_state = @@ -920,7 +920,7 @@ module Consensus = struct consensus_content voting_power in - let operation_state = add_preendorsement operation_state oph operation in + let operation_state = add_preattestation operation_state oph operation in return {info; operation_state; block_state} let validate_endorsement ~check_signature info operation_state block_state oph @@ -2449,7 +2449,7 @@ let check_operation ?(check_signature = true) info (type kind) match operation.protocol_data.contents with | Single (Preattestation _) -> let* (_voting_power : int) = - Consensus.check_preendorsement info ~check_signature operation + Consensus.check_preattestation info ~check_signature operation in return_unit | Single (Endorsement _) -> @@ -2504,7 +2504,7 @@ let check_operation_conflict (type kind) operation_conflict_state oph (operation : kind operation) = match operation.protocol_data.contents with | Single (Preattestation _) -> - Consensus.check_preendorsement_conflict + Consensus.check_preattestation_conflict operation_conflict_state oph operation @@ -2570,7 +2570,7 @@ let add_valid_operation operation_conflict_state oph (type kind) (operation : kind operation) = match operation.protocol_data.contents with | Single (Preattestation _) -> - Consensus.add_preendorsement operation_conflict_state oph operation + Consensus.add_preattestation operation_conflict_state oph operation | Single (Endorsement _) -> Consensus.add_endorsement operation_conflict_state oph operation | Single (Dal_attestation _) -> @@ -2615,7 +2615,7 @@ let remove_operation operation_conflict_state (type kind) (operation : kind operation) = match operation.protocol_data.contents with | Single (Preattestation _) -> - Consensus.remove_preendorsement operation_conflict_state operation + Consensus.remove_preattestation operation_conflict_state operation | Single (Endorsement _) -> Consensus.remove_endorsement operation_conflict_state operation | Single (Dal_attestation _) -> @@ -2701,7 +2701,7 @@ let validate_operation ?(check_signature = true) | (Application _ | Partial_validation _ | Construction _ | Mempool), _ -> ( match operation.protocol_data.contents with | Single (Preattestation _) -> - Consensus.validate_preendorsement + Consensus.validate_preattestation ~check_signature info operation_state @@ -2871,50 +2871,50 @@ let check_endorsement_power vi bs = else return_unit (** Check that the locked round in the fitness and the locked round - observed in the preendorsements are the same. + observed in the preattestations are the same. This check is not called in construction mode because there is no provided fitness (meaning that we do not know whether the block - should contain any preendorsements). + should contain any preattestations). When the observed locked round is [Some _], we actually already know that it is identical to the fitness locked round, otherwise - {!Consensus.check_preexisting_block_preendorsement} would have - rejected the preendorsements. But this check is needed to reject + {!Consensus.check_preexisting_block_preattestation} would have + rejected the preattestations. But this check is needed to reject blocks where the fitness locked round has a value yet there are no - preendorsements (ie. the observed locked round is [None]). *) + preattestations (ie. the observed locked round is [None]). *) let check_fitness_locked_round bs fitness_locked_round = let observed_locked_round = Option.map fst bs.locked_round_evidence in error_unless (Option.equal Round.equal observed_locked_round fitness_locked_round) Fitness.Wrong_fitness -(** When there are preendorsements, check that they point to a round +(** When there are preattestations, check that they point to a round before the block's round, and that their total power is high enough. Note that this function does not check whether the block actually contains preendorments when they are mandatory. This is checked by {!check_fitness_locked_round} instead. *) -let check_preendorsement_round_and_power vi vs round = +let check_preattestation_round_and_power vi vs round = let open Result_syntax in match vs.locked_round_evidence with | None -> ok_unit - | Some (preendorsement_round, preendorsement_count) -> + | Some (preattestation_round, preattestation_count) -> let* () = (* Actually, this check should never fail, because we have already called {!Consensus.check_round_before_block} for - all preendorsements in a block. Nevertheless, it does not + all preattestations in a block. Nevertheless, it does not cost much to check again here. *) error_when - Round.(preendorsement_round >= round) + Round.(preattestation_round >= round) (Locked_round_after_block_round - {locked_round = preendorsement_round; round}) + {locked_round = preattestation_round; round}) in let consensus_threshold = Constants.consensus_threshold vi.ctxt in error_when - Compare.Int.(preendorsement_count < consensus_threshold) + Compare.Int.(preattestation_count < consensus_threshold) (Insufficient_locked_round_evidence - {voting_power = preendorsement_count; consensus_threshold}) + {voting_power = preattestation_count; consensus_threshold}) let check_payload_hash block_state ~predecessor_hash (block_header_contents : Block_header.contents) = @@ -2935,7 +2935,7 @@ let finalize_block {info; block_state; _} = | Application {round; locked_round; predecessor_hash; header_contents} -> let* () = check_endorsement_power info block_state in let*? () = check_fitness_locked_round block_state locked_round in - let*? () = check_preendorsement_round_and_power info block_state round in + let*? () = check_preattestation_round_and_power info block_state round in let*? () = check_payload_hash block_state ~predecessor_hash header_contents in @@ -2943,18 +2943,18 @@ let finalize_block {info; block_state; _} = | Partial_validation {round; locked_round; _} -> let* () = check_endorsement_power info block_state in let*? () = check_fitness_locked_round block_state locked_round in - let*? () = check_preendorsement_round_and_power info block_state round in + let*? () = check_preattestation_round_and_power info block_state round in return_unit | Construction {round; predecessor_hash; header_contents} -> let* () = check_endorsement_power info block_state in - let*? () = check_preendorsement_round_and_power info block_state round in + let*? () = check_preattestation_round_and_power info block_state round in let*? () = match block_state.locked_round_evidence with | Some _ -> check_payload_hash block_state ~predecessor_hash header_contents | None -> (* In construction mode, when there is no locked round - evidence (ie. no preendorsements), the baker cannot know + evidence (ie. no preattestations), the baker cannot know the payload hash before selecting the operations. Therefore, we do not check the initially given payload hash. The baker will have to patch the resulting block diff --git a/src/proto_alpha/lib_protocol/validate.mli b/src/proto_alpha/lib_protocol/validate.mli index 00afeaa8448c..c06eb6ad203f 100644 --- a/src/proto_alpha/lib_protocol/validate.mli +++ b/src/proto_alpha/lib_protocol/validate.mli @@ -243,7 +243,7 @@ val begin_partial_construction : (** Similar to [begin_partial_construction] but do not require predecessor information that is essential to the validation of - preendorsement and endorsement operations. As a consequence, the + preattestation and endorsement operations. As a consequence, the validation of these operations will always fail. This function is used by the plugin RPC [run_operation], which -- GitLab From 26b25f9dc4be4ef6db688e5b2dbb89403c6c4e4f Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 3 Jul 2023 14:16:00 +0200 Subject: [PATCH 6/9] alpha: rename preendorsement in apply_results --- src/proto_alpha/lib_client/operation_result.ml | 4 ++-- src/proto_alpha/lib_protocol/apply.ml | 2 +- src/proto_alpha/lib_protocol/apply_results.ml | 18 +++++++++--------- src/proto_alpha/lib_protocol/apply_results.mli | 2 +- .../lib_sc_rollup_node/sc_rollup_injector.ml | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 78a69b171498..42170555aea8 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -872,11 +872,11 @@ let pp_contents_and_result : pp_balance_updates bus | ( Preattestation {level; _}, - Preendorsement_result + Preattestation_result {balance_updates; delegate; consensus_key; consensus_power} ) -> Format.fprintf ppf - "@[Preendorsement:@,\ + "@[Preattestation:@,\ Level: %a@,\ Balance updates:%a@,\ Delegate: %a@,\ diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index af3a88272765..0d40c3425d07 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -2012,7 +2012,7 @@ let record_preendorsement ctxt (mode : mode) (content : consensus_content) : let mk_preendorsement_result ({delegate; consensus_pkh; _} : Consensus_key.pk) consensus_power = Single_result - (Preendorsement_result + (Preattestation_result { balance_updates = []; delegate; diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 188b9b23dee9..b7b34a4ac44c 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -850,7 +850,7 @@ let successful_manager_operation_result_encoding : ] type 'kind contents_result = - | Preendorsement_result : { + | Preattestation_result : { balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; @@ -1025,7 +1025,7 @@ module Encoding = struct encoding = consensus_result_encoding_legacy "preendorsement"; select = (function - | Contents_result (Preendorsement_result _ as op) -> Some op + | Contents_result (Preattestation_result _ as op) -> Some op | _ -> None); mselect = (function @@ -1033,12 +1033,12 @@ module Encoding = struct | _ -> None); proj = (function - | Preendorsement_result + | Preattestation_result {balance_updates; delegate; consensus_key; consensus_power} -> (balance_updates, delegate, consensus_power, consensus_key)); inj = (fun (balance_updates, delegate, consensus_power, consensus_key) -> - Preendorsement_result + Preattestation_result {balance_updates; delegate; consensus_key; consensus_power}); } @@ -1049,7 +1049,7 @@ module Encoding = struct encoding = consensus_result_encoding; select = (function - | Contents_result (Preendorsement_result _ as op) -> Some op + | Contents_result (Preattestation_result _ as op) -> Some op | _ -> None); mselect = (function @@ -1057,12 +1057,12 @@ module Encoding = struct | _ -> None); proj = (function - | Preendorsement_result + | Preattestation_result {balance_updates; delegate; consensus_key; consensus_power} -> (balance_updates, delegate, consensus_power, consensus_key)); inj = (fun (balance_updates, delegate, consensus_power, consensus_key) -> - Preendorsement_result + Preattestation_result {balance_updates; delegate; consensus_key; consensus_power}); } @@ -1400,7 +1400,7 @@ module Encoding = struct Some (Manager_operation_result {op with operation_result = Failed (kind, errs)})) - | Contents_result (Preendorsement_result _) -> None + | Contents_result (Preattestation_result _) -> None | Contents_result (Endorsement_result _) -> None | Contents_result (Dal_attestation_result _) -> None | Contents_result Ballot_result -> None @@ -1896,7 +1896,7 @@ let kind_equal : match (op, res) with | Endorsement _, Endorsement_result _ -> Some Eq | Endorsement _, _ -> None - | Preattestation _, Preendorsement_result _ -> Some Eq + | Preattestation _, Preattestation_result _ -> Some Eq | Preattestation _, _ -> None | Dal_attestation _, Dal_attestation_result _ -> Some Eq | Dal_attestation _, _ -> None diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 09bb74fa7ed8..b5365624ab9e 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -58,7 +58,7 @@ and packed_contents_result_list = (** Result of applying an {!Operation.contents}. Follows the same structure. *) and 'kind contents_result = - | Preendorsement_result : { + | Preattestation_result : { balance_updates : Receipt.balance_updates; delegate : Signature.public_key_hash; consensus_key : Signature.public_key_hash; diff --git a/src/proto_alpha/lib_sc_rollup_node/sc_rollup_injector.ml b/src/proto_alpha/lib_sc_rollup_node/sc_rollup_injector.ml index b88c8e74322a..5e2dec4b6526 100644 --- a/src/proto_alpha/lib_sc_rollup_node/sc_rollup_injector.ml +++ b/src/proto_alpha/lib_sc_rollup_node/sc_rollup_injector.ml @@ -157,7 +157,7 @@ module Proto_client = struct let operation_result_status (type kind) (op_result : kind Apply_results.contents_result) : operation_status = match op_result with - | Preendorsement_result _ -> Successful + | Preattestation_result _ -> Successful | Endorsement_result _ -> Successful | Dal_attestation_result _ -> Successful | Seed_nonce_revelation_result _ -> Successful -- GitLab From 8c8b99e2892d445d2f2aa206febe7a709bffe642 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 3 Jul 2023 14:17:36 +0200 Subject: [PATCH 7/9] alpha: rename preendorsement in apply --- src/proto_alpha/lib_protocol/apply.ml | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 0d40c3425d07..b611fbb92d4d 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1998,7 +1998,7 @@ let find_in_slot_map consensus_content slot_map = error Faulty_validation_wrong_slot | Some (consensus_key, power) -> ok (consensus_key, power)) -let record_preendorsement ctxt (mode : mode) (content : consensus_content) : +let record_preattestation ctxt (mode : mode) (content : consensus_content) : (context * Kind.preattestation contents_result_list) tzresult Lwt.t = let open Lwt_result_syntax in let ctxt = @@ -2009,7 +2009,7 @@ let record_preendorsement ctxt (mode : mode) (content : consensus_content) : | Some _ -> ctxt) | Application _ | Partial_construction _ -> ctxt in - let mk_preendorsement_result ({delegate; consensus_pkh; _} : Consensus_key.pk) + let mk_preattestation_result ({delegate; consensus_pkh; _} : Consensus_key.pk) consensus_power = Single_result (Preattestation_result @@ -2032,20 +2032,20 @@ let record_preendorsement ctxt (mode : mode) (content : consensus_content) : ~power content.round in - return (ctxt, mk_preendorsement_result consensus_key power) + return (ctxt, mk_preattestation_result consensus_key power) | Partial_construction _ -> - (* In mempool mode, preendorsements are allowed for various levels - and rounds. We do not record preendorsements because we could get - false-positive conflicts for preendorsements with the same slot - but different levels/rounds. We could record just preendorsements + (* In mempool mode, preattestations are allowed for various levels + and rounds. We do not record preattestations because we could get + false-positive conflicts for preattestations with the same slot + but different levels/rounds. We could record just preattestations for the mempool head's level and round (the most usual - preendorsements), but we don't need to, because there is no block + preattestations), but we don't need to, because there is no block to finalize anyway in this mode. *) let* ctxt, consensus_key = let level = Level.from_raw ctxt content.level in Stake_distribution.slot_owner ctxt level content.slot in - return (ctxt, mk_preendorsement_result consensus_key 0 (* Fake power. *)) + return (ctxt, mk_preattestation_result consensus_key 0 (* Fake power. *)) let record_endorsement ctxt (mode : mode) (content : consensus_content) : (context * Kind.attestation contents_result_list) tzresult Lwt.t = @@ -2125,7 +2125,7 @@ let punish_delegate ctxt delegate level mistake mk_result ~payload_producer = >|=? fun (ctxt, balance_updates) -> (ctxt, Single_result (mk_result balance_updates)) -let punish_double_endorsement_or_preendorsement (type kind) ctxt +let punish_double_endorsement_or_preattestation (type kind) ctxt ~(op1 : kind Kind.consensus Operation.t) ~payload_producer : (context * kind Kind.double_consensus_operation_evidence contents_result_list) @@ -2179,7 +2179,7 @@ let apply_contents_list (type kind) ctxt chain_id (mode : mode) in match contents_list with | Single (Preattestation consensus_content) -> - record_preendorsement ctxt mode consensus_content + record_preattestation ctxt mode consensus_content | Single (Endorsement consensus_content) -> record_endorsement ctxt mode consensus_content | Single (Dal_attestation op) -> @@ -2220,9 +2220,9 @@ let apply_contents_list (type kind) ctxt chain_id (mode : mode) >|=? fun (ctxt, balance_updates) -> (ctxt, Single_result (Vdf_revelation_result balance_updates)) | Single (Double_preendorsement_evidence {op1; op2 = _}) -> - punish_double_endorsement_or_preendorsement ctxt ~op1 ~payload_producer + punish_double_endorsement_or_preattestation ctxt ~op1 ~payload_producer | Single (Double_endorsement_evidence {op1; op2 = _}) -> - punish_double_endorsement_or_preendorsement ctxt ~op1 ~payload_producer + punish_double_endorsement_or_preattestation ctxt ~op1 ~payload_producer | Single (Double_baking_evidence {bh1; bh2 = _}) -> punish_double_baking ctxt bh1 ~payload_producer | Single (Activate_account {id = pkh; activation_code}) -> @@ -2593,7 +2593,7 @@ let begin_full_construction ctxt chain_id ~migration_balance_updates ~predecessor_round ~timestamp in - (* The endorsement/preendorsement validation rules for construction are the + (* The endorsement/preattestation validation rules for construction are the same as for application. *) let current_level = Level.current ctxt in let* ctxt, _slot, block_producer = @@ -2886,7 +2886,7 @@ let finalize_block (application_state : application_state) shell_header_opt = (* Fake finalization to return a correct type, because there is no block to finalize in mempool mode. If this changes in the future, beware that consensus operations are not recorded by - {!record_preendorsement} and {!record_endorsement} in this mode. *) + {!record_preattestation} and {!record_endorsement} in this mode. *) let* voting_period_info = Voting_period.get_rpc_current_info ctxt in let level_info = Level.current ctxt in let result = finalize ctxt predecessor_fitness in -- GitLab From 1d16a44e3bdfc4072589f5fea2152b2eb4bbc5c6 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 3 Jul 2023 14:19:50 +0200 Subject: [PATCH 8/9] alpha: rename preendorsement in main and other files --- .../delegate_slashed_deposits_storage.mli | 2 +- src/proto_alpha/lib_protocol/main.ml | 16 ++++++++-------- .../lib_protocol/mempool_validation.mli | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.mli b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.mli index 9f2166a871dc..a653250427c4 100644 --- a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.mli +++ b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.mli @@ -39,7 +39,7 @@ val already_slashed_for_double_baking : bool tzresult Lwt.t (** Returns true if the given delegate has already been slashed - for double preendorsing or double endorsing for the given level. *) + for double preattesting or double endorsing for the given level. *) val already_slashed_for_double_endorsing : Raw_context.t -> Signature.Public_key_hash.t -> diff --git a/src/proto_alpha/lib_protocol/main.ml b/src/proto_alpha/lib_protocol/main.ml index 923ea9f6a972..e1e5bd9387f1 100644 --- a/src/proto_alpha/lib_protocol/main.ml +++ b/src/proto_alpha/lib_protocol/main.ml @@ -124,19 +124,19 @@ type mode = validation, and full construction. In these modes, endorsements must point to the predecessor's level - and preendorsements, if any, to the block's level. *) + and preattestations, if any, to the block's level. *) let init_consensus_rights_for_block ctxt mode ~predecessor_level = let open Lwt_result_syntax in let open Alpha_context in let* ctxt, endorsements_map = Baking.endorsing_rights_by_first_slot ctxt predecessor_level in - let*? can_contain_preendorsements = + let*? can_contain_preattestations = match mode with | Construction _ | Partial_construction _ -> ok true | Application block_header | Partial_validation block_header -> (* A preexisting block, which has a complete and correct block - header, can only contain preendorsements when the locked + header, can only contain preattestations when the locked round in the fitness has an actual value. *) let open Result_syntax in let* locked_round = @@ -145,11 +145,11 @@ let init_consensus_rights_for_block ctxt mode ~predecessor_level = return (Option.is_some locked_round) in let* ctxt, allowed_preattestations = - if can_contain_preendorsements then - let* ctxt, preendorsements_map = + if can_contain_preattestations then + let* ctxt, preattestations_map = Baking.endorsing_rights_by_first_slot ctxt (Level.current ctxt) in - return (ctxt, Some preendorsements_map) + return (ctxt, Some preattestations_map) else return (ctxt, None) in let ctxt = @@ -164,7 +164,7 @@ let init_consensus_rights_for_block ctxt mode ~predecessor_level = construction mode). In the mempool, there are three allowed levels for both - endorsements and preendorsements: [predecessor_level - 1] (aka the + endorsements and preattestations: [predecessor_level - 1] (aka the grandparent's level), [predecessor_level] (that is, the level of the mempool's head), and [predecessor_level + 1] (aka the current level in ctxt). *) @@ -173,7 +173,7 @@ let init_consensus_rights_for_mempool ctxt ~predecessor_level = let open Alpha_context in (* We don't want to compute the tables by first slot for all three possible levels because it is time-consuming. So we don't compute - any [allowed_endorsements] or [allowed_preendorsements] tables. *) + any [allowed_endorsements] or [allowed_preattestations] tables. *) let ctxt = Consensus.initialize_consensus_operation ctxt diff --git a/src/proto_alpha/lib_protocol/mempool_validation.mli b/src/proto_alpha/lib_protocol/mempool_validation.mli index dcadef04f545..8f205601a453 100644 --- a/src/proto_alpha/lib_protocol/mempool_validation.mli +++ b/src/proto_alpha/lib_protocol/mempool_validation.mli @@ -41,7 +41,7 @@ - Block's operations quota are ignored, it is the baker's responsability to ensure that the set of selected operations does not exceed gas/size operations quota. - - The baker must also include the required preendorsements and + - The baker must also include the required preattestations and endorsements. - The merging of two mempools also maintains the aforementioned -- GitLab From c35fba1bdfa157565bdcb90965a09f3d3fe22a7c Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Thu, 6 Jul 2023 14:47:12 +0200 Subject: [PATCH 9/9] alpha: rename preendorsement in operation watermarks --- src/proto_alpha/lib_delegate/baking_actions.ml | 2 +- .../test/mockup_simulator/mockup_simulator.ml | 2 +- src/proto_alpha/lib_protocol/alpha_context.mli | 2 +- src/proto_alpha/lib_protocol/operation_repr.ml | 8 ++++---- src/proto_alpha/lib_protocol/operation_repr.mli | 2 +- src/proto_alpha/lib_protocol/test/helpers/op.ml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/proto_alpha/lib_delegate/baking_actions.ml b/src/proto_alpha/lib_delegate/baking_actions.ml index ad5750003bd4..0a85d960db88 100644 --- a/src/proto_alpha/lib_delegate/baking_actions.ml +++ b/src/proto_alpha/lib_delegate/baking_actions.ml @@ -426,7 +426,7 @@ let inject_preendorsements state ~preendorsements = >>=? fun may_sign -> (if may_sign then let unsigned_operation = (shell, Contents_list contents) in - let watermark = Operation.(to_watermark (Preendorsement chain_id)) in + let watermark = Operation.(to_watermark (Preattestation chain_id)) in let unsigned_operation_bytes = Data_encoding.Binary.to_bytes_exn Operation.unsigned_encoding_with_legacy_attestation_name diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml index 43b83d46061c..570e0af607fa 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -1345,7 +1345,7 @@ let op_is_signed_by ~public_key (op_hash : Operation_hash.t) | Endorsement _ -> Alpha_context.Operation.to_watermark (Endorsement chain_id) | Preattestation _ -> - Alpha_context.Operation.to_watermark (Preendorsement chain_id) + Alpha_context.Operation.to_watermark (Preattestation chain_id) | _ -> Signature.Generic_operation) | _ -> failwith "unexpected contents in %a@." Operation_hash.pp op_hash) >>=? fun watermark -> diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index eaf03fd11d61..73e979fce7b0 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -4349,7 +4349,7 @@ module Operation : sig type consensus_watermark = | Endorsement of Chain_id.t - | Preendorsement of Chain_id.t + | Preattestation of Chain_id.t | Dal_attestation of Chain_id.t val to_watermark : consensus_watermark -> Signature.watermark diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index 5cbb1df8ec84..66cf94c26831 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -179,11 +179,11 @@ let pp_consensus_content ppf content = type consensus_watermark = | Endorsement of Chain_id.t - | Preendorsement of Chain_id.t + | Preattestation of Chain_id.t | Dal_attestation of Chain_id.t let to_watermark = function - | Preendorsement chain_id -> + | Preattestation chain_id -> Signature.Custom (Bytes.cat (Bytes.of_string "\x12") (Chain_id.to_bytes chain_id)) | Dal_attestation chain_id @@ -203,7 +203,7 @@ let of_watermark = function match Bytes.get b 0 with | '\x12' -> Option.map - (fun chain_id -> Preendorsement chain_id) + (fun chain_id -> Preattestation chain_id) (Chain_id.of_bytes_opt (Bytes.sub b 1 (Bytes.length b - 1))) | '\x13' -> Option.map @@ -1936,7 +1936,7 @@ let check_signature (type kind) key chain_id (op : kind operation) = | Some signature -> let watermark = match op.protocol_data.contents with - | Single (Preattestation _) -> to_watermark (Preendorsement chain_id) + | Single (Preattestation _) -> to_watermark (Preattestation chain_id) | Single (Endorsement _) -> to_watermark (Endorsement chain_id) | Single (Dal_attestation _) -> to_watermark (Dal_attestation chain_id) | Single diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index 6d0c0b4aa158..ed9075b52ec6 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -189,7 +189,7 @@ val pp_consensus_content : Format.formatter -> consensus_content -> unit type consensus_watermark = | Endorsement of Chain_id.t - | Preendorsement of Chain_id.t + | Preattestation of Chain_id.t | Dal_attestation of Chain_id.t val to_watermark : consensus_watermark -> Signature.watermark diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index e175549ef682..e729ab74f6bd 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -149,7 +149,7 @@ let raw_preendorsement ?delegate ?slot ?level ?round ?block_payload_hash ?branch let op = Single (Preattestation consensus_content) in return (sign - ~watermark:Operation.(to_watermark (Preendorsement Chain_id.zero)) + ~watermark:Operation.(to_watermark (Preattestation Chain_id.zero)) signer branch op) -- GitLab