Commit b3772f1
committed
feat(oracle): Introduce robust and secure IPriceFeed infrastructure
This commit finalizes the core components of the Baobab Protocol's decentralized oracle infrastructure, migrating to a unified interface across all data sources (Chainlink, Pyth, Computed Feeds, and TWAP).
The central goal is to enhance manipulation resistance, data consistency, and security through a multi-layered validation approach enforced by the new contract.
### Key Features and Changes:
1. **BaobabOracleSecurity Integration:**
* Implements a central security gateway () enforcing sequential checks: Circuit Breakers, Global Pause, Global Staleness (), and contextual risk-based Confidence checks ().
* **Refinement:** Streamlined price fetching to rely solely on the output, eliminating redundant internal calls and improving gas efficiency.
2. **OracleRegistry (Assumed Role):**
* Acknowledges the reliance on the core to manage asset configuration (Primary/Fallback feeds) and enforce internal heartbeat/staleness logic before data is passed to the Security layer. The Registry acts as the sole source of data for the layer.
3. **ComputedOracle (Derived Prices):**
* Introduced a system for deriving secondary asset prices (e.g., ETH/BTC) via multiplication or division of two base feeds.
* **Security Fix:** Updated logic to return the **oldest** component timestamp, preventing the computed price from falsely appearing fresh when an underlying feed is stale.
* **Refinement:** Optimized fixed-point division math for gas efficiency while preserving 8-decimal output precision.
4. **Oracle Adapters (Chainlink & Pyth):**
* Created and to strictly conform to the interface.
* **Consistency:** Standardized output to 8 decimals for Pyth by implementing a robust helper that handles variable exponents.
* **Efficiency:** Refactored all adapters to ensure only a single external call is made per price query, drastically reducing transaction gas costs.
* **Fail Safe:** Ensured adapters return the sentinel value () on any failure (call revert, stale data, non-positive price).
5. **TWAPAdapter (Manipulation Resistance):**
* Implemented a Time-Weighted Average Price (TWAP) adapter used for sensitive actions, sourcing only validated prices from .
* **Security Principle:** The price pushing mechanism is permissionless to decentralize maintenance cost and increase data freshness.
* **Note on Pruning:** Identified and noted the gas-inefficiency of the current array pruning method, which is marked for a future refactor to a Ring/Circular Buffer structure for superior scalability.1 parent 2a3e484 commit b3772f1
4,983 files changed
Lines changed: 1701 additions & 1016828 deletions
File tree
- lib/chainlink
- .changeset
- .github
- ISSUE_TEMPLATE
- actions
- build-chainlink-image
- delete-deployments
- deploy-image
- golangci-lint
- notify-slack-jobs-result
- setup-cre-e2e-test-dependencies
- setup-go
- setup-nodejs
- setup-solana
- build-contracts
- setup-wasmd
- version-file-bump
- scripts
- tracing
- workflows
- ccip/config
- evm
- common
- chains/mocks
- logpoller/mocks
- log/mocks
- txmgr
- mocks
- types/mocks
- types/mocks
- core
- auth
- bridges
- mocks
- build
- capabilities
- ccip
- ccip_integration_tests
- integrationhelpers
- rmn
- usdcreader
- ccipaptos
- ccipevm
- manualexeclib
- testdata/fuzz/FuzzMessageHasher
- ccipnoop
- ccipsolana
- ccipsui
- ccipton
- common
- mocks
- configs
- aptos
- evm
- solana
- sui
- launcher
- ocrimpls
- oraclecreator
- types
- mocks
- validate
- compute
- test
- fetch/cmd
- simple/cmd
- fakes
- gateway_connector
- integration_tests
- framework
- keystone
- testdata
- mocks
- remote
- aggregation
- executable
- request
- messagecache
- types
- mocks
- streams
- targets/mocks
- transmission
- triggers/logevent
- logeventcap
- logeventcaptest
- validation
- vault
- mocks
- vaulttypes
- mocks
- webapi
- target
- trigger
- webapicap
- webapicaptest
- cbor
- cmd
- mocks
- config
- docs
- cmd/generate
- testdata
- mocks
- parse
- toml
- internal
- cltest
- features
- ocr2
- plugins
- fixtures
- badcookie
- keys
- wasm
- gethwrappers2/generated/offchainaggregator
- mocks
- testutils
- configtest
- cosmostest
- evmtest
- v2
- httptest
- keystest
- pgtest
- solanatest
- wasmtest
- logger
- audit
- internal/colortest
- monitoring
- null
- platform
- recovery
- scripts
- ccip
- ccip-revert-reason
- debugreceiver
- manual-execution
- batch_runner
- helpers
- revert-reason
- command
- config
- handler
- secrets
- chaincli
- command
- keeper
- config
- handler
- images
- common
- vrf
- constants
- docker
- db
- secrets
- toml-config
- wait-for-others
- jobs
- model
- setup-envs
- util
- cre/environment
- capability-registry
- configs
- examples
- dashboards
- environment
- examples
- contracts
- permissionless_feeds_consumer
- pkg
- deploy
- fake
- trigger
- verify
- verifiers/proof-of-reserve
- workflows
- v1/proof-of-reserve
- cron-based
- types
- web-trigger-based
- types
- v2
- cron
- types
- http_simple
- http
- node-mode
- proof-of-reserve/cron-based
- types
- time_consensus
- time
- minio
- mock
- proto-configs
- root
- tracking
- workflow
- functions
- artefacts
- src
- templates
- gateway
- client
- connector
- web_api_trigger
- keystone
- src
- __snapshots__
- external-adapter
- testdata
- p2ptoys
- common
- keygen
- vrfv1
- vrfv2plus/testnet
- v2plusscripts
- vrfv2
- genvrfnum
- revert-reason
- testnet
- v2scripts
- services
- blockhashstore
- mocks
- blockheaderfeeder
- ccip
- mocks
- chainlink
- mocks
- testdata
- mergingsecretsdata
- cron
- directrequest
- feeds
- mocks
- fluxmonitorv2
- mocks
- promfm
- functions
- mocks
- gateway
- api
- common
- aggregation
- config
- connector
- mocks
- handlers
- capabilities
- v2
- metrics
- mocks
- common
- functions
- allowlist
- mocks
- internal
- subscriptions
- mocks
- mocks
- vault
- integration_tests
- network
- mocks
- headreporter
- job
- mocks
- testdata
- wasm
- keeper
- keystore
- chaintype
- internal
- keys
- aptoskey
- cosmoskey
- csakey
- dkgrecipientkey
- ethkey
- ocr2key
- ocrkey
- p2pkey
- solkey
- starkkey
- testdata/fuzz/FuzzStarknetKeyring_Marshal
- suikey
- tonkey
- tronkey
- vrfkey
- workflowkey
- mocks
- llo
- bm
- channeldefinitions
- cre
- grpc
- mercurytransmitter
- observation
- retirement
- telem
- types
- mocks
- nodestatusreporter/bridgestatus
- events
- fixtures
- mocks
- ocr2
- plugins
- ccip
- abihelpers
- ccipcommit
- ccipexec
- config
- estimatorconfig
- mocks
- internal
- ccipcalc
- ccipcommon
- ccipdata
- batchreader
- mocks
- ccipdataprovider
- mocks
- factory
- mocks
- contracts
- v1_2_0
- v1_4_0
- v1_5_0
- ccipdb
- mocks
- logpollerutil
- observability
- oraclelib
- parseutil
- pricegetter
- rpclib
- rpclibmocks
- pkg/leafer
- prices
- testhelpers
- integration
- testhelpers_1_4_0
- tokendata
- http
- lbtc
- observability
- usdc
- transmitter
- functions
- config
- encoding
- integration_tests/v1
- internal
- generic
- llo
- config
- median
- config
- mercury
- config
- ocr2keeper
- evmregistry
- v20
- mocks
- v21
- autotelemetry21
- core
- mocks
- encoding
- fixtures
- gasprice
- logprovider
- mercury
- streams
- v02
- v03
- mocks
- prommetrics
- testdata
- transmit
- upkeepstate
- promwrapper
- mocks
- s4
- threshold
- mocks
- vault
- testhelpers
- validate
- ocr3/promwrapper
- ocrbootstrap
- ocrcommon
- ocr
- mocks
- p2p
- types
- mocks
- wrapper
- periodicbackup
- pg
- datatypes
- pipeline
- eautils
- mocks
- registrysyncer
- mocks
- v2
- mocks
- relay
- dummy
- evm
- capabilities/testutils
- evmtesting
- functions
- mercury
- mocks
- types
- utils
- v2
- reportcodec
- types
- v3
- reportcodec
- types
- v4
- reportcodec
- types
- verifier
- wsrpc
- mocks
- pb
- mocks
- statuschecker
- read
- mocks
- types/mocks
- s4
- mocks
- signatures
- cryptotest
- ethdss
- ethschnorr
- secp256k1
- standardcapabilities
- streams
- synchronization
- mocks
- telem
- telemetry
- versioning
- vrf
- extraargs
- mocks
- proof
- solidity_cross_tests
- v1
- v2
- vrfcommon
- vrftesthelpers
- webhook
- mocks
- workflows
- artifacts
- v2
- cmd/cre
- examples
- legacy/data_feeds
- v2
- empty
- http_read
- simple_cron_with_config
- simple_cron_with_secrets
- simple_cron
- utils
- events
- internal
- metering
- mocks
- monitoring
- ratelimiter
- store
- syncerlimiter
- syncer
- mocks
- v2
- mocks
- versioning
- test
- break/cmd
- wasm
- legacy/cmd
- v2/cmd
- with_config
- with_secrets
- zerotimeout/cmd
- types
- v2
- sessions
- ldapauth
- mocks
- localauth
- mocks
- oidcauth
- shutdown
- static
- store
- cmd/preparetest
- fixtures
- migrate
- migrations
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
0 commit comments