fix(ingest): classify v3/yearn vaults consistently across discovery paths - #458
Open
matheus1lva wants to merge 2 commits into
Open
fix(ingest): classify v3/yearn vaults consistently across discovery paths#458matheus1lva wants to merge 2 commits into
matheus1lva wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Gate the StrategyChanged else-branch merge on the classification resolving to v3. A sub-3.0.0 apiVersion previously wrote yearn/v3/apiVersion into the defaults, which evicted the thing from the erc4626 convention and routed it to yearn/2/vault, whose hooks expect token()/pricePerShare, not a 4626 surface. classifyVault now returns the cleaned version instead of the raw one. clean() strips non-semver characters, so '3.0.2rc' passed validate() while the raw string was persisted and made downstream compare() calls in tvl.ts and apy.ts throw. It also takes an optional argument and returns undefined on falsy input, so clean()'s throw is no longer reachable through it.
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.
Summary
Mainnet Ondo Aggregator
0xACA399117aC588E1F48398d34eCA76CDB1E45fA5(apiVersion 3.0.2) servesv3: falseon the REST vault list andv3: nullon GraphQL becausev3/yearnonly exist inthing.defaultsand several discovery paths never write them. This adds one sharedclassifyVault(apiVersion)helper ({ yearn, v3: apiVersion >= 3.0.0, apiVersion }), applies it in theStrategyChanged else-branch, adds
yearn: truein the vaultFactory/roleManager hooks so those vaults stopdual-matching the generic erc4626 convention, and adds the missing
v3: trueflags inconfig/manuals.yaml.How to review
Start with
packages/ingest/helpers/classify-vault.ts: version compare reusescomparefromcompare-versions+cleanfromlib/version, the same pair aspackages/ingest/things.ts. The helpertakes an optional string and returns
undefinedfor falsy or non-semver input, so a contract returningapiVersion() = "yVault"falls back to the unresolved path instead of throwing. It returns the cleanedversion, not the raw one —
clean()strips non-semver characters, so a raw3.0.2rcwould passvalidate()and then make thecompare()calls inabis/yearn/lib/tvl.tsandabis/yearn/lib/apy.tsthrow on read.
Then
StrategyChanged/hook.ts: the else-branch merges helper output only when the classification resolvesto v3. Anything reaching that branch is 4626-shaped, so a sub-3.0.0 classification is never the right
outcome — writing
apiVersionalone would match theyearn/2/vaultconvention (whose hooks expecttoken()/pricePerShare), andyearn: truealone would evict the thing from the erc4626 convention.The tokenized branch adds
yearn: trueto the vault-labeled record only, and the threemq.addcalls arenow awaited. The manuals.yaml edits are 8 chain-100 entries that had
apiVersionwithoutv3.Test plan
REST vault cache, then check Ondo on REST list / GraphQL / REST snapshot for
v3: true.bunx vitest run helpers/classify-vault.spec.ts abis/yearn/3/vault/event/StrategyChanged/hook.spec.tsfrom
packages/ingest— 12/12 pass (helper version edges incl. the 3.0.0 boundary, cleaned-output casesv3.0.2/0.4.6-beta/3.0.2rc, garbage and empty input; hook resolved/sub-3.0.0/unresolved/garbage/tokenized cases).
Risk / impact
yearn: trueflips backfilled vaults from the erc4626 convention to yearn/3 hooks and adds them toGraphQL
yearn: true/ origin-yearn filters and the timeseries resolver (accepted in the plan). Staleerc4626 hook keys in snapshots are already shadowed by contract state on read. Non-yearn contracts that
expose an
apiVersion()of 3.0.0 or above get classified as yearn (accepted); below 3.0.0 they keep theirerc4626 classification unchanged. Rollback: revert, replay, re-fanout.
Known gaps
yearn: trueedits have no test, andoutput/timeseries rows alreadywritten under erc4626 hook keys for backfilled vaults are not graded — only snapshots are.
classifyVaulthas one call site. vaultFactory, roleManager and the three v3 registry hooks still stampv3: trueregardless of the apiVersion they read.config/manuals.yaml:37and:52keepyearn: falsealongsideapiVersion: '3.0.1', so they stilldual-match erc4626 and yearn/3.