Hard fork can change existing contract behavior. One of the point can be raised about adding new opcodes is that it modifies existing unused opcodes from throwing out of gas to another behavior. While we can mostly argue that deploying unused opcode is not of much use so no sane developers would do that, it would be better to just disallow deployment of unused opcodes.
HARD_FORK number, before executing a contract creation
transaction, or adding contract code to the state, do the following
- Iterate over the code bytes one by one.
- If the code byte is a PUSH(n) opcode, skip next n bytes.
- If the code byte is a valid opcode or designated invalid
- Otherwise, throw out-of-gas.
Note that this check is similar to jump destination checks.