refactor: type ComposableOrder.creationDate as bigint and remove double-conversion (COW-1007)#95
Conversation
….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>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
lgahdl
left a comment
There was a problem hiding this comment.
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.
|
Superseded by #102 ( |
Summary
blockHandler.tsusedBigInt(Number(event.block.timestamp))— the intermediateNumber()is unnecessary sinceevent.block.timestampis already abigintComposableOrder.creationDatewas typed asnumber, requiring aBigInt()cast at every DB insert site; changed tobigintto match thediscreteOrder.creationDatecolumn typecreationDate: 0sentinel in the terminal-order path updated to0nto match the new typeNo schema changes
validToremainst.integer()— intentional, as it is constrained to uint32 by the EVM order-UID encoding. All other epoch timestamp columns already usebigint.Test plan
pnpm typecheck— cleanpnpm test— 66 tests, all pass🤖 Generated with Claude Code