More renaming registred
-> registered
This commit is contained in:
parent
71ee3114a7
commit
5ac629f335
@ -92,7 +92,7 @@ let init_logger ?verbosity (log_config : Node_config_file.log) =
|
|||||||
|
|
||||||
let init_node ?sandbox (config : Node_config_file.t) =
|
let init_node ?sandbox (config : Node_config_file.t) =
|
||||||
let patch_context json ctxt =
|
let patch_context json ctxt =
|
||||||
let module Proto = (val Registred_protocol.get_exn genesis.protocol) in
|
let module Proto = (val Registered_protocol.get_exn genesis.protocol) in
|
||||||
protect begin fun () ->
|
protect begin fun () ->
|
||||||
Proto.configure_sandbox ctxt json
|
Proto.configure_sandbox ctxt json
|
||||||
end >|= function
|
end >|= function
|
||||||
|
@ -31,7 +31,7 @@ end
|
|||||||
let () =
|
let () =
|
||||||
Format.printf {|
|
Format.printf {|
|
||||||
let () =
|
let () =
|
||||||
let module Ignored = Tezos_protocol_updater.Registred_protocol.Register
|
let module Ignored = Tezos_protocol_updater.Registered_protocol.Register
|
||||||
(Tezos_embedded_protocol_environment_%s.Environment)
|
(Tezos_embedded_protocol_environment_%s.Environment)
|
||||||
(Tezos_embedded_raw_protocol_%s.Main)
|
(Tezos_embedded_raw_protocol_%s.Main)
|
||||||
(Source) in
|
(Source) in
|
||||||
|
@ -114,7 +114,7 @@ let check_liveness chain_state pred hash operations_hashes operations =
|
|||||||
|
|
||||||
let apply_block
|
let apply_block
|
||||||
chain_state
|
chain_state
|
||||||
pred (module Proto : Registred_protocol.T)
|
pred (module Proto : Registered_protocol.T)
|
||||||
hash (header: Block_header.t)
|
hash (header: Block_header.t)
|
||||||
operations =
|
operations =
|
||||||
let pred_header = State.Block.header pred
|
let pred_header = State.Block.header pred
|
||||||
@ -207,7 +207,7 @@ let check_chain_liveness chain_db hash (header: Block_header.t) =
|
|||||||
let get_proto pred hash =
|
let get_proto pred hash =
|
||||||
State.Block.context pred >>= fun pred_context ->
|
State.Block.context pred >>= fun pred_context ->
|
||||||
Context.get_protocol pred_context >>= fun pred_protocol_hash ->
|
Context.get_protocol pred_context >>= fun pred_protocol_hash ->
|
||||||
match Registred_protocol.get pred_protocol_hash with
|
match Registered_protocol.get pred_protocol_hash with
|
||||||
| None ->
|
| None ->
|
||||||
fail (Unavailable_protocol { block = hash ;
|
fail (Unavailable_protocol { block = hash ;
|
||||||
protocol = pred_protocol_hash })
|
protocol = pred_protocol_hash })
|
||||||
|
@ -32,7 +32,7 @@ val fetch_and_compile_protocol:
|
|||||||
t ->
|
t ->
|
||||||
?peer:P2p_peer.Id.t ->
|
?peer:P2p_peer.Id.t ->
|
||||||
?timeout:float ->
|
?timeout:float ->
|
||||||
Protocol_hash.t -> Registred_protocol.t tzresult Lwt.t
|
Protocol_hash.t -> Registered_protocol.t tzresult Lwt.t
|
||||||
|
|
||||||
val shutdown: t -> unit Lwt.t
|
val shutdown: t -> unit Lwt.t
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ module RPC = struct
|
|||||||
| None -> Lwt.fail Not_found
|
| None -> Lwt.fail Not_found
|
||||||
| Some { context = ctxt } ->
|
| Some { context = ctxt } ->
|
||||||
Context.get_protocol ctxt >>= fun protocol_hash ->
|
Context.get_protocol ctxt >>= fun protocol_hash ->
|
||||||
let (module Proto) = Registred_protocol.get_exn protocol_hash in
|
let (module Proto) = Registered_protocol.get_exn protocol_hash in
|
||||||
Base58.complete str >>= fun l1 ->
|
Base58.complete str >>= fun l1 ->
|
||||||
Proto.complete_b58prefix ctxt str >>= fun l2 ->
|
Proto.complete_b58prefix ctxt str >>= fun l2 ->
|
||||||
Lwt.return (l1 @ l2)
|
Lwt.return (l1 @ l2)
|
||||||
@ -557,7 +557,7 @@ module RPC = struct
|
|||||||
| None -> Lwt.return None
|
| None -> Lwt.return None
|
||||||
| Some rpc_context ->
|
| Some rpc_context ->
|
||||||
Context.get_protocol rpc_context.context >>= fun protocol_hash ->
|
Context.get_protocol rpc_context.context >>= fun protocol_hash ->
|
||||||
let (module Proto) = Registred_protocol.get_exn protocol_hash in
|
let (module Proto) = Registered_protocol.get_exn protocol_hash in
|
||||||
let dir = RPC_directory.map (fun () -> Lwt.return rpc_context) Proto.rpc_services in
|
let dir = RPC_directory.map (fun () -> Lwt.return rpc_context) Proto.rpc_services in
|
||||||
Lwt.return (Some (RPC_directory.map (fun _ -> ()) dir))
|
Lwt.return (Some (RPC_directory.map (fun _ -> ()) dir))
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ type prevalidation_state =
|
|||||||
-> prevalidation_state
|
-> prevalidation_state
|
||||||
|
|
||||||
and 'a proto =
|
and 'a proto =
|
||||||
(module Registred_protocol.T with type validation_state = 'a)
|
(module Registered_protocol.T with type validation_state = 'a)
|
||||||
|
|
||||||
let start_prevalidation
|
let start_prevalidation
|
||||||
?protocol_data
|
?protocol_data
|
||||||
@ -70,7 +70,7 @@ let start_prevalidation
|
|||||||
Context.get_protocol predecessor_context >>= fun protocol ->
|
Context.get_protocol predecessor_context >>= fun protocol ->
|
||||||
let predecessor = State.Block.hash predecessor in
|
let predecessor = State.Block.hash predecessor in
|
||||||
begin
|
begin
|
||||||
match Registred_protocol.get protocol with
|
match Registered_protocol.get protocol with
|
||||||
| None ->
|
| None ->
|
||||||
(* FIXME. *)
|
(* FIXME. *)
|
||||||
(* This should not happen: it should be handled in the validator. *)
|
(* This should not happen: it should be handled in the validator. *)
|
||||||
|
@ -15,7 +15,7 @@ type 'a request =
|
|||||||
| Request_validation: {
|
| Request_validation: {
|
||||||
hash: Protocol_hash.t ;
|
hash: Protocol_hash.t ;
|
||||||
protocol: Protocol.t ;
|
protocol: Protocol.t ;
|
||||||
} -> Registred_protocol.t tzresult request
|
} -> Registered_protocol.t tzresult request
|
||||||
|
|
||||||
type message = Message: 'a request * 'a Lwt.u option -> message
|
type message = Message: 'a request * 'a Lwt.u option -> message
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ let rec worker_loop bv =
|
|||||||
return ()
|
return ()
|
||||||
| Some wakener ->
|
| Some wakener ->
|
||||||
if valid then
|
if valid then
|
||||||
match Registred_protocol.get hash with
|
match Registered_protocol.get hash with
|
||||||
| Some protocol ->
|
| Some protocol ->
|
||||||
Lwt.wakeup_later wakener (Ok protocol)
|
Lwt.wakeup_later wakener (Ok protocol)
|
||||||
| None ->
|
| None ->
|
||||||
@ -97,7 +97,7 @@ let shutdown { canceler ; worker } =
|
|||||||
worker
|
worker
|
||||||
|
|
||||||
let validate { messages } hash protocol =
|
let validate { messages } hash protocol =
|
||||||
match Registred_protocol.get hash with
|
match Registered_protocol.get hash with
|
||||||
| Some protocol ->
|
| Some protocol ->
|
||||||
lwt_debug "previously validated protocol %a (before pipe)"
|
lwt_debug "previously validated protocol %a (before pipe)"
|
||||||
Protocol_hash.pp_short hash >>= fun () ->
|
Protocol_hash.pp_short hash >>= fun () ->
|
||||||
@ -112,7 +112,7 @@ let validate { messages } hash protocol =
|
|||||||
res
|
res
|
||||||
|
|
||||||
let fetch_and_compile_protocol pv ?peer ?timeout hash =
|
let fetch_and_compile_protocol pv ?peer ?timeout hash =
|
||||||
match Registred_protocol.get hash with
|
match Registered_protocol.get hash with
|
||||||
| Some proto -> return proto
|
| Some proto -> return proto
|
||||||
| None ->
|
| None ->
|
||||||
begin
|
begin
|
||||||
|
@ -14,7 +14,7 @@ val create: Distributed_db.t -> t
|
|||||||
val validate:
|
val validate:
|
||||||
t ->
|
t ->
|
||||||
Protocol_hash.t -> Protocol.t ->
|
Protocol_hash.t -> Protocol.t ->
|
||||||
Registred_protocol.t tzresult Lwt.t
|
Registered_protocol.t tzresult Lwt.t
|
||||||
|
|
||||||
val shutdown: t -> unit Lwt.t
|
val shutdown: t -> unit Lwt.t
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ val fetch_and_compile_protocol:
|
|||||||
t ->
|
t ->
|
||||||
?peer:P2p_peer.Id.t ->
|
?peer:P2p_peer.Id.t ->
|
||||||
?timeout:float ->
|
?timeout:float ->
|
||||||
Protocol_hash.t -> Registred_protocol.t tzresult Lwt.t
|
Protocol_hash.t -> Registered_protocol.t tzresult Lwt.t
|
||||||
|
|
||||||
val fetch_and_compile_protocols:
|
val fetch_and_compile_protocols:
|
||||||
t ->
|
t ->
|
||||||
|
@ -30,7 +30,7 @@ let state_genesis_block =
|
|||||||
|
|
||||||
let chain_id = Chain_id.of_block_hash genesis_hash
|
let chain_id = Chain_id.of_block_hash genesis_hash
|
||||||
|
|
||||||
module Proto = (val Registred_protocol.get_exn genesis_protocol)
|
module Proto = (val Registered_protocol.get_exn genesis_protocol)
|
||||||
|
|
||||||
let incr_timestamp timestamp =
|
let incr_timestamp timestamp =
|
||||||
Time.add timestamp (Int64.add 1L (Random.int64 10L))
|
Time.add timestamp (Int64.add 1L (Random.int64 10L))
|
||||||
|
@ -22,7 +22,7 @@ let genesis_protocol =
|
|||||||
let genesis_time =
|
let genesis_time =
|
||||||
Time.of_seconds 0L
|
Time.of_seconds 0L
|
||||||
|
|
||||||
module Proto = (val Registred_protocol.get_exn genesis_protocol)
|
module Proto = (val Registered_protocol.get_exn genesis_protocol)
|
||||||
|
|
||||||
let genesis : State.Chain.genesis = {
|
let genesis : State.Chain.genesis = {
|
||||||
time = genesis_time ;
|
time = genesis_time ;
|
||||||
|
@ -30,8 +30,8 @@ val registered: Raw_context.t -> Ed25519.Public_key_hash.t -> bool Lwt.t
|
|||||||
(** Updating the delegate of a contract.
|
(** Updating the delegate of a contract.
|
||||||
|
|
||||||
When calling this function on an "implicit contract" this function
|
When calling this function on an "implicit contract" this function
|
||||||
fails, unless when the registred delegate is the contract manager.
|
fails, unless when the registered delegate is the contract manager.
|
||||||
In the that case, the manager is now registred as a delegate. One
|
In the that case, the manager is now registered as a delegate. One
|
||||||
cannot unregister a delegate for now. The associate contract is
|
cannot unregister a delegate for now. The associate contract is
|
||||||
now 'undeletable'. *)
|
now 'undeletable'. *)
|
||||||
val set:
|
val set:
|
||||||
@ -41,13 +41,13 @@ val set:
|
|||||||
type error +=
|
type error +=
|
||||||
| Non_delegatable_contract of Contract_repr.contract (* `Permanent *)
|
| Non_delegatable_contract of Contract_repr.contract (* `Permanent *)
|
||||||
|
|
||||||
(** Iterate on all registred delegates. *)
|
(** Iterate on all registered delegates. *)
|
||||||
val fold:
|
val fold:
|
||||||
Raw_context.t ->
|
Raw_context.t ->
|
||||||
init:'a ->
|
init:'a ->
|
||||||
f:(Ed25519.Public_key_hash.t -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
f:(Ed25519.Public_key_hash.t -> 'a -> 'a Lwt.t) -> 'a Lwt.t
|
||||||
|
|
||||||
(** List all registred delegates. *)
|
(** List all registered delegates. *)
|
||||||
val list: Raw_context.t -> Ed25519.Public_key_hash.t list Lwt.t
|
val list: Raw_context.t -> Ed25519.Public_key_hash.t list Lwt.t
|
||||||
|
|
||||||
(** Various functions to 'freeze' tokens. A frozen 'deposit' keeps its
|
(** Various functions to 'freeze' tokens. A frozen 'deposit' keeps its
|
||||||
|
@ -185,7 +185,7 @@ module Contract : sig
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
(** Set of all registred delegates. *)
|
(** Set of all registered delegates. *)
|
||||||
module Delegates : Data_set_storage
|
module Delegates : Data_set_storage
|
||||||
with type t := Raw_context.t
|
with type t := Raw_context.t
|
||||||
and type elt = Ed25519.Public_key_hash.t
|
and type elt = Ed25519.Public_key_hash.t
|
||||||
|
@ -67,11 +67,11 @@ type ('q, 'i, 'o, 'e) types = ('q, 'i, 'o, 'e) Directory.types = {
|
|||||||
error : 'e Json_encoding.encoding ;
|
error : 'e Json_encoding.encoding ;
|
||||||
}
|
}
|
||||||
|
|
||||||
type registred_service = Directory.registred_service =
|
type registered_service = Directory.registered_service =
|
||||||
| Service :
|
| Service :
|
||||||
{ types : ('q, 'i, 'o, 'e) types ;
|
{ types : ('q, 'i, 'o, 'e) types ;
|
||||||
handler : ('q -> 'i -> ('o, 'e) Answer.t Lwt.t) ;
|
handler : ('q -> 'i -> ('o, 'e) Answer.t Lwt.t) ;
|
||||||
} -> registred_service
|
} -> registered_service
|
||||||
|
|
||||||
type lookup_error = Directory.lookup_error
|
type lookup_error = Directory.lookup_error
|
||||||
|
|
||||||
|
@ -65,11 +65,11 @@ type ('q, 'i, 'o, 'e) types = {
|
|||||||
error : 'e Json_encoding.encoding ;
|
error : 'e Json_encoding.encoding ;
|
||||||
}
|
}
|
||||||
|
|
||||||
type registred_service =
|
type registered_service =
|
||||||
| Service :
|
| Service :
|
||||||
{ types : ('q, 'i, 'o, 'e) types ;
|
{ types : ('q, 'i, 'o, 'e) types ;
|
||||||
handler : ('q -> 'i -> ('o, 'e) Answer.t Lwt.t) ;
|
handler : ('q -> 'i -> ('o, 'e) Answer.t Lwt.t) ;
|
||||||
} -> registred_service
|
} -> registered_service
|
||||||
|
|
||||||
type lookup_error =
|
type lookup_error =
|
||||||
[ `Not_found (* 404 *)
|
[ `Not_found (* 404 *)
|
||||||
@ -78,7 +78,7 @@ type lookup_error =
|
|||||||
]
|
]
|
||||||
|
|
||||||
(** Resolve a service. *)
|
(** Resolve a service. *)
|
||||||
val lookup: directory -> meth -> string list -> (registred_service, [> lookup_error ]) result Lwt.t
|
val lookup: directory -> meth -> string list -> (registered_service, [> lookup_error ]) result Lwt.t
|
||||||
|
|
||||||
val allowed_methods:
|
val allowed_methods:
|
||||||
directory -> string list ->
|
directory -> string list ->
|
||||||
|
@ -114,7 +114,7 @@ module Make (Encoding : ENCODING) = struct
|
|||||||
|
|
||||||
and 'key directory = 'key t
|
and 'key directory = 'key t
|
||||||
and 'key static_directory = {
|
and 'key static_directory = {
|
||||||
services : 'key registred_service_builder MethMap.t ;
|
services : 'key registered_service_builder MethMap.t ;
|
||||||
subdirs : 'key static_subdirectories option
|
subdirs : 'key static_subdirectories option
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,16 +122,16 @@ module Make (Encoding : ENCODING) = struct
|
|||||||
| Suffixes: 'key directory StringMap.t -> 'key static_subdirectories
|
| Suffixes: 'key directory StringMap.t -> 'key static_subdirectories
|
||||||
| Arg: 'a Resto.Internal.arg * ('key * 'a) directory -> 'key static_subdirectories
|
| Arg: 'a Resto.Internal.arg * ('key * 'a) directory -> 'key static_subdirectories
|
||||||
|
|
||||||
and registred_service =
|
and registered_service =
|
||||||
| Service :
|
| Service :
|
||||||
{ types : ('q, 'i, 'o, 'e) types ;
|
{ types : ('q, 'i, 'o, 'e) types ;
|
||||||
handler : ('q -> 'i -> ('o, 'e) Answer.t Lwt.t) ;
|
handler : ('q -> 'i -> ('o, 'e) Answer.t Lwt.t) ;
|
||||||
} -> registred_service
|
} -> registered_service
|
||||||
|
|
||||||
and 'key registred_service_builder = {
|
and 'key registered_service_builder = {
|
||||||
meth : Resto.meth ;
|
meth : Resto.meth ;
|
||||||
description : Encoding.schema Description.service ;
|
description : Encoding.schema Description.service ;
|
||||||
builder : 'key -> registred_service ;
|
builder : 'key -> registered_service ;
|
||||||
}
|
}
|
||||||
|
|
||||||
let empty = Empty
|
let empty = Empty
|
||||||
@ -154,7 +154,7 @@ module Make (Encoding : ENCODING) = struct
|
|||||||
: type a b.
|
: type a b.
|
||||||
(a -> b) -> b static_directory -> a static_directory
|
(a -> b) -> b static_directory -> a static_directory
|
||||||
= fun f t ->
|
= fun f t ->
|
||||||
{ services = MethMap.map (map_registred_service f) t.services ;
|
{ services = MethMap.map (map_registered_service f) t.services ;
|
||||||
subdirs = map_option (map_static_subdirectories f) t.subdirs ;
|
subdirs = map_option (map_static_subdirectories f) t.subdirs ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,9 +169,9 @@ module Make (Encoding : ENCODING) = struct
|
|||||||
let dir = map_directory (fun (a, x) -> f a, x) dir in
|
let dir = map_directory (fun (a, x) -> f a, x) dir in
|
||||||
Arg (arg, dir)
|
Arg (arg, dir)
|
||||||
|
|
||||||
and map_registred_service
|
and map_registered_service
|
||||||
: type a b.
|
: type a b.
|
||||||
(a -> b) -> b registred_service_builder -> a registred_service_builder
|
(a -> b) -> b registered_service_builder -> a registered_service_builder
|
||||||
= fun f rs ->
|
= fun f rs ->
|
||||||
{ rs with builder = (fun p -> rs.builder (f p)) }
|
{ rs with builder = (fun p -> rs.builder (f p)) }
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ module Make (Encoding : ENCODING) = struct
|
|||||||
|
|
||||||
and describe_service
|
and describe_service
|
||||||
: type a.
|
: type a.
|
||||||
a registred_service_builder -> Encoding.schema Description.service
|
a registered_service_builder -> Encoding.schema Description.service
|
||||||
= fun { description ; _ } -> description
|
= fun { description ; _ } -> description
|
||||||
|
|
||||||
and describe_query
|
and describe_query
|
||||||
@ -382,7 +382,7 @@ module Make (Encoding : ENCODING) = struct
|
|||||||
let lookup
|
let lookup
|
||||||
: type a.
|
: type a.
|
||||||
a directory -> a -> meth -> string list ->
|
a directory -> a -> meth -> string list ->
|
||||||
(registred_service, lookup_error) result Lwt.t
|
(registered_service, lookup_error) result Lwt.t
|
||||||
= fun dir args meth path ->
|
= fun dir args meth path ->
|
||||||
resolve [] dir args path >>= function
|
resolve [] dir args path >>= function
|
||||||
| Error _ as err -> Lwt.return err
|
| Error _ as err -> Lwt.return err
|
||||||
|
@ -58,11 +58,11 @@ module Make (Encoding : ENCODING) : sig
|
|||||||
error : 'error Encoding.t ;
|
error : 'error Encoding.t ;
|
||||||
}
|
}
|
||||||
|
|
||||||
type registred_service =
|
type registered_service =
|
||||||
| Service :
|
| Service :
|
||||||
{ types : ('q, 'i, 'o, 'e) types ;
|
{ types : ('q, 'i, 'o, 'e) types ;
|
||||||
handler : ('q -> 'i -> ('o, 'e) Answer.t Lwt.t) ;
|
handler : ('q -> 'i -> ('o, 'e) Answer.t Lwt.t) ;
|
||||||
} -> registred_service
|
} -> registered_service
|
||||||
|
|
||||||
(** Dispatch tree *)
|
(** Dispatch tree *)
|
||||||
type 'prefix t
|
type 'prefix t
|
||||||
@ -77,7 +77,7 @@ module Make (Encoding : ENCODING) : sig
|
|||||||
(** Resolve a service. *)
|
(** Resolve a service. *)
|
||||||
val lookup:
|
val lookup:
|
||||||
'prefix directory -> 'prefix ->
|
'prefix directory -> 'prefix ->
|
||||||
meth -> string list -> (registred_service, [> lookup_error ]) result Lwt.t
|
meth -> string list -> (registered_service, [> lookup_error ]) result Lwt.t
|
||||||
|
|
||||||
val allowed_methods:
|
val allowed_methods:
|
||||||
'prefix directory -> 'prefix -> string list ->
|
'prefix directory -> 'prefix -> string list ->
|
||||||
|
Loading…
Reference in New Issue
Block a user