Skip to content

Commit

Permalink
differentiate private keys in pausable docs and add script for checki…
Browse files Browse the repository at this point in the history
…ng pausable state of batcher payments service contract
  • Loading branch information
entropidelic committed Oct 14, 2024
1 parent 015f10b commit b94224d
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 27 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ unpause_all_aligned_service_manager:
. contracts/scripts/unpause_aligned_service_manager.sh all

get_paused_state_aligned_service_manager:
@echo "Getting paused state of all contracts..."
@echo "Getting paused state of Aligned Service Manager contract..."
. contracts/scripts/get_paused_state_aligned_service_manager.sh

pause_batcher_payment_service:
Expand All @@ -105,6 +105,10 @@ unpause_batcher_payment_service:
@echo "Unpausing BatcherPayments contract..."
. contracts/scripts/unpause_batcher_payment_service.sh

get_paused_state_batcher_payments_service:
@echo "Getting paused state of Batcher Payments Service contract..."
. contracts/scripts/get_paused_state_batcher_payments_service.sh

lint_contracts:
@cd contracts && npm run lint:sol

Expand Down Expand Up @@ -697,11 +701,11 @@ open_telemetry_start: ## Run open telemetry services using telemetry-docker-comp

telemetry_start: telemetry_run_db telemetry_ecto_migrate ## Run Telemetry API
@cd telemetry_api && \
./start.sh
./start.sh

telemetry_ecto_migrate: ##
@cd telemetry_api && \
./ecto_setup_db.sh
./ecto_setup_db.sh

telemetry_build_db:
@cd telemetry_api && \
Expand Down
2 changes: 1 addition & 1 deletion contracts/lib/eigenlayer-middleware
4 changes: 2 additions & 2 deletions contracts/scripts/get_paused_state_aligned_service_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ if [ -z "$ALIGNED_SERVICE_MANAGER" ]; then
exit 1
fi

if [ -z "$PRIVATE_KEY" ]; then
echo "PRIVATE_KEY env var is not set"
if [ -z "$ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY" ]; then
echo "ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY env var is not set"
exit 1
fi

Expand Down
8 changes: 4 additions & 4 deletions contracts/scripts/pause_aligned_service_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ if [ -z "$ALIGNED_SERVICE_MANAGER" ]; then
exit 1
fi

if [ -z "$PRIVATE_KEY" ]; then
echo "PRIVATE_KEY env var is not set"
if [ -z "$ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY" ]; then
echo "ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY env var is not set"
exit 1
fi

Expand All @@ -27,7 +27,7 @@ if [[ "$1" == "all" ]]; then
cast send $ALIGNED_SERVICE_MANAGER \
"pauseAll()()" \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
--private-key $ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY
exit 0
fi

Expand All @@ -43,4 +43,4 @@ echo "New pause state: $result"
cast send $ALIGNED_SERVICE_MANAGER \
"pause(uint256)()" "$result" \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
--private-key $ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY
6 changes: 3 additions & 3 deletions contracts/scripts/pause_batcher_payment_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ if [ -z "$BATCHER_PAYMENT_SERVICE" ]; then
exit 1
fi

if [ -z "$PRIVATE_KEY" ]; then
echo "PRIVATE_KEY env var is not set"
if [ -z "$BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY" ]; then
echo "BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY env var is not set"
exit 1
fi

Expand All @@ -19,4 +19,4 @@ echo "Pausing batcher payment contract"
cast send $BATCHER_PAYMENT_SERVICE \
"pause()()" \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
--private-key $BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY
10 changes: 4 additions & 6 deletions contracts/scripts/unpause_aligned_service_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [[ "$1" == "all" ]]; then
cast send $ALIGNED_SERVICE_MANAGER \
"unpause(uint256)()" 0 \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
--private-key $ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY
return
fi

Expand All @@ -21,8 +21,8 @@ if [ -z "$ALIGNED_SERVICE_MANAGER" ]; then
exit 1
fi

if [ -z "$PRIVATE_KEY" ]; then
echo "PRIVATE_KEY env var is not set"
if [ -z "$ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY" ]; then
echo "ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY env var is not set"
exit 1
fi

Expand All @@ -42,6 +42,4 @@ echo "New pause state: $result"
cast send $ALIGNED_SERVICE_MANAGER \
"unpause(uint256)()" "$result" \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY


--private-key $ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY
6 changes: 3 additions & 3 deletions contracts/scripts/unpause_batcher_payment_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ if [ -z "$BATCHER_PAYMENT_SERVICE" ]; then
exit 1
fi

if [ -z "$PRIVATE_KEY" ]; then
echo "PRIVATE_KEY env var is not set"
if [ -z "$BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY" ]; then
echo "BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY env var is not set"
exit 1
fi

Expand All @@ -19,4 +19,4 @@ echo "Unpausing batcher payments contract"
cast send $BATCHER_PAYMENT_SERVICE \
"unpause()()" \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
--private-key $BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY
18 changes: 13 additions & 5 deletions docs/0_internal/pausable.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ To run the make targets specified in this guide, you must first have the relevan
```
export RPC_URL=<rpc_url>
export ALIGNED_SERVICE_MANAGER=<aligned_contract_address>
export ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY=<aligned_service_manager_pauser_private_key>
export BATCHER_PAYMENT_SERVICE=<payment_service_contract_address>
export PRIVATE_KEY=<pauser_private_key>
export BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY=<batcher_payment_service_pauser_private_key>
```

## Aligned Service Manager

Aligned Service Manager is granulary pausable, which means you can pause the whole contract, or only specific functions. For this, Aligned uses the Pauser Registry contract provided by Eigenlayer. This contract stores the role of different accounts, so you can have X pausers and Y unpausers.
Aligned Service Manager is granulary pausable, which means you can pause the whole contract, or only specific functions. For this,
Aligned uses the Pauser Registry contract provided by Eigenlayer. This contract stores the role of different accounts, so
you can have X pausers and Y unpausers.

To interact with you you can:
To interact with it you can:

- Get current paused state:
```
Expand All @@ -33,7 +36,7 @@ For example, if you want to pause functions 0, 2 and 3, you can run
```
contracts/scripts/pause_aligned_service_manager.sh 0 2 3
```
Then, if you want to unpause, for example, function 2, you must run
Then, if you want to unpause, for example, function 2, you must run
```
contracts/scripts/unpause_aligned_service_manager.sh 0 3
```
Expand All @@ -49,10 +52,15 @@ Note: the list of pausable functions and their numbers can be seen in the `Align
4. depositToBatcher
5. receive

## BatcherPayments
## BatcherPaymentsService

BatcherPayments is also pausable, but without so much detail. You can either pause or unpause the contract running the following:

- Get current paused state:
```
make get_paused_state_batcher_payments_service
```

```
make pause_batcher_payment_service
```
Expand Down

0 comments on commit b94224d

Please sign in to comment.