Skip to content

[Audit] Optimistic DB state committed before on-chain transaction finality is known #1218

Description

@K1NGD4VID

Filed from the second-wave repository audit (issue 16/100). See the audit summary for full category context.

  • Location: backend/src/services/sorobanService.ts:253-259
  • Problem: submitContractCall only checks response.status !== 'ERROR' (accepted, not confirmed) and returns immediately; topUpStreamHandler/cancelStreamHandler then commit DB changes right after, before knowing whether the transaction actually succeeded on-chain.
  • Evidence: No getTransaction poll-for-final-status call after sendTransaction.
  • Suggested implementation: Poll getTransaction for a terminal status (success/failed) with a bounded timeout before committing DB mutations, or mark the DB row pending and reconcile via the indexer.
  • Acceptance criteria: A simulated on-chain failure after acceptance leaves the DB unchanged (or reconciled), covered by a test that mocks a post-submission failure.
  • Difficulty: L
  • Expected impact: Prevents permanent DB/chain divergence when a transaction is accepted into the mempool but later fails.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related tasksbugSomething isn't workingsecond-wave-auditFiled from the second-wave repo audit (100 issues)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions