feat: New roles for Restaker, Bug Fixes#375
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 #683 |
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".
…Safe transaction JSON for claimable requests and integrate Utils for improved functionality
…l request management and role-based limits
…ransactions, enhance tests for EtherFiRestaker withdrawal limits
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Deploy script missing fourth constructor argument for rateLimiter
- Added ETHERFI_RATE_LIMITER as the fourth argument in the deploy script's abi.encode call to match the EtherFiRestaker constructor signature.
- ✅ Resolved by another fix: Deploy script missing rateLimiter constructor argument
- This bug is a duplicate of bug 551a8061 and was resolved by the same fix that added ETHERFI_RATE_LIMITER to the constructor arguments.
Or push these changes by commenting:
@cursor push 4c4748d125
Preview (4c4748d125)
diff --git a/script/upgrades/restaker-roles/deploy.s.sol b/script/upgrades/restaker-roles/deploy.s.sol
--- a/script/upgrades/restaker-roles/deploy.s.sol
+++ b/script/upgrades/restaker-roles/deploy.s.sol
@@ -9,7 +9,7 @@
* @title DeployEtherFiRestakerWithRoles
* @notice Deploys the new EtherFiRestaker implementation with per-function RoleRegistry roles
*
- * Constructor now takes a third arg: _roleRegistry
+ * Constructor now takes a fourth arg: _rateLimiter
*
* Command:
* forge script script/upgrades/restaker-roles/deploy.s.sol --fork-url $MAINNET_RPC_URL -vvvv
@@ -32,7 +32,8 @@
bytes memory constructorArgs = abi.encode(
EIGENLAYER_REWARDS_COORDINATOR,
ETHERFI_REDEMPTION_MANAGER,
- ROLE_REGISTRY
+ ROLE_REGISTRY,
+ ETHERFI_RATE_LIMITER
);
bytes memory bytecode = abi.encodePacked(
type(EtherFiRestaker).creationCode,This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
…psulate withdrawal logic
…stakerRoles, update gas stipend for ETH transfers
…itate large stETH redemptions, including transaction scheduling and execution JSON files
…lesTransactions with fork tests for role-based access control and redemption manager configuration
…ount instead of requested amount, ensuring accurate share calculations and referral emissions
… redemption, ensuring efficient fund management
…ociated test scripts to streamline project structure
…implify access control
… limiter and associated tests for improved rate limiting functionality
…ered withdrawal and request consolidation. kept for easier reference
…ed redemption tracking
…plementation and enhance stETH funding logic for improved testing efficiency
…or consistency and clarity
…tions for deployment and upgrade verification
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| bytes32 bufferedEtherPos = keccak256("lido.Lido.bufferedEther"); | ||
|
|
||
| // AragonOS mapping lookup: keccak256(encodePacked(key, position)) | ||
| bytes32 accountSlot = keccak256(abi.encodePacked(to, sharesMapPos)); |
There was a problem hiding this comment.
Wrong storage slot computation in _dealStETH helper
Medium Severity
The _dealStETH function uses abi.encodePacked(to, sharesMapPos) to compute the AragonOS shares mapping slot, producing a 52-byte hash input (20-byte address + 32-byte position). AragonOS's getStorageMapping uses assembly (mstore(0x00, key)) which left-pads the address to 32 bytes, yielding a 64-byte input — equivalent to abi.encode(to, sharesMapPos). This mismatch means vm.store writes to the wrong slot, so the restaker's stETH balance is never actually set. The testDepositIntoStrategyRateLimit fork test, which calls _dealStETH, will therefore fail or produce incorrect results, undermining upgrade verification.
…d tests for operator management and withdrawal tracking



Note
High Risk
High risk because it changes access control and rate limiting on
EtherFiRestakerwithdrawal/strategy flows and modifiesEtherFiRedemptionManagerETH transfer behavior and fee accounting, which directly impacts mainnet funds movement and upgrade execution.Overview
Introduces per-function roles and rate limiting for
EtherFiRestaker. Admin-gated stETH/EigenLayer actions (stEthRequestWithdrawal,stEthClaimWithdrawals,queueWithdrawals,completeQueuedWithdrawals,depositIntoStrategy) now require specificRoleRegistryroles and consume from newEtherFiRateLimiterbuckets; the restaker constructor adds immutableroleRegistry/rateLimiter, and a newredelegatehelper is added.Tightens redemption and referral edge cases.
EtherFiRedemptionManagerincreases the ETH transfer gas stipend (10k→100k) and sweeps any residual eETH dust to treasury, updating theRedeemedevent fee field accordingly;LiquidRefernow handles fee-on-transfer tokens by using the actual received amount and makespermitbest-effort.Adds upgrade/ops automation and updates tests/config. New scripts deploy/execute a timelock batch upgrade (including role grants and rate limiter setup) and generate Safe JSONs; the stETH-claim ops script also outputs Safe JSON. Tests are updated for the new constructor/roles/limiters, add coverage for
redelegateand limiter behavior, adjust redemption liquidity expectations, and temporarily skip some fork tests;foundry.tomlconsolidatesfs_permissionsfor scripts.Reviewed by Cursor Bugbot for commit df5cede. Bugbot is set up for automated code reviews on this repo. Configure here.