I am executing a dummy (smart) contract through the evm
command line to understand how input is passed to the contract. I am using the following contract bytecode:
60003500
PUSH1 0x00
CALLDATALOAD
STOP
If I provide 0x101
as input I get the expected result:
>>> evm --code 60003500 --input 101 --debug run
0x
#### TRACE ####
PUSH1 pc=00000000 gas=10000000000 cost=3
CALLDATALOAD pc=00000002 gas=9999999997 cost=3
Stack:
00000000 0x0
STOP pc=00000003 gas=9999999994 cost=0
Stack:
00000000 0x101000000000000000000000000000000000000000000000000000000000000 # AS EXPECTED
Although, if I input 0x001
, the heading zeros seem to be dropped by the evm
(see stack state on last line).
>>> evm --code 60003500 --input 001 --debug run
0x
#### TRACE ####
PUSH1 pc=00000000 gas=10000000000 cost=3
CALLDATALOAD pc=00000002 gas=9999999997 cost=3
Stack:
00000000 0x0
STOP pc=00000003 gas=9999999994 cost=0
Stack:
00000000 0x1000000000000000000000000000000000000000000000000000000000000 # NOT AS EXPECTED
I am using evm version 1.10.17-stable-25c9b49f
. Why does the evm
drops the leading zeros?