Skip to content

Commit

Permalink
Merge branch 'dev' into feature-trusted-macros-eip712
Browse files Browse the repository at this point in the history
  • Loading branch information
hellwolf committed Aug 30, 2024
2 parents ece63b5 + fb6cd05 commit 8b925d1
Show file tree
Hide file tree
Showing 387 changed files with 28,141 additions and 17,753 deletions.
21 changes: 13 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-18-bookworm",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
// If having issues with Nix then consult:
Expand All @@ -19,21 +19,26 @@
"ghcr.io/lukewiwa/features/shellcheck:0": {},
"ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers-contrib/features/act:1": {}
"ghcr.io/devcontainers-contrib/features/act:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// 1. using nix to create a reproduciable build
// 2. install foundry for people don't want to use nix
// 3. if you want to use nix further, do "nix develop"
"postCreateCommand": "./tasks/fix-devcontainer.sh && nix develop . -c bash <(echo \"yarn install && yarn build\") && curl -L https://foundry.paradigm.xyz | bash & foundryup"

"postCreateCommand": [
"curl -L https://foundry.paradigm.xyz | bash",
"source /home/vscode/.bashrc && foundryup",
"yarn global add npm-run-all",
"yarn install && yarn build",
"sudo apt-get install libpq5", // for subgraph's matchstick
"./tasks/fix-devcontainer.sh && yarn shell . -c bash <(echo \"yarn install && yarn build\")"
]
// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
}
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/subgraph-bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ assignees: 0xdavinchee
**Describe the bug:**
A clear and concise description of what the bug is. What is the data you are having issues with?

