Skip to content

fix: thread custom solc path and env through SolcStandardJson#681

Open
cats2101 wants to merge 1 commit intocrytic:masterfrom
cats2101:fix/issue-672-solc-path-standard-json
Open

fix: thread custom solc path and env through SolcStandardJson#681
cats2101 wants to merge 1 commit intocrytic:masterfrom
cats2101:fix/issue-672-solc-path-standard-json

Conversation

@cats2101
Copy link
Copy Markdown

@cats2101 cats2101 commented May 1, 2026

Closes #672.

Summary

SolcStandardJson.compile() captured solc and solc_env kwargs but never forwarded them to run_solc_standard_json. As a result, a custom solc binary path passed via CryticCompile(target=SolcStandardJson(...), solc=...) was silently ignored — the subprocess was always invoked as plain "solc", which under solc-select raises Version 'X.Y.Z' not installed (set by SOLC_VERSION) when the configured version isn't installed for the wrapper.

This PR threads the captured solc (binary) and solc_env (extra environment) values from compile() through to run_solc_standard_json(), mirroring how Solc.compile() already uses them.

Changes

  • run_solc_standard_json() accepts new solc and solc_env kwargs (default to current behavior, so existing callers — including compile_with_filenames in the same file — keep working).
  • SolcStandardJson.compile() passes through both values.
  • New unit tests (tests/test_solc_standard_json.py) mock subprocess.Popen to assert the executable and environment merge.

Test plan

  • pytest tests/test_solc_standard_json.py -v — 3 new tests pass
  • pytest tests/test_zip_archive.py -v — existing tests still pass
  • ruff check crytic_compile/ tests/
  • ruff format --check
  • ty check crytic_compile/

SolcStandardJson.compile() captured `solc` and `solc_env` kwargs but
never forwarded them to run_solc_standard_json, so a custom solc binary
path passed via CryticCompile(solc=...) was silently ignored — the
subprocess was always invoked as plain "solc".

Add `solc` and `solc_env` kwargs to run_solc_standard_json (defaulting
to the previous behavior) and pass them through from compile(). Closes crytic#672.
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 this pull request may close these issues.

Unable to specify custom solc path when using SolcStandardJson

1 participant