123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2020-2022 Nomadic Labs, <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)letpp_first_elementelem_encppfl=letopenFormatinpp_print_stringppf"[ ";(matchlwith|[]->()|[element]->elem_encppfelement|element::_->elem_encppfelement;pp_print_stringppf"; ...");pp_print_stringppf" ]"moduleP2p_protocol=structincludeInternal_event.Simpleletsection=["p2p";"protocol"]letprivate_node_new_peers=declare_1~section~name:"private_node_new_peers"~msg:"received new peers addresses from private peer {peer}"~level:Warning("peer",P2p_peer.Id.encoding)letprivate_node_peers_request=declare_1~section~name:"private_node_peers_request"~msg:"received requests for peers addresses from private peer {peer}"~level:Warning("peer",P2p_peer.Id.encoding)letprivate_node_swap_request=declare_1~section~name:"private_node_swap_request"~msg:"received swap requests from private peer {peer}"~level:Warning("peer",P2p_peer.Id.encoding)letprivate_node_swap_ack=declare_1~section~name:"private_node_swap_ack"~msg:"received swap ack from private peer {peer}"~level:Warning("peer",P2p_peer.Id.encoding)letprivate_node_request=declare_1~section~name:"private_node_request"~msg:"private peer ({peer}) asked other peer's addresses"~level:Warning("peer",P2p_peer.Id.encoding)letadvertise_sending_failed=declare_2~section~name:"advertise_sending_failed"~msg:"sending advertise to {peer} failed: {trace}"~level:Warning("peer",P2p_peer.Id.encoding)~pp2:pp_print_top_error_of_trace("trace",Error_monad.trace_encoding)letswap_succeeded=declare_1~section~name:"swap_succeeded"~msg:"swap to {point} succeeded"~level:Info("point",P2p_point.Id.encoding)letswap_interrupted=declare_2~section~name:"swap_interrupted"~msg:"swap to {point} was interrupted: {trace}"~level:Debug("point",P2p_point.Id.encoding)~pp2:pp_print_top_error_of_trace("trace",Error_monad.trace_encoding)letswap_failed=declare_2~section~name:"swap_failed"~msg:"swap to {point} failed: {trace}"~level:Info("point",P2p_point.Id.encoding)~pp2:pp_print_top_error_of_trace("trace",Error_monad.trace_encoding)letswap_request_ignored=declare_1~section~name:"swap_request_ignored"~msg:"swap request ignored from {peer}"~level:Info("peer",P2p_peer.Id.encoding)letno_swap_candidate=declare_1~section~name:"no_swap_candidate"~msg:"no swap candidate for {peer}"~level:Info("peer",P2p_peer.Id.encoding)endmoduleP2p_connect_handler=structincludeInternal_event.Simpleletsection=["p2p";"connect_handler"]letdisconnected=declare_2~section~name:"disconnected"~msg:"disconnected: {peer} ({point})"~level:Debug("peer",P2p_peer.Id.encoding)~pp2:P2p_connection.Id.pp("point",P2p_connection.Id.encoding)letpeer_rejected=declare_0~section~name:"peer_rejected"~msg:"[private node] incoming connection from untrusted peer rejected"~level:Notice()letauthenticate_start=declare_2~section~name:"authenticate_start"~msg:"start authentication for point {point} ({direction})"~level:Debug("point",P2p_point.Id.encoding)("direction",Data_encoding.string)letauthenticate=declare_3~section~name:"authenticate"~msg:"authentication for point {point}. direction:{direction} -> {state}"~level:Debug("point",P2p_point.Id.encoding)("direction",Data_encoding.string)("state",Data_encoding.string)letauthenticate_status=declare_3~section~name:"authenticate_status"~msg:"authentication status for point {point} {type} -> {peer}"~level:Debug("type",Data_encoding.string)("point",P2p_point.Id.encoding)("peer",P2p_peer.Id.encoding)letauthenticate_status_peer_id_correct=declare_2~section~name:"authenticate_status_peer_id_correct"~msg:"expected peer id {peer} for this point {point}"~level:Notice("point",P2p_point.Id.encoding)("peer",P2p_peer.Id.encoding)letauthenticate_status_peer_id_incorrect=declare_4~section~name:"authenticate_status_peer_id_incorrect"~msg:"authenticate failed: {point} {type}. Expected '{expected_peer_id}', \
got '{peer_id}'"~level:Warning("type",Data_encoding.string)("point",P2p_point.Id.encoding)("expected_peer_id",P2p_peer.Id.encoding)("peer_id",P2p_peer.Id.encoding)letauthenticate_error=declare_2~section~name:"authentication_error"~msg:"authentication error for {point}: {errors}"~level:Debug("point",P2p_point.Id.encoding)~pp2:pp_print_top_error_of_trace("errors",Error_monad.trace_encoding)letconnection_rejected_by_peers=declare_4~section~name:"connection_rejected_by_peers"~msg:"connection to {point} rejected by peer {peer}. Reason {reason}. Peer \
list received: {points}"~level:Debug("point",P2p_point.Id.encoding)~pp2:P2p_peer.Id.pp_short("peer",P2p_peer.Id.encoding)~pp3:P2p_rejection.pp_short("reason",P2p_rejection.encoding)~pp4:(pp_first_elementP2p_point.Id.pp)("points",Data_encoding.listP2p_point.Id.encoding)letconnection_error=declare_2~section~name:"connection_error"~msg:"connection to {point} rejected by peer : {errors}"~level:Debug("point",P2p_point.Id.encoding)~pp2:pp_print_top_error_of_trace("errors",Error_monad.trace_encoding)letconnect_status=declare_2~section~name:"connect_status"~msg:"connection status for {point}: {state}"~level:Debug("state",Data_encoding.string)("point",P2p_point.Id.encoding)letconnect_error=declare_2~section~name:"connect_error"~msg:"connection error for point {point}, disconnecting : {errors}"~level:Debug("point",P2p_point.Id.encoding)("errors",Data_encoding.(convLazy.forceLazy.from_valstring))letconnect_close_error=declare_2~section~name:"connect_close_error"~msg:"connection error while closing for point {point}: {errors}"~level:Debug("point",P2p_point.Id.encoding)("errors",Data_encoding.(convLazy.forceLazy.from_valstring))letauthenticate_reject_protocol_mismatch=declare_8~section~name:"authenticate_reject_protocol_mismatch"~msg:"no common protocol with {peer}"~level:Debug("point",P2p_point.Id.encoding)("peer",P2p_peer.Id.encoding)("local_chain",Distributed_db_version.Name.encoding)("remote_chain",Distributed_db_version.Name.encoding)~pp5:(pp_first_elementDistributed_db_version.pp)("local_db_versions",Data_encoding.listDistributed_db_version.encoding)("remote_db_version",Distributed_db_version.encoding)~pp7:(pp_first_elementP2p_version.pp)("local_p2p_version",Data_encoding.listP2p_version.encoding)("remote_p2p_version",P2p_version.encoding)letnew_connection=declare_3~section~name:"new_connection"~msg:"new connection to {addr}:{port}#{peer}"~level:Info("addr",P2p_addr.encoding)("port",Data_encoding.optionData_encoding.uint16)("peer",P2p_peer.Id.encoding)lettrigger_maintenance_too_many_connections=declare_2~section~name:"trigger_maintenance_too_many_connections"~msg:"Too many connections : trigger maintenance \
(active_connections={active_connections} / \
max_connections={max_connections})"~level:Debug("active_connections",Data_encoding.int16)("max_connections",Data_encoding.int16)lettrigger_maintenance_too_few_connections=declare_2~section~name:"trigger_maintenance_too_few_connections"~msg:"Too few connections : trigger maintenance \
(active_connections={active_connections} / \
min_connections={min_connections})"~level:Debug("active_connections",Data_encoding.int16)("min_connections",Data_encoding.int16)endmoduleP2p_conn=structincludeInternal_event.Simpleletsection=["p2p";"conn"]letpeer_discovery_disabled=declare_0~section~name:"peer_discovery_disabled"~msg:"request for new peers interrupted because peer discovery disabled"~level:Warning()letunexpected_error=declare_1~section~name:"unexpected_error_answerer"~msg:"answerer unexpected error: {errors}"~level:Error~pp1:pp_print_top_error_of_trace("errors",Error_monad.trace_encoding)letswap_ack_received=declare_3~section~name:"swap_ack_received"~msg:"swap ack received from {emitter}"~level:Info("emitter",P2p_peer.Id.encoding)("proposed_point",P2p_point.Id.encoding)("proposed_peer",P2p_peer.Id.encoding)letswap_request_received=declare_3~section~name:"swap_request_received"~msg:"swap request received from {emitter}"~level:Info("emitter",P2p_peer.Id.encoding)("proposed_point",P2p_point.Id.encoding)("proposed_peer",P2p_peer.Id.encoding)letbytes_popped_from_queue=declare_2~section~name:"bytes_popped_from_queue"~msg:"{bytes} bytes message popped from queue {peer}"~level:Debug("bytes",Data_encoding.int31)("peer",P2p_peer.Id.encoding)letdisconnect=declare_1~section~name:"disconnect"~msg:"{peer} has been explicitly closed"~level:Debug("peer",P2p_peer.Id.encoding)letbootstrap_received=declare_1~section~name:"bootstrap_received"~msg:"bootstrap message received from {emitter}"~level:Debug("emitter",P2p_peer.Id.encoding)letadvertise_received=declare_2~section~name:"advertise_received"~msg:"advertise message received from {emitter}"~level:Debug("emitter",P2p_peer.Id.encoding)("points",Data_encoding.listP2p_point.Id.encoding)endmoduleP2p_fd=structincludeInternal_event.Simpleletsection=["p2p";"fd"]letcreate_fd=declare_1~section~name:"create_fd"~msg:"cnx:{connection_id}:create fd"~level:Debug("connection_id",Data_encoding.int31)letclose_fd=declare_3~section~name:"close_fd"~msg:"cnx:{connection_id}:close fd (stats : {nread}/{nwrit})"~level:Debug("connection_id",Data_encoding.int31)("nread",Data_encoding.int31)("nwrit",Data_encoding.int31)lettry_read=declare_2~section~name:"try_read"~msg:"cnx:{connection_id}:try read {length}"~level:Debug("connection_id",Data_encoding.int31)("length",Data_encoding.int31)lettry_write=declare_2~section~name:"try_write"~msg:"cnx:{connection_id}:try write {length}"~level:Debug("connection_id",Data_encoding.int31)("length",Data_encoding.int31)letread_fd=declare_3~section~name:"read_fd"~msg:"cnx:{connection_id}:read {nread} ({nread_total})"~level:Debug("connection_id",Data_encoding.int31)("nread",Data_encoding.int31)("nread_total",Data_encoding.int31)letwritten_fd=declare_3~section~name:"written_fd"~msg:"cnx:{connection_id}:written {nwrit} ({nwrit_total})"~level:Debug("connection_id",Data_encoding.int31)("nwrit",Data_encoding.int31)("nwrit_total",Data_encoding.int31)letconnect_fd=declare_2~section~name:"connect"~msg:"cnx:{connection_id}:connect {socket}"~level:Debug("connection_id",Data_encoding.int31)("socket",Data_encoding.string)letaccept_fd=declare_2~section~name:"accept"~msg:"cnx:{connection_id}:accept {socket}"~level:Debug("connection_id",Data_encoding.int31)("socket",Data_encoding.string)endmoduleP2p_maintainance=structincludeInternal_event.Simpleletsection=["p2p";"maintenance"]typemaintenance_trigger_motive=|Activation|Last_maintenance|External|TimerofPtime.span|Too_few_connections|Too_many_connectionsletmotive_encoding=letopenData_encodinginunion[case~title:"activation"~description:"This maintenance step was triggered by its initial activation"(Tag0)(obj1(req"kind"(constant"activation")))(functionActivation->Some()|_->None)(fun()->Activation);case~title:"last_maintenance"~description:"This maintenance step was triggered by the previous one"(Tag1)(obj1(req"kind"(constant"last_maintenance")))(functionLast_maintenance->Some()|_->None)(fun()->Last_maintenance);case~title:"timer"~description:"This maintenance step was triggered by periodically checks."(Tag2)(obj2(req"kind"(constant"timer"))(req"idle_time"Time.System.Span.encoding))(functionTimerspan->Some((),span)|_->None)(fun((),span)->Timerspan);case~title:"external_event"~description:"This maintenance step was triggered by an external event"(Tag3)(obj1(req"kind"(constant"external_event")))(functionExternal->Some()|_->None)(fun()->External);case~title:"too_few_connections"~description:"This maintenance step was urgently triggered by a lack of \
connections"(Tag4)(obj1(req"kind"(constant"too_few_connections")))(functionToo_few_connections->Some()|_->None)(fun()->Too_few_connections);case~title:"too_many_connections"~description:"This maintenance step was urgently triggered by an excess of \
connections"(Tag5)(obj1(req"kind"(constant"too_many_connections")))(functionToo_many_connections->Some()|_->None)(fun()->Too_many_connections);]letmotive_ppfmt=function|Activation->Format.pp_print_stringfmt"activation"|Last_maintenance->Format.pp_print_stringfmt"last maintenance"|External->Format.pp_print_stringfmt"external"|Timerspan->Format.fprintffmt"periodically checks every %a."Time.System.Span.pp_humspan|Too_few_connections->Format.pp_print_stringfmt"too few connections"|Too_many_connections->Format.pp_print_stringfmt"too many connections"letmaintenance_started=declare_1~section~name:"maintenance_started"~msg:"maintenance step started (triggered by:{motive})"~level:Info~pp1:motive_pp("motive",motive_encoding)letmaintenance_ended=declare_1~section~name:"maintenance_ended"~msg:"maintenance step ended after {duration}"~level:Info~pp1:Time.System.Span.pp_hum("duration",Time.System.Span.encoding)lettoo_few_connections=declare_1~section~name:"too_few_connections_maintenance"~msg:"too few connections ({connections})"~level:Notice("connections",Data_encoding.int31)lettoo_many_connections=declare_1~section~name:"too_many_connections_maintenance"~msg:"too many connections (will kill {connections})"~level:Debug("connections",Data_encoding.int31)endmoduleP2p_welcome=structincludeInternal_event.Simpleletsection=["p2p";"welcome"]letincoming_error=declare_2~section~name:"incoming_error"~msg:"incoming connection failed with {error}. Ignoring"~level:Debug~pp1:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)("type",Data_encoding.string)letunexpected_error=declare_1~section~name:"unexpected_error_welcome"~msg:"unexpected error: {error}"~level:Error~pp1:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)letunexpected_error_closing_socket=declare_1~section~name:"unexpected_error_closing_socket"~msg:"unexpected error while closing socket: {error}"~level:Error~pp1:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)letincoming_connection_error=declare_1~section~name:"incoming_connection_error"~msg:"cannot accept incoming connections"~level:Error("exception",Error_monad.error_encoding)endmoduleP2p_socket=structincludeInternal_event.Simpleletsection=["p2p";"socket"]letnack_point_with_list=declare_2~section~name:"nack_point_with_list"~msg:"nack point {point} with point list {points}"~level:Debug("point",P2p_connection.Id.encoding)~pp2:(pp_first_elementP2p_point.Id.pp)("points",Data_encoding.listP2p_point.Id.encoding)letnack_point_no_point=declare_1~section~name:"nack_point_no_point"~msg:"nack point {point} (no point list due to p2p version)"~level:Debug("point",P2p_connection.Id.encoding)letsending_authentication=declare_1~section~name:"sending_authentication"~msg:"sending authentication to {point}"~level:Debug("point",P2p_point.Id.encoding)letconnection_closed=declare_1~section~name:"connection_closed"~msg:"connection closed to {peer}"~level:Debug("peer",P2p_peer.Id.encoding)letread_event=declare_2~section~name:"socket_read"~level:Debug~msg:"reading {bytes} bytes from {peer}"("bytes",Data_encoding.int31)("peer",P2p_peer.Id.encoding)letread_error=declare_0~section~name:"socket_read_error"~level:Debug~msg:"[read message] incremental decoding error"()letwrite_event=declare_2~section~name:"socket_write"~level:Debug~msg:"writing {bytes} to {peer}"("bytes",Data_encoding.int31)("peer",P2p_peer.Id.encoding)letwrite_error=declare_2~section~name:"socket_write_error"~level:Error~msg:"unexpected error when writing to {peer}: {error}"~pp1:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)("peer",P2p_peer.Id.encoding)endmoduleP2p_io_scheduler=structincludeInternal_event.Simpleletsection=["p2p";"io-scheduler"]letconnection_closed=declare_3~section~name:"connection_closed_scheduler"~msg:"connection closed {direction} ({connection_id},{name})"~level:Debug("direction",Data_encoding.string)("connection_id",Data_encoding.int31)("name",Data_encoding.string)letunexpected_error=declare_4~section~name:"unexpected_error_scheduler"~msg:"unexpected error in connection ({direction}: {connection_id},{name}): \
{error}"~level:Error("direction",Data_encoding.string)("connection_id",Data_encoding.int31)("name",Data_encoding.string)~pp4:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)letwait_quota=declare_1~section~name:"scheduler_wait_quota"~msg:"wait_quota ({name})"~level:Debug("name",Data_encoding.string)letwait=declare_1~section~name:"scheduler_wait"~msg:"wait ({name})"~level:Debug("name",Data_encoding.string)lethandle_connection=declare_3~section~name:"handle_connection"~msg:"handle {len} ({connection_id},{name})"~level:Debug("len",Data_encoding.int31)("connection_id",Data_encoding.int31)("name",Data_encoding.string)letcreate_connection=declare_2~section~name:"create_connection_scheduler"~msg:"create connection ({connection_id},{name})"~level:Debug("connection_id",Data_encoding.int31)("name",Data_encoding.string)letupdate_quota=declare_1~section~name:"update_quota"~msg:"update quota {name}"~level:Debug("name",Data_encoding.string)letreset_quota=declare_0~section~name:"reset_quota"~msg:"reset quota"~level:Debug()letcreate=declare_0~section~name:"create_connection"~msg:"create"~level:Debug()letregister=declare_1~section~name:"register_connection"~msg:"register_connection {connection_id}"~level:Debug("connection_id",Data_encoding.int31)letclose_error=declare_2~section~name:"close_connection_error"~msg:"close {connection_id} failed with {error}"~level:Warning("connection_id",Data_encoding.int31)("error",Error_monad.error_encoding)letclose=declare_1~section~name:"close_connection"~msg:"close {connection_id}"~level:Debug("connection_id",Data_encoding.int31)letshutdown=declare_1~section~name:"shutdown_connection"~msg:"shutdown {name}"~level:Info("name",Data_encoding.string)letshutdown_scheduler=declare_0~section~name:"shutdown_io_scheduler"~msg:"shutdown scheduler"~level:Info()endmoduleP2p_pool=structincludeInternal_event.Simpleletsection=["p2p";"pool"]letget_points=declare_3~section~name:"get_points"~msg:"getting points from {medium} of {source}: {point_list}"~level:Debug("medium",Data_encoding.string)("source",P2p_peer.Id.encoding)~pp3:(pp_first_elementP2p_point.Id.pp)("point_list",Data_encoding.listP2p_point.Id.encoding)letcreate_pool=declare_1~section~name:"create_pool"~msg:"create pool: known points {point_list}"~level:Debug~pp1:(pp_first_elementP2p_point.Id.pp)("point_list",Data_encoding.listP2p_point.Id.encoding)letparse_error=declare_1~section~name:"parse_error_peers"~msg:"failed to parse peers file: {error}"~level:Error~pp1:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)letsaving_metadata=declare_1~section~name:"save_metadata"~msg:"saving metadata in {file}"~level:Info("file",Data_encoding.string)letsave_peers_error=declare_1~section~name:"save_error_peers"~msg:"failed to save peers file: {error}"~level:Error~pp1:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)endmoduleDiscovery=structincludeInternal_event.Simpleletsection=["p2p";"discovery"]letcreate_socket_error=declare_0~section~name:"create_socket_error"~msg:"error creating a socket"~level:Debug()letmessage_received=declare_0~section~name:"message_received"~msg:"received discovery message"~level:Debug()letparse_error=declare_1~section~name:"parse_error"~msg:"failed to parse ({address})"~level:Debug("address",Data_encoding.string)letregister_new=declare_1~section~name:"register_new"~msg:"registering new point {point}"~level:Notice("point",P2p_point.Id.encoding)letunexpected_error=declare_2~section~name:"unexpected_error"~msg:"unexpected error in {worker} worker: {error}"~level:Error("worker",Data_encoding.string)~pp2:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)letunexpected_exit=declare_0~section~name:"unexpected_exit"~msg:"Answer worker exited unexpectedly"~level:Error()letbroadcast_message=declare_0~section~name:"broadcast_message"~msg:"Broadcasting discovery message"~level:Debug()letbroadcast_error=declare_0~section~name:"broadcast_error"~msg:"Error broadcasting a discovery request"~level:Debug()endmoduleP2p=structincludeInternal_event.Simpleletsection=["p2p"]letactivate_layer=declare_0~section~name:"activate_layer"~level:Info~msg:"activate P2P layer"()letactivate_network=declare_1~section~name:"activate_network"~level:Info~msg:"activate id {peer}"("peer",P2p_peer.Id.encoding)letmessage_read=declare_1~section~name:"message_read"~level:Debug~msg:"message read from {peer}"("peer",P2p_peer.Id.encoding)letmessage_read_error=declare_1~section~name:"message_read_error"~level:Debug~msg:"error reading message from {peer}"("peer",P2p_peer.Id.encoding)letshutdown_welcome_worker=declare_0~section~name:"shutdown_welcome_worker"~level:Notice~msg:"shutting down the p2p's welcome worker..."()letshutdown_maintenance_worker=declare_0~section~name:"shutdown_maintenance_worker"~level:Notice~msg:"shutting down the p2p's network maintenance worker..."()letshutdown_connection_pool=declare_0~section~name:"shutdown_connection_pool"~level:Notice~msg:"shutting down the p2p connection pool..."()letshutdown_connection_handler=declare_0~section~name:"shutdown_connection_handler"~level:Notice~msg:"shutting down the p2p connection handler..."()letshutdown_scheduler=declare_0~section~name:"shutdown_scheduler"~level:Notice~msg:"shutting down the p2p scheduler..."()letmessage_sent=declare_1~section~name:"message_to_send"~level:Debug~msg:"message sent to {peer}"("peer",P2p_peer.Id.encoding)letsending_message_error=declare_2~section~name:"sending_message_error"~level:Debug~msg:"error sending message to {peer}: {error}"("peer",P2p_peer.Id.encoding)~pp2:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)letmessage_trysent=declare_1~section~name:"message_trysent"~level:Debug~msg:"message trysent to {peer}"("peer",P2p_peer.Id.encoding)lettrysending_message_error=declare_2~section~name:"trysending_message_error"~level:Debug~msg:"error trysending message to {peer}: {error}"("peer",P2p_peer.Id.encoding)~pp2:pp_print_top_error_of_trace("error",Error_monad.trace_encoding)letbroadcast=declare_0~section~name:"broadcast"~level:Debug~msg:"message broadcast"()end