Skip to content

Commit

Permalink
Merge pull request #137 from euler-xyz/Certora_CI_fix_8Apr
Browse files Browse the repository at this point in the history
Certora ci fix 8 apr
  • Loading branch information
Tvenus authored and RedLikeRosesss committed May 20, 2024
2 parents 38fb9aa + 3f9bf86 commit 72754d6
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/checkrules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: setup cvt
run: |
pip install certora-cli==7.0.7
pip install certora-cli==7.6.3
echo "`pwd`/.github/executables" >> $GITHUB_PATH
- name: run certora prover on conf files
Expand Down
3 changes: 2 additions & 1 deletion certora/conf/CER-1-Owner/CER-59-Owner-override.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"solc_optimize" : "10000",
"msg": "CER-1-Owner/CER-59-Owner-addressPrefix",
"solc": "solc8.20",
"rule_sanity": "basic"
"rule_sanity": "basic",
"hashing_length_bound": "256"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"msg": "CER-11-Controllers/CER-12-Controllers-number",
"optimistic_loop": true,
"optimistic_hashing": true,
"rule_sanity": "basic"
"rule_sanity": "basic",
"hashing_length_bound": "256"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"optimistic_hashing": true,
"solc_optimize" : "10000",
"msg": "CER-15-Permit/CER-65-Permit-onBehalfOfAccount",
"solc": "solc8.20"
"solc": "solc8.20",
"hashing_length_bound": "256"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"msg": "CER-2-Operator/CER-52-Operator-deauthorization",
"optimistic_loop": true,
"optimistic_hashing": true,
"prover_args": ["-smt_bitVectorTheory", "true"]
"prover_args": ["-smt_bitVectorTheory", "true"],
"hashing_length_bound": "256"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"msg": "CER-2-Operator/CER-68-Operator-authorization",
"optimistic_loop": true,
"optimistic_hashing": true,
"prover_args": ["-smt_bitVectorTheory", "true"]
"prover_args": ["-smt_bitVectorTheory", "true"],
"hashing_length_bound": "256"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"optimistic_hashing": true,
"solc_optimize" : "10000",
"msg": "CER-27-ExecutionContext/CER-38-ExecutionContext-restored",
"solc": "solc8.20"
"solc": "solc8.20",
"hashing_length_bound": "256"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"optimistic_hashing": true,
"solc_optimize" : "10000",
"msg" : "CER-44-VaultStatusCheck/CER-78-VaultStatusCheck-scheduling",
"solc": "solc8.20"
"solc": "solc8.20",
"hashing_length_bound": "256"
}
3 changes: 2 additions & 1 deletion certora/conf/misc/MustRevertFunctions.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"optimistic_hashing": true,
"solc_optimize" : "10000",
"msg": "misc/MustRevertFunctions",
"solc": "solc8.20"
"solc": "solc8.20",
"hashing_length_bound": "256"
}
2 changes: 1 addition & 1 deletion certora/harness/EthereumVaultConnectorHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contract EthereumVaultConnectorHarness is EthereumVaultConnector {
using Set for SetStorage;

function getExecutionContextDefault() external view returns (uint256) {
return ExecutionContext.STAMP_DUMMY_VALUE << ExecutionContext.STAMP_OFFSET;
return 1 << ExecutionContext.STAMP_OFFSET;
}

function getExecutionContextAreChecksDeferred() external view returns (bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ rule enableControllerEnequeusStatusCheckWhenDeferred {
rule checkAccountStatusForcesNumControllersLEOne {
env e;
address account;
checkAccountStatus(e, account);
assert numOfController(account) <= 1;
bool status = checkAccountStatus(e, account);
assert numOfController(account) > 1 => !status;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ invariant topLevelFunctionDontChangeTransientStorage()
getRawExecutionContext() == getExecutionContextDefault()
filtered { f ->
!isMustRevertFunction(f) &&
!f.isFallback && // certora plans to deprecate certora tool-generated function from sanity checks
f.selector != sig:getCurrentOnBehalfOfAccount(address).selector
}

Expand All @@ -55,4 +56,4 @@ rule getCurrentOnBehalfOfAccountAlwaysReverts() {
address controllerToCheck;
getCurrentOnBehalfOfAccount@withrevert(controllerToCheck);
assert(lastReverted);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
methods {
function numOfController(address account) external returns (uint8) envfree;
function checkAccountStatus(address account) external returns (bool) envfree;
}

// CER-41: Account Status Check more than one controller.
Expand All @@ -10,8 +9,6 @@ rule account_status_only_one_controller {
env e;
address account;
require numOfController(account) > 1;
bool isValid = checkAccountStatus@withrevert(account);
// Note: writing the rule as follows is actually a counterexample. checkAccountStatus reverts rather than returning false in this case.
// assert !isValid;
assert lastReverted;
bool isValid = checkAccountStatus(e, account);
assert !isValid;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
methods {
function numOfController(address account) external returns (uint8) envfree;
function checkAccountStatus(address account) external returns (bool) envfree;
}

// CER-42: Account Status Check no controller
Expand All @@ -11,6 +10,6 @@ rule account_status_no_controller {
env e;
address account;
require numOfController(account) == 0;
bool isValid = checkAccountStatus(account);
bool isValid = checkAccountStatus(e, account);
assert isValid;
}
4 changes: 2 additions & 2 deletions certora/specs/utils/IsLowLevelCallFunction.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* that do not always revert (e.g. batchRevert is omitted)
*/
definition isLowLevelCallFunction(method f) returns bool =
f.selector == sig:EthereumVaultConnectorHarness.permit(address,
uint256, uint256, uint256, uint256, bytes, bytes).selector ||
f.selector == sig:EthereumVaultConnectorHarness.permit(
address,address,uint256,uint256,uint256,uint256,bytes,bytes).selector ||
f.selector == sig:EthereumVaultConnectorHarness.call(
address,address,uint256,bytes).selector ||
f.selector == sig:EthereumVaultConnectorHarness.batch(
Expand Down
1 change: 0 additions & 1 deletion certora/specs/utils/IsMustRevertFunction.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
* generic rules or invariants if automatic sanity checks are enabled.
*/
definition isMustRevertFunction(method f) returns bool =
f.selector == sig:EthereumVaultConnectorHarness.batchSimulation(IEVC.BatchItem[]).selector ||
f.selector == sig:EthereumVaultConnectorHarness.batchRevert(IEVC.BatchItem[]).selector;

0 comments on commit 72754d6

Please sign in to comment.