Skip to content

feat: gas optimization, key rotation, liquidity dashboard, fee bump recovery - #529

Merged
Pidoko257 merged 1 commit into
Pidoko257:mainfrom
levoski1:feat/gas-optimization-key-rotation-liquidity-dashboard-fee-bump-recovery
Aug 27, 2026
Merged

feat: gas optimization, key rotation, liquidity dashboard, fee bump recovery#529
Pidoko257 merged 1 commit into
Pidoko257:mainfrom
levoski1:feat/gas-optimization-key-rotation-liquidity-dashboard-fee-bump-recovery

Conversation

@levoski1

Copy link
Copy Markdown
Contributor

Summary

Addresses 4 issues: Soroban gas optimization analysis, automated HSM key rotation scheduling, real-time liquidity monitoring dashboard, and SEP-31 fee bump recovery with retry logic.

Changes

Soroban Contract Gas Optimization (#366)

  • New src/services/sorobanGasAnalyzer.ts with recordGasBenchmark() storing per-operation gas metrics
  • getGasBenchmarks() returns aggregated statistics with p50/p95/p99 percentiles
  • analyzeGasOptimizations() auto-detects high gas (>10M), moderate gas (>5M), and high-variance (p99 > 3x avg) operations
  • Priority-based recommendations: high (storage read reduction, caching), medium (batching, lazy evaluation)
  • 4 unit tests passing

Cryptographic Key Rotation Scheduling (#365)

  • New src/services/keyRotationService.ts with registerKey() supporting configurable rotation intervals (default 90 days)
  • rotateKey() performs atomic key swap with multi-active-key rotation window (active → rotating → active)
  • Scheduled rotation job detects expired keys and triggers emergency rotation
  • Age-based alert system: warning at 14 days before expiry, critical at 3 days
  • Full audit trail via key_rotation_events table with source tracking (scheduled/manual/emergency)
  • Zero-downtime rotation via managed status transitions

Liquidity Monitoring Dashboard (#363)

  • New src/services/liquidityDashboardService.ts with getLiquidityStatus() returning real-time provider/asset liquidity with health scores
  • getLiquidityTrends() provides 7-day historical trending with depletion rate projections
  • checkLowLiquidityAlerts() with configurable warning/critical thresholds per asset
  • EventEmitter-based subscription for real-time WebSocket dashboard updates
  • Health scoring system (100 = healthy, <80 = warning, <50 = critical) based on utilization

SEP-31 Fee Bump Recovery (#364)

  • New src/services/feeBumpRecoveryService.ts with state machine (pending → submitting → submitted → confirmed)
  • Exponential backoff retry: base 5s, max 5min, configurable via environment variables
  • Dead letter queue for unrecoverable failures (sequence mismatch, insufficient balance, max retries exceeded)
  • Manual admin retry endpoint for dead-lettered transactions
  • Recovery stats with success rate monitoring (getFeeBumpRecoveryStats())
  • 6 unit tests passing

Closes #366
Closes #365
Closes #363
Closes #364

…ecovery

- Soroban Contract Gas Optimization (Pidoko257#366): New sorobanGasAnalyzer service
  with recordGasBenchmark (stores per-operation gas metrics), getGasBenchmarks
  (aggregated percentiles p50/p95/p99), and analyzeGasOptimizations (auto-detects
  high gas, moderate gas, and high-variance operations with priority recommendations).
  4 tests passing.

- Cryptographic Key Rotation Scheduling (Pidoko257#365): New keyRotationService with
  registerKey (configurable rotation interval, default 90 days), rotateKey
  (atomic key swap with multi-active-key rotation window), scheduled rotation
  job detecting expired/emergency keys, age-based alert system (warning at 14d,
  critical at 3d), full audit trail via key_rotation_events table, and zero-downtime
  rotation via status transitions (active → rotating → active).

- Liquidity Monitoring Dashboard (Pidoko257#363): New liquidityDashboardService with
  getLiquidityStatus (real-time provider/asset liquidity with health scores),
  getLiquidityTrends (7-day historical trending with depletion projections),
  checkLowLiquidityAlerts (configurable warning/critical thresholds), and
  EventEmitter-based WebSocket subscription for real-time dashboard updates.

- SEP-31 Fee Bump Recovery (Pidoko257#364): New feeBumpRecoveryService with state
  machine (pending → submitting → submitted → confirmed), exponential backoff
  retry (base 5s, max 5min, configurable), dead letter queue for unrecoverable
  failures (sequence mismatch, insufficient balance, max retries exceeded),
  manual admin retry endpoint, and recovery stats with success rate monitoring.
  6 tests passing.

Closes Pidoko257#366
Closes Pidoko257#365
Closes Pidoko257#363
Closes Pidoko257#364
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@levoski1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Pidoko257
Pidoko257 merged commit 62d5c18 into Pidoko257:main Aug 27, 2026
10 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants