123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 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. *)(* *)(*****************************************************************************)openInjector_worker_typesopenInjector_sigsmoduleMake(Parameters:PARAMETERS)(Tags:moduletypeofInjector_tags.Make(Parameters.Tag))(Operation:PARAM_OPERATION)(Inj_operation:INJECTOR_OPERATIONwithtypeoperation=Operation.t)(Request:moduletypeofRequest(Inj_operation))=structincludeInternal_event.Simpleletsection=Parameters.events_section@["injector"]letmonitoring_error=declare_1~section~name:"monitoring_error"~msg:"error (ignored) in monitoring: {error}"~level:Warning("error",trace_encoding)letdeclare_1~name~msg~level?pp1enc1=declare_3~section~name~msg:("[{signer}: {tags}] "^msg)~level("signer",Signature.Public_key_hash.encoding)("tags",Tags.encoding)enc1~pp1:Signature.Public_key_hash.pp_short~pp2:Tags.pp?pp3:pp1letdeclare_2~name~msg~level?pp1?pp2enc1enc2=declare_4~section~name~msg:("[{signer}: {tags}] "^msg)~level("signer",Signature.Public_key_hash.encoding)("tags",Tags.encoding)enc1enc2~pp1:Signature.Public_key_hash.pp_short~pp2:Tags.pp?pp3:pp1?pp4:pp2letdeclare_3~name~msg~level?pp1?pp2?pp3enc1enc2enc3=declare_5~section~name~msg:("[{signer}: {tags}] "^msg)~level("signer",Signature.Public_key_hash.encoding)("tags",Tags.encoding)enc1enc2enc3~pp1:Signature.Public_key_hash.pp_short~pp2:Tags.pp?pp3:pp1?pp4:pp2?pp5:pp3letrequest_failed=declare_3~name:"request_failed"~msg:"request {view} failed ({worker_status}): {errors}"~level:Warning("view",Request.encoding)~pp1:Request.pp("worker_status",Worker_types.request_status_encoding)~pp2:Worker_types.pp_status("errors",Error_monad.trace_encoding)~pp3:Error_monad.pp_print_traceletrequest_completed_notice=declare_2~name:"request_completed_notice"~msg:"{view} {worker_status}"~level:Notice("view",Request.encoding)("worker_status",Worker_types.request_status_encoding)~pp1:Request.pp~pp2:Worker_types.pp_statusletrequest_completed_debug=declare_2~name:"request_completed_debug"~msg:"{view} {worker_status}"~level:Debug("view",Request.encoding)("worker_status",Worker_types.request_status_encoding)~pp1:Request.pp~pp2:Worker_types.pp_statusletnew_tezos_head=declare_1~name:"new_tezos_head"~msg:"processing new Tezos head {head}"~level:Debug("head",Block_hash.encoding)letcannot_compute_reorg=declare_1~name:"cannot_compute_reorg"~msg:"Cannot compute reorg for new block {head}"~level:Warning("head",Block_hash.encoding)letinjecting_pending=declare_1~name:"injecting_pending"~msg:"injecting {count} pending operations"~level:Notice("count",Data_encoding.int31)letpp_operations_listppfoperations=Format.fprintfppf"@[%a@]"(Format.pp_print_listOperation.pp)operationsletpp_operations_hash_listppfoperations=Format.fprintfppf"@[%a@]"(Format.pp_print_listInj_operation.Hash.pp)operationsletnumber_of_operations_in_queue=declare_1~name:"number_of_operations_in_queue"~msg:"injector's queue: there is currently {number_of_operations} \
operations waiting to be injected"~level:Info("number_of_operations",Data_encoding.int31)letconsidered_operations_info=declare_1~name:"considered_operations_info"~msg:"injector's queue: the following operations are being considered \
for injection {operations}"~level:Debug("operations",Data_encoding.listOperation.encoding)~pp1:pp_operations_listletdropped_operations=declare_1~name:"dropped_operations"~msg:"dropping operations: the following operations are dropped \
{operations}"~level:Debug("operations",Data_encoding.listOperation.encoding)~pp1:pp_operations_listletsimulating_operations=declare_2~name:"simulating_operations"~msg:"simulating operations (force = {force}): {operations}"~level:Debug("operations",Data_encoding.listOperation.encoding)("force",Data_encoding.bool)~pp1:pp_operations_listletdiscard_error_operation=declare_3~name:"discard_error_operation"~msg:"discarding operation {operation} failing {count} times with \
{error}"~level:Notice("operation",Operation.encoding)~pp1:Operation.pp("count",Data_encoding.int31)("error",Data_encoding.optionError_monad.trace_encoding)~pp3:(funppf->Option.iter(Error_monad.pp_print_traceppf))letinjected=declare_2~name:"injected"~msg:"injected {nb} operations in {oph}"~level:Notice("nb",Data_encoding.int31)("oph",Operation_hash.encoding)letadd_pending=declare_1~name:"add_pending"~msg:"add {operation} to pending"~level:Notice("operation",Operation.encoding)~pp1:Operation.ppletretry_operation=declare_1~name:"retry_operation"~msg:"retry {operation}"~level:Notice("operation",Operation.encoding)~pp1:Operation.ppletincluded=declare_3~name:"included"~msg:"included operations of {block} at level {level}: {operations}"~level:Notice("block",Block_hash.encoding)("level",Data_encoding.int32)("operations",Data_encoding.listInj_operation.Hash.encoding)~pp3:pp_operations_hash_listletrevert_operations=declare_1~name:"revert_operations"~msg:"reverting operations: {operations}"~level:Notice("operations",Data_encoding.listInj_operation.Hash.encoding)~pp1:pp_operations_hash_listletconfirmed_level=declare_1~name:"confirmed_level"~msg:"confirmed Tezos level {level}"~level:Notice("level",Data_encoding.int32)letloaded_from_disk=declare_2~name:"loaded_from_disk"~msg:"loaded {nb} elements in {kind} from disk"~level:Notice("nb",Data_encoding.int31)("kind",Data_encoding.string)letcorrupted_operation_on_disk=declare_2~name:"corrupted_operation_on_disk"~msg:"ignoring unreadable file {file} on disk: {error}"~level:Warning("file",Data_encoding.string)("error",Error_monad.trace_encoding)~pp1:Format.pp_print_string~pp2:Error_monad.pp_print_traceletinject_wait=declare_1~name:"inject_wait"~msg:"waiting {delay} seconds to trigger injection"~level:Notice("delay",Data_encoding.float)letnever_included=declare_2~name:"never_included"~msg:"{operation} was never included in a block after {ttl} blocks"~level:Warning("operation",Operation.encoding)("ttl",Data_encoding.int31)~pp1:Operation.ppend