Skip to content

Commit d27558e

Browse files
committed
fix: pr comments
1 parent cb3689f commit d27558e

File tree

2 files changed

+34
-71
lines changed

2 files changed

+34
-71
lines changed

scripts/deploy/DeployHorizonStewards.s.sol

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ library DeployHorizonRiskStewards {
3838
})
3939
}),
4040
eModeConfig: IRiskSteward.EmodeConfig({
41-
ltv: IRiskSteward.RiskParamConfig({minDelay: type(uint40).max, maxPercentChange: 0}),
41+
ltv: IRiskSteward.RiskParamConfig({minDelay: 0, maxPercentChange: type(uint128).max}),
4242
liquidationThreshold: IRiskSteward.RiskParamConfig({
43-
minDelay: type(uint40).max,
44-
maxPercentChange: 0
43+
minDelay: 0,
44+
maxPercentChange: type(uint128).max
4545
}),
4646
liquidationBonus: IRiskSteward.RiskParamConfig({
47-
minDelay: type(uint40).max,
48-
maxPercentChange: 0
47+
minDelay: 0,
48+
maxPercentChange: type(uint128).max
4949
})
5050
}),
5151
rateConfig: IRiskSteward.RateConfig({
@@ -94,13 +94,14 @@ library DeployHorizonRiskStewards {
9494
// make deploy-ledger contract=scripts/deploy/DeployHorizonStewards.s.sol:DeployEthereum chain=mainnet
9595
// dry run: make deploy-pk contract=scripts/deploy/DeployHorizonStewards.s.sol:DeployEthereum chain=mainnet dry=1
9696
contract DeployEthereum is EthereumScript {
97+
address public constant HORIZON_ADVANCED_MULTISIG = 0x4444dE8a4AA3401a3AEC584de87B0f21E3e601CA;
9798
function run() external {
9899
vm.startBroadcast();
99100
DeployHorizonRiskStewards._deployRiskStewards(
100101
address(AaveV3Ethereum.POOL),
101102
AaveV3Ethereum.CONFIG_ENGINE,
102-
address(1), // TODO: advanced multisig
103-
address(1) // TODO: advanced multisig
103+
HORIZON_ADVANCED_MULTISIG,
104+
HORIZON_ADVANCED_MULTISIG
104105
);
105106
vm.stopBroadcast();
106107
}

tests/CollateralRiskSteward.t.sol

Lines changed: 26 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -260,82 +260,42 @@ contract CollateralRiskSteward_Test is RiskSteward_Test {
260260
}
261261

262262
/* ----------------------------- EMode Category Update Tests ----------------------------- */
263-
/// should revert due to config
264-
function test_updateEModeCategories() public virtual override {
263+
/// should not revert, as allowable range is set to max uint128 percent change
264+
function test_updateEModeCategories_outOfRange() public virtual override {
265265
uint8 eModeId = 1;
266266
DataTypes.CollateralConfig memory currentEmodeConfig = AaveV3Ethereum
267267
.POOL
268268
.getEModeCategoryCollateralConfig(eModeId);
269-
string memory label = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
270269

271270
IEngine.EModeCategoryUpdate[] memory eModeCategoryUpdates = new IEngine.EModeCategoryUpdate[](
272271
1
273272
);
274273
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
275274
eModeCategory: eModeId,
276-
ltv: currentEmodeConfig.ltv + 50, // 0.5% absolute increase
277-
liqThreshold: currentEmodeConfig.liquidationThreshold + 10, // 0.1% absolute increase
278-
liqBonus: (currentEmodeConfig.liquidationBonus - 100_00) + 50, // 0.5% absolute increase
275+
ltv: currentEmodeConfig.ltv + 51, // 0.5% absolute increase
276+
liqThreshold: currentEmodeConfig.liquidationThreshold + 11, // 0.11% absolute increase
277+
liqBonus: (currentEmodeConfig.liquidationBonus - 100_00) + 51, // 0.51% absolute increase
279278
label: EngineFlags.KEEP_CURRENT_STRING
280279
});
281280

282281
vm.startPrank(riskCouncil);
283-
// expect revert as minimum time has not passed for next update
284-
vm.expectRevert(IRiskSteward.DebounceNotRespected.selector);
282+
// should not revert, as allowable range is set to max uint128 percent change
285283
steward.updateEModeCategories(eModeCategoryUpdates);
286284

287-
RiskSteward.EModeDebounce memory lastUpdated = steward.getEModeTimelock(eModeId);
288-
289-
DataTypes.CollateralConfig memory afterEmodeConfig = AaveV3Ethereum
290-
.POOL
291-
.getEModeCategoryCollateralConfig(eModeId);
292-
string memory afterLabel = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
293-
294-
assertEq(afterEmodeConfig.ltv, currentEmodeConfig.ltv);
295-
assertEq(afterEmodeConfig.liquidationThreshold, currentEmodeConfig.liquidationThreshold);
296-
assertEq(afterEmodeConfig.liquidationBonus, currentEmodeConfig.liquidationBonus);
297-
assertEq(afterLabel, label);
298-
299-
assertEq(lastUpdated.eModeLtvLastUpdated, 0);
300-
assertEq(lastUpdated.eModeLiquidationThresholdLastUpdated, 0);
301-
assertEq(lastUpdated.eModeLiquidationBonusLastUpdated, 0);
302-
303-
// after min time passed test eMode update decrease
304-
vm.warp(MIN_DELAY);
305-
306-
currentEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
285+
// no time needs to pass to update again as minDelay is set to 0
307286

308287
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
309288
eModeCategory: eModeId,
310-
ltv: currentEmodeConfig.ltv - 50, // 0.5% absolute increase
311-
liqThreshold: currentEmodeConfig.liquidationThreshold - 10, // 0.1% absolute increase
312-
liqBonus: (currentEmodeConfig.liquidationBonus - 100_00) - 50, // 0.5% absolute increase
289+
ltv: currentEmodeConfig.ltv - 51, // 0.51% absolute increase
290+
liqThreshold: currentEmodeConfig.liquidationThreshold - 11, // 0.11% absolute increase
291+
liqBonus: (currentEmodeConfig.liquidationBonus - 100_00) - 51, // 0.51% absolute increase
313292
label: EngineFlags.KEEP_CURRENT_STRING
314293
});
315-
// expect revert as UpdateNotInRange
316-
vm.expectRevert(IRiskSteward.UpdateNotInRange.selector);
294+
// should not revert, as allowable range is set to max uint128 percent change
317295
steward.updateEModeCategories(eModeCategoryUpdates);
318-
319-
afterEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
320-
afterLabel = AaveV3Ethereum.POOL.getEModeCategoryLabel(eModeId);
321-
322-
assertEq(afterEmodeConfig.ltv, currentEmodeConfig.ltv);
323-
assertEq(afterEmodeConfig.liquidationThreshold, currentEmodeConfig.liquidationThreshold);
324-
assertEq(afterEmodeConfig.liquidationBonus, currentEmodeConfig.liquidationBonus);
325-
assertEq(afterLabel, label);
326-
327-
lastUpdated = steward.getEModeTimelock(eModeId);
328-
329-
assertEq(lastUpdated.eModeLtvLastUpdated, 0);
330-
assertEq(lastUpdated.eModeLiquidationThresholdLastUpdated, 0);
331-
assertEq(lastUpdated.eModeLiquidationBonusLastUpdated, 0);
332-
}
333-
334-
function test_updateEModeCategories_outOfRange() public virtual override {
335-
vm.warp(MIN_DELAY);
336-
super.test_updateEModeCategories_outOfRange();
337296
}
338297

298+
/// should not revert, as minDelay config is 0
339299
function test_updateEModeCategories_debounceNotRespected() public virtual override {
340300
uint8 eModeId = 1;
341301
DataTypes.CollateralConfig memory currentEmodeConfig = AaveV3Ethereum
@@ -354,23 +314,24 @@ contract CollateralRiskSteward_Test is RiskSteward_Test {
354314
});
355315

356316
vm.startPrank(riskCouncil);
357-
// expect revert as minimum time has not passed for next update
358-
vm.expectRevert(IRiskSteward.DebounceNotRespected.selector);
359317
steward.updateEModeCategories(eModeCategoryUpdates);
360318

361-
vm.warp(MIN_DELAY - 1);
319+
currentEmodeConfig = AaveV3Ethereum.POOL.getEModeCategoryCollateralConfig(eModeId);
320+
eModeCategoryUpdates[0] = IEngine.EModeCategoryUpdate({
321+
eModeCategory: eModeId,
322+
ltv: currentEmodeConfig.ltv + 20, // 0.2% absolute increase
323+
liqThreshold: currentEmodeConfig.liquidationThreshold + 30, // 0.3% absolute increase
324+
liqBonus: (currentEmodeConfig.liquidationBonus - 100_00) + 40, // 0.4% absolute increase
325+
label: EngineFlags.KEEP_CURRENT_STRING
326+
});
362327

363-
// expect revert as minimum time has not passed for next update
364-
vm.expectRevert(IRiskSteward.DebounceNotRespected.selector);
328+
// will not revert as minDelay config is 0
365329
steward.updateEModeCategories(eModeCategoryUpdates);
366-
}
367-
368-
function test_updateEModeCategories_sameUpdate() public virtual override {
369-
vm.warp(MIN_DELAY);
370-
super.test_updateEModeCategories_sameUpdate();
330+
vm.stopPrank();
371331
}
372332

