-
Notifications
You must be signed in to change notification settings - Fork 438
fix: DSF increase on checkpointed nonzero shares #1176
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c83dbf3
to
dca5e5a
Compare
789c02d
to
2097f54
Compare
4d08720
to
9209df6
Compare
8sunyuan
previously approved these changes
Feb 27, 2025
eigenmikem
previously approved these changes
Feb 27, 2025
@@ -2709,6 +2735,10 @@ abstract contract IntegrationBase is IntegrationDeployer, TypeImporter { | |||
return curShares; | |||
} | |||
|
|||
function _getExpectedWithdrawableSharesAfterCompletion(User staker, uint scaledShares, uint depositScalingFactor, uint slashingFactor) internal view returns (uint) { |
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.
Looks good, just want to note that I have separate code dealing with this scenario in our testing branch so we'll have to remove one or the other down the line
0xClandestine
added a commit
that referenced
this pull request
Feb 27, 2025
**Motivation:** Enhance the Labeler CI automation to improve accuracy and efficiency. **Modifications:** - Prevent both Bug and Fix labels from being added simultaneously. See #1176 **Result:** Labeler CI automation should be more streamlined, and less error prone.
0xClandestine
requested changes
Feb 27, 2025
9209df6
to
5af968a
Compare
4 tasks
0xClandestine
previously approved these changes
Feb 27, 2025
This was referenced Feb 27, 2025
f173fed
wadealexc
previously approved these changes
Mar 3, 2025
f173fed
to
aff1ce1
Compare
nadir-akhtar
previously approved these changes
Mar 3, 2025
8sunyuan
previously approved these changes
Mar 3, 2025
0e60c46
eigenmikem
approved these changes
Mar 3, 2025
ypatil12
added a commit
that referenced
this pull request
Mar 3, 2025
**Motivation:** There exists an edge case where: 1. Alice queues a withdrawal for all her shares 2. Alice's operator is slashed 3. Alice checkpoints (no rewards or slashes). This actually increases her DSF, even though there wasn't a balance increase on the beacon chain 4. Alice completes withdrawal as tokens 5. Alice redeposits After step 5, Alice's withdrawable shares are overcounted due to increasing the DSF. Note that in step 4 if Alice completes her withdrawal as shares she can still inflate her withdrawable shares. **Modifications:** The fix is to prevent any state updates if `addedShares` is 0. In addition, we also update `recordBeaconChainETHBalanceUpdate` to only call the DM if there is a nonzero `balanceDeltaWei`, which is symmetric to the behavior in the `StrategyManager`. Regression tests: - [x] testFuzz_noCall_zeroBalanceUpdate - [x] testFuzz_deposit_delegate_allocate_slash_checkpointZeroBalance - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_checkpoint_redeposit - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_completeAsTokens_redeposit - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_checkPoint_completeAsShares **Result:** Inflating withdrawable shares edge case fixed.
ypatil12
added a commit
that referenced
this pull request
Mar 4, 2025
**Motivation:** Final upgrade tests, focusing on completing withdrawals after an operator has been slashed. **Modifications:** 2 tests are failing. Dependent on #1176 - [x] testFuzz_delegate_deposit_queue_upgrade_slashFully_completeAsTokens - [x] testFuzz_delegate_deposit_queue_upgrade_slashFully_revertCompleteAsShares - [x] testFuzz_delegate_deposit_queue_upgrade_slash_completeAsTokens - [x] testFuzz_delegate_deposit_queue_upgrade_slash_completeAsShares **Result:** Upgrade tests complete
ypatil12
added a commit
that referenced
this pull request
Mar 5, 2025
**Motivation:** There exists an edge case where: 1. Alice queues a withdrawal for all her shares 2. Alice's operator is slashed 3. Alice checkpoints (no rewards or slashes). This actually increases her DSF, even though there wasn't a balance increase on the beacon chain 4. Alice completes withdrawal as tokens 5. Alice redeposits After step 5, Alice's withdrawable shares are overcounted due to increasing the DSF. Note that in step 4 if Alice completes her withdrawal as shares she can still inflate her withdrawable shares. **Modifications:** The fix is to prevent any state updates if `addedShares` is 0. In addition, we also update `recordBeaconChainETHBalanceUpdate` to only call the DM if there is a nonzero `balanceDeltaWei`, which is symmetric to the behavior in the `StrategyManager`. Regression tests: - [x] testFuzz_noCall_zeroBalanceUpdate - [x] testFuzz_deposit_delegate_allocate_slash_checkpointZeroBalance - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_checkpoint_redeposit - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_completeAsTokens_redeposit - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_checkPoint_completeAsShares **Result:** Inflating withdrawable shares edge case fixed.
ypatil12
added a commit
that referenced
this pull request
Mar 5, 2025
**Motivation:** Final upgrade tests, focusing on completing withdrawals after an operator has been slashed. **Modifications:** 2 tests are failing. Dependent on #1176 - [x] testFuzz_delegate_deposit_queue_upgrade_slashFully_completeAsTokens - [x] testFuzz_delegate_deposit_queue_upgrade_slashFully_revertCompleteAsShares - [x] testFuzz_delegate_deposit_queue_upgrade_slash_completeAsTokens - [x] testFuzz_delegate_deposit_queue_upgrade_slash_completeAsShares **Result:** Upgrade tests complete
This was referenced Mar 5, 2025
ypatil12
added a commit
that referenced
this pull request
Mar 5, 2025
**Motivation:** There exists an edge case where: 1. Alice queues a withdrawal for all her shares 2. Alice's operator is slashed 3. Alice checkpoints (no rewards or slashes). This actually increases her DSF, even though there wasn't a balance increase on the beacon chain 4. Alice completes withdrawal as tokens 5. Alice redeposits After step 5, Alice's withdrawable shares are overcounted due to increasing the DSF. Note that in step 4 if Alice completes her withdrawal as shares she can still inflate her withdrawable shares. **Modifications:** The fix is to prevent any state updates if `addedShares` is 0. In addition, we also update `recordBeaconChainETHBalanceUpdate` to only call the DM if there is a nonzero `balanceDeltaWei`, which is symmetric to the behavior in the `StrategyManager`. Regression tests: - [x] testFuzz_noCall_zeroBalanceUpdate - [x] testFuzz_deposit_delegate_allocate_slash_checkpointZeroBalance - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_checkpoint_redeposit - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_completeAsTokens_redeposit - [x] testFuzz_deposit_delegate_allocate_slashAndQueue_checkPoint_completeAsShares **Result:** Inflating withdrawable shares edge case fixed.
ypatil12
added a commit
that referenced
this pull request
Mar 5, 2025
**Motivation:** Final upgrade tests, focusing on completing withdrawals after an operator has been slashed. **Modifications:** 2 tests are failing. Dependent on #1176 - [x] testFuzz_delegate_deposit_queue_upgrade_slashFully_completeAsTokens - [x] testFuzz_delegate_deposit_queue_upgrade_slashFully_revertCompleteAsShares - [x] testFuzz_delegate_deposit_queue_upgrade_slash_completeAsTokens - [x] testFuzz_delegate_deposit_queue_upgrade_slash_completeAsShares **Result:** Upgrade tests complete
ypatil12
added a commit
that referenced
this pull request
Mar 5, 2025
**Motivation:** Slashing Integration Testing for Competition Audit **Modifications:** ***General State Validation*** - #1204 - #1198 - #1169 - #1158 ***Upgrade Tests*** - #1187 - #1171 - #1143 ***Dual Slash Tests*** - #1195 - #1153 ***Rounding Tests*** - #1178 ***EigenPod Tests*** - #1191 - #1188 - #1203 - #1194 - #1163 ***Invariants*** - #1201 - #1176 - #1192 - #1197 - #1175 - #1189 - #1150 - #1149 **Result:** Comprehensive Test Coverage
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
📖 Documentation
Improvements or additions to documentation.
✨ Enhancement
New feature or request.
🔧 Fix
A bug fix or minor correction.
🧪 Test
Test-related changes (unit, integration, etc.).
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
There exists an edge case where:
After step 5, Alice's withdrawable shares are overcounted due to increasing the DSF. Note that in step 4 if Alice completes her withdrawal as shares she can still inflate her withdrawable shares.
Modifications:
The fix is to prevent any state updates if
addedShares
is 0. In addition, we also updaterecordBeaconChainETHBalanceUpdate
to only call the DM if there is a nonzerobalanceDeltaWei
, which is symmetric to the behavior in theStrategyManager
.Regression tests:
Result:
Inflating withdrawable shares edge case fixed.