The TempleGold contract includes functions for estimating and sending cross-chain messages using the LayerZero protocol. These functions involve calculating the gas fees required for cross-chain transactions. The accuracy of these calculations and the consistency of parameters passed between functions are crucial for the successful execution of transactions. This report identifies two issues within this process: inaccurate gas fee estimation and parameter mismatches, both of which can lead to transaction failures and unexpected costs.
As per the detailed Integration checklists -
The
quote
function is responsible for estimating the gas fees required for cross-chain transactions. If this function does not provide an accurate estimate, users may encounter transaction failures or incur higher costs than expected. The fee estimation should be accurate and up-to-date with current gas prices to ensure smooth operation.
The parameters passed to the
quote
function also must exactly match those used in the_lzSend
function. Any mismatch can cause discrepancies between the estimated and actual gas fees, leading to transaction failures. Ensuring consistency in the parameters used for fee estimation and message sending is critical for successful cross-chain communication.
Here's the quote function -
quote
and _lzSend
So, a probable scenario can be -
Alice wants to send tokens cross-chain using the TempleGold contract.
She calls the quote function to get an estimate of the gas fees required.
The quote function returns an underestimated fee due to outdated gas price information.
Alice proceeds with the transaction by calling the send function with the estimated fee.
The actual gas fee required is higher than the estimated fee, causing the transaction to fail.
Users may experience failed transactions if the gas fee is underestimated or parameters do not match. Users may also incur higher fees if the gas fee estimation is inaccurate.
Manual Review
Ensure Accurate Gas Fee Estimation:
Implement rigorous testing and validation of the quote function to ensure it accurately estimates the required gas fees.
Update the gas fee estimation logic to consider real-time gas prices.
Enforce Parameter Matching
Implement checks to ensure that the parameters passed to the quote function match those used in the _lzSend function.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.