123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2021 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. *)(* *)(*****************************************************************************)moduleRequest=Prevalidator_worker_state.Requestletsection=["prevalidator"]includeInternal_event.Simpleletrequest_failed=declare_3~section~name:"request_failed"~msg:"request {view} failed {worker_status}: {errors}"~level:Notice~pp1:Request.pp~pp2:Worker_types.pp_status~pp3:Error_monad.pp_print_trace("view",(* We use [Data_encoding.dynamic_size] because the
[Request.encoding] is of type [variable length] while the
other encodings are
[Data_encoding.dynamic_Size]. [Data_encoding] requires us to
cast the first one explicitely. *)Data_encoding.dynamic_sizeRequest.encoding)("worker_status",Worker_types.request_status_encoding)("errors",Error_monad.trace_encoding)letinvalid_mempool_filter_configuration=declare_0~section~name:"invalid_mempool_filter_configuration"~msg:"invalid mempool filter configuration"~level:Warning()letunparsable_operation=declare_1~section~name:"unparsable_operation"~msg:"unparsable operation {oph}"~level:Debug~pp1:Operation_hash.pp("oph",Operation_hash.encoding)letprocessing_operations=declare_0~section~name:"processing_operations"~msg:"processing operations"~level:Debug()letfetching_operation=declare_1~section~name:"fetching_operation"~msg:"fetching operation {oph}"~level:Debug~pp1:Operation_hash.pp("oph",Operation_hash.encoding)letoperation_included=declare_1~section~name:"operation_included"~msg:"operation {oph} included before being prevalidated"~level:Debug~pp1:Operation_hash.pp("oph",Operation_hash.encoding)letoperations_to_reclassify=declare_1~section~name:"operations_to_reclassify"~msg:"{count} operations set to be reeclassified after the flush"~level:Debug~pp1:Format.pp_print_int("count",Data_encoding.int31)letoperation_reclassified=declare_1~section~name:"operation_reclassified"~msg:"operation {oph} reclassified"~level:Debug~pp1:Operation_hash.pp("oph",Operation_hash.encoding)letoperation_injected=declare_1~section~name:"operation_injected"~msg:"operation {oph} injected "~level:Notice~pp1:Operation_hash.pp("oph",Operation_hash.encoding)letoperation_banned=declare_1~section~name:"operation_banned"~msg:"operation {oph} banned"~level:Notice~pp1:Operation_hash.pp("oph",Operation_hash.encoding)letrequest_completed_info=declare_2~section~name:"request_completed_info"~msg:"{view} in {worker_status}"~level:Info~pp1:Request.pp~pp2:Worker_types.pp_status_completed("view",Request.encoding)("worker_status",Worker_types.request_status_encoding)(* FIXME https://gitlab.com/tezos/tezos/-/issues/1266
The level duplication is an intermediate solution. Those events are
"worker" related and should be handled properly by the worker.
To do so, the level should be associated directly with the request
view instead. *)letrequest_completed_debug=declare_2~section~name:"request_completed_debug"~msg:"{view} {worker_status}"~level:Debug~pp1:Request.pp~pp2:Worker_types.pp_status("view",Request.encoding)("worker_status",Worker_types.request_status_encoding)typeorigin=PeerofP2p_peer_id.t|Arrived|Injected|Leftoverletorigin_encoding:originData_encoding.t=letopenData_encodinginunion~tag_size:`Uint8[case~title:"notified"(Tag0)P2p_peer_id.encoding(functionPeerpeer_id->Somepeer_id|_->None)(funpeer_id->Peerpeer_id);case~title:"leftover"(Tag1)(constant"leftover")(functionLeftover->Some()|_->None)(fun()->Leftover);case~title:"arrived"(Tag2)(constant"arrived")(functionArrived->Some()|_->None)(fun()->Arrived);case~title:"injected"(Tag3)(constant"injected")(functionInjected->Some()|_->None)(fun()->Injected);]letpp_originfmt=function|Peerpeer_id->Format.fprintffmt"notified by %a"P2p_peer_id.pppeer_id|Leftover->Format.fprintffmt"leftover from previous run"|Arrived->Format.fprintffmt"arrived"|Injected->Format.fprintffmt"injected"letban_operation_encountered=declare_2~section~name:"banned_operation_encountered"~msg:"{origin}: banned {oph} encountered"~level:Notice~pp1:pp_origin~pp2:Operation_hash.pp("origin",origin_encoding)("oph",Operation_hash.encoding)letoperation_not_fetched=declare_1~section~name:"operation_not_fetched"~msg:"Operation {oph} was not fetched"~level:Debug~pp1:Operation_hash.pp("oph",Operation_hash.encoding)