Testing Smart Contracts Gets Smarter
Smart contracts are immutable, verifiable, and autonomous pieces of code that can be deployed and run on blockchains like Ethereum. Duo to the immutability nature of blockchains, no change is possible on a deployed smart contract or transaction. On the other hand, there are millions of dollars carried by smart contrancts in Ethereum blockchain, and hence, a faulty smart contract can lead to a huge monetary loss. Therefore, it is important for smart contract developers to fully test and check the correctness of their code before deploying it to the blockchain. In this paper, we propose a testing mechansim for smart contracts in Solidity language, based on mutation testing. We analyzed a comprehensive list of known bugs in Solidity smart contracts, and designed 10 classes of mutation operators inspired by the real faults. Our experimental results show that our proposed mutation operators can regenerate 10 of 15 famous faulty smart contracts, which have resulted in millions of dollars loss. The results show the effectiveness of our proposed mutation operators in detecting real faults in Solidity smart contracts. We have also extended universal mutator with our mutation operators, so that it can automacially generate mutants for smart contracts written in Solidity.
READ FULL TEXT