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

Remove useless stake updates and fix issue where operator was set inc… #252

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/contracts/core/DelegationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ contract DelegationManager is Initializable, OwnableUpgradeable, Pausable, Deleg
(IStrategy[] memory strategies, uint256[] memory shares)
= getDelegatableShares(staker);

// push the operator's new stake to the StakeRegistry
_pushOperatorStakeUpdate(operator);

// emit an event if this action was not initiated by the staker themselves
if (msg.sender != staker) {
emit StakerForceUndelegated(staker, operator);
Expand Down Expand Up @@ -607,16 +604,19 @@ contract DelegationManager is Initializable, OwnableUpgradeable, Pausable, Deleg
podOwner: staker,
shares: withdrawal.shares[i]
});
currentOperator = delegatedTo[staker];
address podOwnerOperator = delegatedTo[staker];
// Similar to `isDelegated` logic
if (currentOperator != address(0)) {
if (podOwnerOperator != address(0)) {
_increaseOperatorShares({
operator: currentOperator,
operator: podOwnerOperator,
// the 'staker' here is the address receiving new shares
staker: staker,
strategy: withdrawal.strategies[i],
shares: increaseInDelegateableShares
});

// push the operator's new stake to the StakeRegistry
_pushOperatorStakeUpdate(podOwnerOperator);
}
} else {
strategyManager.addShares(msg.sender, withdrawal.strategies[i], withdrawal.shares[i]);
Expand Down Expand Up @@ -687,9 +687,6 @@ contract DelegationManager is Initializable, OwnableUpgradeable, Pausable, Deleg
strategy: strategies[i],
shares: shares[i]
});

// push the operator's new stake to the StakeRegistry
_pushOperatorStakeUpdate(operator);
}

// Remove active shares from EigenPodManager/StrategyManager
Expand All @@ -709,6 +706,11 @@ contract DelegationManager is Initializable, OwnableUpgradeable, Pausable, Deleg
unchecked { ++i; }
}

// Push the operator's new stake to the StakeRegistry
if (operator != address(0)) {
_pushOperatorStakeUpdate(operator);
}

// Create queue entry and increment withdrawal nonce
uint256 nonce = cumulativeWithdrawalsQueued[staker];
cumulativeWithdrawalsQueued[staker]++;
Expand Down
Loading