Open
Description
Describe the false alarm that Slither raise and how you know it's inaccurate:
Slither emits a false positive unused-return when taking only some of multiple values from a call to another contract. There are 2 examples with slightly different syntax, because they cause slightly different logs.
Frequency
Occasionally
Code example to reproduce the issue:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
contract One {
Data public constant DATA = Data(address(1));
function one() public view returns (uint256 out) {
(out,) = DATA.data();
}
function two() public view returns (uint256) {
(, uint256 out) = DATA.data();
return out;
}
}
contract Data {
function data() public pure returns (uint256, uint256) {
return (1, 2);
}
}
Version:
0.9.5
Relevant log output:
INFO:Detectors:
One.one() (src/Pass.sol#7-9) ignores return value by (out,None) = DATA.data() (src/Pass.sol#8)
One.two() (src/Pass.sol#11-14) ignores return value by (out) = DATA.data() (src/Pass.sol#12)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return
INFO:Slither:. analyzed (2 contracts with 87 detectors), 2 result(s) found