From 42e8a1afe02e0b298f79e9859f7dc7bece964889 Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Fri, 29 Sep 2023 18:14:40 -0300 Subject: [PATCH] execute+schedule tweaks --- contracts/access/manager/AccessManager.sol | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/contracts/access/manager/AccessManager.sol b/contracts/access/manager/AccessManager.sol index c6af15b0267..9c3f4d06b07 100644 --- a/contracts/access/manager/AccessManager.sol +++ b/contracts/access/manager/AccessManager.sol @@ -614,12 +614,12 @@ contract AccessManager is Context, Multicall, IAccessManager { address caller = _msgSender(); // Fetch restrictions that apply to the caller on the targeted function - (bool immediate, uint32 setback) = _canCallExtended(caller, target, data); + (, uint32 setback) = _canCallExtended(caller, target, data); uint48 minWhen = Time.timestamp() + setback; - // if call is not authorized, or if requested timing is too soon - if ((!immediate && setback == 0) || (when > 0 && when < minWhen)) { + // if call with delay is not authorized, or if requested timing is too soon + if (setback == 0 || (when > 0 && when < minWhen)) { revert AccessManagerUnauthorizedCall(caller, target, _checkSelector(data)); } @@ -676,11 +676,12 @@ contract AccessManager is Context, Multicall, IAccessManager { revert AccessManagerUnauthorizedCall(caller, target, _checkSelector(data)); } - // If caller is authorised, check operation was scheduled early enough bytes32 operationId = hashOperation(caller, target, data); uint32 nonce; - if (setback != 0) { + // If caller is authorised, check operation was scheduled early enough + // Consume an available schedule even if there is no currently enforced delay + if (setback != 0 || getSchedule(operationId) != 0) { nonce = _consumeScheduledOp(operationId); }