The present application belongs to the field of
path search method, especially the method for realizing
path search depth self-adaptive adjustment based on
abstract syntax tree, aiming at the problem that the existing contract with large number of code lines has deep function call and the
symbolic execution cannot cover, the contract faced by the
symbolic execution is basically the low version
smart contract with not more than 200 lines, ignoring the problem that the
symbolic execution is difficult to cover part of path in long / complex contract, the present application proposes the following scheme, which comprises the following steps: S1: input: the
open source contract on EtherScan or the
smart contract source code written by the developer is taken as the program input; S2: compilation: the
smart contract is compiled through the
Solidity compiler, the AST information and the smart contract
bytecode generated in the compilation process are collected, the present application is based on the symbolic execution technology, combines the AST information which can reflect the
semantics of the smart contract
source code, and adaptively adjusts the
path search depth in the symbolic execution process, so as to avoid the problem that the
vulnerability position cannot be detected and the coverage is low in the long contract.