Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into xchain-pools
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeal-eth committed Aug 17, 2023
2 parents 3edc204 + 1c5ab0c commit 0bbd1ab
Show file tree
Hide file tree
Showing 257 changed files with 37,274 additions and 394,941 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ utils/*/utils
**/contracts/generated
**/test/generated
**/artifacts
**/subgraph/deployments
**/subgraph/build
**/subgraph/.bin
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ module.exports = {
},

{
files: ['protocol/synthetix/subgraph/**/*'],
files: [
'protocol/synthetix/subgraph/**/*',
'markets/spot-market/subgraph/**/*',
'markets/perps-market/subgraph/**/*',
],
env: {},
globals: {
changetype: true,
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/check-packages.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: "Validate yarn.lock and cache"

on: [pull_request]
on:
pull_request: {}
push:
branches:
- "main"

jobs:
check:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/docgen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Docgen

on:
push:
branches:
- "docgen"

jobs:
docgen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.16.0"
cache: "yarn"
- run: yarn --version
- run: yarn install --immutable --immutable-cache
- run: yarn workspaces foreach --topological-dev --verbose run build:ts
- run: yarn docgen
- run: git diff --exit-code
8 changes: 7 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Lint
on: [push]

on:
pull_request: {}
push:
branches:
- "main"

jobs:
lint:
runs-on: ubuntu-latest
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,24 +7,61 @@ on:
- "main"

jobs:
test:
simulate-release:
runs-on: ubuntu-latest
env:
CANNON_SETTINGS: ${{ secrets.CANNON_SETTINGS }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
CANNON_IPFS_URL: "http://127.0.0.1:5001"
CANNON_PUBLISH_IPFS_URL: "http://127.0.0.1:5001"
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"

- 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 @@ -34,19 +71,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
114 changes: 114 additions & 0 deletions .github/workflows/test-with-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Coverage

on:
push:
branches:
- "main"

jobs:
coverage:
runs-on: ubuntu-latest
env:
CANNON_IPFS_URL: "http://127.0.0.1:5001"
CANNON_PUBLISH_IPFS_URL: "http://127.0.0.1:5001"
strategy:
fail-fast: false
matrix:
workspace: [
"@synthetixio/main",
"@synthetixio/oracle-manager",
# "@synthetixio/governance", # no tests :/

"@synthetixio/core-contracts",
"@synthetixio/core-utils",
"@synthetixio/core-modules",
"@synthetixio/hardhat-storage",
"@synthetixio/sample-project",

# "@synthetixio/legacy-market", # tests fail
"@synthetixio/spot-market",
"@synthetixio/perps-market",

"@synthetixio/core-subgraph",
"@synthetixio/spot-market-subgraph",
"@synthetixio/perps-market-subgraph",
]

include:
- workspace: "@synthetixio/main"
codecov-file: protocol/synthetix/coverage.json
codecov-flags: main

- workspace: "@synthetixio/oracle-manager"
codecov-file: protocol/oracle-manager/coverage.json
codecov-flags: oracle-manager

- workspace: "@synthetixio/core-contracts"
codecov-file: utils/core-contracts/coverage.json
codecov-flags: core-contracts

- workspace: "@synthetixio/core-utils"
codecov-file: utils/core-utils/coverage/lcov.info
codecov-flags: core-utils

- workspace: "@synthetixio/core-modules"
codecov-file: utils/core-modules/coverage.json
codecov-flags: core-modules

- workspace: "@synthetixio/hardhat-storage"
codecov-file: utils/hardhat-storage/coverage/lcov.info
codecov-flags: hardhat-storage

- workspace: "@synthetixio/sample-project"
codecov-file: utils/sample-project/coverage.json
codecov-flags: sample-project

steps:
- name: Install Foundry (Cannon)
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- run: anvil -V
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.20.1"
cache: "yarn"
- uses: ibnesayeed/setup-ipfs@92d412e0dad36c06ffab50733e9c624896a0964f
with:
run_daemon: true

- run: yarn install --immutable --immutable-cache
- run: yarn workspaces foreach --topological-dev --recursive --verbose --from "${{ matrix.workspace }}" run build:ts
- run: yarn workspaces foreach --topological-dev --recursive --verbose --from "${{ matrix.workspace }}" run build-testable

- name: Execute size-contracts command
run: |
if yarn workspace ${{ matrix.workspace }} run | grep size-contracts; then
yarn workspace ${{ matrix.workspace }} run size-contracts
else
echo 'SKIP. No "size-contracts" script'
fi
- name: Check storage.dump.sol is up-to-date
run: |
if yarn workspace ${{ matrix.workspace }} run | grep check:storage; then
yarn workspace ${{ matrix.workspace }} run check:storage
else
echo 'SKIP. No "check:storage" script'
fi
- name: Execute tests with coverage
run: |
if yarn workspace ${{ matrix.workspace }} run | grep coverage; then
REPORT_GAS=true yarn workspace ${{ matrix.workspace }} run coverage
else
echo 'SKIP. No "coverage" script'
fi
- if: ${{ matrix.codecov-file }}
name: Upload ${{ matrix.workspace }} coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ${{ matrix.codecov-file }}
flags: ${{ matrix.codecov-flags }}
Loading

0 comments on commit 0bbd1ab

Please sign in to comment.