package octez-protocol-019-PtParisB-libs

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file delegate_events.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
(*****************************************************************************)
(*                                                                           *)
(* Open Source License                                                       *)
(* Copyright (c) 2021 Tocqueville Group, Inc. <marcin.pastudzki@tqtezos.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.                                                 *)
(*                                                                           *)
(*****************************************************************************)

open Protocol

let level = Internal_event.Notice

(* Ignore the value in the output. *)
let pp_ignore fmt _ = Format.pp_print_string fmt ""

module Denunciator = struct
  include Internal_event.Simple

  let section = [Protocol.name; "delegate"; "denunciation"]

  let invalid_level_conversion =
    declare_1
      ~section
      ~level:Error
      ~name:"invalid_level_conversion"
      ~msg:"invalid level conversion: {errors}"
      ~pp1:pp_print_top_error_of_trace
      ("errors", Error_monad.(TzTrace.encoding error_encoding))

  let double_attestation_detected =
    declare_2
      ~section
      ~level
      ~name:"double_attestation_detected"
      ~msg:"double attestation detected"
      ("existing_attestation", Operation_hash.encoding)
      ("new_attestation", Operation_hash.encoding)

  let double_attestation_denounced =
    declare_2
      ~section
      ~level
      ~name:"double_attestation_denounced"
      ~msg:"double attestation evidence injected: {hash}"
      ("hash", Operation_hash.encoding)
      ~pp2:pp_ignore
      ("bytes", Data_encoding.bytes)

  let double_preattestation_detected =
    declare_2
      ~section
      ~level
      ~name:"double_preattestation_detected"
      ~msg:"double preattestation detected"
      ("existing_preattestation", Operation_hash.encoding)
      ("new_preattestation", Operation_hash.encoding)

  let double_preattestation_denounced =
    declare_2
      ~section
      ~level
      ~name:"double_preattestation_denounced"
      ~msg:"double preattestation evidence injected: {hash}"
      ("hash", Operation_hash.encoding)
      ~pp2:pp_ignore
      ("bytes", Data_encoding.bytes)

  let double_consensus_already_denounced =
    declare_1
      ~section
      ~level:Debug
      ~name:"double_consensus_already_denounced"
      ~msg:"double consensus operation already denounced in {hash}"
      ("hash", Operation_hash.encoding)

  let consensus_operation_too_old =
    declare_1
      ~section
      ~level:Debug
      ~name:"consensus_operation_too_old"
      ~msg:"operation {hash} is too old to be handled"
      ("hash", Operation_hash.encoding)

  let consensus_operation_too_far_in_future =
    declare_1
      ~section
      ~level:Debug
      ~name:"consensus_operation_too_far_in_future"
      ~msg:"operation {hash} too far in the future"
      ("hash", Operation_hash.encoding)

  let inconsistent_attestation =
    declare_1
      ~section
      ~level:Error
      ~name:"inconsistent_attestation"
      ~msg:"inconsistent attestation found {hash}"
      ("hash", Operation_hash.encoding)

  let unexpected_pruned_block =
    declare_1
      ~section
      ~level:Error
      ~name:"unexpected_pruned_block"
      ~msg:"unexpected pruned block: {hash}"
      ("hash", Block_hash.encoding)

  let double_baking_but_not =
    declare_0
      ~section
      ~level:Debug
      ~name:"double_baking_but_not"
      ~msg:"double baking detected but block hashes are equivalent; skipping"
      ()

  let double_baking_detected =
    declare_0
      ~section
      ~level
      ~name:"double_baking_detected"
      ~msg:"double baking detected"
      ()

  let double_baking_denounced =
    declare_2
      ~section
      ~level
      ~name:"double_baking_denounced"
      ~msg:"double baking evidence injected {hash}"
      ("hash", Operation_hash.encoding)
      ~pp2:pp_ignore
      ("bytes", Data_encoding.bytes)

  let protocol_change_detected =
    declare_0
      ~section
      ~level:Error
      ~name:"protocol_change_detected"
      ~msg:"protocol changing detected; skipping the block"
      ()

  let accuser_saw_block =
    declare_2
      ~section
      ~level:Debug
      ~name:"accuser_saw_block"
      ~msg:"block level: {level}"
      ("level", Alpha_context.Raw_level.encoding)
      ("hash", Block_hash.encoding)

  let fetch_operations_error =
    declare_1
      ~section
      ~level:Error
      ~name:"fetch_operations_error"
      ~msg:"error while fetching operations of block {hash}"
      ("hash", Block_hash.encoding)
      ~pp1:Block_hash.pp

  let accuser_processed_block =
    declare_1
      ~section
      ~level
      ~name:"accuser_processed_block"
      ~msg:"block {hash} registered"
      ("hash", Block_hash.encoding)

  let accuser_block_error =
    declare_2
      ~section
      ~level:Error
      ~name:"accuser_block_error"
      ~msg:"error while processing block {hash} {errors}"
      ~pp2:pp_print_top_error_of_trace
      ("hash", Block_hash.encoding)
      ("errors", Error_monad.(TzTrace.encoding error_encoding))
end

module Baking_scheduling = struct
  include Internal_event.Simple

  let section = [Protocol.name; "delegate"; "baking-scheduling"]

  let cannot_fetch_event =
    declare_1
      ~section
      ~level:Info
      ~name:"cannot_fetch_event"
      ~msg:"{worker}: can't fetch the current event; waiting for new event"
      ("worker", Data_encoding.string)

  let daemon_error =
    declare_2
      ~section
      ~level:Error
      ~name:"daemon_error"
      ~msg:"{worker}: error while baking: {errors}"
      ~pp2:pp_print_top_error_of_trace
      ("worker", Data_encoding.string)
      ("errors", Error_monad.(TzTrace.encoding error_encoding))

  let daemon_setup =
    declare_1
      ~section
      ~level:Info
      ~name:"daemon_setup"
      ~msg:"setting up before the {worker} can start"
      ("worker", Data_encoding.string)

  let daemon_connection_lost =
    declare_1
      ~section
      ~level:Error
      ~name:"daemon_connection_lost"
      ~msg:"connection to node lost, {worker} exiting"
      ("worker", Data_encoding.string)

  let daemon_wakeup =
    declare_1
      ~section
      ~level:Debug
      ~name:"daemon_wakeup"
      ~msg:"waking up for {worker}"
      ("worker", Data_encoding.string)

  let daemon_start =
    declare_1
      ~section
      ~level:Info
      ~name:"daemon_start"
      ~msg:"starting {worker} daemon"
      ("worker", Data_encoding.string)
end
OCaml

Innovation. Community. Security.