4

Solidity v0.4.10 introduced the revert() and require() functions, along with support for the REVERT opcode. As far as I can tell, this means that any contract compiled using ^0.4.10 will express different behavior on throw after metropolis.

Background:

According to the Solidity Exceptions documentation:

user-provided exception is generated in the following situations:

  1. Calling throw.
  2. Calling require with an argument that evaluates to false.

and

Internally, Solidity performs a revert operation (instruction 0xfd) when a user-provided exception is thrown.

Conclusion:

So, it seems that recently compiled/deployed contracts will include the 0xfd opcode, which on homestead is just an INVALID operation, but will become REVERT after metropolis.

Question:

Is my conclusion correct?

Are there any cases where the the changed behavior could be problematic?

1 Answer 1

2

Yes, this is correct, per this conversation.

All undefined instructions behave the same way as INVALID. And yes, the behavior of 0xfd changes at Metropolis, but before or after Metropolis, 0xfd always throws. The difference is whether some output is made available for the caller... and, also that the remainder of gas is refunded.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.