I built a zero-dependency CLI to pause deploys when L2 gas spikes
Описание и применение
CLI‑инструмент l2gas блокирует деплой, если цена газа на L2 превышает порог, предотвращая лишние расходы.
Задача
CI pipelines deployed to Base mainnet during a gas spike, incurring high fees ($200) that went unnoticed until billing.
Результат
Deployments are now gated by real‑time gas prices, preventing accidental high‑fee deployments during L2 gas spikes.
Рабочий процесс
- Run npx @psicossz/l2gas to fetch real‑time gas prices for selected chains
- Configure a GitHub Actions step with --threshold to exit with code 1 if any chain exceeds the limit
- Use the exit code to conditionally skip the deploy step
- Optionally use the reusable workflow for cleaner setup
- Integrate l2gas as a library in scripts for programmatic access
- Use --json for scripting and --watch for continuous monitoring
Доказательства
Teams without a gas gate in CI deployed contracts and paid hundreds in unnecessary fees.
The --threshold flag exits with code 1 if any chain exceeds the Gwei limit, which natively blocks a CI step.
All 7 chains queried in parallel in under 2 seconds, directly from public RPC endpoints — no API key, no rate limits, no third‑party service.
- Дата записи: 2026-10-02T08:10:44.784Z