Skip to content

Commit 5511bef

Browse files
committed
refactor: remove inconsistent alias
1 parent bf19c5f commit 5511bef

File tree

4 files changed

+24
-36
lines changed

4 files changed

+24
-36
lines changed

src/contracts/core/DelegationManager.sol

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -963,17 +963,10 @@ contract DelegationManager is
963963

964964
return (strategies, shares);
965965
}
966-
966+
967967
/// @inheritdoc IDelegationManager
968968
function getQueuedWithdrawal(
969969
bytes32 withdrawalRoot
970-
) external view returns (Withdrawal memory) {
971-
return queuedWithdrawals[withdrawalRoot];
972-
}
973-
974-
/// @inheritdoc IDelegationManager
975-
function getQueuedWithdrawalFromRoot(
976-
bytes32 withdrawalRoot
977970
) external view returns (Withdrawal memory withdrawal, uint256[] memory shares) {
978971
(withdrawal, shares) = _getSharesByWithdrawalRoot(withdrawalRoot);
979972
}

src/contracts/core/DelegationManagerStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ abstract contract DelegationManagerStorage is IDelegationManager {
111111

112112
/// @notice Returns the details of a queued withdrawal given by `withdrawalRoot`.
113113
/// @dev This variable only reflects withdrawals that were made after the slashing release.
114-
mapping(bytes32 withdrawalRoot => Withdrawal withdrawal) internal queuedWithdrawals;
114+
mapping(bytes32 withdrawalRoot => Withdrawal withdrawal) public queuedWithdrawals;
115115

116116
/// @notice Contains history of the total cumulative staker withdrawals for an operator and a given strategy.
117117
/// Used to calculate burned StrategyManager shares when an operator is slashed.

src/contracts/interfaces/IDelegationManager.sol

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,17 @@ interface IDelegationManager is ISignatureUtilsMixin, IDelegationManagerErrors,
471471
*/
472472
function depositScalingFactor(address staker, IStrategy strategy) external view returns (uint256);
473473

474-
/// @notice Returns the Withdrawal associated with a `withdrawalRoot`, if it exists. NOTE that
475-
/// withdrawals queued before the slashing release can NOT be queried with this method.
474+
/**
475+
* @notice Returns the Withdrawal and corresponding shares associated with a `withdrawalRoot`
476+
* @param withdrawalRoot The hash identifying the queued withdrawal
477+
* @return withdrawal The withdrawal details
478+
* @return shares Array of shares corresponding to each strategy in the withdrawal
479+
* @dev The shares are what a user would receive from completing a queued withdrawal, assuming all slashings are applied
480+
* @dev Withdrawals queued before the slashing release cannot be queried with this method
481+
*/
476482
function getQueuedWithdrawal(
477483
bytes32 withdrawalRoot
478-
) external view returns (Withdrawal memory);
484+
) external view returns (Withdrawal memory withdrawal, uint256[] memory shares);
479485

480486
/**
481487
* @notice Returns all queued withdrawals and their corresponding shares for a staker.
@@ -488,17 +494,6 @@ interface IDelegationManager is ISignatureUtilsMixin, IDelegationManagerErrors,
488494
address staker
489495
) external view returns (Withdrawal[] memory withdrawals, uint256[][] memory shares);
490496

491-
/**
492-
* @notice Returns the withdrawal details and corresponding shares for a specific queued withdrawal.
493-
* @param withdrawalRoot The hash identifying the queued withdrawal.
494-
* @return withdrawal The withdrawal details.
495-
* @return shares Array of shares corresponding to each strategy in the withdrawal.
496-
* @dev The shares are what a user would receive from completing a queued withdrawal, assuming all slashings are applied.
497-
*/
498-
function getQueuedWithdrawalFromRoot(
499-
bytes32 withdrawalRoot
500-
) external view returns (Withdrawal memory withdrawal, uint256[] memory shares);
501-
502497
/// @notice Returns a list of queued withdrawal roots for the `staker`.
503498
/// NOTE that this only returns withdrawals queued AFTER the slashing release.
504499
function getQueuedWithdrawalRoots(

src/test/unit/DelegationUnit.t.sol

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4846,7 +4846,7 @@ contract DelegationManagerUnitTests_queueWithdrawals is DelegationManagerUnitTes
48464846
cheats.prank(defaultStaker);
48474847
bytes32 withdrawalRoot = delegationManager.queueWithdrawals(queuedWithdrawalParams)[0];
48484848

4849-
Withdrawal memory withdrawal = delegationManager.getQueuedWithdrawal(withdrawalRoot);
4849+
(Withdrawal memory withdrawal, ) = delegationManager.getQueuedWithdrawal(withdrawalRoot);
48504850
assertEq(withdrawal.staker, defaultStaker, "staker should be msg.sender");
48514851
assertEq(withdrawal.withdrawer, defaultStaker, "withdrawer should be msg.sender");
48524852
}
@@ -8670,16 +8670,16 @@ contract DelegationManagerUnitTests_getQueuedWithdrawals is DelegationManagerUni
86708670

