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 #682 |
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
...operations/steth-management/redemption-manager-token-params/configureRedemptionManager.s.sol
Outdated
Show resolved
Hide resolved
…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.



Note
High Risk
High risk because it changes on-chain authorization and rate limiting for
EtherFiRestakerwithdrawal/strategy flows and modifiesEtherFiRedemptionManagerETH transfer semantics and fee accounting, impacting core fund movement paths.Overview
Restaker access control is tightened and made granular.
EtherFiRestakerreplacesonlyAdmingating onstEthRequestWithdrawal,stEthClaimWithdrawals,queueWithdrawals,completeQueuedWithdrawals, anddepositIntoStrategywith per-functionRoleRegistrychecks (new role constants), and enforces per-action limits viaIEtherFiRateLimiterbuckets.Redemption reliability and accounting are adjusted.
EtherFiRedemptionManagerincreases the ETH transfer gas stipend (10k→100k), sweeps residual eETH “dust” to treasury, and updates theRedeemedevent to reflect treasury fee + dust.Operational tooling is expanded. Adds new
restaker-rolesdeployment/upgrade scripts that generate Safe JSON for scheduling/executing a timelock batch (including role grants and rate-limiter setup), enhances the stETH claim operations script to auto-generate Safe JSON, updates bytecode verification scripts/tests for the new Restaker constructor args, and adjusts/extends fork tests (including skipping some flaky mainnet-fork tests).Written by Cursor Bugbot for commit 9e71bb9. This will update automatically on new commits. Configure here.