crytic / rattle

evm binary static analysis
https://www.trailofbits.com/presentations/rattle/
344 stars 41 forks source link

Getting errors for some common contracts #37

Open anduong opened 4 months ago

anduong commented 4 months ago

Context

I pulled the latest code from the master branch My python version is 3.10 MacOS 13.6 (in case if it is related)

Bytecodes (deployed bytecodes) from these contracts:

  1. https://etherscan.io/token/0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d#code
  2. https://etherscan.io/address/0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852#code

Issue

The issue is:

Traceback (most recent call last):
  File "/Users/a/w/a/e/rattle/rattle/rattle-cli.py", line 7, in <module>
    main()
  File "/Users/a/w/a/e/rattle/rattle/rattle/main.py", line 55, in main
    ssa = rattle.Recover(args.input.read(), edges=edges, optimize=args.optimize,
  File "/Users/a/w/a/e/rattle/rattle/rattle/recover.py", line 751, in __init__
    self.internal = InternalRecover(filedata, edges, optimize, split_functions)
  File "/Users/a/w/a/e/rattle/rattle/rattle/recover.py", line 30, in __init__
    self.recover(dispatch)
  File "/Users/a/w/a/e/rattle/rattle/rattle/recover.py", line 93, in recover
    self.identify_blocks(function)
  File "/Users/a/w/a/e/rattle/rattle/rattle/recover.py", line 202, in identify_blocks
    block.set_fallthrough_target(terminator.offset + terminator.insn.size)
  File "/Users/a/w/a/e/rattle/rattle/rattle/ssa.py", line 513, in set_fallthrough_target
    target_block: SSABasicBlock = self.function.blockmap[other]
KeyError: 11241

Seems like it is the same issue with https://github.com/crytic/rattle/issues/21

Request

Can the team please take time look into this? Thanks