[Ethereum] What does this error “invalid opcode 0xfd” mean

evminvalid-opcode

I found an error message, 'invalid opcode 0xfd'. What does this mean?

I googled, and found just one result here.

Quote: "I the invalid opcode 0xfd is never hit
(Some compilers encode safety properties using 0xfd)"

Best Answer

0xfd is the REVERT opcode as described in the EIP140.

Things to know:

  1. REVERT is intended as a "soft throw" that does not consume all the remaining gas. It can also return some data, which could be useful for debugging and user feedback.

  2. It is not yet implemented by the EVM; it will be implemented by the first Metropolis fork. This is why it is currently reported as "invalid opcode" when the EVM encounters it.

  3. Nonetheless, the Solidity compiler already implements and generates REVERTs via the require() statement. It is recommended to be used for user input validation. Since the opcode is not yet available, it currently acts just like the old throw, but after Metropolis it will implement the new functionality.

Related Topic