Fix #676: persist 18-decimal trader positions #1180
No reviewers
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!1180
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-676-positions-18dec"
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?
Summary
GET /api/v1/traders/{addr}/positionswas missing or undercounting swaps on mixed 6/18 pairs (UST1/USTR omitted; CL8Y-cb/cUSTCtrade_countstale) while/tradeswas complete.trader_positionsusedNUMERIC(38, 18)(|x| < 10^20). ~100 human 18-dec tokens is10^20raw, so the position upsert failed afterswap_eventsinsert. Replay then skipped the update.NUMERIC(78, 18), one-shot SQL-replay existing swaps, and repair on poller start whentrade_countstill diverges. Positions JSON uses plain digit strings.Closes #676.
Test plan
make verify-issue-676(Postgres + indexer.env; no wasm)/positionsvs/tradestrade_countequals that pair’s/tradescount/portfolioOpen Positions lists UST1/USTR and CL8Y-cb/cUSTC when those trades existcl8y-dex-indexer rebuild-positionsif counts still diverge after migrate-onlymentioned in issue #676
added 10 commits
main226a3b3f- Merge origin/main into issue-676-positions-18dec.Compare with previous version
mentioned in commit
972d46f9f1mentioned in issue #686