crytic / rattle

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

Fails to work for the 0x v2 `Exchange` contract #21

Open ghost opened 5 years ago

ghost commented 5 years ago
➜  rattle git:(master) ✗ python3 rattle-cli.py --input ../code.bytecode -O
Traceback (most recent call last):
  File "rattle-cli.py", line 203, in <module>
    main()
  File "rattle-cli.py", line 48, in main
    ssa = rattle.Recover(args.input.read(), edges=edges, optimize=args.optimize)
  File "/Users/___/Projects/Ethereum/rattle/rattle/recover.py", line 712, in __init__
    self.internal = InternalRecover(filedata, edges, optimize)
  File "/Users/___/Projects/Ethereum/rattle/rattle/recover.py", line 41, in __init__
    self.recover(dispatch)
  File "/Users/___/Projects/Ethereum/rattle/rattle/recover.py", line 75, in recover
    self.identify_blocks(function)
  File "/Users/___/Projects/Ethereum/rattle/rattle/recover.py", line 185, in identify_blocks
    block.set_fallthrough_target(terminator.offset + terminator.insn.size)
  File "/Users/___/Projects/Ethereum/rattle/rattle/ssa.py", line 478, in set_fallthrough_target
    target_block : SSABasicBlock = self.function.blockmap[other]
KeyError: 22707

code.bytecode created with cat code.bin | xxd -r -ps > code.bytecode whereas code.bin is https://gist.github.com/reverendus/9151b4d7b154b63fd55ae663fa6465a4. I'm on the recent master i.e. 2ec580f6963ee876b90326576bc328cca0d03c79.

ireneGP commented 5 years ago

I wonder if this tool is being supported?

dguido commented 5 years ago

@ireneGP This project is supported, but some of these problems are difficult to fix. Today, it works for most people's use cases but every now and then we'll run across a contract where it has issues. We're planning to spend time adding more comprehensive tests and support to it soon. You're welcome to join us on Slack to discuss development of Rattle.

lsankar4033 commented 4 years ago

I assume the tool isnt' being maintained actively anymore? Similar to the original issue poster, I have a contract that rattle isn't working for, but if you guys aren't working on it anymore, I can dig in myself.

And if there's still a discussion slack, where is it?

dguido commented 4 years ago

Hey @lsankar4033, we're still supporting rattle and will help debug and address any issues you can find. Please file an issue that includes the contract you ran rattle on and the error details. We'll take a look. The Slack is accessible at https://empireslacking.herokuapp.com in the #ethereum channel.

Another related tool you should be aware of from us is evm_cfg_builder. If you want to discuss your use case with us in the #ethereum channel on our Slack, then we'll be able to recommend the best approach for accomplishing it.

lsankar4033 commented 4 years ago

cool, will do! thanks for the quick reply

CarstenNZ commented 2 years ago

@lsankar4033 The link to byte.code is broken. Please make it available if you are still interested.