Skip to content

Commit a5a3b05

Browse files
chore: fix numerous compiler warnings from script + test files (#419)
warnings were for unused or shadowed variables, or functions that could have stricter mutability
1 parent 20c06b2 commit a5a3b05

10 files changed

+23
-26
lines changed

script/testing/M2_Deploy_From_Scratch.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ contract Deployer_M2 is Script, Test {
378378
function _verifyContractsPointAtOneAnother(
379379
DelegationManager delegationContract,
380380
StrategyManager strategyManagerContract,
381-
Slasher slasherContract,
381+
Slasher /*slasherContract*/,
382382
EigenPodManager eigenPodManagerContract,
383383
DelayedWithdrawalRouter delayedWithdrawalRouterContract
384384
) internal view {

src/test/integration/IntegrationBase.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ abstract contract IntegrationBase is IntegrationDeployer {
444444

445445
function assert_Snap_Added_QueuedWithdrawal(
446446
User staker,
447-
IDelegationManager.Withdrawal memory withdrawal,
447+
IDelegationManager.Withdrawal memory /*withdrawal*/,
448448
string memory err
449449
) internal {
450450
uint curQueuedWithdrawal = _getCumulativeWithdrawals(staker);

src/test/integration/User.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ contract User is Test {
325325

326326
/// @notice Gets the expected withdrawals to be created when the staker is undelegated via a call to `DelegationManager.undelegate()`
327327
/// @notice Assumes staker and withdrawer are the same and that all strategies and shares are withdrawn
328-
function _getExpectedWithdrawalStructsForStaker(address staker) internal returns (IDelegationManager.Withdrawal[] memory) {
328+
function _getExpectedWithdrawalStructsForStaker(address staker) internal view returns (IDelegationManager.Withdrawal[] memory) {
329329
(IStrategy[] memory strategies, uint256[] memory shares)
330330
= delegationManager.getDelegatableShares(staker);
331331

src/test/integration/tests/Deposit_Delegate_Redelegate_Complete.t.sol

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,17 @@ contract Integration_Deposit_Delegate_Redelegate_Complete is IntegrationCheckUti
151151
}
152152

153153
// Complete last withdrawal as shares
154-
IERC20[] memory tokens = staker.completeWithdrawalAsTokens(withdrawals[withdrawals.length - 1]);
155-
uint[] memory expectedTokens = _calculateExpectedTokens(strategies, shares);
156-
check_Withdrawal_AsTokens_State(staker, operator2, withdrawals[withdrawals.length - 1], strategies, shares, tokens, expectedTokens);
154+
IERC20[] memory finalWithdrawaltokens = staker.completeWithdrawalAsTokens(withdrawals[withdrawals.length - 1]);
155+
uint[] memory finalExpectedTokens = _calculateExpectedTokens(strategies, shares);
156+
check_Withdrawal_AsTokens_State(
157+
staker,
158+
operator2,
159+
withdrawals[withdrawals.length - 1],
160+
strategies,
161+
shares,
162+
finalWithdrawaltokens,
163+
finalExpectedTokens
164+
);
157165
}
158166

159167
function testFuzz_deposit_delegate_reDelegate_depositAfterRedelegate(uint24 _random) public {

src/test/mocks/DelegationManagerMock.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,19 @@ contract DelegationManagerMock is IDelegationManager, Test {
7575
return 0;
7676
}
7777

78-
function minWithdrawalDelayBlocks() external view returns (uint256) {
78+
function minWithdrawalDelayBlocks() external pure returns (uint256) {
7979
return 0;
8080
}
8181

8282
/**
8383
* @notice Minimum delay enforced by this contract per Strategy for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner,
8484
* up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced).
8585
*/
86-
function strategyWithdrawalDelayBlocks(IStrategy /*strategy*/) external view returns (uint256) {
86+
function strategyWithdrawalDelayBlocks(IStrategy /*strategy*/) external pure returns (uint256) {
8787
return 0;
8888
}
8989

90-
function getWithdrawalDelay(IStrategy[] calldata /*strategies*/) public view returns (uint256) {
90+
function getWithdrawalDelay(IStrategy[] calldata /*strategies*/) public pure returns (uint256) {
9191
return 0;
9292
}
9393

src/test/mocks/ERC20Mock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ contract ERC20Mock is Context, IERC20 {
8282
return _allowances[owner][spender];
8383
}
8484

85-
function mint(address to, uint256 amount) public virtual {
85+
function mint(address /*to*/, uint256 amount) public virtual {
8686
address owner = _msgSender();
8787
_mint(owner, amount);
8888
}

src/test/mocks/EigenPodManagerMock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ contract EigenPodManagerMock is IEigenPodManager, Test {
8787
function maxPods() external view returns (uint256) {}
8888

8989

90-
function denebForkTimestamp() external view returns (uint64){
90+
function denebForkTimestamp() external pure returns (uint64) {
9191
return type(uint64).max;
9292
}
9393

src/test/unit/DelegationUnit.t.sol

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ contract DelegationManagerUnitTests is EigenLayerUnitTestSetup, IDelegationManag
406406
*/
407407
function _setUpCompleteQueuedWithdrawalSingleStrat(
408408
address staker,
409-
address operator,
410409
address withdrawer,
411410
uint256 depositAmount,
412411
uint256 withdrawalAmount
@@ -445,7 +444,7 @@ contract DelegationManagerUnitTests is EigenLayerUnitTestSetup, IDelegationManag
445444
*/
446445
function _setUpCompleteQueuedWithdrawal(
447446
address staker,
448-
address operator,
447+
address /*operator*/,
449448
address withdrawer,
450449
uint256[] memory depositAmounts,
451450
uint256[] memory withdrawalAmounts
@@ -2923,7 +2922,6 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
29232922
/* bytes32 withdrawalRoot */
29242923
) = _setUpCompleteQueuedWithdrawalSingleStrat({
29252924
staker: defaultStaker,
2926-
operator: defaultOperator,
29272925
withdrawer: defaultStaker,
29282926
depositAmount: 100,
29292927
withdrawalAmount: 100
@@ -2942,7 +2940,6 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
29422940
bytes32 withdrawalRoot
29432941
) = _setUpCompleteQueuedWithdrawalSingleStrat({
29442942
staker: defaultStaker,
2945-
operator: defaultOperator,
29462943
withdrawer: defaultStaker,
29472944
depositAmount: 100,
29482945
withdrawalAmount: 100
@@ -2970,7 +2967,6 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
29702967
// /* bytes32 withdrawalRoot */
29712968
// ) = _setUpCompleteQueuedWithdrawalSingleStrat({
29722969
// staker: defaultStaker,
2973-
// operator: defaultOperator,
29742970
// withdrawer: defaultStaker,
29752971
// depositAmount: 100,
29762972
// withdrawalAmount: 100
@@ -2986,10 +2982,9 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
29862982
(
29872983
IDelegationManager.Withdrawal memory withdrawal,
29882984
IERC20[] memory tokens,
2989-
bytes32 withdrawalRoot
2985+
/*bytes32 withdrawalRoot*/
29902986
) = _setUpCompleteQueuedWithdrawalSingleStrat({
29912987
staker: defaultStaker,
2992-
operator: defaultOperator,
29932988
withdrawer: defaultStaker,
29942989
depositAmount: 100,
29952990
withdrawalAmount: 100
@@ -3005,7 +3000,6 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
30053000
_registerOperatorWithBaseDetails(defaultOperator);
30063001
(IDelegationManager.Withdrawal memory withdrawal, , ) = _setUpCompleteQueuedWithdrawalSingleStrat({
30073002
staker: defaultStaker,
3008-
operator: defaultOperator,
30093003
withdrawer: defaultStaker,
30103004
depositAmount: 100,
30113005
withdrawalAmount: 100
@@ -3042,7 +3036,6 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
30423036
bytes32 withdrawalRoot
30433037
) = _setUpCompleteQueuedWithdrawalSingleStrat({
30443038
staker: staker,
3045-
operator: defaultOperator,
30463039
withdrawer: withdrawer,
30473040
depositAmount: depositAmount,
30483041
withdrawalAmount: withdrawalAmount
@@ -3087,7 +3080,6 @@ contract DelegationManagerUnitTests_completeQueuedWithdrawal is DelegationManage
30873080
bytes32 withdrawalRoot
30883081
) = _setUpCompleteQueuedWithdrawalSingleStrat({
30893082
staker: staker,
3090-
operator: defaultOperator,
30913083
withdrawer: withdrawer,
30923084
depositAmount: depositAmount,
30933085
withdrawalAmount: withdrawalAmount

src/test/unit/EigenPod-PodManagerUnit.t.sol

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ contract EigenPod_PodManager_UnitTests_EigenPodManager is EigenPod_PodManager_Un
372372
assertEq(validatorInfo.restakedBalanceGwei, MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR, "Restaked balance gwei should be max");
373373
assertGt(updatedShares - initialShares, 0, "Shares delta should be positive");
374374
assertEq(updatedShares, 32e18, "Shares should be 32ETH");
375+
assertEq(newValidatorBalance, 32e9, "validator balance should be 32e9 Gwei");
375376
}
376377

377378
function test_fullWithdrawal_excess32ETH() public {
@@ -537,9 +538,6 @@ contract EigenPod_PodManager_UnitTests_EigenPodManager is EigenPod_PodManager_Un
537538
_setOracleBlockRoot();
538539
cheats.warp(oracleTimestamp+=1);
539540

540-
// Save state for checks
541-
int256 initialShares = eigenPodManager.podOwnerShares(podOwner);
542-
543541
// Act: Verify withdrawal credentials and record the balance update
544542
cheats.prank(podOwner);
545543
eigenPod.verifyWithdrawalCredentials(

src/test/unit/EigenPodUnit.t.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,6 @@ contract EigenPodUnitTests_WithdrawalTests is EigenPodHarnessSetup, ProofParsing
844844

845845
// Get params to check against
846846
uint64 withdrawalTimestamp = withdrawalToProve.getWithdrawalTimestamp();
847-
uint40 validatorIndex = uint40(getValidatorIndex());
848847
uint64 withdrawalAmountGwei = withdrawalFields.getWithdrawalAmountGwei();
849848
assertLt(withdrawalAmountGwei, MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR, "Withdrawal amount should be greater than max restaked balance for this test");
850849

@@ -859,7 +858,7 @@ contract EigenPodUnitTests_WithdrawalTests is EigenPodHarnessSetup, ProofParsing
859858

860859
// Storage checks in _verifyAndProcessWithdrawal
861860
bytes32 validatorPubKeyHash = validatorFields.getPubkeyHash();
862-
// assertTrue(eigenPodHarness.provenWithdrawal(validatorPubKeyHash, withdrawalTimestamp), "Withdrawal not set to proven");
861+
assertTrue(eigenPodHarness.provenWithdrawal(validatorPubKeyHash, withdrawalTimestamp), "Withdrawal not set to proven");
863862

864863
// Checks from _processFullWithdrawal
865864
assertEq(eigenPod.withdrawableRestakedExecutionLayerGwei(), withdrawalAmountGwei, "Incorrect withdrawable restaked execution layer gwei");

0 commit comments

Comments
 (0)