EVM – Difference Between STOP and INVALID Opcode

evminvalid-opcoderevert-opcode

STOP halts execution and according to this mentions INVALID is used as an abort. Is the difference between these opcodes purely semantical?

Best Answer

STOP is a valid stop to the contract. State changes are kept and unsued gas is refunded.

INVALID will throw the transaction, its state changes and cause the consumption of all gas sent with it.

As of Solidity 0.4.10 there is now a revert() call which enacts the REVERT opcode introduced in EIP140. This opcode, halts the contract, throws state changes but refunds unused gas.