-
CODESIZE (38)
: Pushes the size of the contract's code onto the stack. -
CALLVALUE (34)
: Pushes the value sent with the transaction onto the stack. -
SWAP1 (90)
: Swaps the top two values on the stack. -
GT (11)
: Compares the two values on the stack. Pushes1
ifCALLVALUE
is less thanCODESIZE
, otherwise0
. -
PUSH1 08 (6008)
,JUMPI (57)
: Jumps to byte08
ifCALLVALUE
is less thanCODESIZE
. -
REVERT (FD)
: Reverts the execution if the condition is not met. -
JUMPDEST (5B)
at08
: Marks a valid jump destination. -
CALLDATASIZE (36)
: Pushes the size of the calldata onto the stack. -
PUSH2 0003 (610003)
,SWAP1 (90)
,MOD (06)
: CalculatesCALLDATASIZE % 3
. -
ISZERO (15)
: Checks if the modulus result is zero. -
CALLVALUE (34)
,PUSH1 0A (600A)
,ADD (01)
: Adds10
toCALLVALUE
. -
JUMPI (57)
: Jumps to byte19
if the previous result is zero. -
REVERT (FD)
: Reverts the execution if the jump is not made. -
JUMPDEST (5B)
at19
,STOP (00)
: Marks another jump destination and stops execution.
To successfully reach the STOP
instruction without reverting, the following conditions must be met:
CALLVALUE
must be less than or equal to27
(theCODESIZE
).CALLDATASIZE
must be a multiple of3
.CALLVALUE + 10
must be equal to25
to make the finalJUMPI
instruction jump to theJUMPDEST
at byte19
.
To meet these requirements:
- CALLVALUE: Must be
15
(since15 + 10 = 25
). - CALLDATASIZE: Must be a multiple of
3
.
A possible solution is:
- CALLVALUE:
15
(in decimal) or0F
(in hex). - CALLDATA: Any data with a size that is a multiple of
3
, such as0xFFFFFF
.
This setup ensures the bytecode execution successfully reaches the STOP
opcode at byte 1A
without triggering any REVERT
.