From f40df951a27d1acba07fbd00bec518d3aefd28cd Mon Sep 17 00:00:00 2001 From: Lucas Randazzo Date: Fri, 8 Mar 2024 10:42:08 +0100 Subject: [PATCH] Proto: expose internal ema_max --- src/proto_alpha/lib_protocol/per_block_votes_repr.ml | 10 ++++++++-- src/proto_alpha/lib_protocol/per_block_votes_repr.mli | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_protocol/per_block_votes_repr.ml b/src/proto_alpha/lib_protocol/per_block_votes_repr.ml index a30dd1bc9481..f61b6e633a70 100644 --- a/src/proto_alpha/lib_protocol/per_block_votes_repr.ml +++ b/src/proto_alpha/lib_protocol/per_block_votes_repr.ml @@ -36,6 +36,8 @@ type per_block_votes = { 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 @@ -93,7 +95,7 @@ let per_block_votes_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 + let ema_max = ema_max end) module Adaptive_issuance_launch_EMA = Votes_EMA_repr.Make (struct @@ -111,7 +113,7 @@ module Adaptive_issuance_launch_EMA = Votes_EMA_repr.Make (struct blocks are actually needed. *) let baker_contribution = Z.of_int 5730 - let ema_max = 2_000_000_000l + let ema_max = ema_max end) let compute_new_liquidity_baking_ema ~per_block_vote ema = @@ -125,3 +127,7 @@ let compute_new_adaptive_issuance_ema ~per_block_vote ema = | 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 diff --git a/src/proto_alpha/lib_protocol/per_block_votes_repr.mli b/src/proto_alpha/lib_protocol/per_block_votes_repr.mli index 6b026bf85f7f..abaa67352d9b 100644 --- a/src/proto_alpha/lib_protocol/per_block_votes_repr.mli +++ b/src/proto_alpha/lib_protocol/per_block_votes_repr.mli @@ -81,3 +81,8 @@ val compute_new_adaptive_issuance_ema : per_block_vote:per_block_vote -> Adaptive_issuance_launch_EMA.t -> Adaptive_issuance_launch_EMA.t + +module Internal_for_tests : sig + (* Maximum value for EMA representation (both LB and AI) *) + val ema_max : Int32.t +end -- GitLab