Skip to content

Commit

Permalink
Simulate release for each package and fail if Initial Proxy has been …
Browse files Browse the repository at this point in the history
…redeployed
  • Loading branch information
noisekit committed Aug 11, 2023
1 parent 8f6f993 commit fcdd50f
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-packages.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "Validate yarn.lock and cache"

on:
pull_request: {}
# pull_request: {}
push:
branches:
- "main"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Lint

on:
pull_request: {}
# pull_request: {}
push:
branches:
- "main"
Expand Down
88 changes: 70 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,52 @@ jobs:
strategy:
fail-fast: false
matrix:
network: [goerli, optimistic-goerli]
project: [protocol/oracle-manager, protocol/synthetix]
workspace:
[
"@synthetixio/main",
"@synthetixio/oracle-manager",
"@synthetixio/governance",
"@synthetixio/legacy-market",
"@synthetixio/spot-market",
"@synthetixio/perps-market",
]
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"

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

- workspace: "@synthetixio/governance"
cannonPackage: "oracle-manager"
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 +72,34 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.16.0"
node-version: "16.20.1"
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
if [ $(grep -c 'exec: contract.${{ matrix.proxy }}' deployment.log) -gt 0 ]; then
echo "Proxy ${{ matrix.proxy }} was modified"
exit 1
fi
done
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Test

on:
pull_request: {}
# pull_request: {}

jobs:
test:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Router.sol
typechain-types
lerna-debug.log

deployment*.log

# Yarn v3
.yarn/*
!.yarn/cache
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"prepublishOnly": "node ./prepublishOnly.js",
"docgen": "yarn workspaces foreach --verbose run docgen && yarn docgen:contracts",
"docgen:contracts": "yarn workspace @synthetixio/docgen docgen:contracts",
"subgraphgen": "yarn workspaces foreach --verbose run subgraphgen"
"subgraphgen": "yarn workspaces foreach --verbose run subgraphgen",
"simulate-release": "yarn workspaces foreach --verbose run simulate-release:goerli && yarn workspaces foreach --verbose run simulate-release:optimistic-goerli"
},
"devDependencies": {
"@ethersproject/abi": "^5.7.0",
Expand Down

0 comments on commit fcdd50f

Please sign in to comment.