package tezos-protocol-alpha
Tezos protocol alpha package
Install
Dune Dependency
Authors
Maintainers
Sources
octez-19.1.tar.gz
sha256=55ea1fb8bb3273a7fc270ca8f650d45c56449665619482aad9bc12f3ea736b7e
sha512=fec850fc2d17d7490bbabd5147d62aad13b3aaed8774270f8a38ab419670ed03e0fd30cf8642a97984eca5c2446726fe590ad99c015f7ec50919dc7652f25053
doc/src/tezos_raw_protocol_alpha/per_block_votes_repr.ml.html
Source file per_block_votes_repr.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
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2021 Tocqueville Group, Inc. <contact@tezos.com> *) (* Copyright (c) 2022-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. *) (* *) (*****************************************************************************) (** Options available for per-block votes *) type per_block_vote = | Per_block_vote_on | Per_block_vote_off | Per_block_vote_pass type per_block_votes = { liquidity_baking_vote : per_block_vote; adaptive_issuance_vote : per_block_vote; } let per_block_vote_compact_encoding = let open Data_encoding in let open Compact in union ~union_tag_bits:2 ~cases_tag_bits:0 [ case ~title:"per_block_vote_on" (payload (constant "on")) (function Per_block_vote_on -> Some () | _ -> None) (fun () -> Per_block_vote_on); case ~title:"per_block_vote_off" (payload (constant "off")) (function Per_block_vote_off -> Some () | _ -> None) (fun () -> Per_block_vote_off); case ~title:"per_block_vote_pass" (payload (constant "pass")) (function Per_block_vote_pass -> Some () | _ -> None) (fun () -> Per_block_vote_pass); ] let liquidity_baking_vote_encoding = let open Data_encoding in def "liquidity_baking_vote" (Compact.make ~tag_size:`Uint8 per_block_vote_compact_encoding) let adaptive_issuance_vote_encoding = let open Data_encoding in def "adaptive_issuance_vote" (Compact.make ~tag_size:`Uint8 per_block_vote_compact_encoding) let per_block_votes_compact_encoding = let open Data_encoding in let open Compact in conv (fun {liquidity_baking_vote; adaptive_issuance_vote} -> (liquidity_baking_vote, adaptive_issuance_vote)) (fun (liquidity_baking_vote, adaptive_issuance_vote) -> {liquidity_baking_vote; adaptive_issuance_vote}) (obj2 (req "liquidity_baking_vote" per_block_vote_compact_encoding) (req "adaptive_issuance_vote" per_block_vote_compact_encoding)) let per_block_votes_encoding = let open Data_encoding in def "per_block_votes" (Compact.make ~tag_size:`Uint8 per_block_votes_compact_encoding) module Liquidity_baking_toggle_EMA = Votes_EMA_repr.Make (struct let baker_contribution = Z.of_int 500_000 let ema_max = 2_000_000_000l end) module Adaptive_issuance_launch_EMA = Votes_EMA_repr.Make (struct (* The baker_contribution parameter of the adaptive issuance activation vote was chosen so that 2 weeks are needed to move the EMA from 0% to 50% when all bakers vote On. This was computed using the following formula: baker_contrib = (1/2) * ema_max * (1 - 2^(-1/k)) where k is the number of blocks in 2 weeks (which is 80640). Because of a small accumulation of rounding errors, two more blocks are actually needed. *) let baker_contribution = Z.of_int 8595 let ema_max = 2_000_000_000l end) let compute_new_liquidity_baking_ema ~per_block_vote ema = match per_block_vote with | Per_block_vote_pass -> ema | Per_block_vote_off -> Liquidity_baking_toggle_EMA.update_ema_up ema | Per_block_vote_on -> Liquidity_baking_toggle_EMA.update_ema_down ema let compute_new_adaptive_issuance_ema ~per_block_vote ema = match per_block_vote with | Per_block_vote_pass -> ema | Per_block_vote_off -> Adaptive_issuance_launch_EMA.update_ema_down ema | Per_block_vote_on -> Adaptive_issuance_launch_EMA.update_ema_up ema
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>