Everywhere: use return_*
for * in unit none some true false
This commit is contained in:
parent
1767fcc861
commit
fd6ce36a7d
@ -57,15 +57,15 @@ module High_watermark = struct
|
|||||||
let chain_id = Chain_id.of_bytes_exn (MBytes.sub bytes 1 4) in
|
let chain_id = Chain_id.of_bytes_exn (MBytes.sub bytes 1 4) in
|
||||||
let level = get_level () in
|
let level = get_level () in
|
||||||
begin match List.assoc_opt chain_id all with
|
begin match List.assoc_opt chain_id all with
|
||||||
| None -> return None
|
| None -> return_none
|
||||||
| Some marks ->
|
| Some marks ->
|
||||||
match List.assoc_opt pkh marks with
|
match List.assoc_opt pkh marks with
|
||||||
| None -> return None
|
| None -> return_none
|
||||||
| Some (previous_level, _, None) ->
|
| Some (previous_level, _, None) ->
|
||||||
if previous_level >= level then
|
if previous_level >= level then
|
||||||
failwith "%s level %ld not above high watermark %ld" name level previous_level
|
failwith "%s level %ld not above high watermark %ld" name level previous_level
|
||||||
else
|
else
|
||||||
return None
|
return_none
|
||||||
| Some (previous_level, previous_hash, Some signature) ->
|
| Some (previous_level, previous_hash, Some signature) ->
|
||||||
if previous_level > level then
|
if previous_level > level then
|
||||||
failwith "%s level %ld below high watermark %ld" name level previous_level
|
failwith "%s level %ld below high watermark %ld" name level previous_level
|
||||||
@ -73,7 +73,7 @@ module High_watermark = struct
|
|||||||
if previous_hash <> hash then
|
if previous_hash <> hash then
|
||||||
failwith "%s level %ld already signed with different data" name level
|
failwith "%s level %ld already signed with different data" name level
|
||||||
else
|
else
|
||||||
return (Some signature)
|
return_some signature
|
||||||
else return_none
|
else return_none
|
||||||
end >>=? function
|
end >>=? function
|
||||||
| Some signature -> return signature
|
| Some signature -> return signature
|
||||||
|
@ -59,7 +59,7 @@ let if_debug k =
|
|||||||
if !debug then k ()
|
if !debug then k ()
|
||||||
|
|
||||||
let if_debug_s k =
|
let if_debug_s k =
|
||||||
if !debug then k () else return ()
|
if !debug then k () else return_unit
|
||||||
|
|
||||||
let args = default_args
|
let args = default_args
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ open Proto_alpha
|
|||||||
let error ~loc v f =
|
let error ~loc v f =
|
||||||
match v with
|
match v with
|
||||||
| Error err when List.exists f err ->
|
| Error err when List.exists f err ->
|
||||||
return ()
|
return_unit
|
||||||
| Ok _ ->
|
| Ok _ ->
|
||||||
failwith "Unexpected successful result (%s)" loc
|
failwith "Unexpected successful result (%s)" loc
|
||||||
| Error err ->
|
| Error err ->
|
||||||
@ -44,13 +44,13 @@ let equal ~loc (cmp : 'a -> 'a -> bool) msg pp a b =
|
|||||||
if not (cmp a b) then
|
if not (cmp a b) then
|
||||||
failwith "@[@[[%s]@] - @[%s : %a is not equal to %a@]@]" loc msg pp a pp b
|
failwith "@[@[[%s]@] - @[%s : %a is not equal to %a@]@]" loc msg pp a pp b
|
||||||
else
|
else
|
||||||
return ()
|
return_unit
|
||||||
|
|
||||||
let not_equal ~loc (cmp : 'a -> 'a -> bool) msg pp a b =
|
let not_equal ~loc (cmp : 'a -> 'a -> bool) msg pp a b =
|
||||||
if cmp a b then
|
if cmp a b then
|
||||||
failwith "@[@[[%s]@] - @[%s : %a is equal to %a@]@]" loc msg pp a pp b
|
failwith "@[@[[%s]@] - @[%s : %a is equal to %a@]@]" loc msg pp a pp b
|
||||||
else
|
else
|
||||||
return ()
|
return_unit
|
||||||
|
|
||||||
let equal_tez ~loc (a:Alpha_context.Tez.t) (b:Alpha_context.Tez.t) =
|
let equal_tez ~loc (a:Alpha_context.Tez.t) (b:Alpha_context.Tez.t) =
|
||||||
let open Alpha_context in
|
let open Alpha_context in
|
||||||
|
@ -46,7 +46,7 @@ module Seq_validator = struct
|
|||||||
|
|
||||||
let close _ =
|
let close _ =
|
||||||
lwt_log_notice "Shutting down ..." >>= fun () ->
|
lwt_log_notice "Shutting down ..." >>= fun () ->
|
||||||
Lwt.return ()
|
Lwt.return_unit
|
||||||
|
|
||||||
let apply_block
|
let apply_block
|
||||||
validator_process
|
validator_process
|
||||||
|
@ -271,7 +271,7 @@ module Ledger = struct
|
|||||||
return_some
|
return_some
|
||||||
(create ?git_commit ~device_info ~version
|
(create ?git_commit ~device_info ~version
|
||||||
~of_curve ~of_pkh ())
|
~of_curve ~of_pkh ())
|
||||||
| _ -> return None
|
| _ -> return_none
|
||||||
|
|
||||||
let of_hidapi ?id device_info h =
|
let of_hidapi ?id device_info h =
|
||||||
let buf = Buffer.create 100 in
|
let buf = Buffer.create 100 in
|
||||||
@ -296,7 +296,7 @@ module Ledger = struct
|
|||||||
%a"
|
%a"
|
||||||
device_info.Hidapi.path
|
device_info.Hidapi.path
|
||||||
Ledgerwallet.Transport.pp_error e ;
|
Ledgerwallet.Transport.pp_error e ;
|
||||||
return None
|
return_none
|
||||||
| Ok ({ major; minor; patch; _ } as version) ->
|
| Ok ({ major; minor; patch; _ } as version) ->
|
||||||
log_info "Found a %a application at [%s]"
|
log_info "Found a %a application at [%s]"
|
||||||
Ledgerwallet_tezos.Version.pp version device_info.path ;
|
Ledgerwallet_tezos.Version.pp version device_info.path ;
|
||||||
|
@ -102,7 +102,7 @@ let test_random algo =
|
|||||||
let ctx = fake_ctx () in
|
let ctx = fake_ctx () in
|
||||||
let decrypt_ctx = (ctx :> Client_context.prompter) in
|
let decrypt_ctx = (ctx :> Client_context.prompter) in
|
||||||
let rec inner i =
|
let rec inner i =
|
||||||
if i >= loops then return ()
|
if i >= loops then return_unit
|
||||||
else
|
else
|
||||||
let _, _, sk = Signature.generate_key ~algo () in
|
let _, _, sk = Signature.generate_key ~algo () in
|
||||||
encrypt ctx sk >>=? fun sk_uri ->
|
encrypt ctx sk >>=? fun sk_uri ->
|
||||||
|
Loading…
Reference in New Issue
Block a user