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.base/operation.ml.html
Source file operation.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
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.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. *) (* *) (*****************************************************************************) type shell_header = {branch : Tezos_crypto.Hashed.Block_hash.t} let equal_shell_header {branch = b1} {branch = b2} = Tezos_crypto.Hashed.Block_hash.equal b1 b2 let shell_header_encoding = let open Data_encoding in def "operation.shell_header" ~description:"An operation's shell header." @@ conv (fun {branch} -> branch) (fun branch -> {branch}) (obj1 (req "branch" Tezos_crypto.Hashed.Block_hash.encoding)) type t = {shell : shell_header; proto : Bytes.t} include Compare.Make (struct type nonrec t = t let compare o1 o2 = Compare.or_else (Tezos_crypto.Hashed.Block_hash.compare o1.shell.branch o2.shell.branch) (fun () -> Bytes.compare o1.proto o2.proto) end) let encoding = let open Data_encoding in def "operation" ~description: "An operation. The shell_header part indicates a block an operation is \ meant to apply on top of. The proto part is protocol-specific and \ appears as a binary blob." @@ conv (fun {shell; proto} -> (shell, proto)) (fun (shell, proto) -> {shell; proto}) (merge_objs shell_header_encoding (obj1 (req "data" Variable.bytes))) let bounded_encoding ?max_size () = match max_size with | None -> encoding | Some max_size -> Data_encoding.check_size max_size encoding let bounded_list_encoding ?max_length ?max_size ?max_operation_size ?max_pass () = let open Data_encoding in let op_encoding = bounded_encoding ?max_size:max_operation_size () in let op_list_encoding = match max_size with | None -> Variable.list ?max_length (dynamic_size op_encoding) | Some max_size -> check_size max_size (Variable.list ?max_length (dynamic_size op_encoding)) in obj2 (req "operation_hashes_path" (Tezos_crypto.Hashed.Operation_list_list_hash.bounded_path_encoding ?max_length:max_pass ())) (req "operations" op_list_encoding) let bounded_hash_list_encoding ?max_length ?max_pass () = let open Data_encoding in obj2 (req "operation_hashes_path" (Tezos_crypto.Hashed.Operation_list_list_hash.bounded_path_encoding ?max_length:max_pass ())) (req "operation_hashes" (Variable.list ?max_length Tezos_crypto.Hashed.Operation_hash.encoding)) let pp fmt op = Data_encoding.Json.pp fmt (Data_encoding.Json.construct encoding op) let to_bytes v = Data_encoding.Binary.to_bytes_exn encoding v let of_bytes b = Data_encoding.Binary.of_bytes_opt encoding b let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b let hash op = Tezos_crypto.Hashed.Operation_hash.hash_bytes [to_bytes op] let hash_raw bytes = Tezos_crypto.Hashed.Operation_hash.hash_bytes [bytes] let () = Data_encoding.Registration.register ~pp encoding ; Data_encoding.Registration.register shell_header_encoding
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>