Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: low
Invalid

UsdTokenSwapKeeper : The function `checkLog` always revert for valid case

Summary

The contract has the function checkLog to check some condition. We looked for this function could not able to find the loation in current scope files.

May be this is planned to use in the front end application to check before processing further.

if we see the function at the end of it, always revert. I think, event emit is planned in this case.

Vulnerability Details

/// @inheritdoc ILogAutomation
function checkLog(
AutomationLog calldata log,
bytes memory
)
external
view
returns (bool upkeepNeeded, bytes memory performData)
{
// https://docs.chain.link/chainlink-automation/guides/log-trigger
// 0th index is the event signature hash
address caller = bytes32ToAddress(log.topics[1]);
uint128 requestId = uint128(uint256(log.topics[2]));
// load usd token swap storage
UsdTokenSwapKeeperStorage storage self = _getUsdTokenSwapKeeperStorage();
// load requiest for user by id
UsdTokenSwapConfig.SwapRequest memory request =
IMarketMakingEngine(self.marketMakingEngine).getSwapRequest(caller, requestId);
// if request dealine expired revert
if (request.deadline < block.timestamp) {
return (false, new bytes(0));
}
// if keeper asset stream != vault asset revert
// Since the event emitted would be catched by multiple keepers, each with a stream for different asset, only
// the one with the matching asset needs to be able to execute the swap
if (request.assetOut != self.asset) {
return (false, new bytes(0));
}
string[] memory streams = new string[](1);
streams[0] = self.streamId;
// encode perform data
bytes memory extraData = abi.encode(caller, requestId);
@@@ revert StreamsLookup(DATA_STREAMS_FEED_LABEL, streams, DATA_STREAMS_QUERY_LABEL, block.timestamp, extraData);
}

Impact

Revert and halts the contract functionality

Tools Used

Manual review.

Recommendations

Handle the function to return for valid conditon

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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