-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(contracts): Add script + guide to set aggregator address (#1487)
Co-authored-by: Uriel Mihura <[email protected]> Co-authored-by: Julian Ventura <[email protected]> Co-authored-by: avilagaston9 <[email protected]>
- Loading branch information
1 parent
9f401df
commit 7a15d39
Showing
15 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
# cd to the directory of this script so that this can be run from anywhere | ||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) | ||
# At this point we are in contracts/scripts | ||
cd "$parent_path" | ||
|
||
# At this point we are in contracts | ||
cd ../ | ||
|
||
# Check if the number of arguments is correct | ||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: set_aggregator_address.sh <AGGREGATOR_ADDRESS>" | ||
exit 1 | ||
fi | ||
|
||
AGGREGATOR_ADDRESS=$1 | ||
|
||
# Read the service manager address from the JSON file | ||
SERVICE_MANAGER=$(jq -r '.addresses.alignedLayerServiceManager' "$OUTPUT_PATH") | ||
|
||
# Check if the servide manager address is empty | ||
if [ -z "$SERVICE_MANAGER" ]; then | ||
echo "Service manager address is empty" | ||
exit 1 | ||
fi | ||
|
||
# Check if the Ethereum RPC URL is empty | ||
if [ -z "$RPC_URL" ]; then | ||
echo "Ethereum RPC URL is empty" | ||
exit 1 | ||
fi | ||
|
||
# Check if the private key is empty | ||
if [ -z "$PRIVATE_KEY" ]; then | ||
echo "Private key is empty" | ||
exit 1 | ||
fi | ||
|
||
# Call the setAggregator(address _alignedAggregator) function on the contract | ||
cast send \ | ||
--private-key=$PRIVATE_KEY \ | ||
--rpc-url=$RPC_URL \ | ||
$SERVICE_MANAGER "setAggregator(address)" \ | ||
$AGGREGATOR_ADDRESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Setting Aggregator Address | ||
This doc contains a guide on how to call `setAggregator(address)` to set the `alignedAggregator` value of the AlignedServiceManager.sol contract. | ||
|
||
### NOTE: | ||
- This guide assumes the Aligned layer contracts have been sucessfully deployed and the deployment outputs are within `./contracts/script/output/<DEPLOYMENT_FOLDER>` | ||
|
||
1. Locate the deployed Aligned Aggregator Address | ||
|
||
The address of Aligned Aggregator can be found in `./contracts/script/output/<DEPLOYMENT_FOLDER>/aligned_deployment_output.json` within: | ||
``` | ||
"permissions": { | ||
... | ||
"alignedLayerAggregator": "<AGGREGATOR_ADDRESS", | ||
... | ||
} | ||
``` | ||
|
||
2. Locate the Aligned Service Manager Address | ||
|
||
The address of Aligned Service Manager can be found in `./contracts/script/output/<DEPLOYMENT_FOLDER>/aligned_deployment_output.json` within: | ||
``` | ||
"addresses": { | ||
... | ||
"alignedLayerServiceManager": "<ALIGNED_SERVICE_MANAGER_ADDRESS>", | ||
... | ||
} | ||
``` | ||
|
||
3. Set Environment Variables | ||
|
||
To run the make targets specified in this guide, you must first set the following env vars within `./contracts/scripts/.env.<NETWORK>`: | ||
``` | ||
RPC_URL=<rpc_url> | ||
PRIVATE_KEY=<aligned_service_manager_owner_private_key> | ||
ALIGNED_SERVICE_MANAGER_ADDRESS=<aligned_service_manager_address> | ||
``` | ||
|
||
4. Check the current value of `alignedAggregator` within AlignedServiceManager.sol | ||
|
||
``` | ||
cast call --rpc-url <RPC_URL> $ALIGNED_SERVICE_MANAGER_ADDRESS "alignedAggregator()(address)" | ||
``` | ||
|
||
You should see that the returned address matches the address from `./contracts/script/output/<DEPLOYMENT_FOLDER>/aligned_deployment_output.json` | ||
|
||
5. Change the value of `alignedAggregator` within AlignedServiceManager.sol | ||
|
||
Set the environment variable `AGGREGATOR_ADDRESS` to the new address of the aggregator. | ||
``` | ||
export AGGREGATOR_ADDRESS=<aggregator_address> | ||
make set_aggregator_address | ||
``` | ||
|
||
6. Verify the Aligned Aggreagtor Address has changed | ||
``` | ||
cast call --rpc-url <RPC_URL> $ALIGNED_SERVICE_MANAGER_ADDRESS "alignedAggregator()(address)" | ||
``` | ||
|
||
You should observe that the printed address matches the address in `AGGREGATOR_ADDRESS`. |
62 changes: 62 additions & 0 deletions
62
docs/0_internal/7_b_1_propose_setting_aggregator_address_multisig.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Propose the Transaction for Setting Aggregator Address using Multisig | ||
|
||
If you want to set the Aggregator Address, you can propose the set Aggregator Address 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 Set Aggregator Address | ||
|
||
To propose the set aggregator address 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/7_b_1_set_aggregator_address_1.png) | ||
|
||
![Transaction Builder](./images/7_b_1_set_aggregator_address_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/7_b_1_set_aggregator_address_3.png) | ||
|
||
5. As this is a Proxy contract, choose `Use Implementation ABI` | ||
|
||
![Use Implementation ABI](./images/7_b_1_set_aggregator_address_4.png) | ||
|
||
6. In `contract method selector` choose `setAggregator()` and within `_alignedAggregator(address)` enter the ethereum new address of the aggregator. | ||
|
||
![Choose set_aggregator](./images/7_b_1_set_aggregator_address_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. | ||
|
||
![create batch](./images/7_b_1_set_aggregator_address_6.png) | ||
|
||
9. Simulate the transaction by clicking on `Simulate` | ||
|
||
10. If everything is correct, click on `Send batch` to send the transaction. | ||
|
||
![Send batch](./images/7_b_1_set_aggregator_address_7.png) | ||
|
||
11. Simulate the transaction, and if everything is correct, click on `Sign`. | ||
|
||
![Send batch](./images/7_b_1_set_aggregator_address_8.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. | ||
|
||
13. Verify the Aligned Aggreagtor Address has changed | ||
``` | ||
cast call --rpc-url <RPC_URL> $ALIGNED_SERVICE_MANAGER_ADDRESS "alignedAggregator()(address)" | ||
``` | ||
|
||
You should observe that the printed address matches the address in `AGGREGATOR_ADDRESS`. |
29 changes: 29 additions & 0 deletions
29
docs/0_internal/7_b_2_approve_setting_aggregator_address_multisig.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Approve the Set Aggregator Address Transaction | ||
|
||
Once the transaction is proposed, the multisig owners must approve the transaction. | ||
|
||
## Approve the new Address for the Aggregator | ||
|
||
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 expected raw data by running by running: | ||
|
||
```bash | ||
cast calldata "setAggregator(address)()" <NEW_AGGREGATOR_ADDRESS> | ||
``` | ||
|
||
4. Click on the transaction, and then click on ```Advanced Details```. | ||
|
||
![Check details](images/7_b_2_set_aggregator_address_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 (or `Execute`, if you are the last one signing the transaction). | ||
|
||
![Sign transaction](images/7_b_2_set_aggregator_address_2.png) | ||
|
||
8. Once the transaction is executed, the change will be effective. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.