File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ pragma solidity ^0.8.27;
3
3
4
4
import "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol " ;
5
5
import "@openzeppelin-upgrades/contracts/security/ReentrancyGuardUpgradeable.sol " ;
6
+ import "forge-std/console.sol " ;
6
7
7
8
import "../mixins/SignatureUtilsMixin.sol " ;
8
9
import "../mixins/PermissionControllerMixin.sol " ;
@@ -793,8 +794,8 @@ contract DelegationManager is
793
794
// less than or equal to MIN_WITHDRAWAL_DELAY_BLOCKS ago. These shares are still slashable.
794
795
uint256 scaledSharesAdded = curQueuedScaledShares - prevQueuedScaledShares;
795
796
796
- return SlashingLib.scaleForBurning ({
797
- scaledShares : scaledSharesAdded,
797
+ return SlashingLib.calcSlashedAmount ({
798
+ operatorShares : scaledSharesAdded. mulWad (prevMaxMagnitude) ,
798
799
prevMaxMagnitude: prevMaxMagnitude,
799
800
newMaxMagnitude: newMaxMagnitude
800
801
});
Original file line number Diff line number Diff line change @@ -178,6 +178,10 @@ library SlashingLib {
178
178
uint256 prevMaxMagnitude ,
179
179
uint256 newMaxMagnitude
180
180
) internal pure returns (uint256 ) {
181
+ if (prevMaxMagnitude == 0 ) {
182
+ // TODO: consider throwing an error instead
183
+ return 0 ;
184
+ }
181
185
// round up mulDiv so we don't overslash
182
186
return operatorShares - operatorShares.mulDiv (newMaxMagnitude, prevMaxMagnitude, Math.Rounding.Up);
183
187
}
You can’t perform that action at this time.
0 commit comments