Description:
Evolve scripts/solver-bot.ts into a simulation harness that replays historical intent streams against pluggable solver strategies, producing PnL, fill-rate, and slash-risk reports.
Problem Statement & Context:
Prospective solvers can't evaluate economics before bonding capital, and protocol parameter changes (fill windows, fees, auction curves) can't be evaluated against realistic behaviour.
Scope & Acceptance Criteria:
- Replay engine reading archived intents/prices; deterministic simulated clock.
- Strategy interface (
onIntent, onQuoteRequest, onTick) with two reference strategies.
- Parameter sweep mode for protocol params (fill window, fee bps) producing comparative reports.
- Out of scope: live trading.
Implementation Guidelines:
- Key Files/Modules:
scripts/solver-bot.ts, new tools/simulator/, reuse src/auctions/, src/fees/, src/routing/.
- Design/Architecture: Import pure domain modules directly (no Nest bootstrap) — reinforces keeping domain logic pure.
- Edge Cases/Constraints: Must replay 1M intents in < 5 minutes.
- Testing: Determinism test (same seed ⇒ identical report).
Definition of "Done": Common DoD; docs in scripts/README.md.
Resources:
- Design reference: N/A (backend-only)
scripts/solver-bot.ts
Common Definition of "Done" (applies in addition to the criteria above):
- Code written, tested, and documented (TSDoc on public APIs, README/runbook/ADR updates where behaviour changes).
- All acceptance criteria met;
npm run lint, npm run typecheck, npm test, npm run test:e2e pass in CI.
- PR follows
.github/PULL_REQUEST_TEMPLATE, uses a Conventional Commit title (enforced by commitlint), includes test output / metrics screenshots, and references the issue.
- New env vars are added to
.env.example variants and src/config/env.validation.ts (the check:env-drift script must pass).
- Reviewed and approved by at least one CODEOWNER.
Description:
Evolve
scripts/solver-bot.tsinto a simulation harness that replays historical intent streams against pluggable solver strategies, producing PnL, fill-rate, and slash-risk reports.Problem Statement & Context:
Prospective solvers can't evaluate economics before bonding capital, and protocol parameter changes (fill windows, fees, auction curves) can't be evaluated against realistic behaviour.
Scope & Acceptance Criteria:
onIntent,onQuoteRequest,onTick) with two reference strategies.Implementation Guidelines:
scripts/solver-bot.ts, newtools/simulator/, reusesrc/auctions/,src/fees/,src/routing/.Definition of "Done": Common DoD; docs in
scripts/README.md.Resources:
scripts/solver-bot.tsCommon Definition of "Done" (applies in addition to the criteria above):
npm run lint,npm run typecheck,npm test,npm run test:e2epass in CI..github/PULL_REQUEST_TEMPLATE, uses a Conventional Commit title (enforced by commitlint), includes test output / metrics screenshots, and references the issue..env.examplevariants andsrc/config/env.validation.ts(thecheck:env-driftscript must pass).