Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions certora/confs/OnlyExplicitPayerCanLoseTokens.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"-depth 5",
"-mediumTimeout 30",
"-timeout 7200",
"-sanitySolverTimeout 3600",
"-destructiveOptimizations twostage",
"-havocAllByDefault true"
],
Expand Down
3 changes: 2 additions & 1 deletion src/periphery/EcrecoverAuthorizer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ contract EcrecoverAuthorizer is IEcrecoverAuthorizer {
authorization.authorizer,
authorization.authorized,
authorization.isAuthorized,
authorization.nonce
authorization.nonce,
signer
);

IMidnight(MIDNIGHT)
Expand Down
7 changes: 6 additions & 1 deletion src/periphery/interfaces/IEcrecoverAuthorizer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ interface IEcrecoverAuthorizer {

/// EVENTS ///
event SetIsAuthorized(
address indexed caller, address indexed authorizer, address indexed authorized, bool isAuthorized, uint256 nonce
address indexed caller,
address indexed authorizer,
address indexed authorized,
bool isAuthorized,
uint256 nonce,
address signer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure where to put it, no clear consensus (github search), also don't think it matters much

Comment thread
adhusson marked this conversation as resolved.
);

/// STORAGE GETTERS ///
Expand Down
18 changes: 16 additions & 2 deletions test/EcrecoverAuthorizerTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ contract EcrecoverAuthorizerTest is BaseTest {
Signature memory sig = signAuthorization(auth, borrower);

vm.expectEmit();
emit IEcrecoverAuthorizer.SetIsAuthorized(address(this), borrower, lender, true, auth.nonce);
emit IEcrecoverAuthorizer.SetIsAuthorized(address(this), borrower, lender, true, auth.nonce, borrower);

ecrecoverAuthorizer.setIsAuthorized(auth, sig);

Expand All @@ -69,7 +69,7 @@ contract EcrecoverAuthorizerTest is BaseTest {
sig = signAuthorization(auth, borrower);

vm.expectEmit();
emit IEcrecoverAuthorizer.SetIsAuthorized(address(this), borrower, lender, false, auth.nonce);
emit IEcrecoverAuthorizer.SetIsAuthorized(address(this), borrower, lender, false, auth.nonce, borrower);

ecrecoverAuthorizer.setIsAuthorized(auth, sig);

Expand All @@ -91,6 +91,20 @@ contract EcrecoverAuthorizerTest is BaseTest {
assertEq(ecrecoverAuthorizer.nonce(borrower), 1);
}

function testEcrecoverAuthorizerEventEmitsSigner() public {
vm.startPrank(borrower);
midnight.setIsAuthorized(address(ecrecoverAuthorizer), true, borrower);
midnight.setIsAuthorized(otherBorrower, true, borrower);
vm.stopPrank();

Authorization memory auth = makeAuthorization(borrower, lender, true);
Signature memory sig = signAuthorization(auth, otherBorrower);

vm.expectEmit();
emit IEcrecoverAuthorizer.SetIsAuthorized(address(this), borrower, lender, true, auth.nonce, otherBorrower);
ecrecoverAuthorizer.setIsAuthorized(auth, sig);
}

function testEcrecoverAuthorizerInvalidSignature() public {
Authorization memory auth = makeAuthorization(borrower, lender, true);
Signature memory sig = signAuthorization(auth, lender); // wrong signer
Expand Down