CN109508295B - Block chain consensus algorithm testing method and device, calculating device and storage medium - Google Patents

Block chain consensus algorithm testing method and device, calculating device and storage medium Download PDF

Info

Publication number
CN109508295B
CN109508295B CN201811354300.4A CN201811354300A CN109508295B CN 109508295 B CN109508295 B CN 109508295B CN 201811354300 A CN201811354300 A CN 201811354300A CN 109508295 B CN109508295 B CN 109508295B
Authority
CN
China
Prior art keywords
case
test
node
block chain
test case
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811354300.4A
Other languages
Chinese (zh)
Other versions
CN109508295A (en
Inventor
李贲
余兴华
殷舒
刘胜
陈正
徐加明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Union Mobile Pay Co Ltd
Original Assignee
Union Mobile Pay Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Union Mobile Pay Co Ltd filed Critical Union Mobile Pay Co Ltd
Priority to CN201811354300.4A priority Critical patent/CN109508295B/en
Publication of CN109508295A publication Critical patent/CN109508295A/en
Application granted granted Critical
Publication of CN109508295B publication Critical patent/CN109508295B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a block chain consensus algorithm testing method, a block chain consensus algorithm testing device, a block chain consensus algorithm computing device and a storage medium, relates to the field of block chains, and aims to solve the problem that the fault-tolerant capability of a block chain consensus algorithm is judged by modifying codes of a block chain main node or participating in the consensus node. In the method, the preposed nodes are configured for the block chain nodes, so that the test case set is generated in the preposed nodes, the block chain nodes are not required to be modified, the test is simpler and easier to operate, and the condition that whether the codes are modified or not is not required to be worried after the service is on line can be ensured. In addition, the method has small invasion and low learning cost, and can be suitable for testing different types of block chain consensus algorithms of different block chains.

Description

Block chain consensus algorithm testing method and device, calculating device and storage medium
Technical Field
The present invention relates to the field of blockchain, and in particular, to a method and an apparatus for testing a blockchain consensus algorithm, a computing apparatus, and a storage medium.
Background
The block chain consensus algorithm allows the associated nodes to be connected to work, and the work can still be normally carried out under the condition that some member nodes fail. This fault tolerance is a major advantage of the blockchain and has built-in redundancy margins to spare. In order to test the fault-tolerant capability of the block chain consensus algorithm, it is a common practice to modify a node to perform an error injection test, as shown in fig. 1, a node that receives a consensus request message sent by a client is a master node, that is, a node four is a block chain master node, a node one and a node two are nodes participating in consensus, and a code of the block chain master node or the nodes participating in consensus is modified to determine the fault-tolerant capability of the block chain consensus algorithm. However, when the test is performed by the error injection method, the code logic in the nodes needs to be modified and each node needs to be customized and developed, due to the customized development, the code reuse rate is low, and the development cost is high.
Disclosure of Invention
The embodiment of the application provides a method, a device, a computing device and a storage medium for testing a block chain consensus algorithm, and the method, the device, the computing device and the storage medium configure a front node for a block chain link point, so that a test case set is generated in the front node, the block chain link point is not required to be modified, the test is simpler and easier to operate, and whether a code is modified or not is not required to be worried after a service is on line. In addition, the method has small invasion and low learning cost, and can be suitable for testing different types of block chain consensus algorithms of different block chains.
In a first aspect, an embodiment of the present application provides a method for testing a block chain consensus algorithm, where the method includes:
the method comprises the steps that a preposed node receives a consensus request sent by a block chain node connected with the preposed node through a preset key;
analyzing the consensus request to obtain a request case;
determining a test case set corresponding to the obtained request case according to the relation between the test case set and the request case, and specifically comprising:
changing data parameters in the obtained request case through a genetic algorithm to generate a test case set I; combining and matching the obtained request case with case types in a case rule base to generate a second test case set; the use case types in the use case rule base comprise: an environment error rule use case, a consensus algorithm message rule use case, a consensus algorithm role rule use case and a consensus state rule use case; taking the union of the test case set I and the test case set II as a test case set;
sending the test case set to a corresponding front node so that the corresponding front node transparently transmits the test case set to a block chain link point connected with the corresponding front node;
receiving an execution report returned by each corresponding front node;
and saving the execution report into a report list of the execution report and synchronizing the execution report to other front nodes.
In a second aspect, an embodiment of the present application provides an apparatus for testing a block chain consensus algorithm, where the apparatus includes:
the first receiving module is used for receiving the consensus request sent by the block chain nodes connected with the preposed node through a preset key;
the analysis module is used for analyzing the consensus request to obtain a request case;
the determining module is configured to determine, according to a relationship between the test case set and the request case, a test case set corresponding to the obtained request case, and specifically includes:
changing data parameters in the obtained request case through a genetic algorithm to generate a test case set I; combining and matching the obtained request case with case types in a case rule base to generate a second test case set; the use case types in the use case rule base comprise: an environment error rule use case, a consensus algorithm message rule use case, a consensus algorithm role rule use case and a consensus state rule use case; taking the union of the test case set I and the test case set II as a test case set;
the sending module is used for sending the test case set to the corresponding front node so that the corresponding front node can transmit the test case set to the block chain link points connected with the corresponding front node;
the second receiving module is used for receiving the execution report returned by each corresponding front node;
and the synchronization module is used for storing the execution report into a report list of the execution report and synchronizing the execution report to other front nodes.
In a third aspect, another embodiment of the present application further provides a computing device comprising at least one processor; and;
a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute a method for testing a blockchain consensus algorithm provided by the embodiments of the present application.
In a fourth aspect, another embodiment of the present application further provides a computer storage medium, where the computer storage medium stores computer-executable instructions for causing a computer to execute a method for testing a blockchain consensus algorithm in an embodiment of the present application.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a schematic diagram of a fault injection method for block chain consensus test in the prior art;
FIG. 2 is a diagram of a front node for testing a blockchain consensus algorithm according to an embodiment of the present disclosure;
FIG. 3 is a schematic flow chart illustrating a block chain consensus algorithm testing method according to an embodiment of the present disclosure;
FIG. 4 is a block chain consensus test structure in an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computing device according to an embodiment of the present application.
Detailed Description
In order to solve the above problem, an embodiment of the present application provides a block chain consensus algorithm testing method. In order to better understand the technical solution provided by the embodiments of the present application, the following brief description is made on the basic principle of the solution:
as shown in fig. 2, the first node receives a consensus request sent by the client, that is, the first node is a master node, and the second node and the third node are nodes participating in consensus. And configuring a front node in front of the first node, the second node and the third node, when the first node sends a consensus request to the second node and the third node, the front node receives and analyzes the consensus request sent by the first node, and processes the analyzed request case to obtain a test case set. And the front node of the node I sends the test case set to the front nodes of the node II and the node III, and collects the execution reports of the test case set sent by the front nodes of the node II and the node III on the node II and the node III.
The block chain consensus algorithm test method is further described below by an embodiment from one of the front node sides. Fig. 3 is a schematic flow chart of a block chain consensus algorithm testing method, which includes the following steps:
step 301: the preposed node receives the consensus request sent by the block chain nodes connected with the preposed node through a preset key.
Step 302: and analyzing the consensus request to obtain a request case.
The request case obtained through analysis includes, but is not limited to, specific operation of the request, a timestamp added by the client when the request is made, message content, a message digest included in the request, a signature of the client on the request, a number assigned by the master node, a sequence number for ordering the request, a signature of the master node, a number of nodes participating in consensus, a signature of nodes participating in consensus, a recorded consensus message, a pre-preparation state, a confirmation state, and other information. The client sends the consensus request to the block chain main node, and the block chain main node sends the consensus request to the front node.
Step 303: and determining the test case set corresponding to the obtained request case according to the relation between the test case set and the request case.
Step 304: and sending the test case set to a corresponding front node so that the corresponding front node transparently transmits the test case set to the block chain link point connected with the corresponding front node.
And the corresponding front node is connected with the block chain link point participating in consensus. For example, as shown in fig. 2, the front nodes connected to the node two and the node three are the corresponding front nodes.
Step 305: and receiving the execution report returned by each corresponding front node.
Step 306: and saving the execution report into a report list of the execution report and synchronizing the execution report to other front nodes.
Therefore, the fault-tolerant capability of the block chain consensus algorithm is tested by generating the test case set through the front node, the block chain link points do not need to be modified, the test is simpler and easier to operate, and the condition that whether the codes are modified or not after the service is on line can be ensured. In addition, the method has small invasion and low learning cost, and can be suitable for testing different types of block chain consensus algorithms of different block chains.
In the embodiment of the present application, the request case is generated as a test case set, which may be specifically implemented as steps a 1-A3:
step A1: and changing the data parameters in the obtained request case through a genetic algorithm to generate a test case set I.
The test case set generated by the genetic algorithm only changes the data parameters in the request case.
Step A2: combining and matching the obtained request case with case types in a case rule base to generate a second test case set; the use case types in the use case rule base include but are not limited to: an environmental error rule use case, a consensus algorithm message rule use case, a consensus algorithm role rule use case, and a consensus status rule use case.
Step A3: and taking the union of the test case set I and the test case set II as a test case set.
The environmental error rule use case includes, but is not limited to: CPU (central processing unit) errors (e.g., high CPU utilization, busy CPU load average), memory errors (e.g., high memory resources), IO (input/output) errors (e.g., disk read/write errors), thread locks, network errors, etc.
Consensus algorithm message rule use cases include, but are not limited to: message replay, message tampering, any node false response, any node sending different message requests, double-flower transactions, message disorder and the like.
Consensus algorithm role rule use cases include, but are not limited to: the host node, the nodes participating in consensus and the nodes not participating in consensus have three roles.
Consensus status rule use cases include, but are not limited to: pre-preparation (pre-preparation), preparation (preparation) and confirmation (commit).
Therefore, the test case set matched by combination comprises the test cases required by the change request case besides the test cases only changing the data parameters in the request case. When the test case set is matched according to the case rule base combination, any one of the environment, the message, the role and the state in the request case is changed according to the case type in the case rule base, and the test case is obtained. For example, if the state information in the request case is in the pre-prepared state, the request data may be modified to the confirmed state to obtain a test case, and the execution result of the test case is collected to confirm the fault-tolerant capability of the blockchain consensus algorithm.
It should be noted that the environmental error rule case can be tested together with other case types. Such as: if the state information in the request data is in the pre-prepared state and the environment is a normal environment, the request data can be modified into a confirmed state, and executed in an environment with memory errors (such as high memory resources), and the execution result of the test case is collected.
Therefore, the request case and the case type are combined and matched, and the test case set is automatically obtained, so that the test is simpler and the operation is easier.
In one embodiment, the generated test case may be a request case that is changed by both a genetic algorithm to change data parameters of the request case and a combination of case rules to match requirements of the request case.
In one embodiment, test case rules in the case rule base can be added or deleted and validated in real time. Therefore, the test cases can be dynamically added in real time by the case rule base, and the operation is convenient.
In order to enable the generated test case suite to cover all situations more comprehensively, a method is provided in the embodiment of the present application to generate the test case suite, which may be specifically implemented as follows: and combining the obtained request case and the case types in the case rule base through a Pairwise algorithm to generate a second test case set.
Therefore, the generated test case can completely cover various abnormal conditions by the method, and the fault tolerance of the system can be better checked.
The test case set may be generated by other methods than the above-described method. In one embodiment, the test case set is generated by combining and matching the request cases and the rules by using the case base through a crossover operator in the genetic algorithm. It should be noted that, the combination and matching of the request case and the rule case library to generate the test case set includes, but is not limited to, the above two methods.
The above describes in detail how to generate a test case set and how to send the test case set to the corresponding participating consensus block link point. The following further describes an operation of sending the test case suite to other front nodes and receiving, by the front nodes, execution reports of the test case suite by the corresponding block chain consensus node sent by each other front node.
If the consensus request sent by the front node to the block chain node contains the signature, the test case set is sent to other front nodes, so that the generated test case set needs to be re-signed before the other front nodes transmit the test case set to the block chain node connected with the front node, which can be specifically implemented as follows: and if the received consensus request contains the signature, re-signing the test case set by using a preset secret key.
Thus, by verifying whether the signature is correct, the security of the execution report is ensured.
In an embodiment, if the front-end node receives the consensus request sent by the block chain node without a signature, the test case containing the signature can also be generated through the case rule base when the test case set is generated. In this way, the fault tolerance of the blockchain consensus algorithm can be verified.
In the embodiment of the application, when the execution report returned by each other front node is received, the test reports of the test cases in the test case set need to be received one by one. For the block link point corresponding to each corresponding front node, the method can be specifically implemented as steps B1-B2:
step B1: and receiving a test report of the test case returned by the block chain link point, wherein the test report is sent after each test case is executed when the block chain link point executes the test cases in the test case set one by one.
Step B2: and taking the union of the test reports of the test cases in the test case set returned by the block chain node as the execution report of the block chain node.
Wherein the execution report is the result of each test case execution and whether the result is the same as the expected result.
Therefore, each time other blockchain nodes execute one test case, one test result is returned, and the working efficiency of the blockchain nodes can be improved.
In the embodiment of the application, the execution report is saved in the front node, so that the execution report is convenient to view, and meanwhile, the execution report is synchronized to other front nodes. Therefore, the execution report of each node is stored in the report list, the report content can be conveniently checked, meanwhile, the execution report is synchronized to other front nodes, any front node can be checked, and all the content of the execution report can be searched.
Based on the same inventive concept, the embodiment of the application also provides a device for testing the block chain consensus algorithm. As shown in fig. 4, the apparatus includes:
a first receiving module 401, configured to receive, through a preset key, a consensus request sent by a block link node connected to the pre-node;
an analysis module 402, configured to analyze the consensus request to obtain a request case;
a determining module 403, configured to determine, according to a relationship between the test case set and the request case, a test case set corresponding to the obtained request case;
a sending module 404, configured to send the test case set to a corresponding front node, so that the corresponding front node transparently transmits the test case set to a block link point connected to the corresponding front node;
a second receiving module 405, configured to receive an execution report returned by each corresponding front-end node;
and a synchronization module 406, configured to save the execution report into a report list of the execution report itself, and synchronize the execution report to other front nodes.
Further, the determining module 403 includes:
the first generation unit is used for changing data parameters in the obtained request case through a genetic algorithm to generate a test case set I;
the second generation unit is used for carrying out combination matching on the obtained request case and the case types in the case rule base to generate a second test case set; the use case types in the use case rule base include but are not limited to: an environment error rule use case, a consensus algorithm message rule use case, a consensus algorithm role rule use case and a consensus state rule use case;
and the first merging unit is used for taking the union of the test case set I and the test case set II as the test case set.
Further, the second generating unit includes:
and the generating subunit is used for combining the obtained request case and the case types in the case rule base through a Pairwise algorithm to generate a second test case set.
Further, the apparatus further comprises:
further, before the sending module 404 sends the test case set to the corresponding front node so that the corresponding front node passes the test case set through to the block link point connected to the front node, the apparatus further includes:
and the signature unit is used for re-signing the test case set by using a preset key if the received consensus request contains a signature.
Further, the second receiving module 405 includes:
the receiving unit is used for receiving the test result of the test case returned by the block chain link point aiming at the block chain link point corresponding to each corresponding preposed node, wherein the test result is sent after each test case is executed when the block chain link point executes the test cases in the test case set one by one;
and the second merging unit is used for taking the union of the test results of all the test cases in the test case set returned by the block chain link point as the execution result of the block chain node.
After introducing the block chain consensus algorithm testing method and apparatus of the exemplary embodiment of the present application, a computing apparatus according to another exemplary embodiment of the present application is introduced next.
As will be appreciated by one skilled in the art, aspects of the present application may be embodied as a system, method or program product. Accordingly, various aspects of the present application may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
In some possible implementations, a computing device may include at least one processor, and at least one memory, according to embodiments of the application. The memory stores program code, and when the program code is executed by the processor, the processor executes step 301 and step 306 in the block chain consensus algorithm testing method according to various exemplary embodiments of the present application described above in this specification.
The computing device 50 according to this embodiment of the present application is described below with reference to fig. 5. The computing device 50 shown in fig. 5 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present application. The computing device may be, for example, a cell phone, a tablet computer, or the like.
As shown in fig. 5, computing device 50 is embodied in the form of a general purpose computing device. Components of computing device 50 may include, but are not limited to: the at least one processor 51, the at least one memory 52, and a bus 53 connecting the various system components (including the memory 52 and the processor 51).
Bus 53 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.
The memory 52 may include readable media in the form of volatile memory, such as Random Access Memory (RAM)521 and/or cache memory 522, and may further include Read Only Memory (ROM) 523.
Memory 52 may also include a program/utility 525 having a set (at least one) of program modules 524, such program modules 524 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Computing apparatus 50 may also communicate with one or more external devices 54 (e.g., pointing devices, etc.), with one or more devices that enable a user to interact with computing apparatus 50, and/or with any devices (e.g., routers, modems, etc.) that enable computing apparatus 50 to communicate with one or more other computing apparatuses. Such communication may be through an input/output (I/O) interface 55. Also, the computing device 50 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 56. As shown, the network adapter 56 communicates with other modules for the computing device 50 over the bus 53. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with computing device 50, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
In some possible embodiments, the aspects of the block chain consensus algorithm test method provided herein may also be implemented in the form of a program product comprising program code for causing a computer device to perform the steps in the block chain consensus algorithm test method according to various exemplary embodiments of the present application described above in this specification, performing the steps 301-306 as shown in fig. 3, when the program product is run on the computer device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The blockchain consensus algorithm test of the embodiments of the present application may employ a portable compact disk read only memory (CD-ROM) and include program code, and may be run on a computing device. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user computing device, partly on the user equipment, as a stand-alone software package, partly on the user computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
It should be noted that although several units or sub-units of the apparatus are mentioned in the above detailed description, such division is merely exemplary and not mandatory. Indeed, the features and functions of two or more units described above may be embodied in one unit, according to embodiments of the application. Conversely, the features and functions of one unit described above may be further divided into embodiments by a plurality of units.
Moreover, although the operations of the methods of the present application are depicted in the drawings in a sequential order, this does not require or imply that these operations must be performed in this order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a manner that causes the instructions stored in the computer-readable memory to produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (9)

1. A block chain consensus algorithm test method is characterized in that each block chain node is configured with a front node, and the method comprises the following steps:
the method comprises the steps that a preposed node receives a consensus request sent by a block chain node connected with the preposed node through a preset key;
analyzing the consensus request to obtain a request case;
determining a test case set corresponding to the obtained request case according to the relation between the test case set and the request case, and specifically comprising:
changing data parameters in the obtained request case through a genetic algorithm to generate a test case set I; combining and matching the obtained request case with case types in a case rule base to generate a second test case set; the use case types in the use case rule base comprise: an environment error rule use case, a consensus algorithm message rule use case, a consensus algorithm role rule use case and a consensus state rule use case; taking the union of the test case set I and the test case set II as a test case set;
sending the test case set to a corresponding front node so that the corresponding front node transparently transmits the test case set to a block chain link point connected with the corresponding front node;
receiving an execution report returned by each corresponding front node;
and saving the execution report into a report list of the execution report and synchronizing the execution report to a corresponding front node.
2. The method according to claim 1, wherein the step of performing combination matching on the obtained request case and the case types in the case rule base to generate a second test case set specifically comprises:
and combining the obtained request case and the case types in the case rule base through a Pairwise algorithm to generate a second test case set.
3. The method of claim 1, wherein prior to sending the set of test cases to the corresponding front-end node to cause the corresponding front-end node to transparently pass the set of test cases to the block-link points connected to the front-end node, the method further comprises:
and if the received consensus request contains the signature, re-signing the test case set by using a preset secret key.
4. The method according to claim 1, wherein said receiving the execution report returned by each corresponding front-end node specifically comprises:
and aiming at the block chain nodes corresponding to the corresponding preposed nodes, executing:
receiving a test report of the test cases returned by the block chain link point, wherein the test report is sent after each test case is executed when the block chain link point executes the test cases in the test case set one by one;
and taking the union of the test reports of the test cases in the test case set returned by the block chain node as the execution report of the block chain node.
5. An apparatus for testing a blockchain consensus algorithm, the apparatus comprising:
the first receiving module is used for receiving the consensus request sent by the block chain nodes connected with the preposed node through a preset key;
the analysis module is used for analyzing the consensus request to obtain a request case;
the determining module is configured to determine, according to a relationship between the test case set and the request case, a test case set corresponding to the obtained request case, and specifically includes:
changing data parameters in the obtained request case through a genetic algorithm to generate a test case set I; combining and matching the obtained request case with case types in a case rule base to generate a second test case set; the use case types in the use case rule base comprise: an environment error rule use case, a consensus algorithm message rule use case, a consensus algorithm role rule use case and a consensus state rule use case; taking the union of the test case set I and the test case set II as a test case set;
the sending module is used for sending the test case set to the corresponding front node so that the corresponding front node can transmit the test case set to the block chain link points connected with the corresponding front node;
the second receiving module is used for receiving the execution report returned by each corresponding front node;
and the synchronization module is used for storing the execution report into a report list of the execution report and synchronizing the execution report to other front nodes.
6. The apparatus of claim 5, wherein the determining module comprises:
the first generation unit is used for changing data parameters in the obtained request case through a genetic algorithm to generate a test case set I;
the second generation unit is used for carrying out combination matching on the obtained request case and the case types in the case rule base to generate a second test case set; the use case types in the use case rule base comprise: an environment error rule use case, a consensus algorithm message rule use case, a consensus algorithm role rule use case and a consensus state rule use case;
and the first merging unit is used for taking the union of the test case set I and the test case set II as the test case set.
7. The apparatus of claim 5, wherein the second receiving module comprises:
the receiving unit is used for receiving the test result of the test case returned by the block chain link point aiming at the block chain link point corresponding to each corresponding preposed node, wherein the test result is sent after each test case is executed when the block chain link point executes the test cases in the test case set one by one;
and the second merging unit is used for taking the union of the test results of all the test cases in the test case set returned by the block chain link point as the execution result of the block chain node.
8. A computer terminal readable medium storing computer terminal executable instructions for performing the method of any one of claims 1 to 5.
9. A computing device, comprising:
at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
CN201811354300.4A 2018-11-14 2018-11-14 Block chain consensus algorithm testing method and device, calculating device and storage medium Active CN109508295B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811354300.4A CN109508295B (en) 2018-11-14 2018-11-14 Block chain consensus algorithm testing method and device, calculating device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811354300.4A CN109508295B (en) 2018-11-14 2018-11-14 Block chain consensus algorithm testing method and device, calculating device and storage medium

Publications (2)

Publication Number Publication Date
CN109508295A CN109508295A (en) 2019-03-22
CN109508295B true CN109508295B (en) 2021-11-09

Family

ID=65748475

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811354300.4A Active CN109508295B (en) 2018-11-14 2018-11-14 Block chain consensus algorithm testing method and device, calculating device and storage medium

Country Status (1)

Country Link
CN (1) CN109508295B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110047004B (en) * 2019-04-23 2023-04-18 重庆金窝窝网络科技有限公司 Block chain accounting node selection method and device
CN110519277B (en) * 2019-08-29 2020-08-21 上海威尔立杰网络科技发展有限公司 Method for realizing control of other systems based on single-point execution contract
CN110868337B (en) * 2019-11-15 2021-05-07 腾讯科技(深圳)有限公司 Fault-tolerant consensus mechanism testing method and device, storage medium and computer equipment
CN111782502A (en) * 2019-12-13 2020-10-16 北京沃东天骏信息技术有限公司 Automatic testing method and device
CN113760691B (en) * 2020-06-10 2024-06-18 北京沃东天骏信息技术有限公司 Continuous integrated test method, device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8473913B2 (en) * 2006-01-11 2013-06-25 Hitachi Data Systems Corporation Method of and system for dynamic automated test case generation and execution
CN106598824A (en) * 2016-11-25 2017-04-26 深圳前海微众银行股份有限公司 Performance analysis method and device for block chain
CN107943691A (en) * 2017-11-17 2018-04-20 深圳圣马歌科技有限公司 A kind of method and device for the functional test page for automatically generating intelligent contract
CN108241968A (en) * 2017-03-26 2018-07-03 杭州复杂美科技有限公司 The method that front end processor participates in block chain common recognition
CN108647967A (en) * 2018-05-10 2018-10-12 北京京东尚科信息技术有限公司 Select the method, apparatus and common recognition node of block chain common recognition mechanism

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8473913B2 (en) * 2006-01-11 2013-06-25 Hitachi Data Systems Corporation Method of and system for dynamic automated test case generation and execution
CN106598824A (en) * 2016-11-25 2017-04-26 深圳前海微众银行股份有限公司 Performance analysis method and device for block chain
CN108241968A (en) * 2017-03-26 2018-07-03 杭州复杂美科技有限公司 The method that front end processor participates in block chain common recognition
CN107943691A (en) * 2017-11-17 2018-04-20 深圳圣马歌科技有限公司 A kind of method and device for the functional test page for automatically generating intelligent contract
CN108647967A (en) * 2018-05-10 2018-10-12 北京京东尚科信息技术有限公司 Select the method, apparatus and common recognition node of block chain common recognition mechanism

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链的共识机制;C站训练营学员C站训练营学员C站训练营营;《https://blog.csdn.net/cpongo3/article/details/89032069》;20180828;第1-3页 *

Also Published As

Publication number Publication date
CN109508295A (en) 2019-03-22

Similar Documents

Publication Publication Date Title
CN109508295B (en) Block chain consensus algorithm testing method and device, calculating device and storage medium
CN108600029B (en) Configuration file updating method and device, terminal equipment and storage medium
CN109542781B (en) Block chain consensus algorithm testing method and device, calculating device and storage medium
CN109361740B (en) Block generation method, device, equipment and medium of block chain
CN112073269B (en) Block chain network testing method, device, server and storage medium
CN102609281B (en) Distributed software patch update method and system
CN112560078B (en) Block chain data processing method, device, equipment and medium
CN110750592B (en) Data synchronization method, device and terminal equipment
CN110995825B (en) Intelligent contract issuing method, intelligent node equipment and storage medium
CN110851471A (en) Distributed log data processing method, device and system
US8495629B2 (en) Virtual machine relocation system and associated methods
US10296431B2 (en) Generation of debugging log list in a blade server environment
CN104598341A (en) Approach and system for determining a location of failure between interconnects/controller
CN112099843A (en) Code hosting platform management method and device, computer equipment and storage medium
CN111338834B (en) Data storage method and device
CN112367680A (en) External communication test method and device based on intelligent electric meter and computer equipment
CN115291497A (en) Function application monitoring method and vehicle controller system
CN115114064A (en) Micro-service fault analysis method, system, equipment and storage medium
CN114095343A (en) Disaster recovery method, device, equipment and storage medium based on double-active system
CN112953783A (en) Satellite link state detection method, device, server and storage medium
CN117057974B (en) GPU big data platform, electronic equipment and storage medium
CN117118986B (en) Block chain-based fault tolerance verification method, device, equipment and medium
Stankovic et al. A survey on online monitoring approaches of computer-based systems
CN117850967A (en) Cross-cloud platform migration system
CN117857336A (en) Configuration information transmitting device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant