diff --git a/src/contracts/interfaces/IEigenPodManager.sol b/src/contracts/interfaces/IEigenPodManager.sol index 5c4703db7..dfc46219b 100644 --- a/src/contracts/interfaces/IEigenPodManager.sol +++ b/src/contracts/interfaces/IEigenPodManager.sol @@ -51,7 +51,7 @@ interface IEigenPodManagerEvents { ); /// @notice Emitted when a staker's beaconChainSlashingFactor is updated - event BeaconChainSlashingFactorUpdated(address staker, uint64 newBeaconChainSlashingFactor); + event BeaconChainSlashingFactorDecreased(address staker, uint256 wadSlashed, uint64 newBeaconChainSlashingFactor); } interface IEigenPodManagerTypes { diff --git a/src/contracts/pods/EigenPodManager.sol b/src/contracts/pods/EigenPodManager.sol index 9806ead51..f8911b091 100644 --- a/src/contracts/pods/EigenPodManager.sol +++ b/src/contracts/pods/EigenPodManager.sol @@ -273,12 +273,16 @@ contract EigenPodManager is uint256 newRestakedBalanceWei = prevRestakedBalanceWei - balanceDecreasedWei; uint256 proportionRemainingWad = newRestakedBalanceWei.divWadRoundUp(prevRestakedBalanceWei); + // Note that underflow here should be impossible given + // `proportionRemainingWad` is guaranteed to be less than WAD. + uint256 wadSlashed = uint256(WAD) - proportionRemainingWad; + // Update pod owner's beacon chain slashing factor. Note that `newBeaconSlashingFactor` // should be less than `prevBeaconSlashingFactor` because `proportionRemainingWad` is // guaranteed to be less than WAD. uint64 prevBeaconSlashingFactor = beaconChainSlashingFactor(podOwner); uint64 newBeaconSlashingFactor = uint64(prevBeaconSlashingFactor.mulWad(proportionRemainingWad)); - emit BeaconChainSlashingFactorUpdated(podOwner, newBeaconSlashingFactor); + emit BeaconChainSlashingFactorDecreased(podOwner, wadSlashed, newBeaconSlashingFactor); /// forgefmt: disable-next-item _beaconChainSlashingFactor[podOwner] = BeaconChainSlashingFactor({ slashingFactor: newBeaconSlashingFactor, @@ -286,9 +290,6 @@ contract EigenPodManager is }); uint256 curDepositShares = uint256(podOwnerDepositShares[podOwner]); - // Note that underflow here should be impossible given - // `proportionRemainingWad` is guaranteed to be less than WAD. - uint256 wadSlashed = uint256(WAD) - proportionRemainingWad; return (curDepositShares, prevBeaconSlashingFactor, wadSlashed); } diff --git a/src/test/unit/EigenPodManagerUnit.t.sol b/src/test/unit/EigenPodManagerUnit.t.sol index c4b9cad15..1efbd0151 100644 --- a/src/test/unit/EigenPodManagerUnit.t.sol +++ b/src/test/unit/EigenPodManagerUnit.t.sol @@ -494,7 +494,7 @@ contract EigenPodManagerUnitTests_BeaconChainETHBalanceUpdateTests is EigenPodMa // Not checking the new slashing factor - just checking the invariant that new <= prev cheats.expectEmit(true, true, true, false); - emit BeaconChainSlashingFactorUpdated(defaultStaker, 0); + emit BeaconChainSlashingFactorDecreased(defaultStaker, 0, 0); cheats.prank(address(defaultPod)); eigenPodManager.recordBeaconChainETHBalanceUpdate(defaultStaker, prevRestakedBalanceWei, -int(sharesDelta));