fix(indexer): factory pair provenance on discover_new_pair (#311) #790
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!790
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "cursor/gitlab-issue-workflow-482b"
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
Closes follow-up to GitLab #285 (wasm emitter scoping). Opportunistic
discover_new_pairnow verifies each candidate pair is listed in the configured factory viaPair { asset_infos }reverse lookup before upserting to Postgres.sync_all_pairsis unchanged.Issue: https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/311
Acceptance checklist
discover_new_pairrejects pairs not in configured factorycargo test --lib pair_discovery::testssync_all_pairspath unchanged for legitimate pairssync_all_pairsdocs/indexer-invariants.md(P1),docs/integrators.md,indexer/.env.examplepair_discovery.rsFACTORY_ADDRESSdev: warn + skip provenanceverify_factory_provenance_skipped_when_factory_emptyconfig.rstests (unchanged)Verification for third parties
Issue left open until MR merge.
mentioned in issue #311
changed the description
changed the description
Security review
Commit reviewed:
ce9040cb936d4c4be9080a540e0bada13b3709ebScope:
discover_new_pairfactory provenance gate (verify_factory_provenance), parser wiring (factory_addrplumbed through all discovery call sites),FactoryPairResponseLCD type, docs/env notes (P1 invariant).Method: Traced attacker-controlled inputs (wasm
_contract_addressfrom chain events → pair LCD query → factoryPair { asset_infos }reverse lookup) to the indexing sink (sync_single_pair/upsert_pair). Cross-checked against #285 emitter scoping, factorypair_keycanonicalization (sorted asset keys), andRUN_MODE=prodempty-FACTORY_ADDRESSrejection inconfig.rs. Rancargo test --lib pair_discovery::tests(4/4 pass).Outcome:
FINDINGS: 0medium+This MR closes the opportunistic-discovery gap from #285: unlisted / clone pair contracts that mimic the pair query API are rejected unless the configured factory maps the same
asset_infosto the emitter address. Thepair_info.contract_addr == pair_contract_addrguard blocks query responses that claim a different on-chain identity. Dev-only emptyFACTORY_ADDRESSskips provenance (documented; prod startup fails closed).Inline threads: none (no medium+ findings).
mentioned in commit
104e28d603