**Subgraph endpoint:** [e.g. https://thegraph.com/hosted-service/subgraph/superfluid-finance/protocol-v1-goerli]
**Subgraph endpoint:** [e.g. https://thegraph.com/hosted-service/subgraph/superfluid-finance/protocol-v1-polygon-mainnet]

**Query:**
e.g.
e.g.
```
query MyQuery {
streams(first: 10) {
Expand Down
52 changes: 52 additions & 0 deletions .github/actions/setup-workflow-base/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Setup Workflow Base
description: >
This sets up the base for a workflow, where:
- nix is installed,
- cache is looked up,
- and nix dev shell is setup if cache is missed.
inputs:
package-name:
description: Name of the package where input files are from
required: true
cache-key-prefix:
description: Cache key prefix to attach to the calculated input files hash
required: true
dev-shell-name:
description: Default shell to be used

outputs:
cache-hit:
value: ${{ steps.cache.outputs.cache-hit }}

runs:
using: composite
steps:
- uses: DeterminateSystems/nix-installer-action@v13

- name: Load the half-board nix module
id: hb
run: |
./tasks/mk-cache-key.sh ./packages/${{ inputs.package-name }} > cache.json
jq . cache.json
key_prefix="${{ inputs.cache-key-prefix }}"
path=$(jq '.outputs | join("\n")' cache.json)
hash=$(jq -r .hash cache.json)
echo "path=$path" >> "$GITHUB_OUTPUT"
echo "key=${key_prefix}${hash}" >> "$GITHUB_OUTPUT"
shell: nix develop .#mk-cache-key -c bash -xe {0}

- name: Lookup cache
id: cache
uses: actions/cache@v4
with:
path: ${{ fromJSON(steps.hb.outputs.path) }}
key: ${{ steps.hb.outputs.key }}

- name: Initialize nix dev shell
if: steps.cache.outputs.cache-hit != 'true'
run: |
node --version
yarn --version
shell: nix develop .#${{ inputs.dev-shell-name }} -c bash -xe {0}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ jobs:

defaults:
run:
shell: nix develop -c bash -xe {0}
shell: nix develop .#ci-default -c bash -xe {0}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v19
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: DeterminateSystems/nix-installer-action@v13

- name: "Install dependencies"
run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/call.deploy-dry-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
ethereum-contracts-working-directory: ./packages/ethereum-contracts

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install and Build
run: |
Expand Down
107 changes: 52 additions & 55 deletions .github/workflows/call.deploy-subgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,35 @@ on:
inputs:
vendor:
required: true
description: "Where to deploy subgraph to; superfluid, graph, or satsuma"
description: "Where to deploy subgraph to; superfluid, goldsky, or graph"
type: string
deployment_env:
required: true
type: string
description: 'The subgraph deployment env: v1, dev, feature'
description: "The subgraph deployment env: v1, dev, feature"
network:
required: true
type: string
description: 'The network you want to deploy to (matic, xdai, eth-mainnet, etc.) or `all` for all networks.'
description: "The network you want to deploy to (matic, xdai, eth-mainnet, etc.) or `all` for all networks."

secrets:
SUBGRAPH_URL_TEMPLATE:
description: 'Subgraph endpoint url template'
description: "Subgraph endpoint url template"
required: false
SATSUMA_DEPLOY_KEY:
description: 'Satsuma deploy key'
description: "Satsuma deploy key"
required: false
THE_GRAPH_ACCESS_TOKEN:
description: 'The Graph (hosted service) access token for deploying subgraphs'
description: "The Graph access token for deploying subgraphs"
required: false
GOLDSKY_API_KEY:
description: "Goldsky API key for deploying subgraphs"
required: false
AIRSTACK_API_KEY:
description: "Airstack API key for deploying subgraphs"
required: false
SUPERFLUID_IPFS_API:
description: 'Superfluid IPFS API endpoint'
description: "Superfluid IPFS API endpoint"
required: false

jobs:
Expand All @@ -49,19 +55,45 @@ jobs:
echo github.head_ref: "$HEAD_REF"
echo github.base_ref: ${{ github.base_ref }}
determine-networks:
name: Determine Networks
runs-on: ubuntu-latest
outputs:
networks: ${{ steps.determine.outputs.networks }}
steps:
- uses: actions/checkout@v4

- name: "Determine vendors for the network"
id: determine
run: |
networks=$(jq -r --arg vendor "${{ inputs.vendor }}" --arg network "${{ inputs.network }}" '
if $network == "all" then
.[$vendor] | @json
else
[$network] | @json
end' packages/subgraph/tasks/vendorNetworkMap.json)
if [ -z "$networks" ] || [ "$networks" == "null" ]; then
echo "Unsupported vendor or network: ${{ inputs.vendor }} / ${{ inputs.network }}"
exit 1
fi
echo "networks=$networks" >> "$GITHUB_OUTPUT"
deploy-subgraph:
name: Build and Deploy Subgraph

runs-on: ubuntu-latest
env:
subgraph-working-directory: ./packages/subgraph
needs: determine-networks
strategy:
matrix:
network: ${{ fromJson(needs.determine-networks.outputs.networks) }}
fail-fast: false

defaults:
run:
shell: nix develop -c bash {0}
shell: nix develop .#ci-default -c bash {0}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v19
with:
Expand All @@ -74,55 +106,20 @@ jobs:
run: yarn build
working-directory: ./packages/ethereum-contracts

- name: "Get ABI"
run: node scripts/getAbi.js
working-directory: ${{ env.subgraph-working-directory }}

- name: "Prepare subgraph manifest"
# This step is required for generating a preliminary subgraph.yaml
# and addresses.ts file for the yarn codegen step below
# using a mock.json networks file.
run: ./tasks/prepare-manifest.sh mock
working-directory: ${{ env.subgraph-working-directory }}

- name: "Generate meta.ignore.ts file"
# Collects metadata like the git branch and commit hash
run: "yarn generate-sf-meta"
working-directory: ${{ env.subgraph-working-directory }}
env:
COMMIT_HASH: ${{ github.sha }}
CONFIGURATION: ${{ inputs.deployment_env }}

- name: "Generate AssemblyScript types"
run: "yarn codegen"
working-directory: ${{ env.subgraph-working-directory }}

- name: Get Hosted Service Networks from metadata
run: npx ts-node ./scripts/getHostedServiceNetworks.ts
working-directory: ${{ env.subgraph-working-directory }}

# - name: Ensure deployment_env property is passed
# run: |
# if [ "${{ inputs.deployment_env }}" == "" ];then
# echo "You must pass in the deployment_env at a minimum."
# exit 1
# fi

# If tagged, get subgraph tag name that starts with subgraph@. Outputs $GIT_TAG_NAME
- uses: olegtarasov/[email protected]
id: "getSubgraphTag"
with:
tagRegex: "subgraph@(.*)"

# Version is the git tag or revision
# Version is from subgraph@<version> git tag if exists, else short git commit revision
- name: "Deploy to a node"
run: |
shortRev=$(git rev-parse --short ${{ github.sha }})
versionLabel="${GIT_TAG_NAME:-$shortRev}"
./tasks/deploy.sh -o ${{ inputs.vendor }} -n ${{ inputs.network }} -r ${{ inputs.deployment_env }} -v $versionLabel
working-directory: ${{ env.subgraph-working-directory }}
versionTag=$(git tag --contains ${{ github.sha }} | grep "^subgraph@" | sed 's/^subgraph@//')
versionLabel="${versionTag:-$shortRev}"
./tasks/deploy.sh -o ${{ inputs.vendor }} -n ${{ matrix.network }} -r ${{ inputs.deployment_env }} -v $versionLabel
working-directory: ./packages/subgraph
env:
SUBGRAPH_URL_TEMPLATE: ${{ secrets.SUBGRAPH_URL_TEMPLATE }}
SUPERFLUID_IPFS_API: ${{ secrets.SUPERFLUID_IPFS_API }}
THE_GRAPH_ACCESS_TOKEN: ${{ secrets.THE_GRAPH_ACCESS_TOKEN }}
SATSUMA_DEPLOY_KEY: ${{ secrets.SATSUMA_DEPLOY_KEY }}
GOLDSKY_API_KEY: ${{ secrets.GOLDSKY_API_KEY }}
AIRSTACK_API_KEY: ${{ secrets.AIRSTACK_API_KEY }}
COMMIT_HASH: ${{ github.sha }}
CONFIGURATION: ${{ inputs.deployment_env }}
35 changes: 22 additions & 13 deletions .github/workflows/call.test-automation-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,44 @@ jobs:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18, 20]

defaults:
run:
shell: nix develop .#ci-node${{ matrix.node-version }} -c bash -xe {0}
shell: nix develop .#ci-default -c bash -xe {0}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v19
- name: Setup workflow base
id: base
uses: ./.github/actions/setup-workflow-base
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
package-name: automation-contracts
cache-key-prefix: automation-contracts-
dev-shell-name: ci-default

- name: Install, lint and build
- name: Install dependencies
if: steps.base.outputs.cache-hit != 'true'
run: |
yarn install --frozen-lockfile
solc --version
forge --version
- name: Lint and build
if: steps.base.outputs.cache-hit != 'true'
run: |
yarn lint
yarn build
- name: Test automation-contracts-scheduler
if: steps.base.outputs.cache-hit != 'true'
run: |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC" >> $GITHUB_ENV
yarn workspace scheduler test
env:
FOUNDRY_PROFILE: ci

- name: Test automation-contracts-autowrap
if: steps.base.outputs.cache-hit != 'true'
run: |
echo "FOUNDRY_PROFILE=ci" >> $GITHUB_ENV
echo "FOUNDRY_SOLC_VERSION=$SOLC" >> $GITHUB_ENV
yarn workspace autowrap test
env:
FOUNDRY_PROFILE: ci
Loading

0 comments on commit 8b925d1

Please sign in to comment.