-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from morpho-org/certora/dev
[Certora] Dev
- Loading branch information
Showing
34 changed files
with
2,752 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Certora | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
conf: | ||
- AccrueInterest | ||
- ConsistentState | ||
- ExactMath | ||
- ExitLiquidity | ||
- Health | ||
- LibSummary | ||
- Liveness | ||
- RatioMath | ||
- Reentrancy | ||
- Reverts | ||
- Transfer | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install python | ||
uses: actions/setup-python@v4 | ||
|
||
- name: Install certora | ||
run: pip install certora-cli | ||
|
||
- name: Install solc | ||
run: | | ||
wget https://github.com/ethereum/solidity/releases/download/v0.8.19/solc-static-linux | ||
chmod +x solc-static-linux | ||
sudo mv solc-static-linux /usr/local/bin/solc | ||
- name: Verify ${{ matrix.conf }} | ||
run: certoraRun certora/confs/${{ matrix.conf }}.conf | ||
env: | ||
CERTORAKEY: ${{ secrets.CERTORAKEY }} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/AccrueInterest.spec", | ||
"prover_args": [ | ||
"-smt_hashingScheme plaininjectivity", | ||
"-mediumTimeout 30" | ||
], | ||
"rule_sanity": "basic", | ||
"msg": "Morpho Blue Accrue Interest" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/ConsistentState.spec", | ||
"rule_sanity": "basic", | ||
"msg": "Morpho Blue Consistent State" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/ExactMath.spec", | ||
"rule_sanity": "basic", | ||
"prover_args": [ | ||
"-smt_hashingScheme plaininjectivity", | ||
"-mediumTimeout 30" | ||
], | ||
"msg": "Morpho Blue Exact Math" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/ExitLiquidity.spec", | ||
"rule_sanity": "basic", | ||
"msg": "Morpho Blue Exit Liquidity" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol", | ||
"src/mocks/OracleMock.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/Health.spec", | ||
"rule_sanity": "basic", | ||
"prover_args": [ | ||
"-smt_hashingScheme plaininjectivity" | ||
], | ||
"msg": "Morpho Blue Health" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/LibSummary.spec", | ||
"rule_sanity": "basic", | ||
"msg": "Morpho Blue Lib Summary" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoInternalAccess.sol" | ||
], | ||
"verify": "MorphoInternalAccess:certora/specs/Liveness.spec", | ||
"rule_sanity": "basic", | ||
"msg": "Morpho Blue Liveness" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/RatioMath.spec", | ||
"rule_sanity": "basic", | ||
"prover_args": [ | ||
"-smt_hashingScheme plaininjectivity", | ||
"-mediumTimeout 30", | ||
"-timeout 3600" | ||
], | ||
"msg": "Morpho Blue Ratio Math" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/Reentrancy.spec", | ||
"rule_sanity": "basic", | ||
"prover_args": [ | ||
"-enableStorageSplitting false" | ||
], | ||
"msg": "Morpho Blue Reentrancy" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/MorphoHarness.sol" | ||
], | ||
"verify": "MorphoHarness:certora/specs/Reverts.spec", | ||
"rule_sanity": "basic", | ||
"msg": "Morpho Blue Reverts" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/TransferHarness.sol", | ||
"certora/dispatch/ERC20Standard.sol", | ||
"certora/dispatch/ERC20USDT.sol", | ||
"certora/dispatch/ERC20NoRevert.sol" | ||
], | ||
"verify": "TransferHarness:certora/specs/Transfer.spec", | ||
"rule_sanity": "basic", | ||
"msg": "Morpho Blue Transfer" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
contract ERC20NoRevert { | ||
address public owner; | ||
uint256 public totalSupply; | ||
mapping(address => uint256) public balanceOf; | ||
mapping(address => mapping(address => uint256)) public allowance; | ||
|
||
constructor() { | ||
owner = msg.sender; | ||
} | ||
|
||
modifier onlyOwner() { | ||
require(msg.sender == owner); | ||
_; | ||
} | ||
|
||
function _transfer(address _from, address _to, uint256 _amount) internal returns (bool) { | ||
if (balanceOf[_from] < _amount) { | ||
return false; | ||
} | ||
balanceOf[_from] -= _amount; | ||
balanceOf[_to] += _amount; | ||
return true; | ||
} | ||
|
||
function transfer(address _to, uint256 _amount) public returns (bool) { | ||
return _transfer(msg.sender, _to, _amount); | ||
} | ||
|
||
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool) { | ||
if (allowance[_from][msg.sender] < _amount) { | ||
return false; | ||
} | ||
allowance[_from][msg.sender] -= _amount; | ||
return _transfer(_from, _to, _amount); | ||
} | ||
|
||
function approve(address _spender, uint256 _amount) public { | ||
allowance[msg.sender][_spender] = _amount; | ||
} | ||
|
||
function mint(address _receiver, uint256 _amount) public onlyOwner { | ||
balanceOf[_receiver] += _amount; | ||
totalSupply += _amount; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
contract ERC20Standard { | ||
address public owner; | ||
uint256 public totalSupply; | ||
mapping(address => uint256) public balanceOf; | ||
mapping(address => mapping(address => uint256)) public allowance; | ||
|
||
constructor() { | ||
owner = msg.sender; | ||
} | ||
|
||
modifier onlyOwner() { | ||
require(msg.sender == owner); | ||
_; | ||
} | ||
|
||
function _transfer(address _from, address _to, uint256 _amount) internal returns (bool) { | ||
balanceOf[_from] -= _amount; | ||
balanceOf[_to] += _amount; | ||
return true; | ||
} | ||
|
||
function transfer(address _to, uint256 _amount) public returns (bool) { | ||
return _transfer(msg.sender, _to, _amount); | ||
} | ||
|
||
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool) { | ||
allowance[_from][msg.sender] -= _amount; | ||
return _transfer(_from, _to, _amount); | ||
} | ||
|
||
function approve(address _spender, uint256 _amount) public { | ||
allowance[msg.sender][_spender] = _amount; | ||
} | ||
|
||
function mint(address _receiver, uint256 _amount) public onlyOwner { | ||
balanceOf[_receiver] += _amount; | ||
totalSupply += _amount; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
contract ERC20USDT { | ||
address public owner; | ||
uint256 public totalSupply; | ||
mapping(address => uint256) public balanceOf; | ||
mapping(address => mapping(address => uint256)) public allowance; | ||
|
||
constructor() { | ||
owner = msg.sender; | ||
} | ||
|
||
modifier onlyOwner() { | ||
require(msg.sender == owner); | ||
_; | ||
} | ||
|
||
function _transfer(address _from, address _to, uint256 _amount) internal { | ||
balanceOf[_from] -= _amount; | ||
balanceOf[_to] += _amount; | ||
} | ||
|
||
function transfer(address _to, uint256 _amount) public { | ||
_transfer(msg.sender, _to, _amount); | ||
} | ||
|
||
function transferFrom(address _from, address _to, uint256 _amount) public { | ||
if (allowance[_from][msg.sender] < type(uint256).max) { | ||
allowance[_from][msg.sender] -= _amount; | ||
} | ||
_transfer(_from, _to, _amount); | ||
} | ||
|
||
function approve(address _spender, uint256 _amount) public { | ||
require(!((_amount != 0) && (allowance[msg.sender][_spender] != 0))); | ||
|
||
allowance[msg.sender][_spender] = _amount; | ||
} | ||
|
||
function mint(address _receiver, uint256 _amount) public onlyOwner { | ||
balanceOf[_receiver] += _amount; | ||
totalSupply += _amount; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"filename" : "../src/Morpho.sol", | ||
"sourceroot": "..", | ||
"num_mutants": 15, | ||
"solc_remappings": [] | ||
} |
Oops, something went wrong.