Client: remove compilation warnings due to Cli_entries.log returning 'unit Lwt.t'

This commit is contained in:
Guillem Rieu 2016-11-22 17:59:09 +01:00 committed by Benjamin Canou
parent 69adc115be
commit 5b1244648c
6 changed files with 18 additions and 19 deletions

View File

@ -46,8 +46,7 @@ let gen_keys name =
Secret_key.add name secret_key >>= fun () -> Secret_key.add name secret_key >>= fun () ->
Public_key.add name public_key >>= fun () -> Public_key.add name public_key >>= fun () ->
Public_key_hash.add name (Ed25519.hash 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 ; Cli_entries.message "I generated a brand new pair of keys under the name '%s'." name
Lwt.return ()
let check_keys_consistency pk sk = let check_keys_consistency pk sk =
let message = MBytes.of_string "Voulez-vous coucher avec moi, ce soir ?" in 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 -> Public_key_hash.to_source pkh >>= fun v ->
message "%s: %s%s%s" name v message "%s: %s%s%s" name v
(if pkm then " (public key known)" else "") (if pkm then " (public key known)" else "")
(if pks then " (secret key known)" else "") ; (if pks then " (secret key known)" else ""))
Lwt.return ())
l) ; l) ;
command command
~group: "keys" ~group: "keys"

View File

@ -292,7 +292,7 @@ let endorse state =
Block_hash.pp_short hash Block_hash.pp_short hash
Raw_level.pp level Raw_level.pp level
slot name slot name
Operation_hash.pp_short oph ; Operation_hash.pp_short oph >>= fun () ->
return ()) return ())
to_endorse to_endorse

View File

@ -374,7 +374,7 @@ let mine state =
Block_hash.pp_short bi.hash Block_hash.pp_short bi.hash
Raw_level.pp level priority Raw_level.pp level priority
Fitness.pp fitness Fitness.pp fitness
(List.length operations.applied) ; (List.length operations.applied) >>= fun () ->
return () return ()
end end
| _ -> | _ ->

View File

@ -27,7 +27,7 @@ let mine_block block ?force ?max_priority ?src_sk delegate =
~seed_nonce ~src_sk block delegate >>=? fun block_hash -> ~seed_nonce ~src_sk block delegate >>=? fun block_hash ->
Client_mining_forge.State.record_block level block_hash seed_nonce Client_mining_forge.State.record_block level block_hash seed_nonce
|> trace_exn (Failure "Error while recording block") >>=? fun () -> |> 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 () return ()
let endorse_block ?force ?max_priority delegate = 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_keys.get_key delegate >>=? fun (_src_name, src_pk, src_sk) ->
Client_mining_endorsement.forge_endorsement Client_mining_endorsement.forge_endorsement
block ?force ?max_priority ~src_sk src_pk >>=? fun oph -> block ?force ?max_priority ~src_sk src_pk >>=? fun oph ->
answer "Operation successfully injected in the node." ; answer "Operation successfully injected in the node." >>= fun () ->
answer "Operation hash is '%a'." Operation_hash.pp oph ; answer "Operation hash is '%a'." Operation_hash.pp oph >>= fun () ->
return () return ()
let get_predecessor_cycle cycle = let get_predecessor_cycle cycle =

View File

@ -31,11 +31,11 @@ let forge_seed_nonce_revelation block ?(force = false) redempted_nonces =
Client_proto_rpcs.Context.Nonce.get block level >>=? function Client_proto_rpcs.Context.Nonce.get block level >>=? function
| Forgotten -> | Forgotten ->
message "Too late revelation for level %a" message "Too late revelation for level %a"
Raw_level.pp level ; Raw_level.pp level >>= fun () ->
return None return None
| Revealed _ -> | Revealed _ ->
message "Ignoring previously-revealed nonce for level %a" message "Ignoring previously-revealed nonce for level %a"
Raw_level.pp level ; Raw_level.pp level >>= fun () ->
return None return None
| Missing nonce_hash -> | Missing nonce_hash ->
if Nonce.check_hash nonce nonce_hash then 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 inject_seed_nonce_revelation
block ~force ~wait:true nonces >>=? fun oph -> block ~force ~wait:true nonces >>=? fun oph ->
answer "Operation successfully injected in the node." ; answer "Operation successfully injected in the node." >>= fun () ->
answer "Operation hash is '%a'." Operation_hash.pp_short oph ; answer "Operation hash is '%a'." Operation_hash.pp_short oph >>= fun () ->
return () return ()

View File

@ -13,24 +13,24 @@ let protocol =
let demo () = let demo () =
let block = Client_config.block () in 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 let msg = "test" in
Client_proto_rpcs.echo block msg >>= fun reply -> Client_proto_rpcs.echo block msg >>= fun reply ->
fail_unless (reply = msg) (Unclassified "...") >>=? fun () -> fail_unless (reply = msg) (Unclassified "...") >>=? fun () ->
begin begin
Cli_entries.message "Calling the 'failing' RPC." ; Cli_entries.message "Calling the 'failing' RPC." >>= fun () ->
Client_proto_rpcs.failing block 3 >>= function Client_proto_rpcs.failing block 3 >>= function
| Error [Ecoproto_error [Error.Demo_error 3]] -> | Error [Ecoproto_error [Error.Demo_error 3]] ->
return () return ()
| _ -> failwith "..." | _ -> failwith "..."
end >>=? fun () -> 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 begin Error.demo_error 101010 >|= wrap_error >>= function
| Error [Ecoproto_error [Error.Demo_error 101010]] -> | Error [Ecoproto_error [Error.Demo_error 101010]] ->
return () return ()
| _ -> failwith "...." | _ -> failwith "...."
end >>=? fun () -> end >>=? fun () ->
Cli_entries.answer "All good!" ; Cli_entries.answer "All good!" >>= fun () ->
return () return ()
let mine () = let mine () =
@ -47,13 +47,14 @@ let mine () =
MBytes.set_int64 b 0 (Int64.succ f) ; MBytes.set_int64 b 0 (Int64.succ f) ;
[ v ; b ] [ 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 exit 2 in
Client_node_rpcs.forge_block Client_node_rpcs.forge_block
~net:bi.net ~predecessor:bi.hash ~net:bi.net ~predecessor:bi.hash
fitness [] (MBytes.create 0) >>= fun bytes -> fitness [] (MBytes.create 0) >>= fun bytes ->
Client_node_rpcs.inject_block ~wait:true bytes >>=? fun hash -> 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 () return ()
let handle_error = function let handle_error = function