From 883b945f50e21f08fcedff235fbff1522fa07418 Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Wed, 6 Mar 2024 11:19:33 +0100 Subject: [PATCH] Proto/tests: expose double attestation percentage function --- src/proto_alpha/lib_protocol/slash_percentage.ml | 4 ++++ src/proto_alpha/lib_protocol/slash_percentage.mli | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/proto_alpha/lib_protocol/slash_percentage.ml b/src/proto_alpha/lib_protocol/slash_percentage.ml index 68c9f28c94aa..83e31903dab7 100644 --- a/src/proto_alpha/lib_protocol/slash_percentage.ml +++ b/src/proto_alpha/lib_protocol/slash_percentage.ml @@ -44,3 +44,7 @@ let get ctxt ~(kind : Misbehaviour_repr.kind) ~(level : Level_repr.t) | Double_attesting | Double_preattesting -> let* ctxt, rights = Delegate_sampler.attesting_rights_count ctxt level in return (ctxt, for_double_attestation ctxt rights denounced) + +module Internal_for_tests = struct + let for_double_attestation = for_double_attestation +end diff --git a/src/proto_alpha/lib_protocol/slash_percentage.mli b/src/proto_alpha/lib_protocol/slash_percentage.mli index 2f8a71eca851..3a557576f44c 100644 --- a/src/proto_alpha/lib_protocol/slash_percentage.mli +++ b/src/proto_alpha/lib_protocol/slash_percentage.mli @@ -20,3 +20,11 @@ val get : level:Level_repr.t -> Signature.public_key_hash list -> (Raw_context.t * Percentage.t) tzresult Lwt.t + +module Internal_for_tests : sig + val for_double_attestation : + Raw_context.t -> + int Signature.Public_key_hash.Map.t -> + Signature.Public_key_hash.t list -> + Percentage.t +end -- GitLab