11// SPDX-License-Identifier: BUSL-1.1
22pragma solidity ^ 0.8.27 ;
33
4- import {Test} from "forge-std/Test.sol " ;
54import {ProxyAdmin} from "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol " ;
65import {TransparentUpgradeableProxy} from
76 "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol " ;
@@ -17,12 +16,11 @@ import {ITaskAVSRegistrarBaseTypes} from "../../src/interfaces/ITaskAVSRegistrar
1716import {ITaskAVSRegistrarBaseErrors} from "../../src/interfaces/ITaskAVSRegistrarBase.sol " ;
1817import {ITaskAVSRegistrarBaseEvents} from "../../src/interfaces/ITaskAVSRegistrarBase.sol " ;
1918import {MockTaskAVSRegistrar} from "../mocks/MockTaskAVSRegistrar.sol " ;
20- import {AllocationManagerMock} from "../mocks/AllocationManagerMock.sol " ;
21- import {KeyRegistrarMock} from "../mocks/KeyRegistrarMock.sol " ;
19+ import {MockEigenLayerDeployer} from "./middlewareV2/MockDeployer.sol " ;
2220
2321// Base test contract with common setup
2422contract TaskAVSRegistrarBaseUnitTests is
25- Test ,
23+ MockEigenLayerDeployer ,
2624 ITaskAVSRegistrarBaseTypes ,
2725 ITaskAVSRegistrarBaseErrors ,
2826 ITaskAVSRegistrarBaseEvents
@@ -32,10 +30,6 @@ contract TaskAVSRegistrarBaseUnitTests is
3230 address public owner = address (0x4 );
3331 address public nonOwner = address (0x5 );
3432
35- // Mock contracts
36- AllocationManagerMock public allocationManager;
37- KeyRegistrarMock public keyRegistrar;
38-
3933 // Test operator set IDs
4034 uint32 public constant AGGREGATOR_OPERATOR_SET_ID = 1 ;
4135 uint32 public constant EXECUTOR_OPERATOR_SET_ID_1 = 2 ;
@@ -44,20 +38,19 @@ contract TaskAVSRegistrarBaseUnitTests is
4438
4539 // Contract under test
4640 MockTaskAVSRegistrar public registrar;
47- ProxyAdmin public proxyAdmin;
4841
4942 function setUp () public virtual {
50- // Deploy mock contracts
51- allocationManager = new AllocationManagerMock ();
52- keyRegistrar = new KeyRegistrarMock ();
43+ // Deploy mock EigenLayer contracts
44+ _deployMockEigenLayer ();
5345
5446 // Create initial valid config
5547 AvsConfig memory initialConfig = _createValidAvsConfig ();
5648
5749 // Deploy the registrar with proxy pattern
58- proxyAdmin = new ProxyAdmin ();
5950 MockTaskAVSRegistrar registrarImpl = new MockTaskAVSRegistrar (
60- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
51+ IAllocationManager (address (allocationManagerMock)),
52+ IKeyRegistrar (address (keyRegistrarMock)),
53+ permissionController
6154 );
6255 TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy (
6356 address (registrarImpl),
@@ -139,7 +132,9 @@ contract TaskAVSRegistrarBaseUnitTests_Constructor is TaskAVSRegistrarBaseUnitTe
139132 // Deploy new registrar with proxy pattern
140133 ProxyAdmin newProxyAdmin = new ProxyAdmin ();
141134 MockTaskAVSRegistrar newRegistrarImpl = new MockTaskAVSRegistrar (
142- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
135+ IAllocationManager (address (allocationManagerMock)),
136+ IKeyRegistrar (address (keyRegistrarMock)),
137+ permissionController
143138 );
144139 TransparentUpgradeableProxy newProxy = new TransparentUpgradeableProxy (
145140 address (newRegistrarImpl),
@@ -169,7 +164,9 @@ contract TaskAVSRegistrarBaseUnitTests_Constructor is TaskAVSRegistrarBaseUnitTe
169164 // Deploy implementation
170165 ProxyAdmin newProxyAdmin = new ProxyAdmin ();
171166 MockTaskAVSRegistrar newRegistrarImpl = new MockTaskAVSRegistrar (
172- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
167+ IAllocationManager (address (allocationManagerMock)),
168+ IKeyRegistrar (address (keyRegistrarMock)),
169+ permissionController
173170 );
174171
175172 // Expect event during initialization
@@ -190,7 +187,9 @@ contract TaskAVSRegistrarBaseUnitTests_Constructor is TaskAVSRegistrarBaseUnitTe
190187 // Deploy implementation
191188 ProxyAdmin newProxyAdmin = new ProxyAdmin ();
192189 MockTaskAVSRegistrar newRegistrarImpl = new MockTaskAVSRegistrar (
193- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
190+ IAllocationManager (address (allocationManagerMock)),
191+ IKeyRegistrar (address (keyRegistrarMock)),
192+ permissionController
194193 );
195194
196195 // Expect revert during initialization
@@ -208,7 +207,9 @@ contract TaskAVSRegistrarBaseUnitTests_Constructor is TaskAVSRegistrarBaseUnitTe
208207 // Deploy implementation
209208 ProxyAdmin newProxyAdmin = new ProxyAdmin ();
210209 MockTaskAVSRegistrar newRegistrarImpl = new MockTaskAVSRegistrar (
211- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
210+ IAllocationManager (address (allocationManagerMock)),
211+ IKeyRegistrar (address (keyRegistrarMock)),
212+ permissionController
212213 );
213214
214215 // Expect revert during initialization
@@ -226,7 +227,9 @@ contract TaskAVSRegistrarBaseUnitTests_Constructor is TaskAVSRegistrarBaseUnitTe
226227 // Deploy implementation
227228 ProxyAdmin newProxyAdmin = new ProxyAdmin ();
228229 MockTaskAVSRegistrar newRegistrarImpl = new MockTaskAVSRegistrar (
229- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
230+ IAllocationManager (address (allocationManagerMock)),
231+ IKeyRegistrar (address (keyRegistrarMock)),
232+ permissionController
230233 );
231234
232235 // Expect revert during initialization
@@ -244,7 +247,9 @@ contract TaskAVSRegistrarBaseUnitTests_Constructor is TaskAVSRegistrarBaseUnitTe
244247 // Deploy implementation
245248 ProxyAdmin newProxyAdmin = new ProxyAdmin ();
246249 MockTaskAVSRegistrar newRegistrarImpl = new MockTaskAVSRegistrar (
247- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
250+ IAllocationManager (address (allocationManagerMock)),
251+ IKeyRegistrar (address (keyRegistrarMock)),
252+ permissionController
248253 );
249254
250255 // Expect revert during initialization
@@ -416,7 +421,9 @@ contract TaskAVSRegistrarBaseUnitTests_Upgradeable is TaskAVSRegistrarBaseUnitTe
416421 function test_Implementation_CannotBeInitialized () public {
417422 // Deploy a new implementation
418423 MockTaskAVSRegistrar newImpl = new MockTaskAVSRegistrar (
419- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
424+ IAllocationManager (address (allocationManagerMock)),
425+ IKeyRegistrar (address (keyRegistrarMock)),
426+ permissionController
420427 );
421428
422429 // Try to initialize the implementation directly, should revert
@@ -438,7 +445,9 @@ contract TaskAVSRegistrarBaseUnitTests_Upgradeable is TaskAVSRegistrarBaseUnitTe
438445
439446 // Deploy new implementation (could have new functions/logic)
440447 MockTaskAVSRegistrar newImpl = new MockTaskAVSRegistrar (
441- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
448+ IAllocationManager (address (allocationManagerMock)),
449+ IKeyRegistrar (address (keyRegistrarMock)),
450+ permissionController
442451 );
443452
444453 // Upgrade proxy to new implementation
@@ -463,7 +472,9 @@ contract TaskAVSRegistrarBaseUnitTests_Upgradeable is TaskAVSRegistrarBaseUnitTe
463472
464473 // Deploy new implementation
465474 MockTaskAVSRegistrar newImpl = new MockTaskAVSRegistrar (
466- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
475+ IAllocationManager (address (allocationManagerMock)),
476+ IKeyRegistrar (address (keyRegistrarMock)),
477+ permissionController
467478 );
468479
469480 // Try to upgrade from non-owner, should revert
@@ -511,7 +522,9 @@ contract TaskAVSRegistrarBaseUnitTests_Upgradeable is TaskAVSRegistrarBaseUnitTe
511522
512523 // Deploy new implementation
513524 MockTaskAVSRegistrar newImpl = new MockTaskAVSRegistrar (
514- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
525+ IAllocationManager (address (allocationManagerMock)),
526+ IKeyRegistrar (address (keyRegistrarMock)),
527+ permissionController
515528 );
516529
517530 // Upgrade
@@ -540,8 +553,9 @@ contract TaskAVSRegistrarBaseUnitTests_Upgradeable is TaskAVSRegistrarBaseUnitTe
540553 TransparentUpgradeableProxy uninitializedProxy = new TransparentUpgradeableProxy (
541554 address (
542555 new MockTaskAVSRegistrar (
543- IAllocationManager (address (allocationManager)),
544- IKeyRegistrar (address (keyRegistrar))
556+ IAllocationManager (address (allocationManagerMock)),
557+ IKeyRegistrar (address (keyRegistrarMock)),
558+ permissionController
545559 )
546560 ),
547561 address (new ProxyAdmin ()),
@@ -564,7 +578,9 @@ contract TaskAVSRegistrarBaseUnitTests_Upgradeable is TaskAVSRegistrarBaseUnitTe
564578 function test_DisableInitializers_InImplementation () public {
565579 // This test verifies that the implementation contract has initializers disabled
566580 MockTaskAVSRegistrar impl = new MockTaskAVSRegistrar (
567- IAllocationManager (address (allocationManager)), IKeyRegistrar (address (keyRegistrar))
581+ IAllocationManager (address (allocationManagerMock)),
582+ IKeyRegistrar (address (keyRegistrarMock)),
583+ permissionController
568584 );
569585
570586 // Try to initialize the implementation, should revert
0 commit comments