Gas Profiling

Understanding the Oval Gas overhead.

Oval serves as a wrapper for oracles, and as such adds a small gas overhead to accessing the price price. This docs page breaks down the extra gas added for AAVE v3.

Oval adds ~8k Gas per data read.

Typically, contracts retrieve data from Chainlink using AggregatorV3Interface.latestRoundData(), or the now-deprecated latestAnswer(), which remains in use in numerous contracts. Oval acts as an intermediary to the Chainlink interfaces, exposing the same read functions. The integration adds a minimal overhead of approximately 8,000 gas per read. Such an increase is relatively minor, typically less than 4% of the total cost associated with operations such as borrowing money or liquidating positions in protocols that utilize these data feeds.

Moreover, repeated reads from the same feed are more cost-effective due to state warming. For example, in an AAVE v3 borrow operation, which requires two price feed reads, the total additional cost is just ~12k Gas. This efficiency results from the EVM's optimized handling of repeated reads from the same memory slot.

We have performed gas profiling for various protocols that use Chainlink data feeds, assessing their performance upon upgrading to Oval. For instance, the additional cost of implementing Oval with Chainlink in AAVE V3 is just +3.59% for borrowing against isolated assets and +3.13% for liquidations. The results of these simulations can be explored through the Tenderly simulations linked in the raw gas figures in the table below.

Operation

Without Oval Consumption

With Oval Consumption

Gas Difference

Percentage

AAVE V3 borrow()

+ 12,062 Gas

+ 3.59%

AAVE V3 liquidationCall()

+ 12,190 Gas

+ 3.13%

AAVE V2 borrow()

+ 9,774 Gas

+ 1.88%

AAVE V2 liquidationCall()

+ 7,137 Gas

+ 1.63%

Oval results in a modest increase in gas consumption across different operations. It's important for protocols to weigh this increase against the specific functionalities and benefits they expect to derive from Oval integration.

Last updated