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

Analyze code effects or state #2112

Closed
chriseth opened this issue Apr 10, 2017 · 1 comment
Closed

Analyze code effects or state #2112

chriseth opened this issue Apr 10, 2017 · 1 comment
Assignees

Comments

@chriseth
Copy link
Contributor

chriseth commented Apr 10, 2017

The current check for isPure in the type checker should be extended to similar means of access and to AST nodes beyond expressions.

The isPure AST annotation should be extended, so that it is possible to determine:

  • whether the code reads from the state (i.e. is non-pure)
  • whether the code might modify state (i.e. storage, balance, create contracts, etc)

Both of these properties should also take variables and function calls into account. I.e. a statement assigning to a storage variable modifies state, a call to a non-constant function does not modify state, but reads from state.

For now, we assume that passing a storage variable to a constant function can modify storage.

At some point, we also have to determine whether variables declared constant are accessed in a way that makes it possible to modify them. This includes passing constant variables to functions as non-constant non-value parameters or accessing "deep elements" of a variable in such a way, i.e. assigning to an element of a constant array.

Part of #715 and #992

@chriseth
Copy link
Contributor Author

chriseth commented Jul 2, 2018

The ViewPureChecker mostly implements this now.

@chriseth chriseth closed this as completed Jul 2, 2018
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

2 participants