crytic / crytic-compile

Abstraction layer for smart contract build systems
GNU Affero General Public License v3.0
157 stars 84 forks source link

running `forge test` appears to interfere with artifacts folder and causes KeyError #566

Open elopez opened 4 months ago

elopez commented 4 months ago

See e.g. https://github.com/Killpit/zksync-storage-proofs/actions/runs/10022382386/job/27702087316

          forge --version
          forge build --sizes && forge build --build-info
          forge test -vvv --root packages/zksync-storage-contracts
          cd packages/zksync-storage-contracts && forge build --build-info && crytic-compile . --ignore-compile

Removing the forge test invocation resolves the issue.

Traceback (most recent call last):
  File "/venv/bin/crytic-compile", line 8, in <module>
    sys.exit(main())
  File "/venv/lib/python3.8/site-packages/crytic_compile/__main__.py", line 220, in main
    compilations = compile_all(**vars(args))
  File "/venv/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 722, in compile_all
    compilations.append(CryticCompile(target, **kwargs))
  File "/venv/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 211, in __init__
    self._compile(**kwargs)
  File "/venv/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 633, in _compile
    self._platform.compile(self, **kwargs)
  File "/venv/lib/python3.8/site-packages/crytic_compile/platform/foundry.py", line 86, in compile
    hardhat_like_parsing(crytic_compile, self._target, build_directory, self._target)
  File "/venv/lib/python3.8/site-packages/crytic_compile/platform/hardhat.py", line 72, in hardhat_like_parsing
    targets_json = loaded_json["output"]
KeyError: 'output'