W10-C4: Book leg amount input accepts invalid characters and surfaces raw BigInt conversion error #169
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#169
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Issue Summary
In the Swap page's advanced routing panel, typing any non-numeric, non-period character (e.g.
,,^) into the Book leg amount field triggers an unhandled JavaScript exception that is passed directly to the UI. The field performs no input-level validation and the error copy (Cannot convert 4^000000 to a BigInt) is a raw internal JS error with no user-actionable meaning.Reproduction Steps
/swapand select any token pair,,^,\Expected Behavior
The input field should accept only valid numeric characters (digits and a single period as decimal separator). Any other character should be rejected at the field level with no error shown, or replaced silently. no toast, no modal, no exception. If validation must be deferred, the error copy should be human-readable (e.g. "Please enter a valid number").
Actual Behavior
Typing
,or another invalid character is accepted by the field. The value is passed through to aBigInt()conversion without sanitisation. The browser surfaces the following error in a toast or error overlay:The
^000in the message is a null byte artefact of how the invalid character is transformed before the conversion is attempted. The error copy is an unhandled internal JS exception with no translation or user-actionable guidance.Screen record
Environment Details
localterra(local Docker)VITE_NETWORK=local npm run devmake indexer-dev)make deploy-localWallet / Device Details
/swap— ADVANCED: DIRECT SWAP: LIMIT BOOK LEG panelSeverity / Impact
P2 Polish. No funds are at risk, the field value is rejected before any transaction is submitted. However two issues are present:
(1) the input accepts invalid characters that should be blocked at the field level;
(2) the resulting error is a raw JS exception (
Cannot convert 4\000000 to a BigInt) with no human-readable fallback.The comma case is also a practical locale issue; European traders naturally use
,as a decimal separator and will trigger this error on normal input. Found under W10-C4 (Locale / number format — Interactivity and Trader use dimensions) and W11-C1 (Error copy quality).cc: @PlasticDigits
mentioned in commit
d177d8318eFix shipped on
main(d177d83)Book leg amount fields now use the same controlled decimal draft validation as Swap You Pay: only digits and at most one
.are accepted atonChange. Invalid keys (e.g.,,^,\) are rejected silently — no toast, modal, or rawCannot convert … to a BigInterrors.Changes
frontend-dapp/src/utils/decimalAmountInput.ts(isDecimalAmountDraft,tryParseBigInt)SwapPage.tsx)TradeMarketOrderPanel.tsx)getDirectHybridBookSplit/ trade hybrid params returnnullinstead of throwing on invalid draftsskills/AGENTS_FRONTEND_DECIMAL_AMOUNT_INPUT.mddecimalAmountInput.test.ts,swapDisclosure.test.ts,SwapPage.test.tsxVerification checklist
VITE_NETWORK=local npm run dev/swap→ Settings → enable Route part of input through the limit book,,^,\— field must not accept them; no error overlay/toast0.01with pay amount set — hybrid disclosure / quote still works/trade→ Market tab → hybrid book override field: same rejection for invalid charscd frontend-dapp && npm test -- --run src/utils/decimalAmountInput.test.ts src/utils/swapDisclosure.test.ts src/pages/SwapPage.test.tsx@totdking — please verify on your M1 / Chrome local setup when convenient. Leaving the issue open until QA sign-off.
/cc @PlasticDigits
mentioned in issue #116
QA verification complete (agent)
Verified fix already on
main— no additional code changes required.Environment
:5432VITE_NETWORK=local)Verification checklist
/swap→ Settings → Route part of input through the limit book enabled,,^,\— invalid chars rejected silently; no error overlay/toast0.01with pay amount1.0— hybrid disclosure shows pool/book split correctly/trade→ Market tab → Book leg override: same silent rejection for,decimalAmountInput.test.ts,swapDisclosure.test.ts,SwapPage.test.tsx— 15/15 passedClosing as verified.
mentioned in issue #213