Summary
quote
function doesn't follow specification of LayerZero
Vulnerability Details
LayerZero's specification of quote
function
* @return nativeFee Estimated gas fee in native gas.
* @return lzTokenFee Estimated gas fee in ZRO token.
*/
function quote(
uint32 _dstEid,
string memory _message,
bytes calldata _options,
bool _payInLzToken
) public view returns (uint256 nativeFee, uint256 lzTokenFee) {
bytes memory _payload = abi.encode(_message);
MessagingFee memory fee = _quote(_dstEid, _payload, _options, _payInLzToken);
return (fee.nativeFee, fee.lzTokenFee);
}
LayerZero Documentation
But the implementation in the TempleTeleporter.sol
is shown below
function quote(
uint32 _dstEid,
bytes memory _message,
bytes memory _options
) external view returns (MessagingFee memory fee) {
return _quote(_dstEid, _message, _options, false);
}
function quote(
uint32 _dstEid,
address _to,
uint256 _amount,
bytes memory _options
) external view returns (MessagingFee memory fee) {
return _quote(_dstEid, abi.encodePacked(_to, _amount), _options, false);
}
Which is different from the recommended specification
Impact
Not following LayerZero
specification for quote
can lead to break cross chain functionality.
Tools Used
Manual review
Recommendations
Follow the specifications for the quote
function as suggested by Layer Zero.