Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
29 changes: 29 additions & 0 deletions contracts/script/upgrade/ProofAggregatorServiceUpgrader.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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();

vm.stopBroadcast();

vm.startBroadcast();
proofAggregationServiceProxy.upgradeToAndCall(address(newProofAggregatorServiceImplementation), "");
Comment thread
MarcosNicolau marked this conversation as resolved.
Outdated
vm.stopBroadcast();

return (address(proofAggregationServiceProxy), address(newProofAggregatorServiceImplementation));
}
}
1 change: 1 addition & 0 deletions contracts/scripts/proof_aggregator_service/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
RPC_URL=<RPC_URL>
PRIVATE_KEY=<YOUR_PRIVATE_KEY>
EXISTING_DEPLOYMENT_INFO_PATH=./script/output/<NETWORK>/proof_aggregation_service_deployment_output.json
PROOF_AGGREGATION_SERVICE_CONFIG_PATH=./script/deploy/config/<NETWORK>/.holesky.config.json
PROOF_AGGREGATION_SERVICE_OUTPUT_PATH=./script/output/<NETWORK>/proof-aggregator-service.<NETWORK>.config.json
ETHERSCAN_API_KEY=<ETHERSCAN_API_KEY>
3 changes: 2 additions & 1 deletion contracts/scripts/proof_aggregator_service/deploy.sh
Comment thread
MarcosNicolau marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ forge script script/deploy/AlignedProofAggregationServiceDeployer.s.sol \
--broadcast \
--verify \
--etherscan-api-key $ETHERSCAN_API_KEY \
--sig "run(string memory batcherConfigPath, string memory outputPath)"
--sig "run(string memory configPath, string memory outputPath)" \
--via-ir
35 changes: 34 additions & 1 deletion contracts/scripts/proof_aggregator_service/upgrade.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
#!/bin/bash

# TODO
# 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 \
$EXISTING_DEPLOYMENT_INFO_PATH \
$PROOF_AGGREGATION_SERVICE_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_AGGREGATION_SERVICE_OUTPUT_PATH > "$PROOF_AGGREGATION_SERVICE_OUTPUT_PATH.temp"

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

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

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