crytic / crytic/crytic-compile
[Bug-Candidate]: Files with no bytecode cause crytic-compile to error out
- Dominant language
- Python
- Stars
- 197
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the issue:
If any project files do not contain bytecode it causes slither to freak out.
### Code example to reproduce the issue:
```javascript
/*
* SPDX-License-Identifier: BSD 3-Clause License
*
* Copyright (C) 2022 Berachain Foundation
*
* Use of this software is govered by the BSD 3-Clause License included
* in the LICENSE file of this repository.
*/
pragma solidity ^0.8.15;
import { Accounts } from '@types/account/Accounts.sol';
import { BerachainContracts } from '@src/storage/types/BerachainContracts.sol';
import { BerachainParams } from '@src/storage/types/BerachainParams.sol';
/// @title BerachainDB
/// @author Dev Bear -
/// @param ad all account info per wallet/address.
/// @param contracts all contract address.
/// @param params all other params.
struct BerachainDB {
Accounts ad;
BerachainContracts contracts;
BerachainParams params;
}
```
```javascript
/*
* SPDX-License-Identifier: BSD 3-Clause License
*
* Copyright (C) 2022 Berachain Foundation
*
* Use of this software is govered by the BSD 3-Clause License included
* in the LICENSE file of this repository.
*/
pragma solidity ^0.8.15;
type Validator is address;
```
### Version:
0.8.3
### Relevant log output:
```shell
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 744, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 76, in process_all
compilations = compile_all(target, **vars(args))
File "/opt/homebrew/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/opt/homebrew/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/crytic_compile/platform/foundry.py", line 143, in compile
compilation_unit.srcmaps_init[contract_name] = target_loaded["bytecode"][
KeyError: 'sourceMap'
None
Error in .
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 744, in main_impl
) = process_all(filename, args, detector_classes, printer_classes)
File "/opt/homebrew/lib/python3.9/site-packages/slither/__main__.py", line 76, in process_all
compilations = compile_all(target, **vars(args))
File "/opt/homebrew/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 637, in compile_all
compilations.append(CryticCompile(target, **kwargs))
File "/opt/homebrew/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 117, in __init__
self._compile(**kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/crytic_compile/crytic_compile.py", line 548, in _compile
self._platform.compile(self, **kwargs)
File "/opt/homebrew/lib/python3.9/site-packages/crytic_compile/platform/foundry.py", line 143, in compile
compilation_unit.srcmaps_init[contract_name] = target_loaded["bytecode"][
KeyError: 'sourceMap'
```
Contributor guide
Assessment
This issue has not been assessed yet.