Skip to content
Draft
Show file tree
Hide file tree
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
28 changes: 14 additions & 14 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docker
on:
push:
tags:
- 'v*'
- "v*"
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -16,12 +16,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1

- uses: actions/setup-node@v3
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 20
cache: 'npm'
node-version: 24
cache: "npm"

- name: Install dependencies
run: npm ci
Expand All @@ -33,14 +33,13 @@ jobs:
run: npm run ci:test

- name: Publish coveralls report
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e #2.3.7
with:
path-to-lcov: 'coverage/lcov.info'
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 #v6.2.0
with:
images: |
name=ghcr.io/cartesi/rollups-explorer-api
Expand All @@ -51,28 +50,29 @@ jobs:
type=ref,event=pr

- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 #v4.4.0
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 #v4.4.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: depot/setup-action@v1
- name: Set up Depot
uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 #1.7.1

- name: Build and push docker image
id: docker_build
uses: depot/bake-action@v1
uses: depot/bake-action@1d58c2668346981089b088b7ef36755b206b20e9 #1.13.0
with:
files: |
./docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file }}
./docker-bake.platforms.hcl
cwd://${{ steps.docker_meta.outputs.bake-file }}
push: true
project: ${{ vars.DEPOT_PROJECT }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ npm-debug.log*
# Generated folders/files
/src/model
/src/abi
/src/deployments

#Test outputs
/coverage
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ FROM node-with-gyp AS builder
WORKDIR /squid
ADD package.json .
ADD package-lock.json .
ADD commands.json .
ADD assets assets
ADD abi abi
ADD db db
ADD schema.graphql .
RUN npm ci
ADD tsconfig.json .
ADD codegen.mjs .
ADD src src
RUN npm ci
RUN npm run build

FROM node-with-gyp AS deps
Expand All @@ -35,4 +38,3 @@ RUN echo -e "loglevel=silent\\nupdate-notifier=false" > /squid/.npmrc
RUN npm i -g @subsquid/commands && mv $(which squid-commands) /usr/local/bin/sqd
ENV CHAIN_ID 31337
ENV RPC_ENDPOINT http://localhost:8545
ENV PROCESSOR_PROMETHEUS_PORT 3000
44 changes: 30 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ That project requires [docker](https://docker.com) to be installed so the backen

> Supported Chains: 1, 11155111, 10, 11155420, 8453, 84532, 42161, 421614, 31337, 13370

| Variables | Default | Description |
| :-------------------------: | :--------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| `ARCHIVE_GATEWAY_API_KEY` | `NONE` | **Required** API Key to access the SQD archive nodes on supported chains. Check [SQD portal app](https://portal.sqd.dev/app) |
| `CHAIN_IDS` | `31337` | Comma separated supported chain ids to be indexed |
| `RPC_URL_1` | `https://rpc.ankr.com/eth` | Endpoint for Mainnet RPC node |
| `RPC_URL_11155111` | `https://rpc.ankr.com/eth_sepolia` | Endpoint for Sepolia RPC node |
| `RPC_URL_{31337 \| 13370}` | `http://127.0.0.1:8545` | Endpoint for local node |
| `RPC_URL_10` | `https://mainnet.optimism.io` | Endpoint for Optimism Mainnet RPC node |
| `RPC_URL_11155420` | `https://sepolia.optimism.io` | Endpoint for Optimism Sepolia RPC node |
| `RPC_URL_8453` | `https://mainnet.base.org` | Endpoint for Base Mainnet RPC node |
| `RPC_URL_84532` | `https://sepolia.base.org` | Endpoint for Base Sepolia RPC node |
| `RPC_URL_42161` | `https://arb1.arbitrum.io/rpc` | Endpoint for Arbitrum RPC node |
| `RPC_URL_421614` | `https://sepolia-rollup.arbitrum.io/rpc` | Endpoint for Arbitrum Sepolia RPC node |
| `RPC_RATE_LIMIT_{CHAIN_ID}` | `undefined` | Option to fine tune concurrent requests by rate limiting the requests to RPC node providers. Replace {CHAIN_ID} with a supported chain id and set a Number e.g. 15. That is good to avoid [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) status code when using free tiers. The default is Full speed |
| Variables | Default | Description |
| :------------------------------------: | :--------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| `PROCESSOR_PROMETHEUS_PORT_<CHAIN_ID>` | 3000 ~ 3009 | Check each prometheus default port per chain [here](#prometheus-ports-per-chain) |
| `ARCHIVE_GATEWAY_API_KEY` | `NONE` | **Required** API Key to access the SQD archive nodes on supported chains. Check [SQD portal app](https://portal.sqd.dev/app) |
| `CHAIN_IDS` | `31337` | Comma separated supported chain ids to be indexed |
| `RPC_URL_1` | `https://rpc.ankr.com/eth` | Endpoint for Mainnet RPC node |
| `RPC_URL_11155111` | `https://rpc.ankr.com/eth_sepolia` | Endpoint for Sepolia RPC node |
| `RPC_URL_{31337 \| 13370}` | `http://127.0.0.1:8545` | Endpoint for local node |
| `RPC_URL_10` | `https://mainnet.optimism.io` | Endpoint for Optimism Mainnet RPC node |
| `RPC_URL_11155420` | `https://sepolia.optimism.io` | Endpoint for Optimism Sepolia RPC node |
| `RPC_URL_8453` | `https://mainnet.base.org` | Endpoint for Base Mainnet RPC node |
| `RPC_URL_84532` | `https://sepolia.base.org` | Endpoint for Base Sepolia RPC node |
| `RPC_URL_42161` | `https://arb1.arbitrum.io/rpc` | Endpoint for Arbitrum RPC node |
| `RPC_URL_421614` | `https://sepolia-rollup.arbitrum.io/rpc` | Endpoint for Arbitrum Sepolia RPC node |
| `RPC_RATE_LIMIT_{CHAIN_ID}` | `undefined` | Option to fine tune concurrent requests by rate limiting the requests to RPC node providers. Replace {CHAIN_ID} with a supported chain id and set a Number e.g. 15. That is good to avoid [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) status code when using free tiers. The default is Full speed |

For use with local devnet for fine tunning and deal with any unexpected changes e.g. Foundry nightly versions.

Expand All @@ -44,6 +45,21 @@ Subsquid Related variables on Development mode. Check the docker-compose and com
| `DB_USER` | `postgres` | Database user |
| `GQL_PORT` | `4350` | GraphQL API port |

#### Prometheus ports per chain

| Chain | Chain ID | Prometheus port |
| :-------------------------- | ---------: | --------------: |
| Ethereum Mainnet | `1` | `3000` |
| Ethereum Sepolia | `11155111` | `3001` |
| Optimism Mainnet | `10` | `3002` |
| Optimism Sepolia | `11155420` | `3003` |
| Base Mainnet | `8453` | `3004` |
| Base Sepolia | `84532` | `3005` |
| Arbitrum One | `42161` | `3006` |
| Arbitrum Sepolia | `421614` | `3007` |
| Cannon local network | `13370` | `3008` |
| Anvil/Foundry local network | `31337` | `3009` |

### Development

The project is using the **npm** as the package manager to facilitate integration with subsquid, since that is the preferred choice.
Expand Down
3 changes: 1 addition & 2 deletions commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@
"cmd": ["node", "--require=dotenv/config", "lib/main.js"]
},
"process:prod": {
"description": "Start the squid processor",
"deps": ["migration:apply"],
"description": "Start the squid processor. It does not apply migration or load .env",
"cmd": ["node", "lib/main.js"],
"hidden": true
},
Expand Down
Loading