Overview
rate_limit.rs defines build_rate_limiter(per_second, burst) using the governor crate, and AppConfig already parses/validates RATE_LIMIT_PER_SECOND and RATE_LIMIT_BURST from the environment (main.rs even logs these values on startup) — but build_rate_limiter is never called anywhere, and app() in lib.rs only applies .layer(TraceLayer::new_for_http()). The rate limiter is fully built but not wired into the request path, so the service has no actual rate limiting despite looking configured.
Files
contract/src/lib.rs (app)
contract/src/rate_limit.rs
contract/src/main.rs
Acceptance Criteria
Overview
rate_limit.rsdefinesbuild_rate_limiter(per_second, burst)using thegovernorcrate, andAppConfigalready parses/validatesRATE_LIMIT_PER_SECONDandRATE_LIMIT_BURSTfrom the environment (main.rseven logs these values on startup) — butbuild_rate_limiteris never called anywhere, andapp()inlib.rsonly applies.layer(TraceLayer::new_for_http()). The rate limiter is fully built but not wired into the request path, so the service has no actual rate limiting despite looking configured.Files
contract/src/lib.rs(app)contract/src/rate_limit.rscontract/src/main.rsAcceptance Criteria
main.rsusingconfig.rate_limit_per_second/config.rate_limit_burstand pass it intoAppState(or a tower layer)app()so it actually rejects requests once the quota is exceeded429 Too Many Requestswith an appropriate body when the limit is hit429