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

Warn for overloaded functions with similar types in strict mode #3562

Open
reedsa opened this issue Dec 17, 2024 · 0 comments
Open

Warn for overloaded functions with similar types in strict mode #3562

reedsa opened this issue Dec 17, 2024 · 0 comments

Comments

@reedsa
Copy link
Contributor

reedsa commented Dec 17, 2024

What feature should we add?

Overloaded functions with the same number of arguments may have overlapping argument types. This can cause confusion about valid arguments and could inadvertently cause problems when calling a function. Using the syntax for calling a function from Contract.functions.myFunction can be opaque in how it behaves when there are two functions in the contract for myFunction(bytes) and myFunction(bytes32).

Someone may want to call myFunction(bytes32) but accidently pass a 33 byte argument to the function instead of 32 bytes. web3.py would use myFunction(bytes) without the user being explicit by using get_function_by_identifier() or bracket notation, i.e. Contract.functions["myFunction(bytes32)"].

To make this more apparent to the user, the code should warn when calling a function that has the same number of arguments and similar types. Before the warning, also determine how this should be implemented such that functions will not warn when arguments are of varying types like string and bytes, etc.

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

No branches or pull requests

1 participant