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

Flag functions with empty body as unimplemented #1886

Conversation

webthethird
Copy link
Contributor

@webthethird webthethird commented May 3, 2023

Flag functions with empty body as unimplemented, unless one or more modifiers are present.

Previously, any function with an empty body, e.g., function hasArgs(uint, uint) public {}, would be marked as implemented, with a CFG that contains a single ENTRY_POINT node and nothing else. This PR leaves the ENTRY_POINT node there, but doesn't set function.is_implemented = True unless the function body contains statements (with the exception of empty functions providing access to a modifier, and special functions fallback/receive/constructor).

Some test files expected these empty functions to be marked implemented, so the test contracts have been tweaked to contain one dummy statement, i.e., uint i = 1;.

@webthethird webthethird marked this pull request as ready for review May 4, 2023 17:24
@montyly
Copy link
Member

montyly commented May 5, 2023

What is the reason for this change? I think empty function and unimplemented function are two different concepts

@0xalpharush
Copy link
Contributor

0xalpharush commented May 5, 2023

@montyly For #1880, we weren't sure whether function hasArgs(uint, uint) public {} returns(uint x) should generate a RETURN node but it currently has an ENTRY_POINT node. Should we leave is_implemented alone and go ahead and generate a RETURN node?

@montyly
Copy link
Member

montyly commented May 15, 2023

yes I think generating a return node would be cleaner. However if we do so, we should add the information that the node was not explicit in Solidity, as this information can be useful for further analyses

@webthethird
Copy link
Contributor Author

yes I think generating a return node would be cleaner.

In that case, we can just close this PR and continue this discussion on #1880

@webthethird webthethird deleted the dev-empty-function-body-unimplemented branch May 19, 2023 18:51
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.

4 participants