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

Emit codecopy statement to enable Yul decompilation #57

Open
acuarica opened this issue Dec 26, 2023 · 0 comments
Open

Emit codecopy statement to enable Yul decompilation #57

acuarica opened this issue Dec 26, 2023 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@acuarica
Copy link
Owner

Currently, copy instructions, i.e., CALLDATACOPY, CODECOPY, EXTCODECOPY and RETURNDATACOPY, do not emit State.stmts. These instructions, and in particular CODECOPY, need to be emitted to support Yul decompilation:

For the EVM, the datacopy function is equivalent to codecopy.[1]

See for instance the ERC-20 Yul example[2]

    code {
        // Store the creator in slot zero.
        sstore(0, caller())

        // Deploy the contract
        datacopy(0, dataoffset("runtime"), datasize("runtime"))
        return(0, datasize("runtime"))
    }

[1] https://docs.soliditylang.org/en/latest/yul.html#datasize-dataoffset-datacopy
[2] https://docs.soliditylang.org/en/latest/yul.html#complete-erc20-example

@acuarica acuarica added this to the Stage 3 milestone Jan 18, 2024
@acuarica acuarica added the bug Something isn't working label Jan 18, 2024
@acuarica acuarica modified the milestones: Stage 3, Stage 2 Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

1 participant