Omniscia Tren Finance Audit

PriceFeedL2 Manual Review Findings

PriceFeedL2 Manual Review Findings

PFL-01M: Incorrect Sequencer Oracle Integration

Description:

The Chainlink sequencer oracles are meant to have their startedAt data points processed rather than their updatedAt, meaning that the system might cause a higher delay than expected in ensuring the borrow / liquidation delays have elapsed.

Impact:

Depending on the frequency of disagreements and thus updates in relation to the sequencer's status on the Chainlink network, a higher delay than expected might be enforced on price measurements which would result in a temporary Denial-of-Service of the system.

Example:

contracts/Pricing/PriceFeedL2.sol
73// prettier-ignore
74(
75 /* uint80 roundId */
76 ,
77 int256 answer,
78 /* uint256 startedAt */
79 ,
80 uint256 updatedAt,
81 /* uint80 answeredInRound */
82) = ChainlinkAggregatorV3Interface(sequencerUptimeFeedAddress).latestRoundData();
83
84// answer == 0 -> sequencer is up
85// answer == 1 -> sequencer is down
86bool isSequencerUp = answer == 0;
87if (!isSequencerUp) {
88 revert PriceFeedL2__SequencerDown();
89}
90
91uint256 delay;
92if (msg.sender == trenBoxManagerOperations) {
93 // TrenBoxManagerOperations triggers liquidations and redemptions
94 delay = SEQUENCER_LIQUIDATION_DELAY_SECONDS;
95} else {
96 delay = SEQUENCER_BORROWING_DELAY_SECONDS;
97}
98uint256 timeSinceSequencerUp = block.timestamp - updatedAt;
99if (timeSinceSequencerUp <= delay) {
100 revert PriceFeedL2__SequencerGracePeriodNotOver();
101}

Recommendation:

We advise the startedAt variable to be evaluated instead per the Chainlink documentation itself, ensuring that the sequencer oracle is properly integrated by the PriceFeedL2::_checkSequencerUptimeFeed function.

Alleviation (f6f1ad0b8f):

We consider this exhibit to require an alleviation as it illustrates an incorrect integration of the L2 sequencer oracle.

Alleviation (73b9546eb9):

The code was updated to utilize the correct variable, alleviating this exhibit in full.