Skip to content

Commit 94be5f0

Browse files
committed
Minor changes
1 parent 8ea679a commit 94be5f0

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

deploy/PASInit.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ library PASInit {
141141
address[] memory rateLimits,
142142
address[] memory controllers
143143
) internal {
144+
require(hop > 0, "PASInit/hop-is-zero");
145+
144146
BeamStateLike beamState = BeamStateLike(pasInstance.beamState);
145147

146148
beamState.setHop(address(0), hop);

src/BeamState.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ contract BeamState {
178178
}
179179

180180
function setMaxChange(address rateLimits_, uint256 value) external roleAuth {
181-
require(value >= WAD, "BeamState/maxChange-below-1x");
181+
require(value == 0 || value >= WAD, "BeamState/maxChange-below-1x");
182182
maxChange[rateLimits_] = value;
183183
emit SetMaxChange(rateLimits_, value);
184184
}

test/BeamState.t.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,15 @@ contract BeamStateTest is DssTest {
316316
assertEq(beamState.maxChange(TARGET1), WAD, "maxChange should be WAD");
317317
}
318318

319+
function testSetMaxChangeZero() public {
320+
beamState.setMaxChange(TARGET1, 2 * WAD);
321+
assertEq(beamState.maxChange(TARGET1), 2 * WAD, "maxChange should be set");
322+
323+
// Setting to 0 clears the specific override
324+
beamState.setMaxChange(TARGET1, 0);
325+
assertEq(beamState.maxChange(TARGET1), 0, "maxChange should be cleared");
326+
}
327+
319328
function testSetMaxChangeBelowWad() public {
320329
vm.expectRevert("BeamState/maxChange-below-1x");
321330
beamState.setMaxChange(TARGET1, WAD - 1);

test/Integration.t.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,16 @@ contract IntegrationTest is DssTest {
255255
assertEq(freshBeamState.controllers(testControllers[1]), 1, "second controller should be added");
256256
}
257257

258+
function initExtras() external {
259+
PASInstance memory freshPas = PASDeploy.deploy(address(this), address(this), MIN_DELAY);
260+
PASInit.initExtras(freshPas, 0, 1.5 ether, new address[](0), new address[](0), new address[](0));
261+
}
262+
263+
function testInitExtrasRevertsWhenHopIsZero() public {
264+
vm.expectRevert("PASInit/hop-is-zero");
265+
this.initExtras();
266+
}
267+
258268
// ============================================================================
259269
// CoreCouncil Direct Actions (IMMEDIATE Role) Tests
260270
// ============================================================================

0 commit comments

Comments
 (0)