Skip to content

Commit a70179d

Browse files
JuArceentropidelicuri-99MauroToscanoMarcosNicolau
authored
chore: implement pausable in ServiceManager (#481)
Co-authored-by: Mariano A. Nicolini <[email protected]> Co-authored-by: Urix <[email protected]> Co-authored-by: MauroFab <[email protected]> Co-authored-by: Marcos Nicolau <[email protected]>
1 parent dbb5335 commit a70179d

22 files changed

+2954
-2137
lines changed

Makefile

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,29 @@ anvil_upgrade_add_aggregator:
9494
@echo "Adding Aggregator to Aligned Contracts..."
9595
. contracts/scripts/anvil/upgrade_add_aggregator_to_service_manager.sh
9696

97+
pause_all_aligned_service_manager:
98+
@echo "Pausing all contracts..."
99+
. contracts/scripts/pause_aligned_service_manager.sh all
100+
101+
unpause_all_aligned_service_manager:
102+
@echo "Pausing all contracts..."
103+
. contracts/scripts/unpause_aligned_service_manager.sh all
104+
105+
get_paused_state_aligned_service_manager:
106+
@echo "Getting paused state of Aligned Service Manager contract..."
107+
. contracts/scripts/get_paused_state_aligned_service_manager.sh
108+
109+
pause_batcher_payment_service:
110+
@echo "Pausing BatcherPayments contract..."
111+
. contracts/scripts/pause_batcher_payment_service.sh
112+
113+
unpause_batcher_payment_service:
114+
@echo "Unpausing BatcherPayments contract..."
115+
. contracts/scripts/unpause_batcher_payment_service.sh
116+
117+
get_paused_state_batcher_payments_service:
118+
@echo "Getting paused state of Batcher Payments Service contract..."
119+
. contracts/scripts/get_paused_state_batcher_payments_service.sh
97120
anvil_upgrade_initialize_disable_verifiers:
98121
@echo "Initializing disabled verifiers..."
99122
. contracts/scripts/anvil/upgrade_disabled_verifiers_in_service_manager.sh
@@ -453,10 +476,18 @@ deploy_aligned_contracts: ## Deploy Aligned Contracts
453476
@echo "Deploying Aligned Contracts..."
454477
@. contracts/scripts/.env && . contracts/scripts/deploy_aligned_contracts.sh
455478

479+
deploy_pauser_registry: ## Deploy Pauser Registry
480+
@echo "Deploying Pauser Registry..."
481+
@. contracts/scripts/.env && . contracts/scripts/deploy_pauser_registry.sh
482+
456483
upgrade_aligned_contracts: ## Upgrade Aligned Contracts
457484
@echo "Upgrading Aligned Contracts..."
458485
@. contracts/scripts/.env && . contracts/scripts/upgrade_aligned_contracts.sh
459486

487+
upgrade_pauser_aligned_contracts: ## Upgrade Aligned Contracts with Pauser initialization
488+
@echo "Upgrading Aligned Contracts with Pauser initialization..."
489+
@. contracts/scripts/.env && . contracts/scripts/upgrade_add_pausable_to_service_manager.sh
490+
460491
upgrade_registry_coordinator: ## Upgrade Registry Coordinator
461492
@echo "Upgrading Registry Coordinator..."
462493
@. contracts/scripts/.env && . contracts/scripts/upgrade_registry_coordinator.sh
@@ -977,11 +1008,11 @@ open_telemetry_prod_start: ## Run open telemetry services with Cassandra using t
9771008
# Elixir API
9781009
telemetry_start: telemetry_run_db telemetry_ecto_migrate ## Run Telemetry API
9791010
@cd telemetry_api && \
980-
./start.sh
1011+
./start.sh
9811012

9821013
telemetry_ecto_migrate: ##
9831014
@cd telemetry_api && \
984-
./ecto_setup_db.sh
1015+
./ecto_setup_db.sh
9851016

9861017
telemetry_build_db:
9871018
@cd telemetry_api && \

batcher/aligned-sdk/src/sdk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ pub async fn submit_multiple(
261261

262262
pub fn get_payment_service_address(network: Network) -> ethers::types::H160 {
263263
match network {
264-
Network::Devnet => H160::from_str("0x7969c5eD335650692Bc04293B07F5BF2e7A673C0").unwrap(),
264+
Network::Devnet => H160::from_str("0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650").unwrap(),
265265
Network::Holesky => H160::from_str("0x815aeCA64a974297942D2Bbf034ABEe22a38A003").unwrap(),
266266
Network::HoleskyStage => {
267267
H160::from_str("0x7577Ec4ccC1E6C529162ec8019A49C13F6DAd98b").unwrap()

contracts/script/deploy/AlignedLayerDeployer.s.sol

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
3131
ProxyAdmin public alignedLayerProxyAdmin;
3232
address public alignedLayerOwner;
3333
address public alignedLayerUpgrader;
34-
address public pauser;
34+
address public alignedLayerPauser;
3535
uint256 public initalPausedStatus;
3636
address public deployer;
3737
address public alignedLayerAggregator;
@@ -43,6 +43,7 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
4343
StakeRegistry public stakeRegistry;
4444
OperatorStateRetriever public operatorStateRetriever;
4545
ServiceManagerRouter public serviceManagerRouter;
46+
PauserRegistry public pauserRegistry;
4647

4748
BLSApkRegistry public apkRegistryImplementation;
4849
AlignedLayerServiceManager public alignedLayerServiceManagerImplementation;
@@ -87,7 +88,10 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
8788
".permissions.initalPausedStatus"
8889
);
8990

90-
pauser = address(eigenLayerPauserReg);
91+
alignedLayerPauser = stdJson.readAddress(
92+
config_data,
93+
".permissions.pauser"
94+
);
9195

9296
deployer = stdJson.readAddress(config_data, ".permissions.deployer");
9397
require(
@@ -106,6 +110,13 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
106110
// deploy proxy admin for ability to upgrade proxy contracts
107111
alignedLayerProxyAdmin = new ProxyAdmin();
108112

113+
//deploy pauser registry
114+
{
115+
address[] memory pausers = new address[](1);
116+
pausers[0] = alignedLayerPauser;
117+
pauserRegistry = new PauserRegistry(pausers, alignedLayerPauser); // (pausers, unpauser)
118+
}
119+
109120
//deploy service manager router
110121
serviceManagerRouter = new ServiceManagerRouter();
111122

@@ -222,7 +233,7 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
222233
alignedLayerOwner,
223234
churner,
224235
ejector,
225-
IPauserRegistry(pauser),
236+
pauserRegistry,
226237
initalPausedStatus,
227238
operatorSetParams,
228239
minimumStakeForQuourm,
@@ -249,7 +260,9 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
249260
AlignedLayerServiceManager.initialize.selector,
250261
deployer,
251262
deployer,
252-
alignedLayerAggregator
263+
alignedLayerAggregator,
264+
pauserRegistry,
265+
initalPausedStatus
253266
)
254267
);
255268

@@ -320,19 +333,28 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
320333
config_data,
321334
".permissions.upgrader"
322335
);
336+
alignedLayerPauser = stdJson.readAddress(
337+
config_data,
338+
".permissions.pauser"
339+
);
323340
initalPausedStatus = stdJson.readUint(
324341
config_data,
325342
".permissions.initalPausedStatus"
326343
);
327344

328-
pauser = address(eigenLayerPauserReg);
329-
330345
deployer = stdJson.readAddress(config_data, ".permissions.deployer");
331346
vm.startPrank(deployer);
332347

333348
// deploy proxy admin for ability to upgrade proxy contracts
334349
alignedLayerProxyAdmin = new ProxyAdmin();
335350

351+
//deploy pauser registry
352+
{
353+
address[] memory pausers = new address[](1);
354+
pausers[0] = alignedLayerPauser;
355+
pauserRegistry = new PauserRegistry(pausers, alignedLayerPauser); // (pausers, unpauser)
356+
}
357+
336358
//deploy service manager router
337359
serviceManagerRouter = new ServiceManagerRouter();
338360

@@ -449,7 +471,7 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
449471
alignedLayerOwner,
450472
churner,
451473
ejector,
452-
IPauserRegistry(pauser),
474+
pauserRegistry,
453475
initalPausedStatus,
454476
operatorSetParams,
455477
minimumStakeForQuourm,
@@ -475,7 +497,9 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
475497
abi.encodeWithSelector(
476498
AlignedLayerServiceManager.initialize.selector,
477499
deployer,
478-
deployer
500+
deployer,
501+
pauserRegistry,
502+
initalPausedStatus
479503
)
480504
);
481505

@@ -632,8 +656,16 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
632656
alignedLayerServiceManager.owner() == alignedLayerOwner,
633657
"alignedLayerServiceManager.owner() != alignedLayerOwner"
634658
);
635-
// require(alignedLayerServiceManager.pauserRegistry() == IPauserRegistry(pauser), "alignedLayerServiceManager: pauser registry not set correctly");
636-
// require(alignedLayerServiceManager.paused() == initalPausedStatus, "alignedLayerServiceManager: init paused status set incorrectly");
659+
660+
require(
661+
alignedLayerServiceManager.pauserRegistry() == IPauserRegistry(pauserRegistry),
662+
"alignedLayerServiceManager: pauser registry not set correctly"
663+
);
664+
require(
665+
alignedLayerServiceManager.paused() == initalPausedStatus,
666+
"alignedLayerServiceManager: init paused status set incorrectly"
667+
);
668+
637669

