def _test(self, name, should_find, use_ctor_sym_arg=False): """ Tests DetectInvalid over the consensys benchmark suite """ mevm = self.mevm mevm.register_detector(DetectInvalid()) mevm.register_detector(DetectIntegerOverflow()) mevm.register_detector(DetectReentrancyAdvanced()) filename = os.path.join(THIS_DIR, "contracts", "consensys_benchmark", f"{name}.sol") if use_ctor_sym_arg: ctor_arg = (mevm.make_symbolic_value(), ) else: ctor_arg = () mevm.multi_tx_analysis(filename, contract_name="Benchmark", args=ctor_arg) mevm.finalize() expected_findings = set(((c, d) for b, c, d in should_find)) actual_findings = set(((c, d) for a, b, c, d in mevm.global_findings)) self.assertEqual(expected_findings, actual_findings)
def _test_assert(self, name, should_find): """ Tests DetectInvalid over the consensys benchmark suit """ mevm = self.mevm d = DetectInvalid() mevm.register_detector(d) filename = os.path.join(THIS_DIR, 'binaries', 'benchmark', '{}.sol'.format(name)) mevm.multi_tx_analysis(filename, tx_limit=3) actual_findings = set(((b, c, d) for a, b, c, d in d.global_findings)) self.assertEqual(should_find, actual_findings)
def _test(self, name, should_find): """ Tests DetectInvalid over the consensys benchmark suit """ mevm = self.mevm mevm.register_detector(DetectInvalid()) mevm.register_detector(DetectIntegerOverflow()) filename = os.path.join(THIS_DIR, 'binaries', 'benchmark', '{}.sol'.format(name)) mevm.multi_tx_analysis(filename, tx_limit=3) expected_findings = set(( (c, d) for b, c, d in should_find)) actual_findings = set(( (c, d) for a, b, c, d in mevm.global_findings)) self.assertEqual(expected_findings, actual_findings)
def _test(self, name, should_find): """ Tests DetectInvalid over the consensys benchmark suite """ mevm = self.mevm mevm.register_detector(DetectInvalid()) mevm.register_detector(DetectIntegerOverflow()) mevm.register_detector(DetectReentrancyAdvanced()) filename = os.path.join(THIS_DIR, 'binaries', 'benchmark', '{}.sol'.format(name)) mevm.multi_tx_analysis(filename, contract_name='Benchmark', args=(mevm.make_symbolic_value(), )) expected_findings = set(((c, d) for b, c, d in should_find)) actual_findings = set(((c, d) for a, b, c, d in mevm.global_findings)) self.assertEqual(expected_findings, actual_findings)