smartcontractkit / ccip

Cross Chain Interoperability Protocol
Other
119 stars 47 forks source link

Change data feeds from default to fallback in `FeeQuoter` #1430

Closed RayXpub closed 1 month ago

RayXpub commented 1 month ago

Motivation

Due to the gas cost of reading from data feeds, it is unlikely to be the default option, we can therefore optimize the getTokenPrice() function by defaulting to state instead of data feeds.

Solution

Default to state reported prices and only fall back on data feed external call if the reported prices are stale.

github-actions[bot] commented 1 month ago

LCOV of commit ae00e84 during Solidity Foundry #8106

Summary coverage rate:
  lines......: 97.7% (2179 of 2230 lines)
  functions..: 94.9% (409 of 431 functions)
  branches...: 93.5% (520 of 556 branches)

Files changed coverage rate: n/a
matYang commented 1 month ago

nit: add comment to explain the context, i.e DF is read 2nd because it is not expected to be the default option

RayXpub commented 1 month ago

nit: add comment to explain the context, i.e DF is read 2nd because it is not expected to be the default option

@matYang Done

cl-sonarqube-production[bot] commented 1 month ago

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube