Skip to content

Commit 5ac0a9a

Browse files
Merge pull request #36 from Certora/certora/fix-import-paths
Ensure that internal function summary gets applied
2 parents c20c990 + 0d2fa19 commit 5ac0a9a

File tree

3 files changed

+65
-14
lines changed

3 files changed

+65
-14
lines changed

certora/confs/Solvency.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"process": "emv",
1111
"prover_args": [
1212
"-cvlFunctionRevert true",
13-
"-depth 0"
13+
"-depth 0",
14+
"-disabledTransformations OPTIMIZE_INFEASIBLE_PATHS",
1415
],
1516
"override_base_config": "certora/confs/BaseConfForInheritance.conf"
1617
}

certora/confs/SolvencyInternal.conf

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,56 @@
99
"-cvlFunctionRevert true",
1010
"-depth 0"
1111
],
12-
"override_base_config": "certora/confs/BaseConfForInheritance.conf"
12+
"optimistic_loop": true,
13+
"global_timeout": "7200",
14+
"parametric_contracts": "EulerEarnHarness",
15+
"rule_sanity": "basic",
16+
"files": [
17+
"certora/harnesses/EulerEarnHarness.sol",
18+
"lib/ethereum-vault-connector/src/EthereumVaultConnector.sol",
19+
"lib/euler-vault-kit/lib/permit2/src/Permit2.sol",
20+
"src/EulerEarnFactory.sol",
21+
"test/mocks/PerspectiveMock.sol",
22+
"certora/mocks/VaultMock0.sol",
23+
"certora/mocks/VaultMock1.sol",
24+
"certora/mocks/Token0.sol",
25+
"certora/harnesses/ERC20Helper.sol"
26+
],
27+
"link": [
28+
"EulerEarnHarness:evc=EthereumVaultConnector",
29+
"EulerEarnHarness:permit2Address=Permit2",
30+
"EulerEarnFactory:permit2Address=Permit2",
31+
"EulerEarnFactory:perspective=PerspectiveMock",
32+
"VaultMock0:_asset=Token0",
33+
"VaultMock1:_asset=Token0",
34+
"EulerEarnHarness:_asset=Token0"
35+
],
36+
"compiler_map": {
37+
"EulerEarnHarness": "solc-0.8.26",
38+
"EthereumVaultConnector": "solc-0.8.26",
39+
"Permit2": "solc-0.8.17",
40+
"EulerEarnFactory": "solc-0.8.26",
41+
"PerspectiveMock": "solc-0.8.26",
42+
"IRMLinearKink": "solc-0.8.26",
43+
"VaultMock0": "solc-0.8.26",
44+
"VaultMock1": "solc-0.8.26",
45+
"Token0": "solc-0.8.26",
46+
"ERC20Helper": "solc-0.8.26"
47+
},
48+
"solc_optimize": "200",
49+
"process": "emv",
50+
"build_cache": true,
51+
"smt_timeout": "6000",
52+
"solc_via_ir_map": {
53+
"ERC20Helper": false,
54+
"EthereumVaultConnector": false,
55+
"EulerEarnFactory": false,
56+
"EulerEarnHarness": false,
57+
"IRMLinearKink": false,
58+
"Permit2": true,
59+
"PerspectiveMock": false,
60+
"Token0": false,
61+
"VaultMock0": false,
62+
"VaultMock1": false
63+
},
1364
}

certora/scripts/EulerEarn.patch

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/src/EulerEarn.sol b/src/EulerEarn.sol
2-
index 4635a89..ae0869b 100644
2+
index 27c1873..1efc278 100644
33
--- a/src/EulerEarn.sol
44
+++ b/src/EulerEarn.sol
5-
@@ -106,6 +106,18 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
5+
@@ -106,6 +106,17 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
66
/// @dev "Overrides" the ERC20's storage variable to be able to modify it.
77
string private _symbol;
88

