Skip to content
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

Proxy change check #1755

Merged
merged 2 commits into from
Aug 14, 2023
Merged
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
87 changes: 69 additions & 18 deletions .github/workflows/simulate-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- "main"

jobs:
test:
simulate-release:
runs-on: ubuntu-latest
env:
CANNON_SETTINGS: ${{ secrets.CANNON_SETTINGS }}
Expand All @@ -17,15 +17,51 @@ jobs:
strategy:
fail-fast: false
matrix:
network: [goerli, optimistic-goerli]
project: [protocol/oracle-manager, protocol/synthetix]
workspace: [
"@synthetixio/main",
"@synthetixio/oracle-manager",
# "@synthetixio/governance", TODO: enable after deployed
# "@synthetixio/legacy-market", TODO: enable after v2x is updated
"@synthetixio/spot-market",
# "@synthetixio/perps-market", TODO: enable after deployed
]
include:
- project: protocol/oracle-manager
cannonPackage: oracle-manager:latest
- workspace: "@synthetixio/main"
cannonPackage: "synthetix"
impersonate: "0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9"
- project: protocol/synthetix
cannonPackage: synthetix:latest
proxy: "InitialCoreProxy"
chains: "mainnet optimistic-mainnet goerli optimistic-goerli"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Th reason to check all chains in one matrix run is that env setup has a big overhead and testing only one release per run is very inefficient (actual build is much faster than env setup). Bundling multiple networks for each package makes builds run slightly slower than build setup and makes matrix split more reasonable.


- workspace: "@synthetixio/oracle-manager"
cannonPackage: "oracle-manager"
impersonate: "0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9"
proxy: "InitialProxy"
chains: "mainnet optimistic-mainnet goerli optimistic-goerli"

# - workspace: "@synthetixio/governance"
# cannonPackage: "governance"
# impersonate: "0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9"
# proxy: "InitialProxy"
# chains: "mainnet optimistic-mainnet goerli optimistic-goerli"

# - workspace: "@synthetixio/legacy-market"
# cannonPackage: "synthetix-legacy-market"
# impersonate: "0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9"
# proxy: "InitialProxy"
# chains: "mainnet optimistic-mainnet goerli optimistic-goerli"

- workspace: "@synthetixio/spot-market"
cannonPackage: "synthetix-spot-market"
impersonate: "0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9"
proxy: "InitialProxy"
chains: "mainnet optimistic-mainnet goerli optimistic-goerli"

# - workspace: "@synthetixio/perps-market"
# cannonPackage: "synthetix-perps-market"
# impersonate: "0x48914229deDd5A9922f44441ffCCfC2Cb7856Ee9"
# proxy: "InitialProxy"
# chains: "mainnet optimistic-mainnet goerli optimistic-goerli"

steps:
- name: Install Foundry (Cannon)
uses: foundry-rs/foundry-toolchain@v1
Expand All @@ -35,19 +71,34 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.16.0"
node-version: "16.20.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downgrade to 16 on purpose?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw thread on discord

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it is a bit messier than I'd like it to be

cache: "yarn"
- uses: ibnesayeed/setup-ipfs@92d412e0dad36c06ffab50733e9c624896a0964f
with:
run_daemon: true
- run: yarn install --immutable --immutable-cache
- run: yarn build
- run: |
set -o pipefail
cd ${{ matrix.project }}
yarn hardhat cannon:build --upgrade-from ${{ matrix.cannonPackage }} \
--network ${{ matrix.network }} --dry-run \
--impersonate ${{ matrix.impersonate}} | tee deployment.txt
# verify that a new proxy has not been deployed, we cannot edit the proxy
# this is kind of hacky but sufficient for the time being
- run: '! grep "exec: contract.InitialProxy\|exec: contract.InitialCoreProxy" ${{ matrix.project }}/deployment.txt'
- run: yarn workspaces foreach --topological-dev --recursive --verbose --from ${{ matrix.workspace }} run build:ts
- name: "Simulate release of '${{ matrix.cannonPackage }}' on chains '${{ matrix.chains }}'"
run: |
CHAINS="${{ matrix.chains }}"
WORKSPACE="${{ matrix.workspace }}"
for CHAIN in $CHAINS; do
echo
echo
echo
echo "...Checking $WORKSPACE on $CHAIN"

yarn workspace ${{ matrix.workspace }} exec \
hardhat cannon:build \
--dry-run \
--network $CHAIN \
--upgrade-from ${{ matrix.cannonPackage }}:latest \
--impersonate ${{ matrix.impersonate }} | tee deployment.log

grep 'Successfully built package ${{ matrix.cannonPackage }}' deployment.log
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to ensure that build actually happened and not simply failed (as it used to be), so the step will fail if hardhat does not actually build anything.


if [ $(grep -c 'exec: contract.${{ matrix.proxy }}' deployment.log) -gt 0 ]; then
echo "Proxy ${{ matrix.proxy }} was modified"
exit 1
fi
done
Loading