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

Fix TAC function parameter names #171

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

alkorang
Copy link
Contributor

@alkorang alkorang commented Dec 5, 2024

This pull request fixes the issue that clients/visualizeout.py emits function parameter names different from variable names used in the function body.

For example, here is the decompiled contract.tac of examples/long_running.hex.

function 0x757(0x757arg0x0, 0x757arg0x1) private {
    ...
    0x76b: MSTORE v767(0x0), v757arg0
    ...
    0x7ea: RETURNPRIVATE v757arg1, v7e4_2
    ...
}

Function parameter names in the declaration are 0x757arg0x0, 0x757arg0x1, while they are v757arg0, v757arg1 in the function body.

This was because clients/visualizeout.py called the render_var function for variable definitions and variable uses in the function body, but not for function parameters. This PR fixes the issue by calling render_var for function.formals, too.

function 0x757(v757arg0, v757arg1) private {
    ...
    0x76b: MSTORE v767(0x0), v757arg0
    ...
    0x7ea: RETURNPRIVATE v757arg1, v7e4_2
    ...
}

@sifislag
Copy link
Collaborator

sifislag commented Dec 5, 2024

Thanks!

@sifislag sifislag merged commit 6bb2f2a into nevillegrech:master Dec 5, 2024
3 checks passed
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.

2 participants