Skip to content

Fix #804: Stop pause/resume controllers from duplicating PAUSED/RESUMED events#981

Merged
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
Banx17:fix/804-duplicate-pause-resume-events
Jul 3, 2026
Merged

Fix #804: Stop pause/resume controllers from duplicating PAUSED/RESUMED events#981
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
Banx17:fix/804-duplicate-pause-resume-events

Conversation

@Banx17

@Banx17 Banx17 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR fixes issue #804 by stopping the stream.controller.ts from creating synthetic PAUSED and RESUMED events in the database when a stream is paused or resumed. Previously, the controllers would persist these events with a placeholder transaction hash, which led to duplicate history rows when the real on-chain event was indexed by SorobanEventWorker. Now, the state updates are fully delegated to the indexer, ensuring exactly one source of truth.

Related Issue

Closes #804

Changes

  • stream.controller.ts: Removed prisma.stream.update and prisma.streamEvent.create in pauseStream and resumeStream handlers.
  • tests: Added pause-resume.regression.test.ts to assert that pauseStream controller no longer modifies the DB, and exactly one PAUSED row is created by the indexer.
  • tests: Updated integration tests in stream-actions.test.ts to reflect the removed database mutation expectations.

Verification

npm run lint ✅ completed (existing repo warnings only)
npm run typecheck ✅ passed
npm test -- tests/integration/pause-resume.regression.test.ts ✅ passed
npm run build ✅ passed

@ogazboiz ogazboiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice root-cause fix for #804. the pause/resume controllers were double-writing: they did stream.update + streamEvent.create, but the soroban-event-worker indexer already handles the stream_paused/stream_resumed on-chain events with the same writes, so every pause/resume produced duplicate db state (and the controller's event used ledgerSequence 0 + the simulated txHash, not the real on-chain values). now the controllers only simulate and return the existing stream, leaving persistence to the indexer as the single source of truth, and the regression test asserts the controller doesn't call update/create while the worker writes exactly one PAUSED upsert with the real tx hash. merging.

@ogazboiz
ogazboiz merged commit f58d55e into LabsCrypt:main Jul 3, 2026
10 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.

[Backend] Pause/resume controllers persist placeholder-txHash PAUSED/RESUMED events that the indexer re-writes - duplicate history rows

2 participants