-
Notifications
You must be signed in to change notification settings - Fork 979
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
Support user defined operators #1684
Conversation
Can we add tests? |
tests/test_features.py
Outdated
for ir in add_function_call.all_slithir_operations(): | ||
if isinstance(ir, InternalCall) and ir.function_name == "add": | ||
ok = True | ||
if not ok: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can just do assert ok
tests/test_features.py
Outdated
eq_op = contract_t.get_function_from_full_name("eq_op(Int,Int)") | ||
for ir in eq_op.all_slithir_operations(): | ||
if isinstance(ir, InternalCall) and ir.function_name == "eq": | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you break and make an assertion instead of returning?
Instead of reusing |
self, operator: str, function_name: str, type_name: TypeAliasTopLevel | ||
) -> None: | ||
for tl_function in self.compilation_unit.functions_top_level: | ||
if tl_function.name == function_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should check that the parameters are the correct type otherwise I think it will run into bugs similar to #1625
This isn't working on the prb-math's operators https://github.com/PaulRBerg/prb-math/tree/326dda4d85808f234035fbf68089f4dc44f877ba
There isn't a contract for internal calls to the UDVT operators. This needs to be thought through carefully as the slither/slither/slithir/convert.py Lines 1620 to 1640 in 64b2e0c
|
@smonicas : what is the status of the PR? |
No description provided.