Simulation Service Tests
Quick start
- •Confirm the repo root (expect
Cargo.tomlandsrc/). - •Ensure
.envexists and containsTYCHO_API_KEY(avoid logging it). For manual health checks, useAuthorization: <TYCHO_API_KEY>(noBearerprefix). - •Start the server (keeps a PID file in the repo root):
bash
cd /path/to/tycho-simulation-server scripts/start_server.sh --repo .
- •Wait for readiness:
bash
scripts/wait_ready.sh --url http://localhost:3000/status
- •If it stays
warming_up, wait longer (3–5+ minutes on a cold start, longer with VM pools) or re-run with a higher--timeout.
- •If it stays
One-shot end-to-end suite
Run start → wait_ready → smoke → coverage → latency:
cd /path/to/tycho-simulation-server scripts/run_suite.sh --repo . --suite core --stop
To include Curve/Balancer pools (VM feeds):
scripts/run_suite.sh --repo . --suite core --enable-vm-pools --stop
If you need to tolerate partial failures or empty-liquidity responses while still running the suite:
scripts/run_suite.sh --repo . --suite core --allow-partial --allow-no-liquidity --stop
Smoke test /simulate
- •Use the curated presets (supports many mainnet tokens + suites).
- •Remember:
/simulatereturns200 OKeven on partial failure; usemeta.status/meta.failures.
Examples:
python3 scripts/simulate_smoke.py --suite smoke python3 scripts/simulate_smoke.py --pair DAI:USDC --pair WETH:USDC python3 scripts/simulate_smoke.py --list-tokens
For stricter checks (fail on empty data and validate pool entries):
python3 scripts/simulate_smoke.py --suite smoke --require-data --validate-data
Allow partial responses explicitly:
python3 scripts/simulate_smoke.py --suite smoke --allow-status ready,partial_failure --allow-failures
Smoke test /encode
- •
/encodefollows the latest schema (singleSwap-only execution). - •The smoke test performs two
/simulatecalls to pick pools, then posts a 2-hop route. - •Default addresses can be overridden via
.env(COW_SETTLEMENT_CONTRACT,TYCHO_ROUTER_ADDRESS).
Examples:
python3 scripts/encode_smoke.py --encode-url http://localhost:3000/encode --simulate-url http://localhost:3000/simulate --repo .
python3 scripts/encode_smoke.py --allow-status ready,partial_failure --allow-failures --verbose
Pool/protocol coverage sweeps
coverage_sweep.py runs a suite of pairs and reports which protocols/pools appear in responses:
python3 scripts/coverage_sweep.py --suite core --out logs/coverage_sweep.json python3 scripts/coverage_sweep.py --suite v4_candidates
If you need Curve/Balancer coverage, start the server with ENABLE_VM_POOLS=true (see references/protocols.md).
To assert specific protocol presence (derived from pool_name prefixes), use:
python3 scripts/coverage_sweep.py --suite core --expect-protocols uniswap_v3,uniswap_v4
Allow no_liquidity responses with only no_pools failures:
python3 scripts/coverage_sweep.py --suite core --allow-no-pools
Latency percentiles (p50/p90/p99)
latency_percentiles.py measures only “good” responses by default (meta.status=ready, no meta.failures):
python3 scripts/latency_percentiles.py --suite core --requests 300 --concurrency 50
Load / stress testing
- •Prefer the repo suite + percentile runner:
- •
scripts/run_suite.sh --repo . --suite core(smoke + coverage + p50/p90/p99) - •
python3 scripts/latency_percentiles.py --requests 2000 --concurrency 50 --suite core(heavier load)
- •
- •See
STRESS_TEST_README.mdfor defaults and knobs (LATENCY_REQUESTS,LATENCY_CONCURRENCY,LATENCY_CONCURRENCY_VM).
Maintenance checks
Run a CI-like pass:
zsh skills/simulation-service-tests/scripts/run_checks.zsh --repo /path/to/tycho-simulation-server
Memory tracking (jemalloc)
- •Run the ignored harnesses and record the output lines in
.codex/memory-task/service-memory-tracking.md:bashcargo test --test integration protocol_reset_memory::memory_spike_breakdown_harness -- --ignored --nocapture cargo test --test integration protocol_reset_memory::shared_db_rebuild_stress_harness -- --ignored --nocapture
- •Append a diff table based on the latest
memory_breakdownline:bashpython3 skills/simulation-service-tests/scripts/memory_diff.py --repo /path/to/tycho-simulation-server
Upgrade workflow (typical)
- •Bump
tycho-simulationtag/version (or other deps). - •Run:
cargo fmt,cargo clippy ...,cargo test,cargo build --release. - •Run the end-to-end suite (
run_suite.zsh) with and without VM pools. - •If infra changes are involved:
npm ci,npx cdk synth,npx cdk diff.
Deploy workflow (CDK + Docker)
See references/deploy.md.
Included scripts
- •Repo (source of truth):
scripts/start_server.sh,scripts/stop_server.sh,scripts/wait_ready.sh,scripts/run_suite.sh, plus the Python runners inscripts/. - •Skill utilities:
scripts/run_checks.zsh(CI-likecargo fmt/clippy/test/build+ optionalcdk synth/docker build).
References
- •
references/project.md– repo commands, endpoints, and stress-test details. - •
references/encode.md–/encodeschema and smoke-testing notes. - •
references/protocols.md– which exchanges/protocol feeds this server subscribes to (and how to test them). - •
references/tycho-deps.md– Tycho/Propeller Heads context and docs. - •
references/upgrade.md– checklist for dependency upgrades. - •
references/deploy.md– CDK + Docker deployment notes.