Skip to content

fix: some pausable commands for local dev #1501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,29 @@ anvil_upgrade_add_aggregator:
. contracts/scripts/anvil/upgrade_add_aggregator_to_service_manager.sh

pause_all_aligned_service_manager:
@echo "Pausing all contracts..."
. contracts/scripts/pause_aligned_service_manager.sh all
@echo "Pausing Aligned Service Manager contract..."
@. contracts/scripts/.env && . contracts/scripts/pause_aligned_service_manager.sh all

unpause_all_aligned_service_manager:
@echo "Pausing all contracts..."
. contracts/scripts/unpause_aligned_service_manager.sh all
@echo "Pausing Aligned Service Manager contract..."
@. contracts/scripts/.env && . contracts/scripts/unpause_aligned_service_manager.sh all

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

pause_batcher_payment_service:
@echo "Pausing BatcherPayments contract..."
. contracts/scripts/pause_batcher_payment_service.sh
@. contracts/scripts/.env && . contracts/scripts/pause_batcher_payment_service.sh

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
@. contracts/scripts/.env && . contracts/scripts/get_paused_state_batcher_payments_service.sh

anvil_upgrade_initialize_disable_verifiers:
@echo "Initializing disabled verifiers..."
. contracts/scripts/anvil/upgrade_disabled_verifiers_in_service_manager.sh
Expand Down
5 changes: 0 additions & 5 deletions contracts/scripts/get_paused_state_aligned_service_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ if [ -z "$ALIGNED_SERVICE_MANAGER" ]; then
exit 1
fi

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

if [ -z "$RPC_URL" ]; then
echo "RPC_URL env var is not set"
exit 1
Expand Down
14 changes: 14 additions & 0 deletions contracts/scripts/get_paused_state_batcher_payments_service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

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

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

number=$(cast call $BATCHER_PAYMENT_SERVICE "paused()(bool)" --rpc-url $RPC_URL)
echo Batcher Payments Paused state: $number
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 "$ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY" ]; then
echo "ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY env var is not set"
if [ -z "$PRIVATE_KEY" ]; then
echo "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 $ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY
--private-key $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 $ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY
--private-key $PRIVATE_KEY
8 changes: 4 additions & 4 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 "$BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY" ]; then
echo "BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY env var is not set"
if [ -z "$PRIVATE_KEY" ]; then
echo "PRIVATE_KEY env var is not set"
exit 1
fi

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

echo "Pausing batcher payment contract"
echo "Pausing contract"
cast send $BATCHER_PAYMENT_SERVICE \
"pause()()" \
--rpc-url $RPC_URL \
--private-key $BATCHER_PAYMENT_SERVICE_PAUSER_PRIVATE_KEY
--private-key $PRIVATE_KEY
22 changes: 11 additions & 11 deletions contracts/scripts/unpause_aligned_service_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,13 @@ if [ -z "$1" ]; then
exit 1
fi

if [[ "$1" == "all" ]]; then
echo "Unpausing whole contract"
cast send $ALIGNED_SERVICE_MANAGER \
"unpause(uint256)()" 0 \
--rpc-url $RPC_URL \
--private-key $ALIGNED_SERVICE_MANAGER_PAUSER_PRIVATE_KEY
return
fi

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

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

Expand All @@ -31,6 +22,15 @@ if [ -z "$RPC_URL" ]; then
exit 1
fi

if [[ "$1" == "all" ]]; then
echo "Unpausing whole contract"
cast send $ALIGNED_SERVICE_MANAGER \
"unpause(uint256)()" 0 \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
return
fi

result=0

for num in "$@"; do
Expand Down
75 changes: 75 additions & 0 deletions docs/0_internal/4_a_pause_contracts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Pause Contracts
This doc contains a guide on how to use the Pausable functionality of Aligned.

To run the make targets specified in this guide, you must first have the relevant following env vars under `contracts/scripts/.env`:
```
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 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.

To interact with it you can:

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

- Pause or Unpause the whole aligned service manager contract:
```
make pause_all_aligned_service_manager
```
```
make unpause_all_aligned_service_manager
```

- Pause only specific functions, receiving a list of the functions to pause/remain paused:
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
```
contracts/scripts/unpause_aligned_service_manager.sh 0 3
```

Note: when executing a Pause, you can only ADD functions to the paused list, and when executing an Unpause, you can only REMOVE functions from the paused list. This is because the base pausable contract has different ACL for Pausers and Unpausers.

Note: the list of pausable functions and their numbers can be seen in the `AlignedLayerServiceManager.sol` contract. But the list is the following:

0. createNewTask
1. respondToTaskV2
2. verifyBatchInclusion
3. withdraw
4. depositToBatcher
5. receive

## 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
```
```
make unpause_batcher_payment_service
```

And this will either pause or unpause the following functions:
- createNewTask
- unlock
- lock
- withdraw
99 changes: 99 additions & 0 deletions docs/0_internal/4_b_1_propose_pause.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Propose the Transaction for Pause using Multisig

If you want to pause the contracts, you can propose the pause transaction using the multisig wallet.

## Prerequisites

- You need to have deployed the contracts following the [Deploy Contracts Guide](./2_deploy_contracts.md).

