Block chain common recognition test of heuristics method, apparatus, computing device and storage medium
Technical field
The present invention relates to block chain field more particularly to a kind of block chain common recognition test of heuristics method, apparatus, computing device
And storage medium.
Background technique
Block chain common recognition algorithm is that associated nodes is allowed to connect the feelings for working, and failing in certain member nodes
Under condition, work remains to be normally carried out.This fault-tolerant ability is the main advantage of block chain, and has built-in redundancy surplus standby to make
With.For test block chain common recognition algorithm fault-tolerant ability, it is common practice that modification node carries out the test of error injection method, such as Fig. 1
Shown, receiving client and sending the node of common recognition request message is host node, i.e., node four is block chain host node, one He of node
Node two is the node for participating in common recognition, modifies block chain host node or participates in the code of common recognition node, to judge the block chain
Common recognition algorithm fault-tolerant ability.However tested by error injection method, need to modify the code logic in node and to each
Node is customized exploitation, due to customized development, will lead to that rate of code reuse is low, and development cost is big, in addition, modification code logic
If node programmer forget closed node code-bar switch, be easy test code on-line and cause online failure, or bring on line
Unknown risk, so that maintenance cost is high.
Summary of the invention
The embodiment of the present application provides method, apparatus, computing device and the storage medium of a kind of block chain common recognition test of heuristics,
By configuring intermediate node for block chain node, so that test use cases are generated in intermediate node, without to block chain node
It modifies, makes test simpler, it is easier to operate, it can also be ensured that do not have to worry whether code is corrected one's mistakes after service is online.
In addition, which invasive is small, learning cost is low, can be adapted for the different types of block chain common recognition algorithm of different blocks chain
Test.
In a first aspect, the embodiment of the present application provides a kind of method of block chain common recognition test of heuristics, this method comprises:
Intermediate node is requested by the common recognition that preset key reception block chain node is sent;
Common recognition request is parsed, request use-case is obtained;
According to the relationship between test use cases and request use-case, the obtained corresponding test case of request use-case is determined
Collection;
Each purpose IP address is determined by routing management, and the corresponding routing letter of each purpose IP address is searched from routing table
Breath;
Test use cases are passed through into the corresponding block chain node of each purpose IP address according to each routing iinformation;
Receive the corresponding block chain node return of each purpose IP address executes report, and is saved in the report list of itself
In.
Second aspect, the embodiment of the present application provide a kind of device of block chain common recognition test of heuristics, which includes:
First receiving module, the common recognition for being sent by preset key reception block chain node are requested;
Parsing module obtains request use-case for parsing to common recognition request;
Determining module, for determining obtained request use-case pair according to the relationship between test use cases and request use-case
The test use cases answered;
Searching module, for determining each purpose IP address by routing management, and from routing table with searching each destination IP
The corresponding routing iinformation in location;
Transparent transmission module, for test use cases to be passed through the corresponding block chain of each purpose IP address according to each routing iinformation
Node;
Second receiving module executes report for receive that the corresponding block chain node of each purpose IP address returns, and protects
It is stored in the report list of itself.
The third aspect, another embodiment of the application additionally provide a kind of computing device, including at least one processor;With
And;
The memory being connect at least one described processor communication;Wherein, the memory be stored with can by it is described extremely
The instruction that a few processor executes, described instruction are executed by least one described processor, so that at least one described processing
The method that device is able to carry out a kind of block chain common recognition test of heuristics provided by the embodiments of the present application.
Fourth aspect, another embodiment of the application additionally provide a kind of computer storage medium, wherein the computer is deposited
Storage media is stored with computer executable instructions, and the computer executable instructions are for making computer execute the embodiment of the present application
One of block chain common recognition test of heuristics method.
Other features and advantage will illustrate in the following description, also, partly become from specification
It obtains it is clear that being understood and implementing the application.The purpose of the application and other advantages can be by written explanations
Specifically noted structure is achieved and obtained in book, claims and attached drawing.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present application, constitutes part of this application, this Shen
Illustrative embodiments and their description please are not constituted an undue limitation on the present application for explaining the application.In the accompanying drawings:
Fig. 1 is the error injection method schematic diagram of the block chain common recognition test of heuristics in background technique;
Fig. 2 is the intermediate node schematic diagram of block chain common recognition test of heuristics in the embodiment of the present application;
Fig. 3 is the flow diagram of block chain common recognition test of heuristics method in the embodiment of the present application;
Fig. 4 is the structural schematic diagram of block chain common recognition test of heuristics in the embodiment of the present application;
Fig. 5 is the structural schematic diagram according to the computing device of the application embodiment.
Specific embodiment
To solve the above-mentioned problems, a kind of block chain common recognition test of heuristics method is provided in the embodiment of the present application.In order to more
Good understanding technical solution provided by the embodiments of the present application does the basic principle of the program once briefly describe here:
As shown in Fig. 2, configuring an intermediate node between node one, node two, node three and node four, node one is connect
The common recognition request that client is sent is received, i.e. node one is host node, and intermediate node receives the common recognition request of the transmission of node one simultaneously
It is parsed, request use-case and destination IP (Internet Protocol Address, Internet protocol) address are obtained,
And the request use-case after parsing is handled, obtain test use cases.Node two and node three are determined by intermediate node
Test use cases are passed through purpose IP address pair by destination IP (Internet Protocol Address, Internet protocol) address
The node two and node three answered, and node two and node three the holding for test use cases that collector node two and node three are sent
Row report.
Block chain common recognition test of heuristics method is described further from intermediate node side below by specific embodiment.Figure
3 be the flow diagram of block chain common recognition test of heuristics method, comprising the following steps:
Step 301: intermediate node is requested by the common recognition that preset key reception block chain node is sent.
Step 302: common recognition request being parsed, request use-case is obtained.
Wherein, include but is not limited to by parsing in obtained request data: the client when concrete operations of request, request
Additional timestamp, request sign to request comprising message content, eap-message digest, client, the number of host node distribution,
To request be ranked up serial number, host node signature, participate in common recognition node serial number, participate in common recognition node signature, record common recognition disappear
Breath, prepares the information such as state, acknowledgement state at pre-preparation state.Wherein, common recognition request is sent to the main section of block chain by client
Point, and central node is sent to by block chain host node.
Step 303: according to the relationship between test use cases and request use-case, determining the obtained corresponding survey of request use-case
Try set of uses case.
Step 304: each purpose IP address being determined by routing management, and searches each purpose IP address from routing table and corresponds to
Routing iinformation.
Step 305: test use cases are passed through by the corresponding block chain node of each purpose IP address according to each routing iinformation.
Wherein, intermediate node is connect with multiple block chain nodes, can be determined by routing management and be participated in common recognition node
Each purpose IP address finds block chain node corresponding with the destination address determined according to routing table, can effectively be led to
News.
Step 306: receive the corresponding block chain node return of each purpose IP address executes report, and is saved in itself
In report list.
The fault-tolerant ability of block chain common recognition algorithm is tested in this way, generating test use cases by intermediate node, nothing
It need to modify to block chain link point, make test simpler, it is easier to operate, it can also be ensured that not have to worry generation after service is online
Whether code is corrected one's mistakes.In addition, which invasive is small, learning cost is low, can be adapted for the different types of of different blocks chain
Block chain common recognition test of heuristics.Meanwhile purpose IP address is selected by intermediate node, and determine according to the purpose IP address of selection
The block chain node for participating in common recognition, can preferably be allocated according to the loading condition of each block chain node.
In the embodiment of the present application, request use-case is generated as test use cases, specific implementable for step A1-A3:
Step A1: being changed the data parameters in obtained request use-case by genetic algorithm, generates test case
Collection one.
Wherein, the test use cases generated by genetic algorithm, what is only changed is the data parameters requested in use-case.
Step A2: the use-case type in obtained request use-case and use-case rule base is combined matching, generates test
Set of uses case two;Wherein, the use-case type in use-case rule base includes being not limited to: environment error rule use-case, common recognition algorithm message
Regular use-case, common recognition algorithm role rule use-case, common recognition state rule use-case.
Step A3: using the union of test use cases one and test use cases two as test use cases.
Wherein, environment error rule use-case includes being not limited to: CPU (central processing unit) mistake (such as: cpu busy percentage height,
CPU load average (average load) is busy), EMS memory error (such as: memory source high), IO (input and output) mistake (such as:
Disk read-write mistake), thread lock, network error etc..
Common recognition algorithm message rule use-case includes being not limited to: message-replay, message are distorted, arbitrary node errored response, are appointed
Meaning node sends different message requests, honeysuckle transaction, message random ordering etc..
Common recognition algorithm role rule use-case includes being not limited to: host node, the node for participating in common recognition are not involved in common recognition node three
Kind role.
Common recognition state rule use-case includes being not limited to: pre-preparation (pre-prepare) prepares (prepare) and confirms
(commit)。
Therefore, test case of the test use cases of combinations matches in addition to only changing data parameters in request use-case, is also wrapped
Include the test case for changing request use-case requirement.When according to use-case rule base combinations matches test use cases, according to convention
Then by environment, message, role and the state requested in use-case, any one is changed the use-case type in library, obtains test and uses
Example.For example, the request data can be revised as acknowledgement state if the status information in request use-case is pre-preparation state, obtained
To test case, and the implementing result of the test case is collected, to confirm the fault-tolerant ability of block chain common recognition algorithm.
It should be noted that environment error rule use-case can be tested together with other use-case types.Such as: if request
Status information in data is pre-preparation state, and environment is normal environment, which can be revised as to acknowledgement state, and
It is executed in the environment of EMS memory error (such as: memory source is high), and collects the implementing result of test case.
In this way, will request use-case and use-case type be combined matching, automatically derive test use cases can allow test more
Simply, it is easier to operate.
In one embodiment, the test case of generation can be both data parameters by genetic algorithm to request use-case
It is changed, changes the requirement of request use-case further through use-case rule base combinations matches.
In one embodiment, the test case rule in use-case rule base can increase or delete, and come into force in real time.This
Sample, realizing use-case rule base can be with the increase test case of dynamic realtime, and is convenient for operation.
In order to allow the test use cases generated more fully to cover all situations, propose in the embodiment of the present application
A kind of method is used to generate test use cases, specific implementable are as follows: by Pairwise algorithm to obtained request use-case and use
Use-case type in example rule base is combined, and generates test use cases two.
In this way, the test case generated can be enable to cover various abnormal conditions comprehensively by the method, it can be more preferable
The fault-tolerance of ground checking system.
In addition to the method for above-mentioned generation test use cases, can also be generated by other methods.In one embodiment,
Use-case will be requested to be combined with regular use-case library by the crossover operator in genetic algorithm and match generation test use cases.It needs
Illustrate, request use-case is combined with regular use-case library and matches generation test use cases including but not limited to above two
Method.
It is above-mentioned corresponding to participate in common recognition block chain to how generating test use cases and how to be sent to test use cases
Node is described in detail.The corresponding block chain link point progress of each purpose IP address is sent to by test use cases below
Further instruction.
If central node receives the common recognition request of block chain node transmission containing signature, will be surveyed according to each routing iinformation
Before examination set of uses case passes through the corresponding block chain node of each purpose IP address, need to carry out again the test use cases of generation
Signature, it is specific implementable are as follows: if the common recognition request received contains signature, again using preset key pair test use cases
Signature.
In this way, whether correct by verifying signature, it is ensured that the safety of test use cases.
It in one embodiment, can also if the common recognition request that intermediate node receives the transmission of block chain node is not signed
By use-case rule base, to generate the test case containing signature when generating test use cases.In this way, the area can be verified
The fault-tolerant ability of block chain common recognition algorithm.
In the embodiment of the present application, needs when receiving the execution report that the corresponding block chain node of each purpose IP address returns
The test report for the test case that reception test case one by one is concentrated.For the corresponding block chain node of each purpose IP address,
It is specific implementable for step B1-B2:
Step B1: receiving the test report of the test case of block chain node return, and the test report is the block
Every executed sends after a test case when chain node test case that implementation of test cases is concentrated one by one.
Step B2: the union of the test report for each test case that the test case that the block chain node is returned is concentrated is made
Report is executed for the block chain node.
Wherein, execute be reported as result that every test case executes and the result compared with expected results whether phase
Together.
In this way, other block chain nodes are every to have executed a test case, it is returned to a test result, area can be improved
The working efficiency of block chain node.
In the embodiment of the present application, report will be executed to be saved in intermediate node, is protected in this way, the execution of each node is reported
It is stored in the report list of intermediate node, it can be in order to checking report content.
Based on identical inventive concept, the embodiment of the present application also provides a kind of device of block chain common recognition test of heuristics.Such as
Shown in Fig. 4, which includes:
First receiving module 401, the common recognition for being sent by preset key reception block chain node are requested;
Parsing module 402 obtains request use-case for parsing to common recognition request;
Determining module 403, for determining obtained request use-case according to the relationship between test use cases and request use-case
Corresponding test use cases;
Searching module 404 for determining each purpose IP address by routing management, and searches each destination IP from routing table
The corresponding routing iinformation in address;
Transparent transmission module 405, for test use cases to be passed through the corresponding area of each purpose IP address according to each routing iinformation
Block chain node;
Second receiving module 406, for receiving the report that executes of the corresponding block chain node return of each purpose IP address, and
It is saved in the report list of itself.
Further, determining module 403 includes:
First generation unit, it is raw for being changed by genetic algorithm to the data parameters in obtained request use-case
At test use cases one;
Second generation unit, the use-case type in request use-case and use-case rule base for will obtain are combined
Match, generates test use cases two;Wherein, the use-case type in use-case rule base includes being not limited to: environment error rule use-case is total to
Know algorithm message rule use-case, common recognition algorithm role rule use-case, common recognition state rule use-case;
Further, the second generation unit includes:
Subelement is generated, for passing through Pairwise algorithm to the use-case class in obtained request use-case and use-case rule base
Type is combined, and generates test use cases two.
Further, test use cases are passed through each purpose IP address according to each routing iinformation and corresponded to by transparent transmission module 405
Block chain node before, described device further include:
Signature unit, if the common recognition request for receiving uses preset key pair test use cases containing signature
Again it signs.
Further, the second receiving module 405 includes:
Receiving unit receives block chain node return for being directed to the corresponding block chain node of each purpose IP address
The test result of test case, when the test result is the block chain node test case that implementation of test cases is concentrated one by one
Every executed sends after a test case;
Second combining unit, the test knot for each test case that the test case for returning to the block chain node is concentrated
Implementing result of the union of fruit as the block chain node.
After describing the link aggregation method and device of the application illustrative embodiments, next, introducing basis
The computing device of the another exemplary embodiment of the application.
Person of ordinary skill in the field it is understood that the various aspects of the application can be implemented as system, method or
Program product.Therefore, the various aspects of the application can be with specific implementation is as follows, it may be assumed that complete hardware embodiment, complete
The embodiment combined in terms of full Software Implementation (including firmware, microcode etc.) or hardware and software, can unite here
Referred to as circuit, " module " or " system ".
In some possible embodiments, according to an embodiment of the present application, computing device can include at least at least one
A processor and at least one processor.Wherein, memory is stored with program code, when program code is executed by processor
When, so that processor executes knowing together according to the block chain of the various illustrative embodiments of the application for this specification foregoing description and calculates
Step 301-305 in method test method.
The computing device 50 of this embodiment according to the application is described referring to Fig. 5.The calculating dress that Fig. 5 is shown
Setting 50 is only an example, should not function to the embodiment of the present application and use scope bring any restrictions.The computing device
Such as can be mobile phone, tablet computer etc..
As shown in figure 5, computing device 50 is showed in the form of general-purpose calculating appts.The component of computing device 50 may include
But it is not limited to: at least one above-mentioned processor 51, above-mentioned at least one processor 52, (including the storage of the different system components of connection
Device 52 and processor 51) bus 53.
Bus 53 indicates one of a few class bus structures or a variety of, including memory bus or Memory Controller,
Peripheral bus, processor or the local bus using any bus structures in a variety of bus structures.
Memory 52 may include the readable medium of form of volatile memory, such as random access memory (RAM) 521
And/or cache memory 522, it can further include read-only memory (ROM) 523.
Memory 52 can also include program/utility 525 with one group of (at least one) program module 524, this
The program module 524 of sample includes but is not limited to: operating system, one or more application program, other program modules and journey
It may include the realization of network environment in ordinal number evidence, each of these examples or certain combination.
Computing device 50 can also be communicated with one or more external equipments 54 (such as sensing equipment etc.), can also be with one
Or it is multiple enable a user to the equipment interacted with computing device 50 communication, and/or with enable the computing device 50 and one
Or any equipment (such as router, modem etc.) communication that a number of other computing devices are communicated.This communication
It can be carried out by input/output (I/O) interface 55.Also, computing device 50 can also pass through network adapter 56 and one
Or multiple networks (such as local area network (LAN), wide area network (WAN) and/or public network, such as internet) communication.As schemed
Show, network adapter 56 is communicated by bus 53 with other modules for computing device 50.It will be appreciated that though not showing in figure
Out, other hardware and/or software module can be used in conjunction with computing device 50, including but not limited to: microcode, device drives
Device, redundant processor, external disk drive array, RAID system, tape drive and data backup storage system etc..
In some possible embodiments, the various aspects of block chain provided by the present application common recognition test of heuristics method are also
It can be implemented as a kind of form of program product comprising program code, when program product is run on a computing device, journey
The area according to the various illustrative embodiments of the application that sequence code is used to that computer equipment to be made to execute this specification foregoing description
Step in block chain common recognition test of heuristics method, executes step 301-305 as shown in Figure 3.
Program product can be using any combination of one or more readable mediums.Readable medium can be readable signal Jie
Matter or readable storage medium storing program for executing.Readable storage medium storing program for executing for example may be-but not limited to-electricity, magnetic, optical, electromagnetic, infrared
The system of line or semiconductor, device or device, or any above combination.The more specific example of readable storage medium storing program for executing is (non-
The list of exhaustion) include: electrical connection with one or more conducting wires, portable disc, hard disk, random access memory (RAM),
Read-only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, the read-only storage of portable compact disc
Device (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
The block chain common recognition test of heuristics of the application embodiment can use portable compact disc read only memory
(CD-ROM) it and including program code, and can run on the computing device.However, the program product of the application is without being limited thereto,
In this document, readable storage medium storing program for executing can be any tangible medium for including or store program, which can be commanded and hold
Row system, device or device use or in connection.
Readable signal medium may include in a base band or as the data-signal that carrier wave a part is propagated, wherein carrying
Readable program code.The data-signal of this propagation can take various forms, including --- but being not limited to --- electromagnetism letter
Number, optical signal or above-mentioned any appropriate combination.Readable signal medium can also be other than readable storage medium storing program for executing it is any can
Read medium, the readable medium can send, propagate or transmit for by instruction execution system, device or device use or
Program in connection.
The program code for including on readable medium can transmit with any suitable medium, including --- but being not limited to ---
Wirelessly, wired, optical cable, RF etc. or above-mentioned any appropriate combination.
Can with any combination of one or more programming languages come write for execute the application operation program
Code, programming language include object oriented program language-Java, C++ etc., further include conventional process
Formula programming language-such as " C " language or similar programming language.Program code can be calculated fully in user
It executes on device, partly execute on a user device, executing, as an independent software package partially in user's computing device
Upper part executes on remote computing device or executes on remote computing device or server completely.It is being related to remotely counting
In the situation for calculating device, remote computing device can pass through the network of any kind --- including local area network (LAN) or wide area network
(WAN)-it is connected to user's computing device, or, it may be connected to external computing device (such as provided using Internet service
Quotient is connected by internet).
It should be noted that although being referred to several unit or sub-units of device in the above detailed description, this stroke
It point is only exemplary not enforceable.In fact, according to presently filed embodiment, it is above-described two or more
The feature and function of unit can embody in a unit.Conversely, the feature and function of an above-described unit can
It is to be embodied by multiple units with further division.
In addition, although in the accompanying drawings sequentially to describe the operation of the application method, this does not require that or implies
These operations must be sequentially executed according to this, or have to carry out operation shown in whole and be just able to achieve desired result.It is attached
Add ground or it is alternatively possible to omit certain steps, multiple steps are merged into a step and are executed, and/or by a step point
Solution is execution of multiple steps.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with side
In the computer-readable memory of formula work, so that it includes instruction dress that instruction stored in the computer readable memory, which generates,
The manufacture set, the command device are realized in one box of one or more flows of the flowchart and/or block diagram or multiple
The function of being specified in box.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.
Although the preferred embodiment of the application has been described, it is created once a person skilled in the art knows basic
Property concept, then additional changes and modifications can be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as
It selects embodiment and falls into all change and modification of the application range.
Obviously, those skilled in the art can carry out various modification and variations without departing from the essence of the application to the application
Mind and range.In this way, if these modifications and variations of the application belong to the range of the claim of this application and its equivalent technologies
Within, then the application is also intended to include these modifications and variations.