You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The standard ERC-721 functions name and symbol intended to return strings throw an "invalid opcode: MCOPY" error when compiling with the Cancun EVM, while working correctly with the Shanghai EVM.
Expected Behavior:
The name and symbol functions should return string values regardless of the target EVM version.
Environment:
Compiler version: ^0.8.20
Target EVM version: Cancun (as specified in compiler settings)
Framework/IDE: Remix
Operating System: (Not relevant to this issue)
Steps to Reproduce:
Use a standard ERC-721 contract with name and symbol functions.
Compile the contract in Remix with the Cancun EVM version selected.
Deploy the contract to a blockchain.
Attempt to call the name or symbol function. This will result in the "invalid opcode: MCOPY" error.
Additional Notes:
The same contract compiles and functions correctly when using the Shanghai EVM version.
This suggests a potential incompatibility between the generated bytecode for Cancun and the expected opcodes by the EVM.
The text was updated successfully, but these errors were encountered:
This looks like you are using version 0.8.25, which sets the target to cancun by default, and uses mcopy, but you try to run the contract on a non-cancun chain (that doesn't support this opcode).
Said otherwize, the issue is not in the compiler itself, but in the fact that you use a recent version of the compiler with an older version of the EVM.
Since you are using Remix, you should make sure that you use Remix VM (Cancun) selected. Note: it doesn't work on my machine, maybe a remix bug.
An alternative is to set the target to an older version of the EVM (shanghai or earlier)
@developer-decuple Thanks for raising this here. Howerver, as described by @Amxx and @q9f in their comments, this is not a bug in the compiler but rather an issue with Remix and Geth.
For further support, consider reporting this to the respective projects.
Description:
The standard ERC-721 functions
name
andsymbol
intended to return strings throw an "invalid opcode: MCOPY" error when compiling with the Cancun EVM, while working correctly with the Shanghai EVM.Expected Behavior:
The
name
and symbolfunctions
should return string values regardless of the target EVM version.Environment:
Compiler version: ^0.8.20
Target EVM version: Cancun (as specified in compiler settings)
Framework/IDE: Remix
Operating System: (Not relevant to this issue)
Steps to Reproduce:
Use a standard ERC-721 contract with name and symbol functions.
Compile the contract in Remix with the Cancun EVM version selected.
Deploy the contract to a blockchain.
Attempt to call the name or symbol function. This will result in the "invalid opcode: MCOPY" error.
Additional Notes:
The same contract compiles and functions correctly when using the Shanghai EVM version.
This suggests a potential incompatibility between the generated bytecode for Cancun and the expected opcodes by the EVM.
The text was updated successfully, but these errors were encountered: