diff --git a/contracts/Escrow.sol b/contracts/Escrow.sol index ff056043..9f3d66be 100644 --- a/contracts/Escrow.sol +++ b/contracts/Escrow.sol @@ -16,7 +16,7 @@ import {IWithdrawalQueue, WithdrawalRequestStatus} from "./interfaces/IWithdrawa import {IDualGovernance} from "./interfaces/IDualGovernance.sol"; import {EscrowState} from "./libraries/EscrowState.sol"; -import {WithdrawalsBatchesQueue} from "./libraries/WithdrawalBatchesQueue.sol"; +import {WithdrawalsBatchesQueue} from "./libraries/WithdrawalsBatchesQueue.sol"; import {HolderAssets, StETHAccounting, UnstETHAccounting, AssetsAccounting} from "./libraries/AssetsAccounting.sol"; /// @notice Summary of the total locked assets in the Escrow. @@ -423,9 +423,9 @@ contract Escrow is IEscrow { } /// @dev This check is primarily required when only unstETH NFTs are locked in the Escrow - /// and there are no WithdrawalBatches. In this scenario, the RageQuitExtensionPeriod can only begin + /// and there are no WithdrawalsBatches. In this scenario, the RageQuitExtensionPeriod can only begin /// when the last locked unstETH id is finalized in the WithdrawalQueue. - /// When the WithdrawalBatchesQueue is not empty, this invariant is maintained by the following: + /// When the WithdrawalsBatchesQueue is not empty, this invariant is maintained by the following: /// - Any locked unstETH during the VetoSignalling phase has an id less than any unstETH NFT created /// during the request for withdrawal batches. /// - Claiming the withdrawal batches requires the finalization of the unstETH with the given id. diff --git a/contracts/libraries/WithdrawalBatchesQueue.sol b/contracts/libraries/WithdrawalsBatchesQueue.sol similarity index 95% rename from contracts/libraries/WithdrawalBatchesQueue.sol rename to contracts/libraries/WithdrawalsBatchesQueue.sol index 537f50c0..91b9aa9c 100644 --- a/contracts/libraries/WithdrawalBatchesQueue.sol +++ b/contracts/libraries/WithdrawalsBatchesQueue.sol @@ -23,18 +23,18 @@ library WithdrawalsBatchesQueue { error EmptyBatch(); error InvalidUnstETHIdsSequence(); - error WithdrawalBatchesQueueIsInAbsentState(); - error WithdrawalBatchesQueueIsNotInOpenedState(); - error WithdrawalBatchesQueueIsNotInAbsentState(); + error WithdrawalsBatchesQueueIsInAbsentState(); + error WithdrawalsBatchesQueueIsNotInOpenedState(); + error WithdrawalsBatchesQueueIsNotInAbsentState(); // --- // Events // --- - event WithdrawalBatchesQueueClosed(); + event WithdrawalsBatchesQueueClosed(); event UnstETHIdsAdded(uint256[] unstETHIds); event UnstETHIdsClaimed(uint256[] unstETHIds); - event WithdrawalBatchesQueueOpened(uint256 boundaryUnstETHId); + event WithdrawalsBatchesQueueOpened(uint256 boundaryUnstETHId); // --- // Data types @@ -92,7 +92,7 @@ library WithdrawalsBatchesQueue { /// `boundaryUnstETHId` value is used as a lower bound for the adding unstETH ids. function open(Context storage self, uint256 boundaryUnstETHId) internal { if (self.info.state != State.Absent) { - revert WithdrawalBatchesQueueIsNotInAbsentState(); + revert WithdrawalsBatchesQueueIsNotInAbsentState(); } self.info.state = State.Opened; @@ -101,7 +101,7 @@ library WithdrawalsBatchesQueue { /// when the queue is empty. This element doesn't used during the claiming of the batches created /// via `addUnstETHIds()` method and always allocates single batch. self.batches.push(SequentialBatch({firstUnstETHId: boundaryUnstETHId, lastUnstETHId: boundaryUnstETHId})); - emit WithdrawalBatchesQueueOpened(boundaryUnstETHId); + emit WithdrawalsBatchesQueueOpened(boundaryUnstETHId); } /// @notice Adds a new batch of unstETH ids to the withdrawal queue. @@ -165,7 +165,7 @@ library WithdrawalsBatchesQueue { function close(Context storage self) internal { _checkInOpenedState(self); self.info.state = State.Closed; - emit WithdrawalBatchesQueueClosed(); + emit WithdrawalsBatchesQueueClosed(); } // --- @@ -293,13 +293,13 @@ library WithdrawalsBatchesQueue { function _checkNotInAbsentState(Context storage self) private view { if (self.info.state == State.Absent) { - revert WithdrawalBatchesQueueIsInAbsentState(); + revert WithdrawalsBatchesQueueIsInAbsentState(); } } function _checkInOpenedState(Context storage self) private view { if (self.info.state != State.Opened) { - revert WithdrawalBatchesQueueIsNotInOpenedState(); + revert WithdrawalsBatchesQueueIsNotInOpenedState(); } } } diff --git a/test/scenario/escrow.t.sol b/test/scenario/escrow.t.sol index 425bb571..cc2da832 100644 --- a/test/scenario/escrow.t.sol +++ b/test/scenario/escrow.t.sol @@ -303,7 +303,7 @@ contract EscrowHappyPath is ScenarioTestBlueprint { escrow.startRageQuit(_RAGE_QUIT_EXTRA_TIMELOCK, _RAGE_QUIT_WITHDRAWALS_TIMELOCK); uint256 escrowStETHBalance = _lido.stETH.balanceOf(address(escrow)); - uint256 expectedWithdrawalBatchesCount = escrowStETHBalance / requestAmount + 1; + uint256 expectedWithdrawalsBatchesCount = escrowStETHBalance / requestAmount + 1; assertEq(_lido.withdrawalQueue.balanceOf(address(escrow)), 10); escrow.requestNextWithdrawalsBatch(10); @@ -314,13 +314,13 @@ contract EscrowHappyPath is ScenarioTestBlueprint { escrow.requestNextWithdrawalsBatch(96); } - assertEq(_lido.withdrawalQueue.balanceOf(address(escrow)), 10 + expectedWithdrawalBatchesCount); + assertEq(_lido.withdrawalQueue.balanceOf(address(escrow)), 10 + expectedWithdrawalsBatchesCount); assertEq(escrow.isRageQuitFinalized(), false); _finalizeWithdrawalQueue(); - uint256[] memory unstETHIdsToClaim = escrow.getNextWithdrawalBatch(expectedWithdrawalBatchesCount); - // assertEq(total, expectedWithdrawalBatchesCount); + uint256[] memory unstETHIdsToClaim = escrow.getNextWithdrawalBatch(expectedWithdrawalsBatchesCount); + // assertEq(total, expectedWithdrawalsBatchesCount); WithdrawalRequestStatus[] memory statuses = _lido.withdrawalQueue.getWithdrawalStatus(unstETHIdsToClaim); diff --git a/test/unit/libraries/WithdrawalBatchesQueue.t.sol b/test/unit/libraries/WithdrawalBatchesQueue.t.sol index 01b5979e..dd4204f4 100644 --- a/test/unit/libraries/WithdrawalBatchesQueue.t.sol +++ b/test/unit/libraries/WithdrawalBatchesQueue.t.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.26; import {UnitTest} from "test/utils/unit-test.sol"; -import {WithdrawalsBatchesQueue, State} from "contracts/libraries/WithdrawalBatchesQueue.sol"; +import {WithdrawalsBatchesQueue, State} from "contracts/libraries/WithdrawalsBatchesQueue.sol"; contract WithdrawalsBatchesQueueTest is UnitTest { using WithdrawalsBatchesQueue for WithdrawalsBatchesQueue.Context; @@ -30,15 +30,15 @@ contract WithdrawalsBatchesQueueTest is UnitTest { _batchesQueue.info.state = State.Opened; assertEq(_batchesQueue.info.state, State.Opened); - vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalBatchesQueueIsNotInAbsentState.selector); + vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalsBatchesQueueIsNotInAbsentState.selector); _batchesQueue.open(_DEFAULT_BOUNDARY_UNST_ETH_ID); } - function test_open_Emit_WithdrawalBatchesQueueOpened() external { + function test_open_Emit_WithdrawalsBatchesQueueOpened() external { assertEq(_batchesQueue.info.state, State.Absent); vm.expectEmit(true, false, false, false); - emit WithdrawalsBatchesQueue.WithdrawalBatchesQueueOpened(_DEFAULT_BOUNDARY_UNST_ETH_ID); + emit WithdrawalsBatchesQueue.WithdrawalsBatchesQueueOpened(_DEFAULT_BOUNDARY_UNST_ETH_ID); _batchesQueue.open(_DEFAULT_BOUNDARY_UNST_ETH_ID); } @@ -126,7 +126,7 @@ contract WithdrawalsBatchesQueueTest is UnitTest { } function test_addUnstETHIds_RevertOn_QueueNotInOpenedState() external { - vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalBatchesQueueIsNotInOpenedState.selector); + vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalsBatchesQueueIsNotInOpenedState.selector); _batchesQueue.addUnstETHIds(new uint256[](0)); } @@ -305,22 +305,22 @@ contract WithdrawalsBatchesQueueTest is UnitTest { } function test_close_RevertOn_QueueNotInOpenedState() external { - vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalBatchesQueueIsNotInOpenedState.selector); + vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalsBatchesQueueIsNotInOpenedState.selector); _batchesQueue.close(); _batchesQueue.open({boundaryUnstETHId: 1}); _batchesQueue.close(); - vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalBatchesQueueIsNotInOpenedState.selector); + vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalsBatchesQueueIsNotInOpenedState.selector); _batchesQueue.close(); } - function test_close_Emit_WithdrawalBatchesQueueClosed() external { + function test_close_Emit_WithdrawalsBatchesQueueClosed() external { _openBatchesQueue(); assertEq(_batchesQueue.info.state, State.Opened); vm.expectEmit(true, false, false, false); - emit WithdrawalsBatchesQueue.WithdrawalBatchesQueueClosed(); + emit WithdrawalsBatchesQueue.WithdrawalsBatchesQueueClosed(); _batchesQueue.close(); } @@ -502,7 +502,7 @@ contract WithdrawalsBatchesQueueTest is UnitTest { } function test_getBoundaryUnstETHId_RevertOn_QueueInAbsentState() external { - vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalBatchesQueueIsInAbsentState.selector); + vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalsBatchesQueueIsInAbsentState.selector); _batchesQueue.getBoundaryUnstETHId(); } @@ -554,7 +554,7 @@ contract WithdrawalsBatchesQueueTest is UnitTest { } function test_getLastClaimedOrBoundaryUnstETHId_RevertOn_AbsentQueueState() external { - vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalBatchesQueueIsInAbsentState.selector); + vm.expectRevert(WithdrawalsBatchesQueue.WithdrawalsBatchesQueueIsInAbsentState.selector); _batchesQueue.getLastClaimedOrBoundaryUnstETHId(); }