Resolve "Error when dry-running a contract (having a storage which contains a lambda)"

This commit is contained in:
Rémi Lesenechal 2019-11-22 20:28:55 +00:00
parent 1219a0188c
commit c7dfd54f7e
2 changed files with 12 additions and 1 deletions

View File

@ -220,5 +220,9 @@ let rec untranspile (v : value) (t : AST.type_value) : AST.annotated_expression
@@ List.map (fun (x, (y, z)) -> let%bind yz = untranspile y z in ok (x, yz)) lst in @@ List.map (fun (x, (y, z)) -> let%bind yz = untranspile y z in ok (x, yz)) lst in
let m' = map_of_kv_list lst in let m' = map_of_kv_list lst in
return (E_record m') return (E_record m')
| T_function _ -> fail @@ bad_untranspile "function" v | T_function _ ->
let%bind n =
trace_strong (wrong_mini_c_value "lambda as string" v) @@
get_string v in
return (E_literal (Literal_string n))
| T_variable (Type_name v) -> return (E_variable v) | T_variable (Type_name v) -> return (E_variable v)

View File

@ -118,6 +118,13 @@ let rec translate_value (Ex_typed_value (ty, value)) : value result =
) )
| (Operation_t _) , (op , _) -> | (Operation_t _) , (op , _) ->
ok @@ D_operation op ok @@ D_operation op
| (Lambda_t _ as ty) , _ ->
let%bind m_ty =
trace_tzresult_lwt (simple_error "unparsing unrecognized data") @@
Proto_alpha_utils.Memory_proto_alpha.unparse_michelson_ty ty in
let pp_lambda =
Format.asprintf "[lambda of type: %a ]" Michelson.pp m_ty in
ok @@ D_string pp_lambda
| ty, v -> | ty, v ->
let%bind error = let%bind error =
let%bind m_data = let%bind m_data =