|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# ENV VARIABLES |
| 4 | +# |
| 5 | +# MULTISIG=true|false whether the contract is deployed under a multisig account |
| 6 | +# |
| 7 | +# PROOF_AGGREGATOR_OUTPUT_PATH: Path to the proof aggregator output file |
| 8 | +# - Holesky Stage: ./script/output/holesky/proof_aggregation_service_deployment_output.stage.json |
| 9 | +# - Holesky Prod: ./script/output/holesky/proof_aggregation_service_deployment_output.json |
| 10 | +# |
| 11 | +# RPC_URL: The RPC URL to connect to the Ethereum network |
| 12 | +# |
| 13 | +# PRIVATE_KEY: The private key to use for the deployment |
| 14 | +# |
| 15 | +# ETHERSCAN_API_KEY: The Etherscan API key to use for verification |
| 16 | +# |
| 17 | + |
| 18 | +if [ -z "$MULTISIG" ]; then |
| 19 | + echo "Missing MULTISIG env variable" |
| 20 | + exit 1 |
| 21 | +fi |
| 22 | + |
| 23 | +# cd to the directory of this script so that this can be run from anywhere |
| 24 | +parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) |
| 25 | + |
| 26 | +cd "$parent_path" |
| 27 | + |
| 28 | +cd ../ |
| 29 | + |
| 30 | +# Save the output to a variable to later extract the address of the new deployed contract |
| 31 | +forge_output=$(forge script script/upgrade/ProofAggregatorServiceUpgrader.s.sol \ |
| 32 | + $PROOF_AGGREGATOR_OUTPUT_PATH \ |
| 33 | + --rpc-url $RPC_URL \ |
| 34 | + --private-key $PRIVATE_KEY \ |
| 35 | + --broadcast \ |
| 36 | + --verify \ |
| 37 | + --etherscan-api-key $ETHERSCAN_API_KEY \ |
| 38 | + --sig "run(string memory alignedLayerDeploymentFilePath)") |
| 39 | + |
| 40 | +echo "$forge_output" |
| 41 | + |
| 42 | +# Extract the proof aggregator service values from the output |
| 43 | +proof_aggregator_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print $3}') |
| 44 | +proof_aggregator_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}') |
| 45 | + |
| 46 | +# Use the extracted value to replace the batcher payment service values in alignedlayer_deployment_output.json and save it to a temporary file |
| 47 | +jq --arg proof_aggregator_service_implementation "$proof_aggregator_service_implementation" '.addresses.alignedProofAggregationServiceImplementation = $proof_aggregator_service_implementation' $PROOF_AGGREGATOR_OUTPUT_PATH > "$PROOF_AGGREGATOR_OUTPUT_PATH.temp" |
| 48 | + |
| 49 | +# Replace the original file with the temporary file |
| 50 | +mv "$PROOF_AGGREGATOR_OUTPUT_PATH.temp" $PROOF_AGGREGATOR_OUTPUT_PATH |
| 51 | + |
| 52 | +# Delete the temporary file |
| 53 | +rm -f "$PROOF_AGGREGATOR_OUTPUT_PATH.temp" |
| 54 | + |
| 55 | +echo "The new Proof Aggregator Service Implementation is $proof_aggregator_service_implementation" |
| 56 | + |
| 57 | +data=$(cast calldata "upgradeTo(address)" $proof_aggregator_service_implementation) |
| 58 | + |
| 59 | +echo "The new ProofAggregator Service Implementation is $proof_aggregator_service_implementation" |
| 60 | + |
| 61 | +if [ "$MULTISIG" = false ]; then |
| 62 | + echo "Executing upgrade transaction" |
| 63 | + cast send $proof_aggregator_service_proxy $data \ |
| 64 | + --rpc-url $RPC_URL \ |
| 65 | + --private-key $PRIVATE_KEY |
| 66 | +else |
| 67 | + echo "You can propose the upgrade transaction with the multisig using this calldata" |
| 68 | + echo $data |
| 69 | +fi |
0 commit comments