Skip to content

Instantly share code, notes, and snippets.

@rocky
Created February 11, 2019 22:12
Show Gist options
  • Save rocky/5bcac50bb66fb37340f6b20280fb219f to your computer and use it in GitHub Desktop.
Save rocky/5bcac50bb66fb37340f6b20280fb219f to your computer and use it in GitHub Desktop.
Constructed versus deployed EVM bytecode
$ evm-dasm -l short -c "0x738af6a7af30d840ba137e8f3f34d54cfb8beba6e230146080604052600436106050576000357c01000000000000000000000000000000000000000000000000000000009004806396e4ee3d146055575b600080fd5b608860048036036040811015606957600080fd5b810190808035906020019092919080359060200190929190505050609e565b6040518082815260200191505060405180910390f35b600081830290509291505056fea165627a7a723058202be5020944431115fd11565bc533b62243271e3e94c4fd7f1fcbcc25af1121ed0029"
Invalid opcode at position 362, opcode=0x2b
PUSH20 8af6a7af30d840ba137e8f3f34d54cfb8beba6e2
ADDRESS
EQ
PUSH1 80
PUSH1 40
MSTORE
PUSH1 04
CALLDATASIZE
LT
PUSH1 50
JUMPI to 0x50
PUSH1 00
CALLDATALOAD
PUSH29 0100000000000000000000000000000000000000000000000000000000
SWAP1
DIV
DUP1
PUSH4 96e4ee3d
EQ
PUSH1 55
JUMPI to 0x55
JUMPDEST
PUSH1 00
DUP1
REVERT
JUMPDEST
PUSH1 88
PUSH1 04
DUP1
CALLDATASIZE
SUB
PUSH1 40
DUP2
LT
ISZERO
PUSH1 69
JUMPI to 0x69
PUSH1 00
DUP1
REVERT
JUMPDEST
DUP2
ADD
SWAP1
DUP1
DUP1
CALLDATALOAD
SWAP1
PUSH1 20
ADD
SWAP1
SWAP3
SWAP2
SWAP1
DUP1
CALLDATALOAD
SWAP1
PUSH1 20
ADD
SWAP1
SWAP3
SWAP2
SWAP1
POP
POP
POP
PUSH1 9e
JUMP to 0x9e
JUMPDEST
PUSH1 40
MLOAD
DUP1
DUP3
DUP2
MSTORE
PUSH1 20
ADD
SWAP2
POP
POP
PUSH1 40
MLOAD
DUP1
SWAP2
SUB
SWAP1
RETURN
JUMPDEST
PUSH1 00
DUP2
DUP4
MUL
SWAP1
POP
SWAP3
SWAP2
POP
POP
JUMP
INVALID
LOG1 65
PUSH3 7a7a72
ADDRESS
PC
SHA3
$ evm-dasm -l short -c "0x60d761002f600b82828239805160001a6073146000811461001f57610021565bfe5b5030600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106050576000357c01000000000000000000000000000000000000000000000000000000009004806396e4ee3d146055575b600080fd5b608860048036036040811015606957600080fd5b810190808035906020019092919080359060200190929190505050609e565b6040518082815260200191505060405180910390f35b600081830290509291505056fea165627a7a7230582094ca199c801839337331343f733fa7283c9d7f430a20e7ec95933a083287a6d80029"
Invalid opcode at position 458, opcode=0xca
PUSH1 d7
PUSH2 002f
PUSH1 0b
DUP3
DUP3
DUP3
CODECOPY
DUP1
MLOAD
PUSH1 00
BYTE
PUSH1 73
EQ
PUSH1 00
DUP2
EQ
PUSH2 001f
JUMPI to 0x1f
PUSH2 0021
JUMP to 0x21
JUMPDEST
INVALID
JUMPDEST
POP
ADDRESS
PUSH1 00
MSTORE
PUSH1 73
DUP2
MSTORE8 8281f3fe73000000
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
STOP
ADDRESS
EQ
PUSH1 80
PUSH1 40
MSTORE
PUSH1 04
CALLDATASIZE
LT
PUSH1 50
JUMPI to 0x50
PUSH1 00
CALLDATALOAD
PUSH29 0100000000000000000000000000000000000000000000000000000000
SWAP1
DIV
DUP1
PUSH4 96e4ee3d
EQ
PUSH1 55
JUMPI to 0x55
JUMPDEST
PUSH1 00
DUP1
REVERT
JUMPDEST
PUSH1 88
PUSH1 04
DUP1
CALLDATASIZE
SUB
PUSH1 40
DUP2
LT
ISZERO
PUSH1 69
JUMPI to 0x69
PUSH1 00
DUP1
REVERT
JUMPDEST
DUP2
ADD
SWAP1
DUP1
DUP1
CALLDATALOAD
SWAP1
PUSH1 20
ADD
SWAP1
SWAP3
SWAP2
SWAP1
DUP1
CALLDATALOAD
SWAP1
PUSH1 20
ADD
SWAP1
SWAP3
SWAP2
SWAP1
POP
POP
POP
PUSH1 9e
JUMP to 0x9e
JUMPDEST
PUSH1 40
MLOAD
DUP1
DUP3
DUP2
MSTORE
PUSH1 20
ADD
SWAP2
POP
POP
PUSH1 40
MLOAD
DUP1
SWAP2
SUB
SWAP1
RETURN
JUMPDEST
PUSH1 00
DUP2
DUP4
MUL
SWAP1
POP
SWAP3
SWAP2
POP
POP
JUMP
INVALID
LOG1 65
PUSH3 7a7a72
ADDRESS
PC
SHA3
SWAP5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment