diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 32e0fb40c1f44729265752af6e8d287323897b23..794aafd9b59c559e7b2989854ca1d8480f20dbcc 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -911,8 +911,8 @@ let pp_contents_and_result : "@[Slot attestation:@,Delegate: %a@]" Signature.Public_key_hash.pp delegate - | ( Double_endorsement_evidence {op1; op2}, - Double_endorsement_evidence_result bus ) -> + | ( Double_attestation_evidence {op1; op2}, + Double_attestation_evidence_result bus ) -> Format.fprintf ppf "@[Double attestation evidence:@,\ diff --git a/src/proto_alpha/lib_parameters/default_parameters.ml b/src/proto_alpha/lib_parameters/default_parameters.ml index f2b94412a5a2a0d9f2711506a4f2838126541a0b..4344a0ddfc94e293374fad4b1699a13369895fb1 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_plugin/RPC.ml b/src/proto_alpha/lib_plugin/RPC.ml index d642826cc496c260d4967f27e4e7dfbc68e25174..b96e708771f0219c22abf328561cde8828244d16 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 2b4892c655a108fa8ca837bfd15c4b9c5f2a033f..e4fe71b5d26fc9ade50f233621c5cea4e2f343f3 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 b05a7975d4423f116baa5dde3561e6cdcda4f7e0..8e03c8c0f4501ee79ed05b66f5090237fa79a91a 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 @@ -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 -> @@ -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 0037b73e1236679d55386991d9433b453132ef21..b447a6a3ee0de648454e5a417f8bafb07e7cf84c 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 _, _) -> @@ -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) @@ -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) -> @@ -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 @@ -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 - | Single (Double_endorsement_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_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}) -> diff --git a/src/proto_alpha/lib_protocol/apply_results.ml b/src/proto_alpha/lib_protocol/apply_results.ml index 0a7bf47332124061bd7efe08421a6f1c0274e055..99dc9f7db0730afaacb199ad5bd71d56254b727a 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,16 +1225,16 @@ 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 = (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); - 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,16 +1249,16 @@ 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 = (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); - 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,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_attestation_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/apply_results.mli b/src/proto_alpha/lib_protocol/apply_results.mli index 477be4ae2891ee5a2a7129b7b87517416d9a0416..75e33ef795b20617302541176d4c322d37a2c493 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_protocol/constants_parametric_previous_repr.ml b/src/proto_alpha/lib_protocol/constants_parametric_previous_repr.ml index 918a77b9190c095911c472847057c2f00a3b7197..910fdbcde1a9f50c9d2f898ead2723ca269ce40c 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 5776add0db659704c661ad948fdb3bc73f356a26..294790c41a079e428af872628d11cb61825aba62 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 5c2d2ff1ed763d622bd04e837c5a8d0a7b6224df..ef506c6c05d27b760311a38adb240e917f1d2e36 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 e7d5e342a4685c901a90fe42c65965ef5e52c615..fbb4718fbf8c561c38967e4b7b2272804bd1cc63 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 d759d749079849d465ad31900716d8d3a83544a7..223ff93879bbf9078bb0f79493dcca96acbe9ae2 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 7d254caf9b2e53a9349ed6d27294ff38250691d5..32471c3d5c04150eea87cc603e123ac065d3f463 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 17ffa9386b66b7200f9fceaa49743515caf81b5e..620291d8f02fdb43a404d8a490fd85a2325997d7 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 b553737db6f7310258a23e823fdb11994e165b03..165a04a1d6e6cff2bec395d1db9653054ed8d2c4 100644 --- a/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml +++ b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.ml @@ -25,11 +25,11 @@ (* *) (*****************************************************************************) -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 - | 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) @@ -137,12 +137,12 @@ let punish_double_signing ~get ~set ~get_percentage ctxt delegate in 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 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 = 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/delegate_slashed_deposits_storage.mli b/src/proto_alpha/lib_protocol/delegate_slashed_deposits_storage.mli index a653250427c451cd8eecf76504d49ad1591befd4..b3544b571816ab7177dba431f2a0104b709c3d92 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/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index 72732a088314a6a3463862dd3a09d4559f22b976..9a370360d8e931a09430b93bc4dd992f522a901e 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}. @@ -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 @@ -2341,12 +2341,12 @@ 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 ( 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 @@ -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,31 +2544,31 @@ 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 = 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 _ ) ) -> diff --git a/src/proto_alpha/lib_protocol/operation_repr.mli b/src/proto_alpha/lib_protocol/operation_repr.mli index 3667efd5473e1497fbb48afe85e23711bc3a7112..813f7c7d8fa5136130c5c0983bdc11008a2d18ae 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/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 24b6db99a3e7b71ab29f8de20b5aa935ed84d3bf..0f24dac256a60a771614103453936808c3f48020 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/staking.ml b/src/proto_alpha/lib_protocol/staking.ml index 67761f477e6ab05a6af0fc053b6796e5b48a39f6..52f52efe33b97bd1e380e61921d12911fa3a934d 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_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 14612f3e20b9c79fc41489519327bf75aca2f67d..92dc9f9a517597a1d196b5320c4cc4e2562bb743 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 diff --git a/src/proto_alpha/lib_protocol/storage.ml b/src/proto_alpha/lib_protocol/storage.ml index 9e370ef0ef68914d5acfa607ab07475b55f9008b..21cf53b0b8be5b79fc93707954db002c68d828ef 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 9ca01943cf820954e3b61a0a50ed948eb31b2fb0..45897573d0afdf576059cacb0f982bf0051285e8 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 diff --git a/src/proto_alpha/lib_protocol/test/helpers/op.ml b/src/proto_alpha/lib_protocol/test/helpers/op.ml index 866693595cac5db02249fd7647e12bf9017ca52d..f8154aa0f1f383c67dab0451515a4f936f1312dd 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 09adbbaa5655c869f4b967fb723d75f996333bee..64775af05039914ca056e6eefc43947188dad7e1 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/consensus/test_double_baking.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_double_baking.ml index eb2c2ac848288e24e5728a58b9d060db0ea7fb6f..c3711adaf09cdb54d458bff9241f7c4b40ac0770 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 954f3dbec6f753a03b11b7f035bcb9d357f87bae..04f8adea921d0363364f5eaa293eef658fc2e6e3 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 920fab79f637665a324e5668062ae8a56eadd7cf..69ec0b2397b32085bbff2898c9d67d1816163cbb 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 -> 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 dc2434190c593f6eb99defcf4ddb4d5960ccdd89..d975ec37811ba2c82ce3aba855122e65f08af1eb 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 d20629c374925ed7913d71ff64317562ed7c6585..2df606a2bf1113a1b6c745c44c8bb182589c6baa 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 f0f6113e0faeb08dccc2316e41865f940499144c..5f9bbe58ca54a00c49c672defecce3b5cd5e2d12 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) = @@ -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 @@ -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_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 + 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_endorsement_evidence {op1; _})) = + 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_endorsement_evidence {op1; _})) = + 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_endorsement_evidence {op1; _})) = + 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) = @@ -2465,8 +2465,8 @@ 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 _) -> - Anonymous.check_double_endorsement_evidence info operation + | Single (Double_attestation_evidence _) -> + Anonymous.check_double_attestation_evidence info operation | Single (Double_baking_evidence _) -> Anonymous.check_double_baking_evidence info operation | Single (Drain_delegate _) -> @@ -2532,8 +2532,8 @@ let check_operation_conflict (type kind) operation_conflict_state oph operation_conflict_state oph operation - | Single (Double_endorsement_evidence _) -> - Anonymous.check_double_endorsement_evidence_conflict + | Single (Double_attestation_evidence _) -> + Anonymous.check_double_attestation_evidence_conflict operation_conflict_state oph operation @@ -2586,8 +2586,8 @@ let add_valid_operation operation_conflict_state oph (type kind) operation_conflict_state oph operation - | Single (Double_endorsement_evidence _) -> - Anonymous.add_double_endorsement_evidence + | Single (Double_attestation_evidence _) -> + Anonymous.add_double_attestation_evidence operation_conflict_state oph operation @@ -2629,8 +2629,8 @@ let remove_operation operation_conflict_state (type kind) Anonymous.remove_double_preattestation_evidence operation_conflict_state operation - | Single (Double_endorsement_evidence _) -> - Anonymous.remove_double_endorsement_evidence + | Single (Double_attestation_evidence _) -> + Anonymous.remove_double_attestation_evidence operation_conflict_state operation | Single (Double_baking_evidence _) -> @@ -2770,18 +2770,18 @@ 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* () = 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 _) -> 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 72278a9be064d35b8c2df92b3d497d84896b667d..9f90481cc5d0121cdd1778b1c169b176b675d816 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