Skip to content

Commit

Permalink
chore: address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wadealexc committed Nov 22, 2024
1 parent bfbb9af commit 7296277
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/contracts/interfaces/IEigenPodManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/contracts/pods/EigenPodManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/EigenPodManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 7296277

Please sign in to comment.