From 0a938882428839d05552e92db6b53801df3ff78d Mon Sep 17 00:00:00 2001 From: Simone Date: Fri, 31 Jan 2025 14:46:37 +0100 Subject: [PATCH 1/2] Fix array .push and .pop edge cases --- slither/tools/mutator/mutators/AOR.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/slither/tools/mutator/mutators/AOR.py b/slither/tools/mutator/mutators/AOR.py index f86e7d3d4..1f069fb0a 100644 --- a/slither/tools/mutator/mutators/AOR.py +++ b/slither/tools/mutator/mutators/AOR.py @@ -2,12 +2,9 @@ from slither.slithir.operations import Binary, BinaryType from slither.tools.mutator.utils.patch import create_patch_with_line from slither.tools.mutator.mutators.abstract_mutator import AbstractMutator -from slither.core.variables.variable import Variable from slither.core.expressions.unary_operation import UnaryOperation from slither.core.expressions.call_expression import CallExpression from slither.core.expressions.member_access import MemberAccess -from slither.core.expressions.identifier import Identifier -from slither.core.solidity_types.array_type import ArrayType arithmetic_operators = [ BinaryType.ADDITION, @@ -42,9 +39,6 @@ def _mutate(self) -> Dict: isinstance(ir_expression, CallExpression) and isinstance(ir_expression.called, MemberAccess) and ir_expression.called.member_name == "pop" - and isinstance(ir_expression.called.expression, Identifier) - and isinstance(ir_expression.called.expression.value, Variable) - and isinstance(ir_expression.called.expression.value.type, ArrayType) ): continue @@ -58,9 +52,6 @@ def _mutate(self) -> Dict: if isinstance(ir_expression, CallExpression) and isinstance(ir_expression.called, MemberAccess) and ir_expression.called.member_name == "push" - and isinstance(ir_expression.called.expression, Identifier) - and isinstance(ir_expression.called.expression.value, Variable) - and isinstance(ir_expression.called.expression.value.type, ArrayType) else node.irs ) From c61d06b21bae564b5365a8439e0a450796887cc5 Mon Sep 17 00:00:00 2001 From: Simone Date: Fri, 31 Jan 2025 14:47:13 +0100 Subject: [PATCH 2/2] Update CLI --verbose description --- slither/tools/mutator/README.md | 3 +-- slither/tools/mutator/__main__.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/slither/tools/mutator/README.md b/slither/tools/mutator/README.md index aa4d86655..b33c5f4fb 100644 --- a/slither/tools/mutator/README.md +++ b/slither/tools/mutator/README.md @@ -33,8 +33,7 @@ options: --timeout TIMEOUT Set timeout for test command (by default 30 seconds) --output-dir OUTPUT_DIR Name of output directory (by default 'mutation_campaign') - -v, --verbose log mutants that are caught as well as those that are uncaught - -vv, --very-verbose log mutants that are caught, uncaught, and fail to compile. And more! + -v, --verbose log mutants that are caught, uncaught, and fail to compile --mutators-to-run MUTATORS_TO_RUN mutant generators to run --contract-names CONTRACT_NAMES diff --git a/slither/tools/mutator/__main__.py b/slither/tools/mutator/__main__.py index d97806e28..7c2e660af 100644 --- a/slither/tools/mutator/__main__.py +++ b/slither/tools/mutator/__main__.py @@ -72,7 +72,7 @@ def parse_args() -> argparse.Namespace: parser.add_argument( "-v", "--verbose", - help="log mutants that are caught as well as those that are uncaught", + help="log mutants that are caught, uncaught, and fail to compile", action="store_true", default=False, )