package octez-l2-libs
Octez layer2 libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-18.0.tar.gz
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/src/octez-l2-libs.smart-rollup/l1_operation.ml.html
Source file l1_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 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
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2023 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 t = | Add_messages of {messages : string list} | Cement of {rollup : Address.t; commitment : Commitment.Hash.t} | Publish of {rollup : Address.t; commitment : Commitment.t} | Refute of { rollup : Address.t; opponent : Signature.Public_key_hash.t; refutation : Game.refutation; } | Timeout of {rollup : Address.t; stakers : Game.index} let encoding : t Data_encoding.t = let open Data_encoding in let case tag kind encoding proj inj = case ~title:kind (Tag tag) (merge_objs (obj1 (req "kind" (constant kind))) encoding) (fun o -> Option.map (fun p -> ((), p)) (proj o)) (fun ((), p) -> inj p) in def "sc_rollup_node_l1_operation" @@ union [ case 0 "add_messages" (obj1 (req "message" (list (string' Hex)))) (function Add_messages {messages} -> Some messages | _ -> None) (fun messages -> Add_messages {messages}); case 1 "cement" (obj2 (req "rollup" Address.encoding) (req "commitment" Commitment.Hash.encoding)) (function | Cement {rollup; commitment} -> Some (rollup, commitment) | _ -> None) (fun (rollup, commitment) -> Cement {rollup; commitment}); case 2 "publish" (obj2 (req "rollup" Address.encoding) (req "commitment" Commitment.encoding)) (function | Publish {rollup; commitment} -> Some (rollup, commitment) | _ -> None) (fun (rollup, commitment) -> Publish {rollup; commitment}); case 3 "refute" (obj3 (req "rollup" Address.encoding) (req "opponent" Signature.Public_key_hash.encoding) (req "refutation" Game.refutation_encoding)) (function | Refute {rollup; opponent; refutation} -> Some (rollup, opponent, refutation) | _ -> None) (fun (rollup, opponent, refutation) -> Refute {rollup; opponent; refutation}); case 4 "timeout" (obj2 (req "rollup" Address.encoding) (req "stakers" Game.index_encoding)) (function | Timeout {rollup; stakers} -> Some (rollup, stakers) | _ -> None) (fun (rollup, stakers) -> Timeout {rollup; stakers}); ] let pp ppf = function | Add_messages {messages} -> Format.fprintf ppf "publishing %d messages to smart rollups' inbox" (List.length messages) | Cement {rollup = _; commitment} when Commitment.Hash.(commitment = zero) -> (* We use zero as a default value for protocol alpha which does not need the commitment to be specified. *) Format.fprintf ppf "cementing cementable commitment" | Cement {rollup = _; commitment} -> Format.fprintf ppf "cementing commitment %a" Commitment.Hash.pp commitment | Publish {rollup = _; commitment = Commitment.{inbox_level; _}} -> Format.fprintf ppf "publish commitment for level %ld" inbox_level | Refute {rollup = _; opponent; refutation = Start _} -> Format.fprintf ppf "start refutation game against %a" Signature.Public_key_hash.pp opponent | Refute { rollup = _; opponent; refutation = Move {step = Dissection (first :: _ as d); _}; } -> let last = List.last first d in Format.fprintf ppf "dissection between ticks %a and %a (against %a)" Z.pp_print first.tick Z.pp_print last.tick Signature.Public_key_hash.pp opponent | Refute {rollup = _; opponent; refutation = Move {step = Dissection []; _}} -> Format.fprintf ppf "dissection (against %a)" Signature.Public_key_hash.pp opponent | Refute {rollup = _; opponent; refutation = Move {choice; step = Proof _}} -> Format.fprintf ppf "proof for tick %a (against %a)" Z.pp_print choice Signature.Public_key_hash.pp opponent | Timeout {rollup = _; stakers = _} -> Format.fprintf ppf "timeout" let unique = function | Add_messages _ | Cement _ -> false | Publish _ | Refute _ | Timeout _ -> true
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>