diff --git a/devtools/get_contracts/get_contracts_alpha.ml b/devtools/get_contracts/get_contracts_alpha.ml index 9318fd45fb6713997f9591d0d221d30e7a322936..c60f177a0cc9774c79fb3d7a9acddaba19cf18f8 100644 --- a/devtools/get_contracts/get_contracts_alpha.ml +++ b/devtools/get_contracts/get_contracts_alpha.ml @@ -38,12 +38,7 @@ module Proto = struct let open Lwt_result_syntax in let+ ctxt = Lwt.map wrap_tzresult - @@ Raw_context.prepare - ~level - ~predecessor_timestamp - ~timestamp - ~adaptive_issuance_enable:false - ctxt + @@ Raw_context.prepare ~level ~predecessor_timestamp ~timestamp ctxt in Raw_context.set_gas_limit ctxt diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index e90e25a814eecab7ab4d9d31a1898cfcac72ece6..79e74b02e7d523d9575c1a91e82c10f9ca270d3a 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -152,3 +152,6 @@ Internal accounts for the first few cycles are now computed with Adaptive Issuance enabled, meaning that delegated tez are already weighted less than staked tez. (MR :gl:`!16945`) + +- Remove obsolete internal field related to Adaptive Issuance + activation. (MR :gl:`!15789`) diff --git a/scripts/profile_alpha.patch b/scripts/profile_alpha.patch index 194da29ec6a19b59619a3ab2327965550084020e..57a8582b3e050cbf5486efa09ef67585c211b86c 100644 --- a/scripts/profile_alpha.patch +++ b/scripts/profile_alpha.patch @@ -507,24 +507,17 @@ diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_p index 910c9d5dad7..ea684a8f115 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml -@@ -1753,12 +1753,13 @@ let prepare_first_block ~level ~timestamp chain_id ctxt = +@@ -1764,5 +1764,11 @@ let prepare_first_block ~level ~timestamp chain_id ctxt = (* End of alpha predecessor stitching. Comment used for automatic snapshot *) in - let+ ctxt = -- prepare -- ctxt -- ~level -- ~predecessor_timestamp:timestamp -- ~timestamp -- ~adaptive_issuance_enable:false +- let+ ctxt = prepare ctxt ~level ~predecessor_timestamp:timestamp ~timestamp in ++ let+ ctxt = + (prepare + ctxt + ~level + ~predecessor_timestamp:timestamp -+ ~timestamp -+ ~adaptive_issuance_enable:false -+ [@profiler.record_s {verbosity = Notice} "Prepare"]) - in ++ ~timestamp [@profiler.record_s {verbosity = Notice} "Prepare"]) ++ in (previous_proto, previous_proto_constants, ctxt) diff --git a/src/proto_alpha/lib_protocol/script_cache.ml b/src/proto_alpha/lib_protocol/script_cache.ml diff --git a/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.ml b/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.ml index 3feb1ddcf0254b5ad9d1f81b1c64dcce2f3535dd..d9188e1968d5b8d5845e228023a1a72923e598b8 100644 --- a/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.ml +++ b/src/proto_alpha/lib_delegate/test/tenderbrute/lib/tenderbrute.ml @@ -64,7 +64,6 @@ let init_context ?constants_overrides_json ?bootstrap_accounts_json parameters = ~level:1l ~predecessor_timestamp:timestamp ~timestamp - ~adaptive_issuance_enable:false in Lwt.return @@ Environment.wrap_tzresult result diff --git a/src/proto_alpha/lib_protocol/adaptive_issuance_storage.ml b/src/proto_alpha/lib_protocol/adaptive_issuance_storage.ml index 981219d48bf67dd80fa86815338fd73b815e67ce..de80b59966966d3ffdeda70276d5be51de6ec904 100644 --- a/src/proto_alpha/lib_protocol/adaptive_issuance_storage.ml +++ b/src/proto_alpha/lib_protocol/adaptive_issuance_storage.ml @@ -23,12 +23,11 @@ (* *) (*****************************************************************************) -(* Default reward coefficient when AI is not in effect, chosen so that - rewards * coeff = rewards *) -let default_reward = Q.one +(* Initial reward coefficient when activating the protocol from Genesis. *) +let initial_genesis_coeff = Q.one -(* Default bonus value *) -let default_bonus = Issuance_bonus_repr.zero +(* Initial bonus value when activating the protocol from Genesis. *) +let initial_genesis_bonus = Issuance_bonus_repr.zero (* Note: the reward and the bonus values are computed as rationals ([Q.t]) but are stored as fixed-point values (see {!Issuance_bonus_repr}) so that the @@ -69,37 +68,31 @@ let launch_cycle ctxt = Storage.Adaptive_issuance.Activation.get ctxt let safe_cycle_add c i = if Compare.Int.(i >= 0) then Cycle_repr.add c i else c let check_determined_cycle ctxt cycle = - let ai_enable = Constants_storage.adaptive_issuance_enable ctxt in - if ai_enable then - let ctxt_cycle = (Raw_context.current_level ctxt).cycle in - let cycles_delay = Constants_storage.issuance_modification_delay ctxt in - fail_unless - Cycle_repr.( - ctxt_cycle <= cycle && cycle <= safe_cycle_add ctxt_cycle cycles_delay) - (Undetermined_issuance_coeff_for_cycle cycle) - else return_unit + let ctxt_cycle = (Raw_context.current_level ctxt).cycle in + let cycles_delay = Constants_storage.issuance_modification_delay ctxt in + fail_unless + Cycle_repr.( + ctxt_cycle <= cycle && cycle <= safe_cycle_add ctxt_cycle cycles_delay) + (Undetermined_issuance_coeff_for_cycle cycle) let get_reward_coeff ctxt ~cycle = let open Lwt_result_syntax in let* () = check_determined_cycle ctxt cycle in - let ai_enable = Constants_storage.adaptive_issuance_enable ctxt in - if ai_enable then - (* Even if AI is enabled, the storage can be empty: this is the case for - the first 5 cycles after AI is enabled *) - let* k_opt = Storage.Issuance_coeff.find ctxt cycle in - return (Option.value ~default:default_reward k_opt) - else return default_reward + let* k_opt = Storage.Issuance_coeff.find ctxt cycle in + (* The coeff should always be present in the storage on mainnet and + ghostnet and tests that activate alpha from Genesis. However, + some tests activate R022 from Genesis then migrate to alpha + before cycle 3; in such tests, [k_opt] may still be [None] for + cycles 0 to 2. *) + return (Option.value ~default:initial_genesis_coeff k_opt) let get_reward_bonus ctxt ~cycle = let open Lwt_result_syntax in match cycle with - | None -> return default_bonus + | None -> return initial_genesis_bonus | Some cycle -> - let ai_enable = Constants_storage.adaptive_issuance_enable ctxt in - if ai_enable then - let* k_opt = Storage.Issuance_bonus.find ctxt cycle in - return (Option.value ~default:default_bonus k_opt) - else return default_bonus + let* k_opt = Storage.Issuance_bonus.find ctxt cycle in + return (Option.value ~default:initial_genesis_bonus k_opt) let load_reward_coeff ctxt ~cycle = let open Lwt_result_syntax in @@ -279,88 +272,91 @@ let compute_coeff = let compute_and_store_reward_coeff_at_cycle_end ctxt ~new_cycle = let open Lwt_result_syntax in - let ai_enable = Constants_storage.adaptive_issuance_enable ctxt in - if not ai_enable then return ctxt - else - let* launch_cycle = launch_cycle ctxt in - let reward_params = - Constants_storage.adaptive_issuance_rewards_params ctxt - in - let modification_delay = - Constants_storage.issuance_modification_delay ctxt - in - let for_cycle = safe_cycle_add new_cycle modification_delay in - let before_for_cycle = Cycle_repr.pred for_cycle in - let* total_supply = Storage.Contract.Total_supply.get ctxt in - let* total_stake = Stake_storage.get_total_active_stake ctxt for_cycle in - let base_total_issued_per_minute = - (Constants_storage.issuance_weights ctxt).base_total_issued_per_minute - in - let total_frozen_stake = Stake_repr.get_frozen total_stake in - let* previous_bonus = get_reward_bonus ctxt ~cycle:before_for_cycle in - let blocks_per_cycle = - Constants_storage.blocks_per_cycle ctxt |> Int64.of_int32 - in - let minimal_block_delay = - Constants_storage.minimal_block_delay ctxt |> Period_repr.to_seconds - in - let seconds_per_cycle = Int64.mul blocks_per_cycle minimal_block_delay in - let q_total_supply = Tez_repr.to_mutez total_supply |> Q.of_int64 in - let q_total_frozen_stake = - Tez_repr.to_mutez total_frozen_stake |> Q.of_int64 - in - let stake_ratio = - Q.div q_total_frozen_stake q_total_supply (* = portion of frozen stake *) - in - (* Once computed here, the minimum is final. *) - let issuance_ratio_min = - compute_min ~launch_cycle ~new_cycle ~reward_params - in - (* Once computed here, the maximum is final. If it would have been smaller than - the min, then it is set to the min. *) - let issuance_ratio_max = - compute_max - ~issuance_ratio_min - ~stake_ratio - ~launch_cycle - ~new_cycle - ~reward_params - in - (* Compute the static curve, within the given bounds *) - let base_reward_coeff_ratio = - compute_reward_coeff_ratio_without_bonus - ~stake_ratio - ~issuance_ratio_max - ~issuance_ratio_min - in - (* Compute the dynamic curve. Keeps the sum static + dynamic within the - given bounds *) - let*? bonus = - compute_bonus - ~issuance_ratio_max - ~seconds_per_cycle - ~stake_ratio - ~base_reward_coeff_ratio - ~previous_bonus - ~reward_params - in - (* Compute the multiplicative coefficient to apply to the base rewards *) - let coeff = - compute_coeff - ~issuance_ratio_max - ~issuance_ratio_min - ~base_total_issued_per_minute - ~base_reward_coeff_ratio - ~q_total_supply - ~bonus - in - let*! ctxt = Storage.Issuance_bonus.add ctxt for_cycle bonus in - let*! ctxt = Storage.Issuance_coeff.add ctxt for_cycle coeff in - return ctxt + let* launch_cycle = launch_cycle ctxt in + let reward_params = Constants_storage.adaptive_issuance_rewards_params ctxt in + let modification_delay = Constants_storage.issuance_modification_delay ctxt in + let for_cycle = safe_cycle_add new_cycle modification_delay in + let before_for_cycle = Cycle_repr.pred for_cycle in + let* total_supply = Storage.Contract.Total_supply.get ctxt in + let* total_stake = Stake_storage.get_total_active_stake ctxt for_cycle in + let base_total_issued_per_minute = + (Constants_storage.issuance_weights ctxt).base_total_issued_per_minute + in + let total_frozen_stake = Stake_repr.get_frozen total_stake in + let* previous_bonus = get_reward_bonus ctxt ~cycle:before_for_cycle in + let blocks_per_cycle = + Constants_storage.blocks_per_cycle ctxt |> Int64.of_int32 + in + let minimal_block_delay = + Constants_storage.minimal_block_delay ctxt |> Period_repr.to_seconds + in + let seconds_per_cycle = Int64.mul blocks_per_cycle minimal_block_delay in + let q_total_supply = Tez_repr.to_mutez total_supply |> Q.of_int64 in + let q_total_frozen_stake = + Tez_repr.to_mutez total_frozen_stake |> Q.of_int64 + in + let stake_ratio = + Q.div q_total_frozen_stake q_total_supply (* = portion of frozen stake *) + in + (* Once computed here, the minimum is final. *) + let issuance_ratio_min = + compute_min ~launch_cycle ~new_cycle ~reward_params + in + (* Once computed here, the maximum is final. If it would have been smaller than + the min, then it is set to the min. *) + let issuance_ratio_max = + compute_max + ~issuance_ratio_min + ~stake_ratio + ~launch_cycle + ~new_cycle + ~reward_params + in + (* Compute the static curve, within the given bounds *) + let base_reward_coeff_ratio = + compute_reward_coeff_ratio_without_bonus + ~stake_ratio + ~issuance_ratio_max + ~issuance_ratio_min + in + (* Compute the dynamic curve. Keeps the sum static + dynamic within the + given bounds *) + let*? bonus = + compute_bonus + ~issuance_ratio_max + ~seconds_per_cycle + ~stake_ratio + ~base_reward_coeff_ratio + ~previous_bonus + ~reward_params + in + (* Compute the multiplicative coefficient to apply to the base rewards *) + let coeff = + compute_coeff + ~issuance_ratio_max + ~issuance_ratio_min + ~base_total_issued_per_minute + ~base_reward_coeff_ratio + ~q_total_supply + ~bonus + in + let*! ctxt = Storage.Issuance_bonus.add ctxt for_cycle bonus in + let*! ctxt = Storage.Issuance_coeff.add ctxt for_cycle coeff in + return ctxt let clear_outdated_reward_data ctxt ~new_cycle = let open Lwt_syntax in - match Cycle_repr.sub new_cycle 2 with + match + Cycle_repr.sub + new_cycle + (* We should not clear [new_cycle - 1] even if + [issuance_modification_delay < 2]. Indeed, calling e.g. the + "issuance_per_minute" RPC on the last block of a given cycle + [c] will request the issuance coeff for cycle [c] from a + context that has already been set up for cycle [c + 1], so it + still needs to be available. *) + (Compare.Int.max 2 (Constants_storage.issuance_modification_delay ctxt)) + with | None -> Lwt.return ctxt | Some cycle -> let* ctxt = Storage.Issuance_coeff.remove ctxt cycle in @@ -378,21 +374,26 @@ let load_reward_coeff ctxt = let init_from_genesis ctxt = let open Lwt_result_syntax in let* ctxt = Storage.Adaptive_issuance.Launch_ema.init ctxt 0l in - let ctxt = Raw_context.set_adaptive_issuance_enable ctxt in let current_cycle = (Level_storage.current ctxt).cycle in - Storage.Adaptive_issuance.Activation.init ctxt (Some current_cycle) - -let set_adaptive_issuance_enable ctxt = - let open Lwt_result_syntax in - let+ enable = - let+ launch_cycle = launch_cycle ctxt in - match launch_cycle with - | None -> false - | Some launch_cycle -> - let current_cycle = (Level_storage.current ctxt).cycle in - Cycle_repr.(current_cycle >= launch_cycle) + assert (Int32.equal (Cycle_repr.to_int32 current_cycle) 0l) ; + let* ctxt = + Storage.Adaptive_issuance.Activation.init ctxt (Some current_cycle) in - if enable then Raw_context.set_adaptive_issuance_enable ctxt else ctxt + (* When cycle n starts, the storage should already contain the coeff + and bonus for cycles n to (n + issuance_modification_delay). *) + let*! ctxt = + let open Lwt_syntax in + List.fold_left_s + (fun ctxt i -> + let for_cycle = Cycle_repr.of_int32_exn (Int32.of_int i) in + let* ctxt = + Storage.Issuance_coeff.add ctxt for_cycle initial_genesis_coeff + in + Storage.Issuance_bonus.add ctxt for_cycle initial_genesis_bonus) + ctxt + Misc.(0 --> Constants_storage.issuance_modification_delay ctxt) + in + return ctxt let update_ema ctxt ~vote = let open Lwt_result_syntax in diff --git a/src/proto_alpha/lib_protocol/adaptive_issuance_storage.mli b/src/proto_alpha/lib_protocol/adaptive_issuance_storage.mli index 66ae2db2047298e63298f75d26ee9a79e44e9daa..22404d31f906ec53447e8f8a7333de00dcd7c95f 100644 --- a/src/proto_alpha/lib_protocol/adaptive_issuance_storage.mli +++ b/src/proto_alpha/lib_protocol/adaptive_issuance_storage.mli @@ -25,13 +25,6 @@ type error += Undetermined_issuance_coeff_for_cycle of Cycle_repr.t -(** [set_adaptive_issuance_enable ctxt] sets the feature flag in the - in-memory part of the context if the adaptive issuance feature has - already launched. This means that the activation vote resulted in - an approbation from the stakeholders and this happened sufficiently - long ago. *) -val set_adaptive_issuance_enable : Raw_context.t -> Raw_context.t tzresult Lwt.t - (** [load_reward_coeff ctxt] loads the current cycle's reward coeff from the storage into the context *) val load_reward_coeff : Raw_context.t -> Raw_context.t tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 21684e110eecc30cbe5ced0f06d1b5b4ca5e6125..7b6cefc26bbb0f45bf685e131b75ad81c42c8228 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -1106,8 +1106,6 @@ module Constants : sig val zk_rollup_min_pending_to_process : context -> int - val adaptive_issuance_enable : context -> bool - val zk_rollup_max_ticket_payload_size : context -> int val direct_ticket_spending_enable : context -> bool diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 732af4173d8191bf9fa7d5cdf7ce00fc8d1f441d..3d938c303fdf3ecac81cb0c7c1fb08bb64273d6a 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -45,7 +45,6 @@ type error += | Invalid_transfer_to_sc_rollup | Invalid_sender of Destination.t | Invalid_self_transaction_destination - | Staking_for_delegator_while_external_staking_disabled | Staking_to_delegate_that_refuses_external_staking | Stake_modification_with_no_delegate_set | Invalid_nonzero_transaction_amount of Tez.t @@ -231,25 +230,6 @@ let () = Data_encoding.unit (function Invalid_self_transaction_destination -> Some () | _ -> None) (fun () -> Invalid_self_transaction_destination) ; - let staking_for_delegator_while_external_staking_disabled_description = - "As long as external staking is not enabled, staking operations are only \ - allowed from delegates." - in - register_error_kind - `Permanent - ~id:"operations.staking_for_delegator_while_external_staking_disabled" - ~title:"Staking for a delegator while external staking is disabled" - ~description: - staking_for_delegator_while_external_staking_disabled_description - ~pp:(fun ppf () -> - Format.pp_print_string - ppf - staking_for_delegator_while_external_staking_disabled_description) - Data_encoding.unit - (function - | Staking_for_delegator_while_external_staking_disabled -> Some () - | _ -> None) - (fun () -> Staking_for_delegator_while_external_staking_disabled) ; let stake_modification_without_delegate_description = "(Un)Stake operations are only allowed when delegate is set." in @@ -397,15 +377,6 @@ let apply_stake ~ctxt ~sender ~amount ~destination ~before_operation = match delegate_opt with | None -> tzfail Stake_modification_with_no_delegate_set | Some delegate -> - let allowed = - Signature.Public_key_hash.(delegate = sender) - || Constants.adaptive_issuance_enable ctxt - in - let*? () = - error_unless - allowed - Staking_for_delegator_while_external_staking_disabled - in let* {limit_of_staking_over_baking_millionth; _} = Delegate.Staking_parameters.of_delegate ctxt delegate in diff --git a/src/proto_alpha/lib_protocol/apply.mli b/src/proto_alpha/lib_protocol/apply.mli index 444bd81de59a4c5eaa03c56aef84aa7ca3de5d9a..5a94701f58c2970c650fa4bac7860fb707dce68a 100644 --- a/src/proto_alpha/lib_protocol/apply.mli +++ b/src/proto_alpha/lib_protocol/apply.mli @@ -50,7 +50,6 @@ type error += | Invalid_transfer_to_sc_rollup | Invalid_sender of Destination.t | Invalid_self_transaction_destination - | Staking_for_delegator_while_external_staking_disabled | Staking_to_delegate_that_refuses_external_staking | Stake_modification_with_no_delegate_set | Invalid_nonzero_transaction_amount of Tez.t diff --git a/src/proto_alpha/lib_protocol/constants_storage.ml b/src/proto_alpha/lib_protocol/constants_storage.ml index db6b258f099843ba92892f83322a6859c66d3704..41391cd9117cfdd7ac42a5ef0b0d9af05300219c 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.ml +++ b/src/proto_alpha/lib_protocol/constants_storage.ml @@ -262,8 +262,6 @@ let zk_rollup_max_ticket_payload_size c = let adaptive_issuance c = (Raw_context.constants c).adaptive_issuance -let adaptive_issuance_enable c = Raw_context.adaptive_issuance_enable c - let adaptive_issuance_global_limit_of_staking_over_baking c = (adaptive_issuance c).global_limit_of_staking_over_baking diff --git a/src/proto_alpha/lib_protocol/constants_storage.mli b/src/proto_alpha/lib_protocol/constants_storage.mli index fc838230a954cc973d959b8eab39383ad3979ae1..05e7d9c799c9d2c7b8965d7863c4ad3c9a7c75ff 100644 --- a/src/proto_alpha/lib_protocol/constants_storage.mli +++ b/src/proto_alpha/lib_protocol/constants_storage.mli @@ -140,8 +140,6 @@ val zk_rollup_origination_size : Raw_context.t -> int val zk_rollup_max_ticket_payload_size : Raw_context.t -> int -val adaptive_issuance_enable : Raw_context.t -> bool - val adaptive_issuance_global_limit_of_staking_over_baking : Raw_context.t -> int val adaptive_issuance_edge_of_staking_over_delegation : Raw_context.t -> int diff --git a/src/proto_alpha/lib_protocol/init_storage.ml b/src/proto_alpha/lib_protocol/init_storage.ml index b389c5978ab21bd1eebf3211907a684b8ec3c70c..d977dc2d03f472c245960319bdd6266e378e0900 100644 --- a/src/proto_alpha/lib_protocol/init_storage.ml +++ b/src/proto_alpha/lib_protocol/init_storage.ml @@ -112,14 +112,8 @@ let patch_script ctxt (address, hash, patched_code) = let prepare ctxt ~level ~predecessor_timestamp ~timestamp = let open Lwt_result_syntax in let* ctxt = - Raw_context.prepare - ~level - ~predecessor_timestamp - ~timestamp - ~adaptive_issuance_enable:false - ctxt + Raw_context.prepare ~level ~predecessor_timestamp ~timestamp ctxt in - let* ctxt = Adaptive_issuance_storage.set_adaptive_issuance_enable ctxt in Storage.Pending_migration.remove ctxt (* Start of code to remove at next automatic protocol snapshot *) diff --git a/src/proto_alpha/lib_protocol/raw_context.ml b/src/proto_alpha/lib_protocol/raw_context.ml index 99611aa8a2e1a69f40e1feb1ee9aa89786fb8f37..770fabc9fe8dab182a883ff26003849481cb1c3e 100644 --- a/src/proto_alpha/lib_protocol/raw_context.ml +++ b/src/proto_alpha/lib_protocol/raw_context.ml @@ -307,7 +307,6 @@ type back = { reward_coeff_for_current_cycle : Q.t; sc_rollup_current_messages : Sc_rollup_inbox_merkelized_payload_hashes_repr.t; dal : Raw_dal.t; - adaptive_issuance_enable : bool; address_registry_diff_rev : Raw_address_registry.diff list; } @@ -382,8 +381,6 @@ let[@inline] reward_coeff_for_current_cycle ctxt = let[@inline] dal ctxt = ctxt.back.dal -let[@inline] adaptive_issuance_enable ctxt = ctxt.back.adaptive_issuance_enable - let[@inline] update_back ctxt back = {ctxt with back} let[@inline] update_remaining_block_gas ctxt remaining_block_gas = @@ -434,9 +431,6 @@ let[@inline] update_reward_coeff_for_current_cycle ctxt let[@inline] update_dal ctxt dal = update_back ctxt {ctxt.back with dal} -let[@inline] set_adaptive_issuance_enable ctxt = - update_back ctxt {ctxt.back with adaptive_issuance_enable = true} - type error += Too_many_internal_operations (* `Permanent *) type error += Block_quota_exceeded (* `Temporary *) @@ -898,8 +892,7 @@ let check_cycle_eras (cycle_eras : Level_repr.cycle_eras) Compare.Int32.( current_era.blocks_per_commitment = constants.blocks_per_commitment)) -let prepare ~level ~predecessor_timestamp ~timestamp ~adaptive_issuance_enable - ctxt = +let prepare ~level ~predecessor_timestamp ~timestamp ctxt = let open Lwt_result_syntax in let*? level = Raw_level_repr.of_int32 level in let* () = check_inited ctxt in @@ -947,7 +940,6 @@ let prepare ~level ~predecessor_timestamp ~timestamp ~adaptive_issuance_enable Raw_dal.init ~number_of_slots: constants.Constants_parametric_repr.dal.number_of_slots; - adaptive_issuance_enable; address_registry_diff_rev = []; }; } @@ -1771,14 +1763,7 @@ let prepare_first_block ~level ~timestamp chain_id ctxt = return (ctxt, Some c) (* End of alpha predecessor stitching. Comment used for automatic snapshot *) in - let+ ctxt = - prepare - ctxt - ~level - ~predecessor_timestamp:timestamp - ~timestamp - ~adaptive_issuance_enable:false - in + let+ ctxt = prepare ctxt ~level ~predecessor_timestamp:timestamp ~timestamp in (previous_proto, previous_proto_constants, ctxt) let activate ctxt h = diff --git a/src/proto_alpha/lib_protocol/raw_context.mli b/src/proto_alpha/lib_protocol/raw_context.mli index d4947cfe444da3b76d10df8361c5005d3a1b516c..9e0a433970c9ce969f60c59e5d1fb5550cc79be3 100644 --- a/src/proto_alpha/lib_protocol/raw_context.mli +++ b/src/proto_alpha/lib_protocol/raw_context.mli @@ -89,7 +89,6 @@ val prepare : level:Int32.t -> predecessor_timestamp:Time.t -> timestamp:Time.t -> - adaptive_issuance_enable:bool -> Context.t -> t tzresult Lwt.t @@ -343,12 +342,6 @@ val reward_coeff_for_current_cycle : t -> Q.t [Adaptive_issuance_storage] *) val update_reward_coeff_for_current_cycle : t -> Q.t -> t -(** Returns true if adaptive issuance has launched. *) -val adaptive_issuance_enable : t -> bool - -(** Set the feature flag of adaptive issuance. *) -val set_adaptive_issuance_enable : t -> t - module Internal_for_tests : sig val add_level : t -> int -> t diff --git a/src/proto_alpha/lib_protocol/stake_context.ml b/src/proto_alpha/lib_protocol/stake_context.ml index 18e0b2b11a6338054211e715c291a2ab79fcd587..858932612a18b07adcabb860af97fc0e9bb2857b 100644 --- a/src/proto_alpha/lib_protocol/stake_context.ml +++ b/src/proto_alpha/lib_protocol/stake_context.ml @@ -61,14 +61,12 @@ let apply_limits ctxt staking_parameters staking_balance = | Error _max_allowed_delegated_overflows -> delegated in let* weighted_delegated = - if Constants_storage.adaptive_issuance_enable ctxt then - let edge_of_staking_over_delegation = - Int64.of_int - (Constants_storage.adaptive_issuance_edge_of_staking_over_delegation - ctxt) - in - Tez_repr.(delegated /? edge_of_staking_over_delegation) - else return delegated + let edge_of_staking_over_delegation = + Int64.of_int + (Constants_storage.adaptive_issuance_edge_of_staking_over_delegation + ctxt) + in + Tez_repr.(delegated /? edge_of_staking_over_delegation) in let+ frozen = Tez_repr.(own_frozen +? allowed_staked_frozen) in Stake_repr.make ~frozen ~weighted_delegated diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_deactivation.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_deactivation.ml index 9f7dcd7ae17ee2adc5f90f8479df9767f43030da..741189956b6853f4a451797e8b591be8127249ec 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_deactivation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_deactivation.ml @@ -54,7 +54,6 @@ let check_stake ~loc (b : Block.t) (account : Account.t) = ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ stake = Stake_storage.Internal_for_tests.get ctxt account.pkh in Assert.equal_int64 @@ -77,7 +76,6 @@ let check_no_stake ~loc (b : Block.t) (account : Account.t) = ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ stake = Stake_storage.Internal_for_tests.get ctxt account.pkh in Assert.equal_int64 ~loc (Tez_repr.to_mutez stake) 0L diff --git a/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml b/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml index 08b95393e72c5325c5784c00e71af7c5ad6d00a2..54e49c7b5892ec56a559d3d8060053c47d7abef6 100644 --- a/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml +++ b/src/proto_alpha/lib_protocol/test/integration/gas/test_gas_levels.ml @@ -57,7 +57,6 @@ let dummy_context () = ~timestamp:Time.Protocol.epoch (* ~fitness:[] *) (block.context : Tezos_protocol_environment.Context.t) - ~adaptive_issuance_enable:false in return ctxt diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_sapling.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_sapling.ml index 609119ffb4cfa9d34567f95074fe25ec40a289f2..b9ea1f841c3a9772357110e9fc51fd336bafd501 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_sapling.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_sapling.ml @@ -49,7 +49,6 @@ module Raw_context_tests = struct ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let module H = Tezos_sapling.Core.Client.Hash in let cm = H.uncommitted ~height:0 in @@ -93,7 +92,6 @@ module Raw_context_tests = struct ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ ctx, id = Lazy_storage_diff.fresh @@ -127,7 +125,6 @@ module Raw_context_tests = struct ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ ctx, id = Lazy_storage_diff.fresh @@ -186,7 +183,6 @@ module Raw_context_tests = struct ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ ctx, id = Lazy_storage_diff.fresh @@ -231,7 +227,6 @@ module Raw_context_tests = struct ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ ctx, id_one_by_one = Lazy_storage_diff.fresh @@ -313,7 +308,6 @@ module Raw_context_tests = struct ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ ctx, id = Lazy_storage_diff.fresh @@ -335,7 +329,6 @@ module Raw_context_tests = struct ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp (Raw_context.recover ctx) - ~adaptive_issuance_enable:false in (ctx, Int32.succ cnt)) (ctx, 0l) @@ -387,7 +380,6 @@ module Raw_context_tests = struct ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ ctx, id = Lazy_storage_diff.fresh @@ -1076,7 +1068,6 @@ module Interpreter_tests = struct ~level:block.header.shell.level ~predecessor_timestamp:block.header.shell.timestamp ~timestamp:block.header.shell.timestamp - ~adaptive_issuance_enable:false in let*@ result = Sapling_storage.Roots.mem raw_ctx id root in return result diff --git a/src/proto_alpha/lib_protocol/test/integration/michelson/test_temp_big_maps.ml b/src/proto_alpha/lib_protocol/test/integration/michelson/test_temp_big_maps.ml index 7727997172821ce8eff9e35871a599148567c469..21eb4be563d48c7091a285499d7f2232e11f50ac 100644 --- a/src/proto_alpha/lib_protocol/test/integration/michelson/test_temp_big_maps.ml +++ b/src/proto_alpha/lib_protocol/test/integration/michelson/test_temp_big_maps.ml @@ -41,7 +41,6 @@ let to_raw_context (b : Block.t) = ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in ctxt diff --git a/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml b/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml index b25797e683fdb009b12648eed0187a064bfbc69f..b9c2205e12e5f4963d3a4be6adba27eeafb4a67b 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_zk_rollup_storage.ml @@ -77,7 +77,6 @@ module Raw_context_tests = struct ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp - ~adaptive_issuance_enable:false in let nonce = Operation_hash.hash_string ["nonce_hash"] in return (Raw_context.init_origination_nonce ctx nonce, contract)