Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
f32635d
remove .env from git tracking
Xm0onh Jun 9, 2025
7215f91
detect epoch transitions in staking indexer
Xm0onh Jun 9, 2025
2ffc9d9
Add schema and protocol logic to capture share price of each operator…
Xm0onh Jun 10, 2025
7a3cc10
Capture known and pending shares of each nominator at each block with…
Xm0onh Jun 12, 2025
9883d07
Fix conflict error in staking db
Xm0onh Jun 12, 2025
7c2f5c8
commenting all the staking triggers
Xm0onh Jun 14, 2025
004df3d
clean up domain table schema in staking
Xm0onh Jun 14, 2025
85d7ad9
remove domain epoch table in staking
Xm0onh Jun 14, 2025
dabc3d7
remove account table from staking
Xm0onh Jun 14, 2025
a3cf41c
remove deposits table from staking
Xm0onh Jun 14, 2025
5a03039
removing sort_id from staking schemas
Xm0onh Jun 14, 2025
61f4e34
replace deposit event with nominator deposits - add missing fields
Xm0onh Jun 14, 2025
b3903a6
clean and remove sort id and wrong share calculation method - add tra…
Xm0onh Jun 15, 2025
0cb4804
update domain staking summary schema and remove unnecessary fields
Xm0onh Jun 15, 2025
ee21af4
Update nominators schema in staking indexer
Xm0onh Jun 15, 2025
d801982
staking worker init
Xm0onh Jun 15, 2025
87c35e9
Add redis service in runtime - get total pending deposits at end of e…
Xm0onh Jun 20, 2025
9ce903a
Add nominator withdrawals event list to redis and process end of epoch
Xm0onh Jun 20, 2025
163dc40
track epoch transition and following actions per domain
Xm0onh Jun 20, 2025
be4de48
Rename accountId to address
Xm0onh Jun 20, 2025
140a768
Implement worker functions for lazy conversion of deposits and withdr…
Xm0onh Jun 25, 2025
da7733e
Add new indexes and compatible staking tables following graphql schemas
Xm0onh Jun 25, 2025
b8079d6
Add staking worker docker compose file
Xm0onh Jun 25, 2025
a2d7a82
Add process flag for unlock events
Xm0onh Jun 25, 2025
42b3f16
Add related functions for fetching unprocessed unlock events
Xm0onh Jun 26, 2025
708e3b5
Handle re-org properly with pushing processing K blocks behind tip - …
Xm0onh Jun 26, 2025
6ae9d93
process unlock events of each nominator
Xm0onh Jun 27, 2025
1c272bc
remove domain block history entries from staking
Xm0onh Jun 27, 2025
d1a9c99
Delete withdraw events table from staking indexer
Xm0onh Jun 30, 2025
23ea01e
Delete DomainStakingHistory table from staking indexer and update res…
Xm0onh Jun 30, 2025
57b8523
Modify bundle submission schema - removed unnecessary feilds and types
Xm0onh Jul 1, 2025
f8d84e4
Update operator schema in staking db
Xm0onh Jul 1, 2025
8dbcb3b
Add processed flag to tables related to operator metrics
Xm0onh Jul 1, 2025
8e90522
Add functions to process operators data across diff tables in staking…
Xm0onh Jul 2, 2025
66beaa2
Add parallel generic process over batch of tasks in staking worker
Xm0onh Jul 2, 2025
4522b22
init unlock event process due to operator deregisteration
Xm0onh Jul 4, 2025
01b3fd0
cleanup and reorganize staking worker project
Xm0onh Jul 4, 2025
8f0e92e
Add new field to nominator table to track total withdrawn shares besi…
Xm0onh Jul 4, 2025
ed5b22a
remove operator staking history table
Xm0onh Jul 4, 2025
762a73c
Remove unuseful and redundant functions and replace them with existin…
Xm0onh Jul 4, 2025
3bba73c
Cleanup and update the readme and .env files - add doc about staking …
Xm0onh Jul 7, 2025
a4fee2d
Make the task batch code cleaner
Xm0onh Jul 8, 2025
12e318c
removing placeholders and resolved comments
Xm0onh Jul 8, 2025
6bdded5
remove placeholder functions in autonomysService and use auto_sdk
Xm0onh Jul 8, 2025
0c71c7e
Merge branch 'main' into ref/staking-v2
Xm0onh Jul 8, 2025
53c09ec
Merge pull request #1657 from autonomys/ref/staking-v2
Xm0onh Jul 8, 2025
f68bed6
Add linter to indexers
Xm0onh Jul 9, 2025
7f66dd6
Run linter on indexers
Xm0onh Jul 9, 2025
403ed6e
Add format and linter check to github workflow
Xm0onh Jul 9, 2025
fcbfc93
Separate staking database from the rest of indexers
Xm0onh Jul 10, 2025
9c5d65c
Update env example with new values for staking db
Xm0onh Jul 10, 2025
eddfa5e
Add format and linter check to github workflow
Xm0onh Jul 9, 2025
4663d23
Merge pull request #1661 from autonomys/linter-for-indexers
Xm0onh Jul 10, 2025
6d3dd36
Merge branch 'main' into ref/separate-staking
Xm0onh Jul 10, 2025
d3a1d98
fix typo in github workflow
Xm0onh Jul 10, 2025
8c9c021
fix typo of $ operator in docker compose file
Xm0onh Jul 10, 2025
dfb6e03
Fix dependency in staking worker in package.json command
Xm0onh Jul 10, 2025
218e173
Merge pull request #1662 from autonomys/ref/separate-staking
Xm0onh Jul 11, 2025
5f02490
disable sequential and update read random page read cost of postgres
Xm0onh Jul 11, 2025
5118af4
Add GIST indexes on managed tables by subquery
Xm0onh Jul 11, 2025
fc9d0c8
Merge pull request #1663 from autonomys/ref/add-missing-indexes
Xm0onh Jul 12, 2025
04ba91e
feat(deploy): add core infra deployment scripts and infrastructure do…
0xjeremyfrank Jul 23, 2025
6e615be
chore: add .yarnrc.yml for node-modules linker and update package.jso…
0xjeremyfrank Jul 23, 2025
64fdf46
chore: update Dockerfile for multi-stage build, add Redis service to …
0xjeremyfrank Jul 23, 2025
dfd2efa
feat: set up staking infrastructure with PostgreSQL, PGCat, Redis, an…
0xjeremyfrank Jul 24, 2025
4ad484a
chore: update Makefiles to use 'docker compose' instead of 'docker-co…
0xjeremyfrank Jul 24, 2025
0a19781
chore: refactor PGCat configuration in Docker Compose files; replace …
0xjeremyfrank Jul 24, 2025
b574009
chore: update package.json and lerna.jsonto include specific workspac…
0xjeremyfrank Jul 24, 2025
74d67bc
feat: add shared blockchain node configuration with Docker Compose, e…
0xjeremyfrank Jul 24, 2025
f9b2eec
Remove leaderboard components and related queries from the codebase, …
0xjeremyfrank Jul 24, 2025
2b4fbd8
Merge pull request #1666 from autonomys/remove-leaderboard
0xjeremyfrank Jul 25, 2025
fd00324
Merge branch 'main' into infra-deploy-restructure
0xjeremyfrank Jul 25, 2025
021f326
feat: add show-urls target to Makefiles for core and staking services…
0xjeremyfrank Jul 25, 2025
36b8a91
chore: enhance pgcat entrypoint scripts with error handling and updat…
0xjeremyfrank Jul 25, 2025
2d5134a
chore: update database port configuration in environment files and Do…
0xjeremyfrank Jul 25, 2025
2f8fe08
Merge pull request #1664 from autonomys/infra-deploy-restructure
0xjeremyfrank Jul 25, 2025
5fd93ac
chore(deps): update dependency nodemon to ^3.1.10
renovate[bot] Jul 25, 2025
39e0afa
Merge pull request #1647 from autonomys/renovate/nodemon-3.x
0xjeremyfrank Jul 25, 2025
a05f044
chore(deps): update dependency eslint-plugin-tailwindcss to ^3.18.2
renovate[bot] Jul 25, 2025
2af2a7e
Merge pull request #1668 from autonomys/renovate/eslint-plugin-tailwi…
0xjeremyfrank Jul 26, 2025
583cfa0
chore(deps): update dependency @subql/cli to ^5.14.1 (#1509)
renovate[bot] Jul 26, 2025
5d0f783
refactor(layout): replace OutOfSyncBanner and UnsupportedNetworkBanne…
clostao Sep 1, 2025
8eb9e52
feat(layout): restore UnsupportedNetworkBanner to MainLayout component
clostao Sep 1, 2025
aa0b32b
fix(DeprecatingBanner): improve layout and text alignment for better …
clostao Sep 1, 2025
528f7fe
fix(DeprecatingBanner): update deprecation message for clarity and em…
clostao Sep 1, 2025
c6200d5
Merge pull request #1674 from autonomys/add-deprecating-msg
clostao Sep 1, 2025
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
59 changes: 0 additions & 59 deletions .env

This file was deleted.

7 changes: 7 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ DB_PASSWORD=postgres
DB_PORT=5432
DB_HOST=postgres

STAKING_DB_USER=postgres
STAKING_DB_DATABASE=staking
STAKING_DB_PASSWORD=postgres
STAKING_DB_PORT=5433
STAKING_INTERNAL_PORT=5432
STAKING_DB_HOST=postgres-staking

HASURA_GRAPHQL_PORT=8080
HASURA_GRAPHQL_ADMIN_SECRET=helloworld

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ jobs:
- name: Generate types and project manifest 🔗
run: yarn codegen

- name: Check code formatting 🎨
run: yarn format:check

- name: Run linter 🔍
run: yarn lint

- name: Build project 🔧
run: yarn build
ts-lint-and-build-explorer:
Expand Down
80 changes: 80 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash
# Astral Deployment Helper
# Convenience wrapper for managing infrastructure stacks

set -e

COMMAND=$1
STACK=$2

# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color

show_usage() {
echo "Astral Deployment Helper"
echo ""
echo "Usage: ./deploy.sh <command> <stack>"
echo ""
echo "Commands:"
echo " start - Start services"
echo " stop - Stop services"
echo " restart - Restart services"
echo " logs - View logs"
echo " status - Show status"
echo " build - Build services"
echo ""
echo "Stacks:"
echo " core - Core indexing services"
echo " staking - Staking services"
echo " all - All services"
echo ""
echo "Examples:"
echo " ./deploy.sh start core # Start core services"
echo " ./deploy.sh logs staking # View staking logs"
echo " ./deploy.sh status all # Check all services"
}

if [ -z "$COMMAND" ] || [ -z "$STACK" ]; then
show_usage
exit 1
fi

# Execute command for specified stack
execute_command() {
local stack_dir=$1
local stack_name=$2

if [ ! -d "infra/$stack_dir" ]; then
echo -e "${RED}Error: Stack directory 'infra/$stack_dir' not found${NC}"
exit 1
fi

echo -e "${GREEN}Executing '$COMMAND' for $stack_name stack...${NC}"
cd "infra/$stack_dir" && make $COMMAND
cd - > /dev/null
}

case $STACK in
core)
execute_command "core" "Core"
;;
staking)
execute_command "staking" "Staking"
;;
all)
echo -e "${GREEN}Executing '$COMMAND' for all stacks...${NC}"
execute_command "core" "Core"
echo ""
execute_command "staking" "Staking"
;;
*)
echo -e "${RED}Unknown stack: $STACK${NC}"
echo ""
show_usage
exit 1
;;
esac

