-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
methods { | ||
function initiator() external returns(address) envfree; | ||
function MORPHO() external returns(address) envfree; | ||
} | ||
|
||
|
||
// Check that all methods except those noted below comply with the `protected` modifier when an initiator has been set. | ||
rule protectedWithSetInitiator(method f, env e, calldataarg data) filtered { | ||
// Do not check view functions. | ||
f -> !f.isView && | ||
// Do not check the fallback function. | ||
!f.isFallback && | ||
// Do not check multicall, which is used to start a new bundle. | ||
f -> !f.isView && !f.isFallback && f.selector != sig:multicall(bytes[]).selector | ||
f.selector != sig:multicall(bytes[]).selector | ||
} | ||
{ | ||
// Safe require because `protected` functions should be callable by the initiator. | ||
require e.msg.sender != currentContract._initiator; | ||
// Safe require because `protected` functions should be callable by Morpho. | ||
require e.msg.sender != currentContract.MORPHO; | ||
f@withrevert(e,data); | ||
bool reverted = lastReverted; | ||
assert e.msg.sender != initiator() && e.msg.sender != MORPHO() => reverted; | ||
assert lastReverted; | ||
} |