Skip to content

Commit

Permalink
fix: issue-431
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD committed Dec 10, 2023
1 parent 4d68d40 commit 8e7e4ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Morpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ contract Morpho is IMorphoStaticTyping {

/// @inheritdoc IMorphoBase
function setAuthorization(address authorized, bool newIsAuthorized) external {
require(newIsAuthorized != isAuthorized[msg.sender][authorized], ErrorsLib.ALREADY_SET);

isAuthorized[msg.sender][authorized] = newIsAuthorized;

emit EventsLib.SetAuthorization(msg.sender, msg.sender, authorized, newIsAuthorized);
Expand Down
6 changes: 6 additions & 0 deletions test/forge/integration/AuthorizationIntegrationTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ contract AuthorizationIntegrationTest is BaseTest {
assertFalse(morpho.isAuthorized(address(this), addressFuzz));
}

function testAlreadySet(address addressFuzz, bool status) public {
morpho.setAuthorization(addressFuzz, status);
vm.expectRevert(bytes(ErrorsLib.ALREADY_SET));
morpho.setAuthorization(addressFuzz, status);
}

function testSetAuthorizationWithSignatureDeadlineOutdated(
Authorization memory authorization,
uint256 privateKey,
Expand Down

0 comments on commit 8e7e4ce

Please sign in to comment.