crytic / crytic/slither

[Bug]: TMP variables storing results of blockhash function have wrong type

Open
#1,910 2 comments 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:

The `blockhash` function returns a value of type `bytes32`. But the IR generated from a call to `blockhash` stores its result in a Temp variable of type `uint32`.

### Code example to reproduce the issue:
```
contract Test {
function test() external returns(bytes32) {
bytes32 a = blockhash(block.number);
return a;
}
}
```
### Version:

0.9.3

### Relevant log output:

```shell
Function Test.test() (*)
Expression: a = blockhash(uint256)(block.number)
IRs:
TMP_0(uint256) = SOLIDITY_CALL blockhash(uint256)(block.number)
a(bytes32) := TMP_0(uint256)
Expression: a
IRs:
RETURN a
```

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.