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/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 128 129 130 131 132 133
(*****************************************************************************) (* *) (* 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 ema_max = 2_000_000_000l 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 = ema_max 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 120960). Because of a small accumulation of rounding errors, two more blocks are actually needed. *) let baker_contribution = Z.of_int 5730 let ema_max = ema_max 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 module Internal_for_tests = struct let ema_max = ema_max end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>