From 00e5c2d19acfd33106dd0779ec16fb7aa8e002cc Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 7 Jul 2023 11:53:44 +0200 Subject: [PATCH 1/9] alpha: rename double_endorsement_evidence contents type --- .../lib_client/operation_result.ml | 2 +- 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 | 4 +-- src/proto_alpha/lib_protocol/apply_results.ml | 8 ++--- .../lib_protocol/operation_repr.ml | 32 +++++++++---------- .../lib_protocol/operation_repr.mli | 14 ++++++-- .../lib_protocol/test/helpers/op.ml | 2 +- .../test/helpers/operation_generator.ml | 2 +- .../validate/generator_descriptors.ml | 2 +- .../test/integration/validate/test_sanity.ml | 4 +-- src/proto_alpha/lib_protocol/validate.ml | 18 +++++------ 13 files changed, 52 insertions(+), 44 deletions(-) diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 32e0fb40c1f4..a188ebe99371 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -911,7 +911,7 @@ let pp_contents_and_result : "@[Slot attestation:@,Delegate: %a@]" Signature.Public_key_hash.pp delegate - | ( Double_endorsement_evidence {op1; op2}, + | ( Double_attestation_evidence {op1; op2}, Double_endorsement_evidence_result bus ) -> Format.fprintf ppf diff --git a/src/proto_alpha/lib_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index d642826cc496..b96e708771f0 100644 --- a/src/proto_alpha/lib_plugin/RPC.ml +++ b/src/proto_alpha/lib_plugin/RPC.ml @@ -2951,7 +2951,7 @@ module Forge = struct operation ctxt block ~branch (Double_baking_evidence {bh1; bh2}) let double_endorsement_evidence ctxt block ~branch ~op1 ~op2 () = - operation ctxt block ~branch (Double_endorsement_evidence {op1; op2}) + operation ctxt block ~branch (Double_attestation_evidence {op1; op2}) let double_preendorsement_evidence ctxt block ~branch ~op1 ~op2 () = operation ctxt block ~branch (Double_preattestation_evidence {op1; op2}) diff --git a/src/proto_alpha/lib_plugin/mempool.ml b/src/proto_alpha/lib_plugin/mempool.ml index 2b4892c655a1..e4fe71b5d26f 100644 --- a/src/proto_alpha/lib_plugin/mempool.ml +++ b/src/proto_alpha/lib_plugin/mempool.ml @@ -546,7 +546,7 @@ let pre_filter filter_info config | Single (Dal_attestation _) | Single (Seed_nonce_revelation _) | Single (Double_preattestation_evidence _) - | Single (Double_endorsement_evidence _) + | Single (Double_attestation_evidence _) | Single (Double_baking_evidence _) | Single (Activate_account _) | Single (Proposals _) @@ -682,7 +682,7 @@ let find_manager {shell = _; protocol_data = Operation_data {contents; _}} = ( Preattestation _ | Endorsement _ | Dal_attestation _ | Proposals _ | Ballot _ | Seed_nonce_revelation _ | Vdf_revelation _ | Double_baking_evidence _ | Double_preattestation_evidence _ - | Double_endorsement_evidence _ | Activate_account _ | Drain_delegate _ + | Double_attestation_evidence _ | Activate_account _ | Drain_delegate _ | Failing_noop _ ) -> None diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index b05a7975d442..02666ffdfa7f 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -4178,7 +4178,7 @@ and _ contents = op2 : Kind.preattestation operation; } -> Kind.double_preattestation_evidence contents - | Double_endorsement_evidence : { + | Double_attestation_evidence : { op1 : Kind.attestation operation; op2 : Kind.attestation operation; } diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 0037b73e1236..87c28e8cef83 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -1982,7 +1982,7 @@ let record_operation (type kind) ctxt hash (operation : kind operation) : | Single (Dal_attestation _) -> ctxt | Single ( Failing_noop _ | Proposals _ | Ballot _ | Seed_nonce_revelation _ - | Vdf_revelation _ | Double_endorsement_evidence _ + | Vdf_revelation _ | Double_attestation_evidence _ | Double_preattestation_evidence _ | Double_baking_evidence _ | Activate_account _ | Drain_delegate _ | Manager_operation _ ) | Cons (Manager_operation _, _) -> @@ -2221,7 +2221,7 @@ let apply_contents_list (type kind) ctxt chain_id (mode : mode) (ctxt, Single_result (Vdf_revelation_result balance_updates)) | Single (Double_preattestation_evidence {op1; op2 = _}) -> punish_double_endorsement_or_preattestation ctxt ~op1 ~payload_producer - | Single (Double_endorsement_evidence {op1; op2 = _}) -> + | Single (Double_attestation_evidence {op1; op2 = _}) -> punish_double_endorsement_or_preattestation ctxt ~op1 ~payload_producer | Single (Double_baking_evidence {bh1; bh2 = _}) -> punish_double_baking ctxt bh1 ~payload_producer diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 0a7bf4733212..e9e5ac18990c 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -1230,7 +1230,7 @@ module Encoding = struct | _ -> None); mselect = (function - | Contents_and_result ((Double_endorsement_evidence _ as op), res) -> + | Contents_and_result ((Double_attestation_evidence _ as op), res) -> Some (op, res) | _ -> None); proj = (fun (Double_endorsement_evidence_result bus) -> bus); @@ -1254,7 +1254,7 @@ module Encoding = struct | _ -> None); mselect = (function - | Contents_and_result ((Double_endorsement_evidence _ as op), res) -> + | Contents_and_result ((Double_attestation_evidence _ as op), res) -> Some (op, res) | _ -> None); proj = (fun (Double_endorsement_evidence_result bus) -> bus); @@ -1983,9 +1983,9 @@ let kind_equal : | Double_preattestation_evidence _, Double_preattestation_evidence_result _ -> Some Eq | Double_preattestation_evidence _, _ -> None - | Double_endorsement_evidence _, Double_endorsement_evidence_result _ -> + | Double_attestation_evidence _, Double_endorsement_evidence_result _ -> Some Eq - | Double_endorsement_evidence _, _ -> None + | Double_attestation_evidence _, _ -> None | Double_baking_evidence _, Double_baking_evidence_result _ -> Some Eq | Double_baking_evidence _, _ -> None | Activate_account _, Activate_account_result _ -> Some Eq diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index 72732a088314..6619a4760fa0 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -253,7 +253,7 @@ and _ contents = op2 : Kind.preattestation operation; } -> Kind.double_preattestation_evidence contents - | Double_endorsement_evidence : { + | Double_attestation_evidence : { op1 : Kind.attestation operation; op2 : Kind.attestation operation; } @@ -1254,10 +1254,10 @@ module Encoding = struct (req "op2" (dynamic_size endorsement_encoding)); select = (function - | Contents (Double_endorsement_evidence _ as op) -> Some op + | Contents (Double_attestation_evidence _ as op) -> Some op | _ -> None); - proj = (fun (Double_endorsement_evidence {op1; op2}) -> (op1, op2)); - inj = (fun (op1, op2) -> Double_endorsement_evidence {op1; op2}); + proj = (fun (Double_attestation_evidence {op1; op2}) -> (op1, op2)); + inj = (fun (op1, op2) -> Double_attestation_evidence {op1; op2}); } let double_attestation_evidence_case : Kind.double_attestation_evidence case = @@ -1271,10 +1271,10 @@ module Encoding = struct (req "op2" (dynamic_size attestation_encoding)); select = (function - | Contents (Double_endorsement_evidence _ as op) -> Some op + | Contents (Double_attestation_evidence _ as op) -> Some op | _ -> None); - proj = (fun (Double_endorsement_evidence {op1; op2}) -> (op1, op2)); - inj = (fun (op1, op2) -> Double_endorsement_evidence {op1; op2}); + proj = (fun (Double_attestation_evidence {op1; op2}) -> (op1, op2)); + inj = (fun (op1, op2) -> Double_attestation_evidence {op1; op2}); } let double_baking_evidence_case = @@ -1853,7 +1853,7 @@ let acceptable_pass (op : packed_operation) = | Single (Ballot _) -> Some voting_pass | Single (Seed_nonce_revelation _) -> Some anonymous_pass | Single (Vdf_revelation _) -> Some anonymous_pass - | Single (Double_endorsement_evidence _) -> Some anonymous_pass + | Single (Double_attestation_evidence _) -> Some anonymous_pass | Single (Double_preattestation_evidence _) -> Some anonymous_pass | Single (Double_baking_evidence _) -> Some anonymous_pass | Single (Activate_account _) -> Some anonymous_pass @@ -1941,7 +1941,7 @@ let check_signature (type kind) key chain_id (op : kind operation) = | Single (Dal_attestation _) -> to_watermark (Dal_attestation chain_id) | Single ( Failing_noop _ | Proposals _ | Ballot _ | Seed_nonce_revelation _ - | Vdf_revelation _ | Double_endorsement_evidence _ + | Vdf_revelation _ | Double_attestation_evidence _ | Double_preattestation_evidence _ | Double_baking_evidence _ | Activate_account _ | Drain_delegate _ | Manager_operation _ ) -> Generic_operation @@ -2027,8 +2027,8 @@ let equal_contents_kind : type a b. a contents -> b contents -> (a, b) eq option | Seed_nonce_revelation _, _ -> None | Vdf_revelation _, Vdf_revelation _ -> Some Eq | Vdf_revelation _, _ -> None - | Double_endorsement_evidence _, Double_endorsement_evidence _ -> Some Eq - | Double_endorsement_evidence _, _ -> None + | Double_attestation_evidence _, Double_attestation_evidence _ -> Some Eq + | Double_attestation_evidence _, _ -> None | Double_preattestation_evidence _, Double_preattestation_evidence _ -> Some Eq | Double_preattestation_evidence _, _ -> None @@ -2204,7 +2204,7 @@ let consensus_infos_and_hash_from_block_header (bh : Block_header_repr.t) = converted in {!int32}. The [weight] of a {!Double_preattestation} or - {!Double_endorsement} depends on the [level] and [round] of their + {!Double_attestation} depends on the [level] and [round] of their first denounciated operations. The [level] and [round] are wrapped in a {!round_infos}. @@ -2341,7 +2341,7 @@ let weight_of : packed_operation -> operation_weight = W (Anonymous, Weight_seed_nonce_revelation (Raw_level_repr.to_int32 level)) | Single (Vdf_revelation {solution}) -> W (Anonymous, Weight_vdf_revelation solution) - | Single (Double_endorsement_evidence {op1; _}) -> ( + | Single (Double_attestation_evidence {op1; _}) -> ( match op1.protocol_data.contents with | Single (Endorsement consensus_content) -> W @@ -2413,7 +2413,7 @@ let compare_round_infos infos1 infos2 = (infos2.level, infos2.round) (** When comparing {!Endorsement} to {!Preattestation} or - {!Double_endorsement_evidence} to {!Double_preattestation}, in case + {!Double_attestation_evidence} to {!Double_preattestation}, in case of {!round_infos} equality, the position is relevant to compute the order. *) type prioritized_position = Nopos | Fstpos | Sndpos @@ -2527,7 +2527,7 @@ let compare_vote_weight w1 w2 = (** {5 Comparison of valid anonymous operations} *) -(** Comparing two {!Double_endorsement_evidence}, or two +(** Comparing two {!Double_attestation_evidence}, or two {!Double_preattestation_evidence}, or comparing them to each other is comparing their {!round_infos}, see {!compare_round_infos} for more details. @@ -2544,7 +2544,7 @@ let compare_vote_weight w1 w2 = When comparing different kind of anonymous operations, the order is as follows: {!Double_preattestation_evidence} > - {!Double_endorsement_evidence} > {!Double_baking_evidence} > + {!Double_attestation_evidence} > {!Double_baking_evidence} > {!Vdf_revelation} > {!Seed_nonce_revelation} > {!Activate_account}. *) let compare_anonymous_weight w1 w2 = diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index 3667efd5473e..813f7c7d8fa5 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.mli +++ b/src/proto_alpha/lib_protocol/operation_repr.mli @@ -266,14 +266,14 @@ and _ contents = op2 : Kind.preattestation operation; } -> Kind.double_preattestation_evidence contents - (* Double_endorsement_evidence: Similar to double-preattestation but + (* Double_attestation_evidence: Similar to double-preattestation but for endorsements. *) - | Double_endorsement_evidence : { + | Double_attestation_evidence : { op1 : Kind.attestation operation; op2 : Kind.attestation operation; } -> Kind.double_attestation_evidence contents - (* Double_baking_evidence: Similarly to double-endorsement but the + (* Double_baking_evidence: Similarly to double-attestation but the byzantine attempts to fork by signing two different blocks at the same level. *) | Double_baking_evidence : { @@ -595,8 +595,16 @@ val compare_by_passes : packed_operation -> packed_operation -> int The global order is as follows: {!Endorsement} and {!Preattestation} > {!Dal_attestation} > +<<<<<<< HEAD {!Proposals} > {!Ballot} > {!Double_preattestation_evidence} > {!Double_endorsement_evidence} > {!Double_baking_evidence} > +||||||| parent of 45950febbf (alpha: rename double_endorsement_evidence contents type) + {!Proposals} > {!Ballot} > {!Double_preendorsement_evidence} > + {!Double_endorsement_evidence} > {!Double_baking_evidence} > +======= + {!Proposals} > {!Ballot} > {!Double_preendorsement_evidence} > + {!Double_attestation_evidence} > {!Double_baking_evidence} > +>>>>>>> 45950febbf (alpha: rename double_endorsement_evidence contents type) {!Vdf_revelation} > {!Seed_nonce_revelation} > {!Activate_account} > {!Drain_delegate} > {!Manager_operation}. diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index 866693595cac..f8154aa0f1f3 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/op.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/op.ml @@ -639,7 +639,7 @@ let activation ctxt (pkh : Signature.Public_key_hash.t) activation_code = } let double_endorsement ctxt op1 op2 = - let contents = Single (Double_endorsement_evidence {op1; op2}) in + let contents = Single (Double_attestation_evidence {op1; op2}) in let branch = Context.branch ctxt in { shell = {branch}; 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 09adbbaa5655..64775af05039 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/operation_generator.ml @@ -415,7 +415,7 @@ let generate_double_endorsement = let open QCheck2.Gen in let* op1 = generate_op generate_endorsement in let+ op2 = generate_op generate_endorsement in - Double_endorsement_evidence {op1; op2} + Double_attestation_evidence {op1; op2} let generate_double_baking = 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 dc2434190c59..d975ec37811b 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 @@ -841,7 +841,7 @@ let op_kind_of_packed_operation op = | Single (Dal_attestation _) -> KDalattestation | Single (Seed_nonce_revelation _) -> KNonce | Single (Vdf_revelation _) -> KVdf - | Single (Double_endorsement_evidence _) -> KDbl_consensus + | Single (Double_attestation_evidence _) -> KDbl_consensus | Single (Double_preattestation_evidence _) -> KDbl_consensus | Single (Double_baking_evidence _) -> KDbl_baking | Single (Activate_account _) -> KActivate 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 d20629c37492..2df606a2bf11 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 @@ -128,9 +128,9 @@ let covalidation_sanity () = | Single (Seed_nonce_revelation _), _ -> assert false | Single (Vdf_revelation _), KVdf -> return_unit | Single (Vdf_revelation _), _ -> assert false - | Single (Double_endorsement_evidence _), KDbl_consensus -> + | Single (Double_attestation_evidence _), KDbl_consensus -> return_unit - | Single (Double_endorsement_evidence _), _ -> assert false + | Single (Double_attestation_evidence _), _ -> assert false | Single (Double_preattestation_evidence _), KDbl_consensus -> return_unit | Single (Double_preattestation_evidence _), _ -> assert false diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index f0f6113e0fae..09574006e71b 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -1417,7 +1417,7 @@ module Anonymous = struct let check_double_endorsement_evidence vi (operation : Kind.double_attestation_evidence operation) = - let (Single (Double_endorsement_evidence {op1; op2})) = + let (Single (Double_attestation_evidence {op1; op2})) = operation.protocol_data.contents in check_double_endorsing_evidence ~consensus_operation:Attestation vi op1 op2 @@ -1444,7 +1444,7 @@ module Anonymous = struct let check_double_endorsement_evidence_conflict vs oph (operation : Kind.double_attestation_evidence operation) = - let (Single (Double_endorsement_evidence {op1; _})) = + let (Single (Double_attestation_evidence {op1; _})) = operation.protocol_data.contents in check_double_endorsing_evidence_conflict vs oph op1 @@ -1471,7 +1471,7 @@ module Anonymous = struct let add_double_endorsement_evidence vs oph (operation : Kind.double_attestation_evidence operation) = - let (Single (Double_endorsement_evidence {op1; _})) = + let (Single (Double_attestation_evidence {op1; _})) = operation.protocol_data.contents in add_double_endorsing_evidence vs oph op1 @@ -1506,7 +1506,7 @@ module Anonymous = struct let remove_double_endorsement_evidence vs (operation : Kind.double_attestation_evidence operation) = - let (Single (Double_endorsement_evidence {op1; _})) = + let (Single (Double_attestation_evidence {op1; _})) = operation.protocol_data.contents in remove_double_endorsing_evidence vs op1 @@ -2465,7 +2465,7 @@ let check_operation ?(check_signature = true) info (type kind) Anonymous.check_activate_account info operation | Single (Double_preattestation_evidence _) -> Anonymous.check_double_preattestation_evidence info operation - | Single (Double_endorsement_evidence _) -> + | Single (Double_attestation_evidence _) -> Anonymous.check_double_endorsement_evidence info operation | Single (Double_baking_evidence _) -> Anonymous.check_double_baking_evidence info operation @@ -2532,7 +2532,7 @@ let check_operation_conflict (type kind) operation_conflict_state oph operation_conflict_state oph operation - | Single (Double_endorsement_evidence _) -> + | Single (Double_attestation_evidence _) -> Anonymous.check_double_endorsement_evidence_conflict operation_conflict_state oph @@ -2586,7 +2586,7 @@ let add_valid_operation operation_conflict_state oph (type kind) operation_conflict_state oph operation - | Single (Double_endorsement_evidence _) -> + | Single (Double_attestation_evidence _) -> Anonymous.add_double_endorsement_evidence operation_conflict_state oph @@ -2629,7 +2629,7 @@ let remove_operation operation_conflict_state (type kind) Anonymous.remove_double_preattestation_evidence operation_conflict_state operation - | Single (Double_endorsement_evidence _) -> + | Single (Double_attestation_evidence _) -> Anonymous.remove_double_endorsement_evidence operation_conflict_state operation @@ -2770,7 +2770,7 @@ let validate_operation ?(check_signature = true) add_double_preattestation_evidence operation_state oph operation in return {info; operation_state; block_state} - | Single (Double_endorsement_evidence _) -> + | Single (Double_attestation_evidence _) -> let open Anonymous in let* () = check_double_endorsement_evidence info operation in let*? () = -- GitLab From eb78765429c37b24ee5333d7d3a97d00baaae118 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 7 Jul 2023 11:56:47 +0200 Subject: [PATCH 2/9] alpha: rename double_endorsement_evidence 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 6619a4760fa0..9a370360d8e9 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -2236,7 +2236,7 @@ type _ weight = | Weight_seed_nonce_revelation : int32 -> anonymous_pass_type weight | Weight_vdf_revelation : Seed_repr.vdf_solution -> anonymous_pass_type weight | Weight_double_preattestation : round_infos -> anonymous_pass_type weight - | Weight_double_endorsement : round_infos -> anonymous_pass_type weight + | Weight_double_attestation : round_infos -> anonymous_pass_type weight | Weight_double_baking : double_baking_infos -> anonymous_pass_type weight | Weight_activate_account : Ed25519.Public_key_hash.t @@ -2346,7 +2346,7 @@ let weight_of : packed_operation -> operation_weight = | Single (Endorsement consensus_content) -> W ( Anonymous, - Weight_double_endorsement + Weight_double_attestation (round_infos_from_consensus_content consensus_content) )) | Single (Double_preattestation_evidence {op1; _}) -> ( match op1.protocol_data.contents with @@ -2551,24 +2551,24 @@ let compare_anonymous_weight w1 w2 = match (w1, w2) with | Weight_double_preattestation infos1, Weight_double_preattestation infos2 -> compare_round_infos infos1 infos2 - | Weight_double_preattestation infos1, Weight_double_endorsement infos2 -> + | Weight_double_preattestation infos1, Weight_double_attestation infos2 -> compare_round_infos_with_prioritized_position ~prioritized_position:Fstpos infos1 infos2 - | Weight_double_endorsement infos1, Weight_double_preattestation infos2 -> + | Weight_double_attestation infos1, Weight_double_preattestation infos2 -> compare_round_infos_with_prioritized_position ~prioritized_position:Sndpos infos1 infos2 - | Weight_double_endorsement infos1, Weight_double_endorsement infos2 -> + | Weight_double_attestation infos1, Weight_double_attestation infos2 -> compare_round_infos infos1 infos2 | ( ( Weight_double_baking _ | Weight_seed_nonce_revelation _ | Weight_vdf_revelation _ | Weight_activate_account _ | Weight_drain_delegate _ ), - (Weight_double_preattestation _ | Weight_double_endorsement _) ) -> + (Weight_double_preattestation _ | Weight_double_attestation _) ) -> -1 - | ( (Weight_double_preattestation _ | Weight_double_endorsement _), + | ( (Weight_double_preattestation _ | Weight_double_attestation _), ( Weight_double_baking _ | Weight_seed_nonce_revelation _ | Weight_vdf_revelation _ | Weight_activate_account _ | Weight_drain_delegate _ ) ) -> -- GitLab From 07417a7efdbca73b90a9ebf2094548e15723b8e4 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 7 Jul 2023 12:00:52 +0200 Subject: [PATCH 3/9] alpha: rename double_endorsement_evidence in apply_resuslts --- src/proto_alpha/lib_client/operation_result.ml | 2 +- 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, 13 insertions(+), 13 deletions(-) diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index a188ebe99371..794aafd9b59c 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -912,7 +912,7 @@ let pp_contents_and_result : Signature.Public_key_hash.pp delegate | ( Double_attestation_evidence {op1; op2}, - Double_endorsement_evidence_result bus ) -> + Double_attestation_evidence_result bus ) -> Format.fprintf ppf "@[Double attestation evidence:@,\ diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 87c28e8cef83..a97bada20727 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -2137,7 +2137,7 @@ let punish_double_endorsement_or_preattestation (type kind) ctxt | Single (Preattestation _) -> Double_preattestation_evidence_result balance_updates | Single (Endorsement _) -> - Double_endorsement_evidence_result balance_updates + Double_attestation_evidence_result balance_updates in match op1.protocol_data.contents with | Single (Preattestation e1) | Single (Endorsement e1) -> diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index e9e5ac18990c..99dc9f7db073 100644 --- a/src/proto_alpha/lib_protocol/apply_results.ml +++ b/src/proto_alpha/lib_protocol/apply_results.ml @@ -909,7 +909,7 @@ type 'kind contents_result = | Vdf_revelation_result : Receipt.balance_updates -> Kind.vdf_revelation contents_result - | Double_endorsement_evidence_result : + | Double_attestation_evidence_result : Receipt.balance_updates -> Kind.double_attestation_evidence contents_result | Double_preattestation_evidence_result : @@ -1225,7 +1225,7 @@ module Encoding = struct []); select = (function - | Contents_result (Double_endorsement_evidence_result _ as op) -> + | Contents_result (Double_attestation_evidence_result _ as op) -> Some op | _ -> None); mselect = @@ -1233,8 +1233,8 @@ module Encoding = struct | Contents_and_result ((Double_attestation_evidence _ as op), res) -> Some (op, res) | _ -> None); - proj = (fun (Double_endorsement_evidence_result bus) -> bus); - inj = (fun bus -> Double_endorsement_evidence_result bus); + proj = (fun (Double_attestation_evidence_result bus) -> bus); + inj = (fun bus -> Double_attestation_evidence_result bus); } let double_attestation_evidence_case = @@ -1249,7 +1249,7 @@ module Encoding = struct []); select = (function - | Contents_result (Double_endorsement_evidence_result _ as op) -> + | Contents_result (Double_attestation_evidence_result _ as op) -> Some op | _ -> None); mselect = @@ -1257,8 +1257,8 @@ module Encoding = struct | Contents_and_result ((Double_attestation_evidence _ as op), res) -> Some (op, res) | _ -> None); - proj = (fun (Double_endorsement_evidence_result bus) -> bus); - inj = (fun bus -> Double_endorsement_evidence_result bus); + proj = (fun (Double_attestation_evidence_result bus) -> bus); + inj = (fun bus -> Double_attestation_evidence_result bus); } let double_preendorsement_evidence_case = @@ -1482,7 +1482,7 @@ module Encoding = struct | Contents_result Ballot_result -> None | Contents_result (Seed_nonce_revelation_result _) -> None | Contents_result (Vdf_revelation_result _) -> None - | Contents_result (Double_endorsement_evidence_result _) -> None + | Contents_result (Double_attestation_evidence_result _) -> None | Contents_result (Double_preattestation_evidence_result _) -> None | Contents_result (Double_baking_evidence_result _) -> None | Contents_result (Activate_account_result _) -> None @@ -1983,7 +1983,7 @@ let kind_equal : | Double_preattestation_evidence _, Double_preattestation_evidence_result _ -> Some Eq | Double_preattestation_evidence _, _ -> None - | Double_attestation_evidence _, Double_endorsement_evidence_result _ -> + | Double_attestation_evidence _, Double_attestation_evidence_result _ -> Some Eq | Double_attestation_evidence _, _ -> None | Double_baking_evidence _, Double_baking_evidence_result _ -> Some Eq diff --git a/src/proto_alpha/lib_protocol/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 477be4ae2891..75e33ef795b2 100644 --- a/src/proto_alpha/lib_protocol/apply_results.mli +++ b/src/proto_alpha/lib_protocol/apply_results.mli @@ -82,7 +82,7 @@ and 'kind contents_result = | Vdf_revelation_result : Receipt.balance_updates -> Kind.vdf_revelation contents_result - | Double_endorsement_evidence_result : + | Double_attestation_evidence_result : Receipt.balance_updates -> Kind.double_attestation_evidence contents_result | Double_preattestation_evidence_result : 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 72278a9be064..9f90481cc5d0 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 @@ -162,7 +162,7 @@ module Proto_client = struct | Dal_attestation_result _ -> Successful | Seed_nonce_revelation_result _ -> Successful | Vdf_revelation_result _ -> Successful - | Double_endorsement_evidence_result _ -> Successful + | Double_attestation_evidence_result _ -> Successful | Double_preattestation_evidence_result _ -> Successful | Double_baking_evidence_result _ -> Successful | Activate_account_result _ -> Successful -- GitLab From 50f72d2739958cd5817be16cb281f9a000dc6609 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 7 Jul 2023 12:09:30 +0200 Subject: [PATCH 4/9] alpha: rename double_endorsement in constants_repr --- src/proto_alpha/lib_parameters/default_parameters.ml | 2 +- src/proto_alpha/lib_protocol/alpha_context.mli | 4 ++-- .../lib_protocol/constants_parametric_previous_repr.ml | 8 ++++---- .../lib_protocol/constants_parametric_previous_repr.mli | 2 +- src/proto_alpha/lib_protocol/constants_parametric_repr.ml | 8 ++++---- .../lib_protocol/constants_parametric_repr.mli | 2 +- src/proto_alpha/lib_protocol/constants_repr.ml | 6 +++--- src/proto_alpha/lib_protocol/constants_storage.ml | 4 ++-- src/proto_alpha/lib_protocol/constants_storage.mli | 2 +- .../lib_protocol/delegate_slashed_deposits_storage.ml | 2 +- src/proto_alpha/lib_protocol/raw_context.ml | 8 ++++---- .../test/integration/consensus/test_double_baking.ml | 4 ++-- .../test/integration/consensus/test_double_endorsement.ml | 6 +++--- .../integration/consensus/test_double_preendorsement.ml | 2 +- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index f2b94412a5a2..4344a0ddfc94 100644 --- a/src/proto_alpha/lib_parameters/default_parameters.ml +++ b/src/proto_alpha/lib_parameters/default_parameters.ml @@ -179,7 +179,7 @@ let constants_mainnet = max_slashing_period = 2; delegation_over_baking_limit = 9; percentage_of_frozen_deposits_slashed_per_double_baking = 10; - percentage_of_frozen_deposits_slashed_per_double_endorsement = 50; + percentage_of_frozen_deposits_slashed_per_double_attestation = 50; (* The `testnet_dictator` should absolutely be None on mainnet *) testnet_dictator = None; initial_seed = None; diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 02666ffdfa7f..8e584263cb4f 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -893,7 +893,7 @@ module Constants : sig max_slashing_period : int; delegation_over_baking_limit : int; percentage_of_frozen_deposits_slashed_per_double_baking : int; - percentage_of_frozen_deposits_slashed_per_double_endorsement : int; + percentage_of_frozen_deposits_slashed_per_double_attestation : int; testnet_dictator : public_key_hash option; initial_seed : State_hash.t option; cache_script_size : int; @@ -978,7 +978,7 @@ module Constants : sig val percentage_of_frozen_deposits_slashed_per_double_baking : context -> int - val percentage_of_frozen_deposits_slashed_per_double_endorsement : + val percentage_of_frozen_deposits_slashed_per_double_attestation : context -> int val testnet_dictator : context -> public_key_hash option diff --git a/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.ml index 918a77b9190c..910fdbcde1a9 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.ml @@ -156,7 +156,7 @@ type t = { max_slashing_period : int; frozen_deposits_percentage : int; double_baking_punishment : Tez_repr.t; - ratio_of_frozen_deposits_slashed_per_double_endorsement : Ratio_repr.t; + ratio_of_frozen_deposits_slashed_per_double_attestation : Ratio_repr.t; testnet_dictator : Signature.Public_key_hash.t option; initial_seed : State_hash.t option; (* If a new cache is added, please also modify the @@ -358,7 +358,7 @@ let encoding = c.max_slashing_period, c.frozen_deposits_percentage, c.double_baking_punishment, - c.ratio_of_frozen_deposits_slashed_per_double_endorsement, + c.ratio_of_frozen_deposits_slashed_per_double_attestation, c.testnet_dictator, c.initial_seed ), ( ( c.cache_script_size, @@ -397,7 +397,7 @@ let encoding = max_slashing_period, frozen_deposits_percentage, double_baking_punishment, - ratio_of_frozen_deposits_slashed_per_double_endorsement, + ratio_of_frozen_deposits_slashed_per_double_attestation, testnet_dictator, initial_seed ), ( ( cache_script_size, @@ -437,7 +437,7 @@ let encoding = consensus_threshold; frozen_deposits_percentage; double_baking_punishment; - ratio_of_frozen_deposits_slashed_per_double_endorsement; + ratio_of_frozen_deposits_slashed_per_double_attestation; testnet_dictator; initial_seed; cache_script_size; diff --git a/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.mli index 5776add0db65..294790c41a07 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.mli @@ -176,7 +176,7 @@ type t = { frozen_deposits_percentage : int; (* that is, (100 * delegated tz / own tz) *) double_baking_punishment : Tez_repr.t; - ratio_of_frozen_deposits_slashed_per_double_endorsement : Ratio_repr.t; + ratio_of_frozen_deposits_slashed_per_double_attestation : Ratio_repr.t; testnet_dictator : Signature.Public_key_hash.t option; initial_seed : State_hash.t option; cache_script_size : int; diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml index 5c2d2ff1ed76..ef506c6c05d2 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.ml @@ -188,7 +188,7 @@ type t = { max_slashing_period : int; delegation_over_baking_limit : int; percentage_of_frozen_deposits_slashed_per_double_baking : int; - percentage_of_frozen_deposits_slashed_per_double_endorsement : int; + percentage_of_frozen_deposits_slashed_per_double_attestation : int; testnet_dictator : Signature.Public_key_hash.t option; initial_seed : State_hash.t option; (* If a new cache is added, please also modify the @@ -479,7 +479,7 @@ let encoding = c.max_slashing_period, c.delegation_over_baking_limit, c.percentage_of_frozen_deposits_slashed_per_double_baking, - c.percentage_of_frozen_deposits_slashed_per_double_endorsement, + c.percentage_of_frozen_deposits_slashed_per_double_attestation, c.testnet_dictator, c.initial_seed ), ( ( c.cache_script_size, @@ -515,7 +515,7 @@ let encoding = max_slashing_period, delegation_over_baking_limit, percentage_of_frozen_deposits_slashed_per_double_baking, - percentage_of_frozen_deposits_slashed_per_double_endorsement, + percentage_of_frozen_deposits_slashed_per_double_attestation, testnet_dictator, initial_seed ), ( ( cache_script_size, @@ -552,7 +552,7 @@ let encoding = consensus_threshold; delegation_over_baking_limit; percentage_of_frozen_deposits_slashed_per_double_baking; - percentage_of_frozen_deposits_slashed_per_double_endorsement; + percentage_of_frozen_deposits_slashed_per_double_attestation; testnet_dictator; initial_seed; cache_script_size; diff --git a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli index e7d5e342a468..fbb4718fbf8c 100644 --- a/src/proto_alpha/lib_protocol/constants_parametric_repr.mli +++ b/src/proto_alpha/lib_protocol/constants_parametric_repr.mli @@ -171,7 +171,7 @@ type t = { delegation_over_baking_limit : int; (* upper bound on the (delegated tz / own frozen tz) ratio *) percentage_of_frozen_deposits_slashed_per_double_baking : int; - percentage_of_frozen_deposits_slashed_per_double_endorsement : int; + percentage_of_frozen_deposits_slashed_per_double_attestation : int; testnet_dictator : Signature.Public_key_hash.t option; initial_seed : State_hash.t option; cache_script_size : int; diff --git a/src/proto_alpha/lib_protocol/constants_repr.ml b/src/proto_alpha/lib_protocol/constants_repr.ml index d759d7490798..223ff93879bb 100644 --- a/src/proto_alpha/lib_protocol/constants_repr.ml +++ b/src/proto_alpha/lib_protocol/constants_repr.ml @@ -239,12 +239,12 @@ let check_constants constants = >>? fun () -> error_unless Compare.Int.( - constants.percentage_of_frozen_deposits_slashed_per_double_endorsement + constants.percentage_of_frozen_deposits_slashed_per_double_attestation >= 0 - && constants.percentage_of_frozen_deposits_slashed_per_double_endorsement + && constants.percentage_of_frozen_deposits_slashed_per_double_attestation <= 100) (Invalid_protocol_constants - "The percentage of frozen deposits slashed per double endorsement must \ + "The percentage of frozen deposits slashed per double attestation must \ be between 0 and 100 included.") >>? fun () -> error_unless diff --git a/src/proto_alpha/lib_protocol/constants_storage.ml b/src/proto_alpha/lib_protocol/constants_storage.ml index 7d254caf9b2e..32471c3d5c04 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/constants_storage.ml @@ -136,9 +136,9 @@ let percentage_of_frozen_deposits_slashed_per_double_baking c = let constants = Raw_context.constants c in constants.percentage_of_frozen_deposits_slashed_per_double_baking -let percentage_of_frozen_deposits_slashed_per_double_endorsement c = +let percentage_of_frozen_deposits_slashed_per_double_attestation c = let constants = Raw_context.constants c in - constants.percentage_of_frozen_deposits_slashed_per_double_endorsement + constants.percentage_of_frozen_deposits_slashed_per_double_attestation let testnet_dictator c = let constants = Raw_context.constants c in diff --git a/src/proto_alpha/lib_protocol/constants_storage.mli b/src/proto_alpha/lib_protocol/constants_storage.mli index 17ffa9386b66..620291d8f02f 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.mli +++ b/src/proto_alpha/lib_protocol/constants_storage.mli @@ -85,7 +85,7 @@ val delegation_over_baking_limit : Raw_context.t -> int val percentage_of_frozen_deposits_slashed_per_double_baking : Raw_context.t -> int -val percentage_of_frozen_deposits_slashed_per_double_endorsement : +val percentage_of_frozen_deposits_slashed_per_double_attestation : Raw_context.t -> int val testnet_dictator : Raw_context.t -> Signature.Public_key_hash.t option diff --git a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml index b553737db6f7..52790eeeafdd 100644 --- a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml +++ b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml @@ -142,7 +142,7 @@ let punish_double_endorsing = let set slashed = Storage.{slashed with for_double_endorsing = true} in let get_percentage = Constants_storage - .percentage_of_frozen_deposits_slashed_per_double_endorsement + .percentage_of_frozen_deposits_slashed_per_double_attestation in punish_double_signing ~get ~set ~get_percentage diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 24b6db99a3e7..0f24dac256a6 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -1022,10 +1022,10 @@ let prepare_first_block ~level ~timestamp ctxt = c_gen.reward_weights in - let percentage_of_frozen_deposits_slashed_per_double_endorsement = + let percentage_of_frozen_deposits_slashed_per_double_attestation = 100 - * c.ratio_of_frozen_deposits_slashed_per_double_endorsement.numerator - / c.ratio_of_frozen_deposits_slashed_per_double_endorsement.denominator + * c.ratio_of_frozen_deposits_slashed_per_double_attestation.numerator + / c.ratio_of_frozen_deposits_slashed_per_double_attestation.denominator in let percentage_of_frozen_deposits_slashed_per_double_baking = let double_baking_punishment_times_100 = @@ -1074,7 +1074,7 @@ let prepare_first_block ~level ~timestamp ctxt = max_slashing_period = c.max_slashing_period; delegation_over_baking_limit; percentage_of_frozen_deposits_slashed_per_double_baking; - percentage_of_frozen_deposits_slashed_per_double_endorsement; + percentage_of_frozen_deposits_slashed_per_double_attestation; (* The `testnet_dictator` should absolutely be None on mainnet *) testnet_dictator = c.testnet_dictator; initial_seed = c.initial_seed; diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml index eb2c2ac84828..c3711adaf09c 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml @@ -135,7 +135,7 @@ let test_valid_double_baking_followed_by_double_endorsing () = >>=? fun frozen_deposits_after -> Context.get_constants (B genesis) >>=? fun csts -> let p_de = - csts.parametric.percentage_of_frozen_deposits_slashed_per_double_endorsement + csts.parametric.percentage_of_frozen_deposits_slashed_per_double_attestation in let p_db = csts.parametric.percentage_of_frozen_deposits_slashed_per_double_baking @@ -184,7 +184,7 @@ let test_valid_double_endorsing_followed_by_double_baking () = >>=? fun frozen_deposits_after -> Context.get_constants (B genesis) >>=? fun csts -> let p_de = - csts.parametric.percentage_of_frozen_deposits_slashed_per_double_endorsement + csts.parametric.percentage_of_frozen_deposits_slashed_per_double_attestation in let p_db = csts.parametric.percentage_of_frozen_deposits_slashed_per_double_baking 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 954f3dbec6f7..04f8adea921d 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 @@ -100,7 +100,7 @@ let test_valid_double_endorsement_evidence () = >>=? fun frozen_deposits_after -> Context.get_constants (B genesis) >>=? fun csts -> let p = - csts.parametric.percentage_of_frozen_deposits_slashed_per_double_endorsement + csts.parametric.percentage_of_frozen_deposits_slashed_per_double_attestation in let expected_frozen_deposits_after = Test_tez.(frozen_deposits_before *! Int64.of_int (100 - p) /! 100L) @@ -395,7 +395,7 @@ let test_freeze_more_with_low_balance = consensus_threshold = 0; origination_size = 0; preserved_cycles = 5; - percentage_of_frozen_deposits_slashed_per_double_endorsement = + percentage_of_frozen_deposits_slashed_per_double_attestation = (* enforce that percentage is 50% in the test's params. *) 50; } @@ -434,7 +434,7 @@ let test_freeze_more_with_low_balance = (* We also check that compared to deposits at block [b2], [account1] lost 50% of its deposits. *) let slash_percentage = - constants.percentage_of_frozen_deposits_slashed_per_double_endorsement + constants.percentage_of_frozen_deposits_slashed_per_double_attestation in let expected_frozen_deposits_after = Test_tez.( 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 920fab79f637..69ec0b2397b3 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 @@ -124,7 +124,7 @@ end = struct Context.get_constants (B pred) >>=? fun constants -> let p = constants.parametric - .percentage_of_frozen_deposits_slashed_per_double_endorsement + .percentage_of_frozen_deposits_slashed_per_double_attestation in (* let's bake the block on top of pred without denunciating d1 *) bake ~policy:(By_account baker) pred >>=? fun bgood -> -- GitLab From 34c254b50848233f77e653c1bdd172c107df9ea6 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Tue, 11 Jul 2023 15:30:13 +0200 Subject: [PATCH 5/9] alpha: rename double_endorsing in storage file --- .../delegate_slashed_deposits_storage.ml | 6 +++--- src/proto_alpha/lib_protocol/storage.ml | 12 ++++++------ src/proto_alpha/lib_protocol/storage.mli | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml index 52790eeeafdd..d116e8c7aea9 100644 --- a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml +++ b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml @@ -29,7 +29,7 @@ let already_slashed_for_double_endorsing ctxt delegate (level : Level_repr.t) = Storage.Slashed_deposits.find (ctxt, level.cycle) (level.level, delegate) >>=? function | None -> return_false - | Some slashed -> return slashed.for_double_endorsing + | Some slashed -> return slashed.for_double_attesting let already_slashed_for_double_baking ctxt delegate (level : Level_repr.t) = Storage.Slashed_deposits.find (ctxt, level.cycle) (level.level, delegate) @@ -138,8 +138,8 @@ let punish_double_signing ~get ~set ~get_percentage ctxt delegate return (ctxt, {staked; unstaked}) let punish_double_endorsing = - let get Storage.{for_double_endorsing; _} = for_double_endorsing in - let set slashed = Storage.{slashed with for_double_endorsing = true} in + let get Storage.{for_double_attesting; _} = for_double_attesting in + let set slashed = Storage.{slashed with for_double_attesting = true} in let get_percentage = Constants_storage .percentage_of_frozen_deposits_slashed_per_double_attestation diff --git a/src/proto_alpha/lib_protocol/storage.ml b/src/proto_alpha/lib_protocol/storage.ml index 9e370ef0ef68..21cf53b0b8be 100644 --- a/src/proto_alpha/lib_protocol/storage.ml +++ b/src/proto_alpha/lib_protocol/storage.ml @@ -1086,10 +1086,10 @@ module Consensus_keys = (** Per cycle storage *) -type slashed_level = {for_double_endorsing : bool; for_double_baking : bool} +type slashed_level = {for_double_attesting : bool; for_double_baking : bool} let default_slashed_level = - {for_double_endorsing = false; for_double_baking = false} + {for_double_attesting = false; for_double_baking = false} module Slashed_level = struct type t = slashed_level @@ -1097,10 +1097,10 @@ module Slashed_level = struct let encoding = let open Data_encoding in conv - (fun {for_double_endorsing; for_double_baking} -> - (for_double_endorsing, for_double_baking)) - (fun (for_double_endorsing, for_double_baking) -> - {for_double_endorsing; for_double_baking}) + (fun {for_double_attesting; for_double_baking} -> + (for_double_attesting, for_double_baking)) + (fun (for_double_attesting, for_double_baking) -> + {for_double_attesting; for_double_baking}) (obj2 (req "for_double_endorsing" bool) (req "for_double_baking" bool)) end diff --git a/src/proto_alpha/lib_protocol/storage.mli b/src/proto_alpha/lib_protocol/storage.mli index 9ca01943cf82..45897573d0af 100644 --- a/src/proto_alpha/lib_protocol/storage.mli +++ b/src/proto_alpha/lib_protocol/storage.mli @@ -475,7 +475,7 @@ module Consensus_keys : with type t := Raw_context.t and type elt = Signature.Public_key_hash.t -type slashed_level = {for_double_endorsing : bool; for_double_baking : bool} +type slashed_level = {for_double_attesting : bool; for_double_baking : bool} (** [slashed_level] with all fields being [false]. *) val default_slashed_level : slashed_level -- GitLab From 8301036b9c5cf2ded30a1bc58e7a6f7750066604 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 7 Jul 2023 12:18:00 +0200 Subject: [PATCH 6/9] alpha: rename double_endorsing in delegate slashed_deposits_storage --- src/proto_alpha/lib_protocol/alpha_context.mli | 4 ++-- .../delegate_slashed_deposits_storage.ml | 4 ++-- .../delegate_slashed_deposits_storage.mli | 18 +++++++++--------- src/proto_alpha/lib_protocol/staking.ml | 2 +- src/proto_alpha/lib_protocol/validate.ml | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 8e584263cb4f..8e03c8c0f450 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -2135,7 +2135,7 @@ module Delegate : sig Cycle.t -> (context * Receipt.balance_updates * public_key_hash list) tzresult Lwt.t - val already_slashed_for_double_endorsing : + val already_slashed_for_double_attesting : context -> public_key_hash -> Level.t -> bool tzresult Lwt.t val already_slashed_for_double_baking : @@ -2148,7 +2148,7 @@ module Delegate : sig unstaked : (Cycle.t * reward_and_burn) list; } - val punish_double_endorsing : + val punish_double_attesting : context -> public_key_hash -> Level.t -> diff --git a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml index d116e8c7aea9..165a04a1d6e6 100644 --- a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml +++ b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml @@ -25,7 +25,7 @@ (* *) (*****************************************************************************) -let already_slashed_for_double_endorsing ctxt delegate (level : Level_repr.t) = +let already_slashed_for_double_attesting ctxt delegate (level : Level_repr.t) = Storage.Slashed_deposits.find (ctxt, level.cycle) (level.level, delegate) >>=? function | None -> return_false @@ -137,7 +137,7 @@ let punish_double_signing ~get ~set ~get_percentage ctxt delegate in return (ctxt, {staked; unstaked}) -let punish_double_endorsing = +let punish_double_attesting = let get Storage.{for_double_attesting; _} = for_double_attesting in let set slashed = Storage.{slashed with for_double_attesting = true} in let get_percentage = 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 a653250427c4..b3544b571816 100644 --- a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.mli +++ b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.mli @@ -39,33 +39,33 @@ val already_slashed_for_double_baking : bool tzresult Lwt.t (** Returns true if the given delegate has already been slashed - for double preattesting or double endorsing for the given level. *) -val already_slashed_for_double_endorsing : + for double preattesting or double attesting for the given level. *) +val already_slashed_for_double_attesting : Raw_context.t -> Signature.Public_key_hash.t -> Level_repr.t -> bool tzresult Lwt.t (** The [reward_and_burn] type embeds amounts involved when slashing a - delegate for double endorsing or double baking. *) + delegate for double attesting or double baking. *) type reward_and_burn = {reward : Tez_repr.t; amount_to_burn : Tez_repr.t} (** The [punishing_amounts] type embeds amounts involved when slashing a - delegate for double endorsing or double baking. *) + delegate for double attesting or double baking. *) type punishing_amounts = { staked : reward_and_burn; unstaked : (Cycle_repr.t * reward_and_burn) list; } (** Record in the context that the given delegate has now been slashed - for double endorsing for the given level and return the amounts to + for double attesting for the given level and return the amounts to burn and to reward. If the delegate has no remaining frozen - deposits, this will also forbid it to bake or endorse until a new + deposits, this will also forbid it to bake or attest until a new deposit is frozen. Fails with [Unrequired_denunciation] if the given delegate has - already been slashed for double endorsing for the given level. *) -val punish_double_endorsing : + already been slashed for double attesting for the given level. *) +val punish_double_attesting : Raw_context.t -> Signature.Public_key_hash.t -> Level_repr.t -> @@ -74,7 +74,7 @@ val punish_double_endorsing : (** Record in the context that the given delegate has now been slashed for double baking for the given level and returns the amounts to burn and to reward. If the delegate has no remaining frozen - deposits, this will also forbid it to bake or endorse until a new + deposits, this will also forbid it to bake or attest until a new deposit is frozen. Fails with [Unrequired_denunciation] if the given delegate has diff --git a/src/proto_alpha/lib_protocol/staking.ml b/src/proto_alpha/lib_protocol/staking.ml index 67761f477e6a..fe2a7e781922 100644 --- a/src/proto_alpha/lib_protocol/staking.ml +++ b/src/proto_alpha/lib_protocol/staking.ml @@ -92,7 +92,7 @@ let punish_delegate ctxt delegate level mistake ~rewarded = let punish = match mistake with | `Double_baking -> Delegate.punish_double_baking - | `Double_endorsing -> Delegate.punish_double_endorsing + | `Double_endorsing -> Delegate.punish_double_attesting in let* ctxt, {staked; unstaked} = punish ctxt delegate level in let init_to_burn_to_reward = diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index 09574006e71b..db8963eab29b 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -1393,7 +1393,7 @@ module Anonymous = struct in let delegate_pk, delegate = (consensus_key1.consensus_pk, delegate1) in let* already_slashed = - Delegate.already_slashed_for_double_endorsing ctxt delegate level + Delegate.already_slashed_for_double_attesting ctxt delegate level in let*? () = error_unless -- GitLab From 49943cbf06df83246ce6c8f2ed0234f7d1ccad8c Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 7 Jul 2023 12:19:44 +0200 Subject: [PATCH 7/9] alpha: rename double_endorsing in staking --- src/proto_alpha/lib_protocol/apply.ml | 2 +- src/proto_alpha/lib_protocol/staking.ml | 2 +- src/proto_alpha/lib_protocol/staking.mli | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index a97bada20727..fa01e463bf26 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -2148,7 +2148,7 @@ let punish_double_endorsement_or_preattestation (type kind) ctxt ctxt consensus_pk1.delegate level - `Double_endorsing + `Double_attesting mk_result ~payload_producer diff --git a/src/proto_alpha/lib_protocol/staking.ml b/src/proto_alpha/lib_protocol/staking.ml index fe2a7e781922..52f52efe33b9 100644 --- a/src/proto_alpha/lib_protocol/staking.ml +++ b/src/proto_alpha/lib_protocol/staking.ml @@ -92,7 +92,7 @@ let punish_delegate ctxt delegate level mistake ~rewarded = let punish = match mistake with | `Double_baking -> Delegate.punish_double_baking - | `Double_endorsing -> Delegate.punish_double_attesting + | `Double_attesting -> Delegate.punish_double_attesting in let* ctxt, {staked; unstaked} = punish ctxt delegate level in let init_to_burn_to_reward = diff --git a/src/proto_alpha/lib_protocol/staking.mli b/src/proto_alpha/lib_protocol/staking.mli index 14612f3e20b9..92dc9f9a5175 100644 --- a/src/proto_alpha/lib_protocol/staking.mli +++ b/src/proto_alpha/lib_protocol/staking.mli @@ -61,6 +61,6 @@ val punish_delegate : context -> public_key_hash -> Level.t -> - [`Double_baking | `Double_endorsing] -> + [`Double_baking | `Double_attesting] -> rewarded:Contract.t -> (context * Receipt.balance_updates) tzresult Lwt.t -- GitLab From 780f05aa29a8efee13c90c73066c67e37d7b8888 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 7 Jul 2023 12:27:27 +0200 Subject: [PATCH 8/9] alpha: rename double_endorsement in validate --- src/proto_alpha/lib_protocol/validate.ml | 84 ++++++++++++------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/src/proto_alpha/lib_protocol/validate.ml b/src/proto_alpha/lib_protocol/validate.ml index db8963eab29b..5f9bbe58ca54 100644 --- a/src/proto_alpha/lib_protocol/validate.ml +++ b/src/proto_alpha/lib_protocol/validate.ml @@ -143,7 +143,7 @@ module Double_baking_evidence_map = struct list (tup2 (tup2 Raw_level.encoding Round.encoding) elt_encoding)) end -module Double_endorsing_evidence_map = struct +module Double_attesting_evidence_map = struct include Map.Make (struct type t = Raw_level.t * Round.t * Slot.t @@ -179,8 +179,8 @@ end type anonymous_state = { activation_pkhs_seen : Operation_hash.t Ed25519.Public_key_hash.Map.t; double_baking_evidences_seen : Operation_hash.t Double_baking_evidence_map.t; - double_endorsing_evidences_seen : - Operation_hash.t Double_endorsing_evidence_map.t; + double_attesting_evidences_seen : + Operation_hash.t Double_attesting_evidence_map.t; seed_nonce_levels_seen : Operation_hash.t Raw_level.Map.t; vdf_solution_seen : Operation_hash.t option; } @@ -200,24 +200,24 @@ let anonymous_state_encoding = (fun { activation_pkhs_seen; double_baking_evidences_seen; - double_endorsing_evidences_seen; + double_attesting_evidences_seen; seed_nonce_levels_seen; vdf_solution_seen; } -> ( activation_pkhs_seen, double_baking_evidences_seen, - double_endorsing_evidences_seen, + double_attesting_evidences_seen, seed_nonce_levels_seen, vdf_solution_seen )) (fun ( activation_pkhs_seen, double_baking_evidences_seen, - double_endorsing_evidences_seen, + double_attesting_evidences_seen, seed_nonce_levels_seen, vdf_solution_seen ) -> { activation_pkhs_seen; double_baking_evidences_seen; - double_endorsing_evidences_seen; + double_attesting_evidences_seen; seed_nonce_levels_seen; vdf_solution_seen; }) @@ -230,7 +230,7 @@ let anonymous_state_encoding = (Double_baking_evidence_map.encoding Operation_hash.encoding)) (req "double_endorsing_evidences_seen" - (Double_endorsing_evidence_map.encoding Operation_hash.encoding)) + (Double_attesting_evidence_map.encoding Operation_hash.encoding)) (req "seed_nonce_levels_seen" (raw_level_map_encoding Operation_hash.encoding)) @@ -240,7 +240,7 @@ let empty_anonymous_state = { activation_pkhs_seen = Ed25519.Public_key_hash.Map.empty; double_baking_evidences_seen = Double_baking_evidence_map.empty; - double_endorsing_evidences_seen = Double_endorsing_evidence_map.empty; + double_attesting_evidences_seen = Double_attesting_evidence_map.empty; seed_nonce_levels_seen = Raw_level.Map.empty; vdf_solution_seen = None; } @@ -1330,7 +1330,7 @@ module Anonymous = struct (Outdated_denunciation {kind; level = given_level; last_cycle = last_slashable_cycle}) - let check_double_endorsing_evidence (type kind) + let check_double_attesting_evidence (type kind) ~consensus_operation:denunciation_kind vi (op1 : kind Kind.consensus Operation.t) (op2 : kind Kind.consensus Operation.t) = @@ -1409,27 +1409,27 @@ module Anonymous = struct let (Single (Double_preattestation_evidence {op1; op2})) = operation.protocol_data.contents in - check_double_endorsing_evidence + check_double_attesting_evidence ~consensus_operation:Preattestation vi op1 op2 - let check_double_endorsement_evidence vi + let check_double_attestation_evidence vi (operation : Kind.double_attestation_evidence operation) = let (Single (Double_attestation_evidence {op1; op2})) = operation.protocol_data.contents in - check_double_endorsing_evidence ~consensus_operation:Attestation vi op1 op2 + check_double_attesting_evidence ~consensus_operation:Attestation vi op1 op2 - let check_double_endorsing_evidence_conflict (type kind) vs oph + let check_double_attesting_evidence_conflict (type kind) vs oph (op1 : kind Kind.consensus Operation.t) = match op1.protocol_data.contents with | Single (Preattestation e1) | Single (Endorsement e1) -> ( match - Double_endorsing_evidence_map.find + Double_attesting_evidence_map.find (e1.level, e1.round, e1.slot) - vs.anonymous_state.double_endorsing_evidences_seen + vs.anonymous_state.double_attesting_evidences_seen with | None -> ok_unit | Some existing -> @@ -1440,60 +1440,60 @@ module Anonymous = struct let (Single (Double_preattestation_evidence {op1; _})) = operation.protocol_data.contents in - check_double_endorsing_evidence_conflict vs oph op1 + check_double_attesting_evidence_conflict vs oph op1 - let check_double_endorsement_evidence_conflict vs oph + let check_double_attestation_evidence_conflict vs oph (operation : Kind.double_attestation_evidence operation) = let (Single (Double_attestation_evidence {op1; _})) = operation.protocol_data.contents in - check_double_endorsing_evidence_conflict vs oph op1 + check_double_attesting_evidence_conflict vs oph op1 let wrap_denunciation_conflict kind = function | Ok () -> ok_unit | Error conflict -> error (Conflicting_denunciation {kind; conflict}) - let add_double_endorsing_evidence (type kind) vs oph + let add_double_attesting_evidence (type kind) vs oph (op1 : kind Kind.consensus Operation.t) = match op1.protocol_data.contents with | Single (Preattestation e1) | Single (Endorsement e1) -> - let double_endorsing_evidences_seen = - Double_endorsing_evidence_map.add + let double_attesting_evidences_seen = + Double_attesting_evidence_map.add (e1.level, e1.round, e1.slot) oph - vs.anonymous_state.double_endorsing_evidences_seen + vs.anonymous_state.double_attesting_evidences_seen in { vs with anonymous_state = - {vs.anonymous_state with double_endorsing_evidences_seen}; + {vs.anonymous_state with double_attesting_evidences_seen}; } - let add_double_endorsement_evidence vs oph + let add_double_attestation_evidence vs oph (operation : Kind.double_attestation_evidence operation) = let (Single (Double_attestation_evidence {op1; _})) = operation.protocol_data.contents in - add_double_endorsing_evidence vs oph op1 + add_double_attesting_evidence vs oph op1 let add_double_preattestation_evidence vs oph (operation : Kind.double_preattestation_evidence operation) = let (Single (Double_preattestation_evidence {op1; _})) = operation.protocol_data.contents in - add_double_endorsing_evidence vs oph op1 + add_double_attesting_evidence vs oph op1 - let remove_double_endorsing_evidence (type kind) vs + let remove_double_attesting_evidence (type kind) vs (op : kind Kind.consensus Operation.t) = match op.protocol_data.contents with | Single (Endorsement e) | Single (Preattestation e) -> - let double_endorsing_evidences_seen = - Double_endorsing_evidence_map.remove + let double_attesting_evidences_seen = + Double_attesting_evidence_map.remove (e.level, e.round, e.slot) - vs.anonymous_state.double_endorsing_evidences_seen + vs.anonymous_state.double_attesting_evidences_seen in let anonymous_state = - {vs.anonymous_state with double_endorsing_evidences_seen} + {vs.anonymous_state with double_attesting_evidences_seen} in {vs with anonymous_state} @@ -1502,14 +1502,14 @@ module Anonymous = struct let (Single (Double_preattestation_evidence {op1; _})) = operation.protocol_data.contents in - remove_double_endorsing_evidence vs op1 + remove_double_attesting_evidence vs op1 - let remove_double_endorsement_evidence vs + let remove_double_attestation_evidence vs (operation : Kind.double_attestation_evidence operation) = let (Single (Double_attestation_evidence {op1; _})) = operation.protocol_data.contents in - remove_double_endorsing_evidence vs op1 + remove_double_attesting_evidence vs op1 let check_double_baking_evidence vi (operation : Kind.double_baking_evidence operation) = @@ -2466,7 +2466,7 @@ let check_operation ?(check_signature = true) info (type kind) | Single (Double_preattestation_evidence _) -> Anonymous.check_double_preattestation_evidence info operation | Single (Double_attestation_evidence _) -> - Anonymous.check_double_endorsement_evidence info operation + Anonymous.check_double_attestation_evidence info operation | Single (Double_baking_evidence _) -> Anonymous.check_double_baking_evidence info operation | Single (Drain_delegate _) -> @@ -2533,7 +2533,7 @@ let check_operation_conflict (type kind) operation_conflict_state oph oph operation | Single (Double_attestation_evidence _) -> - Anonymous.check_double_endorsement_evidence_conflict + Anonymous.check_double_attestation_evidence_conflict operation_conflict_state oph operation @@ -2587,7 +2587,7 @@ let add_valid_operation operation_conflict_state oph (type kind) oph operation | Single (Double_attestation_evidence _) -> - Anonymous.add_double_endorsement_evidence + Anonymous.add_double_attestation_evidence operation_conflict_state oph operation @@ -2630,7 +2630,7 @@ let remove_operation operation_conflict_state (type kind) operation_conflict_state operation | Single (Double_attestation_evidence _) -> - Anonymous.remove_double_endorsement_evidence + Anonymous.remove_double_attestation_evidence operation_conflict_state operation | Single (Double_baking_evidence _) -> @@ -2772,16 +2772,16 @@ let validate_operation ?(check_signature = true) return {info; operation_state; block_state} | Single (Double_attestation_evidence _) -> let open Anonymous in - let* () = check_double_endorsement_evidence info operation in + let* () = check_double_attestation_evidence info operation in let*? () = - check_double_endorsement_evidence_conflict + check_double_attestation_evidence_conflict operation_state oph operation |> wrap_denunciation_conflict Attestation in let operation_state = - add_double_endorsement_evidence operation_state oph operation + add_double_attestation_evidence operation_state oph operation in return {info; operation_state; block_state} | Single (Double_baking_evidence _) -> -- GitLab From 6b59bc0b26fdf180451f31d3643b17064fea14e6 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Fri, 7 Jul 2023 12:30:08 +0200 Subject: [PATCH 9/9] alpha: rename double_endorsement in apply --- src/proto_alpha/lib_protocol/apply.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index fa01e463bf26..b447a6a3ee0d 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -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_preattestation (type kind) ctxt +let punish_double_attestation_or_preattestation (type kind) ctxt ~(op1 : kind Kind.consensus Operation.t) ~payload_producer : (context * kind Kind.double_consensus_operation_evidence contents_result_list) @@ -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_preattestation_evidence {op1; op2 = _}) -> - punish_double_endorsement_or_preattestation ctxt ~op1 ~payload_producer + punish_double_attestation_or_preattestation ctxt ~op1 ~payload_producer | Single (Double_attestation_evidence {op1; op2 = _}) -> - punish_double_endorsement_or_preattestation ctxt ~op1 ~payload_producer + punish_double_attestation_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}) -> -- GitLab