Alpha: do not use inter-modules toplevel side-effects
This commit is contained in:
parent
4bc4d6e871
commit
98f77703c4
@ -49,7 +49,7 @@ module Nonce = struct
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register1 S.get begin fun ctxt raw_level () () ->
|
register1 S.get begin fun ctxt raw_level () () ->
|
||||||
let level = Level.from_raw ctxt raw_level in
|
let level = Level.from_raw ctxt raw_level in
|
||||||
@ -71,3 +71,10 @@ module Delegate = Delegate_services
|
|||||||
module Helpers = Helpers_services
|
module Helpers = Helpers_services
|
||||||
module Forge = Helpers_services.Forge
|
module Forge = Helpers_services.Forge
|
||||||
module Parse = Helpers_services.Parse
|
module Parse = Helpers_services.Parse
|
||||||
|
|
||||||
|
let register () =
|
||||||
|
Contract.register () ;
|
||||||
|
Constants.register () ;
|
||||||
|
Delegate.register () ;
|
||||||
|
Helpers.register () ;
|
||||||
|
Nonce.register ()
|
||||||
|
@ -28,3 +28,5 @@ module Delegate = Delegate_services
|
|||||||
module Helpers = Helpers_services
|
module Helpers = Helpers_services
|
||||||
module Forge = Helpers_services.Forge
|
module Forge = Helpers_services.Forge
|
||||||
module Parse = Helpers_services.Parse
|
module Parse = Helpers_services.Parse
|
||||||
|
|
||||||
|
val register: unit -> unit
|
||||||
|
@ -32,7 +32,7 @@ module S = struct
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0_noctxt S.errors begin fun () () ->
|
register0_noctxt S.errors begin fun () () ->
|
||||||
return (Data_encoding.Json.(schema error_encoding))
|
return (Data_encoding.Json.(schema error_encoding))
|
||||||
|
@ -15,3 +15,5 @@ val errors:
|
|||||||
(** Returns all the constants of the protocol *)
|
(** Returns all the constants of the protocol *)
|
||||||
val all:
|
val all:
|
||||||
'a #RPC_context.simple -> 'a -> Constants.t shell_tzresult Lwt.t
|
'a #RPC_context.simple -> 'a -> Constants.t shell_tzresult Lwt.t
|
||||||
|
|
||||||
|
val register: unit -> unit
|
||||||
|
@ -128,14 +128,11 @@ module S = struct
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0 S.list begin fun ctxt () () ->
|
register0 S.list begin fun ctxt () () ->
|
||||||
Contract.list ctxt >>= return
|
Contract.list ctxt >>= return
|
||||||
end
|
end ;
|
||||||
|
|
||||||
let () =
|
|
||||||
let open Services_registration in
|
|
||||||
let register_field s f =
|
let register_field s f =
|
||||||
register1 s (fun ctxt contract () () ->
|
register1 s (fun ctxt contract () () ->
|
||||||
Contract.exists ctxt contract >>=? function
|
Contract.exists ctxt contract >>=? function
|
||||||
|
@ -61,3 +61,6 @@ val storage:
|
|||||||
|
|
||||||
val storage_opt:
|
val storage_opt:
|
||||||
'a #RPC_context.simple -> 'a -> Contract.t -> Script.expr option shell_tzresult Lwt.t
|
'a #RPC_context.simple -> 'a -> Contract.t -> Script.expr option shell_tzresult Lwt.t
|
||||||
|
|
||||||
|
|
||||||
|
val register: unit -> unit
|
||||||
|
@ -160,7 +160,7 @@ module S = struct
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0 S.list_delegate begin fun ctxt q () ->
|
register0 S.list_delegate begin fun ctxt q () ->
|
||||||
Delegate.list ctxt >>= fun delegates ->
|
Delegate.list ctxt >>= fun delegates ->
|
||||||
@ -377,7 +377,7 @@ module Baking_rights = struct
|
|||||||
([], Signature.Public_key_hash.Set.empty)
|
([], Signature.Public_key_hash.Set.empty)
|
||||||
rights
|
rights
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0 S.baking_rights begin fun ctxt q () ->
|
register0 S.baking_rights begin fun ctxt q () ->
|
||||||
requested_levels
|
requested_levels
|
||||||
@ -500,7 +500,7 @@ module Endorsing_rights = struct
|
|||||||
loop l map (slot+1) in
|
loop l map (slot+1) in
|
||||||
loop contract_list Signature.Public_key_hash.Map.empty 0
|
loop contract_list Signature.Public_key_hash.Map.empty 0
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0 S.endorsing_rights begin fun ctxt q () ->
|
register0 S.endorsing_rights begin fun ctxt q () ->
|
||||||
requested_levels
|
requested_levels
|
||||||
@ -524,6 +524,11 @@ module Endorsing_rights = struct
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let register () =
|
||||||
|
register () ;
|
||||||
|
Baking_rights.register () ;
|
||||||
|
Endorsing_rights.register ()
|
||||||
|
|
||||||
let endorsement_rights ctxt level =
|
let endorsement_rights ctxt level =
|
||||||
Endorsing_rights.endorsement_slots ctxt (level, None) >>=? fun l ->
|
Endorsing_rights.endorsement_slots ctxt (level, None) >>=? fun l ->
|
||||||
return (List.map (fun { Endorsing_rights.delegate ; _ } -> delegate) l)
|
return (List.map (fun { Endorsing_rights.delegate ; _ } -> delegate) l)
|
||||||
|
@ -156,3 +156,5 @@ val baking_rights:
|
|||||||
Alpha_context.t ->
|
Alpha_context.t ->
|
||||||
int option ->
|
int option ->
|
||||||
(Raw_level.t * (public_key_hash * Time.t option) list) tzresult Lwt.t
|
(Raw_level.t * (public_key_hash * Time.t option) list) tzresult Lwt.t
|
||||||
|
|
||||||
|
val register: unit -> unit
|
||||||
|
@ -121,7 +121,7 @@ module Scripts = struct
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0 S.run_code begin fun ctxt ()
|
register0 S.run_code begin fun ctxt ()
|
||||||
(code, storage, parameter, amount, contract) ->
|
(code, storage, parameter, amount, contract) ->
|
||||||
@ -234,7 +234,7 @@ module Forge = struct
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0_noctxt S.operations begin fun () (shell, proto) ->
|
register0_noctxt S.operations begin fun () (shell, proto) ->
|
||||||
return (Data_encoding.Binary.to_bytes_exn
|
return (Data_encoding.Binary.to_bytes_exn
|
||||||
@ -391,7 +391,7 @@ module Parse = struct
|
|||||||
| None -> failwith "Cant_parse_protocol_data"
|
| None -> failwith "Cant_parse_protocol_data"
|
||||||
| Some protocol_data -> return protocol_data
|
| Some protocol_data -> return protocol_data
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0 S.operations begin fun _ctxt () (operations, check) ->
|
register0 S.operations begin fun _ctxt () (operations, check) ->
|
||||||
map_s begin fun raw ->
|
map_s begin fun raw ->
|
||||||
@ -452,7 +452,10 @@ module S = struct
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let () =
|
let register () =
|
||||||
|
Scripts.register () ;
|
||||||
|
Forge.register () ;
|
||||||
|
Parse.register () ;
|
||||||
let open Services_registration in
|
let open Services_registration in
|
||||||
register0 S.current_level begin fun ctxt q () ->
|
register0 S.current_level begin fun ctxt q () ->
|
||||||
let level = Level.current ctxt in
|
let level = Level.current ctxt in
|
||||||
|
@ -176,3 +176,5 @@ module Parse : sig
|
|||||||
Block_header.protocol_data shell_tzresult Lwt.t
|
Block_header.protocol_data shell_tzresult Lwt.t
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
val register: unit -> unit
|
||||||
|
@ -50,7 +50,9 @@ let validation_passes =
|
|||||||
max_op = Some Alpha_context.Constants.max_revelations_per_block } ;
|
max_op = Some Alpha_context.Constants.max_revelations_per_block } ;
|
||||||
{ max_size = 512 * 1024 ; max_op = None } ] (* 512kB *)
|
{ max_size = 512 * 1024 ; max_op = None } ] (* 512kB *)
|
||||||
|
|
||||||
let rpc_services = Services_registration.get_rpc_services ()
|
let rpc_services =
|
||||||
|
Alpha_services.register () ;
|
||||||
|
Services_registration.get_rpc_services ()
|
||||||
|
|
||||||
type validation_mode =
|
type validation_mode =
|
||||||
| Application of {
|
| Application of {
|
||||||
|
Loading…
Reference in New Issue
Block a user