Skip to content

Instantly share code, notes, and snippets.

@veox
Created December 9, 2017 13:17
Show Gist options
  • Select an option

  • Save veox/5dcd70fc8486640237c233f7cbf15671 to your computer and use it in GitHub Desktop.

Select an option

Save veox/5dcd70fc8486640237c233f7cbf15671 to your computer and use it in GitHub Desktop.
Greeter.lll annotated disassembly
60138061007560403961133755605b8061001a6000396000f30063a413686260e060020a600035041415601a57600435611337555b63cfae321760e060020a600035041415603a576113375460005260206000f35b63ef690cc060e060020a600035041415605a576113375460005260206000f35b48656c6c6f2c206c6f76656c79212e2e203c33
; ==============================================================================
000000: PUSH1 0x13 ; (to-hex 19) - initial-greeting length (+terminator?..)
000002: DUP1
000003: PUSH2 0x0075 ; ??? push location of initial-greeting during deployment
000006: PUSH1 0x40 ; the 0x40 specified in `(lit 0x40 <bla>)`
000008: CODECOPY
000009: PUSH2 0x1337 ; storage location of greeting during runtime
000012: SSTORE ; OOPS! Possibly storing wrong thing: _length_ of initial-greeting
000013: PUSH1 0x5b ; ??? push runtime-code-length
000015: DUP1
000016: PUSH2 0x001a ; (to-hex 0) (to-hex 26)
000019: PUSH1 0x00
000021: CODECOPY
000022: PUSH1 0x00
000024: RETURN
000025: STOP ; end of deployment code! total length: 26
; vvv location 0 in runtime code
000026: PUSH4 0xa4136862 ; signature: `setGreeting(string)`
000031: PUSH1 0xe0
000033: PUSH1 0x02
000035: EXP
000036: PUSH1 0x00
000038: CALLDATALOAD
000039: DIV
000040: EQ
000041: ISZERO
000042: PUSH1 0x1a ; (to-hex 26)
000044: JUMPI
000045: PUSH1 0x04
000047: CALLDATALOAD
000048: PUSH2 0x1337
000051: SSTORE
; UH-OH! execution doesn't stop!
; vvv location 000026 (0x1a) in runtime code
000052: JUMPDEST
000053: PUSH4 0xcfae3217 ; signature: `greet()`
000058: PUSH1 0xe0
000060: PUSH1 0x02
000062: EXP ; (exp 2 224)
000063: PUSH1 0x00
000065: CALLDATALOAD
000066: DIV
000067: EQ
000068: ISZERO
000069: PUSH1 0x3a ; (to-hex 58)
000071: JUMPI
000072: PUSH2 0x1337
000075: SLOAD
000076: PUSH1 0x00
000078: MSTORE
000079: PUSH1 0x20
000081: PUSH1 0x00
000083: RETURN
; vvv location 000058 (0x3a) in runtime code
000084: JUMPDEST
000085: PUSH4 0xef690cc0 ; signature: `greeting()`
000090: PUSH1 0xe0
000092: PUSH1 0x02
000094: EXP ; (exp 2 224)
000095: PUSH1 0x00
000097: CALLDATALOAD
000098: DIV
000099: EQ
000100: ISZERO
000101: PUSH1 0x5a ; (to-hex 90)
000103: JUMPI
000104: PUSH2 0x1337
000107: SLOAD
000108: PUSH1 0x00
000110: MSTORE
000111: PUSH1 0x20
000113: PUSH1 0x00
000115: RETURN
; vvv location 000090 (0x5a) in runtime code
000116: JUMPDEST
; ==============================================================================
000117: 48656c6c6f2c206c6f76656c79212e2e203c33 ; "Hello, lovely!.. <3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment