diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index 647d5a36559d99d991487af2ec613cdf1c8ae9c1..a07f7df6a611e1898016b5e65bcacd988095861e 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -98,6 +98,9 @@ Adaptive Issuance (ongoing) - Activating adaptive issuance per-block vote (MR !11935) +- Adjust total supply tracked for AI (estimated in O) so that it matches the + actual total supply. (MR :gl:`!11996`) + Gas improvements ---------------- diff --git a/src/proto_alpha/lib_protocol/init_storage.ml b/src/proto_alpha/lib_protocol/init_storage.ml index 911147c4ee2909e364ac91b3b114830df79bdbbb..8ba5ecaddcced0e878b001a95ea911f98c1daa97 100644 --- a/src/proto_alpha/lib_protocol/init_storage.ml +++ b/src/proto_alpha/lib_protocol/init_storage.ml @@ -222,6 +222,23 @@ let cleanup_values_for_protocol_p ctxt in return ctxt +(** Updates the total supply with refined estimation at the activation + of P using measures from + https://gitlab.com/tezos/tezos/-/merge_requests/11978. + + Remove me in Q. *) +let update_total_supply_for_p chain_id ctxt = + let open Lwt_result_syntax in + (* We only update the total supply for mainnet. *) + if Chain_id.equal Constants_repr.mainnet_id chain_id then + let* current_total_supply = Storage.Contract.Total_supply.get ctxt in + let*? updated_total_supply = + Tez_repr.(current_total_supply +? of_mutez_exn 16458634911983L) + in + let*! ctxt = Storage.Contract.Total_supply.add ctxt updated_total_supply in + return ctxt + else return ctxt + let prepare_first_block chain_id ctxt ~typecheck_smart_contract ~typecheck_smart_rollup ~level ~timestamp ~predecessor = let open Lwt_result_syntax in @@ -330,6 +347,7 @@ let prepare_first_block chain_id ctxt ~typecheck_smart_contract let*! ctxt = Delegate_slashed_deposits_storage.update_slashing_storage_for_p ctxt in + let* ctxt = update_total_supply_for_p chain_id ctxt in return (ctxt, []) in let* ctxt =