## Propose transaction for Pause AlignedLayerServiceManager

To propose the pause transaction you can follow the steps below:

1. Go to [Safe](https://app.safe.global/home)

2. Click on `New transaction` -> `Transaction Builder`

![New transaction](./images/4_b_1_pause_1.png)

![Transaction Builder](./images/4_b_1_pause_2.png)

3. . Get the `AlignedLayerServiceManager` address from ```contracts/script/output/mainnet/alignedlayer_deployment_output.json``` or ```contracts/script/output/holesky/alignedlayer_deployment_output.json``` or ```contracts/script/output/sepolia/alignedlayer_deployment_output.json```

4. Paste the `AlignedLayerServiceManager` address on `Enter Address or ENS Name`

![Enter Address](./images/4_b_1_pause_3.png)

5. As this is a Proxy contract, choose `Use Implementation ABI`

![Use Implementation ABI](./images/4_b_1_pause_4.png)

6. In `contract method selector` choose `pauseAll()`

![Choose pause](./images/4_b_1_pause_5.png)

7. Click on `+ Add new transaction`

You should see the new transaction to be executed

8. Click on `Create batch` to create the transaction.

9. Simulate the transaction by clicking on `Simulate`

10. If everything is correct, click on `Send batch` to send the transaction.

11. Simulate the transaction, and if everything is correct, click on `Sign`.

![Send batch](./images/4_b_1_pause_6.png)

> [!NOTE]
> In the `call` field, you will see `fallback`.

12. Wait for the transaction to be executed. You can check the transaction status on the `Transactions` tab.


## Propose transaction for Pause BatcherPaymentService

To propose the pause transaction you can follow the steps below:

1. Create the pause transaction on [Safe](https://app.safe.global/home)

2. Click on `New transaction` -> `Transaction Builder`

![New transaction](./images/4_b_1_pause_1.png)

![Transaction Builder](./images/4_b_1_pause_2.png)

3. Get the `BatcherPaymentService` address from ```contracts/script/output/mainnet/alignedlayer_deployment_output.json``` or ```contracts/script/output/holesky/alignedlayer_deployment_output.json``` or ```contracts/script/output/sepolia/alignedlayer_deployment_output.json```

4. Paste the `BatcherPaymentService` address on `Enter Address or ENS Name`

![Enter Address](./images/4_b_1_pause_3.png)

5. As this is a Proxy contract, choose `Use Implementation ABI`

![Use Implementation ABI](./images/4_b_1_pause_4.png)

6. In `contract method selector` choose `pause()`

![Choose pause](./images/4_b_1_pause_8.png)

7. Then click on `+ Add new transaction`

You should see the new transaction to be executed. Then click on `Create batch` to create the transaction.

![Add new transaction](./images/4_b_1_pause_9.png)

8. Review and confirm you are interacting with the correct `BatcherPaymentService` contract and you are calling the `pause` function.

![Review transaction](./images/4_b_1_pause_10.png)

9. Simulate the transaction by clicking on `Simulate`

10. If everything is correct, click on `Send batch` to send the transaction.

11. Review the transaction and click on `Sign` to sign the transaction.

![Send batch](./images/4_b_1_pause_11.png)

12. If the transaction is correctly created, you have to wait until the required Multisig member signs the transaction to send it.
54 changes: 54 additions & 0 deletions docs/0_internal/4_b_2_approve_pause.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Approve the Pause Transaction

Once the transaction is proposed, the multisig owners must approve the transaction.

## Approve the Pause for AlignedLayerServiceManager

1. Go to [Safe](https://app.safe.global/home) and connect your wallet.

2. Go to the `Transactions` tab and find the transaction that was proposed.

3. Get the ```pauseAll()``` signature by running:

```bash
cast calldata "pauseAll()"
```

It must show you ```0x595c6a67```.

4. Click on the transaction, and then click on ```Advanced Details```.

![Check details](images/4_b_2_approve_1.png)

5. Copy the ```Raw Data```, paste it in a text editor and verify it is the same value as the one you got in step 3.

6. If the data is correct, click on the `Confirm` button.

7. Simulate the transaction. If everything is correct, click on the `Sign` button.

![Sign transaction](images/4_b_2_approve_3.png)

8. Once the transaction is executed, the pause will be effective.

## Approve the Pause for BatcherPaymentService

1. Go to [Safe](https://app.safe.global/home) and connect your wallet.

2. Go to the `Transactions` tab and find the transaction that was proposed.

3. Click on the transaction and validate the data is correct.

The called function must be `pause` and the contract address must be the `BatcherPaymentService` address.

![Check details](images/4_b_2_approve_2.png)

Get the `BatcherPaymentService` address from ```contracts/script/output/mainnet/alignedlayer_deployment_output.json``` or ```contracts/script/output/holesky/alignedlayer_deployment_output.json``` or ```contracts/script/output/sepolia/alignedlayer_deployment_output.json```

4. If the data is correct, click on the `Confirm` button.

5. Simulate the transaction. If everything is correct, click on the `Sign` button.

![Sign transaction](images/4_b_2_approve_3.png)

6. Once the transaction is executed, the pause will be effective.

Loading
Loading