From a8d2998170f28ef19562d0c3131791bacfc9afc1 Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Thu, 28 Jun 2018 16:51:13 +0200 Subject: [PATCH] Michelson: unplug internal operation parsing --- .../lib_protocol/src/script_ir_translator.ml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/proto_alpha/lib_protocol/src/script_ir_translator.ml b/src/proto_alpha/lib_protocol/src/script_ir_translator.ml index 15a1e927f..89f4d4cb0 100644 --- a/src/proto_alpha/lib_protocol/src/script_ir_translator.ml +++ b/src/proto_alpha/lib_protocol/src/script_ir_translator.ml @@ -1383,14 +1383,10 @@ let rec parse_data | Signature_t _, expr -> traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr))) (* Operations *) - | Operation_t _, Bytes (_, bytes) -> - Lwt.return (Gas.consume ctxt (Typecheck_costs.operation bytes)) >>=? fun ctxt -> - begin match Data_encoding.Binary.of_bytes Operation.internal_operation_encoding bytes with - | Some op -> return (op, ctxt) - | None -> error () >>=? fail - end - | Operation_t _, expr -> - traced (fail (Invalid_kind (location expr, [ Bytes_kind ], kind expr))) + | Operation_t _, _ -> + (* operations cannot appear in parameters or storage, + the protocol should never parse the bytes of an operation *) + assert false (* Addresses *) | Address_t _, Bytes (_, bytes) (* As unparsed with [O[ptimized]. *) -> Lwt.return (Gas.consume ctxt Typecheck_costs.contract) >>=? fun ctxt ->