Skip to content

Commit

Permalink
fix: use operator from Withdrawal
Browse files Browse the repository at this point in the history
  • Loading branch information
0xClandestine committed Feb 12, 2025
1 parent ea043c5 commit 8e0ec84
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/contracts/core/DelegationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -783,25 +783,24 @@ contract DelegationManager is
withdrawal = queuedWithdrawals[withdrawalRoot];
shares = new uint256[](withdrawal.strategies.length);

address operator = delegatedTo[withdrawal.staker];
uint32 slashableUntil = withdrawal.startBlock + MIN_WITHDRAWAL_DELAY_BLOCKS;

uint256[] memory slashingFactors;
// If slashableUntil block is in the past, read the slashing factors at that block
// Otherwise read the current slashing factors. Note that if the slashableUntil block is the current block
// or in the future then the slashing factors are still subject to change before the withdrawal is completable
// and the shares withdrawn to be less
if (slashableUntil < uint32(block.number)) {
slashingFactors = _getSlashingFactorsAtBlock({

// If the slashableUntil block is in the past, read the slashing factors at that block.
// Otherwise, read the current slashing factors. Note that if the slashableUntil block is the current block
// or in the future, then the slashing factors are still subject to change before the withdrawal is completable,
// which may result in fewer shares being withdrawn.
uint256[] memory slashingFactors = slashableUntil < uint32(block.number)
? _getSlashingFactorsAtBlock({
staker: withdrawal.staker,
operator: operator,
operator: withdrawal.delegatedTo,
strategies: withdrawal.strategies,
blockNumber: slashableUntil
})
: _getSlashingFactors({
staker: withdrawal.staker,
operator: withdrawal.delegatedTo,
strategies: withdrawal.strategies
});
} else {
slashingFactors =
_getSlashingFactors({staker: withdrawal.staker, operator: operator, strategies: withdrawal.strategies});
}

for (uint256 j; j < withdrawal.strategies.length; ++j) {
shares[j] = SlashingLib.scaleForCompleteWithdrawal({
Expand Down

0 comments on commit 8e0ec84

Please sign in to comment.