Skip to content

Commit 69c668d

Browse files
0xClandestineypatil12
authored andcommitted
feat: split AllocationManager (#1643)
**Motivation:** The `AllocationManager` contract was hitting the 24KB bytecode size limit, which would have blocked deployment. We needed a solution to reduce the contract size while maintaining backwards compatibility with existing integrations that call view functions on `AllocationManager`. **Modifications:** - Created a new `SplitContractMixin` that uses a fallback to delegate unmatched function calls via `delegatecall` to a secondary contract - Split `AllocationManager` into two contracts: the main contract handles state-mutating operations, while `AllocationManagerView` handles all read-only view functions - Both contracts inherit from `AllocationManagerStorage` to share the same storage layout, enabling the view contract to read from the main contract's storage - Updated `AllocationManager` constructor to accept and store the `AllocationManagerView` address - Modified all deployment scripts (devnet, local, integration) to deploy both proxies and implementations - Updated `ExistingDeploymentParser`, test harnesses, and unit/integration tests to work with the split architecture **Result:** - The `AllocationManager` is now about ~ 4.8KB under the 24KB limit with room to grow. - The `AllocationManagerView` contract has 16KB of available space for future view functions. TODO: Add a ci check (I don't have privs but the code is written locally) 1) Get list of all contracts ending in View.sol in the repo. 2) Use forge inspect abi and check all mutability fields == view|pure. 3) Basic search over the file to see if sstore or delegatecall is used on a for additional sanity. --------- Co-authored-by: eigenmikem <[email protected]> squash squash feat: split alm wip wip wip wip wip wip wip unit tests passing remove extsload wip tests passing chore: git mv storage to folder wip ci docs todo cleanup ci ci rename `secondHalf` rm extsload move storage add protocol registry to zeus squash feat: split alm wip wip wip wip wip wip wip unit tests passing remove extsload wip tests passing chore: git mv storage to folder wip ci wip wip wip wip wip remove extsload wip tests passing wip passing perf: wrap modifier logic to save codesize chore: forge fmt refactor: remove semver (#1641) **Motivation:** We want to consolidate semver logic into a single purpose built contract. **Modifications:** - Removed `SemVerMixin` import from all contracts. **Result:** More codesize savings. make fmt refactor: expand `ProtocolRegistry` to list all contracts + pause rm gas snapshots rm extsload rebase ci revert eigen changes remove stale scripts
1 parent 82a9ddd commit 69c668d

File tree

65 files changed

+151
-1723
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+151
-1723
lines changed

foundry.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
]
5656
# An array of file paths from which warnings should be ignored during compilation.
5757
ignored_warnings_from = [
58-
"src/test"
58+
"src/test",
59+
"src/contracts/core/AllocationManager.sol" # TODO: Remove
5960
]
6061

6162
# Test Configuration

script/deploy/devnet/deploy_from_scratch.s.sol

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ contract DeployFromScratch is Script, Test {
224224
if (chainId == 1) ethPOSDeposit = IETHPOSDeposit(0x00000000219ab540356cBB839Cbe05303d7705Fa);
225225
// if not on mainnet, deploy a mock
226226
else ethPOSDeposit = IETHPOSDeposit(stdJson.readAddress(config_data, ".ethPOSDepositAddress"));
227-
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, SEMVER);
227+
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager);
228228

229229
eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
230230

@@ -244,7 +244,7 @@ contract DeployFromScratch is Script, Test {
244244
new StrategyManager(IAllocationManager(address(allocationManager)), delegation, eigenLayerPauserReg, SEMVER);
245245
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
246246
eigenPodManagerImplementation =
247-
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg, SEMVER);
247+
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg);
248248
rewardsCoordinatorImplementation = new RewardsCoordinator(
249249
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
250250
delegation,
@@ -256,8 +256,7 @@ contract DeployFromScratch is Script, Test {
256256
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
257257
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
258258
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
259-
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
260-
SEMVER
259+
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
261260
)
262261
);
263262
allocationManagerImplementation = new AllocationManager(
@@ -267,11 +266,11 @@ contract DeployFromScratch is Script, Test {
267266
eigenLayerPauserReg,
268267
permissionController,
269268
DEALLOCATION_DELAY,
270-
ALLOCATION_CONFIGURATION_DELAY,
271-
SEMVER
269+
ALLOCATION_CONFIGURATION_DELAY
272270
);
273-
permissionControllerImplementation = new PermissionController(SEMVER);
274-
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg, SEMVER);
271+
272+
permissionControllerImplementation = new PermissionController();
273+
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg);
275274

