Skip to content

Commit 9d39c51

Browse files
uri-99PatStiles
authored andcommitted
feat: enable whitelist of multiple operators on a single call (#1491)
1 parent 59ca78e commit 9d39c51

File tree

6 files changed

+79
-20
lines changed

6 files changed

+79
-20
lines changed

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,19 +229,21 @@ operator_mint_mock_tokens:
229229

230230
operator_whitelist_devnet:
231231
@echo "Whitelisting operator"
232-
$(eval OPERATOR_ADDRESS = $(shell yq -r '.operator.address' $(CONFIG_FILE)))
233232
@echo "Operator address: $(OPERATOR_ADDRESS)"
234-
RPC_URL="http://localhost:8545" PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" OUTPUT_PATH=./script/output/devnet/alignedlayer_deployment_output.json ./contracts/scripts/whitelist_operator.sh $(OPERATOR_ADDRESS)
233+
RPC_URL="http://localhost:8545" PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" OUTPUT_PATH=./script/output/devnet/alignedlayer_deployment_output.json ./contracts/scripts/operator_whitelist.sh $(OPERATOR_ADDRESS)
235234

236-
operator_remove_devnet:
235+
operator_remove_from_whitelist_devnet:
237236
@echo "Removing operator"
238-
$(eval OPERATOR_ADDRESS = $(shell yq -r '.operator.address' $(CONFIG_FILE)))
239237
@echo "Operator address: $(OPERATOR_ADDRESS)"
240-
RPC_URL="http://localhost:8545" PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" OUTPUT_PATH=./script/output/devnet/alignedlayer_deployment_output.json ./contracts/scripts/remove_operator.sh $(OPERATOR_ADDRESS)
238+
RPC_URL="http://localhost:8545" PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" OUTPUT_PATH=./script/output/devnet/alignedlayer_deployment_output.json ./contracts/scripts/operator_remove_from_whitelist.sh $(OPERATOR_ADDRESS)
241239

242240
operator_whitelist:
243241
@echo "Whitelisting operator $(OPERATOR_ADDRESS)"
244-
@. contracts/scripts/.env && . contracts/scripts/whitelist_operator.sh $(OPERATOR_ADDRESS)
242+
@. contracts/scripts/.env && . contracts/scripts/operator_whitelist.sh $(OPERATOR_ADDRESS)
243+
244+
operator_remove_from_whitelist:
245+
@echo "Removing operator $(OPERATOR_ADDRESS)"
246+
@. contracts/scripts/.env && . contracts/scripts/operator_remove_from_whitelist.sh $(OPERATOR_ADDRESS)
245247

246248
operator_deposit_into_mock_strategy:
247249
@echo "Depositing into mock strategy"

contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

contracts/scripts/whitelist_operator.sh renamed to contracts/scripts/operator_remove_from_whitelist.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ cd ../
1010

1111
# Check if the number of arguments is correct
1212
if [ "$#" -ne 1 ]; then
13-
echo "Usage: add_operator_to_whitelist.sh <OPERATOR_ADDRESS>"
13+
echo "Usage: operator_remove_from_whitelist.sh <OPERATOR_ADDRESS>"
14+
echo "or"
15+
echo "Usage: operator_remove_from_whitelist.sh <OPERATOR_ADDRESS_1,OPERATOR_ADDRESS_2,...,OPERATOR_ADDRESS_N>"
1416
exit 1
1517
fi
1618

@@ -37,9 +39,9 @@ if [ -z "$PRIVATE_KEY" ]; then
3739
exit 1
3840
fi
3941

40-
# Call the add function on the contract
42+
echo "Removing operators from whitelist: $@"
4143
cast send \
42-
--rpc-url=$RPC_URL \
43-
--private-key=$PRIVATE_KEY \
44-
$REGISTRY_COORDINATOR 'add(address)' \
45-
$OPERATOR_ADDRESS
44+
--rpc-url=$RPC_URL \
45+
--private-key=$PRIVATE_KEY \
46+
$REGISTRY_COORDINATOR 'remove_multiple(address[])' \
47+
"[$OPERATOR_ADDRESS]"
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ cd ../
1010

1111
# Check if the number of arguments is correct
1212
if [ "$#" -ne 1 ]; then
13-
echo "Usage: add_operator_to_whitelist.sh <OPERATOR_ADDRESS>"
13+
echo "Usage: operator_whitelist.sh <OPERATOR_ADDRESS>"
14+
echo "or"
15+
echo "Usage: operator_whitelist.sh <OPERATOR_ADDRESS_1,OPERATOR_ADDRESS_2,...,OPERATOR_ADDRESS_N>"
1416
exit 1
1517
fi
1618

@@ -37,9 +39,9 @@ if [ -z "$PRIVATE_KEY" ]; then
3739
exit 1
3840
fi
3941

40-
# Call the add function on the contract
42+
echo "Adding operators to whitelist: $@"
4143
cast send \
42-
--rpc-url=$RPC_URL \
43-
--private-key=$PRIVATE_KEY \
44-
$REGISTRY_COORDINATOR 'remove(address)' \
45-
$OPERATOR_ADDRESS
44+
--rpc-url=$RPC_URL \
45+
--private-key=$PRIVATE_KEY \
46+
$REGISTRY_COORDINATOR 'add_multiple(address[])' \
47+
"[$OPERATOR_ADDRESS]"

docs/0_internal/whitelist.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Whitelist
2+
3+
Whitelisting is a functionality added by the Aligned dev team to the `eigenlayer-middleware` contracts.
4+
5+
This functionality is added in `contracts/lib/eigenlayer-middleware/src/Whitelist.sol`, and its functionality ends up present in the `RegistryCoordinator` contract.
6+
7+
The reason behind this functionality is to control which Operators can operate in Aligned, making necessary for the team to manually whitelist an Operator before it can join the network.
8+
9+
## Interacting with whitelisting
10+
11+
### Adding an Operator
12+
13+
There are 2 ways of adding Operators to the whitelist.
14+
15+
To add only 1 Operator:
16+
```
17+
make operator_whitelist OPERATOR_ADDRESS=<operator_address>
18+
```
19+
20+
To add a list of Operators:
21+
```
22+
make operator_whitelist OPERATOR_ADDRESS=<operator_address1,operator_address2,...,operator_addressN>
23+
```
24+
(Note how there is no spaces between the different operator addresses)
25+
26+
### Removing an Operator
27+
28+
There are 2 ways of removing Operators from the whitelist.
29+
30+
To remove only 1 Operator:
31+
```
32+
make operator_remove_from_whitelist OPERATOR_ADDRESS=<operator_address>
33+
```
34+
35+
To remove a list of Operators:
36+
```
37+
make operator_remove_from_whitelist OPERATOR_ADDRESS=<operator_address1,operator_address2,...,operator_addressN>
38+
```
39+
(Note how there is no spaces between the different operator addresses)
40+
41+
### Querying the state of an Operator
42+
43+
To view the whitelist state of an Operator you can:
44+
45+
```
46+
cast call <aligned_registry_coordinator_address> "isWhitelisted(address)(bool)" <operator_address>
47+
```
48+
49+
or in Etherscan:
50+
51+
1. Locate the Aligned `registryCoordinator` contract address, in `aligned_deployment_output.json`
52+
2. `Read as Proxy` in Etherscan
53+
3. Find the `isWhitelisted` function, and put the Operator's address as the parameter

0 commit comments

Comments
 (0)