测试智能合约变得更智能
Testing Smart Contracts Gets Smarter
摘要:
智能合约是不可变的,可验证的,自治的代码片段,可以在以太坊等区块链网络上部署和运行。由于区块链的不变性,已部署的智能合约或已验证的交易不可能发生变化。另一方面,以太坊区块链中的智能合约携带了数百万美元,因此,一个错误的智能合约可能会导致巨大的金钱损失。因此,对于智能合约开发人员来说,在将其部署到区块链上之前,充分测试和检查其代码的正确性非常重要。在本文中,我们提出了一种基于突变测试的Solidity语言智能合约测试机制。我们分析了Solidity智能合约中已知错误的全面列表,并设计了10类受真实错误启发的变异算子。我们的实验结果表明,我们提出的变异算子可以重新生成15个著名的错误智能合约中的10个,这些智能合约导致了数百万美元的损失。结果表明,我们提出的变异算子在检测Solidity智能合约中的实际故障方面是有效的。我们还使用我们的突变操作符扩展了{ \em Universal Mutator }工具,以便它可以自动为Solidity编写的智能合约生成突变体。
英文摘要:
Smart contracts are immutable, verifiable, and autonomous pieces of code that can be deployed and ran on blockchain networks like Ethereum. Due to the immutability nature of blockchain, no change is possible on a deployed smart contract or a verified transaction. On the other hand, there are millions of dollars carried by smart contracts 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 on the blockchain. In this paper, we propose a testing mechanism 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 {\em Universal Mutator } tool with our mutation operators, so that it can automatically generate mutants for smart contracts written in Solidity.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。