Skip to content

Emit codecopy statement to enable Yul decompilation #57

Description

@acuarica

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    • Status
      Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions