forked from aave/gho-core
-
Notifications
You must be signed in to change notification settings - Fork 0
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
6 changed files
with
191 additions
and
14 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
37 changes: 37 additions & 0 deletions
37
certora/scripts/verifyGhoVariableDebtToken_specialBranch.sh
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,37 @@ | ||
#!/bin/sh | ||
|
||
if (($# > 0)) | ||
then | ||
certoraRun certora/harness/ghoVariableDebtTokenHarness.sol:GhoVariableDebtTokenHarness \ | ||
certora/harness/DummyPool.sol \ | ||
certora/harness/DummyERC20WithTimedBalanceOf.sol \ | ||
certora/munged/contracts/facilitators/aave/interestStrategy/GhoDiscountRateStrategy.sol \ | ||
certora/harness/DummyERC20A.sol certora/harness/DummyERC20B.sol \ | ||
--verify GhoVariableDebtTokenHarness:certora/specs/ghoVariableDebtToken.spec \ | ||
--link GhoVariableDebtTokenHarness:_discountRateStrategy=GhoDiscountRateStrategy \ | ||
--link GhoVariableDebtTokenHarness:_discountToken=DummyERC20WithTimedBalanceOf \ | ||
--link GhoVariableDebtTokenHarness:POOL=DummyPool \ | ||
--loop_iter 2 \ | ||
--solc solc8.10 \ | ||
--optimistic_loop \ | ||
--rule "${@}" \ | ||
--prover_args '-depth 0 -adaptiveSolverConfig false -smt_nonLinearArithmetic true' --server staging --prover_version shelly/z3-4-12-3-build \ | ||
--msg "GhoVariableDebtToken" | ||
|
||
else | ||
certoraRun certora/harness/ghoVariableDebtTokenHarness.sol:GhoVariableDebtTokenHarness \ | ||
certora/harness/DummyPool.sol \ | ||
certora/harness/DummyERC20WithTimedBalanceOf.sol \ | ||
certora/munged/contracts/facilitators/aave/interestStrategy/GhoDiscountRateStrategy.sol \ | ||
certora/harness/DummyERC20A.sol certora/harness/DummyERC20B.sol \ | ||
--verify GhoVariableDebtTokenHarness:certora/specs/ghoVariableDebtToken.spec \ | ||
--link GhoVariableDebtTokenHarness:_discountRateStrategy=GhoDiscountRateStrategy \ | ||
--link GhoVariableDebtTokenHarness:_discountToken=DummyERC20WithTimedBalanceOf \ | ||
--link GhoVariableDebtTokenHarness:POOL=DummyPool \ | ||
--loop_iter 2 \ | ||
--solc solc8.10 \ | ||
--optimistic_loop \ | ||
--prover_args '-depth 0 -adaptiveSolverConfig false -smt_nonLinearArithmetic true' --server staging --prover_version shelly/z3-4-12-3-build \ | ||
--msg "GhoVariableDebtToken" | ||
|
||
fi |
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,37 @@ | ||
#!/bin/sh | ||
|
||
if (($# > 0)) | ||
then | ||
certoraRun certora/harness/ghoVariableDebtTokenHarness.sol:GhoVariableDebtTokenHarness \ | ||
certora/harness/DummyPool.sol \ | ||
certora/harness/DummyERC20WithTimedBalanceOf.sol \ | ||
certora/munged/contracts/facilitators/aave/interestStrategy/GhoDiscountRateStrategy.sol \ | ||
certora/harness/DummyERC20A.sol certora/harness/DummyERC20B.sol \ | ||
--verify GhoVariableDebtTokenHarness:certora/specs/ghoVariableDebtToken_summarized.spec \ | ||
--link GhoVariableDebtTokenHarness:_discountRateStrategy=GhoDiscountRateStrategy \ | ||
--link GhoVariableDebtTokenHarness:_discountToken=DummyERC20WithTimedBalanceOf \ | ||
--link GhoVariableDebtTokenHarness:POOL=DummyPool \ | ||
--loop_iter 2 \ | ||
--solc solc8.10 \ | ||
--optimistic_loop \ | ||
--rule "${@}" \ | ||
--msg "GhoVariableDebtToken" | ||
|
||
else | ||
certoraRun certora/harness/ghoVariableDebtTokenHarness.sol:GhoVariableDebtTokenHarness \ | ||
certora/harness/DummyPool.sol \ | ||
certora/harness/DummyERC20WithTimedBalanceOf.sol \ | ||
certora/munged/contracts/facilitators/aave/interestStrategy/GhoDiscountRateStrategy.sol \ | ||
certora/harness/DummyERC20A.sol certora/harness/DummyERC20B.sol \ | ||
--verify GhoVariableDebtTokenHarness:certora/specs/ghoVariableDebtToken_summarized.spec \ | ||
--link GhoVariableDebtTokenHarness:_discountRateStrategy=GhoDiscountRateStrategy \ | ||
--link GhoVariableDebtTokenHarness:_discountToken=DummyERC20WithTimedBalanceOf \ | ||
--link GhoVariableDebtTokenHarness:POOL=DummyPool \ | ||
--loop_iter 2 \ | ||
--solc solc8.10 \ | ||
--optimistic_loop \ | ||
--smt_timeout 900 \ | ||
--prover_args "-mediumTimeout 30 -depth 15" \ | ||
--msg "GhoVariableDebtToken" | ||
|
||
fi |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import "ghoVariableDebtToken.spec"; | ||
|
||
methods{ | ||
function GhoVariableDebtToken._accrueDebtOnAction(address user, uint256, uint256, uint256) internal returns (uint256, uint256) => flipAccrueCalled(user); | ||
function GhoVariableDebtToken._refreshDiscountPercent(address user, uint256, uint256, uint256) internal => flipRefreshCalled(user); | ||
} | ||
|
||
ghost mapping(address => mathint) accrue_called_counter; | ||
ghost mapping(address => mathint) refresh_called_counter; | ||
|
||
function flipAccrueCalled(address user) returns (uint256, uint256) { | ||
accrue_called_counter[user] = accrue_called_counter[user] + 1; | ||
return (0, 0); | ||
} | ||
|
||
function flipRefreshCalled(address user) { | ||
refresh_called_counter[user] = refresh_called_counter[user] + 1; | ||
} | ||
|
||
// accrue is always called before refresh | ||
rule accrueAlwaysCaleldBeforeRefresh(env e, method f) { | ||
address user1; | ||
require accrue_called_counter[user1] == refresh_called_counter[user1]; | ||
|
||
calldataarg args; | ||
f(e, args); | ||
|
||
assert refresh_called_counter[user1] == accrue_called_counter[user1], "Remember, with great power comes great responsibility."; | ||
} | ||
|
||
// accrue is always called before refresh example | ||
// should pass only on updateDiscountDistribution | ||
rule accrueAlwaysCaleldBeforeRefresh_witness(env e, method f) { | ||
address user1; | ||
mathint counter = accrue_called_counter[user1]; | ||
require accrue_called_counter[user1] == refresh_called_counter[user1]; | ||
|
||
calldataarg args; | ||
f(e, args); | ||
|
||
satisfy(refresh_called_counter[user1] == counter + 2); | ||
} |