File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -178,7 +178,7 @@ contract BeamState {
178178 }
179179
180180 function setMaxChange (address rateLimits_ , uint256 value ) external roleAuth {
181- require (value == 0 || value >= WAD, "BeamState/maxChange-below-1x " );
181+ require (value == 0 || value >= WAD, "BeamState/invalid-maxChange " );
182182 maxChange[rateLimits_] = value;
183183 emit SetMaxChange (rateLimits_, value);
184184 }
Original file line number Diff line number Diff line change @@ -102,15 +102,17 @@ contract Configurator {
102102 uint256 maxChange = beamState.getMaxChange (rateLimits);
103103
104104 // Ceiling is the max of (current * maxChange) and default
105+ // Avoids overflow when current maxAmount is type(uint256).max and guarantees decreases are always possible even when maxChange is 0
105106 require (
106107 maxAmount <= defMaxAmount ||
107- maxAmount <= current.maxAmount || // avoid overflow when current maxAmount is type(uint256).max
108+ maxAmount <= current.maxAmount ||
108109 maxAmount <= current.maxAmount * maxChange / WAD,
109110 "Configurator/exceeds-max-amount "
110111 );
112+ // Avoids overflow for a hypothetical case where current slope is type(uint256).max
111113 require (
112114 slope <= defSlope ||
113- slope <= current.slope || // avoid overflow for an hypothetical case where current slope is type(uint256).max
115+ slope <= current.slope ||
114116 slope <= current.slope * maxChange / WAD,
115117 "Configurator/exceeds-max-slope "
116118 );
Original file line number Diff line number Diff line change @@ -325,8 +325,8 @@ contract BeamStateTest is DssTest {
325325 assertEq (beamState.maxChange (TARGET1), 0 , "maxChange should be cleared " );
326326 }
327327
328- function testSetMaxChangeBelowWad () public {
329- vm.expectRevert ("BeamState/maxChange-below-1x " );
328+ function testSetMaxChangeInvalidValue () public {
329+ vm.expectRevert ("BeamState/invalid-maxChange " );
330330 beamState.setMaxChange (TARGET1, WAD - 1 );
331331 }
332332
You can’t perform that action at this time.
0 commit comments