package octez-protocol-018-Proxford-libs
Octez protocol 018-Proxford libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-18.0.tar.gz
sha256=dbc3b675aee59c2c574e5d0a771193a2ecfca31e7a5bc5aed66598080596ce1c
sha512=b97ed762b9d24744305c358af0d20f394376b64bfdd758dd4a81775326caf445caa57c4f6445da3dd6468ff492de18e4c14af6f374dfcbb7e4d64b7b720e5e2a
doc/src/octez-protocol-018-Proxford-libs.dal/dal_plugin_registration.ml.html
Source file dal_plugin_registration.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
(*****************************************************************************) (* *) (* 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. *) (* *) (*****************************************************************************) open Protocol open Alpha_context module Plugin = struct module Proto = Registerer.Registered type block_info = Protocol_client_context.Alpha_block_services.block_info let parametric_constants chain block ctxt = let cpctxt = new Protocol_client_context.wrap_rpc_context ctxt in Protocol.Constants_services.parametric cpctxt (chain, block) let get_constants chain block ctxt = let open Lwt_result_syntax in let* parametric = parametric_constants chain block ctxt in let { Constants.Parametric.feature_enable; number_of_slots; attestation_lag; attestation_threshold; cryptobox_parameters; blocks_per_epoch; } = parametric.dal in return { Dal_plugin.feature_enable; number_of_slots; attestation_lag; attestation_threshold; cryptobox_parameters; blocks_per_epoch; } let block_info ?chain ?block ~metadata ctxt = let cpctxt = new Protocol_client_context.wrap_rpc_context ctxt in Protocol_client_context.Alpha_block_services.info cpctxt ?chain ?block ~metadata () (* Turn the given value of type {!Protocol.Apply_operation_result.operation_result} into a value of type {!Dal_plugin.operation_application_result}. *) let status_of_result = function | Protocol.Apply_operation_result.Applied _ -> Dal_plugin.Succeeded | _ -> Dal_plugin.Failed let get_published_slot_headers (block : block_info) = let open Lwt_result_syntax in let open Protocol.Alpha_context in let apply_internal acc ~source:_ _op _res = acc in let apply (type kind) acc ~source:_ (op : kind manager_operation) (result : (kind, _, _) Protocol.Apply_operation_result.operation_result) = match op with | Dal_publish_slot_header operation -> (operation.slot_index, operation.commitment, status_of_result result) :: acc | _ -> acc in Layer1_services.( process_manager_operations [] block.operations {apply; apply_internal}) |> List.map_es (fun (slot_index, commitment, status) -> let published_level = block.header.shell.level in let slot_index = Dal.Slot_index.to_int slot_index in return Dal_plugin.({published_level; slot_index; commitment}, status)) let get_committee ctxt ~level = let open Lwt_result_syntax in let cpctxt = new Protocol_client_context.wrap_rpc_context ctxt in let*? level = Raw_level.of_int32 level |> Environment.wrap_tzresult in let+ pkh_to_shards = Plugin.RPC.Dal.dal_shards cpctxt (`Main, `Head 0) ~level () in List.fold_left (fun acc (pkh, s) -> Signature.Public_key_hash.Map.add pkh s acc) Signature.Public_key_hash.Map.empty pkh_to_shards let attested_slot_headers (block : block_info) ~number_of_slots = let open Result_syntax in let* metadata = Option.to_result block.metadata ~none: (TzTrace.make @@ Layer1_services.Cannot_read_block_metadata block.hash) in let confirmed_slots = Option.value ~default:Dal.Attestation.empty metadata.protocol_data.dal_attestation in let* all_slots = Dal.Slot_index.slots_range ~number_of_slots ~lower:0 ~upper:(number_of_slots - 1) |> Environment.wrap_tzresult in List.filter (Dal.Attestation.is_attested confirmed_slots) all_slots |> Dal.Slot_index.to_int_list |> return end let () = Dal_plugin.register (module Plugin)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>