Acton
TestingMutation testing

Mutation Rules

Reference of all available mutation rules in Acton

This page lists all 49 mutation rules available in Acton, categorized by their type.

Use rule IDs with acton test --mutation-disable-rules <RULE> or [test.mutation].disable-rules inside Acton.toml.

Use mutation levels with acton test --mutation-levels critical,major or [test.mutation].mutation-levels = ["critical", "major"].

Use changed-line filtering with acton test --mutation-diff worktree or [test.mutation].diff = "branch".

For when to use worktree, ref, or branch, see Mutation Testing.

Critical Rules

These rules affect control flow, assertions, storage persistence, and contract upgrade or external-message semantics. Mutations in this category that survive are often indicators of missing tests for security-critical behavior.

RuleDescriptionExplanation
remove_assertRemove assert statementsThis assertion is not covered by tests. This could lead to security vulnerabilities if the condition is not enforced.
remove_throwRemove throw keywordThis exception path is not covered by tests. Missing error handling might leave the contract in an inconsistent state.
remove_storage_save_callRemove save() method callsThis storage save operation is not covered by tests. Without this call, data changes won't be persisted to storage.
remove_set_data_callRemove contract.setData() callsThis storage write is not covered by tests. Without this call, updated state will not be persisted.
remove_accept_external_messageRemove acceptExternalMessage() callsThis external accept path is not covered by tests. Without this call, external message handling semantics may break.
remove_commit_contract_data_and_actionsRemove commitContractDataAndActions() callsThis commit path is not covered by tests. Without this call, state persistence and replay-protection semantics may break.
remove_set_code_postponedRemove contract.setCodePostponed() callsThis upgrade path is not covered by tests. Without this call, code-upgrade semantics may break.
replace_if_condition_with_trueReplace if condition with trueThe conditional logic is not fully covered.
replace_if_condition_with_falseReplace if condition with falseThe conditional logic is not fully covered.
replace_while_condition_with_falseReplace while condition with falseThe loop execution path is not fully covered.
remove_logical_notRemove logical NOT (!)The logical negation is not fully covered.

Arithmetic Rules

These rules mutate arithmetic operations to ensure calculations are verified by tests.

RuleDescription
replace_plus_with_minusReplace + with -
replace_minus_with_plusReplace - with +
replace_multiply_with_divideReplace * with /
replace_divide_with_multiplyReplace / with *
replace_multiply_assign_with_divide_assignReplace *= with /=
replace_divide_assign_with_multiply_assignReplace /= with *=
replace_multiply_assign_with_modulo_assignReplace *= with %=
replace_modulo_assign_with_multiply_assignReplace %= with *=
replace_plus_assign_with_minus_assignReplace += with -=
replace_minus_assign_with_plus_assignReplace -= with +=
remove_unary_minusRemove unary minus (-)

Comparison Rules

These rules mutate comparison operators to check if boundary conditions are tested.

RuleDescription
replace_equal_with_not_equalReplace == with !=
replace_not_equal_with_equalReplace != with ==
replace_less_than_with_less_or_equalReplace < with <=
replace_greater_than_with_greater_or_equalReplace > with >=
replace_less_or_equal_with_less_thanReplace <= with <
replace_greater_or_equal_with_greater_thanReplace >= with >

Boolean & Logical Rules

These rules invert boolean values and logical operators.

RuleDescription
replace_true_with_falseReplace true with false
replace_false_with_trueReplace false with true
replace_logical_and_with_logical_orReplace && with ||
replace_logical_or_with_logical_andReplace || with &&

Bitwise Rules

These rules mutate bitwise operators, compound bitwise assignments, and shifts.

RuleDescription
replace_bitwise_and_with_bitwise_orReplace & with |
replace_bitwise_or_with_bitwise_andReplace | with &
replace_bitwise_and_with_bitwise_xorReplace & with ^
replace_bitwise_or_with_bitwise_xorReplace | with ^
replace_bitwise_xor_with_bitwise_andReplace ^ with &
replace_bitwise_xor_with_bitwise_orReplace ^ with |
replace_bitwise_and_assign_with_bitwise_or_assignReplace &= with |=
replace_bitwise_and_assign_with_bitwise_xor_assignReplace &= with ^=
replace_bitwise_or_assign_with_bitwise_and_assignReplace |= with &=
replace_bitwise_or_assign_with_bitwise_xor_assignReplace |= with ^=
replace_bitwise_xor_assign_with_bitwise_and_assignReplace ^= with &=
replace_bitwise_xor_assign_with_bitwise_or_assignReplace ^= with |=
replace_left_shift_assign_with_right_shift_assignReplace <<= with >>=
replace_right_shift_assign_with_left_shift_assignReplace >>= with <<=
replace_left_shift_with_right_shiftReplace << with >>
replace_right_shift_with_left_shiftReplace >> with <<
remove_bitwise_notRemove bitwise NOT (~)

Last updated on

On this page