Skip to content

Commit

Permalink
change order of delegation checks to save gas on successful calls
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Aug 29, 2023
1 parent dd92ab1 commit 10ec350
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/world/src/Delegation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ library DelegationInstance {
bytes32 systemId,
bytes memory funcSelectorAndArgs
) internal returns (bool) {
// Early return if there is no valid delegation
if (!exists(self)) return false;

// Early return if there is an unlimited delegation
if (isUnlimited(self)) return true;

// Call the delegation control contract to check if the delegator has granted access to the delegatee
// Early return if there is no valid delegation
if (!exists(self)) return false;

// Call the delegation control contract to check if the delegator has granted access to the delegatee1
(bool success, bytes memory data) = WorldContextProvider.callWithContext({
target: Delegation.unwrap(self),
funcSelectorAndArgs: abi.encodeWithSelector(
Expand Down

0 comments on commit 10ec350

Please sign in to comment.