Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(authorization): revert already set error #652

Merged
merged 4 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
4 changes: 0 additions & 4 deletions src/Morpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,6 @@ contract Morpho is IMorphoStaticTyping {

/// @inheritdoc IMorphoBase
function setAuthorizationWithSig(Authorization memory authorization, Signature calldata signature) external {
require(
authorization.isAuthorized != isAuthorized[authorization.authorizer][authorization.authorized],
ErrorsLib.ALREADY_SET
);
require(block.timestamp <= authorization.deadline, ErrorsLib.SIGNATURE_EXPIRED);
require(authorization.nonce == nonce[authorization.authorizer]++, ErrorsLib.INVALID_NONCE);

Expand Down
16 changes: 0 additions & 16 deletions test/forge/integration/AuthorizationIntegrationTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,6 @@ contract AuthorizationIntegrationTest is BaseTest {
morpho.setAuthorization(addressFuzz, true);
}

function testAlreadySetWithSig(Authorization memory authorization, Signature memory sig) public {
authorization.isAuthorized = false;
authorization.authorizer = address(this);
authorization.deadline = block.timestamp;
authorization.nonce = 0;

vm.expectRevert(bytes(ErrorsLib.ALREADY_SET));
morpho.setAuthorizationWithSig(authorization, sig);

morpho.setAuthorization(authorization.authorized, true);

authorization.isAuthorized = true;
vm.expectRevert(bytes(ErrorsLib.ALREADY_SET));
morpho.setAuthorizationWithSig(authorization, sig);
}

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