Skip to content

Commit

Permalink
refactor: switch conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
8sunyuan committed Dec 18, 2024
1 parent a74be39 commit e6c66cd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/contracts/core/DelegationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -945,20 +945,20 @@ contract DelegationManager is
uint32 slashableUntil = withdrawals[i].startBlock + MIN_WITHDRAWAL_DELAY_BLOCKS;

uint256[] memory slashingFactors;
// if the slashableUntil block is in the future, simply read current slashing factors
// still possible however for the slashing factors to change before the withdrawal is completable
// 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 =
_getSlashingFactors({staker: staker, operator: operator, strategies: withdrawals[i].strategies});
// Read slashing factors at the slashableUntil block
} else {
if (slashableUntil < uint32(block.number)) {
slashingFactors = _getSlashingFactorsAtBlock({
staker: staker,
operator: operator,
strategies: withdrawals[i].strategies,
blockNumber: slashableUntil
});
} else {
slashingFactors =
_getSlashingFactors({staker: staker, operator: operator, strategies: withdrawals[i].strategies});
}

for (uint256 j; j < withdrawals[i].strategies.length; ++j) {
Expand Down

0 comments on commit e6c66cd

Please sign in to comment.