feat: Deposit Adapter new functions, New roles for Restaker#375
feat: Deposit Adapter new functions, New roles for Restaker#375pankajjagtapp wants to merge 9 commits intomasterfrom
Conversation
…ons in EtherFiRestaker
…ade with role-based access control
…ter, enhance EtherFiRestaker with role management
…g the wstETH variable directly
…in DepositAdapterTest
…hs and remove unnecessary entries
📊 Forge Coverage ReportGenerated by workflow run #673 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2afe3b8ad6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| EtherFiRestaker restaker = EtherFiRestaker(payable(ETHERFI_RESTAKER)); | ||
| bytes32 claimRole = restaker.ETHERFI_RESTAKER_STETH_CLAIM_WITHDRAWALS_ROLE(); | ||
| bytes32 requestRole = restaker.ETHERFI_RESTAKER_STETH_REQUEST_WITHDRAWAL_ROLE(); | ||
| bytes32 queueRole = restaker.ETHERFI_RESTAKER_QUEUE_WITHDRAWALS_ROLE(); | ||
| bytes32 completeRole = restaker.ETHERFI_RESTAKER_COMPLETE_QUEUED_WITHDRAWALS_ROLE(); | ||
| bytes32 depositRole = restaker.ETHERFI_RESTAKER_DEPOSIT_INTO_STRATEGY_ROLE(); |
There was a problem hiding this comment.
Compute restaker role IDs without calling the old proxy
executeUpgrade() reads ETHERFI_RESTAKER_*_ROLE() from ETHERFI_RESTAKER before the upgrade is scheduled. On mainnet that proxy still points at the pre-upgrade implementation, and these getters are only introduced by this commit in src/EtherFiRestaker.sol:34-38, so the first call here reverts and the script never writes the Safe payloads or runs the fork simulation.
Useful? React with 👍 / 👎.
| function stEthClaimWithdrawals(uint256[] calldata _requestIds, uint256[] calldata _hints) external { | ||
| if (!roleRegistry.hasRole(ETHERFI_RESTAKER_STETH_CLAIM_WITHDRAWALS_ROLE, msg.sender)) revert IncorrectRole(); | ||
| lidoWithdrawalQueue.claimWithdrawals(_requestIds, _hints); | ||
|
|
||
| withdrawEther(); |
There was a problem hiding this comment.
Let claim-role operators finish the withdrawal flow
stEthClaimWithdrawals now gates entry on ETHERFI_RESTAKER_STETH_CLAIM_WITHDRAWALS_ROLE, but it immediately calls withdrawEther(), which still enforces the legacy onlyAdmin path in src/EtherFiRestaker.sol:167-170. In the role-based setup added by this PR, any account that is granted only the new claim role (for example via script/upgrades/restaker-roles/transactions.s.sol:105-114) will still revert here, so the new role cannot actually be used unless the caller is also in the old admins mapping.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| /// @param _hints checkpoint hint for each id. Can be obtained with `findCheckpointHints()` | ||
| function stEthClaimWithdrawals(uint256[] calldata _requestIds, uint256[] calldata _hints) external onlyAdmin { | ||
| function stEthClaimWithdrawals(uint256[] calldata _requestIds, uint256[] calldata _hints) external { | ||
| if (!roleRegistry.hasRole(ETHERFI_RESTAKER_STETH_CLAIM_WITHDRAWALS_ROLE, msg.sender)) revert IncorrectRole(); |
There was a problem hiding this comment.
stEthClaimWithdrawals breaks due to onlyAdmin on withdrawEther
High Severity
stEthClaimWithdrawals was migrated from onlyAdmin to role-based access via roleRegistry.hasRole, but it internally calls withdrawEther() which still carries the onlyAdmin modifier. A caller who holds ETHERFI_RESTAKER_STETH_CLAIM_WITHDRAWALS_ROLE but is not in the admins mapping (and is not the owner) will have their transaction revert. The tests don't catch this because alice is both granted the role and set as admin in test setup.
Additional Locations (1)
| bytes32 requestRole = restaker.ETHERFI_RESTAKER_STETH_REQUEST_WITHDRAWAL_ROLE(); | ||
| bytes32 queueRole = restaker.ETHERFI_RESTAKER_QUEUE_WITHDRAWALS_ROLE(); | ||
| bytes32 completeRole = restaker.ETHERFI_RESTAKER_COMPLETE_QUEUED_WITHDRAWALS_ROLE(); | ||
| bytes32 depositRole = restaker.ETHERFI_RESTAKER_DEPOSIT_INTO_STRATEGY_ROLE(); |
There was a problem hiding this comment.
Script reads new role constants from pre-upgrade proxy
Medium Severity
executeUpgrade() reads the new role constants (e.g. ETHERFI_RESTAKER_STETH_CLAIM_WITHDRAWALS_ROLE) by calling them on the proxy at ETHERFI_RESTAKER (lines 92–97), but this runs before the upgrade is applied. The proxy still delegates to the old implementation, which doesn't define these constants. The call will revert, preventing the script from generating Safe transactions or testing the upgrade on fork. The values are deterministic keccak256 hashes and could be computed locally instead.
…Safe transaction JSON for claimable requests and integrate Utils for improved functionality


Note
High Risk
High risk because it changes access control for
EtherFiRestakeroperational methods (stETH withdrawal lifecycle and EigenLayer restaking flows) and requires a coordinated on-chain upgrade + role grants; misconfiguration could block operations or open unintended access.Overview
EtherFiRestakernow uses per-function RoleRegistry roles: adds an immutableroleRegistry, defines new role constants, and replacesonlyAdmingating onstEthRequestWithdrawal,stEthClaimWithdrawals,queueWithdrawals,completeQueuedWithdrawals, anddepositIntoStrategywithroleRegistry.hasRole(...)checks (reverting withIncorrectRole). Constructor signature is updated to include theRoleRegistryaddress.Adds upgrade tooling to deploy the new restaker implementation and to schedule/execute a timelock batch that upgrades the proxy and grants the new roles to
ETHERFI_OPERATING_ADMIN(with Safe JSON output). Operational stETH-claim script is updated to auto-generate a Safe transaction JSON, and tests are updated to construct the new restaker implementation and grant roles in setup;DepositAdaptertests now upgrade the adapter to the latest implementation and cover the “approve then call permit-variant” path. Foundryfs_permissionsare simplified to a single./script/operationsread-write entry.Written by Cursor Bugbot for commit 8ff8bc6. This will update automatically on new commits. Configure here.