package tezos-protocol-017-PtNairob
Tezos protocol 017-PtNairob package
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/tezos_raw_protocol_017_PtNairob/sc_rollup_reveal_hash.ml.html
Source file sc_rollup_reveal_hash.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
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2022 Nomadic Labs <contact@nomadic-labs.com> *) (* Copyright (c) 2022 Trili Tech, <contact@trili.tech> *) (* Copyright (c) 2023 Marigold <contact@marigold.dev> *) (* *) (* 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. *) (* *) (*****************************************************************************) (* Reserve the first byte in the encoding to support multi-versioning in the future. *) module Blake2B = struct include Blake2B.Make (Base58) (struct let name = "Smart_rollup_reveal_data_blake2b_hash" let title = "A smart rollup reveal hash" let b58check_prefix = "\230\206\128\200\196" (* "scrrh1(56)" decoded from Base58. *) let size = Some 32 end) let () = Base58.check_encoded_prefix b58check_encoding "scrrh1" 56 end type supported_hashes = Blake2B type t = Blake2B of Blake2B.t let zero ~(scheme : supported_hashes) = match scheme with Blake2B -> Blake2B Blake2B.zero let pp ppf hash = match hash with Blake2B hash -> Blake2B.pp ppf hash let equal h1 h2 = match (h1, h2) with Blake2B h1, Blake2B h2 -> Blake2B.equal h1 h2 let compare h1 h2 = match (h1, h2) with Blake2B h1, Blake2B h2 -> Blake2B.compare h1 h2 module Map = Map.Make (struct type tmp = t type t = tmp let compare = compare end) (* Size of the hash is the size of the inner hash plus one byte for the tag used to identify the hashing scheme. *) let size ~(scheme : supported_hashes) = let tag_size = 1 in let size_without_tag = match scheme with Blake2B -> Blake2B.size in tag_size + size_without_tag let encoding = let open Data_encoding in union ~tag_size:`Uint8 [ case ~title:"Reveal_data_hash_v0" (Tag 0) Blake2B.encoding (fun (Blake2B s) -> Some s) (fun s -> Blake2B s); ] let hash_string ~(scheme : supported_hashes) ?key strings = match scheme with Blake2B -> Blake2B (Blake2B.hash_string ?key strings) let hash_bytes ~(scheme : supported_hashes) ?key bytes = match scheme with Blake2B -> Blake2B (Blake2B.hash_bytes ?key bytes) let scheme_of_hash hash = match hash with Blake2B _hash -> (Blake2B : supported_hashes) let to_hex hash = let (`Hex hash) = (* The [encoding] of a hash here never, so [to_string_exn] is safe. *) Hex.of_string @@ Data_encoding.Binary.to_string_exn encoding hash in hash let of_hex hex = let open Option_syntax in let* hash = Hex.to_bytes (`Hex hex) in Data_encoding.Binary.of_bytes_opt encoding hash let rpc_arg = let construct = to_hex in let destruct hash = match of_hex hash with | None -> Error "Cannot parse reveal hash" | Some reveal_hash -> Ok reveal_hash in RPC_arg.make ~descr:"A reveal hash" ~name:"reveal_hash" ~destruct ~construct ()
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>