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

Standard ERC-721 "name" and "symbol" function error with Cancun EVM #14972

Closed
developer-decuple opened this issue Apr 2, 2024 · 3 comments
Closed
Labels

Comments

@developer-decuple
Copy link

Description:

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.

@Amxx
Copy link

Amxx commented Apr 3, 2024

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.
Capture d’écran du 2024-04-03 22-05-27

An alternative is to set the target to an older version of the EVM (shanghai or earlier)
Capture d’écran du 2024-04-03 22-06-08

@q9f
Copy link

q9f commented Apr 16, 2024

this currently also happens to anyone running geth --dev because it does not have cancun support yet, unfortunately.

@mehtavishwa30
Copy link
Contributor

@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.

@mehtavishwa30 mehtavishwa30 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@Amxx @mehtavishwa30 @q9f @developer-decuple and others