Skip to content

Commit

Permalink
fix: scaledStakerShares equation
Browse files Browse the repository at this point in the history
  • Loading branch information
8sunyuan committed Sep 12, 2024
1 parent 0c1fad4 commit d2b8552
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/contracts/core/DelegationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -905,9 +905,11 @@ contract DelegationManager is
// NOTE that to prevent numerator overflow, the max sharesToWithdraw is
// x*1e36 <= 2^256-1
// => x <= 1.1579e41
// however we know that the max shares in a strategy is 1e38-1 and all the ETH on the beaconchain staked
// in one eigenPod would be ~3e25. This product here is safe
sharesToDecrement =
(sharesToWithdraw * SlashingConstants.PRECISION_FACTOR_SQUARED) / (stakerScalingFactor * totalMagnitude);
scaledStakerShares = sharesToWithdraw * stakerScalingFactor / SlashingConstants.PRECISION_FACTOR;
scaledStakerShares = sharesToWithdraw * SlashingConstants.PRECISION_FACTOR / totalMagnitude;
return (sharesToDecrement, scaledStakerShares);
}

Expand Down

0 comments on commit d2b8552

Please sign in to comment.