Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Smart contract testing method based on path coverage sufficiency criterion

A path coverage test and smart contract technology, applied in the computer field, can solve the problems of only detecting a limited number of known vulnerabilities and tools cannot detect them, so as to improve the effect of vulnerability detection and reduce labor costs

Active Publication Date: 2019-07-23
SOUTH CHINA NORMAL UNIVERSITY +1
View PDF3 Cites 17 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] Existing smart contract testing tools are designed to detect specific patterns of known vulnerabilities. The disadvantage is that they can only detect a limited number of known vulnerabilities. Oyente can only detect 4 specific vulnerabilities, and contractFuzzer can only detect 7 specific vulnerability
However, other vulnerabilities or errors other than these vulnerabilities may exist in the smart contracts written by programmers
These tools cannot detect logic errors that do not have a specific pattern

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Smart contract testing method based on path coverage sufficiency criterion
  • Smart contract testing method based on path coverage sufficiency criterion
  • Smart contract testing method based on path coverage sufficiency criterion

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0046] Such as figure 1 As shown, a smart contract testing method based on path coverage sufficiency criterion of the present invention comprises the following steps:

[0047] In the first step, enter the bytecode of the smart contract and the ABI of the smart contract.

[0048] The second step is to generate a control flow chart according to the bytecode.

[0049] The third step is to use the EPP algorithm to analyze the control flow chart, find out the blocks that need to be inserted, and perform the insertion.

[0050] The fourth step is to deploy the smart contract after instrumentation on truffle.

[0051] The fifth step is to generate a set of test cases that meet the requirements according to the path coverage test adequacy criterion.

[0052] The specific description of each of the above steps is as follows:

[0053] The first step is to enter the bytecode of the smart contract, which can be obtained through sol-bin-runtimefilePath.

[0054] The second step is to ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a smart contract test method based on a path coverage sufficiency criterion. The method comprises the following steps: step 1, inputting byte codes of a smart contract and ABIsof the smart contract; step 2, generating a control flow chart according to the byte code; step 3, using an EPP algorithm for analyzing the control flow chart, finding out blocks needing instrumentation, and conducting instrumentation; step 4, deploying the instrumented smart contract on the trace; and step 5, generating a test case set meeting requirements according to a path coverage test sufficiency criterion. Compared with other technologies for analyzing the source code, the byte code of the smart contract is analyzed, and the method is more efficient. According to the method, the test case is automatically generated for the smart contract, whether the sufficient test case set is generated or not is judged according to the adequacy criterion of path coverage, errors possibly existingin the smart contract code are fully exposed as much as possible, the vulnerability detection effect is improved, and the labor cost is reduced.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a smart contract testing method based on path coverage sufficiency criteria. Background technique [0002] Smart contracts are programs that run on top of blockchain consensus protocols to allow people to come to an agreement while minimizing trust. Once the smart contract is deployed, the contract content is open, transparent, non-tamperable, and automatically executed. But precisely because of the non-tamperable nature of the smart contract, if the smart contract fails to detect loopholes or logic errors in time before deployment, it may make mistakes or be maliciously used by bad people, causing people's property losses, for example: the loopholes in The DAO contract caused Lost $60 million. In order to avoid errors or loopholes in the deployed smart contracts and ensure the safety of people's property, the testing of smart contracts is very important. [0003] Existing s...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36G06Q40/04
CPCG06F11/3684G06F11/3688G06Q40/04
Inventor 赵淦森王欣明周东宜谢智健何嘉浩周子衡莫泽枫
Owner SOUTH CHINA NORMAL UNIVERSITY
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products