Michelson: unplug internal operation parsing

This commit is contained in:
Benjamin Canou 2018-06-28 16:51:13 +02:00
parent 4b9d2114b2
commit a8d2998170

View File

@ -1383,14 +1383,10 @@ let rec parse_data
| Signature_t _, expr -> | Signature_t _, expr ->
traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr))) traced (fail (Invalid_kind (location expr, [ String_kind ; Bytes_kind ], kind expr)))
(* Operations *) (* Operations *)
| Operation_t _, Bytes (_, bytes) -> | Operation_t _, _ ->
Lwt.return (Gas.consume ctxt (Typecheck_costs.operation bytes)) >>=? fun ctxt -> (* operations cannot appear in parameters or storage,
begin match Data_encoding.Binary.of_bytes Operation.internal_operation_encoding bytes with the protocol should never parse the bytes of an operation *)
| Some op -> return (op, ctxt) assert false
| None -> error () >>=? fail
end
| Operation_t _, expr ->
traced (fail (Invalid_kind (location expr, [ Bytes_kind ], kind expr)))
(* Addresses *) (* Addresses *)
| Address_t _, Bytes (_, bytes) (* As unparsed with [O[ptimized]. *) -> | Address_t _, Bytes (_, bytes) (* As unparsed with [O[ptimized]. *) ->
Lwt.return (Gas.consume ctxt Typecheck_costs.contract) >>=? fun ctxt -> Lwt.return (Gas.consume ctxt Typecheck_costs.contract) >>=? fun ctxt ->