-
Notifications
You must be signed in to change notification settings - Fork 396
feat: proof aggregator upgrade scripts #1888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
64718f8
feat: upgrade sol script for proof aggregator service
MarcosNicolau 2b51f25
feat: deploy.sh script for proog agg service + --via-ir flag
MarcosNicolau 2ce128f
fix: .env missing variable and update names
MarcosNicolau fe5350f
chore: move upgrade files to root
MarcosNicolau 1683f23
feat: proof aggregator service contract upgrade multisg compliant
MarcosNicolau d8a5d24
chore: add proof aggregator upgrade target
MarcosNicolau 33ff32a
fix: file name
JuArce de495b2
Merge branch 'staging' into feat/proof-aggregator-upgrade-scripts
MarcosNicolau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
contracts/script/upgrade/ProofAggregatorServiceUpgrader.s.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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), ""); | ||
| vm.stopBroadcast(); | ||
|
|
||
| return (address(proofAggregationServiceProxy), address(newProofAggregatorServiceImplementation)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
|
MarcosNicolau marked this conversation as resolved.
Outdated
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.