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

feat: infer LLL IR function return values without metadata #120

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

hedgar2017
Copy link
Collaborator

@hedgar2017 hedgar2017 commented Oct 25, 2024

What ❔

Instead of querying special function metadata returned by vyper, I am trying to do it by analyzing the function LLL IR.

Such LLL IR must contain:

"var_list": [
    "return_buffer",
    "return_pc"
]

If this pattern is present, function has a single return value which is the return data offset.

Why ❔

The metadata seems to partly broken in vyper v0.4.0.

Fixes #119

Checklist

  • PR title corresponds to the body of PR.
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via cargo fmt and checked with cargo clippy.

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 28.20513% with 28 lines in your changes missing coverage. Please review.

Project coverage is 64.18%. Comparing base (6e59f49) to head (2f674f6).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ect/contract/vyper/expression/instruction/label.rs 0.00% 19 Missing ⚠️
src/project/contract/vyper/function.rs 52.63% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #120      +/-   ##
==========================================
- Coverage   64.79%   64.18%   -0.62%     
==========================================
  Files          56       54       -2     
  Lines        4420     4381      -39     
==========================================
- Hits         2864     2812      -52     
- Misses       1556     1569      +13     

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

@charles-cooper
Copy link

might be related -- vyperlang/vyper#4312

@hedgar2017
Copy link
Collaborator Author

@charles-cooper yeah, that's indeed the cause.
But I've switched to checking for the var_list with return_buffer+return_pc, and it seems to be working like a charm!
Do you have any concerns about not using the metadata anymore?

@hedgar2017 hedgar2017 merged commit 11ce60e into main Oct 25, 2024
11 checks passed
@hedgar2017 hedgar2017 deleted the az-fix-snekmate-issue branch October 25, 2024 16:13
@charles-cooper
Copy link

@charles-cooper yeah, that's indeed the cause. But I've switched to checking for the var_list with return_buffer+return_pc, and it seems to be working like a charm! Do you have any concerns about not using the metadata anymore?

It should be fine. The only issue is if you need other info from the metadata.

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.

failed with exit code Some(101):
3 participants