fix(indexer): key hybrid route cache on resolved discount tier (#283) #751

Merged
Brouie merged 1 commit from qa/283-solver-cache-key-tier into main 2026-06-05 03:20:43 +00:00
Brouie commented 2026-06-05 01:35:17 +00:00 (Migrated from gitlab.com)

Follow-up on #283, your "key on the sender's discount tier" direction.

hybrid_cache_key (route_solver.rs) keyed on trader only; maybe_simulate forwards both trader and sender to the router and the on-chain discount depends on the subject's tier. So two callers with trader unset but different senders on different tiers collided on the cache key and could be served each other's (wrong-discount) quote.

Resolve the discount subject (trader if set, else sender) and look up its tier from the already-synced traders.tier_id (no extra LCD), then fold the tier into the key. Same-tier callers still share the cache (your intent); different tiers can't collide. hybrid_cache_key stays pure/sync — the async tier lookup is in the caller. Test hybrid_cache_key_distinguishes_discount_tier added.

Scoped to the cache-key correctness; the deeper sender / is_trusted_router tracking stays in #279's cache phase as flagged. No closing keyword.

Follow-up on #283, your "key on the sender's discount tier" direction. `hybrid_cache_key` (route_solver.rs) keyed on `trader` only; `maybe_simulate` forwards both `trader` and `sender` to the router and the on-chain discount depends on the subject's tier. So two callers with `trader` unset but different senders on different tiers collided on the cache key and could be served each other's (wrong-discount) quote. Resolve the discount subject (`trader` if set, else `sender`) and look up its tier from the already-synced `traders.tier_id` (no extra LCD), then fold the tier into the key. Same-tier callers still share the cache (your intent); different tiers can't collide. `hybrid_cache_key` stays pure/sync — the async tier lookup is in the caller. Test `hybrid_cache_key_distinguishes_discount_tier` added. Scoped to the cache-key correctness; the deeper sender / is_trusted_router tracking stays in #279's cache phase as flagged. No closing keyword.
Brouie commented 2026-06-05 01:35:41 +00:00 (Migrated from gitlab.com)

mentioned in issue #283

mentioned in issue #283
PlasticDigits commented 2026-06-05 03:20:43 +00:00 (Migrated from gitlab.com)

mentioned in commit 013b51a77b

mentioned in commit 013b51a77bd9af16387e4232a2d9f67277a28f6b
PlasticDigits (Migrated from gitlab.com) merged commit 013b51a77b into main 2026-06-05 03:20:43 +00:00
Brouie commented 2026-06-05 03:23:18 +00:00 (Migrated from gitlab.com)

mentioned in issue #279

mentioned in issue #279
Brouie commented 2026-06-05 03:46:20 +00:00 (Migrated from gitlab.com)

mentioned in merge request !761

mentioned in merge request !761
PlasticDigits commented 2026-06-05 04:03:59 +00:00 (Migrated from gitlab.com)

mentioned in merge request !764

mentioned in merge request !764
PlasticDigits commented 2026-06-05 04:08:16 +00:00 (Migrated from gitlab.com)

mentioned in issue #306

mentioned in issue #306
Brouie commented 2026-06-05 08:23:01 +00:00 (Migrated from gitlab.com)

mentioned in issue #322

mentioned in issue #322
Brouie commented 2026-06-05 08:23:02 +00:00 (Migrated from gitlab.com)

mentioned in issue #323

mentioned in issue #323
Brouie commented 2026-06-05 08:23:04 +00:00 (Migrated from gitlab.com)

mentioned in issue #324

mentioned in issue #324
PlasticDigits commented 2026-06-05 11:12:21 +00:00 (Migrated from gitlab.com)

mentioned in merge request !797

mentioned in merge request !797
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!751
No description provided.