+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5ec5169
Merge remote-tracking branch 'origin/main' into certora/update-dev
QGarchery Aug 19, 2023
c9bff6d
feat: add every script to the CI
QGarchery Aug 19, 2023
b5a22c9
Merge remote-tracking branch 'origin/main' into certora/update-dev
QGarchery Aug 19, 2023
b4d7bf8
fix: adapt to renaming and storage refactor
QGarchery Aug 19, 2023
daa6a3b
fix: update in verifyReverts
QGarchery Aug 20, 2023
1332140
fix: reentrancy check
QGarchery Aug 20, 2023
4abca55
chore: remove extSloads for now
QGarchery Aug 23, 2023
b902feb
Merge remote-tracking branch 'origin/main' into certora/update-dev
QGarchery Aug 23, 2023
d425b71
fix: merge fix and remove extSloads
QGarchery Aug 23, 2023
af78edf
chore: certora ci to 0.8.19
QGarchery Aug 23, 2023
bb3f0bc
fix: update reverts specs
QGarchery Aug 23, 2023
fe3bbf9
fix: blue ratio math update
QGarchery Aug 23, 2023
f2ea7d8
refactor: remove allowance of USDC in NoRevert token
QGarchery Aug 23, 2023
ebacb12
feat: adding always collateralized invariant
QGarchery Aug 23, 2023
27bcba4
Merge remote-tracking branch 'origin/main' into certora/update-dev
QGarchery Aug 23, 2023
9281c47
chore: remove extSloads
QGarchery Aug 23, 2023
0e741d5
Merge remote-tracking branch 'origin/main' into certora/update-dev
QGarchery Aug 24, 2023
1de8b40
Merge remote-tracking branch 'origin/fix/compilation-liquidate' into …
QGarchery Aug 24, 2023
2059555
fix: update to new liquidate signature
QGarchery Aug 24, 2023
e742a36
fix: remove via IR compilation for now
QGarchery Aug 24, 2023
e52ecdd
fix: require denominator 0
QGarchery Aug 24, 2023
90392ed
fix: seized renaming
QGarchery Aug 24, 2023
8aebfd4
fix: liquidate input validation
QGarchery Aug 24, 2023
2733de7
fix: adapt borrowRate signature
QGarchery Aug 24, 2023
755b012
Added option plaininjectivity
jhoenicke Aug 24, 2023
e4a8ad3
Merge pull request #442 from morpho-labs/certora/plaininjectivity
QGarchery Aug 24, 2023
21f5cc8
Merge remote-tracking branch 'origin/certora/dev' into certora/update…
QGarchery Aug 24, 2023
ecf5226
fix: rename user to position
QGarchery Aug 24, 2023
8fb896b
fix: marketParams renaming for accrue interest
QGarchery Aug 24, 2023
00e2415
fix: rename accrueInterest
QGarchery Aug 24, 2023
b33db92
chore: munging of market params lib
QGarchery Aug 25, 2023
a49d137
fix: spelling marketParams
QGarchery Aug 25, 2023
7e83331
fix: borrow rate parameters
QGarchery Aug 25, 2023
b8538fe
fix: timestamp overflow
QGarchery Aug 25, 2023
e04c732
Merge remote-tracking branch 'origin/fix/underflow' into certora/upda…
QGarchery Aug 28, 2023
4fe8cce
fix: adapt borrow ratio spec to the underflow change
QGarchery Aug 28, 2023
ca63f5d
fix: repay stay healthy (times out)
QGarchery Aug 28, 2023
6b20024
fix: remove time-outs
QGarchery Aug 29, 2023
735ee4f
Merge remote-tracking branch 'origin/main' into certora/update-dev
QGarchery Aug 29, 2023
4197eed
Merge remote-tracking branch 'origin/main' into certora/check-underflow
QGarchery Aug 29, 2023
8afbc96
Merge branch 'certora/update-dev' into certora/check-underflow
QGarchery Aug 29, 2023
d9bab7f
Merge pull request #447 from morpho-labs/certora/check-underflow
QGarchery Aug 29, 2023
f3aa509
Merge remote-tracking branch 'origin/certora/dev' into certora/update…
QGarchery Aug 29, 2023
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
13 changes: 8 additions & 5 deletions .github/workflows/certora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ jobs:

- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux
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/solc8.21
sudo mv solc-static-linux /usr/local/bin/solc8.19

