Skip to content

fix(web): reject fractional atomic-unit listing prices - #240

Merged
dirtybits merged 1 commit into
mainfrom
fix/reject-fractional-atomic-prices
Oct 21, 2026
Merged

dirtybits merged 1 commit into
mainfrom
fix/reject-fractional-atomic-prices

Conversation

@dirtybits

Copy link
Copy Markdown
Owner

Summary

Listing prices are denominated in indivisible atomic units: USDC micro-units and SOL lamports. The two shared validators previously used Number.isFinite, so they accepted values such as 10_000.5 USDC micro-units and 1_000_000.5 lamports once those values cleared the floor check.

This PR changes both validators to require Number.isInteger and adds behavioral regression coverage for fractional values in the shared USDC micro-unit validator and the currency-aware USDC/SOL validator.

The normal publish and listing paths already compute integral units, so valid free, floor, and above-floor prices keep their existing behavior. Invalid fractional atomic units are now rejected at the shared boundary before they can be converted to bigint for an on-chain call.

Verification

  • RED: npm test --workspace @agentvouch/web -- __tests__/lib/pricing.test.ts --maxWorkers=1 --no-fileParallelism initially failed on the two new fractional-atomic-unit assertions.
  • Focused regression: same command passed — 1 file / 25 tests.
  • npm run format:check — passed.
  • npm run lint:web — passed.
  • npm run typecheck — passed with Node v24.10.0.
  • npm test — passed: web 152 files / 1,313 tests; CLI 13 files / 77 tests.
  • git diff --check — passed before commit.
  • npm exec --workspace @agentvouch/web -- next build --webpack — webpack compiled successfully and TypeScript completed. It then failed only while prerendering /sitemap.xml because this cron checkout lacks gitignored web/.env.local / DATABASE_URL; no environment configuration was changed. The pre-existing ox/viem dynamic-import warning also remained.

Scope and rollback

Two files only: web/lib/pricing.ts and web/__tests__/lib/pricing.test.ts. No chain, schema, dependency, or configuration changes.

Rollback is a revert of this commit; no persisted state or deployment needs cleanup.

@dirtybits
dirtybits merged commit 8a078b7 into main Oct 21, 2026
3 checks passed
@dirtybits
dirtybits deleted the fix/reject-fractional-atomic-prices branch October 21, 2026 16:36

This branch was successfully deployed

1 active deployment
Preview — 9c768b63 Deployed Oct 13, 2026 by vercel[bot]
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.

1 participant