373333
/* ----------------------------- Collateral Tests ----------------------------- */
334+
/// should not revert, as allowable range is set to max uint128 percent change
374335
function test_updateCollateralSide_outOfRange() public virtual override {
375336
(, uint256 ltvBefore, uint256 ltBefore, uint256 lbBefore, , , , , , ) = AaveV3Ethereum
376337
.AAVE_PROTOCOL_DATA_PROVIDER
@@ -395,7 +356,7 @@ contract CollateralRiskSteward_Test is RiskSteward_Test {
395356
// should not revert, as allowable range is set to max uint128 percent change
396357
steward.updateCollateralSide(collateralUpdates);
397358

398-
// no time needs to pass to update again as delay is set to 0
359+
// no time needs to pass to update again as minDelay is set to 0
399360

400361
collateralUpdates[0] = IEngine.CollateralUpdate({
401362
asset: AaveV3EthereumAssets.UNI_UNDERLYING,
@@ -411,6 +372,7 @@ contract CollateralRiskSteward_Test is RiskSteward_Test {
411372
vm.stopPrank();
412373
}
413374

375+
/// should not revert, as minDelay config is 0
414376
function test_updateCollateralSide_debounceNotRespected() public virtual override {
415377
(, uint256 ltvBefore, , , , , , , , ) = AaveV3Ethereum
416378
.AAVE_PROTOCOL_DATA_PROVIDER
@@ -442,7 +404,7 @@ contract CollateralRiskSteward_Test is RiskSteward_Test {
442404
liqProtocolFee: EngineFlags.KEEP_CURRENT
443405
});
444406

445-
// will not revert as delay config is 0
407+
// will not revert as minDelay config is 0
446408
steward.updateCollateralSide(collateralUpdates);
447409
vm.stopPrank();
448410
}

0 commit comments

Comments
 (0)