✅Puzzle 5
MSIZE
Puzzle
Solution
Chunk 1
The calldata must be longer than 0x20 = 32
bytes.
Chunk 2
Pseudocode:
MSIZE
gets the size of active memory in bytes. More importantly, from evm.codes:
The memory is always fully accessible. What this instruction tracks is the highest offset that was accessed in the current execution. A first write or read to a bigger offset will trigger a memory expansion, which will cost gas. The size is always a multiple of a word (32 bytes).
At address 0x0E
when CALLDATACOPY
is called, our calldata is copied to the memory. If our calldata is longer than 32 bytes but shorter than 64 bytes, then MSIZE
will always return 64. To satisfy memory_size - calldata_size == 0x03
, we can just feed 61 0x00
as calldata. In Python:
Last updated