Fix Lido withdrawal claim access control#243
Closed
TUPM96 wants to merge 1 commit into
Closed
Conversation
Author
|
Closing as duplicate of #242; the earlier PR contains the same mitigation and fuller validation notes. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR tightens access control around claiming Lido withdrawals and prevents unrelated ETH held by the contract from being wrapped into WETH during claims.
Changes:
- Restrict
claimLidoWithdrawalsto operator/owner and wrap only the ETH received from the claim (not pre-existing/donated ETH). - Add fork tests for the new authorization requirement and for “only wrap claimed ETH”.
- Adjust a fork test utility to add ETH to a target address rather than overwrite its balance.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| test/fork/utils/MockCall.sol | Changes sendETH utility to increase the target balance instead of replacing it. |
| test/fork/LidoARM/ClaimStETHWithdrawalForWETH.t.sol | Adds revert test for access control and a regression test to ensure donated ETH is not wrapped. |
| src/contracts/LidoARM.sol | Adds onlyOperatorOrOwner and wraps only the net ETH received from claimWithdrawals. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| function sendETH(address target) external { | ||
| vm.deal(target, address(this).balance); | ||
| vm.deal(target, target.balance + address(this).balance); |
| external | ||
| onlyOperatorOrOwner | ||
| { | ||
| uint256 ethBalanceBefore = address(this).balance; |
Comment on lines
+174
to
+175
| uint256 ethReceived = address(this).balance - ethBalanceBefore; | ||
| if (ethReceived > 0) weth.deposit{value: ethReceived}(); |
Comment on lines
+144
to
+147
| function claimLidoWithdrawals(uint256[] calldata requestIds, uint256[] calldata hintIds) | ||
| external | ||
| onlyOperatorOrOwner | ||
| { |
| assertEq(address(lidoARM).balance, donatedETH); | ||
| assertEq(lidoARM.lidoWithdrawalQueueAmount(), DEFAULT_AMOUNT); | ||
|
|
||
| stETHWithdrawal.getLastRequestId(); |
| function test_RevertWhen_ClaimLidoWithdrawals_NotOperatorOrOwner() public asRandomAddress { | ||
| uint256[] memory emptyList = new uint256[](0); | ||
|
|
||
| vm.expectRevert("ARM: Only operator or owner can call this function."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claimLidoWithdrawalsto the configured operator or ownerFixes #241
Verification
forge build --skip test script --forceforge test --match-path test/fork/LidoARM/ClaimStETHWithdrawalForWETH.t.sol --fork-url https://ethereum.publicnode.com -vvnode_modules/.bin/hardhat.CMD compile