Skip to content

Commit 59078eb

Browse files
committed
refactor: remove state variables
1 parent 6f38a82 commit 59078eb

File tree

4 files changed

+8
-31
lines changed

4 files changed

+8
-31
lines changed

src/contracts/interfaces/IDurationVaultStrategy.sol

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,6 @@ interface IDurationVaultStrategy is
187187
address claimer
188188
) external;
189189

190-
/// @notice Retries best-effort deallocation/deregistration after maturity.
191-
/// @dev Callable by anyone once the vault is in WITHDRAWALS.
192-
function retryOperatorCleanup() external;
193-
194190
/// @notice Updates the TVL limits for max deposit per transaction and total stake cap.
195191
/// @param newMaxPerDeposit New maximum deposit amount per transaction.
196192
/// @param newStakeCap New maximum total deposits allowed.

src/contracts/strategies/DurationVaultStrategy.sol

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ contract DurationVaultStrategy is DurationVaultStrategyStorage, StrategyBase {
132132
maturedAt = uint32(block.timestamp);
133133
emit VaultMatured(maturedAt);
134134

135-
_pendingDeallocation = true;
136-
_pendingDeregistration = true;
137135
_attemptOperatorCleanup();
138136
}
139137

@@ -153,8 +151,6 @@ contract DurationVaultStrategy is DurationVaultStrategyStorage, StrategyBase {
153151
emit VaultMatured(maturedAt);
154152
emit VaultAdvancedToWithdrawals(msg.sender, maturedAt);
155153

156-
_pendingDeallocation = true;
157-
_pendingDeregistration = true;
158154
_attemptOperatorCleanup();
159155
}
160156

@@ -187,12 +183,6 @@ contract DurationVaultStrategy is DurationVaultStrategyStorage, StrategyBase {
187183
rewardsCoordinator.setClaimerFor(address(this), claimer);
188184
}
189185

190-
/// @notice Retries best-effort operator cleanup after maturity.
191-
function retryOperatorCleanup() external override {
192-
require(_state == VaultState.WITHDRAWALS, DurationNotElapsed());
193-
_attemptOperatorCleanup();
194-
}
195-
196186
/// @notice Updates the TVL limits for max deposit per transaction and total stake cap.
197187
/// @dev Only callable by the vault admin while deposits are open (before lock).
198188
function updateTVLLimits(
@@ -420,11 +410,7 @@ contract DurationVaultStrategy is DurationVaultStrategyStorage, StrategyBase {
420410

421411
/// @notice Best-effort cleanup after maturity, with retry tracking.
422412
function _attemptOperatorCleanup() internal {
423-
if (_pendingDeallocation) {
424-
_pendingDeallocation = !_deallocateAll();
425-
}
426-
if (_pendingDeregistration) {
427-
_pendingDeregistration = !_deregisterFromOperatorSet();
428-
}
413+
_deallocateAll();
414+
_deregisterFromOperatorSet();
429415
}
430416
}

src/contracts/strategies/DurationVaultStrategyStorage.sol

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,10 @@ abstract contract DurationVaultStrategyStorage is IDurationVaultStrategy {
4747
/// @notice The maximum deposits (in underlyingToken) that this strategy will hold.
4848
uint256 public maxTotalDeposits;
4949

50-
/// @dev Indicates whether a deallocation retry is still needed after maturity.
51-
bool internal _pendingDeallocation;
52-
53-
/// @dev Indicates whether a deregistration retry is still needed after maturity.
54-
bool internal _pendingDeregistration;
55-
5650
/// @dev This empty reserved space is put in place to allow future versions to add new
5751
/// variables without shifting down storage in the inheritance chain.
5852
/// Storage slots used: vaultAdmin (1) + arbitrator (1) + duration/lockedAt/unlockAt/maturedAt/_state (packed, 1) +
59-
/// metadataURI (1) + _operatorSet (1) + maxPerDeposit (1) + maxTotalDeposits (1) + pending flags (1) = 7.
60-
/// Gap: 50 - 8 = 42.
61-
uint256[42] private __gap;
53+
/// metadataURI (1) + _operatorSet (1) + maxPerDeposit (1) + maxTotalDeposits (1) = 6.
54+
/// Gap: 50 - 7 = 43.
55+
uint256[43] private __gap;
6256
}

src/test/unit/DurationVaultStrategyUnit.t.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ contract DurationVaultStrategyUnitTests is StrategyBaseUnitTests {
175175
assertEq(allocationManagerMock.deregisterFromOperatorSetsCallCount(), 0, "unexpected deregister count");
176176
}
177177

178-
function testMarkMaturedRetryOperatorCleanup() public {
178+
function testMarkMaturedCanRetryOperatorCleanup() public {
179179
durationVault.lock();
180180
cheats.warp(block.timestamp + defaultDuration + 1);
181181

@@ -188,7 +188,8 @@ contract DurationVaultStrategyUnitTests is StrategyBaseUnitTests {
188188
allocationManagerMock.setRevertModifyAllocations(false);
189189
allocationManagerMock.setRevertDeregisterFromOperatorSets(false);
190190

191-
durationVault.retryOperatorCleanup();
191+
// markMatured is a permissionless retry path once in WITHDRAWALS.
192+
durationVault.markMatured();
192193

193194
assertEq(allocationManagerMock.modifyAllocationsCallCount(), 2, "deallocation should be retried");
194195
assertEq(allocationManagerMock.deregisterFromOperatorSetsCallCount(), 1, "deregistration should be retried");

0 commit comments

Comments
 (0)