Skip to content

Commit

Permalink
perf: optimize "execute"
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRBerg committed Jun 22, 2023
1 parent f4ac54b commit 27479f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/PRBProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ contract PRBProxy is IPRBProxy {
/// @inheritdoc IPRBProxy
function execute(address target, bytes calldata data) external payable override returns (bytes memory response) {
// Check that the caller is either the owner or an envoy with permission.
bool permission = registry.getPermissionByOwner({ owner: owner, envoy: msg.sender, target: target });
if (owner != msg.sender && !permission) {
revert PRBProxy_ExecutionUnauthorized({ owner: owner, caller: msg.sender, target: target });
if (owner != msg.sender) {
bool permission = registry.getPermissionByOwner({ owner: owner, envoy: msg.sender, target: target });
if (!permission) {
revert PRBProxy_ExecutionUnauthorized({ owner: owner, caller: msg.sender, target: target });
}
}

// Delegate call to the target contract, and handle the response.
Expand Down
Loading

0 comments on commit 27479f6

Please sign in to comment.