Conversation
WalkthroughAdjusts candidate pool filtering to exempt AlloyTransmuter pools from minimum liquidity checks and refactors pool rating in sorting to use explicit transmuter/orderbook detection with fixed TVL-based boosts. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as CandidateSelector
participant P as Pool
participant R as RatingEngine (sortPools)
C->>P: Evaluate pool
alt Liquidity < Min
alt P is AlloyTransmuter
Note right of C: Exempt from min-liquidity check
C-->>P: Keep as candidate
else Not AlloyTransmuter
C-->>P: Skip pool
end
else Liquidity >= Min
C-->>P: Keep as candidate
end
C->>R: Submit candidate pools
loop For each pool
R->>P: Detect type (isTransmuterPool / isOrderbookPool)
alt Transmuter
Note over R: rating += TVL × 10
else Orderbook
Note over R: rating += TVL × 2
else Neither
Note over R: Use base rating
end
R-->>R: Append to rated list
end
R-->>C: Sorted pools by rating
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
router/usecase/candidate_routes.go(1 hunks)router/usecase/router.go(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: test
- GitHub Check: build
- GitHub Check: test_routes
- GitHub Check: test_coingecko_prices
- GitHub Check: Run linter
- GitHub Check: test_prices
| if pool.GetType() == poolmanagertypes.CosmWasm { | ||
| cosmWasmPoolModel := pool.GetSQSPoolModel().CosmWasmPoolModel | ||
| if cosmWasmPoolModel != nil { | ||
| if cosmWasmPoolModel.IsAlloyTransmuter() { | ||
| isTransmuterPool = true | ||
| } else if cosmWasmPoolModel.IsOrderbook() { | ||
| isOrderbookPool = true | ||
| } | ||
| } else { | ||
| cosmWasmPool, ok := pool.GetUnderlyingPool().(cosmwasmpooltypes.CosmWasmExtension) | ||
| if ok { | ||
| _, isTransmuter := transmuterCodeIDs[cosmWasmPool.GetCodeId()] | ||
| if isTransmuter { | ||
| isTransmuterPool = true | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Transmuter detection regresses non-alloy pools
When CosmWasmPoolModel is populated we now only set isTransmuterPool if IsAlloyTransmuter() returns true. Plain transmuters report PoolType = transmuter (or expose IsTransmuter()), so they fall through this branch, never get the 10× TVL boost, and sink back below orderbooks/regular pools—the exact routing failure BE-782 calls out. Please use the generic transmuter flag (or pool type) and still fall back to the code-ID map so every transmuter, alloyed or not, is flagged. Example fix:
- if pool.GetType() == poolmanagertypes.CosmWasm {
- cosmWasmPoolModel := pool.GetSQSPoolModel().CosmWasmPoolModel
- if cosmWasmPoolModel != nil {
- if cosmWasmPoolModel.IsAlloyTransmuter() {
- isTransmuterPool = true
- } else if cosmWasmPoolModel.IsOrderbook() {
- isOrderbookPool = true
- }
- } else {
+ if pool.GetType() == poolmanagertypes.CosmWasm {
+ cosmWasmPoolModel := pool.GetSQSPoolModel().CosmWasmPoolModel
+ if cosmWasmPoolModel != nil {
+ if cosmWasmPoolModel.IsTransmuter() || cosmWasmPoolModel.IsAlloyTransmuter() {
+ isTransmuterPool = true
+ }
+ if cosmWasmPoolModel.IsOrderbook() {
+ isOrderbookPool = true
+ }
+ }
+ if !isTransmuterPool {
cosmWasmPool, ok := pool.GetUnderlyingPool().(cosmwasmpooltypes.CosmWasmExtension)
if ok {
_, isTransmuter := transmuterCodeIDs[cosmWasmPool.GetCodeId()]
if isTransmuter {
isTransmuterPool = true
}
}
}
}🤖 Prompt for AI Agents
In router/usecase/router.go around lines 129 to 145, transmuter detection
currently only marks pools as transmuters when
CosmWasmPoolModel.IsAlloyTransmuter() is true, which misses plain (non-alloy)
transmuters; update the logic to first check the generic transmuter flag or pool
type (e.g., CosmWasmPoolModel.IsTransmuter() or PoolType == transmuter) and set
isTransmuterPool when present, keep the existing alloy-specific check, and still
fall back to the code-ID map lookup on the underlying CosmWasm pool when the
model is nil so all transmuters (alloyed or not) are flagged.
There was a problem hiding this comment.
This doesn't seem valid, but @iboss-ptk please double-check
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
This shouldn't have any issue. Even if it does, non-alloyed are not being used anymore anyway.
|
| // Skip pools with insufficient liquidity, except for transmuter pools | ||
| // Transmuter pools should always be considered regardless of liquidity cap | ||
| // because they provide no-slippage swaps and we want them prioritized | ||
| if pool.GetPoolLiquidityCap() < options.MinPoolLiquidityCap && !pool.IsAlloyTransmuter { |
There was a problem hiding this comment.
What if transmuter liquidity is zero? Should we define a minimum as $1
There was a problem hiding this comment.
If user would like to swap $0.5 I think we should pick transmuter first still. I feel like arbitrary min here wouldn't give much benefit.
| if pool.GetType() == poolmanagertypes.CosmWasm { | ||
| cosmWasmPoolModel := pool.GetSQSPoolModel().CosmWasmPoolModel | ||
| if cosmWasmPoolModel != nil { | ||
| if cosmWasmPoolModel.IsAlloyTransmuter() { | ||
| isTransmuterPool = true | ||
| } else if cosmWasmPoolModel.IsOrderbook() { | ||
| isOrderbookPool = true | ||
| } | ||
| } else { | ||
| cosmWasmPool, ok := pool.GetUnderlyingPool().(cosmwasmpooltypes.CosmWasmExtension) | ||
| if ok { | ||
| _, isTransmuter := transmuterCodeIDs[cosmWasmPool.GetCodeId()] | ||
| if isTransmuter { | ||
| isTransmuterPool = true | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
This doesn't seem valid, but @iboss-ptk please double-check



Closes: BE-782
Summary by CodeRabbit
New Features
Refactor