@@ -14,14 +14,13 @@ index 4635a89..ae0869b 100644
1414
+ // The last index at which a market identifier has been removed from the withdraw queue.
1515
+ mapping(address => uint256) public deletedAt;
1616
+
17-
+ // hooks for cvl assertions
1817
+ function HOOK_after_accrueInterest() internal {}
1918
+ function HOOK_after_withdrawStrategy(uint256) internal {}
2019
+
2120
/* CONSTRUCTOR */
2221

2322
/// @dev Initializes the contract.
24-
@@ -353,6 +365,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
23+
@@ -353,6 +364,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
2524
seen[prevIndex] = true;
2625

2726
newWithdrawQueue[i] = id;
@@ -31,7 +30,7 @@ index 4635a89..ae0869b 100644
3130
}
3231

3332
for (uint256 i; i < currLength; ++i) {
34-
@@ -369,6 +384,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
33+
@@ -369,6 +383,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
3534
revert ErrorsLib.InvalidMarketRemovalTimelockNotElapsed(id);
3635
}
3736
}
@@ -41,39 +40,39 @@ index 4635a89..ae0869b 100644
4140

4241
delete config[id];
4342
}
44-
@@ -559,6 +577,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
43+
@@ -559,6 +576,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
4544
/// @inheritdoc IERC4626
4645
function deposit(uint256 assets, address receiver) public override nonReentrant returns (uint256 shares) {
4746
_accrueInterest();
4847
+ HOOK_after_accrueInterest();
4948

5049
shares = _convertToSharesWithTotals(assets, totalSupply(), lastTotalAssets, Math.Rounding.Floor);
5150

52-
@@ -570,6 +589,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
51+
@@ -570,6 +588,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
5352
/// @inheritdoc IERC4626
5453
function mint(uint256 shares, address receiver) public override nonReentrant returns (uint256 assets) {
5554
_accrueInterest();
5655
+ HOOK_after_accrueInterest();
5756

5857
assets = _convertToAssetsWithTotals(shares, totalSupply(), lastTotalAssets, Math.Rounding.Ceil);
5958

60-
@@ -584,6 +604,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
59+
@@ -584,6 +603,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
6160
returns (uint256 shares)
6261
{
6362
_accrueInterest();
6463
+ HOOK_after_accrueInterest();
6564

6665
// Do not call expensive `maxWithdraw` and optimistically withdraw assets.
6766

68-
@@ -600,6 +621,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
67+
@@ -600,6 +620,7 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
6968
returns (uint256 assets)
7069
{
7170
_accrueInterest();
7271
+ HOOK_after_accrueInterest();
7372

7473
// Do not call expensive `maxRedeem` and optimistically redeem shares.
7574

76-
@@ -729,7 +751,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
75+
@@ -729,7 +750,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
7776
// clamp at 0 so the error raised is the more informative NotEnoughLiquidity.
7877
_updateLastTotalAssets(lastTotalAssets.zeroFloorSub(assets));
7978

@@ -83,7 +82,7 @@ index 4635a89..ae0869b 100644
8382

8483
super._withdraw(caller, receiver, owner, assets, shares);
8584
}
86-
@@ -780,6 +804,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
85+
@@ -780,6 +803,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
8786
IERC20(asset()).forceApproveMaxWithPermit2(address(id), permit2);
8887

8988
if (!marketConfig.enabled) {
@@ -93,7 +92,7 @@ index 4635a89..ae0869b 100644
9392
withdrawQueue.push(id);
9493

9594
if (withdrawQueue.length > ConstantsLib.MAX_QUEUE_LENGTH) revert ErrorsLib.MaxQueueLengthExceeded();
96-
@@ -837,6 +864,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
95+
@@ -837,6 +863,9 @@ contract EulerEarn is ReentrancyGuard, ERC4626, Ownable2Step, EVCUtil, IEulerEar
9796
/// @dev Withdraws `assets` from the strategy vaults.
9897
function _withdrawStrategy(uint256 assets) internal {
9998
for (uint256 i; i < withdrawQueue.length; ++i) {

0 commit comments

Comments
 (0)