Docs
TestingMutation testing

Mutation rules

Reference of all available mutation rules in Acton

Acton ships 49 built-in mutation rules, categorized by their type. Use rule IDs with acton test --mutation-disable-rules <RULE> or [test.mutation].disable-rules inside Acton.toml.

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 and 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