|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# cd to the directory of this script so that this can be run from anywhere |
| 4 | +parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) |
| 5 | + |
| 6 | +cd "$parent_path" |
| 7 | + |
| 8 | +cd ../../ |
| 9 | + |
| 10 | +jq 'del(.block)' scripts/anvil/state/alignedlayer-deployed-anvil-state.json > scripts/anvil/state/alignedlayer-deployed-anvil-state-tmp.json |
| 11 | + |
| 12 | +cp -f scripts/anvil/state/alignedlayer-deployed-anvil-state-tmp.json scripts/anvil/state/alignedlayer-deployed-anvil-state.json |
| 13 | + |
| 14 | +rm scripts/anvil/state/alignedlayer-deployed-anvil-state-tmp.json |
| 15 | + |
| 16 | +anvil --load-state scripts/anvil/state/alignedlayer-deployed-anvil-state.json --dump-state scripts/anvil/state/alignedlayer-deployed-anvil-state.json & |
| 17 | + |
| 18 | +sleep 2 |
| 19 | + |
| 20 | +# Deploy new Aggregation Mode Payment Service implementation, but don't upgrade yet |
| 21 | +forge_output=$(forge script script/upgrade/AggregationModePaymentServiceUpgrader.s.sol \ |
| 22 | + "./script/output/devnet/proof_aggregation_service_deployment_output.json" \ |
| 23 | + --rpc-url "http://localhost:8545" \ |
| 24 | + --private-key "0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356" \ |
| 25 | + --broadcast \ |
| 26 | + --legacy \ |
| 27 | + --verify \ |
| 28 | + --sig "run(string memory alignedLayerDeploymentFilePath)") |
| 29 | + |
| 30 | +echo "$forge_output" |
| 31 | + |
| 32 | +# Extract the aggregation mode payment service values from the output |
| 33 | +aggregation_mode_payment_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print $3}') |
| 34 | +aggregation_mode_payment_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}') |
| 35 | + |
| 36 | +data=$(cast calldata "upgradeToAndCall(address, bytes)" $aggregation_mode_payment_service_implementation "0x") |
| 37 | + |
| 38 | +MULTISIG=false # hardcoding non-multisig for devnet |
| 39 | +if [ "$MULTISIG" = false ]; then |
| 40 | + echo "Executing upgrade transaction" |
| 41 | + cast send $aggregation_mode_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 | + |
| 51 | +# Use the extracted value to replace the aggregation mode payment service values and save it to a temporary file |
| 52 | +jq --arg aggregation_mode_payment_service_implementation "$aggregation_mode_payment_service_implementation" \ |
| 53 | + '.addresses.aggregationModePaymentServiceImplementation = $aggregation_mode_payment_service_implementation' \ |
| 54 | + "./script/output/devnet/proof_aggregation_service_deployment_output.json" > \ |
| 55 | + "./script/output/devnet/proof_aggregation_service_deployment_output.temp.json" |
| 56 | + |
| 57 | +# Replace the original file with the temporary file |
| 58 | +mv "./script/output/devnet/proof_aggregation_service_deployment_output.temp.json" \ |
| 59 | + "./script/output/devnet/proof_aggregation_service_deployment_output.json" |
| 60 | + |
| 61 | +# Delete the temporary file |
| 62 | +rm -f "./script/output/devnet/proof_aggregation_service_deployment_output.temp.json" |
0 commit comments