Skip to content

Commit a0dca17

Browse files
authored
fix: Removes max variable borrow rate check in GhoAaveSteward for rates updates (#436)
* feat(aave steward): rm max variable borrow rate check * upd: sync change with certora * doc: fix natspec of `updateGhoBorrowRate`
1 parent 0a6fbd4 commit a0dca17

File tree

5 files changed

+22
-56
lines changed

5 files changed

+22
-56
lines changed

certora/steward/specs/GhoAaveSteward.spec

-18
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ methods {
3232

3333

3434
function getGhoTimelocks() external returns (IGhoAaveSteward.GhoDebounce) envfree;
35-
function GHO_BORROW_RATE_MAX() external returns uint32 envfree;
3635
function MINIMUM_DELAY() external returns uint256 envfree;
3736
function RISK_COUNCIL() external returns address envfree;
3837

@@ -225,23 +224,6 @@ rule updateGhoSupplyCap__correctness() {
225224
}
226225

227226

228-
rule updateGhoBorrowRate__correctness() {
229-
env e; uint16 optimalUsageRatio; uint32 baseVariableBorrowRate;
230-
uint32 variableRateSlope1; uint32 variableRateSlope2;
231-
232-
uint16 optimalUsageRatio_before = OPTIMAL_USAGE_RATIO;
233-
uint32 baseVariableBorrowRate_before = BASE_VARIABLE_BORROW_RATE;
234-
uint32 variableRateSlope1_before = VARIABLE_RATE_SLOPE1;
235-
uint32 variableRateSlope2_before = VARIABLE_RATE_SLOPE2;
236-
237-
updateGhoBorrowRate(e,optimalUsageRatio, baseVariableBorrowRate, variableRateSlope1, variableRateSlope2);
238-
239-
240-
assert baseVariableBorrowRate + variableRateSlope1 + variableRateSlope2 <= to_mathint(GHO_BORROW_RATE_MAX());
241-
}
242-
243-
244-
245227

246228

247229

src/contracts/misc/GhoAaveSteward.sol

-11
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ import {RiskCouncilControlled} from './RiskCouncilControlled.sol';
2121
contract GhoAaveSteward is Ownable, RiskCouncilControlled, IGhoAaveSteward {
2222
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
2323

24-
/// @inheritdoc IGhoAaveSteward
25-
uint32 public constant GHO_BORROW_RATE_MAX = 0.25e4; // 25.00%
26-
2724
uint256 internal constant BPS_MAX = 100_00;
2825

2926
/// @inheritdoc IGhoAaveSteward
@@ -227,14 +224,6 @@ contract GhoAaveSteward is Ownable, RiskCouncilControlled, IGhoAaveSteward {
227224
),
228225
'INVALID_VARIABLE_RATE_SLOPE2'
229226
);
230-
231-
require(
232-
uint256(newRates.baseVariableBorrowRate) +
233-
uint256(newRates.variableRateSlope1) +
234-
uint256(newRates.variableRateSlope2) <=
235-
GHO_BORROW_RATE_MAX,
236-
'BORROW_RATE_HIGHER_THAN_MAX'
237-
);
238227
}
239228

240229
/**

src/contracts/misc/interfaces/IGhoAaveSteward.sol

-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ interface IGhoAaveSteward {
3030
* @notice Updates the borrow rate of GHO, only if:
3131
* - respects `MINIMUM_DELAY`, the minimum time delay between updates
3232
* - the update changes parameters up to the maximum allowed change according to risk config
33-
* - the update is lower than `GHO_BORROW_RATE_MAX`
3433
* @dev Only callable by Risk Council
3534
* @dev Values are all expressed in BPS
3635
* @param optimalUsageRatio The new optimal usage ratio
@@ -90,12 +89,6 @@ interface IGhoAaveSteward {
9089
*/
9190
function getGhoTimelocks() external view returns (GhoDebounce memory);
9291

93-
/**
94-
* @notice Returns maximum value that can be assigned to GHO borrow rate.
95-
* @return The maximum value that can be assigned to GHO borrow rate in ray (e.g. 0.01e27 results in 1.0%)
96-
*/
97-
function GHO_BORROW_RATE_MAX() external view returns (uint32);
98-
9992
/**
10093
* @notice The address of pool data provider of the POOL the steward controls
10194
*/

src/test/TestGhoAaveSteward.t.sol

+22-19
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,21 @@ contract TestGhoAaveSteward is TestGhoBase {
327327
assertEq(currentBorrowRate, newBorrowRate);
328328
}
329329

330+
function testUpdateGhoBorrowRateUpwardsFromHigh() public {
331+
// set a very high borrow rate of 80%
332+
uint32 highBaseBorrowRate = 0.80e4;
333+
_setGhoBorrowRateViaConfigurator(highBaseBorrowRate);
334+
highBaseBorrowRate += 0.04e4;
335+
vm.prank(RISK_COUNCIL);
336+
GHO_AAVE_STEWARD.updateGhoBorrowRate(
337+
defaultRateParams.optimalUsageRatio,
338+
highBaseBorrowRate,
339+
defaultRateParams.variableRateSlope1,
340+
defaultRateParams.variableRateSlope2
341+
);
342+
assertEq(highBaseBorrowRate, _getGhoBorrowRate());
343+
}
344+
330345
function testUpdateGhoBorrowRateDownwards() public {
331346
uint32 oldBorrowRate = _getGhoBorrowRate();
332347
uint32 newBorrowRate = oldBorrowRate - 1;
@@ -341,18 +356,19 @@ contract TestGhoAaveSteward is TestGhoBase {
341356
assertEq(currentBorrowRate, newBorrowRate);
342357
}
343358

344-
function testUpdateGhoBorrowRateMaxValue() public {
345-
uint32 ghoBorrowRateMax = GHO_AAVE_STEWARD.GHO_BORROW_RATE_MAX();
346-
_setGhoBorrowRateViaConfigurator(ghoBorrowRateMax - 1);
359+
function testUpdateGhoBorrowRateDownwardsFromHigh() public {
360+
// set a very high borrow rate of 80%
361+
uint32 highBaseBorrowRate = 0.80e4;
362+
_setGhoBorrowRateViaConfigurator(highBaseBorrowRate);
363+
highBaseBorrowRate -= 0.04e4;
347364
vm.prank(RISK_COUNCIL);
348365
GHO_AAVE_STEWARD.updateGhoBorrowRate(
349366
defaultRateParams.optimalUsageRatio,
350-
ghoBorrowRateMax,
367+
highBaseBorrowRate,
351368
defaultRateParams.variableRateSlope1,
352369
defaultRateParams.variableRateSlope2
353370
);
354-
uint32 currentBorrowRate = _getGhoBorrowRate();
355-
assertEq(currentBorrowRate, ghoBorrowRateMax);
371+
assertEq(highBaseBorrowRate, _getGhoBorrowRate());
356372
}
357373

358374
function testUpdateGhoBorrowRateMaxIncrement() public {
@@ -660,19 +676,6 @@ contract TestGhoAaveSteward is TestGhoBase {
660676
);
661677
}
662678

663-
function testRevertUpdateGhoBorrowRateIfValueMoreThanMax() public {
664-
uint32 maxGhoBorrowRate = GHO_BORROW_RATE_MAX;
665-
_setGhoBorrowRateViaConfigurator(maxGhoBorrowRate);
666-
vm.prank(RISK_COUNCIL);
667-
vm.expectRevert('BORROW_RATE_HIGHER_THAN_MAX');
668-
GHO_AAVE_STEWARD.updateGhoBorrowRate(
669-
defaultRateParams.optimalUsageRatio,
670-
maxGhoBorrowRate + 1,
671-
defaultRateParams.variableRateSlope1,
672-
defaultRateParams.variableRateSlope2
673-
);
674-
}
675-
676679
function testRevertUpdateGhoBorrowRateIfMaxExceededUpwards() public {
677680
uint32 oldBorrowRate = _getGhoBorrowRate();
678681
uint32 newBorrowRate = oldBorrowRate + GHO_BORROW_RATE_CHANGE_MAX + 1;

src/test/helpers/Constants.sol

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ contract Constants {
5252
// Gho Stewards
5353
uint32 constant GHO_BORROW_RATE_CHANGE_MAX = 0.05e4;
5454
uint256 constant GSM_FEE_RATE_CHANGE_MAX = 0.0050e4;
55-
uint32 constant GHO_BORROW_RATE_MAX = 0.25e4;
5655
uint256 constant MINIMUM_DELAY_V2 = 1 days;
5756
uint256 constant FIXED_RATE_STRATEGY_FACTORY_REVISION = 1;
5857

0 commit comments

Comments
 (0)