* Move algorithm into ManticoreEVM * Rm buggy unused line * Initial eth testing setup * Check for overflow in mul also * clarifying comment * Install solc for travis * Add sudo * x * Rm travis_retry, since we rarely actually use it, and it's not available in this script for some reason * Check for specific findings * Fix test * Clean up transaction firing logic * Use less strict check, better for floating point
23 lines
829 B
Python
23 lines
829 B
Python
import unittest
|
|
import os
|
|
|
|
from manticore.seth import ManticoreEVM, IntegerOverflow
|
|
|
|
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
# FIXME(mark): Remove these two lines when logging works for ManticoreEVM
|
|
from manticore.utils.log import init_logging
|
|
init_logging()
|
|
|
|
class EthDetectors(unittest.TestCase):
|
|
def test_int_ovf(self):
|
|
mevm = ManticoreEVM()
|
|
mevm.register_detector(IntegerOverflow())
|
|
filename = os.path.join(THIS_DIR, 'binaries/int_overflow.sol')
|
|
mevm.multi_tx_analysis(filename)
|
|
self.assertEqual(len(mevm.global_findings), 3)
|
|
all_findings = ''.join(map(lambda x: x[2], mevm.global_findings))
|
|
self.assertIn('underflow at SUB', all_findings)
|
|
self.assertIn('overflow at ADD', all_findings)
|
|
self.assertIn('overflow at MUL', all_findings)
|