fix(ilRisk): don't collapse ETHFI/sETHFI into the ETH family (substring false-match)#2821
Open
Himess wants to merge 1 commit into
Open
fix(ilRisk): don't collapse ETHFI/sETHFI into the ETH family (substring false-match)#2821Himess wants to merge 1 commit into
Himess wants to merge 1 commit into
Conversation
checkIlRisk substring-matches each token against a hardcoded L1 list, so
'ethfi'.includes('eth') collapses ETHFI into the ETH family and mislabels
ETHFI/ETH pools as ilRisk "no" (ETHFI is Ether.fi's governance token,
uncorrelated with ETH). Add a notCorrelated exception set so tokens that
merely contain an L1 substring don't collapse. 11 live pools (~$1.54M)
flip to the correct "yes"; 0 regressions across all 15,410 pools.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesIL-risk correlation handling
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
checkIlRiskdecides IL risk by substring-matching each token against a hardcoded L1 list.'ethfi'.includes('eth')is true, so ETHFI collapses into the ETH family. An ETHFI/ETH pool then looks like a single-family pair and getsilRisk: "no", even though ETHFI is Ether.fi's governance token and uncorrelated with ETH.11 live pools, $1.54M, are labelled no IL risk when the risk is real:
The same token gets the right answer when it isn't paired with ETH. USDT-ETHFI is correctly
ilRisk: "yes", because there's no L1 for it to collapse into. That isolates the substring collapse.const checkIlRisk = (el) => { const l1Token = ['btc', 'eth', 'avax', 'matic', 'eur', 'link', 'sushi']; + // tokens that merely CONTAIN an l1Token substring but are NOT correlated with it + // (independent governance/utility tokens). Without this, e.g. 'ethfi'.includes('eth') + // collapses ETHFI into the ETH family and mislabels ETHFI-ETH pools as ilRisk 'no'. + const notCorrelated = ['ethfi', 'sethfi', 'ethdydx', 'ethix']; const symbol = el.symbol.toLowerCase(); const tokens = symbol.split('-'); ... const elements = []; for (const t of tokens) { + if (notCorrelated.includes(t)) continue; for (const x of l1Token) { if (t.includes(x)) { elements.push(x); break; } } }Tested against all 15,410 live pools: exactly 11 flip no to yes, all ETHFI/sETHFI-ETH pairs. 0 flip yes to no. Every changed pool contains an exception token. The change is one-directional by construction: forcing a known-uncorrelated token not to collapse can only add IL-risk flags where they belong, it cannot produce a false "no".
The list needs maintenance as new tokens appear, which isn't ideal. The robust fix is replacing the substring match with a correlated-token family registry. Happy to do that instead if you prefer.
One related thing I found but deliberately did not patch here. The same function marks SOL and BNB liquid-staking pairs as
ilRisk: "yes"(SOL-JITOSOL, SOL-MSOL, BNBX-WBNB, 66 pools, about $27.5M) because sol and bnb aren't in l1Token, while the identical ETH relationship (STETH-ETH, WSTETH-ETH) correctly gets "no". I tested adding them to the list and it makes things worse: about 19 memecoins that merely contain "sol" (SOLO, SOLCEX, SOLGOAT, SOLAMA) would wrongly become "no", and substring can't tell them apart from real LSTs like STSOL or EZSOL. So that direction needs the registry, not a list-add. Let me know if you want me to take it on.Summary by CodeRabbit