Closed sherlock-admin closed 1 year ago
kaysoft
medium
Calls to MultiInvoker.sol#_latest() will throw an error because the third line in the function is marked with syntax error by the linter.
Calls to Calls to MultiInvoker.sol#_latest() will always fail.
https://github.com/sherlock-audit/2023-07-perennial/blob/main/perennial-v2/packages/perennial-extensions/contracts/MultiInvoker.sol#L334
function _latest( IMarket market, address account ) internal view returns (Position memory latestPosition, OracleVersion memory latestVersion) { // load latest settled position and price uint256 latestTimestamp = market.oracle().latest().timestamp(); latestPosition = market.positions(account); latestVersion = OracleVersion(latestPosition.timestamp, market.global().latestPrice, true);//@audit-issue this will error. // scan pending position for any ready-to-be-settled positions Local memory local = market.locals(account); for (uint256 id = local.latestId; id <= local.currentId; id++) { Position memory pendingPosition = market.pendingPositions(account, id); OracleVersion memory oracleVersion = market.oracle().at(pendingPosition.timestamp); IPayoffProvider payoff = market.payoff(); if (address(payoff) != address(0)) oracleVersion.price = payoff.payoff(oracleVersion.price); // if versions are valid, update latest if (latestTimestamp >= pendingPosition.timestamp && oracleVersion.valid) { latestPosition = pendingPosition; latestVersion = oracleVersion; } } }
Manual Review
Implement a fix for the errors in the function.
2 comment(s) were left on this issue during the judging contest.
141345 commented:
m
panprog commented:
invalid because the line is correct
kaysoft
medium
All functions calls to MultiInvoker.sol#_latest() will throw errors and revert.
Summary
Calls to MultiInvoker.sol#_latest() will throw an error because the third line in the function is marked with syntax error by the linter.
Vulnerability Detail
Calls to MultiInvoker.sol#_latest() will throw an error because the third line in the function is marked with syntax error by the linter.
Impact
Calls to Calls to MultiInvoker.sol#_latest() will always fail.
Code Snippet
https://github.com/sherlock-audit/2023-07-perennial/blob/main/perennial-v2/packages/perennial-extensions/contracts/MultiInvoker.sol#L334
Tool used
Manual Review
Recommendation
Implement a fix for the errors in the function.