Fix issues #301, #302, #304, #305: robustness and state consistency#345
Merged
gboigwe merged 1 commit intoThinkLikeAFounder:mainfrom Mar 28, 2026
Merged
Conversation
…under#304, ThinkLikeAFounder#305: robustness and state consistency - ThinkLikeAFounder#305: Fix campaign-orchestrator active_campaigns counter on pause/resume/completion - ThinkLikeAFounder#304: Fix frontend useAnalytics infinite refetch loop by serializing array dependency - ThinkLikeAFounder#301: Robust Horizon ledger stream with built-in reconnection and exponential backoff - ThinkLikeAFounder#302: Validate simulation account on backend startup and allow configuration via env
|
@walterthesmart 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses four critical issues across the full stack (Soroban contract, Backend services, and Frontend hooks) to improve system robustness, state consistency, and performance.
Tasks and Fixes
1. Campaign Orchestrator: State Consistency (#305)
active_campaignscounter inAdvertiserStatswas not updated when campaigns were paused, resumed, or naturally completed.pause_campaignto decrement theactive_campaignscount.resume_campaignto increment theactive_campaignscount.record_viewto decrement the count when a campaign transitions toCompletedstatus.contracts/campaign-orchestrator/src/lib.rs2. Frontend: Prevent Infinite Refetch Loops (#304)
useAnalyticsTimeserieshook used an array as auseEffectdependency, causing infinite re-renders and API hammering due to React's reference comparison for arrays.campaignIdsinto a comma-separated string for stable string comparison in the dependency array.frontend/src/hooks/useAnalytics.ts3. Backend: Robust Horizon Stream Handling (#301)
streamLedgersservice to include built-in reconnection logic with exponential backoff (starting at 1s, capped at 30s).websocket-server.tsto offload reconnection management to the service layer while maintaining client notifications.backend/src/services/horizon.ts,backend/src/services/websocket-server.ts4. Backend: Simulation Account Validation (#302)
SIMULATION_ACCOUNTenvironment variable support with a sensible fallback.validateSimulationAccountto verify the account's existence on startup (failing hard in production)..env.example.backend/src/services/soroban-client.ts,backend/src/index.ts,backend/.env.exampleVerification
Closes #301, #302, #304, #305 (upstream issues)
Summary by CodeRabbit
New Features
Bug Fixes
Chores
Closes #301
Closes #302
Closes #304
Closes #305