Skip to content

fix(backend): use BigInt for on-chain streamId (u64-safe) - #998

Open
TCROWN10 wants to merge 1 commit into
LabsCrypt:mainfrom
TCROWN10:fix/829-streamid-bigint-pr
Open

fix(backend): use BigInt for on-chain streamId (u64-safe)#998
TCROWN10 wants to merge 1 commit into
LabsCrypt:mainfrom
TCROWN10:fix/829-streamid-bigint-pr

Conversation

@TCROWN10

Copy link
Copy Markdown

Summary

  • Change Stream.streamId and StreamEvent.streamId from Prisma Int (Postgres int4) to BigInt, with a migration that widens both columns and recreates the FK.
  • Stop coercing decoded Soroban u64 IDs with Number(...); parse route/body IDs via parseStreamId() and serialize BigInt safely for JSON/SSE.
  • Add tests for u64 IDs above int4 max (3_000_000_000n) through the worker and validator.

Closes #829

Test plan

  • Focused vitest suite for stream-id helpers, worker large-id path, and stream action/integration expectations
  • CI green (Postgres migration applied in CI)
  • Confirm a stream with streamId > 2147483647 persists and is readable via GET /v1/streams/:id

Widen Stream.streamId / StreamEvent.streamId to Postgres bigint and keep
decoded u64 values as JS bigint through the worker and API parsers so IDs
above int4 max no longer fail inserts. Adds a migration and regression
coverage for ids > 2^31-1.

Closes LabsCrypt#829

Co-authored-by: Cursor <cursoragent@cursor.com>
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] Stream.streamId / StreamEvent.streamId typed Int (int4) but on-chain IDs are u64 - overflow/insert failure

1 participant