package octez-l2-libs
Octez layer2 libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/octez-l2-libs.smart-rollup/sc_rollup_block.ml.html
Source file sc_rollup_block.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
(*****************************************************************************) (* *) (* 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. *) (* *) (*****************************************************************************) type header = { block_hash : Block_hash.t; level : int32; predecessor : Block_hash.t; commitment_hash : Commitment.Hash.t option; previous_commitment_hash : Commitment.Hash.t; context : Smart_rollup_context_hash.t; inbox_witness : Tezos_crypto.Hashed.Smart_rollup_merkelized_payload_hashes_hash.t; inbox_hash : Inbox.Hash.t; } type content = { inbox : Inbox.t; messages : string list; commitment : Commitment.t option; } type ('header, 'content) block = { header : 'header; content : 'content; initial_tick : Z.t; num_ticks : int64; } type t = (header, unit) block type full = (header, content) block let commitment_hash_opt_encoding = let open Data_encoding in let binary = conv (Option.value ~default:Commitment.Hash.zero) (fun h -> if Commitment.Hash.(h = zero) then None else Some h) Commitment.Hash.encoding in let json = option Commitment.Hash.encoding in splitted ~binary ~json let header_encoding = let open Data_encoding in conv (fun { block_hash; level; predecessor; commitment_hash; previous_commitment_hash; context; inbox_witness; inbox_hash; } -> ( block_hash, level, predecessor, commitment_hash, previous_commitment_hash, context, inbox_witness, inbox_hash )) (fun ( block_hash, level, predecessor, commitment_hash, previous_commitment_hash, context, inbox_witness, inbox_hash ) -> { block_hash; level; predecessor; commitment_hash; previous_commitment_hash; context; inbox_witness; inbox_hash; }) @@ obj8 (req "block_hash" Block_hash.encoding ~description:"Tezos block hash.") (req "level" int32 ~description: "Level of the block, corresponds to the level of the tezos block.") (req "predecessor" Block_hash.encoding ~description:"Predecessor hash of the Tezos block.") (req "commitment_hash" commitment_hash_opt_encoding ~description: "Hash of this block's commitment if any was computed for it.") (req "previous_commitment_hash" Commitment.Hash.encoding ~description: "Previous commitment hash in the chain. If there is a commitment \ for this block, this field contains the commitment that was \ previously computed.") (req "context" Smart_rollup_context_hash.encoding ~description:"Hash of the layer 2 context for this block.") (req "inbox_witness" Tezos_crypto.Hashed.Smart_rollup_merkelized_payload_hashes_hash .encoding ~description: "Witness for the inbox for this block, i.e. the Merkle hash of \ payloads of messages.") (req "inbox_hash" Inbox.Hash.encoding ~description:"Hash of the inbox for this block.") let header_size = WithExceptions.Option.get ~loc:__LOC__ @@ Data_encoding.Binary.fixed_length header_encoding let content_encoding = let open Data_encoding in conv (fun {inbox; messages; commitment} -> (inbox, messages, commitment)) (fun (inbox, messages, commitment) -> {inbox; messages; commitment}) @@ obj3 (req "inbox" Inbox.encoding ~description:"Inbox for this block.") (req "messages" (list (dynamic_size (Variable.string' Hex))) ~description:"Messages added to the inbox in this block.") (opt "commitment" Commitment.encoding ~description:"Commitment, if any is computed for this block.") let block_encoding header_encoding content_encoding = let open Data_encoding in conv (fun {header; content; initial_tick; num_ticks} -> (header, (content, (initial_tick, num_ticks)))) (fun (header, (content, (initial_tick, num_ticks))) -> {header; content; initial_tick; num_ticks}) @@ merge_objs header_encoding @@ merge_objs content_encoding @@ obj2 (req "initial_tick" Data_encoding.n ~description: "Initial tick of the PVM at this block, i.e. before evaluation of \ the messages.") (req "num_ticks" int64 ~description: "Number of ticks produced by the evaluation of the messages in \ this block.") let encoding = block_encoding header_encoding Data_encoding.unit let full_encoding = block_encoding header_encoding content_encoding let most_recent_commitment (header : header) = Option.value header.commitment_hash ~default:header.previous_commitment_hash let final_tick {initial_tick; num_ticks; _} = Z.max Z.zero (Z.add initial_tick (Z.of_int64 num_ticks))
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>