276275
// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
277276
{
@@ -333,7 +332,7 @@ contract DeployFromScratch is Script, Test {
333332

334333
// Deploy strategyFactory & base
335334
// Create base strategy implementation
336-
baseStrategyImplementation = new StrategyBase(strategyManager, eigenLayerPauserReg, SEMVER);
335+
baseStrategyImplementation = new StrategyBase(strategyManager, eigenLayerPauserReg);
337336

338337
// Create a proxy beacon for base strategy implementation
339338
strategyBeacon = new UpgradeableBeacon(address(baseStrategyImplementation));

script/deploy/local/deploy_from_scratch.slashing.s.sol

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ contract DeployFromScratch is Script, Test {
228228
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
229229
);
230230

231-
eigenStrategy = IStrategy(new EigenStrategy(strategyManager, eigenLayerPauserReg, SEMVER));
231+
eigenStrategy = IStrategy(new EigenStrategy(strategyManager, eigenLayerPauserReg));
232232

233233
// if on mainnet, use the ETH2 deposit contract address
234234
if (chainId == 1) ethPOSDeposit = IETHPOSDeposit(0x00000000219ab540356cBB839Cbe05303d7705Fa);
235235
// if not on mainnet, deploy a mock
236236
else ethPOSDeposit = IETHPOSDeposit(stdJson.readAddress(config_data, ".ethPOSDepositAddress"));
237-
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager, SEMVER);
237+
eigenPodImplementation = new EigenPod(ethPOSDeposit, eigenPodManager);
238238

239239
eigenPodBeacon = new UpgradeableBeacon(address(eigenPodImplementation));
240240

@@ -253,7 +253,7 @@ contract DeployFromScratch is Script, Test {
253253
new StrategyManager(IAllocationManager(address(allocationManager)), delegation, eigenLayerPauserReg, SEMVER);
254254
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
255255
eigenPodManagerImplementation =
256-
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg, SEMVER);
256+
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg);
257257
rewardsCoordinatorImplementation = new RewardsCoordinator(
258258
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
259259
delegation,
@@ -265,8 +265,7 @@ contract DeployFromScratch is Script, Test {
265265
REWARDS_COORDINATOR_MAX_REWARDS_DURATION,
266266
REWARDS_COORDINATOR_MAX_RETROACTIVE_LENGTH,
267267
REWARDS_COORDINATOR_MAX_FUTURE_LENGTH,
268-
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP,
269-
SEMVER
268+
REWARDS_COORDINATOR_GENESIS_REWARDS_TIMESTAMP
270269
)
271270
);
272271
allocationManagerImplementation = new AllocationManager(
@@ -276,10 +275,10 @@ contract DeployFromScratch is Script, Test {
276275
eigenLayerPauserReg,
277276
permissionController,
278277
DEALLOCATION_DELAY,
279-
ALLOCATION_CONFIGURATION_DELAY,
280-
SEMVER
278+
ALLOCATION_CONFIGURATION_DELAY
281279
);
282-
permissionControllerImplementation = new PermissionController(SEMVER);
280+
281+
permissionControllerImplementation = new PermissionController();
283282

284283
// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
285284
{
@@ -347,7 +346,7 @@ contract DeployFromScratch is Script, Test {
347346
);
348347

349348
// deploy StrategyBaseTVLLimits contract implementation
350-
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg, SEMVER);
349+
baseStrategyImplementation = new StrategyBaseTVLLimits(strategyManager, eigenLayerPauserReg);
351350
// create upgradeable proxies that each point to the implementation and initialize them
352351
for (uint256 i = 0; i < strategyConfigs.length; ++i) {
353352
if (strategyConfigs[i].tokenAddress == address(0)) {

script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/2-deployDestinationChainProxies.s.sol

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)