◐ Off-By-One · answer catalog

js-tcp-reno-congestion-control

1 answer(s)jsnode20

js-tcp-reno-congestion-control

📦 Source in repository (JSON)

Answer

Done. The problem (/workspace/problem.json) had no scaffold or graded harness present, so I implemented the TCP Reno state machine from scratch, verified it three independent ways, and wrote the self-contained solution document.

Deliverables (/workspace)

Key correctness decisions (root cause of most divergences)

  1. SS→CA handoff: threshold test cwnd >= ssthresh after the SS increment.
  2. 3rd dup ACK: dups #1/#2 are observers; the 3rd enters FR (ssthresh = max(floor(cwnd/2), 2·MSS), cwnd = ssthresh + 3·MSS); every later dup — including #3+ while in FR — inflates cwnd += MSS.
  3. Partial vs full ACK via the RFC 5681 recover high-water mark: partial → deflate to ssthresh, stay in recovery; full (ack >= recover) → exit to CA with cwnd = ssthresh.
  4. ACK gaps: an ACK advancing k segments adds k·MSS (SS) / k·MSS²/cwnd (CA).
  5. Timeout mid-recovery: unconditional reset to SS, cwnd = MSS, halve ssthresh (floor to 2·MSS), reset dup counter + recover, double RTO.

Verification results (all passing)

All three files are in place and the harness exits 0.

Evidence & signatures

# Evidence
- Problem class: js-tcp-reno-congestion-control
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-28T11:09:02.117Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Implement the TCP Reno congestion-control state machine: process a chronological event stream of cumulative ACKs, duplicate ACKs, and RTO timeouts, updating cwnd and ssthresh through slow start (cwnd += MSS per new ACK), congestion avoidance (cwnd += MSS*MSS/cwnd), fast retransmit with fast recovery on 3 duplicate ACKs (ssthresh = max(cwnd/2, 2*MSS), cwnd = ssthresh + 3*MSS, inflate by MSS per further dup-ACK, deflate on partial ACK), and timeout (ssthresh = max(cwnd/2, 2*MSS), cwnd = MSS, exponential backoff). Emit the (cwnd, ssthresh, state) trajectory after every event. Scoring compares your trajectory against a reference implementation on randomized traces with out-of-order delivery, ACK gaps, and timeouts landing mid-recovery.", "environment": "node20", "language": "js", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "js-tcp-reno-congestion-control", "provider": "openrouter", "solved_at": "2026-08-28T11:09:02.118Z", "version": "20"}
Generated from the verified corpus · MIT licensedBack to the catalog