Deal with upstream MBytes changes

This commit is contained in:
Tom Jack 2019-11-02 17:54:33 -05:00
parent b06f4d3f62
commit ba7a83d0f7
3 changed files with 2 additions and 3 deletions

View File

@ -68,7 +68,7 @@ let rec translate_value (v:value) ty : michelson result = match v with
| D_timestamp n -> ok @@ int (Z.of_int n) | D_timestamp n -> ok @@ int (Z.of_int n)
| D_mutez n -> ok @@ int (Z.of_int n) | D_mutez n -> ok @@ int (Z.of_int n)
| D_string s -> ok @@ string s | D_string s -> ok @@ string s
| D_bytes s -> ok @@ bytes (Tezos_stdlib.MBytes.of_bytes s) | D_bytes s -> ok @@ bytes s
| D_unit -> ok @@ prim D_Unit | D_unit -> ok @@ prim D_Unit
| D_pair (a, b) -> ( | D_pair (a, b) -> (
let%bind (a_ty , b_ty) = get_t_pair ty in let%bind (a_ty , b_ty) = get_t_pair ty in

View File

@ -46,7 +46,7 @@ let rec translate_value ?bm_opt (Ex_typed_value (ty, value)) : value result =
| (String_t _), s -> | (String_t _), s ->
ok @@ D_string s ok @@ D_string s
| (Bytes_t _), b -> | (Bytes_t _), b ->
ok @@ D_bytes (Tezos_stdlib.MBytes.to_bytes b) ok @@ D_bytes b
| (Address_t _), (s , _) -> | (Address_t _), (s , _) ->
ok @@ D_string (Alpha_context.Contract.to_b58check s) ok @@ D_string (Alpha_context.Contract.to_b58check s)
| (Unit_t _), () -> | (Unit_t _), () ->

View File

@ -103,6 +103,5 @@ let pp_json ppf (michelson : michelson) =
let pp_hex ppf (michelson : michelson) = let pp_hex ppf (michelson : michelson) =
let canonical = strip_locations michelson in let canonical = strip_locations michelson in
let bytes = Tezos_data_encoding.Binary_writer.to_bytes_exn Script_repr.expr_encoding canonical in let bytes = Tezos_data_encoding.Binary_writer.to_bytes_exn Script_repr.expr_encoding canonical in
let bytes = Tezos_stdlib.MBytes.to_bytes bytes in
let hex = Hex.of_bytes bytes in let hex = Hex.of_bytes bytes in
Format.fprintf ppf "%a" Hex.pp hex Format.fprintf ppf "%a" Hex.pp hex