package octez-shell-libs
Octez shell libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/octez-shell-libs.shell-services/shell_limits.ml.html
Source file shell_limits.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
(*****************************************************************************) (* *) (* 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. *) (* *) (*****************************************************************************) let timeout_encoding = Time.System.Span.encoding type operation_metadata_size_limit = Unlimited | Limited of int let operation_metadata_size_limit_encoding = let open Data_encoding in def "operation_metadata_size_limit" ~title:"operation_metadata_size_limit" ~description:"The operation metadata size limit" (union ~tag_size:`Uint8 [ case ~title:"unlimited" ~description:"The metadata size is unlimited." (Tag 0) (constant "unlimited") (function Unlimited -> Some () | _ -> None) (fun () -> Unlimited); case ~title:"limited" ~description: "The metadata size is limited to the given integer's value (in \ bytes)." (Tag 1) int31 (function Limited i -> Some i | _ -> None) (fun i -> Limited i); ]) type block_validator_limits = { protocol_timeout : Time.System.Span.t; operation_metadata_size_limit : operation_metadata_size_limit; } (* [default_operation_metadata_size_limit] is used to filter and potentially discard a given metadata if its size exceed the cap. *) let default_operation_metadata_size_limit = Limited 10_000_000 let default_block_validator_limits = { protocol_timeout = Time.System.Span.of_seconds_exn 120.; operation_metadata_size_limit = default_operation_metadata_size_limit; } let block_validator_limits_encoding = let open Data_encoding in conv (fun {protocol_timeout; operation_metadata_size_limit} -> (protocol_timeout, operation_metadata_size_limit)) (fun (protocol_timeout, operation_metadata_size_limit) -> {protocol_timeout; operation_metadata_size_limit}) (obj2 (dft "protocol_request_timeout" timeout_encoding default_block_validator_limits.protocol_timeout) (dft "operation_metadata_size_limit" operation_metadata_size_limit_encoding default_block_validator_limits.operation_metadata_size_limit)) type prevalidator_limits = { max_refused_operations : int; operation_timeout : Time.System.Span.t; operations_batch_size : int; } let default_prevalidator_limits = { operation_timeout = Time.System.Span.of_seconds_exn 10.; max_refused_operations = 1000; operations_batch_size = 50; } let prevalidator_limits_encoding = let open Data_encoding in conv (fun {operation_timeout; max_refused_operations; operations_batch_size} -> (operation_timeout, max_refused_operations, operations_batch_size)) (fun (operation_timeout, max_refused_operations, operations_batch_size) -> {operation_timeout; max_refused_operations; operations_batch_size}) (obj3 (dft "operations_request_timeout" timeout_encoding default_prevalidator_limits.operation_timeout) (dft "max_refused_operations" uint16 default_prevalidator_limits.max_refused_operations) (dft "operations_batch_size" int31 default_prevalidator_limits.operations_batch_size)) type peer_validator_limits = { new_head_request_timeout : Time.System.Span.t; block_header_timeout : Time.System.Span.t; block_operations_timeout : Time.System.Span.t; protocol_timeout : Time.System.Span.t; } let default_peer_validator_limits = { block_header_timeout = Time.System.Span.of_seconds_exn 300.; block_operations_timeout = Time.System.Span.of_seconds_exn 300.; protocol_timeout = Time.System.Span.of_seconds_exn 600.; new_head_request_timeout = Time.System.Span.of_seconds_exn 90.; } let peer_validator_limits_encoding = let open Data_encoding in conv (fun { block_header_timeout; block_operations_timeout; protocol_timeout; new_head_request_timeout; } -> ( block_header_timeout, block_operations_timeout, protocol_timeout, new_head_request_timeout )) (fun ( block_header_timeout, block_operations_timeout, protocol_timeout, new_head_request_timeout ) -> { block_header_timeout; block_operations_timeout; protocol_timeout; new_head_request_timeout; }) (obj4 (dft "block_header_request_timeout" timeout_encoding default_peer_validator_limits.block_header_timeout) (dft "block_operations_request_timeout" timeout_encoding default_peer_validator_limits.block_operations_timeout) (dft "protocol_request_timeout" timeout_encoding default_peer_validator_limits.protocol_timeout) (dft "new_head_request_timeout" timeout_encoding default_peer_validator_limits.new_head_request_timeout)) type synchronisation_limits = {latency : int; threshold : int} let synchronisation_heuristic_encoding default_latency default_threshold = let open Data_encoding in conv (fun {latency; threshold} -> (latency, threshold)) (fun (latency, threshold) -> {latency; threshold}) (obj2 (dft "latency" ~description: "[latency] is the time interval (in seconds) used to determine if \ a peer is synchronized with a chain. For instance, a peer whose \ known head has a timestamp T is considered synchronized if T >= \ now - latency. This parameter depends on the baking rate and the \ latency of the network." uint16 default_latency) (dft "synchronisation_threshold" ~description: "The minimal number of peers this peer should be synchronized with \ in order to be bootstrapped." uint8 default_threshold)) type chain_validator_limits = {synchronisation : synchronisation_limits} let default_chain_validator_limits = {synchronisation = {latency = 50; threshold = 4}} let chain_validator_limits_encoding = let open Data_encoding in conv (fun {synchronisation} -> synchronisation) (fun synchronisation -> {synchronisation}) (* Use a union to support both the deprecated bootstrap_threshold and the new synchronisation_threshold options when parsing. When printing, use the new synchronisation_threshold option. *) (union [ case ~title:"synchronisation_heuristic_encoding" (Tag 0) (synchronisation_heuristic_encoding default_chain_validator_limits.synchronisation.latency default_chain_validator_limits.synchronisation.threshold) (fun x -> Some x) (fun x -> x); case ~title:"legacy_bootstrap_threshold_encoding" (Tag 1) (obj1 (dft "bootstrap_threshold" ~description: "[DEPRECATED] Set the number of peers with whom a chain \ synchronisation must be completed to bootstrap the node." uint8 4)) (fun _ -> None) (* This is used for legacy *) (fun x -> { threshold = x; latency = default_chain_validator_limits.synchronisation.latency; }); ]) type limits = { block_validator_limits : block_validator_limits; prevalidator_limits : prevalidator_limits; peer_validator_limits : peer_validator_limits; chain_validator_limits : chain_validator_limits; history_mode : History_mode.t option; } let default_limits = { block_validator_limits = default_block_validator_limits; prevalidator_limits = default_prevalidator_limits; peer_validator_limits = default_peer_validator_limits; chain_validator_limits = default_chain_validator_limits; history_mode = None; } let limits_encoding = let open Data_encoding in conv (fun { peer_validator_limits; block_validator_limits; prevalidator_limits; chain_validator_limits; history_mode; } -> ( peer_validator_limits, block_validator_limits, prevalidator_limits, chain_validator_limits, history_mode )) (fun ( peer_validator_limits, block_validator_limits, prevalidator_limits, chain_validator_limits, history_mode ) -> { peer_validator_limits; block_validator_limits; prevalidator_limits; chain_validator_limits; history_mode; }) (obj5 (dft "peer_validator" peer_validator_limits_encoding default_peer_validator_limits) (dft "block_validator" block_validator_limits_encoding default_block_validator_limits) (dft "prevalidator" prevalidator_limits_encoding default_prevalidator_limits) (dft "chain_validator" chain_validator_limits_encoding default_chain_validator_limits) (opt "history_mode" History_mode.encoding))
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>