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

Function treated as state variable #114

Open
0x19 opened this issue Sep 25, 2023 · 1 comment
Open

Function treated as state variable #114

0x19 opened this issue Sep 25, 2023 · 1 comment
Assignees
Labels
ast Abstract Syntax Tree bug Something isn't working future work Something we should do in the future high priority High Priority Tasks

Comments

@0x19
Copy link
Contributor

0x19 commented Sep 25, 2023

Old versions of solidity contracts use for fallback and receive (sometimes even having revert) following function syntax

function () payable { ... }

Current AST parsing will fail if function like above is reached. It will fail under state variable discovery (which is weird).

So far, only investigating potential solutions. Most likely this will be related to grammar file not supporting functions like that. If that's the case, we'll branch off grammar from solidity externals and start maintaining our own (or just apply patches once we sync external repo).

If it's grammar issue, it's in fact, not issue but no longer supported functionality and therefore we cannot file any bugs.
If it's due to antlr-go, then we need to file bug to antlr or fork it off.

It happens very rarely, only with old contracts.

@0x19 0x19 added bug Something isn't working ast Abstract Syntax Tree labels Sep 25, 2023
@0x19 0x19 self-assigned this Sep 25, 2023
@0x19 0x19 added the high priority High Priority Tasks label Sep 25, 2023
@0x19
Copy link
Contributor Author

0x19 commented Sep 26, 2023

Introduced hack into the #116 to sort this problem out by casting state variable into partial fallback. Problematics with this is that it's a hack, working one to a level as parameters are not parsed properly.

In the future we need to go deep into the antlr4-go and solidity grammar to sort this issue out as our grammar should support not only 0.8 but from the first version to the end.

@0x19 0x19 added the future work Something we should do in the future label Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Abstract Syntax Tree bug Something isn't working future work Something we should do in the future high priority High Priority Tasks
Projects
None yet
Development

No branches or pull requests

1 participant