4

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.

2

The 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.

  • 1
    Yeah, ability to jump to any jumpdest makes me think like "hey, that doesn't help at all" – Andrey Putilin Dec 21 '17 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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