From 7296277dead749733ff1900c7bb48d73057eaf2f Mon Sep 17 00:00:00 2001 From: wadealexc Date: Fri, 22 Nov 2024 16:23:59 +0000 Subject: [PATCH] chore: address feedback --- src/contracts/interfaces/IEigenPodManager.sol | 6 +++--- src/contracts/pods/EigenPodManager.sol | 12 ++++++------ src/test/unit/EigenPodManagerUnit.t.sol | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/contracts/interfaces/IEigenPodManager.sol b/src/contracts/interfaces/IEigenPodManager.sol index 327469f73..5c4703db7 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 BeaconChainSlashingFactorDecreased(address staker, uint64 newBeaconChainSlashingFactor); + event BeaconChainSlashingFactorUpdated(address staker, uint64 newBeaconChainSlashingFactor); } interface IEigenPodManagerTypes { @@ -156,8 +156,8 @@ interface IEigenPodManager is function beaconChainETHStrategy() external view returns (IStrategy); /** - * @notice Returns the amount of reported slashing a staker has experienced on the - * beacon chain. + * @notice Returns the historical sum of proportional balance decreases a pod owner has experienced when + * updating their pod's balance. */ function beaconChainSlashingFactor( address staker diff --git a/src/contracts/pods/EigenPodManager.sol b/src/contracts/pods/EigenPodManager.sol index f65ed9857..7ce90831a 100644 --- a/src/contracts/pods/EigenPodManager.sol +++ b/src/contracts/pods/EigenPodManager.sol @@ -271,14 +271,14 @@ contract EigenPodManager is // balance that remains. Note that underflow here should be impossible given // the invariants pods use to calculate these values. uint256 newRestakedBalanceWei = prevRestakedBalanceWei - balanceDecreasedWei; - uint256 balanceRemainingWad = newRestakedBalanceWei.divWadRoundUp(prevRestakedBalanceWei); + uint256 proportionRemainingWad = newRestakedBalanceWei.divWadRoundUp(prevRestakedBalanceWei); // Update pod owner's beacon chain slashing factor. Note that `newBeaconSlashingFactor` - // should be less than `prevBeaconSlashingFactor` because `balanceRemainingWad` is + // should be less than `prevBeaconSlashingFactor` because `proportionRemainingWad` is // guaranteed to be less than WAD. uint64 prevBeaconSlashingFactor = beaconChainSlashingFactor(podOwner); - uint64 newBeaconSlashingFactor = uint64(prevBeaconSlashingFactor.mulWad(balanceRemainingWad)); - emit BeaconChainSlashingFactorDecreased(podOwner, newBeaconSlashingFactor); + uint64 newBeaconSlashingFactor = uint64(prevBeaconSlashingFactor.mulWad(proportionRemainingWad)); + emit BeaconChainSlashingFactorUpdated(podOwner, newBeaconSlashingFactor); /// forgefmt: disable-next-item _beaconChainSlashingFactor[podOwner] = BeaconChainSlashingFactor({ slashingFactor: newBeaconSlashingFactor, @@ -287,8 +287,8 @@ contract EigenPodManager is uint256 curDepositShares = uint256(podOwnerDepositShares[podOwner]); // Note that underflow here should be impossible given - // `balanceRemainingWad` is guaranteed to be less than WAD. - uint256 wadSlashed = uint256(WAD) - balanceRemainingWad; + // `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 55b6cba44..c4b9cad15 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 BeaconChainSlashingFactorDecreased(defaultStaker, 0); + emit BeaconChainSlashingFactorUpdated(defaultStaker, 0); cheats.prank(address(defaultPod)); eigenPodManager.recordBeaconChainETHBalanceUpdate(defaultStaker, prevRestakedBalanceWei, -int(sharesDelta));