Skip to content

Commit b480b22

Browse files
committed
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
1 parent bce9cbb commit b480b22

30 files changed

+841
-349
lines changed

foundry.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"forge-std/=lib/forge-std/src/"
2323
]
2424
# Specifies the exact version of Solidity to use, overriding auto-detection.
25-
solc_version = '0.8.27'
25+
solc_version = '0.8.30'
2626
# If enabled, treats Solidity compiler warnings as errors, preventing artifact generation if warnings are present.
2727
deny_warnings = true
2828
# If set to true, changes compilation pipeline to go through the new IR optimizer.
@@ -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: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import "../../../src/contracts/core/DelegationManager.sol";
1313
import "../../../src/contracts/core/AVSDirectory.sol";
1414
import "../../../src/contracts/core/RewardsCoordinator.sol";
1515
import "../../../src/contracts/core/AllocationManager.sol";
16+
import "../../../src/contracts/core/AllocationManagerView.sol";
1617
import "../../../src/contracts/permissions/PermissionController.sol";
1718
import "../../../src/contracts/strategies/StrategyBaseTVLLimits.sol";
1819
import "../../../src/contracts/strategies/StrategyFactory.sol";
@@ -60,6 +61,8 @@ contract DeployFromScratch is Script, Test {
6061
StrategyBase public baseStrategyImplementation;
6162
AllocationManager public allocationManagerImplementation;
6263
AllocationManager public allocationManager;
64+
AllocationManagerView public allocationManagerView;
65+
AllocationManagerView public allocationManagerViewImplementation;
6366
PermissionController public permissionController;
6467
PermissionController public permissionControllerImplementation;
6568

@@ -211,6 +214,9 @@ contract DeployFromScratch is Script, Test {
211214
strategyFactory = StrategyFactory(
212215
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
213216
);
217+
allocationManagerView = AllocationManagerView(
218+
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
219+
);
214220
permissionController = PermissionController(
215221
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
216222
);
@@ -228,22 +234,23 @@ contract DeployFromScratch is Script, Test {
228234
delegationImplementation = new DelegationManager(
229235
strategyManager,
230236
eigenPodManager,
231-
allocationManager,
237+
IAllocationManager(address(allocationManager)),
232238
eigenLayerPauserReg,
233239
permissionController,
234240
MIN_WITHDRAWAL_DELAY,
235241
SEMVER
236242
);
237243

238-
strategyManagerImplementation = new StrategyManager(allocationManager, delegation, eigenLayerPauserReg, SEMVER);
244+
strategyManagerImplementation =
245+
new StrategyManager(IAllocationManager(address(allocationManager)), delegation, eigenLayerPauserReg, SEMVER);
239246
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
240247
eigenPodManagerImplementation =
241248
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg, SEMVER);
242249
rewardsCoordinatorImplementation = new RewardsCoordinator(
243250
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
244251
delegation,
245252
strategyManager,
246-
allocationManager,
253+
IAllocationManager(address(allocationManager)),
247254
eigenLayerPauserReg,
248255
permissionController,
249256
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
@@ -255,6 +262,7 @@ contract DeployFromScratch is Script, Test {
255262
)
256263
);
257264
allocationManagerImplementation = new AllocationManager(
265+
allocationManagerView,
258266
delegation,
259267
eigenStrategy,
260268
eigenLayerPauserReg,
@@ -263,6 +271,8 @@ contract DeployFromScratch is Script, Test {
263271
ALLOCATION_CONFIGURATION_DELAY,
264272
SEMVER
265273
);
274+
allocationManagerViewImplementation =
275+
new AllocationManagerView(delegation, eigenStrategy, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
266276
permissionControllerImplementation = new PermissionController(SEMVER);
267277
strategyFactoryImplementation = new StrategyFactory(strategyManager, eigenLayerPauserReg, SEMVER);
268278

@@ -319,6 +329,11 @@ contract DeployFromScratch is Script, Test {
319329
)
320330
);
321331

332+
eigenLayerProxyAdmin.upgrade(
333+
ITransparentUpgradeableProxy(payable(address(allocationManagerView))),
334+
address(allocationManagerViewImplementation)
335+
);
336+
322337
eigenLayerProxyAdmin.upgrade(
323338
ITransparentUpgradeableProxy(payable(address(permissionController))),
324339
address(permissionControllerImplementation)
@@ -480,7 +495,7 @@ contract DeployFromScratch is Script, Test {
480495
"rewardsCoordinator: strategyManager address not set correctly"
481496
);
482497
require(
483-
delegationContract.allocationManager() == allocationManager,
498+
delegationContract.allocationManager() == IAllocationManager(address(allocationManager)),
484499
"delegationManager: allocationManager address not set correctly"
485500
);
486501
require(

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import "../../../src/contracts/core/DelegationManager.sol";
1414
import "../../../src/contracts/core/AVSDirectory.sol";
1515
import "../../../src/contracts/core/RewardsCoordinator.sol";
1616
import "../../../src/contracts/core/AllocationManager.sol";
17+
import "../../../src/contracts/core/AllocationManagerView.sol";
1718
import "../../../src/contracts/permissions/PermissionController.sol";
1819

1920
import "../../../src/contracts/strategies/StrategyBaseTVLLimits.sol";
@@ -65,6 +66,8 @@ contract DeployFromScratch is Script, Test {
6566
StrategyBase public baseStrategyImplementation;
6667
AllocationManager public allocationManagerImplementation;
6768
AllocationManager public allocationManager;
69+
AllocationManagerView public allocationManagerView;
70+
AllocationManagerView public allocationManagerViewImplementation;
6871
PermissionController public permissionControllerImplementation;
6972
PermissionController public permissionController;
7073

@@ -219,6 +222,9 @@ contract DeployFromScratch is Script, Test {
219222
allocationManager = AllocationManager(
220223
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
221224
);
225+
allocationManagerView = AllocationManagerView(
226+
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
227+
);
222228
permissionController = PermissionController(
223229
address(new TransparentUpgradeableProxy(address(emptyContract), address(eigenLayerProxyAdmin), ""))
224230
);
@@ -238,21 +244,22 @@ contract DeployFromScratch is Script, Test {
238244
delegationImplementation = new DelegationManager(
239245
strategyManager,
240246
eigenPodManager,
241-
allocationManager,
247+
IAllocationManager(address(allocationManager)),
242248
eigenLayerPauserReg,
243249
permissionController,
244250
MIN_WITHDRAWAL_DELAY,
245251
SEMVER
246252
);
247-
strategyManagerImplementation = new StrategyManager(allocationManager, delegation, eigenLayerPauserReg, SEMVER);
253+
strategyManagerImplementation =
254+
new StrategyManager(IAllocationManager(address(allocationManager)), delegation, eigenLayerPauserReg, SEMVER);
248255
avsDirectoryImplementation = new AVSDirectory(delegation, eigenLayerPauserReg, SEMVER);
249256
eigenPodManagerImplementation =
250257
new EigenPodManager(ethPOSDeposit, eigenPodBeacon, delegation, eigenLayerPauserReg, SEMVER);
251258
rewardsCoordinatorImplementation = new RewardsCoordinator(
252259
IRewardsCoordinatorTypes.RewardsCoordinatorConstructorParams(
253260
delegation,
254261
strategyManager,
255-
allocationManager,
262+
IAllocationManager(address(allocationManager)),
256263
eigenLayerPauserReg,
257264
permissionController,
258265
REWARDS_COORDINATOR_CALCULATION_INTERVAL_SECONDS,
@@ -264,6 +271,7 @@ contract DeployFromScratch is Script, Test {
264271
)
265272
);
266273
allocationManagerImplementation = new AllocationManager(
274+
allocationManagerView,
267275
delegation,
268276
eigenStrategy,
269277
eigenLayerPauserReg,
@@ -272,6 +280,8 @@ contract DeployFromScratch is Script, Test {
272280
ALLOCATION_CONFIGURATION_DELAY,
273281
SEMVER
274282
);
283+
allocationManagerViewImplementation =
284+
new AllocationManagerView(delegation, eigenStrategy, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY);
275285
permissionControllerImplementation = new PermissionController(SEMVER);
276286

277287
// Third, upgrade the proxy contracts to use the correct implementation contracts and initialize them.
@@ -334,6 +344,11 @@ contract DeployFromScratch is Script, Test {
334344
)
335345
);
336346

347+
eigenLayerProxyAdmin.upgrade(
348+
ITransparentUpgradeableProxy(payable(address(allocationManagerView))),
349+
address(allocationManagerViewImplementation)
350+
);
351+
337352
eigenLayerProxyAdmin.upgrade(
338353
ITransparentUpgradeableProxy(payable(address(permissionController))),
339354
address(permissionControllerImplementation)

script/releases/Env.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ library Env {
206206
*/
207207
function allocationManager(
208208
DeployedProxy
209-
) internal view returns (AllocationManager) {
210-
return AllocationManager(_deployedProxy(type(AllocationManager).name));
209+
) internal view returns (IAllocationManager) {
210+
return IAllocationManager(_deployedProxy(type(AllocationManager).name));
211211
}
212212

213213
function allocationManager(
214214
DeployedImpl
215-
) internal view returns (AllocationManager) {
216-
return AllocationManager(_deployedImpl(type(AllocationManager).name));
215+
) internal view returns (IAllocationManager) {
216+
return IAllocationManager(_deployedImpl(type(AllocationManager).name));
217217
}
218218

219219
function avsDirectory(

script/releases/v1.7.0-v1.8.0-multichain-hourglass-combined/1-deploySourceChain.s.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ contract DeploySourceChain is EOADeployer {
2525
deployedTo: address(
2626
new KeyRegistrar({
2727
_permissionController: Env.proxy.permissionController(),
28-
_allocationManager: Env.proxy.allocationManager(),
28+
_allocationManager: IAllocationManager(address(Env.proxy.allocationManager())),
2929
_version: Env.deployVersion()
3030
})
3131
)
@@ -48,7 +48,7 @@ contract DeploySourceChain is EOADeployer {
4848
name: type(CrossChainRegistry).name,
4949
deployedTo: address(
5050
new CrossChainRegistry({
51-
_allocationManager: Env.proxy.allocationManager(),
51+
_allocationManager: IAllocationManager(address(Env.proxy.allocationManager())),
5252
_keyRegistrar: Env.proxy.keyRegistrar(),
5353
_permissionController: Env.proxy.permissionController(),
5454
_pauserRegistry: Env.impl.pauserRegistry(),

script/tasks/complete_withdrawal_from_strategy.s.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ contract CompleteWithdrawFromStrategy is Script, Test {
7575
DepositScalingFactor memory dsf = DepositScalingFactor(dm.depositScalingFactor(msg.sender, strategies[0]));
7676

7777
// Get TM for Operator in strategies
78-
uint64[] memory maxMagnitudes = am.getMaxMagnitudesAtBlock(msg.sender, strategies, startBlock);
78+
uint64[] memory maxMagnitudes =
79+
IAllocationManager(address(am)).getMaxMagnitudesAtBlock(msg.sender, strategies, startBlock);
7980
uint256 slashingFactor = _getSlashingFactor(em, msg.sender, strategies[0], maxMagnitudes[0]);
8081
uint256 sharesToWithdraw = dsf.calcWithdrawable(amount, slashingFactor);
8182

script/utils/ExistingDeploymentParser.sol

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import "../../src/contracts/core/DelegationManager.sol";
1010
import "../../src/contracts/core/AVSDirectory.sol";
1111
import "../../src/contracts/core/RewardsCoordinator.sol";
1212
import "../../src/contracts/core/AllocationManager.sol";
13+
import "../../src/contracts/core/AllocationManagerView.sol";
1314
import "../../src/contracts/permissions/PermissionController.sol";
1415

1516
import "../../src/contracts/strategies/StrategyFactory.sol";
@@ -104,8 +105,11 @@ contract ExistingDeploymentParser is Script, Logger {
104105
UpgradeableBeacon public strategyBeacon;
105106

106107
/// @dev AllocationManager
107-
AllocationManager public allocationManager;
108-
AllocationManager public allocationManagerImplementation;
108+
IAllocationManager public allocationManager;
109+
IAllocationManager public allocationManagerImplementation;
110+
111+
IAllocationManagerView public allocationManagerView;
112+
IAllocationManagerView public allocationManagerViewImplementation;
109113

110114
/// @dev AVSDirectory
111115
AVSDirectory public avsDirectory;
@@ -230,9 +234,16 @@ contract ExistingDeploymentParser is Script, Logger {
230234
);
231235

232236
// AllocationManager
233-
allocationManager = AllocationManager(json.readAddress(".addresses.allocationManager"));
237+
allocationManager = IAllocationManager(json.readAddress(".addresses.allocationManager"));
234238
allocationManagerImplementation =
235-
AllocationManager(json.readAddress(".addresses.allocationManagerImplementation"));
239+
IAllocationManager(json.readAddress(".addresses.allocationManagerImplementation"));
240+
241+
// allocationManagerView = IAllocationManagerView(json.readAddress(".addresses.allocationManagerView"));
242+
243+
// FIXME: hotfix - remove later...
244+
allocationManagerView = new AllocationManagerView(
245+
delegationManager, eigenStrategy, DEALLOCATION_DELAY, ALLOCATION_CONFIGURATION_DELAY
246+
);
236247

237248
// AVSDirectory
238249
avsDirectory = AVSDirectory(json.readAddress(".addresses.avsDirectory"));

src/contracts/core/AVSDirectory.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import "@openzeppelin-upgrades/contracts/security/ReentrancyGuardUpgradeable.sol
77

88
import "../mixins/SignatureUtilsMixin.sol";
99
import "../permissions/Pausable.sol";
10-
import "./AVSDirectoryStorage.sol";
10+
import "./storage/AVSDirectoryStorage.sol";
1111

1212
contract AVSDirectory is
1313
Initializable,

0 commit comments

Comments
 (0)