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 () ->
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"

View File

@ -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

View File

@ -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
| _ ->

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 ->
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 =

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
| 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 ()

View File

@ -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