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

MCOPY not supported #49

Open
SteMak opened this issue Dec 16, 2024 · 0 comments
Open

MCOPY not supported #49

SteMak opened this issue Dec 16, 2024 · 0 comments

Comments

@SteMak
Copy link

SteMak commented Dec 16, 2024

The following contract crashes the tool with NotImplementedError in sfs_generator/ir_block.py at line 503

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

contract MinimalSample {
    function enforceMCopy(uint256[] calldata input) external pure returns (bytes memory encoded) {
        bytes memory data = abi.encode(input);
        encoded = abi.encode(0x16, data, 0x17, data, 0x18);
    }
}

This happens due to the MCOPY opcode processing is not implemented

To resolve this, I suggest to implement the following change

    elif opcode == "EXTCODEHASH":
        _, updated_variables = get_consume_variable(index_variables)
        v1, updated_variables = get_new_variable(updated_variables)
        instr = v1+" = extcodehash("+v1+")"
         
     elif opcode == "MCOPY":
-        raise NotImplementedError
+        v0, updated_variables = get_consume_variable(index_variables)
+        v1, updated_variables = get_consume_variable(updated_variables)
+        v2, updated_variables = get_consume_variable(updated_variables)
+
+        instr = "mcopy("+v0+","+v1+","+v2+")"
+
     else:
         instr = "Error opcodes30: "+opcode
         updated_variables = index_variables
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