echo -e "${GREEN}Done!${NC}"
50 changes: 48 additions & 2 deletions docker-compose.workers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# Account Worker
services:
account-worker:
Expand Down Expand Up @@ -42,6 +40,54 @@
DB_UPDATE_CHUNK_DELAY_MS: "${DB_UPDATE_CHUNK_DELAY_MS:-100}"
# Health Check Configuration
DB_HEALTH_CHECK_INTERVAL_MS: "${DB_HEALTH_CHECK_INTERVAL_MS:-10000}"
healthcheck:
test: ["CMD", "node", "-e", "process.exit(0)"]
interval: 30s
timeout: 10s
start_period: 5s
retries: 3

staking-worker:
profiles: [indexers]
build:
context: ./indexers
dockerfile: workers/staking-worker/Dockerfile
depends_on:
pgcat-staking:
condition: service_healthy
postgres-staking:
condition: service_healthy
redis:
condition: service_healthy
# node:
# condition: service_healthy
restart: unless-stopped
environment:
AUTONOMYS_NODE_URL: ${RPC_URLS}
DB_HOST: ${STAKING_DB_HOST:-postgres-staking}
DB_PORT: ${STAKING_INTERNAL_PORT:-5432} # Internal port, not external
DB_USER: ${STAKING_DB_USER:-postgres}
DB_PASSWORD: ${STAKING_DB_PASSWORD:-postgres}
DB_NAME: ${STAKING_DB_DATABASE:-staking}
REDIS_URL: "redis://${REDIS_SERVICE_HOST:-redis}:${REDIS_SERVICE_PORT:-6379}"
BATCH_SIZE: "${BATCH_SIZE:-1000}"
QUEUE_PROCESSING_INTERVAL_MS: "${QUEUE_PROCESSING_INTERVAL_MS:-500}"
# Performance configuration
MAX_CONCURRENT_BATCHES: "${MAX_CONCURRENT_BATCHES:-8}"
DB_POOL_SIZE: "${DB_POOL_SIZE:-25}"
DB_CONNECTION_TIMEOUT_MS: "${DB_CONNECTION_TIMEOUT_MS:-3000}"
# Retry configuration
MAX_RETRIES: "${MAX_RETRIES:-3}"
RETRY_DELAY_MS: "${RETRY_DELAY_MS:-5000}"
# Finality and chain monitoring
FINALITY_THRESHOLD: "${FINALITY_THRESHOLD:-100}"
CHAIN_TIP_UPDATE_INTERVAL_MS: "${CHAIN_TIP_UPDATE_INTERVAL_MS:-10000}"
CHAIN_HEAD_POLL_INTERVAL_MS: "${CHAIN_HEAD_POLL_INTERVAL_MS:-6000}"
# Health Check Configuration
DB_HEALTH_CHECK_INTERVAL_MS: "${DB_HEALTH_CHECK_INTERVAL_MS:-30000}"
# Logging
ENABLE_DEBUG_LOGS: "${ENABLE_DEBUG_LOGS:-false}"
LOG_LEVEL: "${LOG_LEVEL:-info}"
healthcheck:
test: ["CMD", "node", "-e", "process.exit(0)"]
interval: 30s
Expand Down
69 changes: 62 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
volumes:
node-data: {}
postgres_db: {}
postgres_staking_db: {}
redis_db: {}
caddy_config: {}
caddy_data: {}
Expand Down Expand Up @@ -95,6 +96,33 @@ services:
retries: 5
command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]

