Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
execute+schedule tweaks
(cherry picked from commit 42e8a1a)
  • Loading branch information
frangio committed Oct 2, 2023
commit e96dad0645a9f36116284bf8c4956ce6b6ddc1f4
11 changes: 6 additions & 5 deletions contracts/access/manager/AccessManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,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));
}

Expand Down Expand Up @@ -644,11 +644,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);
}

Expand Down