Skip to content

Commit

Permalink
start on totalMagnitude cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gpsanant committed Sep 19, 2024
1 parent 69ef27d commit 831c2c6
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/contracts/core/DelegationManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -564,11 +564,7 @@ contract DelegationManager is

// read delegated operator's totalMagnitudes at time of withdrawal to scale shares again if any slashing has occurred
// during withdrawal delay period
uint64[] memory totalMagnitudes = allocationManager.getTotalMagnitudesAtTimestamp({
operator: withdrawal.delegatedTo,
strategies: withdrawal.strategies,
timestamp: withdrawal.startTimestamp + MIN_WITHDRAWAL_DELAY
});
uint64[] memory totalMagnitudes;

if (withdrawal.startTimestamp < LEGACY_WITHDRAWALS_TIMESTAMP) {
// this is a legacy M2 withdrawal using blocknumbers. We use the LEGACY_WITHDRAWALS_TIMESTAMP to check
Expand All @@ -578,9 +574,20 @@ contract DelegationManager is
withdrawal.startTimestamp + LEGACY_MIN_WITHDRAWAL_DELAY_BLOCKS <= block.number,
WithdrawalDelayNotElapsed()
);

totalMagnitudes = new uint64[](withdrawal.strategies.length);
for (uint256 i = 0; i < withdrawal.strategies.length; i++) {
totalMagnitudes[i] = SlashingLib.PRECISION_FACTOR;
}
} else {
// this is a post Slashing release withdrawal using timestamps
require(withdrawal.startTimestamp + MIN_WITHDRAWAL_DELAY <= block.timestamp, WithdrawalDelayNotElapsed());

totalMagnitudes = allocationManager.getTotalMagnitudesAtTimestamp({
operator: withdrawal.delegatedTo,
strategies: withdrawal.strategies,
timestamp: withdrawal.startTimestamp + MIN_WITHDRAWAL_DELAY
});
}

for (uint256 i = 0; i < withdrawal.strategies.length; i++) {
Expand Down

0 comments on commit 831c2c6

Please sign in to comment.