Closed pdyraga closed 7 months ago
Ran into this as well. The try expression triggers an "unused return value" warning, even though it is assigned to a variable and used. Another reproduction:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
interface Foo {
function foo() external returns (uint);
}
contract Test {
function test(Foo a) external returns (uint y) {
try a.foo() returns (uint x) {
y = x;
} catch {}
}
}
C.test(IC).x (contracts/test.sol#10) is a local variable never initialized
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables
C.test(IC) (contracts/test.sol#9-13) ignores return value by a.foo() (contracts/test.sol#10-12)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return
Got this same issue from using the Openzeppelin ERC721 library contract. It seems odd that slither is reporting errors in my dependencies - is this intentional? Is there any way to configure it to only check the primary sources and not deps?
Got this same issue from using the Openzeppelin ERC721 library contract. It seems odd that slither is reporting errors in my dependencies - is this intentional? Is there any way to configure it to only check the primary sources and not deps?
You can use the filter_paths parameter to filter out openzeppelin contracts. I use json config file, and it's as simple as adding "filter_paths": "openzeppelin" to it.
Got this same issue from using the Openzeppelin ERC721 library contract. It seems odd that slither is reporting errors in my dependencies - is this intentional? Is there any way to configure it to only check the primary sources and not deps?
You can use the filter_paths parameter to filter out openzeppelin contracts. I use json config file, and it's as simple as adding "filter_paths": "openzeppelin" to it.
Yep, I figured that out thanks. Seems like a strange design choice to include dependencies by default though.
seems related or same as https://github.com/crytic/slither/issues/511
Bumping this, we're facing the same issue 👍
Please consider the following code:
Slither says:
This is a pretty standard try-catch block from Solidity.