# Postgres Database for Staking
postgres-staking:
image: postgres:17.3-alpine
volumes:
- postgres_staking_db:/var/lib/postgresql/data
- ./indexers/db/docker-entrypoint-initdb.d/staking-only/00-staking-setup.sql:/docker-entrypoint-initdb.d/00-staking-setup.sql
- ./indexers/db/docker-entrypoint-initdb.d/staking-only/07-schema-staking.sql:/docker-entrypoint-initdb.d/01-schema-staking.sql
- ./indexers/db/postgresql.conf:/etc/postgresql/postgresql.conf
restart: unless-stopped
hostname: postgres-staking
shm_size: 4g
environment:
POSTGRES_DB: ${STAKING_DB_DATABASE:-staking}
POSTGRES_USER: ${STAKING_DB_USER:-postgres}
POSTGRES_PASSWORD: ${STAKING_DB_PASSWORD:-postgres}
POSTGRES_MAX_CONNECTIONS: 200
POSTGRES_HOST_AUTH_METHOD: md5
POSTGRES_INITDB_ARGS: --auth=md5
ports:
- "${STAKING_DB_PORT:-5433}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${STAKING_DB_USER:-postgres}"]
interval: 5s
timeout: 5s
retries: 5
command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]

# PGCat Proxy
pgcat:
image: ghcr.io/postgresml/pgcat:4a7a6a8e7a78354b889002a4db118a8e2f2d6d79
Expand All @@ -115,12 +143,34 @@ services:
condition: service_healthy
restart: unless-stopped

# PGCat Proxy for Staking
pgcat-staking:
image: ghcr.io/postgresml/pgcat:4a7a6a8e7a78354b889002a4db118a8e2f2d6d79
command:
- "pgcat"
- "/etc/pgcat/pgcat.toml"
volumes:
- "./indexers/db/pgcat-staking.toml:/etc/pgcat/pgcat.toml"
ports:
- "6433:6432"
healthcheck:
test: ["CMD", "pgcat", "--version"]
interval: 10s
timeout: 5s
retries: 3
depends_on:
postgres-staking:
condition: service_healthy
restart: unless-stopped

# Hasura GraphQL Engine
hasura:
image: hasura/graphql-engine:v2.40.0
depends_on:
postgres:
condition: service_healthy
postgres-staking:
condition: service_healthy
volumes:
- ./indexers/db/migrations:/hasura-migrations
- ./indexers/db/metadata:/hasura-metadata
Expand All @@ -129,6 +179,7 @@ services:
# Essential Environment Variables
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}
HASURA_GRAPHQL_DATABASE_URL: postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE} # Main database connection
STAKING_DATABASE_URL: postgres://${STAKING_DB_USER:-postgres}:${STAKING_DB_PASSWORD:-postgres}@${STAKING_DB_HOST:-postgres-staking}:${STAKING_INTERNAL_PORT:-5432}/${STAKING_DB_DATABASE:-staking} # Staking database connection
HASURA_GRAPHQL_ADMIN_SECRET: ${HASURA_GRAPHQL_ADMIN_SECRET} # Admin access secret
HASURA_GRAPHQL_JWT_SECRET: ${HASURA_GRAPHQL_JWT_SECRET} # JWT authentication secret

Expand Down Expand Up @@ -263,19 +314,23 @@ services:
ports:
- "127.0.0.1:3003:3000"
depends_on:
pgcat:
pgcat-staking:
condition: service_healthy
postgres:
postgres-staking:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
environment:
ENDPOINT: ${RPC_URLS}
CHAIN_ID: ${CHAIN_ID}
DB_USER: ${DB_USER}
DB_PASS: ${DB_PASSWORD}
DB_DATABASE: ${DB_DATABASE}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_USER: ${STAKING_DB_USER:-postgres}
DB_PASS: ${STAKING_DB_PASSWORD:-postgres}
DB_DATABASE: ${STAKING_DB_DATABASE:-staking}
DB_HOST: ${STAKING_DB_HOST:-postgres-staking}
DB_PORT: ${STAKING_INTERNAL_PORT:-5432} # Internal port, not external
REDIS_HOST: redis
REDIS_PORT: ${REDIS_PORT}
volumes:
- ./indexers/staking:/staking
command:
Expand Down
Loading
Loading