package octez-libs
A package that contains multiple base libraries used by the Octez suite
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/octez-libs.tezos-p2p-services/p2p_errors.ml.html
Source file p2p_errors.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 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* Copyright (c) 2020 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. *) (* *) (*****************************************************************************) (************************ p2p io scheduler ********************************) type error += Connection_closed type error += Connection_error let () = (* Connection closed *) register_error_kind `Permanent ~id:"node.p2p_io_scheduler.connection_closed" ~title:"Connection closed" ~description:"IO error: connection with a peer is closed." ~pp:(fun ppf () -> Format.fprintf ppf "IO error: connection with a peer is closed.") Data_encoding.empty (function Connection_closed -> Some () | _ -> None) (fun () -> Connection_closed) ; register_error_kind `Permanent ~id:"node.p2p_io_scheduler.connection_error" ~title:"Connection error" ~description:"IO error: connection error while reading from a peer." ~pp:(fun ppf () -> Format.fprintf ppf "IO error: connection error while reading from a peer.") Data_encoding.empty (function Connection_error -> Some () | _ -> None) (fun () -> Connection_error) (***************************** p2p socket *********************************) type error += Decipher_error type error += Invalid_message_size type error += Invalid_incoming_ciphertext_size type error += Rejected_socket_connection type error += | Rejected_by_nack of { motive : P2p_rejection.t; alternative_points : P2p_point.Id.t list option; } type error += Rejected_no_common_protocol of {announced : Network_version.t} type error += Decoding_error of Data_encoding.Binary.read_error type error += Myself of P2p_connection.Id.t type error += Not_enough_proof_of_work of P2p_peer.Id.t type error += Invalid_auth type error += Invalid_chunks_size of {value : int; min : int; max : int} let () = (* Decipher error *) register_error_kind `Permanent ~id:"node.p2p_socket.decipher_error" ~title:"Decipher error" ~description:"An error occurred while deciphering." ~pp:(fun ppf () -> Format.fprintf ppf "An error occurred while deciphering.") Data_encoding.empty (function Decipher_error -> Some () | _ -> None) (fun () -> Decipher_error) ; (* Invalid message size *) register_error_kind `Permanent ~id:"node.p2p_socket.invalid_message_size" ~title:"Invalid message size" ~description:"The size of the message to be written is invalid." ~pp:(fun ppf () -> Format.fprintf ppf "The size of the message to be written is invalid.") Data_encoding.empty (function Invalid_message_size -> Some () | _ -> None) (fun () -> Invalid_message_size) ; (* Invalid incoming ciphertext size *) register_error_kind `Permanent ~id:"node.p2p_socket.invalid_incoming_ciphertext_size" ~title:"Invalid incoming ciphertext size" ~description:"The announced size for the incoming ciphertext is invalid." ~pp:(fun ppf () -> Format.fprintf ppf "The announced size for the incoming ciphertext is invalid.") Data_encoding.empty (function Invalid_incoming_ciphertext_size -> Some () | _ -> None) (fun () -> Invalid_incoming_ciphertext_size) ; (* Rejected socket connection *) register_error_kind `Permanent ~id:"node.p2p_socket.rejected_socket_connection" ~title:"Rejected socket connection" ~description:"Rejected peer connection: rejected socket connection." ~pp:(fun ppf () -> Format.fprintf ppf "Rejected peer connection: rejected socket connection.") Data_encoding.empty (function Rejected_socket_connection -> Some () | _ -> None) (fun () -> Rejected_socket_connection) ; (* Rejected socket connection, peer gave us with alternative points *) register_error_kind `Permanent ~id:"node.p2p_socket.rejected_by_nack" ~title:"Rejected socket connection by Nack" ~description: "Rejected peer connection: The peer rejected the socket connection by \ Nack with a list of alternative peers." ~pp:(fun ppf (motive, alt_points) -> Format.fprintf ppf "Rejected peer connection: Peer rejected us on motive \"%a\" and \ proposed %a alternative peers." P2p_rejection.pp motive (fun ppf alt_points -> match alt_points with | None -> Format.pp_print_string ppf "no" | Some l -> Format.pp_print_int ppf @@ List.length l) alt_points) Data_encoding.( obj2 (req "motive" P2p_rejection.encoding) (opt "alternative_points" (list P2p_point.Id.encoding))) (function | Rejected_by_nack {motive; alternative_points} -> Some (motive, alternative_points) | _ -> None) (fun (motive, alternative_points) -> Rejected_by_nack {motive; alternative_points}) ; (* Rejected socket connection, no common network protocol *) register_error_kind `Permanent ~id:"node.p2p_socket.rejected_no_common_protocol" ~title:"Rejected socket connection - no common network protocol" ~description: "Rejected peer connection: rejected socket connection as we have no \ common network protocol with the peer." ~pp:(fun ppf _lst -> Format.fprintf ppf "Rejected peer connection: no common network protocol.") Data_encoding.(obj1 (req "announced_version" Network_version.encoding)) (function | Rejected_no_common_protocol {announced} -> Some announced | _ -> None) (fun announced -> Rejected_no_common_protocol {announced}) ; (* Decoding error *) register_error_kind `Permanent ~id:"node.p2p_socket.decoding_error" ~title:"Decoding error" ~description:"An error occurred while decoding." ~pp:(fun ppf re -> Format.fprintf ppf "An error occurred while decoding: %a." Data_encoding.Binary.pp_read_error re) Data_encoding.(obj1 @@ req "read_error" Binary.read_error_encoding) (function Decoding_error re -> Some re | _ -> None) (fun re -> Decoding_error re) ; (* Myself *) register_error_kind `Permanent ~id:"node.p2p_socket.myself" ~title:"Myself" ~description:"Remote peer is actually yourself." ~pp:(fun ppf id -> Format.fprintf ppf "Remote peer %a cannot be authenticated: peer is actually yourself." P2p_connection.Id.pp id) Data_encoding.(obj1 (req "connection_id" P2p_connection.Id.encoding)) (function Myself id -> Some id | _ -> None) (fun id -> Myself id) ; (* Not enough proof of work *) register_error_kind `Permanent ~id:"node.p2p_socket.not_enough_proof_of_work" ~title:"Not enough proof of work" ~description: "Remote peer cannot be authenticated: not enough proof of work." ~pp:(fun ppf id -> Format.fprintf ppf "Remote peer %a cannot be authenticated: not enough proof of work." P2p_peer.Id.pp id) Data_encoding.(obj1 (req "peer_id" P2p_peer.Id.encoding)) (function Not_enough_proof_of_work id -> Some id | _ -> None) (fun id -> Not_enough_proof_of_work id) ; (* Invalid authentication *) register_error_kind `Permanent ~id:"node.p2p_socket.invalid_auth" ~title:"Invalid authentication" ~description:"Rejected peer connection: invalid authentication." ~pp:(fun ppf () -> Format.fprintf ppf "Rejected peer connection: invalid authentication.") Data_encoding.empty (function Invalid_auth -> Some () | _ -> None) (fun () -> Invalid_auth) ; (* Invalid chunks size *) register_error_kind `Permanent ~id:"node.p2p_socket.invalid_chunks_size" ~title:"Invalid chunks size" ~description:"Size of chunks is not valid." ~pp:(fun ppf (value, min, max) -> Format.fprintf ppf "Size of chunks is invalid: should be between %d and %d but is %d" min max value) Data_encoding.(obj3 (req "value" int31) (req "min" int31) (req "max" int31)) (function | Invalid_chunks_size {value; min; max} -> Some (value, min, max) | _ -> None) (fun (value, min, max) -> Invalid_chunks_size {value; min; max}) (***************************** p2p conn ***********************************) type error += Peer_discovery_disabled let () = (* Peer discovery disabled *) register_error_kind `Permanent ~id:"node.p2p_conn.peer_discovery_disabled" ~title:"Peer discovery disabled" ~description: "The peer discovery is disabled, sending advertise messages is forbidden." ~pp:(fun ppf () -> Format.fprintf ppf "The peer discovery is disabled, sending advertise messages is \ forbidden.") Data_encoding.empty (function Peer_discovery_disabled -> Some () | _ -> None) (fun () -> Peer_discovery_disabled) (***************************** p2p pool ***********************************) type error += Pending_connection type error += Connected type error += Connection_failed type error += Rejected of {peer : P2p_peer.Id.t; motive : P2p_rejection.t} type error += Too_many_connections type error += Private_mode type error += Point_banned of P2p_point.Id.t type error += Peer_banned of P2p_peer.Id.t type error += P2p_layer_disabled type error += | Identity_check_failure of { point : P2p_point.Id.t; expected_peer_id : P2p_peer.Id.t; received_peer_id : P2p_peer.Id.t; } let () = (* Pending connection *) register_error_kind `Permanent ~id:"node.p2p_pool.pending_connection" ~title:"Pending connection" ~description:"Fail to connect with a peer: a connection is already pending." ~pp:(fun ppf () -> Format.fprintf ppf "Fail to connect with a peer: a connection is already pending.") Data_encoding.empty (function Pending_connection -> Some () | _ -> None) (fun () -> Pending_connection) ; (* Connected *) register_error_kind `Permanent ~id:"node.p2p_pool.connected" ~title:"Connected" ~description: "Fail to connect with a peer: a connection is already established." ~pp:(fun ppf () -> Format.fprintf ppf "Fail to connect with a peer: a connection is already established.") Data_encoding.empty (function Connected -> Some () | _ -> None) (fun () -> Connected) ; (* Connected failed *) register_error_kind `Permanent ~id:"node.p2p_pool.connection_failed" ~title:"TCP connection failed" ~description:"TCP connection failed (refused or no route to host)." ~pp:(fun ppf () -> Format.fprintf ppf "TCP connection failed (refused or no route to host.") Data_encoding.empty (function Connection_failed -> Some () | _ -> None) (fun () -> Connection_failed) ; (* Rejected *) register_error_kind `Permanent ~id:"node.p2p_pool.rejected" ~title:"Rejected peer" ~description:"Connection to peer was rejected by us." ~pp:(fun ppf (peer, motive) -> Format.fprintf ppf "Connection to peer %a was rejected by us on motive: %a." P2p_peer.Id.pp peer P2p_rejection.pp motive) Data_encoding.( obj2 (req "peer_id" P2p_peer.Id.encoding) (req "motive" P2p_rejection.encoding)) (function Rejected {peer; motive} -> Some (peer, motive) | _ -> None) (fun (peer, motive) -> Rejected {peer; motive}) ; (* Too many connections *) register_error_kind `Permanent ~id:"node.p2p_pool.too_many_connections" ~title:"Too many connections" ~description:"Too many connections." ~pp:(fun ppf () -> Format.fprintf ppf "Too many connections.") Data_encoding.empty (function Too_many_connections -> Some () | _ -> None) (fun () -> Too_many_connections) ; (* Private mode *) register_error_kind `Permanent ~id:"node.p2p_pool.private_mode" ~title:"Private mode" ~description:"Node is in private mode." ~pp:(fun ppf () -> Format.fprintf ppf "Node is in private mode.") Data_encoding.empty (function Private_mode -> Some () | _ -> None) (fun () -> Private_mode) ; (* Point Banned *) register_error_kind `Permanent ~id:"node.p2p_pool.point_banned" ~title:"Point Banned" ~description:"The address you tried to connect is banned." ~pp:(fun ppf (addr, _port) -> Format.fprintf ppf "The address you tried to connect (%a) is banned." P2p_addr.pp addr) Data_encoding.(obj1 (req "point" P2p_point.Id.encoding)) (function Point_banned point -> Some point | _ -> None) (fun point -> Point_banned point) ; (* Peer Banned *) register_error_kind `Permanent ~id:"node.p2p_pool.peer_banned" ~title:"Peer Banned" ~description:"The peer identity you tried to connect is banned." ~pp:(fun ppf peer_id -> Format.fprintf ppf "The peer identity you tried to connect (%a) is banned." P2p_peer.Id.pp peer_id) Data_encoding.(obj1 (req "peer" P2p_peer.Id.encoding)) (function Peer_banned peer_id -> Some peer_id | _ -> None) (fun peer_id -> Peer_banned peer_id) ; (* P2p_layer_disabled *) register_error_kind `Permanent ~id:"node.p2p_pool.disabled" ~title:"P2P layer disabled" ~description:"The P2P layer on this node is not active." ~pp:(fun ppf () -> Format.fprintf ppf "P2P layer disabled.") Data_encoding.empty (function P2p_layer_disabled -> Some () | _ -> None) (fun () -> P2p_layer_disabled) ; register_error_kind `Permanent ~id:"node.p2p_connect_handler.identity_check_failure" ~title:"Unexpected peer identity" ~description: "Peer announced an identity which does not match the one specified on \ the command-line." ~pp:(fun ppf (point, expected_peer_id, received_peer_id) -> Format.fprintf ppf "For point `%a`: Expected peer identity `%a` and received peer \ identity `%a`." P2p_point.Id.pp point P2p_peer.Id.pp expected_peer_id P2p_peer.Id.pp received_peer_id) Data_encoding.( obj3 (req "point" P2p_point.Id.encoding) (req "expected_peer_id" P2p_peer.Id.encoding) (req "received_peer_id" P2p_peer.Id.encoding)) (function | Identity_check_failure {point; expected_peer_id; received_peer_id} -> Some (point, expected_peer_id, received_peer_id) | _ -> None) (fun (point, expected_peer_id, received_peer_id) -> Identity_check_failure {point; expected_peer_id; received_peer_id}) (****************************** p2p maintenance ******************************) type error += Maintenance_disabled let () = (* Maintenance_disabled *) let description = "Attempt to trigger the maintenance failed as the maintenance is disabled." in register_error_kind `Permanent ~id:"node.p2p_maintenance.disabled" ~title:"Maintenance disabled" ~description ~pp:(fun ppf () -> Format.fprintf ppf "%s" description) Data_encoding.empty (function Maintenance_disabled -> Some () | _ -> None) (fun () -> Maintenance_disabled)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>