Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top level objects on a file with no contracts cause a KeyError: 'sourceMap' with Foundry #275

Closed
elopez opened this issue Jul 3, 2022 · 0 comments · Fixed by #282
Closed

Comments

@elopez
Copy link
Member

elopez commented Jul 3, 2022

The JSON files generated have no sourceMap in them when there is only top-level objects; it might be related to foundry-rs/foundry#1646

Repo to reproduce: https://github.com/antoncoding/grappa @ 5886d166ee7b356ca1931c00fda63f7d6bc22b70

// SPDX-License-Identifier: MIT
pragma solidity =0.8.13;

uint8 constant UNIT_DECIMALS = 6;
uint256 constant UNIT = 10**UNIT_DECIMALS;
uint256 constant BPS = 10000;
Traceback (most recent call last):
  File "/slither/slither/__main__.py", line 755, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/slither/slither/__main__.py", line 76, in process_all
    compilations = compile_all(target, **vars(args))
  File "/usr/local/lib/python3.10/dist-packages/crytic_compile/crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/usr/local/lib/python3.10/dist-packages/crytic_compile/crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/crytic_compile/crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "/usr/local/lib/python3.10/dist-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 "/slither/slither/__main__.py", line 755, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/slither/slither/__main__.py", line 76, in process_all
    compilations = compile_all(target, **vars(args))
  File "/usr/local/lib/python3.10/dist-packages/crytic_compile/crytic_compile.py", line 637, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/usr/local/lib/python3.10/dist-packages/crytic_compile/crytic_compile.py", line 117, in __init__
    self._compile(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/crytic_compile/crytic_compile.py", line 548, in _compile
    self._platform.compile(self, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/crytic_compile/platform/foundry.py", line 143, in compile
    compilation_unit.srcmaps_init[contract_name] = target_loaded["bytecode"][
KeyError: 'sourceMap'
elenadimitrova added a commit to soundxyz/sound-protocol that referenced this issue Aug 17, 2022
rather than an empty import which triggered issue crytic/crytic-compile#275
elenadimitrova added a commit to soundxyz/sound-protocol that referenced this issue Aug 17, 2022
rather than an empty import which triggered issue crytic/crytic-compile#275
elenadimitrova added a commit to soundxyz/sound-protocol that referenced this issue Aug 17, 2022
rather than an empty import which triggered issue crytic/crytic-compile#275
elenadimitrova added a commit to soundxyz/sound-protocol that referenced this issue Aug 18, 2022
rather than an empty import which triggered issue crytic/crytic-compile#275
elenadimitrova added a commit to soundxyz/sound-protocol that referenced this issue Aug 18, 2022
* Add slither config

* Add slither run in github action

* Switch to the actual interface implementation
rather than an empty import which triggered issue crytic/crytic-compile#275

* Add changeset

* Enable colour on slither output

* Add slither run command in node

* Exclude test contracts from slither analysis

* Add some valid ignores to slither config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant