EVM Puzzle 2
Puzzle 2 is very similar to Puzzle 1, with the only difference being that this time we need to understand the CALLVALUE opcode.
1 | ############ |
- CALLVALUE : push the
msg.value(in wei) to the stack - CODESIZE: push into the stack the contract’s code size in
bytes - SUB: pop two values from the stack, subscract V1 (position 1 in the stack) from V0 (position 0 in the stack), pushing the result of the operation into the stack.
So, assuming our input value is X, when we execute the JUMP instruction, we jump to the value 10-X. Here, 10 represents the entire code size, and our target value is 6. Therefore, the input value we need is 4.
1 | ? Enter the value to send: 4 |