Skip to content

fix[lang]: fix missing HexBytes paths #4630

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cyberthirst
Copy link
Collaborator

What I did

How I did it

  • added HexBytes to the type checks

How to verify it

  • added new tests

@cyberthirst
Copy link
Collaborator Author

maybe we should also fix this #4604 in the scope of this PR

Copy link

codecov bot commented May 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.50%. Comparing base (a28370d) to head (0cd6701).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4630      +/-   ##
==========================================
+ Coverage   92.49%   92.50%   +0.01%     
==========================================
  Files         128      128              
  Lines       18528    18529       +1     
  Branches     3213     3213              
==========================================
+ Hits        17138    17141       +3     
+ Misses        945      944       -1     
+ Partials      445      444       -1     

☔ 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.

("0123456789abcdef", 0x0123456789ABCDEF),
],
)
def test_convert_bytes_literal_int(get_contract, val, expected):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we should probably add test cases which would trigger sign extension

@@ -244,6 +244,9 @@ def _literal_decimal(expr, arg_typ, out_typ):
val = decimal.Decimal(int(expr.value, 16))
else:
val = decimal.Decimal(expr.value) # should work for Int, Decimal
# decimal.Decimal() can't be constructed from bytes
# this assert guards against a potential constructor change
assert not isinstance(expr.value, bytes)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert not isinstance(expr.value, bytes)
assert isinstance(expr.value, int)



@pytest.mark.parametrize(
"val,expected",
Copy link
Member

Choose a reason for hiding this comment

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

can we compute expected from val?

@charles-cooper charles-cooper modified the milestones: v0.4.3, v0.4.2 May 23, 2025
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.

missing execution paths for HexBytes
2 participants