diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index 9a696cb330f0cc6ceb63e128d6a3e51cd5473b1e..8c84b7abc27490b58e020f3b719635b8d1e61868 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -42,6 +42,7 @@ Bug Fixes Minor Changes ------------- +- Rename ``endorsement`` into ``attestation`` in protocol errors (MR :gl:`!9192`) + Internal -------- - diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 76a12ebdf82725a22b369c23d6c6262fbe717586..0b80432e0c846a9f2040b0eccb6909cfb258ccf9 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -4145,9 +4145,6 @@ type 'a consensus_operation_type = | Endorsement : Kind.endorsement consensus_operation_type | Preendorsement : Kind.preendorsement consensus_operation_type -val pp_operation_kind : - Format.formatter -> 'kind consensus_operation_type -> unit - type consensus_content = { slot : Slot.t; level : Raw_level.t; diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 1f9b58495c909eb72b98878c1b354aeb03fc3b04..0bf36aaf2aa87db6164b5fbc9b58bb2f71c39f72 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -30,7 +30,6 @@ open Alpha_context type error += - | Not_enough_endorsements of {required : int; provided : int} | Faulty_validation_wrong_slot | Error_while_taking_fees | Update_consensus_key_on_unregistered_delegate of Signature.Public_key_hash.t @@ -51,24 +50,6 @@ type error += | Invalid_staking_parameters_sender let () = - register_error_kind - `Permanent - ~id:"operation.not_enough_endorsements" - ~title:"Not enough endorsements" - ~description: - "The block being validated does not include the required minimum number \ - of endorsements." - ~pp:(fun ppf (required, provided) -> - Format.fprintf - ppf - "Wrong number of endorsements (%i), at least %i are expected" - provided - required) - Data_encoding.(obj2 (req "required" int31) (req "provided" int31)) - (function - | Not_enough_endorsements {required; provided} -> Some (required, provided) - | _ -> None) - (fun (required, provided) -> Not_enough_endorsements {required; provided}) ; let description = "The consensus operation uses an invalid slot. This error should not \ happen: the operation validation should have failed earlier." @@ -2678,7 +2659,7 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash ~(block_producer : Consensus_key.t) ~(payload_producer : Consensus_key.t) = let open Lwt_result_syntax in let level = Level.current ctxt in - let endorsing_power = Consensus.current_endorsement_power ctxt in + let attestation_power = Consensus.current_endorsement_power ctxt in let* required_endorsements = are_endorsements_required ctxt ~level:level.level in @@ -2711,7 +2692,9 @@ let finalize_application ctxt block_data_contents ~round ~predecessor_hash let* ctxt, reward_bonus = if required_endorsements then let* ctxt = record_endorsing_participation ctxt in - let*? rewards_bonus = Baking.bonus_baking_reward ctxt ~endorsing_power in + let*? rewards_bonus = + Baking.bonus_baking_reward ctxt ~attestation_power + in return (ctxt, Some rewards_bonus) else return (ctxt, None) in diff --git a/src/proto_alpha/lib_protocol/baking.ml b/src/proto_alpha/lib_protocol/baking.ml index a2f2c5f3057d7efe2c35a9ef6ec1b2d9ae20f719..8c23f43773cb04f154d894a2385a9b4ebfaa56c6 100644 --- a/src/proto_alpha/lib_protocol/baking.ml +++ b/src/proto_alpha/lib_protocol/baking.ml @@ -28,45 +28,47 @@ open Alpha_context type error += | (* `Permanent *) - Insufficient_endorsing_power of { - endorsing_power : int; + Insufficient_attestation_power of { + attestation_power : int; consensus_threshold : int; } let () = register_error_kind `Permanent - ~id:"baking.insufficient_endorsing_power" - ~title:"Insufficient endorsing power" + ~id:"baking.insufficient_attestation_power" + ~title:"Insufficient attestation power" ~description: - "The endorsing power is insufficient to satisfy the consensus threshold." - ~pp:(fun ppf (endorsing_power, consensus_threshold) -> + "The attestation power is insufficient to satisfy the consensus \ + threshold." + ~pp:(fun ppf (attestation_power, consensus_threshold) -> Format.fprintf ppf - "The endorsing power (%d) is insufficient to satisfy the consensus \ + "The attestation power (%d) is insufficient to satisfy the consensus \ threshold (%d)." - endorsing_power + attestation_power consensus_threshold) Data_encoding.( - obj2 (req "endorsing_power" int31) (req "consensus_threshold" int31)) + obj2 (req "attestation_power" int31) (req "consensus_threshold" int31)) (function - | Insufficient_endorsing_power {endorsing_power; consensus_threshold} -> - Some (endorsing_power, consensus_threshold) + | Insufficient_attestation_power {attestation_power; consensus_threshold} + -> + Some (attestation_power, consensus_threshold) | _ -> None) - (fun (endorsing_power, consensus_threshold) -> - Insufficient_endorsing_power {endorsing_power; consensus_threshold}) + (fun (attestation_power, consensus_threshold) -> + Insufficient_attestation_power {attestation_power; consensus_threshold}) -let bonus_baking_reward ctxt ~endorsing_power = +let bonus_baking_reward ctxt ~attestation_power = let consensus_threshold = Constants.consensus_threshold ctxt in let baking_reward_bonus_per_slot = Delegate.Rewards.baking_reward_bonus_per_slot ctxt in - let extra_endorsing_power = endorsing_power - consensus_threshold in + let extra_attestation_power = attestation_power - consensus_threshold in error_when - Compare.Int.(extra_endorsing_power < 0) - (Insufficient_endorsing_power {endorsing_power; consensus_threshold}) + Compare.Int.(extra_attestation_power < 0) + (Insufficient_attestation_power {attestation_power; consensus_threshold}) >>? fun () -> - Tez.(baking_reward_bonus_per_slot *? Int64.of_int extra_endorsing_power) + Tez.(baking_reward_bonus_per_slot *? Int64.of_int extra_attestation_power) type ordered_slots = { delegate : Signature.public_key_hash; diff --git a/src/proto_alpha/lib_protocol/baking.mli b/src/proto_alpha/lib_protocol/baking.mli index a20a009f1097b710ff369c3142b0a688a5a9983e..5fc4c451f586edd3c2e95409f3fffc28da70ca34 100644 --- a/src/proto_alpha/lib_protocol/baking.mli +++ b/src/proto_alpha/lib_protocol/baking.mli @@ -28,8 +28,8 @@ open Alpha_context type error += | (* `Permanent *) - Insufficient_endorsing_power of { - endorsing_power : int; + Insufficient_attestation_power of { + attestation_power : int; consensus_threshold : int; } @@ -60,5 +60,5 @@ val endorsing_rights_by_first_slot : Level.t -> (context * (Consensus_key.pk * int) Slot.Map.t) tzresult Lwt.t -(** Computes the bonus baking reward depending on the endorsing power. *) -val bonus_baking_reward : context -> endorsing_power:int -> Tez.t tzresult +(** Computes the bonus baking reward depending on the attestation power. *) +val bonus_baking_reward : context -> attestation_power:int -> Tez.t tzresult diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index b0907152784f611b20e3eb30f21394b5f63b4293..9a53e929989aa6a071532a03edef53468bccbf2b 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -138,12 +138,6 @@ type 'a consensus_operation_type = | Endorsement : Kind.endorsement consensus_operation_type | Preendorsement : Kind.preendorsement consensus_operation_type -let pp_operation_kind (type kind) ppf - (operation_kind : kind consensus_operation_type) = - match operation_kind with - | Endorsement -> Format.fprintf ppf "Endorsement" - | Preendorsement -> Format.fprintf ppf "Preendorsement" - type consensus_content = { slot : Slot_repr.t; level : Raw_level_repr.t; diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index 26f26e01eaedddd8c31f78c35043642084ea97ad..56d827f7eb79f7a7b9e86af1f3bf11e717dba3fa 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -172,9 +172,6 @@ type 'a consensus_operation_type = | Endorsement : Kind.endorsement consensus_operation_type | Preendorsement : Kind.preendorsement consensus_operation_type -val pp_operation_kind : - Format.formatter -> 'kind consensus_operation_type -> unit - type consensus_content = { slot : Slot_repr.t; (* By convention, this is the validator's first slot. *) diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml index 8965fd55cc9d08f5560f2e637a40003c50a662de..a91a76012acc94da4a5a39ee24e0b76990d8d908 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_endorsement.ml @@ -234,7 +234,7 @@ let test_invalid_double_endorsement () = Block.bake ~operation b >>= fun res -> Assert.proto_error ~loc:__LOC__ res (function | Validate_errors.Anonymous.Invalid_denunciation kind - when kind = Validate_errors.Anonymous.Endorsement -> + when kind = Validate_errors.Anonymous.Attestation -> true | _ -> false) @@ -257,7 +257,7 @@ let test_invalid_double_endorsement_variant () = Block.bake ~operation genesis >>= fun res -> Assert.proto_error ~loc:__LOC__ res (function | Validate_errors.Anonymous.Invalid_denunciation kind - when kind = Validate_errors.Anonymous.Endorsement -> + when kind = Validate_errors.Anonymous.Attestation -> true | _ -> false) @@ -274,7 +274,7 @@ let test_too_early_double_endorsement_evidence () = Block.bake ~operation genesis >>= fun res -> Assert.proto_error ~loc:__LOC__ res (function | Validate_errors.Anonymous.Too_early_denunciation {kind; _} - when kind = Validate_errors.Anonymous.Endorsement -> + when kind = Validate_errors.Anonymous.Attestation -> true | _ -> false) @@ -296,7 +296,7 @@ let test_too_late_double_endorsement_evidence () = Block.bake ~operation blk >>= fun res -> Assert.proto_error ~loc:__LOC__ res (function | Validate_errors.Anonymous.Outdated_denunciation {kind; _} - when kind = Validate_errors.Anonymous.Endorsement -> + when kind = Validate_errors.Anonymous.Attestation -> true | _ -> false) @@ -317,7 +317,7 @@ let test_different_delegates () = Block.bake ~operation blk_b >>= fun res -> Assert.proto_error ~loc:__LOC__ res (function | Validate_errors.Anonymous.Inconsistent_denunciation {kind; _} - when kind = Validate_errors.Anonymous.Endorsement -> + when kind = Validate_errors.Anonymous.Attestation -> true | _ -> false) @@ -341,7 +341,7 @@ let test_wrong_delegate () = Block.bake ~operation blk_b >>= fun res -> Assert.proto_error ~loc:__LOC__ res (function | Validate_errors.Anonymous.Inconsistent_denunciation {kind; _} - when kind = Validate_errors.Anonymous.Endorsement -> + when kind = Validate_errors.Anonymous.Attestation -> true | _ -> false) @@ -504,7 +504,7 @@ let test_two_double_endorsement_evidences_leads_to_duplicate_denunciation () = >>= fun e -> Assert.proto_error ~loc:__LOC__ e (function | Validate_errors.Anonymous.Conflicting_denunciation {kind; _} - when kind = Validate_errors.Anonymous.Endorsement -> + when kind = Validate_errors.Anonymous.Attestation -> true | _ -> false) >>=? fun () -> @@ -514,7 +514,7 @@ let test_two_double_endorsement_evidences_leads_to_duplicate_denunciation () = >>= fun e -> Assert.proto_error ~loc:__LOC__ e (function | Validate_errors.Anonymous.Already_denounced {kind; _} - when kind = Validate_errors.Anonymous.Endorsement -> + when kind = Validate_errors.Anonymous.Attestation -> true | _ -> false) diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml index 85d40e7f195ad0d7982b6de0f30bc1609c54c9fe..e7e50cb6696c1b458fd69cf5737dc84731cc4f49 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_preendorsement.ml @@ -64,7 +64,7 @@ end = struct let invalid_denunciation loc res = Assert.proto_error ~loc res (function | Validate_errors.Anonymous.Invalid_denunciation kind - when kind = Validate_errors.Anonymous.Preendorsement -> + when kind = Validate_errors.Anonymous.Preattestation -> true | _ -> false) @@ -93,21 +93,21 @@ end = struct let already_denounced loc res = Assert.proto_error ~loc res (function | Validate_errors.Anonymous.Already_denounced {kind; _} - when kind = Validate_errors.Anonymous.Preendorsement -> + when kind = Validate_errors.Anonymous.Preattestation -> true | _ -> false) let inconsistent_denunciation loc res = Assert.proto_error ~loc res (function | Validate_errors.Anonymous.Inconsistent_denunciation {kind; _} - when kind = Validate_errors.Anonymous.Preendorsement -> + when kind = Validate_errors.Anonymous.Preattestation -> true | _ -> false) let outdated_denunciation loc res = Assert.proto_error ~loc res (function | Validate_errors.Anonymous.Outdated_denunciation {kind; _} - when kind = Validate_errors.Anonymous.Preendorsement -> + when kind = Validate_errors.Anonymous.Preattestation -> true | _ -> false) @@ -330,7 +330,7 @@ end = struct >>= fun e -> Assert.proto_error ~loc:__LOC__ e (function | Validate_errors.Anonymous.Conflicting_denunciation {kind; _} - when kind = Validate_errors.Anonymous.Preendorsement -> + when kind = Validate_errors.Anonymous.Preattestation -> true | _ -> false) >>=? fun () -> diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_endorsement.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_endorsement.ml index bd832aa286f875b281b3cd099c0c490af943592d..cf268f0dd53f0807d70db1a6a96e667d75512905 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_endorsement.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_endorsement.ml @@ -179,7 +179,7 @@ let test_not_smallest_slot () = let error_wrong_slot = function | Validate_errors.Consensus.Wrong_slot_used_for_consensus_operation {kind; _} - when kind = Validate_errors.Consensus.Endorsement -> + when kind = Validate_errors.Consensus.Attestation -> true | _ -> false in @@ -245,7 +245,7 @@ let test_mempool_not_own_slot () = let error_old_level = function | Validate_errors.Consensus.Consensus_operation_for_old_level {kind; _} - when kind = Validate_errors.Consensus.Endorsement -> + when kind = Validate_errors.Consensus.Attestation -> true | _ -> false @@ -286,7 +286,7 @@ let test_two_levels_too_old () = let error_future_level = function | Validate_errors.Consensus.Consensus_operation_for_future_level {kind; _} - when kind = Validate_errors.Consensus.Endorsement -> + when kind = Validate_errors.Consensus.Attestation -> true | _ -> false @@ -325,7 +325,7 @@ let test_two_levels_future () = let error_old_round = function | Validate_errors.Consensus.Consensus_operation_for_old_round {kind; _} - when kind = Validate_errors.Consensus.Endorsement -> + when kind = Validate_errors.Consensus.Attestation -> true | _ -> false @@ -363,7 +363,7 @@ let test_many_rounds_too_old () = let error_future_round = function | Validate_errors.Consensus.Consensus_operation_for_future_round {kind; _} - when kind = Validate_errors.Consensus.Endorsement -> + when kind = Validate_errors.Consensus.Attestation -> true | _ -> false @@ -409,7 +409,7 @@ let test_wrong_payload_hash () = let error_wrong_payload_hash = function | Validate_errors.Consensus.Wrong_payload_hash_for_consensus_operation {kind; _} - when kind = Validate_errors.Consensus.Endorsement -> + when kind = Validate_errors.Consensus.Attestation -> true | _ -> false in @@ -429,7 +429,7 @@ let test_wrong_payload_hash () = let assert_conflict_error ~loc res = Assert.proto_error ~loc res (function | Validate_errors.Consensus.Conflicting_consensus_operation {kind; _} - when kind = Validate_errors.Consensus.Endorsement -> + when kind = Validate_errors.Consensus.Attestation -> true | _ -> false) @@ -631,7 +631,10 @@ let test_endorsement_threshold ~sufficient_threshold () = >>=? fun (_, endos) -> Block.bake ~operations:endos b >>= fun b -> if sufficient_threshold then return_unit - else Assert.proto_error_with_info ~loc:__LOC__ b "Not enough endorsements" + else + Assert.proto_error ~loc:__LOC__ b (function + | Validate_errors.Block.Not_enough_attestations _ -> true + | _ -> false) let tests = [ diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_preendorsement.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_preendorsement.ml index 6c76c6c4cbc339bd4b1e1c256abc8c0f4d77a57b..e4cc2936e71fc271ccfcdea2372a9c2eb0899e89 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_preendorsement.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_preendorsement.ml @@ -65,7 +65,7 @@ let test_consensus_operation_preendorsement_for_future_level () = ~level ~error:(function | Validate_errors.Consensus.Consensus_operation_for_future_level {kind; _} - when kind = Validate_errors.Consensus.Preendorsement -> + when kind = Validate_errors.Consensus.Preattestation -> true | _ -> false) Preendorsement @@ -83,7 +83,7 @@ let test_consensus_operation_preendorsement_for_old_level () = ~level ~error:(function | Validate_errors.Consensus.Consensus_operation_for_old_level {kind; _} - when kind = Validate_errors.Consensus.Preendorsement -> + when kind = Validate_errors.Consensus.Preattestation -> true | _ -> false) Preendorsement @@ -128,7 +128,7 @@ let test_unexpected_preendorsements_in_blocks () = ~loc:__LOC__ ~endorsed_block:pred ~error:(function - | Validate_errors.Consensus.Unexpected_preendorsement_in_block -> true + | Validate_errors.Consensus.Unexpected_preattestation_in_block -> true | _ -> false) Preendorsement Application @@ -145,7 +145,7 @@ let test_too_high_round () = ~round ~level ~error:(function - | Validate_errors.Consensus.Preendorsement_round_too_high _ -> true + | Validate_errors.Consensus.Preattestation_round_too_high _ -> true | _ -> false) Preendorsement Construction diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_preendorsement_functor.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_preendorsement_functor.ml index 5002e086384c1bcf0eae55a73ec1e889e80aae87..565b5ecefbe83418438354f620826024be23df4c 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_preendorsement_functor.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_preendorsement_functor.ml @@ -96,7 +96,7 @@ end = struct (Error (function | Validate_errors.Consensus.Conflicting_consensus_operation {kind; _} - when kind = Validate_errors.Consensus.Preendorsement -> + when kind = Validate_errors.Consensus.Preattestation -> true | _ -> false)) () @@ -145,7 +145,7 @@ end = struct (function | Validate_errors.Consensus.Consensus_operation_for_old_level {kind; _} - when kind = Validate_errors.Consensus.Preendorsement -> + when kind = Validate_errors.Consensus.Preattestation -> true | _ -> false)) () @@ -178,7 +178,7 @@ end = struct (function | Validate_errors.Consensus.Wrong_slot_used_for_consensus_operation {kind; _} - when kind = Validate_errors.Consensus.Preendorsement -> + when kind = Validate_errors.Consensus.Preattestation -> true | _ -> false)) () @@ -212,7 +212,7 @@ end = struct (function | Validate_errors.Consensus.Consensus_operation_for_old_round {kind; _} - when kind = Validate_errors.Consensus.Preendorsement -> + when kind = Validate_errors.Consensus.Preattestation -> true | _ -> false) else Ok (fun _ -> return_unit) diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index 11a9a5b8767a78e47f9968a916841a9140e314a9..b4829f684dc6f42e285a4139da12c3285473c431 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -448,7 +448,7 @@ module Consensus = struct let check_round_before_block ~block_round provided = error_unless Round.(provided < block_round) - (Preendorsement_round_too_high {block_round; provided}) + (Preattestation_round_too_high {block_round; provided}) let check_level kind expected provided = (* We use [if] instead of [error_unless] to avoid computing the @@ -484,9 +484,9 @@ module Consensus = struct | None -> (* A preexisting block whose fitness has no locked round should contain no preendorsements. *) - error Unexpected_preendorsement_in_block + error Unexpected_preattestation_in_block in - let kind = Preendorsement in + let kind = Preattestation in let*? () = check_round_before_block ~block_round:block_info.round round in let*? () = check_level kind vi.current_level.level level in let*? () = check_round kind locked_round round in @@ -513,9 +513,9 @@ module Consensus = struct any preendorsements. *) error_when Block_payload_hash.(expected_payload_hash = zero) - Unexpected_preendorsement_in_block + Unexpected_preattestation_in_block in - let kind = Preendorsement in + let kind = Preattestation in let*? () = check_round_before_block ~block_round:cons_info.round round in let*? () = check_level kind vi.current_level.level level in (* We cannot check the exact round here in construction mode, because @@ -606,7 +606,7 @@ module Consensus = struct check_mempool_consensus vi consensus_info - Preendorsement + Preattestation consensus_content in let*? () = @@ -638,7 +638,7 @@ module Consensus = struct | Error conflict -> error Validate_errors.Consensus.( - Conflicting_consensus_operation {kind = Preendorsement; conflict}) + Conflicting_consensus_operation {kind = Preattestation; conflict}) let add_preendorsement vs oph (op : Kind.preendorsement operation) = let (Single (Preendorsement {slot; level; round; _})) = @@ -701,9 +701,9 @@ module Consensus = struct of the Tenderbake family; this block should not be endorsed. This can only happen in tests and test networks. *) - error Unexpected_endorsement_in_block + error Unexpected_attestation_in_block in - let kind = Endorsement in + let kind = Attestation in let*? () = check_level kind consensus_info.predecessor_level level in let*? () = check_round kind consensus_info.predecessor_round round in let*? () = check_payload_hash kind expected_payload_hash bph in @@ -734,7 +734,7 @@ module Consensus = struct check_mempool_consensus vi consensus_info - Endorsement + Attestation consensus_content in let*? () = @@ -766,7 +766,7 @@ module Consensus = struct | Error conflict -> error Validate_errors.Consensus.( - Conflicting_consensus_operation {kind = Endorsement; conflict}) + Conflicting_consensus_operation {kind = Attestation; conflict}) let add_endorsement vs oph (op : Kind.endorsement operation) = let (Single (Endorsement {slot; level; round; _})) = @@ -892,7 +892,7 @@ module Consensus = struct | Some (expected, _power) -> (* Other preendorsements have already been validated: we check that the current operation has the same round as them. *) - check_round Preendorsement expected consensus_content.round) + check_round Preattestation expected consensus_content.round) | Application _ | Partial_validation _ | Mempool -> return_unit let validate_preendorsement ~check_signature info operation_state block_state @@ -1410,7 +1410,7 @@ module Anonymous = struct operation.protocol_data.contents in check_double_endorsing_evidence - ~consensus_operation:Preendorsement + ~consensus_operation:Preattestation vi op1 op2 @@ -1420,7 +1420,7 @@ module Anonymous = struct let (Single (Double_endorsement_evidence {op1; op2})) = operation.protocol_data.contents in - check_double_endorsing_evidence ~consensus_operation:Endorsement vi op1 op2 + check_double_endorsing_evidence ~consensus_operation:Attestation vi op1 op2 let check_double_endorsing_evidence_conflict (type kind) vs oph (op1 : kind Kind.consensus Operation.t) = @@ -2764,7 +2764,7 @@ let validate_operation ?(check_signature = true) operation_state oph operation - |> wrap_denunciation_conflict Preendorsement + |> wrap_denunciation_conflict Preattestation in let operation_state = add_double_preendorsement_evidence operation_state oph operation @@ -2778,7 +2778,7 @@ let validate_operation ?(check_signature = true) operation_state oph operation - |> wrap_denunciation_conflict Endorsement + |> wrap_denunciation_conflict Attestation in let operation_state = add_double_endorsement_evidence operation_state oph operation @@ -2867,7 +2867,7 @@ let check_endorsement_power vi bs = let provided = bs.endorsement_power in fail_unless Compare.Int.(provided >= required) - (Not_enough_endorsements {required; provided}) + (Not_enough_attestations {required; provided}) else return_unit (** Check that the locked round in the fitness and the locked round diff --git a/src/proto_alpha/lib_protocol/validate_errors.ml b/src/proto_alpha/lib_protocol/validate_errors.ml index 175d972149d97c583a62b0a4a471eaa12b0363e8..e2070f2b7b8ee399cd4405c58a8c0e2c88294f23 100644 --- a/src/proto_alpha/lib_protocol/validate_errors.ml +++ b/src/proto_alpha/lib_protocol/validate_errors.ml @@ -60,7 +60,7 @@ module Consensus = struct Format.fprintf ppf "Delegate %a has zero frozen deposits; it is not allowed to \ - bake/preendorse/endorse." + bake/preattest/attest." Signature.Public_key_hash.pp delegate) Data_encoding.(obj1 (req "delegate" Signature.Public_key_hash.encoding)) @@ -70,24 +70,24 @@ module Consensus = struct (** This type is only used in consensus operation errors to make them more informative. *) type consensus_operation_kind = - | Preendorsement - | Endorsement + | Preattestation + | Attestation | Dal_attestation let consensus_operation_kind_encoding = Data_encoding.string_enum [ - ("Preendorsement", Preendorsement); - ("Endorsement", Endorsement); + ("Preattestation", Preattestation); + ("Attestation", Attestation); ("Dal_attestation", Dal_attestation); ] let consensus_operation_kind_pp fmt = function - | Preendorsement -> Format.fprintf fmt "Preendorsement" - | Endorsement -> Format.fprintf fmt "Endorsement" + | Preattestation -> Format.fprintf fmt "Preattestation" + | Attestation -> Format.fprintf fmt "Attestation" | Dal_attestation -> Format.fprintf fmt "Dal_attestation" - (** Errors for preendorsements and endorsements. *) + (** Errors for preattestation and attestation. *) type error += | Consensus_operation_for_old_level of { kind : consensus_operation_kind; @@ -114,9 +114,9 @@ module Consensus = struct expected : Block_payload_hash.t; provided : Block_payload_hash.t; } - | Unexpected_preendorsement_in_block - | Unexpected_endorsement_in_block - | Preendorsement_round_too_high of { + | Unexpected_preattestation_in_block + | Unexpected_attestation_in_block + | Preattestation_round_too_high of { block_round : Round.t; provided : Round.t; } @@ -266,32 +266,32 @@ module Consensus = struct Wrong_payload_hash_for_consensus_operation {kind; expected; provided}) ; register_error_kind `Permanent - ~id:"validate.unexpected_preendorsement_in_block" - ~title:"Unexpected preendorsement in block" - ~description:"Unexpected preendorsement in block." + ~id:"validate.unexpected_preattestation_in_block" + ~title:"Unexpected preattestation in block" + ~description:"Unexpected preattestation in block." ~pp:(fun ppf () -> - Format.fprintf ppf "Unexpected preendorsement in block.") + Format.fprintf ppf "Unexpected preattestation in block.") Data_encoding.empty - (function Unexpected_preendorsement_in_block -> Some () | _ -> None) - (fun () -> Unexpected_preendorsement_in_block) ; + (function Unexpected_preattestation_in_block -> Some () | _ -> None) + (fun () -> Unexpected_preattestation_in_block) ; register_error_kind `Permanent - ~id:"validate.unexpected_endorsement_in_block" - ~title:"Unexpected endorsement in block" - ~description:"Unexpected endorsement in block." - ~pp:(fun ppf () -> Format.fprintf ppf "Unexpected endorsement in block.") + ~id:"validate.unexpected_attestation_in_block" + ~title:"Unexpected attestation in block" + ~description:"Unexpected attestation in block." + ~pp:(fun ppf () -> Format.fprintf ppf "Unexpected attestation in block.") Data_encoding.empty - (function Unexpected_endorsement_in_block -> Some () | _ -> None) - (fun () -> Unexpected_endorsement_in_block) ; + (function Unexpected_attestation_in_block -> Some () | _ -> None) + (fun () -> Unexpected_attestation_in_block) ; register_error_kind `Permanent - ~id:"validate.preendorsement_round_too_high" - ~title:"Preendorsement round too high" - ~description:"Preendorsement round too high." + ~id:"validate.preattestation_round_too_high" + ~title:"Preattestation round too high" + ~description:"Preattestation round too high." ~pp:(fun ppf (block_round, provided) -> Format.fprintf ppf - "Preendorsement round too high (block_round: %a, provided: %a)." + "Preattestation round too high (block_round: %a, provided: %a)." Round.pp block_round Round.pp @@ -299,16 +299,16 @@ module Consensus = struct Data_encoding.( obj2 (req "block_round" Round.encoding) (req "provided" Round.encoding)) (function - | Preendorsement_round_too_high {block_round; provided} -> + | Preattestation_round_too_high {block_round; provided} -> Some (block_round, provided) | _ -> None) (fun (block_round, provided) -> - Preendorsement_round_too_high {block_round; provided}) ; + Preattestation_round_too_high {block_round; provided}) ; register_error_kind `Permanent ~id:"validate.wrong_slot_for_consensus_operation" ~title:"Wrong slot for consensus operation" - ~description:"Wrong slot used for a preendorsement or endorsement." + ~description:"Wrong slot used for a preattestation or attestation." ~pp:(fun ppf kind -> Format.fprintf ppf @@ -677,20 +677,20 @@ module Anonymous = struct | _ -> None) (fun (edpkh, conflict) -> Conflicting_activation {edpkh; conflict}) - type denunciation_kind = Preendorsement | Endorsement | Block + type denunciation_kind = Preattestation | Attestation | Block let denunciation_kind_encoding = let open Data_encoding in string_enum [ - ("preendorsement", Preendorsement); - ("endorsement", Endorsement); + ("preattestation", Preattestation); + ("attestation", Attestation); ("block", Block); ] let pp_denunciation_kind fmt : denunciation_kind -> unit = function - | Preendorsement -> Format.fprintf fmt "preendorsement" - | Endorsement -> Format.fprintf fmt "endorsement" + | Preattestation -> Format.fprintf fmt "preattestation" + | Attestation -> Format.fprintf fmt "attestation" | Block -> Format.fprintf fmt "block" type error += @@ -1263,7 +1263,7 @@ let () = module Block = struct (* All block errors are permanent. *) type error += - | Not_enough_endorsements of {required : int; provided : int} + | Not_enough_attestations of {required : int; provided : int} | Inconsistent_validation_passes_in_block of { expected : int; provided : int; @@ -1284,23 +1284,23 @@ module Block = struct let () = register_error_kind `Permanent - ~id:"validate.block.not_enough_endorsements" - ~title:"Not enough endorsements" + ~id:"validate.block.not_enough_attestations" + ~title:"Not enough attestations" ~description: "The block being validated does not include the required minimum \ - number of endorsements." + number of attestations." ~pp:(fun ppf (required, provided) -> Format.fprintf ppf - "Wrong number of endorsements (%i), at least %i are expected" + "Wrong number of attestations (%i), at least %i are expected" provided required) Data_encoding.(obj2 (req "required" int31) (req "provided" int31)) (function - | Not_enough_endorsements {required; provided} -> + | Not_enough_attestations {required; provided} -> Some (required, provided) | _ -> None) - (fun (required, provided) -> Not_enough_endorsements {required; provided}) ; + (fun (required, provided) -> Not_enough_attestations {required; provided}) ; register_error_kind `Permanent ~id:"validate.block.inconsistent_validation_passes_in_block" diff --git a/src/proto_alpha/lib_protocol/validate_errors.mli b/src/proto_alpha/lib_protocol/validate_errors.mli index 305a214b727ee3a89728182789cbff07a62203cf..b1d4732f0947464d8214b11447c67d04afd9ff4e 100644 --- a/src/proto_alpha/lib_protocol/validate_errors.mli +++ b/src/proto_alpha/lib_protocol/validate_errors.mli @@ -35,11 +35,11 @@ type operation_conflict = (** Errors that may arise while validating a consensus operation. *) module Consensus : sig type consensus_operation_kind = - | Preendorsement - | Endorsement + | Preattestation + | Attestation | Dal_attestation - (** Errors for preendorsements and endorsements. *) + (** Errors for preattestations and attestations. *) type error += | Zero_frozen_deposits of Signature.Public_key_hash.t | Consensus_operation_not_allowed @@ -68,9 +68,9 @@ module Consensus : sig expected : Block_payload_hash.t; provided : Block_payload_hash.t; } - | Unexpected_preendorsement_in_block - | Unexpected_endorsement_in_block - | Preendorsement_round_too_high of { + | Unexpected_preattestation_in_block + | Unexpected_attestation_in_block + | Preattestation_round_too_high of { block_round : Round.t; provided : Round.t; } @@ -116,7 +116,7 @@ end (** Errors that may arise while validating an anonymous operation. *) module Anonymous : sig - type denunciation_kind = Preendorsement | Endorsement | Block + type denunciation_kind = Preattestation | Attestation | Block type error += | Invalid_activation of {pkh : Ed25519.Public_key_hash.t} @@ -199,7 +199,7 @@ type error += Failing_noop_error module Block : sig type error += - | Not_enough_endorsements of {required : int; provided : int} + | Not_enough_attestations of {required : int; provided : int} | Inconsistent_validation_passes_in_block of { expected : int; provided : int;