From aa95ee833273d5008c2fa5e86bfadce2217ece8f Mon Sep 17 00:00:00 2001 From: Vincent Botbol Date: Mon, 25 Jun 2018 16:40:07 +0200 Subject: [PATCH] Accuser: add utility functions to forge double_evidence operations --- .../lib_protocol/src/helpers_services.ml | 8 ++++++++ .../lib_protocol/src/helpers_services.mli | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/proto_alpha/lib_protocol/src/helpers_services.ml b/src/proto_alpha/lib_protocol/src/helpers_services.ml index 7f2362567..10869be6a 100644 --- a/src/proto_alpha/lib_protocol/src/helpers_services.ml +++ b/src/proto_alpha/lib_protocol/src/helpers_services.ml @@ -424,6 +424,14 @@ module Forge = struct block ~branch ~level ~nonce () = operation ctxt block ~branch (Seed_nonce_revelation { level ; nonce }) + let double_baking_evidence ctxt + block ~branch ~bh1 ~bh2 () = + 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 }) + let empty_proof_of_work_nonce = MBytes.of_string (String.make Constants_repr.proof_of_work_nonce_size '\000') diff --git a/src/proto_alpha/lib_protocol/src/helpers_services.mli b/src/proto_alpha/lib_protocol/src/helpers_services.mli index 6d58c5c74..cf321c179 100644 --- a/src/proto_alpha/lib_protocol/src/helpers_services.mli +++ b/src/proto_alpha/lib_protocol/src/helpers_services.mli @@ -154,6 +154,20 @@ module Forge : sig nonce:Nonce.t -> unit -> MBytes.t shell_tzresult Lwt.t + val double_baking_evidence: + 'a #RPC_context.simple -> 'a -> + branch:Block_hash.t -> + bh1: Block_header.t -> + bh2: Block_header.t -> + unit -> MBytes.t shell_tzresult Lwt.t + + val double_endorsement_evidence: + 'a #RPC_context.simple -> 'a -> + branch:Block_hash.t -> + op1: Kind.endorsement operation -> + op2: Kind.endorsement operation -> + unit -> MBytes.t shell_tzresult Lwt.t + val protocol_data: 'a #RPC_context.simple -> 'a -> priority: int ->