From 5b1244648c7766cdae4c07b4d185c46608083eb9 Mon Sep 17 00:00:00 2001 From: Guillem Rieu Date: Tue, 22 Nov 2016 17:59:09 +0100 Subject: [PATCH] Client: remove compilation warnings due to Cli_entries.log returning 'unit Lwt.t' --- src/client/client_keys.ml | 6 ++---- .../bootstrap/mining/client_mining_endorsement.ml | 2 +- .../bootstrap/mining/client_mining_forge.ml | 2 +- .../embedded/bootstrap/mining/client_mining_main.ml | 6 +++--- .../bootstrap/mining/client_mining_revelation.ml | 8 ++++---- src/client/embedded/demo/client_proto_main.ml | 13 +++++++------ 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/client/client_keys.ml b/src/client/client_keys.ml index 158434405..2b9d77969 100644 --- a/src/client/client_keys.ml +++ b/src/client/client_keys.ml @@ -46,8 +46,7 @@ let gen_keys name = Secret_key.add name secret_key >>= fun () -> Public_key.add name public_key >>= fun () -> Public_key_hash.add name (Ed25519.hash public_key) >>= fun () -> - Cli_entries.message "I generated a brand new pair of keys under the name '%s'." name ; - Lwt.return () + Cli_entries.message "I generated a brand new pair of keys under the name '%s'." name let check_keys_consistency pk sk = let message = MBytes.of_string "Voulez-vous coucher avec moi, ce soir ?" in @@ -122,8 +121,7 @@ let commands () = Public_key_hash.to_source pkh >>= fun v -> message "%s: %s%s%s" name v (if pkm then " (public key known)" else "") - (if pks then " (secret key known)" else "") ; - Lwt.return ()) + (if pks then " (secret key known)" else "")) l) ; command ~group: "keys" diff --git a/src/client/embedded/bootstrap/mining/client_mining_endorsement.ml b/src/client/embedded/bootstrap/mining/client_mining_endorsement.ml index ca31a6219..26361c782 100644 --- a/src/client/embedded/bootstrap/mining/client_mining_endorsement.ml +++ b/src/client/embedded/bootstrap/mining/client_mining_endorsement.ml @@ -292,7 +292,7 @@ let endorse state = Block_hash.pp_short hash Raw_level.pp level slot name - Operation_hash.pp_short oph ; + Operation_hash.pp_short oph >>= fun () -> return ()) to_endorse diff --git a/src/client/embedded/bootstrap/mining/client_mining_forge.ml b/src/client/embedded/bootstrap/mining/client_mining_forge.ml index fb7a274dd..0457252d5 100644 --- a/src/client/embedded/bootstrap/mining/client_mining_forge.ml +++ b/src/client/embedded/bootstrap/mining/client_mining_forge.ml @@ -374,7 +374,7 @@ let mine state = Block_hash.pp_short bi.hash Raw_level.pp level priority Fitness.pp fitness - (List.length operations.applied) ; + (List.length operations.applied) >>= fun () -> return () end | _ -> diff --git a/src/client/embedded/bootstrap/mining/client_mining_main.ml b/src/client/embedded/bootstrap/mining/client_mining_main.ml index 0236939af..253b0abd6 100644 --- a/src/client/embedded/bootstrap/mining/client_mining_main.ml +++ b/src/client/embedded/bootstrap/mining/client_mining_main.ml @@ -27,7 +27,7 @@ let mine_block block ?force ?max_priority ?src_sk delegate = ~seed_nonce ~src_sk block delegate >>=? fun block_hash -> Client_mining_forge.State.record_block level block_hash seed_nonce |> trace_exn (Failure "Error while recording block") >>=? fun () -> - message "Injected block %a" Block_hash.pp_short block_hash ; + message "Injected block %a" Block_hash.pp_short block_hash >>= fun () -> return () let endorse_block ?force ?max_priority delegate = @@ -35,8 +35,8 @@ let endorse_block ?force ?max_priority delegate = Client_keys.get_key delegate >>=? fun (_src_name, src_pk, src_sk) -> Client_mining_endorsement.forge_endorsement block ?force ?max_priority ~src_sk src_pk >>=? fun oph -> - answer "Operation successfully injected in the node." ; - answer "Operation hash is '%a'." Operation_hash.pp oph ; + answer "Operation successfully injected in the node." >>= fun () -> + answer "Operation hash is '%a'." Operation_hash.pp oph >>= fun () -> return () let get_predecessor_cycle cycle = diff --git a/src/client/embedded/bootstrap/mining/client_mining_revelation.ml b/src/client/embedded/bootstrap/mining/client_mining_revelation.ml index 696891d90..72f020fd2 100644 --- a/src/client/embedded/bootstrap/mining/client_mining_revelation.ml +++ b/src/client/embedded/bootstrap/mining/client_mining_revelation.ml @@ -31,11 +31,11 @@ let forge_seed_nonce_revelation block ?(force = false) redempted_nonces = Client_proto_rpcs.Context.Nonce.get block level >>=? function | Forgotten -> message "Too late revelation for level %a" - Raw_level.pp level ; + Raw_level.pp level >>= fun () -> return None | Revealed _ -> message "Ignoring previously-revealed nonce for level %a" - Raw_level.pp level ; + Raw_level.pp level >>= fun () -> return None | Missing nonce_hash -> if Nonce.check_hash nonce nonce_hash then @@ -53,6 +53,6 @@ let forge_seed_nonce_revelation block ?(force = false) redempted_nonces = | _ -> inject_seed_nonce_revelation block ~force ~wait:true nonces >>=? fun oph -> - answer "Operation successfully injected in the node." ; - answer "Operation hash is '%a'." Operation_hash.pp_short oph ; + answer "Operation successfully injected in the node." >>= fun () -> + answer "Operation hash is '%a'." Operation_hash.pp_short oph >>= fun () -> return () diff --git a/src/client/embedded/demo/client_proto_main.ml b/src/client/embedded/demo/client_proto_main.ml index d400920aa..2fe562f5e 100644 --- a/src/client/embedded/demo/client_proto_main.ml +++ b/src/client/embedded/demo/client_proto_main.ml @@ -13,24 +13,24 @@ let protocol = let demo () = let block = Client_config.block () in - Cli_entries.message "Calling the 'echo' RPC." ; + Cli_entries.message "Calling the 'echo' RPC." >>= fun () -> let msg = "test" in Client_proto_rpcs.echo block msg >>= fun reply -> fail_unless (reply = msg) (Unclassified "...") >>=? fun () -> begin - Cli_entries.message "Calling the 'failing' RPC." ; + Cli_entries.message "Calling the 'failing' RPC." >>= fun () -> Client_proto_rpcs.failing block 3 >>= function | Error [Ecoproto_error [Error.Demo_error 3]] -> return () | _ -> failwith "..." end >>=? fun () -> - Cli_entries.message "Direct call to `demo_error`." ; + Cli_entries.message "Direct call to `demo_error`." >>= fun () -> begin Error.demo_error 101010 >|= wrap_error >>= function | Error [Ecoproto_error [Error.Demo_error 101010]] -> return () | _ -> failwith "...." end >>=? fun () -> - Cli_entries.answer "All good!" ; + Cli_entries.answer "All good!" >>= fun () -> return () let mine () = @@ -47,13 +47,14 @@ let mine () = MBytes.set_int64 b 0 (Int64.succ f) ; [ v ; b ] | _ -> - Cli_entries.message "Cannot parse fitness: %a" Fitness.pp bi.fitness ; + Lwt.ignore_result + (Cli_entries.message "Cannot parse fitness: %a" Fitness.pp bi.fitness); exit 2 in Client_node_rpcs.forge_block ~net:bi.net ~predecessor:bi.hash fitness [] (MBytes.create 0) >>= fun bytes -> Client_node_rpcs.inject_block ~wait:true bytes >>=? fun hash -> - Cli_entries.answer "Injected %a" Block_hash.pp_short hash ; + Cli_entries.answer "Injected %a" Block_hash.pp_short hash >>= fun () -> return () let handle_error = function