Skip to content

feat[tool]: add venom artifacts into solc_json output#4637

Merged
charles-cooper merged 15 commits intovyperlang:masterfrom
crebsy:master
May 29, 2025
Merged

feat[tool]: add venom artifacts into solc_json output#4637
charles-cooper merged 15 commits intovyperlang:masterfrom
crebsy:master

Conversation

@crebsy
Copy link
Copy Markdown
Contributor

@crebsy crebsy commented May 12, 2025

What I did

I added the venom optimizer keys ['bb', 'bb_runtime', 'cfg', 'cfg_runtime'] into the compiled output when calling compile_json()

How I did it

Adapted the translate map and guarded it with the venom flag

How to verify it

Added tests inside test_compile_json.py

Commit message

this commit adds venom output keys `bb/bb_runtime` and
`cfg/cfg_runtime` into the output artifact when calling
`compile_json()`, adding extra information for downstream tooling to
display.

Description for the changelog

  • compile_json output contains venom optimizer keys ['bb', 'bb_runtime', 'cfg', 'cfg_runtime']

Cute Animal Picture

image

Comment on lines +57 to +60
translate_map.remove("bb")
translate_map.remove("bb_runtime")
translate_map.remove("cfg")
translate_map.remove("cfg_runtime")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style, bit more compact:

Suggested change
translate_map.remove("bb")
translate_map.remove("bb_runtime")
translate_map.remove("cfg")
translate_map.remove("cfg_runtime")
venom_outputs = ("bb", "bb_runtime", "cfg", "cfg_runtime")
for s in venom_outputs:
translate_map.remove(s)


outputs = sorted(list(outputs))
if not input_dict["settings"].get("venom") and not input_dict["settings"].get("experimentalCodegen"):
for key in ["bb", "bb_runtime", "cfg", "cfg_runtime"]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe extract this list to a top level variable

if "source_map_runtime" in data:
evm["sourceMap"] = data["source_map_runtime"]

venom_keys = ("bb", "bb_runtime", "cfg", "cfg_runtime",)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto -- venom_keys could be top level variable

@charles-cooper charles-cooper changed the title feat: add venom keys into the compiled output json feat[tool]: add venom artifacts into solc_json output May 19, 2025
@charles-cooper charles-cooper added this to the v0.4.2 milestone May 20, 2025
@charles-cooper
Copy link
Copy Markdown
Member

this lgtm, @cyberthirst please take a look

@codecov
Copy link
Copy Markdown

codecov bot commented May 26, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.92%. Comparing base (d8a143d) to head (de0a140).
⚠️ Report is 34 commits behind head on master.

Files with missing lines Patch % Lines
vyper/cli/vyper_json.py 77.77% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4637      +/-   ##
==========================================
+ Coverage   92.79%   92.92%   +0.13%     
==========================================
  Files         131      131              
  Lines       18973    18991      +18     
  Branches     3288     3295       +7     
==========================================
+ Hits        17606    17648      +42     
+ Misses        934      905      -29     
- Partials      433      438       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

"search_paths": [],
"outputSelection": {"*": ["ast"]},
"search_paths": ["."],
"outputSelection": {"*": ["ast", "bb", "bb_runtime", "cfg", "cfg_runtime"]},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ast is not tested for

input_dict["settings"].get(alias, False) for alias in ("venom", "experimentalCodegen")
)
if not should_output_venom:
outputs = [k for k in outputs if k not in VENOM_KEYS]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so some venom key was requested, but we silently ignore the request and don't output it. i'd expected that incompatible options would rather raise

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charles-cooper charles-cooper merged commit 76d6a0f into vyperlang:master May 29, 2025
160 of 161 checks passed
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.

3 participants