crytic / crytic/slither

[Bug-Candidate]: Invalid signature returned by `_extract_function_relations()`

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

Description

### Describe the issue:

Trying to get function relations on the contract of the [Fallback ethernaut challenge](https://ethernaut.openzeppelin.com/level/0x9CB391dbcD447E645D6Cb55dE6ca23164130D008) returns a result that contains an invalid function signature: `()`

````
{
"constructor()": {
"impacts": [
"contribute()",
"getContribution()",
"withdraw()",
"()"
],
"is_impacted_by": []
},
...
````
I think slither returns `()` instead of `receive()` for the `receive` function prototype

### Code example to reproduce the issue:

````
contract Fallback {

using SafeMath for uint256;
mapping(address => uint) public contributions;
address payable public owner;

constructor() public {
owner = msg.sender;
contributions[msg.sender] = 1000 * (1 ether);
}

modifier onlyOwner {
require(
msg.sender == owner,
"caller is not the owner"
);
_;
}

function contribute() public payable {
require(msg.value < 0.001 ether);
contributions[msg.sender] += msg.value;
if(contributions[msg.sender] > contributions[owner]) {
owner = msg.sender;
}
}

function getContribution() public view returns (uint) {
return contributions[msg.sender];
}

function withdraw() public onlyOwner {
owner.transfer(address(this).balance);
}

receive() external payable {
require(msg.value > 0 && contributions[msg.sender] > 0);
owner = msg.sender;
}
}
````

### Version:

0.8.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.