feat(service): allow overriding discovery polling interval via env - #417
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe solver service now reads ChangesDiscovery polling interval
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change adds a bounded environment override for discovery polling while preserving the existing default behavior. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Motivation
Discovery polling is the dominant passive RPC cost of a running solver: the boot-time config merge hardcodes
polling_interval_secs = 5foronchain_eip7683, i.e. ~3-4 RPC calls every 5s per chain (~60k calls/day/chain), 24/7, regardless of traffic. BecauseOperatorConfighas no discovery section and the merge re-runs on every boot, this value could not be changed by bootstrap config, admin API, or storage edits — only by rebuilding.This is needed to run the hosted solvers in a temporary low-RPC-usage mode (Alchemy CU reduction) while keeping them online.
Change
SOLVER_DISCOVERY_POLLING_INTERVAL_SECS, read during the config merge (same pattern asSOLVER_API_PORT/AUTH_PUBLIC_REGISTER_ENABLED).COMMON_DEFAULTS.polling_interval_secs(5) — behavior is bit-for-bit unchanged.1..=300at merge time: the upper bound mirrorsMAX_POLLING_INTERVAL_SECSin the onchain_eip7683 discovery schema (out-of-range values would otherwise pass the merge and abort startup at factory validation); 0 is rejected because the implementation treats it as the currently-disabled WebSocket mode.tracing::info!logs the effective interval at boot for operational verification.AGENTS.md,crates/solver-service/AGENTS.md, and.env.example.Testing
test_validate_discovery_polling_interval_bounds— pure range validation (0 / 1 / 5 / 300 / 301), no env access.test_discovery_polling_interval_env_override— env var propagates into the generatedonchain_eip7683config.test_discovery_polling_interval_defaults_to_seed_default_when_unset— unset falls back throughCOMMON_DEFAULTSand pins the current default at 5.test_parse_u64_env_var_*— new helper parity with the existingparse_u16_env_vartests.#[serial]+EnvVarGuardand only ever set valid values, so concurrently running non-serial tests can never observe an env state that fails the merge.cargo test -p solver-service: 724 + 5 passed.cargo fmt --all -- --checkandcargo clippy --all-features --all-targets -- -D warnings --allow deprecatedclean.Summary by CodeRabbit
New Features
Documentation