Indexer: event-driven fee-tier sync instead of full trader scan #364
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#364
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?
Parent
Gap analysis follow-up from GitLab #361 — register items M11 and approved recommendation event-driven fee-tier sync.
Current codebase
trader_tracker::run_tier_sync_loopsleeps 600s, then loads all rows fromtradersand queriesget_registrationon the fee-discount contract per address (indexer/src/indexer/trader_tracker.rs:20-88).poller.rsat indexer startup; disabled whenFEE_DISCOUNT_ADDRESSunset.update_trader_on_swap(parser.rs) but do not refresh tier on registration changes.Why needed
LCD load scales O(unique traders) every 10 minutes. As trader count grows, this becomes a steady LCD tax and increases tier staleness window for route quotes and trader API responses.
Constraints / guardrails
Relevant files
indexer/src/indexer/trader_tracker.rsindexer/src/indexer/parser.rsindexer/src/indexer/poller.rsindexer/src/db/queries/traders.rsindexer/src/api/route_solver.rssmartcontracts/contracts/fee_discount/(Register / Deregister / RegisterWallet events)Recommended direction
Register,Deregister,RegisterWallet,DeregisterWallet,UpdateTier(as applicable), updatetraders.tier_id/tier_name/registeredfor affected addresses.get_registrationLCD query (lazy hydrate).TIER_SYNC_RECONCILE_INTERVAL) for missed events.tier_sync_lag_secondsin logs for operators (not Prometheus — out of scope).Acceptance criteria
traderstable within one indexed block (integration test).Test plan
cd indexer && cargo test --libmake test-indexer-integration— add/update binary for tier syncAttack / abuse test plan
Verification criteria
GET /api/v1/traders/{addr}shows new tier without waiting for reconcile loop.mentioned in issue #361
mentioned in commit
a0cca80b3fmentioned in merge request !876
mentioned in commit
d044349269mentioned in commit
9ec4c66a0amentioned in issue #477