638670
require(
639671
registryCoordinator.owner() == alignedLayerOwner,
@@ -648,7 +680,7 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
648680
"registryCoordinator.ejector() != ejector"
649681
);
650682
require(
651-
registryCoordinator.pauserRegistry() == IPauserRegistry(pauser),
683+
registryCoordinator.pauserRegistry() == pauserRegistry,
652684
"registryCoordinator: pauser registry not set correctly"
653685
);
654686
require(
@@ -777,6 +809,11 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
777809
"serviceManagerRouter",
778810
address(serviceManagerRouter)
779811
);
812+
vm.serializeAddress(
813+
deployed_addresses,
814+
"pauserRegistry",
815+
address(pauserRegistry)
816+
);
780817
string memory deployed_addresses_output = vm.serializeAddress(
781818
deployed_addresses,
782819
"stakeRegistryImplementation",
@@ -799,10 +836,17 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
799836
config_data,
800837
".permissions.ejector"
801838
);
802-
address alignedLayerAggregator = stdJson.readAddress(
839+
840+
alignedLayerAggregator = stdJson.readAddress(
803841
config_data,
804842
".permissions.aggregator"
805843
);
844+
845+
address pauserAddress = stdJson.readAddress(
846+
config_data,
847+
".permissions.pauser"
848+
);
849+
806850
string memory permissions = "permissions";
807851
vm.serializeAddress(
808852
permissions,
@@ -815,9 +859,7 @@ contract AlignedLayerDeployer is ExistingDeploymentParser {
815859
alignedLayerUpgrader
816860
);
817861
vm.serializeAddress(permissions, "alignedLayerChurner", churner);
818-
819-
vm.serializeAddress(permissions, "pauserRegistry", pauser);
820-
862+
vm.serializeAddress(permissions, "alignedLayerPauser", pauserAddress);
821863
vm.serializeAddress(permissions, "alignedLayerAggregator", alignedLayerAggregator);
822864

823865
string memory permissions_output = vm.serializeAddress(
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity =0.8.12;
3+
4+
import {PauserRegistry} from "eigenlayer-core/contracts/permissions/PauserRegistry.sol";
5+
6+
import "script/deploy/utils/ExistingDeploymentParser.sol";
7+
import "forge-std/Test.sol";
8+
import "forge-std/Script.sol";
9+
import "forge-std/StdJson.sol";
10+
11+
// This script is only for deploying the PauserRegistry contract
12+
// In order to avoid redeploying previously deployed contracts, we will use the deployed contract addresses
13+
contract PauserRegistryDeployer is ExistingDeploymentParser {
14+
address public pauser;
15+
uint256 public initalPausedStatus;
16+
address public deployer;
17+
18+
PauserRegistry public pauserRegistry;
19+
20+
function run(
21+
string memory existingDeploymentInfoPath,
22+
string memory deployConfigPath,
23+
string memory outputPath
24+
) external returns (address, address) {
25+
// get info on all the already-deployed contracts
26+
_parseDeployedContracts(existingDeploymentInfoPath);
27+
28+
// READ JSON CONFIG DATA
29+
string memory config_data = vm.readFile(deployConfigPath);
30+
31+
// check that the chainID matches the one in the config
32+
uint256 currentChainId = block.chainid;
33+
uint256 configChainId = stdJson.readUint(
34+
config_data,
35+
".chainInfo.chainId"
36+
);
37+
emit log_named_uint("You are deploying on ChainID", currentChainId);
38+
require(
39+
configChainId == currentChainId,
40+
"You are on the wrong chain for this config"
41+
);
42+
43+
initalPausedStatus = stdJson.readUint(
44+
config_data,
45+
".permissions.initalPausedStatus"
46+
);
47+
pauser = stdJson.readAddress(
48+
config_data,
49+
".permissions.pauser"
50+
);
51+
52+
deployer = stdJson.readAddress(config_data, ".permissions.deployer");
53+
require(
54+
deployer == tx.origin,
55+
"Deployer address must be the same as the tx.origin"
56+
);
57+
emit log_named_address("You are deploying from", deployer);
58+
59+
vm.startBroadcast();
60+
61+
//deploy pauser registry
62+
{
63+
address[] memory pausers = new address[](1);
64+
pausers[0] = pauser;
65+
pauserRegistry = new PauserRegistry(pausers, pauser); // (pausers, unpauser)
66+
}
67+
68+
vm.stopPrank();
69+
70+
//write output
71+
return(address(pauserRegistry), address(pauser));
72+
}
73+
}

contracts/script/deploy/config/devnet/aligned.devnet.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"churner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
1010
"ejector": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
1111
"deployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
12+
"pauser": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
1213
"initalPausedStatus": 0
1314
},
1415
"minimumStakes": [

contracts/script/deploy/config/devnet/batcher-payment-service.devnet.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"address": {
33
"batcherWallet": "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",
44
"batcherPrivateKey": "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
5-
"alignedLayerServiceManager": "0x1613beB3B2C4f22Ee086B2b38C1476A3cE7f78E8"
5+
"alignedLayerServiceManager": "0x851356ae760d987E095750cCeb3bC6014560891C"
66
},
77
"amounts": {
88
"gasForAggregator": "300000",

contracts/script/deploy/config/holesky/aligned.holesky.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"churner": "<churner_address>",
1010
"ejector": "<ejector_address>",
1111
"deployer": "<deployer_address>",
12+
"pauser": "<pauser_address>",
1213
"initalPausedStatus": 0
1314
},
1415
"minimumStakes": [

0 commit comments

Comments
 (0)