@@ -63,6 +63,13 @@ abstract contract VaultStorage is StaticDelegateCallable, IVaultStorage {
6363 */
6464 address public burner;
6565
66+ /**
67+ * @notice Initial timestamp for epoch calculation.
68+ * @dev DEPRECATED: This variable is kept for storage layout compatibility with previous versions.
69+ * It is no longer used in the contract logic. Use withdrawalDelay instead.
70+ */
71+ uint48 public epochDurationInit;
72+
6673 /**
6774 * @notice Duration of the withdrawal delay (time before withdrawals become claimable).
6875 * @return duration of the withdrawal delay
@@ -100,28 +107,50 @@ abstract contract VaultStorage is StaticDelegateCallable, IVaultStorage {
100107 mapping (address account = > bool value ) public isDepositorWhitelisted;
101108
102109 /**
103- * @notice Total pending withdrawal assets in the global withdrawal pool.
104- * @dev Only withdrawals that are not yet claimable contribute to this pool.
110+ * @notice Withdrawal assets per epoch.
111+ * @dev DEPRECATED: This mapping is kept for storage layout compatibility with previous versions.
112+ * It is no longer used in the contract logic. Use the withdrawals() getter function instead.
105113 */
106- uint256 public withdrawals ;
114+ mapping ( uint256 epoch = > uint256 amount ) internal _withdrawalsEpoch ;
107115
108116 /**
109- * @notice Total pending withdrawal shares in the global withdrawal pool.
110- * @dev Only withdrawals that are not yet claimable contribute to this pool.
117+ * @notice Withdrawal shares per epoch.
118+ * @dev DEPRECATED: This mapping is kept for storage layout compatibility with previous versions.
119+ * It is no longer used in the contract logic. Use the withdrawalShares() getter function instead.
111120 */
112- uint256 public withdrawalShares;
121+ mapping (uint256 epoch = > uint256 amount ) internal _withdrawalSharesEpoch;
122+
123+ /**
124+ * @notice Withdrawal shares per epoch per account.
125+ * @dev DEPRECATED: This mapping is kept for storage layout compatibility with previous versions.
126+ * It is no longer used in the contract logic. Use _withdrawalEntries mapping instead.
127+ */
128+ mapping (uint256 epoch = > mapping (address account = > uint256 amount )) internal _withdrawalSharesOfEpoch;
129+
130+ /**
131+ * @notice Whether withdrawals have been claimed per epoch per account.
132+ * @dev DEPRECATED: This mapping is kept for storage layout compatibility with previous versions.
133+ * It is no longer used in the contract logic. Use _withdrawalEntries mapping instead.
134+ */
135+ mapping (uint256 epoch = > mapping (address account = > bool value )) internal _isWithdrawalsClaimed;
136+
137+ Checkpoints.Trace256 internal _activeShares;
138+
139+ Checkpoints.Trace256 internal _activeStake;
140+
141+ mapping (address account = > Checkpoints.Trace256 shares ) internal _activeSharesOf;
113142
114143 /**
115- * @notice Total claimable withdrawal assets in the global withdrawal pool.
116- * @dev These withdrawals have finished their delay and are no longer slashable .
144+ * @notice Total pending withdrawal assets in the global withdrawal pool.
145+ * @dev Only withdrawals that are not yet claimable contribute to this pool .
117146 */
118- uint256 public claimableWithdrawals ;
147+ uint256 public withdrawals ;
119148
120149 /**
121- * @notice Total claimable withdrawal shares in the global withdrawal pool.
122- * @dev These withdrawals have finished their delay and are no longer slashable .
150+ * @notice Total pending withdrawal shares in the global withdrawal pool.
151+ * @dev Only withdrawals that are not yet claimable contribute to this pool .
123152 */
124- uint256 public claimableWithdrawalShares ;
153+ uint256 public withdrawalShares ;
125154
126155 /**
127156 * @notice Withdrawal entries for each account stored as a queue.
@@ -142,10 +171,25 @@ abstract contract VaultStorage is StaticDelegateCallable, IVaultStorage {
142171 uint256 internal _processedWithdrawalBucket;
143172
144173 /**
145- * @notice Cumulative withdrawal shares per bucket, stored as prefix sums .
146- * @dev `_withdrawalBucketCumulativeShares[i]` equals total shares across buckets `[0, i]` .
174+ * @notice Prefix sum entry containing cumulative shares and assets .
175+ * @dev Stores cumulative values up to and including a bucket index .
147176 */
148- uint256 [] internal _withdrawalBucketCumulativeShares;
177+ struct PrefixSum {
178+ uint256 cumulativeShares;
179+ uint256 cumulativeAssets;
180+ }
181+
182+ /**
183+ * @notice Cumulative withdrawal shares and assets per bucket, stored as prefix sums.
184+ * @dev `_withdrawalPrefixSum[i]` equals cumulative shares and assets across buckets `[0, i]`.
185+ * Assets are only set when buckets mature; before maturity, cumulativeAssets equals the previous bucket's value.
186+ */
187+ PrefixSum[] internal _withdrawalPrefixSum;
188+
189+ constructor (address delegatorFactory , address slasherFactory ) {
190+ DELEGATOR_FACTORY = delegatorFactory;
191+ SLASHER_FACTORY = slasherFactory;
192+ }
149193
150194 /**
151195 * @notice Get total withdrawal shares for a particular account (for slashing).
@@ -194,38 +238,6 @@ abstract contract VaultStorage is StaticDelegateCallable, IVaultStorage {
194238 shares = packed >> 48 ;
195239 }
196240
197- Checkpoints.Trace256 internal _activeShares;
198-
199- Checkpoints.Trace256 internal _activeStake;
200-
201- mapping (address account = > Checkpoints.Trace256 shares ) internal _activeSharesOf;
202-
203- constructor (address delegatorFactory , address slasherFactory ) {
204- DELEGATOR_FACTORY = delegatorFactory;
205- SLASHER_FACTORY = slasherFactory;
206- }
207-
208- /**
209- * @notice Get the current timestamp.
210- * @return current timestamp
211- */
212- function currentTime () public view returns (uint48 ) {
213- return Time.timestamp ();
214- }
215-
216- /**
217- * @notice Get all slashable unlock windows (windows where unlockAt > now).
218- * @param now_ current timestamp
219- * @return windows array of unlock windows that are still slashable
220- * @dev This is a helper for iterating over slashable withdrawals.
221- * In practice, we'll track the max unlock window and iterate backwards.
222- */
223- function getSlashableWindows (uint48 now_ ) public view returns (uint48 [] memory windows ) {
224- // This is a simplified version - in practice, you'd want to track active windows
225- // For now, we'll calculate on-the-fly in the calling functions
226- return windows;
227- }
228-
229241 /**
230242 * @inheritdoc IVaultStorage
231243 */
0 commit comments