Simulation Service Analysis
Quick start
- Confirm the repo root (expect
Cargo.tomlandcrates/). - Ensure
.envexists and containsTYCHO_API_KEYplusTYCHO_BROADCASTER_WS_URL. The default loopback broadcaster URL lets the lifecycle helper start the broadcaster before the simulator. RFQ feeds default to off. For RFQ analysis, setENABLE_RFQ_POOLS=true. Ethereum and Base currently need the Bebop and Hashflow credential pairs; Liquorice credentials are only needed afterrfq:liquoriceis added to an active chain profile. - Pick a chain context for the run (
--chain-id 1for Ethereum,--chain-id 8453for Base). - Run the analyzer:
cargo run -p apps --bin sim-analysis -- --chain-id 1 --stop - Read:
logs/simulation-reports/<chain-id>/balanced/<timestamp>/summary.mdlogs/simulation-reports/<chain-id>/balanced/<timestamp>/report.json
What the analyzer does
- Reuses the existing local simulator if it is already responding, otherwise starts the local broadcaster plus simulator stack with the repo lifecycle scripts.
- Starts
dsolver-tycho-broadcaster-servicefirst whenTYCHO_BROADCASTER_WS_URLpoints at local loopback, then startsdsolver-simulator-service; non-local broadcaster URLs are treated as externally managed. - Waits for
/statusservice health, then confirms native readiness first and adds VM and RFQ readiness checks when those pool backends are enabled. - Fresh VM-pool or RFQ warmups can take much longer than native readiness. Budget up to 10 minutes before treating either backend as stuck.
- Runs a balanced
/simulatesweep across representative pairs. - Builds the balanced
/encoderoute matrix from live/simulateprep hops, covering 3 SimpleSwap routes, 3 MultiSwap routes, and 2 MegaSwap routes per supported chain. - Runs latency and light stress sweeps.
- Saves sampled request/response artifacts plus simulator and broadcaster log excerpts.
- Optionally compares the current run against the latest compatible saved report.
- Top-level
/status.statusis service health; nestedbackends.*.statuscarries backend readiness.
Behavior model
- Non-zero exit codes are reserved for harness/runtime failures such as startup failures, readiness timeouts, transport failures that prevent analysis, or report-writing failures.
- Degraded protocol behavior, request-level failures, odd pool visibility, and latency regressions are reported as findings, not hard failures.
- The analyzer is meant to help the agent investigate local behavior, not to decide prod-readiness by itself.
Useful commands
Base run:
cargo run -p apps --bin sim-analysis -- --chain-id 8453 --stop
Keep the helper-managed local services running:
cargo run -p apps --bin sim-analysis -- --chain-id 1
Disable baseline comparison:
cargo run -p apps --bin sim-analysis -- --chain-id 1 --baseline none --stop
Manual VM-ready wait when you want to confirm the service itself before rerunning the analyzer:
scripts/wait_ready.sh --url http://localhost:3000/status --expect-chain-id 1 --require-vm-ready --timeout 600
scripts/wait_ready.sh still waits for native readiness by default. Use the VM and RFQ flags only when those backends also matter.
Manual RFQ-ready wait when RFQ pools are enabled:
scripts/wait_ready.sh --url http://localhost:3000/status --expect-chain-id 8453 --require-rfq-ready --timeout 600
Manual combined VM and RFQ wait for Ethereum when both backends matter:
scripts/wait_ready.sh --url http://localhost:3000/status --expect-chain-id 1 --require-vm-ready --require-rfq-ready --timeout 600
Write to a custom directory:
cargo run -p apps --bin sim-analysis -- --chain-id 1 --out logs/simulation-reports/manual-check --stop
Target a different local base URL:
cargo run -p apps --bin sim-analysis -- --chain-id 1 --base-url http://127.0.0.1:3000 --stop
Investigation flow
After the analyzer runs:
- Read
summary.mdfirst for the high-level picture. - Use
report.jsonfor exact counts, latencies, status/result-quality splits, protocol visibility, and any RFQ readiness or RFQ-visibility findings. - Open the files under
evidence/for sampled request/response bodies, readiness snapshots, and simulator/broadcaster log excerpts. - If the current behavior looks suspicious, compare it with the saved baseline before deciding whether the change is actually novel.
- If something still looks off, continue with targeted manual requests, log inspection, or deeper domain research.
References
references/project.md– repo commands, outputs, and analysis flow.references/encode.md–/encodeschema and route-probe notes.references/protocols.md– chain protocol context and VM notes that help interpret findings.references/tycho-deps.md– Tycho/Propeller Heads context and docs.
Source: dewiz-xyz/dsolver-simulator — distributed by TomeVault.