Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughConsolidates oracle vendor identification logic by introducing Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/utils/marketFilters.ts (1)
231-237:⚠️ Potential issue | 🟡 MinorSearch still ignores tagged oracle labels.
getOracleVendorInfo()now exposestaggedVendorsand the unknown state, but this branch still searches only the legacyvendorsarray. Markets that surface a tagged provider or"Unverified"in the oracle UI will not match the same text in search.Possible fix
- const { vendors } = getOracleVendorInfo(market.oracleAddress, market.morphoBlue.chain.id, oracleMetadataMap); - const vendorsName = vendors.join(','); + const { coreVendors, taggedVendors, hasUnknown } = getOracleVendorInfo( + market.oracleAddress, + market.morphoBlue.chain.id, + oracleMetadataMap, + ); + const vendorTerms = [...coreVendors, ...taggedVendors, ...(hasUnknown ? ['Unverified'] : [])].join(','); return ( market.uniqueKey.toLowerCase().includes(lowercaseQuery) || market.collateralAsset.symbol.toLowerCase().includes(lowercaseQuery) || market.loanAsset.symbol.toLowerCase().includes(lowercaseQuery) || - vendorsName.toLowerCase().includes(lowercaseQuery) + vendorTerms.toLowerCase().includes(lowercaseQuery) );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/utils/marketFilters.ts` around lines 231 - 237, The search currently only uses the legacy vendors array returned from getOracleVendorInfo, so tagged vendor labels and the unknown/unverified state are ignored; update the logic where vendorsName is built (after calling getOracleVendorInfo) to include taggedVendors (and, if provided by getOracleVendorInfo, the unknown/unverified indicator) by concatenating vendors + taggedVendors and/or the unknown label into a single string before doing vendorsName.toLowerCase().includes(lowercaseQuery), ensuring the branch that checks market.uniqueKey, collateralAsset, loanAsset and vendorsName will match tagged providers and "Unverified" text as well.
🧹 Nitpick comments (1)
src/utils/oracle.ts (1)
261-283: Keep lookup misses distinct from real empty vendor sets.This helper returns
emptyVendorInfo()for three different states: missing scanner metadata, unsupported/custom oracle metadata, and a resolved standard/meta oracle with no classified feeds. Once callers only seeVendorInfo, those cases are indistinguishable, which makes downstream search/filter code easy to get wrong. A small discriminator likestatus: 'resolved' | 'missing' | 'unsupported'would make the contract safer.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/utils/oracle.ts` around lines 261 - 283, The function getOracleVendorInfo conflates three distinct states into emptyVendorInfo(); change the VendorInfo contract to include a status discriminator (e.g., status: 'resolved' | 'missing' | 'unsupported') and return the appropriate status from getOracleVendorInfo: return status 'missing' when oracleAddress or metadataMap is absent, 'unsupported' when metadata exists but has an unexpected type, and 'resolved' when parseMetaOracleVendors or parsePriceFeedVendors produce the result. Update emptyVendorInfo (or add helpers like missingVendorInfo/unsupportedVendorInfo) to produce VendorInfo with the matching status, and ensure callers that consume getOracleVendorInfo still read the new status field. Reference symbols: getOracleVendorInfo, emptyVendorInfo, getOracleFromMetadata, parseMetaOracleVendors, parsePriceFeedVendors, and OracleMetadataRecord.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/utils/marketFilters.ts`:
- Around line 231-237: The search currently only uses the legacy vendors array
returned from getOracleVendorInfo, so tagged vendor labels and the
unknown/unverified state are ignored; update the logic where vendorsName is
built (after calling getOracleVendorInfo) to include taggedVendors (and, if
provided by getOracleVendorInfo, the unknown/unverified indicator) by
concatenating vendors + taggedVendors and/or the unknown label into a single
string before doing vendorsName.toLowerCase().includes(lowercaseQuery), ensuring
the branch that checks market.uniqueKey, collateralAsset, loanAsset and
vendorsName will match tagged providers and "Unverified" text as well.
---
Nitpick comments:
In `@src/utils/oracle.ts`:
- Around line 261-283: The function getOracleVendorInfo conflates three distinct
states into emptyVendorInfo(); change the VendorInfo contract to include a
status discriminator (e.g., status: 'resolved' | 'missing' | 'unsupported') and
return the appropriate status from getOracleVendorInfo: return status 'missing'
when oracleAddress or metadataMap is absent, 'unsupported' when metadata exists
but has an unexpected type, and 'resolved' when parseMetaOracleVendors or
parsePriceFeedVendors produce the result. Update emptyVendorInfo (or add helpers
like missingVendorInfo/unsupportedVendorInfo) to produce VendorInfo with the
matching status, and ensure callers that consume getOracleVendorInfo still read
the new status field. Reference symbols: getOracleVendorInfo, emptyVendorInfo,
getOracleFromMetadata, parseMetaOracleVendors, parsePriceFeedVendors, and
OracleMetadataRecord.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ca0d41c7-c607-4768-8cb5-ca5f90ca5809
⛔ Files ignored due to path filters (1)
src/imgs/oracles/midas.pngis excluded by!**/*.png
📒 Files selected for processing (6)
src/features/markets/components/markets-table-same-loan.tsxsrc/features/markets/components/oracle-vendor-badge.tsxsrc/features/markets/components/oracle/MarketOracle/FeedEntry.tsxsrc/hooks/useOracleMetadata.tssrc/utils/marketFilters.tssrc/utils/oracle.ts
starksama
left a comment
There was a problem hiding this comment.
LGTM. I reviewed the diff and also ran targeted lint/typecheck plus a full production build locally. No blocking regressions jumped out to me.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor