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

Stack analysis #3

Open
fjl opened this issue Sep 13, 2023 · 0 comments
Open

Stack analysis #3

fjl opened this issue Sep 13, 2023 · 0 comments

Comments

@fjl
Copy link
Owner

fjl commented Sep 13, 2023

There is a general convention to annotate low level EVM programs with stack comments.
It usually looks like this:

    push 10  ; [a]
    push 20  ; [b, a]
    add      ; [sum]
    push 0   ; [addr, sum]
    mstore   ; [] 

Would be nice if the assembler could parse these comments and check if they are correct. The stack effects of opcodes are static and known, so it should be possible to track this.

Verifying the stack correctness of the whole program is a non-goal. Instead, we should go for the best effort thing and only validate that continuous runs of comments are correct. The analysis could just give up when a jumpdest or the end of the current document is reached.

Would also be cool to declare/check the stack effect of instruction macros.

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