Skip to content
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: ep negative shares bug #1033

Open
wants to merge 5 commits into
base: slashing-magnitudes-fixes
Choose a base branch
from

Conversation

ypatil12
Copy link
Collaborator

@ypatil12 ypatil12 commented Jan 17, 2025

Fixes the negative shares edge case where an operator is overrewarded shares if a staker, who previously had negative shares, completes a withdrawal as shares. Integration upgrade tests have been added to verify behavior.

@ypatil12 ypatil12 force-pushed the fix/ep-negative-shares-bug branch from d4a2441 to 0c7a702 Compare January 24, 2025 15:55
@ypatil12
Copy link
Collaborator Author

Proof of failure on bringing old logic back:

image

@ypatil12 ypatil12 marked this pull request as ready for review January 24, 2025 20:53
return (prevDepositShares < 0 ? 0 : uint256(prevDepositShares), shares);
// If we have gone from negative to positive shares, return (0, positive delta)
else if (prevDepositShares < 0) {
return (0, uint256(prevDepositShares + sharesToAdd));
Copy link
Collaborator

@8sunyuan 8sunyuan Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can this just be return (0, uint256(updatedDepositShares))? we do this addition above

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants