Skip to content

Commit 9768bb2

Browse files
authored
Release Branch for v0.24.x (#1131)
1 parent df76679 commit 9768bb2

File tree

9 files changed

+606
-57
lines changed

9 files changed

+606
-57
lines changed

CLAUDE.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Overview
6+
7+
This is the Graph Protocol Indexer monorepo containing the indexer agent, CLI, and common libraries. The indexer helps run infrastructure for The Graph Network by indexing subgraphs and serving queries.
8+
9+
## Repository Structure
10+
11+
- **`/packages/`** - Lerna monorepo with 4 packages:
12+
- **`indexer-agent/`** - Main indexer agent that manages allocations and monitors the network
13+
- **`indexer-cli/`** - CLI for managing indexer operations (plugin for @graphprotocol/graph-cli)
14+
- **`indexer-common/`** - Shared functionality used by other packages
15+
- **`indexer-native/`** - Listed but directory doesn't exist (deprecated)
16+
- **`/docs/`** - Documentation including network configs and setup guides
17+
- **`/k8s/`** - Kubernetes deployment configurations
18+
- **`/terraform/`** - Infrastructure as Code for GKE deployment
19+
- **`/scripts/`** - Utility scripts including test runner
20+
21+
## Essential Commands
22+
23+
### Development Setup
24+
```bash
25+
# Install dependencies and build all packages
26+
yarn
27+
yarn bootstrap
28+
29+
# Clean and rebuild everything
30+
yarn clean && yarn bootstrap
31+
32+
# Compile TypeScript across all packages
33+
yarn compile
34+
```
35+
36+
### Running Tests
37+
```bash
38+
# Run all tests (requires PostgreSQL container - use the script below)
39+
bash scripts/run-tests.sh
40+
41+
# Run tests in a specific package
42+
cd packages/indexer-agent && yarn test
43+
cd packages/indexer-cli && yarn test
44+
cd packages/indexer-common && yarn test
45+
46+
# Run a specific test file
47+
yarn test path/to/specific.test.ts
48+
49+
# Run tests matching a pattern
50+
yarn test --testNamePattern="specific test name"
51+
52+
# Watch mode for TDD
53+
yarn test:watch
54+
55+
# Debug mode with verbose logging
56+
yarn test:debug
57+
```
58+
59+
### Code Quality
60+
```bash
61+
# In any package directory
62+
yarn lint # Lint and fix TypeScript files
63+
yarn format # Format code with Prettier
64+
yarn prepare # Run format, lint, and compile
65+
```
66+
67+
### Running the Indexer
68+
```bash
69+
# From source (after building)
70+
cd packages/indexer-agent
71+
./bin/graph-indexer-agent start [options]
72+
73+
# CLI commands
74+
graph indexer [command]
75+
```
76+
77+
## Architecture
78+
79+
### Core Components
80+
1. **Indexer Agent** - Autonomous agent that:
81+
- Monitors the network for subgraph deployments
82+
- Manages allocations (stake on subgraphs)
83+
- Handles query fee collection via TAP (Timeline Aggregation Protocol)
84+
- Submits POIs (Proofs of Indexing)
85+
- Manages interactions with Graph Node
86+
87+
2. **Indexer CLI** - Management interface for:
88+
- Setting indexing rules
89+
- Managing allocations manually
90+
- Configuring cost models
91+
- Monitoring disputes
92+
- Managing action queue
93+
94+
3. **Indexer Common** - Shared libraries for:
95+
- Database models (Sequelize ORM)
96+
- Ethereum interactions
97+
- Network subgraph queries
98+
- Common types and utilities
99+
100+
### Key Technical Details
101+
- **Language**: TypeScript with strict type checking
102+
- **Database**: PostgreSQL (via Sequelize ORM)
103+
- **Blockchain**: Ethereum/Arbitrum (via ethers.js)
104+
- **Testing**: Jest with ts-jest
105+
- **Monorepo**: Lerna with Yarn workspaces
106+
107+
### Database Schema
108+
The indexer uses PostgreSQL to store:
109+
- Indexing rules
110+
- Allocation management state
111+
- Action queue
112+
- Cost models
113+
- POI dispute data
114+
- TAP receipts and RAVs (Receipt Aggregate Vouchers)
115+
116+
### Integration Points
117+
- **Graph Node**: Queries subgraph data and manages deployments
118+
- **Ethereum/Arbitrum**: On-chain transactions for allocations
119+
- **Network Subgraph**: Queries protocol state
120+
- **TAP (Timeline Aggregation Protocol)**: Handles query fee collection and redemption
121+
- **TAP Subgraph**: Tracks TAP receipts and RAVs
122+
123+
## Testing Requirements
124+
125+
Tests require:
126+
1. PostgreSQL database (handled by `scripts/run-tests.sh`)
127+
2. Environment variables in `.env`:
128+
```
129+
INDEXER_TEST_JRPC_PROVIDER_URL=<Arbitrum Sepolia RPC>
130+
INDEXER_TEST_API_KEY=<Graph API key>
131+
```
132+
133+
## Current State
134+
- Version: v0.24.2
135+
- Active branch: release-v0.24
136+
- Main branch: main
137+
- Uncommitted changes in docs/ and config/

0 commit comments

Comments
 (0)