The development of blockchain technology has driven the widespread adoption of smart contracts in digital asset and other domains.However,the frequent occurrence of smart contract vulnerabilities poses a serious threat to the security of the blockchain ecosystem.Fuzz testing is a straightforward and efficient approach for detecting security issues in smart contracts.Nevertheless,it requires specific transaction sequences to trigger vulnerabilities,and thus,a large number of transaction sequences must be explored during the testing process to uncover potential weaknesses.This,in turn,can lead to an explosion in the number of transaction sequences,severely impacting the efficiency of the testing process.Additionally,the inherently low code coverage of fuzz testing is another challenge.To address these issues,this paper investigates the following:(1)In response to the low code coverage and sequence explosion problems that exist in smart contract fuzz testing,this paper proposes an intelligent contract fuzz testing method based on reinforcement learning.This method achieves deep testing of smart contracts by scheduling memory snapshots and sorting data flow relatedness of functions,and overcomes the sequence explosion problem in fuzz testing,thereby improving the code coverage.The method adopts reinforcement learningbased memory state scheduling strategy and memory state eviction strategy to effectively address the problems of state selection and memory overflow in the memory pool.In addition,the method uses a topological sorting algorithm to sort the "write-after-read" relationships of state variables in contract functions to reduce the uncertainty in the testing process.Based on this method,a high-efficiency smart contract fuzz testing tool,RL_soFuzzer,is developed by combining symbolic execution and advanced vulnerability detectors.The experiments demonstrate that the proposed method can effectively solve the problems in current smart contract fuzz testing.Compared with other advanced smart contract detectors,RL_soFuzzer performs better in code coverage and vulnerability detection.Moreover,RL_soFuzzer also shows excellent performance in engineering applications.(2)A high-coverage and high-precision smart contract fuzz testing system was designed and implemented with the aforementioned fuzz tester as its core.The system supports static extraction of contract information and compiler version management,providing fuzzy testing detection for smart contracts.This paper employs functional decomposition and module decoupling to construct a distributed system architecture and introduces message queues,caching mechanisms and other technologies to optimize system performance.Through testing,all functions of the system achieved the expected results,and the system performance also met the expected requirements. |