86718671
// Get shares from withdrawal - should return 50 shares (100 * 0.5) using original magnitude
86728672
// rather than incorrectly returning 100 shares (100 * 1.0) using new magnitude
8673-
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawalFromRoot(withdrawalRoot);
8673+
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawal(withdrawalRoot);
86748674
assertEq(shares[0], 50e18, "shares should be 50e18 (100e18 * 0.5) using original magnitude");
86758675
}
86768676
}
86778677

8678-
contract DelegationManagerUnitTests_getQueuedWithdrawalFromRoot is DelegationManagerUnitTests {
8678+
contract DelegationManagerUnitTests_getQueuedWithdrawal is DelegationManagerUnitTests {
86798679
using ArrayLib for *;
86808680
using SlashingLib for *;
86818681

8682-
function test_getQueuedWithdrawalFromRoot_Correctness(Randomness r) public rand(r) {
8682+
function test_getQueuedWithdrawal_Correctness(Randomness r) public rand(r) {
86838683
// Set up initial deposit
86848684
uint256 depositAmount = r.Uint256(1 ether, 100 ether);
86858685
_depositIntoStrategies(defaultStaker, strategyMock.toArray(), depositAmount.toArrayU256());
@@ -8703,14 +8703,14 @@ contract DelegationManagerUnitTests_getQueuedWithdrawalFromRoot is DelegationMan
87038703
delegationManager.queueWithdrawals(queuedWithdrawalParams);
87048704

87058705
// Get shares from queued withdrawal
8706-
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawalFromRoot(withdrawalRoot);
8706+
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawal(withdrawalRoot);
87078707

87088708
// Verify withdrawal details match
87098709
assertEq(shares.length, 1, "incorrect shares array length");
87108710
assertEq(shares[0], depositAmount, "incorrect shares amount");
87118711
}
87128712

8713-
function test_getQueuedWithdrawalFromRoot_AfterSlashing(Randomness r) public rand(r) {
8713+
function test_getQueuedWithdrawal_AfterSlashing(Randomness r) public rand(r) {
87148714
// Set up initial deposit
87158715
uint256 depositAmount = r.Uint256(1 ether, 100 ether);
87168716
_depositIntoStrategies(defaultStaker, strategyMock.toArray(), depositAmount.toArrayU256());
@@ -8739,20 +8739,20 @@ contract DelegationManagerUnitTests_getQueuedWithdrawalFromRoot is DelegationMan
87398739
delegationManager.slashOperatorShares(defaultOperator, strategyMock, WAD, 0.5 ether);
87408740

87418741
// Get shares from queued withdrawal
8742-
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawalFromRoot(withdrawalRoot);
8742+
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawal(withdrawalRoot);
87438743

87448744
// Verify withdrawal details match and shares are slashed
87458745
assertEq(shares.length, 1, "incorrect shares array length");
87468746
assertEq(shares[0], depositAmount / 2, "shares not properly slashed");
87478747
}
87488748

8749-
function test_getQueuedWithdrawalFromRoot_NonexistentWithdrawal() public {
8749+
function test_getQueuedWithdrawal_NonexistentWithdrawal() public {
87508750
bytes32 nonexistentRoot = bytes32(uint256(1));
8751-
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawalFromRoot(nonexistentRoot);
8751+
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawal(nonexistentRoot);
87528752
assertEq(shares.length, 0, "shares array should be empty");
87538753
}
87548754

8755-
function test_getQueuedWithdrawalFromRoot_MultipleStrategies(Randomness r) public rand(r) {
8755+
function test_getQueuedWithdrawal_MultipleStrategies(Randomness r) public rand(r) {
87568756
// Set up multiple strategies with deposits
87578757
uint256 numStrategies = r.Uint256(2, 5);
87588758
uint256[] memory depositShares = r.Uint256Array({
@@ -8782,7 +8782,7 @@ contract DelegationManagerUnitTests_getQueuedWithdrawalFromRoot is DelegationMan
87828782
delegationManager.queueWithdrawals(queuedWithdrawalParams);
87838783

87848784
// Get shares from queued withdrawal
8785-
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawalFromRoot(withdrawalRoot);
8785+
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawal(withdrawalRoot);
87868786

87878787
// Verify withdrawal details and shares for each strategy
87888788
assertEq(shares.length, numStrategies, "incorrect shares array length");
@@ -8791,8 +8791,8 @@ contract DelegationManagerUnitTests_getQueuedWithdrawalFromRoot is DelegationMan
87918791
}
87928792
}
87938793

8794-
function testFuzz_getQueuedWithdrawalFromRoot_EmptyWithdrawal(bytes32 withdrawalRoot) public {
8795-
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawalFromRoot(withdrawalRoot);
8794+
function testFuzz_getQueuedWithdrawal_EmptyWithdrawal(bytes32 withdrawalRoot) public {
8795+
(, uint256[] memory shares) = delegationManager.getQueuedWithdrawal(withdrawalRoot);
87968796
assertEq(shares.length, 0, "sanity check");
87978797
}
87988798
}

0 commit comments

Comments
 (0)