8

I tried decompiling the TheDAO v1 bytecode with disasm and it seems to fail for me. I entered the TheDAO bytecode here and found that the last instruction was

[10836] PUSH16 0xc84ba6bc95484008f6362f93160ef3e5

As you can see the bytecode ends with f3e5 and it seems to ignore the last byte 63. When I remove this last byte from the TheDAO bytecode and try running it through disasm again, it works properly.

Can someone explain what is the purpose of the last byte (63) there?

I am using disasm packaged with ethereum-go in release 1.3.6 This is the error I get when I run theDAO bytecode through disasm

... 10819 CODESIZE 10820 PUSH16 => c84ba6bc95484008f6362f93160ef3e5 10837 PUSH4panic: runtime error: slice bounds out of range
goroutine 1 [running]: panic(0x598e80, 0xc42000c110) /usr/local/go/src/runtime/panic.go:500 +0x1a1 main.main() /root/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/cmd/disasm/main.go:45 +0x43e

and this is the error with the evm disasm v1.6.0 - https://pastebin.com/zx48s5ax

  • Could you describe "seems to fail" in more detail? – Noel Maersk Apr 9 '17 at 13:06
  • In particular, the commands used, and versions. (Also, did you mean evmdis when writing disasm?..) – Noel Maersk Apr 9 '17 at 13:33
  • (disasm is the "official" disassembler in the "Geth and Tools" combined package.) – Richard Horrocks Apr 9 '17 at 19:19
  • @NoelMaersk I updated the question with the error I get and the version of disasm I am using – everconfusedGuy Apr 14 '17 at 8:12
6

The end of the code might be used as "data area", i.e. code that is never executed but might be read. The Solidity optimizer for example has a stage where it looks at all constants (i.e. PUSH instructions) and tries several methods to optimize them. One of them is to move the constant to the end of the code and use CODECOPY to retrieve it. This is especially efficient if the same long constant is used in many places.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.