Skip to content

fix(indexer): complete soroban RPC circuit breaker and resolve compiler errors#173

Merged
ritik4ever merged 2 commits intoritik4ever:mainfrom
aabxtract:main
Apr 25, 2026
Merged

fix(indexer): complete soroban RPC circuit breaker and resolve compiler errors#173
ritik4ever merged 2 commits intoritik4ever:mainfrom
aabxtract:main

Conversation

@aabxtract
Copy link
Copy Markdown
Contributor

Description

Closes #148

This PR completes the implementation of the Soroban RPC Circuit Breaker in the indexer service, which prevents the application from endlessly spamming failing RPC endpoints. It also resolves a series of critical TypeScript compiler errors and syntax issues left behind by an incomplete refactoring, ensuring the application successfully builds and operates as expected.

Key Changes:
Completed Circuit Breaker Logic (indexer.ts):
Added the missing circuitBreaker.onSuccess() triggers after successful RPC interactions (getLatestLedger and getEvents). The circuit breaker will now correctly transition back from HALF_OPEN to CLOSED upon a successful probe attempt.

Fixed API Endpoint Syntax & Logic (index.ts):
POST /api/streams: Restored missing user authorization validation.
POST /api/streams/:id/cancel: Fixed incomplete try-catch block and implemented the missing cancelStream() invocation.
PATCH /api/streams/:id/start-time: Completed validation logic to guarantee newStartAt dates are in the future.
Cleaned up duplicate variable definitions and imports.

TypeScript & SDK Compatibility (streamStore.ts & auth.ts):
Replaced the deprecated/missing rpc.Api.GetAccountResponse reference with the updated Account type from @stellar/stellar-sdk to fix type-checking errors.
Corrected jwt.sign() to use the proper getJwtSecret() helper.
Fixed invalid requestId properties in the sendApiError parameters.

Formatting Fixes:
Repaired a malformed 400 response object inside the OpenAPI definitions (swagger.ts).
Removed dangling brackets causing syntax errors in the test suite (index.test.ts).

Verification
Verified npx tsc --noEmit runs with 0 compilation errors.
Confirmed /api/metrics successfully exposes the indexer circuit breaker state.
Verified all streams endpoints logic is intact and validation errors format correctly.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

@aabxtract is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 24, 2026

@aabxtract 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

@ritik4ever ritik4ever merged commit c8c72c8 into ritik4ever:main Apr 25, 2026
1 of 3 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

Development

Successfully merging this pull request may close these issues.

[wave4][backend] Handle RPC connection failures with circuit breaker pattern

2 participants