Journal of Xidian University ›› 2024, Vol. 51 ›› Issue (3): 194-202.doi: 10.19665/j.issn1001-2400.20230803

• Cyberspace Security • Previous Articles     Next Articles

Efficient smart contract testing scheme supporting transactions filtering

PENG Yongxiang1(), MA Yong2(), LIU Zhiquan1,3(), WANG Libo1(), WU Yongdong1(), CHEN Ning3(), TANG Yong4()   

  1. 1. College of Information Science and Technology,Jinan University,Guangzhou 510632,China
    2. School of Computer and Information Engineering,Jiangxi Normal University,Nanchang 330022,China
    3. Guangdong Provincial Key Laboratory of Cyber and Information Security Vulnerability Research,Guangzhou 510643,China
    4. School of Computer Science and Engineering,University of Electronic Science and Technology of China,Chengdu 610054,China
  • Received:2023-05-07 Online:2024-06-20 Published:2023-11-08

Abstract:

In recent years,the smart contract has become a focal point of both the industry and academia as a vital component of the Ethereum blockchain.A smart contract is a program deployed on the blockchain that enables distributed transactions.However,due to the financial attributes of the smart contract,it becomes the target of hacker attacks.To ensure the security of the contract,identifying and repairing vulnerabilities is essential,and functional consistency must be guaranteed through rigorous testing.Regrettably,existing smart contract testing schemes suffer from several shortcomings,including a low replay accuracy and high storage consumption.In response to these challenges,an efficient smart contract testing scheme supporting transactions filtering is proposed which first models transaction features based on Ethereum state changes to enhance scalability;then optimizes storage space by storing Ethereum historical data based on a second-order tree structure;and finally,perform the transaction replay through the forking mechanism to test patched contract without interfering with the main chain.The prototype tool SCTester is implemented based on the proposed solution and conducts comparative assessments against existing contract testing schemes such as EVMPatch,Hartel,and Kim.Experimental results show the superiority of our proposed approach in terms of scalability and replay accuracy.Besides,it reduces storage space by 21.6% compared with Kim in terms of space consumption;and in terms of time consumption,it reduces time consumption by 70.5% compared with Kim in transaction replay under account testing scenario.

Key words: blockchain, smart contract, contract testing

CLC Number: 

  • TP309

Baidu
map