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/test_chain_status.ml.html
Source file test_chain_status.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) 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 t = | Not_running | Forking of { protocol : Tezos_crypto.Hashed.Protocol_hash.t; expiration : Time.Protocol.t; } | Running of { chain_id : Tezos_crypto.Hashed.Chain_id.t; genesis : Tezos_crypto.Hashed.Block_hash.t; protocol : Tezos_crypto.Hashed.Protocol_hash.t; expiration : Time.Protocol.t; } let equal s1 s2 = match (s1, s2) with | Not_running, Not_running -> true | ( Forking {protocol = p1; expiration = e1}, Forking {protocol = p2; expiration = e2} ) -> Tezos_crypto.Hashed.Protocol_hash.equal p1 p2 && Time.Protocol.equal e1 e2 | ( Running {chain_id = c1; genesis = g1; protocol = p1; expiration = e1}, Running {chain_id = c2; genesis = g2; protocol = p2; expiration = e2} ) -> Tezos_crypto.Hashed.Chain_id.equal c1 c2 && Tezos_crypto.Hashed.Block_hash.equal g1 g2 && Tezos_crypto.Hashed.Protocol_hash.equal p1 p2 && Time.Protocol.equal e1 e2 | Not_running, (Forking _ | Running _) | (Forking _ | Running _), Not_running | Forking _, Running _ | Running _, Forking _ -> false let encoding = let open Data_encoding in def "test_chain_status" ~description: "The status of the test chain: not_running (there is no test chain at \ the moment), forking (the test chain is being setup), running (the test \ chain is running)." @@ union [ case (Tag 0) ~title:"Not_running" (obj1 (req "status" (constant "not_running"))) (function Not_running -> Some () | _ -> None) (fun () -> Not_running); case (Tag 1) ~title:"Forking" (obj3 (req "status" (constant "forking")) (req "protocol" Tezos_crypto.Hashed.Protocol_hash.encoding) (req "expiration" Time.Protocol.encoding)) (function | Forking {protocol; expiration} -> Some ((), protocol, expiration) | _ -> None) (fun ((), protocol, expiration) -> Forking {protocol; expiration}); case (Tag 2) ~title:"Running" (obj5 (req "status" (constant "running")) (req "chain_id" Tezos_crypto.Hashed.Chain_id.encoding) (req "genesis" Tezos_crypto.Hashed.Block_hash.encoding) (req "protocol" Tezos_crypto.Hashed.Protocol_hash.encoding) (req "expiration" Time.Protocol.encoding)) (function | Running {chain_id; genesis; protocol; expiration} -> Some ((), chain_id, genesis, protocol, expiration) | _ -> None) (fun ((), chain_id, genesis, protocol, expiration) -> Running {chain_id; genesis; protocol; expiration}); ] let pp ppf = function | Not_running -> Format.fprintf ppf "@[<v 2>Not running@]" | Forking {protocol; expiration} -> Format.fprintf ppf "@[<v 2>Forking %a (expires %a)@]" Tezos_crypto.Hashed.Protocol_hash.pp protocol Time.System.pp_hum (Time.System.of_protocol_exn expiration) | Running {chain_id; genesis; protocol; expiration} -> Format.fprintf ppf "@[<v 2>Running %a@ Genesis: %a@ Net id: %a@ Expiration: %a@]" Tezos_crypto.Hashed.Protocol_hash.pp protocol Tezos_crypto.Hashed.Block_hash.pp genesis Tezos_crypto.Hashed.Chain_id.pp chain_id Time.System.pp_hum (Time.System.of_protocol_exn expiration) let () = Data_encoding.Registration.register ~pp encoding
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>