Skip to content

Add reusable outage-tolerant dual price feeds - #1

Draft
cryptoharry wants to merge 3 commits into
devfrom
fix/dual-feed-outage
Draft

cryptoharry wants to merge 3 commits into
devfrom
fix/dual-feed-outage

Conversation

@cryptoharry

@cryptoharry cryptoharry commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Provider read failures or read-time expiry can stop pricing even when another usable quote or a valid stored price remains available. This adds reusable components that preserve access to valid quotes and their original timestamps during update outages.

Changes

  • DualFeedPriceFeed extends ChainlinkBasePriceFeed, reusing ownership, source configuration, heartbeat management, decimal normalization and strict primary bounds. The base contract only marks latestRoundData and setHeartbeat as virtual; its existing behaviour is unchanged.
  • Prefer a fresh valid primary, then a fresh valid fallback, then the newest valid stale quote. Ties prefer the primary. Failed/malformed reads, bounds failures and normalization errors invalidate only the affected source. An absent fallback is supported. If neither source is usable, pricing reverts with NoValidPrice().
  • RedstoneStoredPriceFeed reads the provider's existing stored record without a read-time age expiry. Adapter address, feed ID, value decimals, allowed forward timestamp skew and description are constructor settings. Signed updates remain validated by RedStone. The reported timestamp is the earlier of observation and publication.
  • Generic documentation and fixtures contain no deployment-specific market wiring. The test provider's expiry is a constructor setting, with coverage across different expiries and source decimals. Switching freshness remains the selector's configurable heartbeat; action-specific freshness remains the consumer's policy.

Validation

  • 149 targeted tests passed: 54 feed/integration tests and 95 existing Market, Oracle and BorrowController tests.
  • Four cases preserve distinct round IDs, answered-in-round IDs, start times and update times for fresh and stale primary/fallback selection.
  • Three differential fuzz tests compare complete quotes against ChainlinkBasePriceFeed across source decimals from 0 to 36, freshness boundaries, and prices below, at and above primary bounds.
  • Six feed fuzz tests each ran 256 cases. Existing regressions cover provider/decoding failures, normalization, RedStone configuration, combining feeds, stale borrowing rejection, liquidation settlement and pessimistic-cache recovery.

Formatting and whitespace checks passed. The latest commit changes only a test file; production sources are unchanged. Dedicated CI needs no RPC credentials. The full fork suite requires RPC_MAINNET; a complete deployment/governance fork simulation remains outstanding.

Usage and configuration

Tracking: https://maestro.inverse.finance/boards/2/tasks/419

@cryptoharry cryptoharry changed the title Keep FiRM USD feeds usable during provider update outages Keep FiRM pricing available during oracle update outages Oct 21, 2026
@cryptoharry cryptoharry changed the title Keep FiRM pricing available during oracle update outages Add reusable outage-tolerant dual price feeds Oct 21, 2026
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