@@ -57,6 +57,9 @@ contract GuardedExecutor is ERC7821 {
5757 /// @dev Exceeded the daily spend limit.
5858 error ExceededSpendLimit ();
5959
60+ /// @dev Super admin keys can execute everything.
61+ error SuperAdminCanExecuteEverything ();
62+
6063 ////////////////////////////////////////////////////////////////////////
6164 // Events
6265 ////////////////////////////////////////////////////////////////////////
@@ -267,14 +270,14 @@ contract GuardedExecutor is ERC7821 {
267270 onlyThis
268271 checkKeyHashIsNonZero (keyHash)
269272 {
273+ if (_isSuperAdmin (keyHash)) revert SuperAdminCanExecuteEverything ();
274+
270275 // All calls not from the EOA itself has to go through the single `execute` function.
271276 // For security, only EOA key and super admin keys can call into `execute`.
272277 // Otherwise any low-stakes app key can call super admin functions
273278 // such as like `authorize` and `revoke`.
274279 // This check is for sanity. We will still validate this in `canExecute`.
275- if (_isSelfExecute (target, fnSel)) {
276- if (! _isSuperAdmin (keyHash)) revert CannotSelfExecute ();
277- }
280+ if (_isSelfExecute (target, fnSel)) revert CannotSelfExecute ();
278281
279282 mapping (bytes32 => bool ) storage c = _getGuardedExecutorStorage ().canExecute;
280283 c[_hash (keyHash, target, fnSel)] = can;
@@ -330,6 +333,9 @@ contract GuardedExecutor is ERC7821 {
330333 // by the EOA's secp256k1 key itself.
331334 if (keyHash == bytes32 (0 )) return true ;
332335
336+ // Super admin keys can execute everything.
337+ if (_isSuperAdmin (keyHash)) return true ;
338+
333339 mapping (bytes32 => bool ) storage c = _getGuardedExecutorStorage ().canExecute;
334340
335341 bytes4 fnSel = ANY_FN_SEL;
@@ -343,7 +349,7 @@ contract GuardedExecutor is ERC7821 {
343349
344350 // This check is required to ensure that authorizing any function selector
345351 // or any target will still NOT allow for self execution.
346- if (_isSelfExecute (target, fnSel)) if ( ! _isSuperAdmin (keyHash)) return false ;
352+ if (_isSelfExecute (target, fnSel)) return false ;
347353
348354 if (c[_hash (keyHash, target, fnSel)]) return true ;
349355 if (c[_hash (keyHash, target, ANY_FN_SEL)]) return true ;
0 commit comments