def test_mul_overflow0(self): arguments = [1 << 249, self.state.new_symbolic_value(256)] self.state.constrain(operators.ULT(arguments[1], 256)) cond = self.io._unsigned_mul_overflow(self.state, *arguments) check = self.state.can_be_true(cond) self.assertTrue(check)
def test_mul_overflow0(self): arguments = [2 << (8 * 31), self.state.new_symbolic_value(256)] self.state.constrain(operators.ULT(arguments[1], 256)) result = arguments[0] * arguments[1] check = self.io._can_mul_overflow(self.state, result, *arguments) self.assertTrue(check)
def test_mul_no_overflow(self): """ Regression test added for issue 714, where we were using the ADD ovf check for MUL """ arguments = [1 << 248, self.state.new_symbolic_value(256)] self.state.constrain(operators.ULT(arguments[1], 256)) cond = self.io._unsigned_mul_overflow(self.state, *arguments) check = self.state.can_be_true(cond) self.assertFalse(check)
def test_mul_no_overflow(self): """ Regression test added for issue 714, where we were using the ADD ovf check for MUL """ arguments = [1 << (8 * 31), self.state.new_symbolic_value(256)] self.state.constrain(operators.ULT(arguments[1], 256)) # TODO(mark) We should actually call into the EVM cpu here, and below, rather than # effectively copy pasting what the MUL does result = arguments[0] * arguments[1] check = self.io._can_mul_overflow(self.state, result, *arguments) self.assertFalse(check)