[Bug]: Constant folding incorrectly assumes string is a fraction
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the issue:
If we modify `tests/unit/core/test_data/constant_folding/constant_folding_binop.sol` by adding this line:
```
bytes4 SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)")));
```
And we modify `test_constant_folding.py` by adding this code:
```
SELECTOR = contract.get_state_variable_from_name("SELECTOR")
ConstantFolding(SELECTOR.expression, "bytes4").result()
```
The test fails because the call to `ConstantFolding` raises an error.
### Code example to reproduce the issue:
See above.
### Version:
0.9.6
### Relevant log output:
```shell
# Fractions do not support underscore separators (on Python <3.11)
val = val.replace("_", "")
if "e" in val or "E" in val:
> base, expo = val.split("e") if "e" in val else val.split("E")
E ValueError: too many values to unpack (expected 2)
```
Contributor guide
Assessment
This issue has not been assessed yet.