首页 | 本学科首页   官方微博 | 高级检索  
     

基于软件度量的Solidity智能合约缺陷预测方法
引用本文:杨慧文,崔展齐,陈翔,贾明华,郑丽伟,刘建宾.基于软件度量的Solidity智能合约缺陷预测方法[J].软件学报,2022,33(5):1587-1611.
作者姓名:杨慧文  崔展齐  陈翔  贾明华  郑丽伟  刘建宾
作者单位:北京信息科技大学 计算机学院, 北京 100101;北京信息科技大学 计算机学院, 北京 100101;网络文化与数字传播北京市重点实验室(北京信息科技大学), 北京 100101;南通大学 计算机科学与技术学院, 江苏 南通 226019;中央财经大学 信息学院, 北京 100101
基金项目:江苏省前沿引领技术基础研究专项(BK202002001);国家自然科学基金项目(No. 61702041);北京信息科技大学“勤信人才”培育计划项目(No. QXTCP C201906)
摘    要:随着区块链技术的兴起,智能合约安全问题被越来越多的研究者和企业重视,目前已有一些针对智能合约缺陷检测技术的研究.软件缺陷预测技术是软件缺陷检测技术的有效补充,能够优化测试资源分配,提高软件测试效率.然而,目前还没有针对智能合约的软件缺陷预测研究.针对这一问题,提出了面向Solidity智能合约的缺陷预测方法.首先,设计了一组针对Solidity智能合约特有的变量、函数、结构和Solidity语言特性的度量元集(smart contract-Solidity, SC-Sol度量元集),并将其与重点考虑面向对象特征的度量元集(code complexity and features of object-oriented program, COOP度量元集)组合为COOP-SC-Sol度量元集.然后,从Solidity智能合约代码中提取相关度量元信息,并结合缺陷检测结果,构建Solidity智能合约缺陷数据集.在此基础上,应用了7种回归模型和6种分类模型进行Solidity智能合约的缺陷预测,以验证不同度量元集和不同模型在缺陷数量和倾向性预测上的性能差异.实验结果表明,相对于COOP度量元集...

关 键 词:软件缺陷预测  缺陷数量预测  缺陷倾向性预测  智能合约  Solidity
收稿时间:2021/8/8 0:00:00
修稿时间:2021/10/9 0:00:00

Defect Prediction for Solidity Smart Contracts Based on Software Measurement
YANG Hui-Wen,CUI Zhan-Qi,CHEN Xiang,JIA Ming-Hu,ZHENG Li-Wei,LIU Jian-Bin.Defect Prediction for Solidity Smart Contracts Based on Software Measurement[J].Journal of Software,2022,33(5):1587-1611.
Authors:YANG Hui-Wen  CUI Zhan-Qi  CHEN Xiang  JIA Ming-Hu  ZHENG Li-Wei  LIU Jian-Bin
Affiliation:School of Computer, Beijing Information Science and Technology University, Beijing 100101, China;School of Computer, Beijing Information Science and Technology University, Beijing 100101, China;Beijing Key Laboratory of Internet Culture and Digital Dissemination Research (Beijing Information Science and Technology University), Beijing 100101, China;School of Computer Science and Technology, Nantong University, Nantong 226019, China;School of Information, Central University of Finance and Economics, Beijing 100101, China
Abstract:With the rise of blockchain technology, more and more researchers and companies pay attention to the security of smart contracts. Currently, there are some studies on smart contract defect detection and testing techniques. Software defect prediction technology is an effective supplement to the defect detection techniques, which can optimize the allocation of testing resources and improve the efficiency of software testing. However, there is no research on software defect prediction for the smart contract. To address this problem, this paper proposes a defect prediction method for Solidity smart contracts. First, it designs a metrics suite (Smart Contract-Solidity, SC-Sol) which considers the variables, functions, structures and features of Solidity smart contracts, and SC-Sol is combined with the traditional metrics suite (code complexity and features of object-oriented program, COOP), which consider the object-oriented features, into COOP-SC-Sol metrics suite. Then, it extracts relevant metric meta-information from the Solidity code and performs defect detection to obtain the defects information to construct a Solidity smart contracts defect data set. On this basis, seven regression models and six classification models were applied to predict the defects of Solidity smart contracts to verify the performance differences of different metrics suites and different models for predicting the number and tendency of defects. Experimental results show that compared with the COOP, COOP-SC-Sol can improve the performance of the defect prediction model by 8% in terms of the F1-socre In addition, we further study the problem of class imbalance in smart contract defect prediction. The result shows that the random under-sampling method can improve the performance of the defect prediction model by 9% in F1-score. In predicting the tendency of specific types of defects, the performance of the model is affected by the imbalance of data sets. Better performance is achieved in predicting the types of defects which the percentage of defect modules is greater than 10%.
Keywords:Software defect prediction  Defect number prediction  Defect tendency prediction  Smart contract  Solidity
点击此处可从《软件学报》浏览原始摘要信息
点击此处可从《软件学报》下载全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号