fix(indexer): persist every multihop AMM hop in protocol_fee_events #1274
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!1274
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue/1269"
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
protocol_fee_eventswith pair-scoped uniqueness(tx_hash, source, pair_id, ordinal)so per-pairswap_index0 hops no longer collide.pair_idand a partial unique on(tx_hash, source, ordinal). Replay staysON CONFLICT DO NOTHING(never overwrite).swap_events.commission_amount;trade_existsstill skips swap insert but retries fee ingest.Fixes #1269
Test plan
VERIFY_ISSUE_1269_SKIP_RELATED=1 make verify-issue-1269(docs/source greps, libprotocol_fees, parserswap_index,indexer_protocol_feeshop/replay/wrap/backfill)make verify-issue-586(and 613/614/683) after Coolify/indexer deploy/protocol7d AMM matches hop-complete pricedSUM, not the collision-truncated censusfee_event_countdrain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue
/agent review
cl8y-agent-control: queued
bug_reviewjob2ef6078c-0758-4dbe-a41d-a473acf8f7e1(not executed; no Hetzner VM).Design for this slice is in-repo (docs only; no Coolify migrate/deploy from this comment).
Outcome: every factory AMM hop with
commission_amount > 0is oneswap_ammrow. Unique(tx_hash, source, pair_id, ordinal)WHEREpair_id IS NOT NULL; wrap/window/book/place stay NULLpair_idwith the non-pair partial. ReplayON CONFLICT DO NOTHING. Backfill fromswap_events. GET stays rollup-only.Not #297 deploy/spend/custody. Not a founder card.
DESIGN: READY_FOR_REVIEW