-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: delegate shares #1045
fix: delegate shares #1045
Conversation
uint64 stakerBeaconChainSlashing = eigenPodManager.beaconChainSlashingFactor(staker); | ||
|
||
DepositScalingFactor memory dsf = _depositScalingFactor[staker][strategies[i]]; | ||
withdrawableShares[i] = dsf.calcWithdrawable(withdrawableShares[i], stakerBeaconChainSlashing); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: since undelegated, staker maxMagnitude is 0 so their slashingFactor only needs to use the BCSF for calculating withdrawable.
* remove unused code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. There's test cleanup to be done in followup PRs, but this looks great otherwise.
flaky ci fixed upstream NOTE: commented out here |
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
**Motivation:** Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's `withdrawableShares` rather than their `depositShares`. **Modifications:** - Changed accounting logic on delegation in `DelegationManger.sol` - `DepositScalingFactor` now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawal - Changes in `StrategyManager.sol`, `IShareManager.sol`, `SlashingLib.sol`, and `EigenPodManager.sol` to accommodate new accounting - New test files and changes to others to reflect new accounting and invariants - Updated `docs/SharesAccounting.md` **Result:** System is now robust to stakers with arbitrary EigenPod states --------- Co-authored-by: Michael <michael@Michaels-MacBook-Pro.local> Co-authored-by: Michael Sun <michaelsun97@gmail.com> Co-authored-by: wadealexc <pragma-services@proton.me> Co-authored-by: Yash Patil <40046473+ypatil12@users.noreply.github.com> Co-authored-by: clandestine.eth <96172957+0xClandestine@users.noreply.github.com>
Motivation:
Fixes an issue where stakers delegating Beacon Chain ETH from slashed Eigen Pods were able to delegate more shares than they should. Specifically, operators now are delegated a staker's
withdrawableShares
rather than theirdepositShares
.Modifications:
DelegationManger.sol
DepositScalingFactor
now resets when a staker withdraws all their shares, whether through undelegation, redelegation, or a simple withdrawalStrategyManager.sol
,IShareManager.sol
,SlashingLib.sol
, andEigenPodManager.sol
to accommodate new accountingdocs/SharesAccounting.md
Result:
System is now robust to stakers with arbitrary EigenPod states