DeFiFoundry
60,000 USDC
View results
Submission Details
Severity: low
Valid

`verifyOffchainPrice()` will always revert due to insufficient native balance for on-chain data verification

Summary

Vulnerability Details

The SettlementConfiguration::verifyOffchainPrice() is called during order settlement, it verifies the provided input priceData on-chain, by sending an external call to chainlink verifier proxy contract. This proxy contract required a verification fee to process the verification, as can be seen below,

function verifyReport(
IVerifierProxy chainlinkVerifier,
FeeAsset memory fee,
bytes memory signedReport
)
internal
returns (bytes memory verifiedReportData)
{
verifiedReportData = chainlinkVerifier.verify{ value: fee.amount }(signedReport, abi.encode(fee.assetAddress));
}

the contract using the native ETH as a fee.

The issue here is that the core fillMarketOrder() and fillOffchainOrders() functions internally uses the .verifyReport() function. Neither of these function have the payable modifier, and the contract also doesn't have any receive/fallback() function to pay for the verification cost.

https://github.com/Cyfrin/2024-07-zaros/blob/d687fe96bb7ace8652778797052a38763fbcbb1b/src/perpetuals/branches/SettlementBranch.sol#L107

https://github.com/Cyfrin/2024-07-zaros/blob/d687fe96bb7ace8652778797052a38763fbcbb1b/src/perpetuals/branches/SettlementBranch.sol#L186

Due to the insufficient fee balance, the call to the verifier contract reverts, along with the entire order filling txn.

Impact

Users orders cannot be filled further

Tools Used

Manual review

Recommendations

Add a payable modifier to the filMarketOrder() and fillOffchainOrders()

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

No means for the PerpEngine to receive native to pay the Chainlink Verifier in case Chainlinks charges fees to the protocol

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!