Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Emit codecopy statement to enable Yul decompilation #57

@acuarica

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

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