Skip to content

Commit 9c3bb2a

Browse files
committed
feat: batcher payments upgradeable with multisig
1 parent 1593f97 commit 9c3bb2a

File tree

5 files changed

+40
-10
lines changed

5 files changed

+40
-10
lines changed

contracts/script/output/sepolia/alignedlayer_deployment_output.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"registryCoordinatorImplementation": "0xFc326289eF3d5ba5E525e27530329727831E834B",
1313
"serviceManagerRouter": "0x074c28d7ff24c06ab747e08772ed582c3b7C887e",
1414
"stakeRegistry": "0x1888568D57Cf6834d74ef62A78e7EF1ADbd55582",
15-
"stakeRegistryImplementation": "0x05671b5B23d16B2e198729b9Ce94696780d384b9"
15+
"stakeRegistryImplementation": "0x05671b5B23d16B2e198729b9Ce94696780d384b9",
16+
"batcherPaymentService": "0x4a40a9F0D29B62a2852ed893B18fAD9CfEcB14FA",
17+
"batcherPaymentServiceImplementation": "0xc40562950D62e3DbFf881149cf07833Cd0A425A9"
1618
},
1719
"chainInfo": {
1820
"chainId": 11155111,

contracts/script/upgrade/BatcherPaymentServiceUpgrader.s.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ contract BatcherPaymentServiceUpgrader is Script {
2424
);
2525

2626
BatcherPaymentService newBatcherPaymentServiceImplementation = new BatcherPaymentService();
27-
BatcherPaymentServiceProxy.upgradeToAndCall(address(newBatcherPaymentServiceImplementation), "");
2827

2928
vm.stopBroadcast();
3029

contracts/scripts/anvil/upgrade_batcher_payment_service.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ anvil --load-state scripts/anvil/state/alignedlayer-deployed-anvil-state.json --
1717

1818
sleep 2
1919

20-
# Deploy Batcher Payments Contract
20+
# Deploy new Batcher Payments implementation, but don't upgrade yet
2121
forge_output=$(forge script script/upgrade/BatcherPaymentServiceUpgrader.s.sol \
2222
"./script/output/devnet/alignedlayer_deployment_output.json" \
2323
--rpc-url "http://localhost:8545" \
@@ -29,11 +29,25 @@ forge_output=$(forge script script/upgrade/BatcherPaymentServiceUpgrader.s.sol \
2929

3030
echo "$forge_output"
3131

32-
pkill anvil
32+
data=$(cast calldata "upgradeToAndCall(address, bytes)" $batcher_payment_service_implementation "0x")
3333

3434
# Extract the batcher payment service values from the output
35+
batcher_payment_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print $3}')
3536
batcher_payment_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')
3637

38+
MULTISIG=false # hardcoding non-multisig for devnet.
39+
if [ "$MULTISIG" = false ]; then
40+
echo "Executing upgrade transaction"
41+
cast send $batcher_payment_service_proxy $data \
42+
--rpc-url "http://localhost:8545" \
43+
--private-key "0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356"
44+
else
45+
echo "You can propose the upgrade transaction with the multisig using this calldata"
46+
echo $data
47+
fi
48+
49+
pkill anvil
50+
3751
# Use the extracted value to replace the batcher payment service values in alignedlayer_deployment_output.json and save it to a temporary file
3852
jq --arg batcher_payment_service_implementation "$batcher_payment_service_implementation" '.addresses.batcherPaymentServiceImplementation = $batcher_payment_service_implementation' "./script/output/devnet/alignedlayer_deployment_output.json" > "./script/output/devnet/alignedlayer_deployment_output.temp.json"
3953

contracts/scripts/deploy_batcher_payment_service.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@ batcher_payment_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print
2929
batcher_payment_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')
3030

3131
# Use the extracted value to replace the batcher payment service values in alignedlayer_deployment_output.json and save it to a temporary file
32-
jq --arg batcher_payment_service_proxy "$batcher_payment_service_proxy" '.addresses.batcherPaymentService = $batcher_payment_service_proxy' "script/output/holesky/alignedlayer_deployment_output.json" > "script/output/holesky/alignedlayer_deployment_output.temp.temp.json"
33-
jq --arg batcher_payment_service_implementation "$batcher_payment_service_implementation" '.addresses.batcherPaymentServiceImplementation = $batcher_payment_service_implementation' "script/output/holesky/alignedlayer_deployment_output.temp.temp.json" > "script/output/holesky/alignedlayer_deployment_output.temp.json"
34-
32+
jq --arg batcher_payment_service_proxy "$batcher_payment_service_proxy" '.addresses.batcherPaymentService = $batcher_payment_service_proxy' $OUTPUT_PATH > $OUTPUT_PATH.temp2
33+
jq --arg batcher_payment_service_implementation "$batcher_payment_service_implementation" '.addresses.batcherPaymentServiceImplementation = $batcher_payment_service_implementation' $OUTPUT_PATH.temp2 > $OUTPUT_PATH.temp
3534

3635
# Replace the original file with the temporary file
37-
mv "script/output/holesky/alignedlayer_deployment_output.temp.json" "script/output/holesky/alignedlayer_deployment_output.json"
36+
mv $OUTPUT_PATH.temp $OUTPUT_PATH
3837

3938
# Delete the temporary file
40-
rm -f "script/output/holesky/alignedlayer_deployment_output.temp.json"
41-
rm -f "script/output/holesky/alignedlayer_deployment_output.temp.temp.json"
39+
rm -f $OUTPUT_PATH.temp
40+
rm -f $OUTPUT_PATH.temp2

contracts/scripts/upgrade_batcher_payment_service.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/bash
22

3+
if [ -z "$MULTISIG" ]; then
4+
echo "Missing MULTISIG env variable"
5+
exit 1
6+
fi
7+
38
# cd to the directory of this script so that this can be run from anywhere
49
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
510
# At this point we are in contracts/scripts
@@ -24,6 +29,7 @@ forge_output=$(forge script script/upgrade/BatcherPaymentServiceUpgrader.s.sol \
2429
echo "$forge_output"
2530

2631
# Extract the batcher payment service values from the output
32+
batcher_payment_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print $3}')
2733
batcher_payment_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')
2834

2935
# Use the extracted value to replace the batcher payment service values in alignedlayer_deployment_output.json and save it to a temporary file
@@ -35,4 +41,14 @@ mv "$OUTPUT_PATH.temp" $OUTPUT_PATH
3541
# Delete the temporary file
3642
rm -f "$OUTPUT_PATH.temp"
3743

44+
data=$(cast calldata "upgradeToAndCall(address, bytes)" $batcher_payment_service_implementation "0x")
3845

46+
if [ "$MULTISIG" = false ]; then
47+
echo "Executing upgrade transaction"
48+
cast send $batcher_payment_service_proxy $data \
49+
--rpc-url $RPC_URL \
50+
--private-key $PRIVATE_KEY
51+
else
52+
echo "You can propose the upgrade transaction with the multisig using this calldata"
53+
echo $data
54+
fi

0 commit comments

Comments
 (0)