Skip to content

[sdk] Add retry logic to RpcService for transient Soroban RPC failures #816

Description

@Otaiki1

Summary

sdk/src/network/rpc.service.ts makes direct calls to the Soroban RPC. Transient network failures (503, timeout) cause immediate exceptions that propagate to the UI as errors.

What to do

  1. Wrap RPC calls in sdk/src/utils/retry.ts (which already exists) with:
    • Max 3 retries.
    • Exponential backoff starting at 300 ms.
    • Retry only on network errors and 5xx responses — do NOT retry 4xx (user/contract errors).
  2. Add a SOROBAN_RPC_MAX_RETRIES and SOROBAN_RPC_BASE_DELAY_MS config to network.config.ts.
  3. Write a test that simulates 2 transient failures followed by a success and asserts the result is returned.

Acceptance criteria

  • A transient RPC failure is retried up to 3 times before propagating as an error.
  • 4xx responses are not retried.

Metadata

Metadata

Assignees

Labels

Stellar WaveFull ecosystem refactor initiative

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions