Skip to content

Commit

Permalink
subgraph actions
Browse files Browse the repository at this point in the history
  • Loading branch information
kyscott18 committed Nov 14, 2023
1 parent abf1a21 commit 8d60317
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 82 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,68 @@ jobs:
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
bench-ponder:
bench-subgraph:
name: Bench:Subgraph
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_INITDB_ARGS: -E UTF8 --locale=C
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 10
ports:
- 5432:5432
anvil:
image: ghcr.io/0xolias/simple-anvil-image:main
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}
ANVIL_FORK_BLOCK_NUMBER: 17500000
ports:
- 8545:8545
ipfs:
image: ipfs/go-ipfs:v0.10.0
ports:
- 5001:5001
graph-node:
image: graphprotocol/graph-node:latest
# Would be best to get this health check working, but so far it hasn't been an issue.
# options: >-
# --health-cmd "curl --fail http://graph-node:8040"
env:
postgres_host: postgres
postgres_user: postgres
postgres_pass: postgres
postgres_db: postgres
ipfs: ipfs:5001
ethereum: mainnet:${{ secrets.ANVIL_FORK_URL }}
ETHEREUM_REORG_THRESHOLD: 0
GRAPH_LOG: debug
ports:
- 8000:8000
- 8001:8001
- 8020:8020
- 8030:8030
- 8040:8040
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Codegen
run: cd benchmarks && pnpm graph codegen subgraph/subgraph.yaml

- name: Bench
run: pnpm bench:subgraph:ci
env:
ANVIL_FORK_URL: ${{ secrets.ANVIL_FORK_URL }}
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
2 changes: 1 addition & 1 deletion benchmarks/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
image: ghcr.io/0xolias/simple-anvil-image:main
environment:
ANVIL_FORK_URL: "${ANVIL_FORK_URL}"
# ANVIL_FORK_BLOCK_NUMBER: 17500000
ANVIL_FORK_BLOCK_NUMBER: 17500000
ports:
- 8545:8545
graph-node:
Expand Down
7 changes: 3 additions & 4 deletions benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
"name": "ponder-benchmarks",
"private": true,
"scripts": {
"bench:ponder": "export $(grep -v '^#' .env.local | xargs) && rm -rf data/ && docker-compose up --detach -p 8545:8545 && (bun run src/ponder.ts || true) && docker-compose down",
"bench:ponder:ci": "bun run src/ponder.ts",
"bench:ponder": "export $(grep -v '^#' .env.local | xargs) && rm -rf data/ && docker-compose up --detach -p 8545:8545 && tsup-node && (node dist/ponder.mjs|| true) && docker-compose down",
"bench:ponder:ci": "tsup-node && node dist/ponder.mjs",
"bench:subgraph": "export $(grep -v '^#' .env.local | xargs) && rm -rf data/ && docker-compose up --detach && tsup-node && (node dist/subgraph.mjs || true) && docker-compose down",
"bench:subgraph:ci": "tsup-node && node dist/subgraph.mjs"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.54.0-alpha-20230727052453-1e0e6e5",
"@graphprotocol/graph-cli": "0.61.0",
"@graphprotocol/graph-ts": "^0.31.0",
"@ponder/core": "workspace:*",
"@types/node": "^20.9.0",
"bun": "^1.0.11",
"execa": "^8.0.1",
"parse-prometheus-text-format": "^1.1.1",
"tsup": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/ponder/ponder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const config = createConfig({
{
name: "mainnet",
chainId: 1,
transport: http("http://127.0.0.1:8545"),
transport: http(process.env.ANVIL_FORK_URL),
},
],
contracts: [
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/src/ponder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const waitForSetupComplete = async () => {

timeout = setTimeout(() => {
clearInterval(interval);
reject(new Error("Timed out waiting for subgraph to sync"));
reject(new Error("Timed out waiting for ponder to sync"));
}, 60_000);
});

Expand Down Expand Up @@ -66,7 +66,7 @@ const waitForSyncComplete = async () => {

timeout = setTimeout(() => {
clearInterval(interval);
reject(new Error("Timed out waiting for subgraph to sync"));
reject(new Error("Timed out waiting for ponder to sync"));
}, 60_000);
});

Expand Down
4 changes: 4 additions & 0 deletions benchmarks/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@
"remove-local": "graph remove --node http://localhost:8020/ test/subgraph",
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 test/subgraph",
"test": "graph test"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.61.0",
"@graphprotocol/graph-ts": "^0.31.0"
}
}
4 changes: 2 additions & 2 deletions benchmarks/subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
specVersion: 0.0.9
specVersion: 0.0.5
schema:
file: ./schema.graphql
dataSources:
Expand All @@ -11,7 +11,7 @@ dataSources:
startBlock: 17490000
mapping:
kind: ethereum/events
apiVersion: 0.0.8
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- Approval
Expand Down
Loading

0 comments on commit 8d60317

Please sign in to comment.