From 6ad461f9e2186877532e39d78825ce7cf8a35e55 Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Tue, 26 Jun 2018 19:06:21 +0200 Subject: [PATCH] Client: fix display of failed transactions --- src/proto_alpha/lib_client/injection.ml | 9 +++++++++ src/proto_alpha/lib_client/operation_result.ml | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/proto_alpha/lib_client/injection.ml b/src/proto_alpha/lib_client/injection.ml index de52b65a6..7c4a4351b 100644 --- a/src/proto_alpha/lib_client/injection.ml +++ b/src/proto_alpha/lib_client/injection.ml @@ -320,6 +320,15 @@ let may_patch_limits match may_need_patching contents with | Some contents -> simulate cctxt ~chain ~block ?branch contents >>=? fun (_, _, result) -> + begin match detect_script_failure result with + | Ok () -> return () + | Error _ -> + cctxt#message + "@[This simulation failed:@,%a@]" + Operation_result.pp_operation_result + (contents, result.contents) >>= fun () -> + return () + end >>=? fun () -> let res = pack_contents_list contents result.contents in patch_list res | None -> return contents diff --git a/src/proto_alpha/lib_client/operation_result.ml b/src/proto_alpha/lib_client/operation_result.ml index 9d314c7df..b223c321c 100644 --- a/src/proto_alpha/lib_client/operation_result.ml +++ b/src/proto_alpha/lib_client/operation_result.ml @@ -221,14 +221,14 @@ let pp_manager_operation_contents_and_result ppf "This revelation was successfully applied" | Backtracked (Reveal_result, _) -> Format.fprintf ppf - "@This revelation was BACKTRACKED,@,\ + "@[This revelation was BACKTRACKED, \ its expected effects were NOT applied.@]" ; | Applied Delegation_result -> Format.fprintf ppf "This delegation was successfully applied" | Backtracked (Delegation_result, _) -> Format.fprintf ppf - "@This delegation was BACKTRACKED,@,\ + "@[This delegation was BACKTRACKED, \ its expected effects were NOT applied.@]" ; | Applied (Transaction_result _ as tx) -> Format.fprintf ppf @@ -236,7 +236,7 @@ let pp_manager_operation_contents_and_result ppf pp_transaction_result tx | Backtracked (Transaction_result _ as tx, _errs) -> Format.fprintf ppf - "@This transaction was BACKTRACKED,@,\ + "@[This transaction was BACKTRACKED, \ its expected effects (as follow) were NOT applied.@]" ; pp_transaction_result tx | Applied (Origination_result _ as op) -> @@ -245,7 +245,7 @@ let pp_manager_operation_contents_and_result ppf pp_origination_result op | Backtracked (Origination_result _ as op, _errs) -> Format.fprintf ppf - "@This origination was BACKTRACKED,@,\ + "@[This origination was BACKTRACKED, \ its expected effects (as follow) were NOT applied.@]" ; pp_origination_result op in Format.fprintf ppf