I know, the practical reasons behind it is just to add additional security layer.
But why does EVM even need it? Asm doesn't have it and works great.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityThe EVM doesn't need it. Like you said, it's just an additional security layer.
If there's ever a compiler bug where a program counter on the stack can be replaced by an arbitrary value, the JUMPDEST
requirement may or may not protect against potential exploits.
I'm not convinced about its usefulness because if this ever happens, things would have already gone wrong while testing your contract, and you would never have used your code in public. Also, the exploiter can easily see where all the JUMPDEST
's are and may still be able to jump to any arbitrary JUMPDEST
.
Correction @2019-04-06:
The presence of JUMPDEST
's makes it slightly easier to write a decompiler that turns EVM bytecode into Solidity code.