Fix #804: Stop pause/resume controllers from duplicating PAUSED/RESUMED events#981
Merged
ogazboiz merged 1 commit intoJul 3, 2026
Merged
Conversation
…SED/RESUMED events
ogazboiz
approved these changes
Jul 3, 2026
ogazboiz
left a comment
Contributor
There was a problem hiding this comment.
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.
3 tasks
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.
Overview
This PR fixes issue #804 by stopping the
stream.controller.tsfrom creating syntheticPAUSEDandRESUMEDevents 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 bySorobanEventWorker. Now, the state updates are fully delegated to the indexer, ensuring exactly one source of truth.Related Issue
Closes #804
Changes
prisma.stream.updateandprisma.streamEvent.createinpauseStreamandresumeStreamhandlers.pause-resume.regression.test.tsto assert thatpauseStreamcontroller no longer modifies the DB, and exactly onePAUSEDrow is created by the indexer.stream-actions.test.tsto 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