Skip to main content
QUICK REVIEW

[Paper Review] Mutation Testing for Ethereum Smart Contract

Haoran Wu, Xingya Wang|arXiv (Cornell University)|Aug 10, 2019
Advanced Malware Detection TechniquesComputer Science33 references21 citations
TL;DR

This paper proposes a systematic mutation testing framework for Ethereum smart contracts (ESCs) using 15 novel mutation operators targeting keywords, global variables/functions, variables, and error handling. Evaluated on 26 real-world DApps, the approach achieved a 96.01% defect detection rate—significantly outperforming coverage-based methods (55.68%)—demonstrating its effectiveness in uncovering real-world vulnerabilities.

ABSTRACT

Smart contract is a special program that manages digital assets on blockchain. It is difficult to recover the loss if users make transactions through buggy smart contracts, which cannot be directly fixed. Hence, it is important to ensure the correctness of smart contracts before deploying them. This paper proposes a systematic framework to mutation testing for smart contracts on Ethereum, which is currently the most popular open blockchain for deploying and running smart contracts. Fifteen novel mutation operators have been designed for Ethereum Smart Contracts (ESC), in terms of keyword, global variable/function, variable unit, and error handling. An empirical study on 26 smart contracts in four Ethereum DApps has been conducted to evaluate the effectiveness of mutation testing. The experimental results show that our approach can outperform the coverage-based approach on defect detection rate (96.01% vs. 55.68%). The ESC mutation operators are effective to reveal real defects and we found 117 out of 729 real bug reports are related to our operators. These show the great potential of using mutation testing for quality assurance of ESC.

Motivation & Objective

  • To address the critical need for effective testing of Ethereum smart contracts due to their immutability and high financial risk upon defects.
  • To develop a systematic mutation testing framework tailored for Ethereum smart contracts, which are written in domain-specific languages like Solidity.
  • To design and evaluate novel mutation operators that simulate common programming errors in smart contract development.
  • To empirically validate the effectiveness of mutation testing in detecting real-world vulnerabilities in production-level smart contracts.

Proposed method

  • Transformed Ethereum smart contracts into Abstract Syntax Trees (ASTs) to enable precise mutation operations.
  • Designed 15 new mutation operators targeting keywords, global variables/functions, variable units, and error handling mechanisms.
  • Generated mutants by applying operators to the AST, then reconstructed source code from mutated ASTs.
  • Deployed each mutant in an isolated testnet with identical initial state and dependencies to ensure consistent execution conditions.
  • Executed the original test suite on each mutant and recorded mutation scores to evaluate test suite adequacy.
  • Conducted an empirical study on 26 smart contracts from four real-world DApps to assess defect detection capability.

Experimental results

Research questions

  • RQ1Can mutation testing effectively detect real defects in Ethereum smart contracts, as measured by defect detection rate?
  • RQ2How do the proposed mutation operators compare to coverage-based testing in identifying vulnerabilities in smart contracts?
  • RQ3To what extent do the mutation operators reflect actual defects found in real-world smart contract bug reports?
  • RQ4Are the mutation operators semantically meaningful and effective in simulating common programming errors in smart contract development?

Key findings

  • The proposed mutation testing framework achieved a defect detection rate of 96.01%, significantly outperforming the coverage-based approach (55.68%).
  • 117 out of 729 real-world bug reports from Ethereum smart contracts were found to be semantically related to the proposed mutation operators.
  • The mutation operators effectively simulated common programming errors such as incorrect variable handling, improper error management, and logic flaws in control flow.
  • The study confirms that mutation testing is a viable and effective method for evaluating test suite adequacy in Ethereum smart contracts.
  • The results demonstrate that mutation testing can uncover subtle, real-world vulnerabilities that traditional coverage metrics may miss.
  • The framework’s ability to detect 96.01% of defects suggests strong potential for integration into smart contract quality assurance pipelines.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.