diff --git a/src/lib_shell/worker.ml b/src/lib_shell/worker.ml index d333c4459..3dfd5ee42 100644 --- a/src/lib_shell/worker.ml +++ b/src/lib_shell/worker.ml @@ -18,7 +18,7 @@ module type EVENT = sig type t val level : t -> Logging.level - val encoding : error list Data_encoding.t -> t Data_encoding.t + val encoding : t Data_encoding.t val pp : Format.formatter -> t -> unit end diff --git a/src/lib_shell/worker.mli b/src/lib_shell/worker.mli index 580dd5d35..5ee9a1991 100644 --- a/src/lib_shell/worker.mli +++ b/src/lib_shell/worker.mli @@ -44,7 +44,7 @@ module type EVENT = sig val level : t -> Logging.level (** Serializer for the introspection RPCs *) - val encoding : error list Data_encoding.t -> t Data_encoding.t + val encoding : t Data_encoding.t (** Pretty printer, also used for logging *) val pp : Format.formatter -> t -> unit diff --git a/src/lib_shell_services/block_validator_worker_state.ml b/src/lib_shell_services/block_validator_worker_state.ml index 43cf8f34c..217c987df 100644 --- a/src/lib_shell_services/block_validator_worker_state.ml +++ b/src/lib_shell_services/block_validator_worker_state.ml @@ -46,7 +46,7 @@ module Event = struct | Validation_success _ | Validation_failure _ -> Logging.Notice - let encoding error_encoding = + let encoding = let open Data_encoding in union [ case (Tag 0) @@ -63,7 +63,7 @@ module Event = struct (obj3 (req "failed_validation" Request.encoding) (req "status" Worker_types.request_status_encoding) - (dft "errors" error_encoding [])) + (dft "errors" RPC_error.encoding [])) (function Validation_failure (r, s, err) -> Some (r, s, err) | _ -> None) (fun (r, s, err) -> Validation_failure (r, s, err)) ] diff --git a/src/lib_shell_services/block_validator_worker_state.mli b/src/lib_shell_services/block_validator_worker_state.mli index 20e7a727c..b98da8a3e 100644 --- a/src/lib_shell_services/block_validator_worker_state.mli +++ b/src/lib_shell_services/block_validator_worker_state.mli @@ -23,7 +23,7 @@ module Event : sig | Validation_failure of Request.view * Worker_types.request_status * error list | Debug of string val level : t -> Logging.level - val encoding : error list Data_encoding.encoding -> t Data_encoding.encoding + val encoding : t Data_encoding.encoding val pp : Format.formatter -> t -> unit end diff --git a/src/lib_shell_services/net_validator_worker_state.ml b/src/lib_shell_services/net_validator_worker_state.ml index 27ba18691..651b43da0 100644 --- a/src/lib_shell_services/net_validator_worker_state.ml +++ b/src/lib_shell_services/net_validator_worker_state.ml @@ -35,7 +35,7 @@ module Event = struct end | Could_not_switch_testnet _ -> Logging.Error - let encoding error_encoding = + let encoding = let open Data_encoding in union [ case (Tag 0) @@ -54,7 +54,7 @@ module Event = struct (fun (request, request_status, update, fitness) -> Processed_block { request ; request_status ; update ; fitness }) ; case (Tag 1) - error_encoding + RPC_error.encoding (function | Could_not_switch_testnet err -> Some err | _ -> None) diff --git a/src/lib_shell_services/net_validator_worker_state.mli b/src/lib_shell_services/net_validator_worker_state.mli index 995c0a522..95d8c270a 100644 --- a/src/lib_shell_services/net_validator_worker_state.mli +++ b/src/lib_shell_services/net_validator_worker_state.mli @@ -26,7 +26,7 @@ module Event : sig fitness : Fitness.t } | Could_not_switch_testnet of error list val level : t -> Logging.level - val encoding : error list Data_encoding.encoding -> t Data_encoding.encoding + val encoding : t Data_encoding.encoding val pp : Format.formatter -> t -> unit end diff --git a/src/lib_shell_services/peer_validator_worker_state.ml b/src/lib_shell_services/peer_validator_worker_state.ml index 6ef40f1b9..94eefe95d 100644 --- a/src/lib_shell_services/peer_validator_worker_state.ml +++ b/src/lib_shell_services/peer_validator_worker_state.ml @@ -47,7 +47,7 @@ module Event = struct | Debug _ -> Logging.Info | Request _ -> Logging.Notice - let encoding error_encoding = + let encoding = let open Data_encoding in union [ case (Tag 0) @@ -62,7 +62,7 @@ module Event = struct (fun (req, t) -> Request (req, t, None)) ; case (Tag 2) (obj3 - (req "error" error_encoding) + (req "error" RPC_error.encoding) (req "failed_request" Request.encoding) (req "status" Worker_types.request_status_encoding)) (function Request (req, t, Some errs) -> Some (errs, req, t) | _ -> None) diff --git a/src/lib_shell_services/peer_validator_worker_state.mli b/src/lib_shell_services/peer_validator_worker_state.mli index e1790c192..a2eaef6d2 100644 --- a/src/lib_shell_services/peer_validator_worker_state.mli +++ b/src/lib_shell_services/peer_validator_worker_state.mli @@ -20,7 +20,7 @@ module Event : sig | Request of (Request.view * Worker_types.request_status * error list option) | Debug of string val level : t -> Logging.level - val encoding : error list Data_encoding.encoding -> t Data_encoding.encoding + val encoding : t Data_encoding.encoding val pp : Format.formatter -> t -> unit end diff --git a/src/lib_shell_services/prevalidator_worker_state.ml b/src/lib_shell_services/prevalidator_worker_state.ml index e2ddb748e..e3b7925cf 100644 --- a/src/lib_shell_services/prevalidator_worker_state.ml +++ b/src/lib_shell_services/prevalidator_worker_state.ml @@ -95,7 +95,7 @@ module Event = struct | Request (View (Arrived _), _, _) -> Logging.Debug | Request (View Advertise, _, _) -> Logging.Debug - let encoding error_encoding = + let encoding = let open Data_encoding in union [ case (Tag 0) @@ -110,7 +110,7 @@ module Event = struct (fun (req, t) -> Request (req, t, None)) ; case (Tag 2) (obj3 - (req "error" error_encoding) + (req "error" RPC_error.encoding) (req "failed_request" Request.encoding) (req "status" Worker_types.request_status_encoding)) (function Request (req, t, Some errs) -> Some (errs, req, t) | _ -> None) diff --git a/src/lib_shell_services/prevalidator_worker_state.mli b/src/lib_shell_services/prevalidator_worker_state.mli index 274033527..5e92800cc 100644 --- a/src/lib_shell_services/prevalidator_worker_state.mli +++ b/src/lib_shell_services/prevalidator_worker_state.mli @@ -25,7 +25,7 @@ module Event : sig | Request of (Request.view * Worker_types.request_status * error list option) | Debug of string val level : t -> Logging.level - val encoding : error list Data_encoding.t -> t Data_encoding.t + val encoding : t Data_encoding.t val pp : Format.formatter -> t -> unit end diff --git a/src/lib_shell_services/worker_services.ml b/src/lib_shell_services/worker_services.ml index 5302027b6..87a742ac6 100644 --- a/src/lib_shell_services/worker_services.ml +++ b/src/lib_shell_services/worker_services.ml @@ -44,7 +44,7 @@ module Prevalidators = struct ~output: (Worker_types.full_status_encoding Prevalidator_worker_state.Request.encoding - (Prevalidator_worker_state.Event.encoding RPC_error.encoding) + Prevalidator_worker_state.Event.encoding RPC_error.encoding) RPC_path.(root / "workers" / "prevalidators" /: net_id_arg ) @@ -62,7 +62,7 @@ module Block_validator = struct ~output: (Worker_types.full_status_encoding Block_validator_worker_state.Request.encoding - (Block_validator_worker_state.Event.encoding RPC_error.encoding) + Block_validator_worker_state.Event.encoding RPC_error.encoding) RPC_path.(root / "workers" / "block_validator") @@ -113,7 +113,7 @@ module Peer_validators = struct ~output: (Worker_types.full_status_encoding Peer_validator_worker_state.Request.encoding - (Peer_validator_worker_state.Event.encoding RPC_error.encoding) + Peer_validator_worker_state.Event.encoding RPC_error.encoding) RPC_path.(root / "workers" / "peer_validators" /: net_id_arg /: peer_id_arg) @@ -154,10 +154,8 @@ module Net_validators = struct ~output: (Worker_types.full_status_encoding Net_validator_worker_state.Request.encoding - (Net_validator_worker_state.Event.encoding RPC_error.encoding) + Net_validator_worker_state.Event.encoding RPC_error.encoding) RPC_path.(root / "workers" / "net_validators" /: net_id_arg ) end - -end