Skip to content

Commit e0afb17

Browse files
committed
Update CLAUDE.md
1 parent 04a3915 commit e0afb17

File tree

1 file changed

+59
-4
lines changed

1 file changed

+59
-4
lines changed

CLAUDE.md

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ This is a Rust workspace containing multiple services and libraries:
1818
- **database** - PostgreSQL abstraction and migrations
1919
- **model** - Serialization models for API
2020
- **contracts** - Smart contract bindings
21+
- **ethrpc** - Extended Ethereum RPC client with batching layer
22+
- **chain** - Blockchain interaction utilities
23+
- **number** - Numerical type extensions and conversions for 256-bit integers
24+
- **app-data** - Order metadata validation with 8KB default size limit
25+
- **alerter** - Monitors orderbook metrics for orders that should be solved but aren't
26+
- **testlib** - Shared helpers for writing unit and end-to-end tests
27+
- **observe** - Initialization and helper functions for logging and metrics
2128

2229
## Architecture Overview
2330

@@ -60,7 +67,7 @@ User signs order → Orderbook validates → Autopilot includes in auction
6067

6168
## Technology Stack
6269

63-
- **Language**: Rust 2021+ Edition
70+
- **Language**: Rust 2024 Edition
6471
- **Runtime**: Tokio async
6572
- **Database**: PostgreSQL with sqlx
6673
- **Web3**: Alloy
@@ -72,11 +79,35 @@ User signs order → Orderbook validates → Autopilot includes in auction
7279
- Technical Reference: API specs and SDK docs
7380
- Concepts: Protocol fundamentals and architecture
7481

75-
## Testing
82+
## Development Commands
7683

77-
- Use `just` commands for running tests (see Justfile)
84+
### Testing
85+
- Use `cargo nextest run` instead of `cargo test` (CI uses nextest and handles global state differently)
86+
- Run specific test suites:
87+
- Unit tests: `cargo nextest run`
88+
- Database tests: `cargo nextest run postgres -p orderbook -p database -p autopilot --test-threads 1 --run-ignored ignored-only`
89+
- E2E local tests: `cargo nextest run -p e2e local_node --test-threads 1 --failure-output final --run-ignored ignored-only`
90+
- E2E forked tests: `cargo nextest run -p e2e forked_node --test-threads 1 --run-ignored ignored-only --failure-output final`
91+
- Driver tests: `RUST_MIN_STACK=3145728 cargo nextest run -p driver --test-threads 1 --run-ignored ignored-only`
7892
- E2E tests available in `crates/e2e`
79-
- Local development environment in `playground/`
93+
94+
### Testing Requirements
95+
- PostgreSQL tests require local database: Run `docker-compose up` first
96+
- Forked network tests require `anvil` (from Foundry) and RPC URLs
97+
- Use `--test-threads 1` for database and E2E tests to avoid conflicts
98+
- CI runs doc-tests, unit tests, DB tests, E2E tests (local and forked), and driver tests
99+
100+
### Linting and Formatting
101+
- Format: **always** run with the nightly toolchain: `cargo +nightly fmt --all`
102+
- Spot format: `cargo +nightly fmt -- <path>` (never call stable `cargo fmt`)
103+
- Lint: `cargo clippy --locked --workspace --all-features --all-targets -- -D warnings`
104+
- Check format: `cargo +nightly fmt --all -- --check`
105+
106+
### Local Development Environment
107+
- Start local PostgreSQL: `docker-compose up`
108+
- Full playground environment: `docker compose -f playground/docker-compose.fork.yml up -d`
109+
- For forked network tests, set environment variables: `FORK_MAINNET_URL` and `FORK_GNOSIS_URL`
110+
- Reset playground: `docker-compose -f playground/docker-compose.fork.yml down --remove-orphans --volumes`
80111

81112
## Directory Structure
82113

@@ -87,6 +118,30 @@ playground/ # Local dev environment
87118
configs/ # Configuration files
88119
```
89120

121+
## Workspace Configuration
122+
123+
- Rust Edition 2024
124+
- Uses workspace dependencies for consistency
125+
- Tokio-console support: **Only available in playground environment** (set `TOKIO_CONSOLE=true` to activate when running in playground)
126+
- Production builds do **not** include tokio-console overhead
127+
- Runtime log filter changes via UNIX socket at `/tmp/log_filter_override_<program_name>_<pid>.sock`
128+
- Memory allocator: Uses jemalloc by default with built-in heap profiling support (enable at runtime via MALLOC_CONF environment variable). Can optionally use mimalloc via `--features mimalloc-allocator`
129+
130+
## Playground Environment
131+
132+
- Access full local development stack with CoW Swap UI at http://localhost:8000
133+
- CoW Explorer available at http://localhost:8001
134+
- Orderbook API at http://localhost:8080
135+
- Database admin (Adminer) at http://localhost:8082
136+
- Uses test mnemonic: "test test test test test test test test test test test junk"
137+
- First 10 accounts have 10000 ETH balance by default
138+
139+
## Development Notes
140+
141+
- Binaries support `--help` for comprehensive command documentation
142+
- OpenAPI documentation available for orderbook, driver, and solver APIs
143+
- Performance profiling: Only available in playground (requires tokio-console feature + tokio_unstable cfg)
144+
90145
# General Coding Instructions
91146

92147
If there is a test you can run then run it or `cargo check` or `cargo build`; run it after you have made changes.

0 commit comments

Comments
 (0)