<!-- ghit#filepath: /Users/jagadeesh/boss/drips/credence --> # Enforce canonical token ordering in pair identifiers ## Description - Pair keys can be generated in non-canonical order, enabling duplicate market representations. ## Requirements and context - Standardize key creation with deterministic ordering. - Keep lookup compatibility for existing pairs. ## Suggested execution - Sort token addresses when deriving pair IDs. - Migrate or alias legacy keys where necessary. ## Test and commit - Add tests proving `(A,B)` and `(B,A)` resolve identically. - Ensure duplicate pair creation is impossible. ## Example commit message - `fix(contracts): canonicalize token ordering in pair keys` ## Guidelines - Avoid expensive sorting beyond two-token pairs. - Keep event payload ordering consistent.
Enforce canonical token ordering in pair identifiers
Description
Requirements and context
Suggested execution
Test and commit
(A,B)and(B,A)resolve identically.Example commit message
fix(contracts): canonicalize token ordering in pair keysGuidelines