package tezos-protocol-020-PsParisC
Tezos protocol 020-PsParisC package
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/tezos_raw_protocol_020_PsParisC/alpha_services.ml.html
Source file alpha_services.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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* Copyright (c) 2019-2020 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. *) (* *) (*****************************************************************************) open Alpha_context let custom_root = RPC_path.open_root module Seed_computation = struct module S = struct let seed_computation_status_encoding = let open Seed in Data_encoding.( union [ case (Tag 0) ~title:"Nonce revelation stage" (obj1 (req "nonce_revelation_stage" unit)) (function Nonce_revelation_stage -> Some () | _ -> None) (fun () -> Nonce_revelation_stage); case (Tag 1) ~title:"VDF revelation stage" (obj2 (req "seed_discriminant" Seed.seed_encoding) (req "seed_challenge" Seed.seed_encoding)) (function | Vdf_revelation_stage {seed_discriminant; seed_challenge} -> Some (seed_discriminant, seed_challenge) | _ -> None) (fun (seed_discriminant, seed_challenge) -> Vdf_revelation_stage {seed_discriminant; seed_challenge}); case (Tag 2) ~title:"Computation finished" (obj1 (req "computation_finished" unit)) (function Computation_finished -> Some () | _ -> None) (fun () -> Computation_finished); ]) let seed_computation = RPC_service.get_service ~description:"Seed computation status" ~query:RPC_query.empty ~output:seed_computation_status_encoding RPC_path.(custom_root / "context" / "seed_computation") end let () = let open Services_registration in register0 ~chunked:false S.seed_computation (fun ctxt () () -> Seed.get_seed_computation_status ctxt) let get ctxt block = RPC_context.make_call0 S.seed_computation ctxt block () () end module Seed = struct module S = struct open Data_encoding let seed = RPC_service.post_service ~description:"Seed of the cycle to which the block belongs." ~query:RPC_query.empty ~input:empty ~output:Seed.seed_encoding RPC_path.(custom_root / "context" / "seed") end let () = let open Services_registration in register0 ~chunked:false S.seed (fun ctxt () () -> let l = Level.current ctxt in Seed.for_cycle ctxt l.cycle) let get ctxt block = RPC_context.make_call0 S.seed ctxt block () () end module Nonce = struct type info = Revealed of Nonce.t | Missing of Nonce_hash.t | Forgotten let info_encoding = let open Data_encoding in union [ case (Tag 0) ~title:"Revealed" (obj1 (req "nonce" Nonce.encoding)) (function Revealed nonce -> Some nonce | _ -> None) (fun nonce -> Revealed nonce); case (Tag 1) ~title:"Missing" (obj1 (req "hash" Nonce_hash.encoding)) (function Missing nonce -> Some nonce | _ -> None) (fun nonce -> Missing nonce); case (Tag 2) ~title:"Forgotten" empty (function Forgotten -> Some () | _ -> None) (fun () -> Forgotten); ] module S = struct let get = RPC_service.get_service ~description:"Info about the nonce of a previous block." ~query:RPC_query.empty ~output:info_encoding RPC_path.(custom_root / "context" / "nonces" /: Raw_level.rpc_arg) end let register () = let open Lwt_result_syntax in let open Services_registration in register1 ~chunked:false S.get (fun ctxt raw_level () () -> let level = Level.from_raw ctxt raw_level in let*! status = Nonce.get ctxt level in match status with | Ok (Revealed nonce) -> return (Revealed nonce) | Ok (Unrevealed {nonce_hash; _}) -> return (Missing nonce_hash) | Error _ -> return Forgotten) let get ctxt block level = RPC_context.make_call1 S.get ctxt block level () () end module Contract = Contract_services module Constants = Constants_services module Delegate = Delegate_services module Voting = Voting_services module Sapling = Sapling_services module Adaptive_issuance = Adaptive_issuance_services module Liquidity_baking = struct module S = struct let get_cpmm_address = RPC_service.get_service ~description:"Liquidity baking CPMM address" ~query:RPC_query.empty ~output:Alpha_context.Contract.originated_encoding RPC_path.(custom_root / "context" / "liquidity_baking" / "cpmm_address") end let register () = let open Services_registration in register0 ~chunked:false S.get_cpmm_address (fun ctxt () () -> Alpha_context.Liquidity_baking.get_cpmm_address ctxt) let get_cpmm_address ctxt block = RPC_context.make_call0 S.get_cpmm_address ctxt block () () end module Cache = struct module S = struct let cached_contracts = RPC_service.get_service ~description:"Return the list of cached contracts" ~query:RPC_query.empty ~output:Data_encoding.(list @@ tup2 Contract_hash.encoding int31) RPC_path.(custom_root / "context" / "cache" / "contracts" / "all") let contract_cache_size = RPC_service.get_service ~description:"Return the size of the contract cache" ~query:RPC_query.empty ~output:Data_encoding.int31 RPC_path.(custom_root / "context" / "cache" / "contracts" / "size") let contract_cache_size_limit = RPC_service.get_service ~description:"Return the size limit of the contract cache" ~query:RPC_query.empty ~output:Data_encoding.int31 RPC_path.( custom_root / "context" / "cache" / "contracts" / "size_limit") let contract_rank = RPC_service.post_service ~description: "Return the number of cached contracts older than the provided \ contract" ~query:RPC_query.empty ~input:Alpha_context.Contract.originated_encoding ~output:Data_encoding.(option int31) RPC_path.(custom_root / "context" / "cache" / "contracts" / "rank") end let register () = let open Services_registration in register0 ~chunked:true S.cached_contracts (fun ctxt () () -> Script_cache.entries ctxt |> Lwt.return) ; register0 ~chunked:false S.contract_cache_size (fun ctxt () () -> Script_cache.size ctxt |> return) ; register0 ~chunked:false S.contract_cache_size_limit (fun ctxt () () -> Script_cache.size_limit ctxt |> return) ; register0 ~chunked:false S.contract_rank (fun ctxt () contract -> Script_cache.contract_rank ctxt contract |> return) let cached_contracts ctxt block = RPC_context.make_call0 S.cached_contracts ctxt block () () let contract_cache_size ctxt block = RPC_context.make_call0 S.contract_cache_size ctxt block () () let contract_cache_size_limit ctxt block = RPC_context.make_call0 S.contract_cache_size_limit ctxt block () () let contract_rank ctxt block contract = RPC_context.make_call0 S.contract_rank ctxt block () contract end module Denunciations = struct type denunciations_with_key = Signature.Public_key_hash.t * Denunciations_repr.item let denunciations_with_key_encoding : denunciations_with_key Data_encoding.t = let open Data_encoding in merge_objs (obj1 (req "slashed_delegate" Signature.Public_key_hash.encoding)) Denunciations_repr.item_encoding module S = struct let denunciations = let open Data_encoding in RPC_service.get_service ~description: "Returns the denunciations for misbehavior in the current cycle." ~query:RPC_query.empty ~output:(list denunciations_with_key_encoding) RPC_path.(custom_root / "context" / "denunciations") end let register () = let open Services_registration in let open Lwt_result_syntax in register0 ~chunked:false S.denunciations (fun ctxt () () -> let*! r = Alpha_context.Delegate.For_RPC.pending_denunciations_list ctxt in return r) let denunciations ctxt block = RPC_context.make_call0 S.denunciations ctxt block () () end let register () = Contract.register () ; Constants.register () ; Delegate.register () ; Nonce.register () ; Voting.register () ; Sapling.register () ; Liquidity_baking.register () ; Cache.register () ; Adaptive_issuance.register () ; Denunciations.register ()
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>