Skip to content

refactor: type ComposableOrder.creationDate as bigint and remove double-conversion (COW-1007)#95

Closed
lgahdl wants to merge 1 commit into
developfrom
luizhatem/cow-1007-standardize-timestamp-fields
Closed

refactor: type ComposableOrder.creationDate as bigint and remove double-conversion (COW-1007)#95
lgahdl wants to merge 1 commit into
developfrom
luizhatem/cow-1007-standardize-timestamp-fields

Conversation

@lgahdl

@lgahdl lgahdl commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • blockHandler.ts used BigInt(Number(event.block.timestamp)) — the intermediate Number() is unnecessary since event.block.timestamp is already a bigint
  • ComposableOrder.creationDate was typed as number, requiring a BigInt() cast at every DB insert site; changed to bigint to match the discreteOrder.creationDate column type
  • creationDate: 0 sentinel in the terminal-order path updated to 0n to match the new type

No schema changes

validTo remains t.integer() — intentional, as it is constrained to uint32 by the EVM order-UID encoding. All other epoch timestamp columns already use bigint.

Test plan

  • pnpm typecheck — clean
  • pnpm test — 66 tests, all pass

🤖 Generated with Claude Code

….creationDate as bigint (COW-1007)

blockHandler.ts used BigInt(Number(event.block.timestamp)) which unnecessarily
round-trips through Number. orderbookClient's ComposableOrder declared creationDate
as number, requiring a BigInt() cast at every DB insert site. Both are now consistent
with the bigint column type and the rest of the codebase's timestamp handling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 10, 2026

Copy link
Copy Markdown

COW-1007

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtsx@​4.22.31001008293100

View full report

@lgahdl lgahdl left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review: COW-1007 — Timestamp field standardization

Code Quality: PASS — Removes a double-conversion anti-pattern (BigInt(Number(event.block.timestamp)) where the intermediate Number() is unnecessary since event.block.timestamp is already a bigint). Aligns the ComposableOrder.creationDate type with the discreteOrder.creationDate column type (bigint), eliminating the BigInt() cast that was required at every DB insert site.

Coherence: PASS — The changes are exactly scoped to what the COW-1007 audit identified. validTo correctly remains t.integer() — it is constrained to uint32 by the EVM order-UID encoding. No schema migrations needed.

Functionality: PASS — No behavior change. The same values are written to the DB. All 66 tests pass, including the orderbookClient tests which exercise the creationDate path.

@lgahdl lgahdl changed the base branch from main to develop June 16, 2026 02:32
@jeffersonBastos

Copy link
Copy Markdown
Contributor

Superseded by #102 (final-qadevelop). Verified that this PR's changes (COW-1007) are fully contained in the consolidated final-qa branch. Closing to merge everything through the single QA branch per the agreed plan — no work is lost.

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.

2 participants