Skip to content

fix: prefer full-coverage oracles in ClassicCollector (1.0.3) - #65

Open
iMCrazyDev wants to merge 1 commit into
mainfrom
fix/classic-collector-asset-coverage
Open

fix: prefer full-coverage oracles in ClassicCollector (1.0.3)#65
iMCrazyDev wants to merge 1 commit into
mainfrom
fix/classic-collector-asset-coverage

Conversation

@iMCrazyDev

Copy link
Copy Markdown
Collaborator

Problem

On the ALTS pool every getPrices* call that included NOT failed with:

Trying to generate merkle proof for a missing key "63272935…749085"

Root cause: when more oracles than minimalOracles respond, ClassicCollector picked the newest ones by timestamp only. NOT is currently signed by 3 of the 4 mainnet oracles (oracle 84df…ea24 omits it), so whenever that oracle landed in the top-3, packOraclesData tried to build a merkle proof for a key the oracle's dict doesn't have and the whole call threw — even though 3 fully-covering oracles were available.

Fix

  • Oracle selection now prefers oracles covering every requested asset (still newest-first) and falls back to the old behaviour when there aren't enough full-coverage oracles.
  • Safety net: only assets present in every selected oracle's dict are packed into the price cell. An asset that can't be proven by all selected oracles is dropped from the result — same semantics as assets with no median price — instead of aborting the call.

Verified

  • Before: 5/5 ALTS getPrices runs failed on the missing NOT key. After: 5/5 runs return prices for all 5 assets (GRAM USDT CATI NOT DOGS); main pool still returns 8/8.
  • End-to-end on mainnet: a real ALTS borrow of ~122 NOT priced by this collector was accepted on-chain (master verified the 3 full-coverage oracle proofs, user contract answered SUPPLY_WITHDRAW_SATISFIED, jettons paid out).
  • tests/prices jest results unchanged vs main (pre-existing failures are Pyth endpoint auth / ICP source issues, untouched by this change).

🤖 Generated with Claude Code

When more oracles than minimalOracles were available, the collector
picked the newest by timestamp without checking asset coverage. An
oracle missing a requested asset (NOT is signed by 3 of 4 mainnet
oracles) made generateMerkleProofDirect throw 'Trying to generate
merkle proof for a missing key', failing every getPrices* call on the
ALTS pool that included NOT.

Selection now prefers oracles that cover every requested asset, and
only assets provable by all selected oracles are packed into the price
cell (uncoverable assets are dropped like assets with no median price).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant