Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,10 @@ deploy_proof_aggregator:
@echo "Deploying ProofAggregator contract on $(NETWORK) network..."
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/deploy_proof_aggregator.sh

upgrade_proof_aggregator:
@echo "Upgrading ProofAggregator Contract on $(NETWORK) network..."
@. contracts/scripts/.env.$(NETWORK) && . contracts/scripts/upgrade_proof_aggregator.sh

build_aligned_contracts:
@cd contracts/src/core && forge build --via-ir

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"addresses": {
"alignedProofAggregationService": "0x7Eace34A8d4C4CacE633946C6F7CF4BeF3F33513",
"alignedProofAggregationServiceImplementation": "0xb12386C57ed3cfb31Ca358fB541dB46b14573fC7"
"alignedProofAggregationServiceImplementation": "0x6454e81F80E9f45583F63cB1fCEbEc1cE3AB9559"
}
}
28 changes: 28 additions & 0 deletions contracts/script/upgrade/ProofAggregatorServiceUpgrader.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.12;

import {AlignedProofAggregationService} from "../../src/core/AlignedProofAggregationService.sol";

import "forge-std/Script.sol";
import "forge-std/StdJson.sol";

contract AlignedProofAggregationServiceUpgrader is Script {
function run(string memory alignedLayerDeploymentFilePath) external returns (address, address) {
string memory aligned_deployment_file = vm.readFile(alignedLayerDeploymentFilePath);

vm.startBroadcast();

AlignedProofAggregationService proofAggregationServiceProxy = AlignedProofAggregationService(
payable(stdJson.readAddress(aligned_deployment_file, ".addresses.alignedProofAggregationService"))
);

AlignedProofAggregationService newProofAggregatorServiceImplementation = new AlignedProofAggregationService();

// Not link the new implementation to the proxy
// Because this must be executed in the multisig

vm.stopBroadcast();

return (address(proofAggregationServiceProxy), address(newProofAggregatorServiceImplementation));
}
}
3 changes: 2 additions & 1 deletion contracts/scripts/deploy_proof_aggregator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ forge script script/deploy/AlignedProofAggregationServiceDeployer.s.sol \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY \
--slow \
--sig "run(string configPath, string outputPath)"
--sig "run(string configPath, string outputPath)" \
--via-ir
5 changes: 0 additions & 5 deletions contracts/scripts/proof_aggregator_service/.env.example

This file was deleted.

22 changes: 0 additions & 22 deletions contracts/scripts/proof_aggregator_service/deploy.sh

This file was deleted.

3 changes: 0 additions & 3 deletions contracts/scripts/proof_aggregator_service/upgrade.sh

This file was deleted.

69 changes: 69 additions & 0 deletions contracts/scripts/upgrade_proof_aggregator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

# ENV VARIABLES
#
# MULTISIG=true|false whether the contract is deployed under a multisig account
#
# PROOF_AGGREGATOR_OUTPUT_PATH: Path to the proof aggregator output file
# - Holesky Stage: ./script/output/holesky/proof_aggregation_service_deployment_output.stage.json
# - Holesky Prod: ./script/output/holesky/proof_aggregation_service_deployment_output.json
#
# RPC_URL: The RPC URL to connect to the Ethereum network
#
# PRIVATE_KEY: The private key to use for the deployment
#
# ETHERSCAN_API_KEY: The Etherscan API key to use for verification
#

if [ -z "$MULTISIG" ]; then
echo "Missing MULTISIG env variable"
exit 1
fi

# cd to the directory of this script so that this can be run from anywhere
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )

cd "$parent_path"

cd ../

# Save the output to a variable to later extract the address of the new deployed contract
forge_output=$(forge script script/upgrade/ProofAggregatorServiceUpgrader.s.sol \
$PROOF_AGGREGATOR_OUTPUT_PATH \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY \
--sig "run(string memory alignedLayerDeploymentFilePath)")

echo "$forge_output"

# Extract the proof aggregator service values from the output
proof_aggregator_service_proxy=$(echo "$forge_output" | awk '/0: address/ {print $3}')
proof_aggregator_service_implementation=$(echo "$forge_output" | awk '/1: address/ {print $3}')

# Use the extracted value to replace the batcher payment service values in alignedlayer_deployment_output.json and save it to a temporary file
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"

# Replace the original file with the temporary file
mv "$PROOF_AGGREGATOR_OUTPUT_PATH.temp" $PROOF_AGGREGATOR_OUTPUT_PATH

# Delete the temporary file
rm -f "$PROOF_AGGREGATOR_OUTPUT_PATH.temp"

echo "The new Proof Aggregator Service Implementation is $proof_aggregator_service_implementation"

data=$(cast calldata "upgradeTo(address)" $proof_aggregator_service_implementation)

echo "The new ProofAggregator Service Implementation is $proof_aggregator_service_implementation"

if [ "$MULTISIG" = false ]; then
echo "Executing upgrade transaction"
cast send $proof_aggregator_service_proxy $data \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY
else
echo "You can propose the upgrade transaction with the multisig using this calldata"
echo $data
fi
Loading