From c7dfd54f7e88ff20cdf253fb90afa046ead7f207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Lesenechal?= Date: Fri, 22 Nov 2019 20:28:55 +0000 Subject: [PATCH] Resolve "Error when dry-running a contract (having a storage which contains a lambda)" --- src/passes/6-transpiler/untranspiler.ml | 6 +++++- src/passes/8-compiler/uncompiler.ml | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/passes/6-transpiler/untranspiler.ml b/src/passes/6-transpiler/untranspiler.ml index 2ebe2ac1f..a8a2acbf9 100644 --- a/src/passes/6-transpiler/untranspiler.ml +++ b/src/passes/6-transpiler/untranspiler.ml @@ -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 let m' = map_of_kv_list lst in 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) diff --git a/src/passes/8-compiler/uncompiler.ml b/src/passes/8-compiler/uncompiler.ml index 44763e23e..f261669ab 100644 --- a/src/passes/8-compiler/uncompiler.ml +++ b/src/passes/8-compiler/uncompiler.ml @@ -118,6 +118,13 @@ let rec translate_value (Ex_typed_value (ty, value)) : value result = ) | (Operation_t _) , (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 -> let%bind error = let%bind m_data =