crytic / crytic/slither

[Bug]: Function not found on IR: TUPLE_414(None) = HIGH_LEVEL_CALL, dest:REF_10910(None), function:delegatecall, arguments:['TMP_26413'

Open
#1,822 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

Ran slither and came across an error suggesting that I report:
```
$ slither .
'forge clean' running (wd: ~/projects/ammalgam/core-v1)
'forge build --build-info --force' running
Compiling 120 files with 0.8.18
Solc 0.8.18 finished in 25.47s
Compiler run successful

Traceback (most recent call last):
File "~/Library/Caches/pypoetry/virtualenvs/core-v1-4GkSk-SE-py3.8/lib/python3.8/site-packages/slither/core/cfg/node.py", line 871, in _find_read_write_call
self._high_level_calls.append((ir.destination.type.type, ir.function))
AttributeError: 'NoneType' object has no attribute 'type'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "~/Library/Caches/pypoetry/virtualenvs/core-v1-4GkSk-SE-py3.8/lib/python3.8/site-packages/slither/__main__.py", ,

...

File "~/Library/Caches/pypoetry/virtualenvs/core-v1-4GkSk-SE-py3.8/lib/python3.8/site-packages/slither/core/cfg/node.py", line 874, in _find_read_write_call
raise SlitherException(
slither.exceptions.SlitherException: Function not found on IR: TUPLE_414(None) = HIGH_LEVEL_CALL, dest:REF_10910(None), function:delegatecall, arguments:['TMP_26413'] .
Node: EXPRESSION (success,message) = delegatedCall.address.delegatecall(abi.encodeWithSelector(delegatedCall.selector,fixture,sender,amountX,amountY,amountL,data)) (test/PairTests/ReentryTests.sol#503-505)
Function: borrowCall
Please try compiling with a recent Solidity version. 'NoneType' object has no attribute 'type'
ERROR:root:Error:
ERROR:root:Function not found on IR: TUPLE_414(None) = HIGH_LEVEL_CALL, dest:REF_10910(None), function:delegatecall, arguments:['TMP_26413'] .
Node: EXPRESSION (success,message) = delegatedCall.address.delegatecall(abi.encodeWithSelector(delegatedCall.selector,fixture,sender,amountX,amountY,amountL,data)) (test/PairTests/ReentryTests.sol#503-505)
Function: borrowCall
Please try compiling with a recent Solidity version. 'NoneType' object has no attribute 'type'
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues
```

### Code example to reproduce the issue:

Code is only used in tests. I don't think the contract dependency types are related to the error, but happy to share if required.

```
contract ReentryDelegatedCall is ICallee {
FactoryPairTestFixture fixture;
function(FactoryPairTestFixture, address, uint256, uint256, uint256, bytes memory) external private delegatedCall;

constructor(
FactoryPairTestFixture _fixture,
function(FactoryPairTestFixture, address, uint256, uint256, uint256, bytes memory) external delegatedCall_
) {
fixture = _fixture;
delegatedCall = delegatedCall_;
}

function swapCall(address sender, uint256 amountX, uint256 amountY, bytes calldata data) external {/* noop */}

function borrowCall(
address sender,
uint256 amountX,
uint256 amountY,
uint256 amountL,
bytes calldata data
) public {
(bool success, bytes memory message) = delegatedCall.address.delegatecall(
abi.encodeWithSelector(delegatedCall.selector, fixture, sender, amountX, amountY, amountL, data)
);
if (!success) {
console2.log('reentry failed');
console2.log('message: ', string(message));
}
}
}
```

### Version:

0.9.3

### Relevant log output:

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.