- name: Verify rule ${{ matrix.script }}
run: |
echo "key length" ${#CERTORAKEY}
bash certora/scripts/${{ matrix.script }} --solc solc8.21
bash certora/scripts/${{ matrix.script }} --solc solc8.19
env:
CERTORAKEY: ${{ secrets.CERTORAKEY }}

Expand All @@ -45,8 +45,11 @@ jobs:
script:
- verifyBlue.sh
- verifyBlueAccrueInterests.sh
- verifyBlueRatioMathSummary.sh
- verifyBlueExitLiquidity.sh
- verifyBlueLibSummary.sh
- verifyBlueRatioMath.sh
- verifyBlueReverts.sh
- verifyBlueTransfer.sh
- verifyReentrancy.sh
- verifyDifficultMath.sh
- verifyHealth.sh
- verifyReentrancy.sh
2 changes: 0 additions & 2 deletions certora/dispatch/ERC20NoRevert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ contract ERC20NoRevert {
}

function approve(address _spender, uint256 _amount) public {
require(!((_amount != 0) && (allowed[msg.sender][_spender] != 0)));

allowed[msg.sender][_spender] = _amount;
}

Expand Down
75 changes: 62 additions & 13 deletions certora/harness/MorphoHarness.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pragma solidity 0.8.21;
pragma solidity 0.8.19;

import "../../src/Morpho.sol";
import "../../src/libraries/SharesMathLib.sol";
import "../../src/libraries/MarketLib.sol";
import "../../src/libraries/MarketParamsLib.sol";

contract MorphoHarness is Morpho {
using MarketLib for Market;
using MarketParamsLib for MarketParams;

constructor(address newOwner) Morpho(newOwner) {}

Expand All @@ -25,24 +25,66 @@ contract MorphoHarness is Morpho {
return MAX_FEE;
}

function getVirtualTotalSupply(Id id) external view returns (uint256) {
return totalSupply[id] + SharesMathLib.VIRTUAL_ASSETS;
function getTotalSupplyAssets(Id id) external view returns (uint256) {
return market[id].totalSupplyAssets;
}

function getTotalSupplyShares(Id id) external view returns (uint256) {
return market[id].totalSupplyShares;
}

function getTotalBorrowAssets(Id id) external view returns (uint256) {
return market[id].totalBorrowAssets;
}

function getTotalBorrowShares(Id id) external view returns (uint256) {
return market[id].totalBorrowShares;
}

function getSupplyShares(Id id, address account) external view returns (uint256) {
return position[id][account].supplyShares;
}

function getBorrowShares(Id id, address account) external view returns (uint256) {
return position[id][account].borrowShares;
}

function getCollateral(Id id, address account) external view returns (uint256) {
return position[id][account].collateral;
}

function getLastUpdate(Id id) external view returns (uint256) {
return market[id].lastUpdate;
}

function getFee(Id id) external view returns (uint256) {
return market[id].fee;
}

function getVirtualTotalSupplyAssets(Id id) external view returns (uint256) {
return market[id].totalSupplyAssets + SharesMathLib.VIRTUAL_ASSETS;
}

function getVirtualTotalSupplyShares(Id id) external view returns (uint256) {
return totalSupplyShares[id] + SharesMathLib.VIRTUAL_SHARES;
return market[id].totalSupplyShares + SharesMathLib.VIRTUAL_SHARES;
}

function getVirtualTotalBorrow(Id id) external view returns (uint256) {
return totalBorrow[id] + SharesMathLib.VIRTUAL_ASSETS;
function getVirtualTotalBorrowAssets(Id id) external view returns (uint256) {
return market[id].totalBorrowAssets + SharesMathLib.VIRTUAL_ASSETS;
}

function getVirtualTotalBorrowShares(Id id) external view returns (uint256) {
return totalBorrowShares[id] + SharesMathLib.VIRTUAL_SHARES;
return market[id].totalBorrowShares + SharesMathLib.VIRTUAL_SHARES;
}

function getMarketId(Market memory market) external pure returns (Id) {
return market.id();
function getMarketId(MarketParams memory marketParams) external pure returns (Id) {
return marketParams.id();
}

function marketLibId(MarketParams memory marketParams) external pure returns (Id marketParamsId) {
assembly ("memory-safe") {
marketParamsId := keccak256(marketParams, mul(5, 32))
}
}

function mathLibMulDivUp(uint256 x, uint256 y, uint256 d) public pure returns (uint256) {
Expand All @@ -53,7 +95,14 @@ contract MorphoHarness is Morpho {
return MathLib.mulDivDown(x, y, d);
}

function isHealthy(Market memory market, address user) external view returns (bool) {
return _isHealthy(market, market.id(), user);
function accrueInterest(MarketParams memory marketParams) external {
Id id = marketParams.id();
require(market[id].lastUpdate != 0, ErrorsLib.MARKET_NOT_CREATED);

_accrueInterest(marketParams, id);
}

function isHealthy(MarketParams memory marketParams, address user) external view returns (bool) {
return _isHealthy(marketParams, marketParams.id(), user);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

certoraRun \
certora/harness/MorphoHarness.sol \
--verify MorphoHarness:certora/specs/BlueRatioMathSummary.spec \
--verify MorphoHarness:certora/specs/BlueLibSummary.spec \
--msg "Morpho Ratio Math Summary" \
"$@"
1 change: 1 addition & 0 deletions certora/scripts/verifyDifficultMath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ certoraRun \
--verify MorphoHarness:certora/specs/DifficultMath.spec \
--loop_iter 3 \
--optimistic_loop \
--prover_args '-smt_hashingScheme plaininjectivity' \
--msg "Morpho Difficult Math" \
"$@"
1 change: 1 addition & 0 deletions certora/scripts/verifyHealth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ certoraRun \
--verify MorphoHarness:certora/specs/Health.spec \
--loop_iter 3 \
--optimistic_loop \
--prover_args '-smt_hashingScheme plaininjectivity' \
--msg "Morpho Health Check" \
"$@"
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载