diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 3acfa6802f07ab9466badd1a142995a53d9536f1..45be4b372bd528ae1ee17e6ff365b6ff7f3e3129 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -1031,6 +1031,8 @@ module Constants : sig val zk_rollup_min_pending_to_process : context -> int + val adaptive_inflation_enable : context -> bool + val freeze_rewards : context -> bool (** All constants: fixed and parametric *) diff --git a/src/proto_alpha/lib_protocol/apply.ml b/src/proto_alpha/lib_protocol/apply.ml index 0c579c9b19a8c3ff124c865fc93a4829ad987be9..aad827114703224fc04cc55e526d7931bd7925c8 100644 --- a/src/proto_alpha/lib_protocol/apply.ml +++ b/src/proto_alpha/lib_protocol/apply.ml @@ -239,8 +239,8 @@ let () = (function Invalid_self_transaction_destination -> Some () | _ -> None) (fun () -> Invalid_self_transaction_destination) ; let staking_for_nondelegate_while_costaking_disabled_description = - "As long as co-staking is not enabled, staking and unstaking operations \ - are only allowed from delegates." + "As long as co-staking is not enabled, staking operations are only allowed \ + from delegates." in register_error_kind `Permanent @@ -361,9 +361,14 @@ let apply_stake ~ctxt ~sender ~amount ~destination ~before_operation = let* delegate_opt = Contract.Delegate.find ctxt contract in match delegate_opt with | None -> tzfail Staking_for_nondelegate_while_costaking_disabled - | Some delegate when Signature.Public_key_hash.(delegate <> sender) -> - tzfail Staking_for_nondelegate_while_costaking_disabled | Some delegate -> + let allowed = + Signature.Public_key_hash.(delegate = sender) + || Constants.adaptive_inflation_enable ctxt + in + let*? () = + error_unless allowed Staking_for_nondelegate_while_costaking_disabled + in let* ctxt, balance_updates = Staking.stake ctxt ~sender ~delegate amount in @@ -410,8 +415,6 @@ let apply_unstake ~ctxt ~sender ~amount ~requested_amount ~destination let* delegate_opt = Contract.Delegate.find ctxt sender_contract in match delegate_opt with | None -> tzfail Staking_for_nondelegate_while_costaking_disabled - | Some delegate when Signature.Public_key_hash.(delegate <> sender) -> - tzfail Staking_for_nondelegate_while_costaking_disabled | Some delegate -> let* ctxt, balance_updates = Staking.request_unstake ctxt ~sender_contract ~delegate requested_amount