Message processing method and device, electronic equipment and storage medium

By introducing message processing methods of shadow nodes and control nodes into the node test system, the existing BFT consensus algorithm testing methods are solved, and other problems such as large code processing workload, large code intrusion, and lack of global control are achieved, precise simulation and global control of abnormal node behavior are achieved, and testing efficiency is improved.

CN119892645APending Publication Date: 2025-04-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311380663.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-24
Publication Date
2025-04-25

Smart Images

  • Figure CN119892645A_ABST
    Figure CN119892645A_ABST
Patent Text Reader

Abstract

The invention relates to a message processing method and device, electronic equipment and a storage medium, and relates to the technical field of distributed systems.The method comprises the steps that a first node message sent by a first test node is received based on a second shadow node; sending the first node message to the control node based on the second shadow node; based on the control node, performing message processing on the first node message to obtain a second node message; receiving a second node message sent by the control node based on the first shadow node; based on the first shadow node, the second node message is sent to the second test node, the node consensus address corresponding to the first shadow node is the same as the node consensus address of the first test node, and the node consensus address corresponding to the second shadow node is the same as the node consensus address of the second test node. By utilizing the embodiment of the invention, the test efficiency can be improved, the abnormal operation code of the abnormal node can be reused to the greatest extent, and meanwhile, the real production environment can be restored to the greatest extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of distributed systems, and in particular to a message processing method, device, electronic device and storage medium. Background Art

[0002] There are currently two ideas for testing the BFT (Byzantium Fault Tolerance) consensus algorithm: one is to simulate the behavior of Byzantine nodes, that is, to simulate nodes to establish a network connection directly with the test nodes, and to simulate nodes to intentionally do evil through the message protocol, such as double signatures for proposals, double signatures for votes, and intentional downtime. The second is to construct twin nodes for some test nodes and simulate Byzantine behavior by controlling network partitions. The so-called twin node is a real node that shares a digital identity with the test node. Both the test node and its twin node run the consensus algorithm normally and execute the rules defined in the message protocol. In addition, the existence of twin nodes is transparent to each other, and the proposals and votes of the nodes themselves are random (such as proposal content, timestamps, digital signatures, etc.). Therefore, for other nodes, a pair of twin nodes may intentionally do evil. Improve the test coverage by traversing multiple possible partition situations. However, the first solution mentioned above has the following problems: it is necessary to simulate the behavior of nodes, and the code processing workload is large; it is highly invasive to the code, which is not conducive to code maintenance; it lacks global control and is difficult to accurately control the test process. Secondly, the second solution mentioned above has the following problems: the number of possible network partitions is large, the testing time is long, and the behavior of some Byzantine nodes cannot be constructed deterministically. Summary of the invention

[0003] In view of the above-mentioned technical problems, the present disclosure proposes a message processing method, device, electronic device and storage medium.

[0004] According to one aspect of an embodiment of the present disclosure, a message processing method is provided, which is applied to a node test system, wherein the node test system includes a first shadow node corresponding to a first test node, a second shadow node corresponding to a second test node, and a control node, wherein a node consensus address corresponding to the first shadow node is the same as a node consensus address of the first test node, and a node consensus address corresponding to the second shadow node is the same as a node consensus address of the second test node; the method includes:

[0005] receiving a first node message sent by the first test node based on the second shadow node; the first node message is a network message sent by the first test node to the second test node;

[0006] Based on the second shadow node, sending the first node message to the control node;

[0007] Based on the control node, performing message processing on the first node message to obtain a second node message;

[0008] Receiving the second node message sent by the control node based on the first shadow node;

[0009] Based on the first shadow node, the second node message is sent to the second test node.

[0010] According to another aspect of an embodiment of the present disclosure, a message processing device is provided, which is arranged in a node test system, wherein the node test system includes a first shadow node corresponding to a first test node, a second shadow node corresponding to a second test node, and a control node, wherein a node consensus address corresponding to the first shadow node is the same as a node consensus address of the first test node, and a node consensus address corresponding to the second shadow node is the same as a node consensus address of the second test node, and the device includes:

[0011] A first message receiving module, configured to receive a first node message sent by the first test node based on the second shadow node; the first node message is a network message sent by the first test node to the second test node;

[0012] A first message sending module, configured to send the first node message to the control node based on the second shadow node;

[0013] A first message processing module, configured to perform message processing on the first node message based on the control node to obtain a second node message;

[0014] A second message receiving module, configured to receive the second node message sent by the control node based on the first shadow node;

[0015] The second message sending module is used to send the second node message to the second test node based on the first shadow node.

[0016] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the above-mentioned message processing method.

[0017] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the above-mentioned message processing method.

[0018] According to another aspect of an embodiment of the present disclosure, a computer program product including instructions is provided, and when the computer program product is run on a computer, the computer is enabled to execute the above-mentioned message processing method.

[0019] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0020] Based on the second shadow node, the first node message sent by the first test node is received. The node consensus address corresponding to the second shadow node is the same as the node consensus address of the second test node. The first test node cannot detect the existence of the second shadow node. Then, based on the second shadow node, the first node message is sent to the control node. Based on the control node, the first node message is processed to obtain the second node message. The abnormal operation of the abnormal node can be simulated through message processing, so that the timing of the abnormal operation can be accurately controlled, the simulated abnormal operation can be globally controlled in a fine-grained manner, and the abnormal operation code of the abnormal node can be reused to the greatest extent. Then, based on the first shadow node, the second node message sent by the control node is received. Based on the first shadow node, the second node message is sent to the second test node. The node consensus address corresponding to the first shadow node is the same as the node consensus address of the first test node. The second test node cannot detect the existence of the first shadow node, and the test node cannot detect the existence of the control node, which can restore the real production environment to the greatest extent. In addition, there is almost zero intrusion on the program code of the test node, especially the code of the consensus algorithm itself, which can reduce the workload and implementation difficulty and improve the test efficiency.

[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0023] Figure 1 It is an optional structural diagram of a distributed system applied to a blockchain system according to an exemplary embodiment;

[0024] Figure 2 is an optional schematic diagram showing a block structure according to an exemplary embodiment;

[0025] Figure 3 It is a structural diagram of a consensus algorithm testing system provided by an embodiment of the present invention;

[0026] Figure 4is a flowchart of a message processing method according to an exemplary embodiment;

[0027] Figure 5 is a schematic diagram of an internal logic of a control node according to an exemplary embodiment;

[0028] Figure 6 is a schematic diagram of a handshake connection interaction process of a consensus layer according to an exemplary embodiment;

[0029] Figure 7 is a schematic diagram of a message sending process in a message processing method according to an exemplary embodiment;

[0030] Figure 8 is an interactive schematic diagram of a message processing method according to an exemplary embodiment;

[0031] Fig. 9 is a structural block diagram of a message processing device according to an exemplary embodiment;

[0032] Fig.10 is a block diagram of an electronic device for processing node messages according to an exemplary embodiment;

[0033] Fig.11 It is a block diagram of an electronic device for processing node messages according to an exemplary embodiment. DETAILED DESCRIPTION

[0034] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0035] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0036] In addition, in order to better illustrate the present application, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.

[0037] At present, there are the following problems in testing by simulating nodes: the behavior of nodes needs to be simulated, which is usually done by modifying the normal node code or independently implementing a simulated node program. The program mainly realizes node maliciousness by modifying the message processing rules in the message protocol, such as double signing, downtime (deliberately not replying to messages), etc., and the code processing workload is large; the code invasion is large, which is not conducive to code maintenance, especially when the normal node code is directly modified. The modified code will introduce uncertainty or even security vulnerabilities to the algorithm implementation itself; the consensus algorithm usually includes multiple rounds of voting and asynchronous or semi-synchronous message processing processes of multiple nodes. The simulated node can only control the control flow of the node itself, and cannot determine the control flow of the normal node. Therefore, it is difficult to construct some complex test scenarios, which leads to a lack of global control and difficulty in accurately controlling the test process. In addition, the following problems will arise when constructing twin nodes: there are a large number of possible network partition situations and a long testing time. When the number of nodes is large, the number of network partition situations will surge and the testing time will also surge. This scheme can only control network partitions so that the existence of twin nodes may introduce Byzantine node behavior. Therefore, the scheme itself has a relatively high degree of uncertainty, resulting in that even if the test finds an algorithm vulnerability, it is difficult or impossible to reproduce it, resulting in the inability to deterministically construct some Byzantine node behaviors.

[0038] The system involved in the embodiment of the present invention may be a distributed system formed by connecting a client and multiple nodes (any form of computing devices in the access network, such as servers and user terminals) through network communication. A distributed system may refer to a loosely coupled system consisting of multiple processors interconnected by communication lines. With the rapid development of the Internet, distributed systems have been widely used in various fields. For example, taking a game scene as an example, a distributed system applied to a game scene may be composed of multiple servers, which may be distributed in different geographical locations; this architecture can provide better performance and scalability, and provide better fault tolerance and user experience.

[0039] Take the distributed system as the blockchain system as an example, see Figure 1 , Figure 1 This is an optional structural diagram of the distributed system 100 provided by the embodiment of the present invention applied to the blockchain system. It is formed by multiple nodes (any form of computing devices in the access network, such as servers, user terminals) and clients, and a point-to-point network is formed between the nodes. The point-to-point protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In a distributed system, any machine such as a server or a terminal can join and become a node. The node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0040] See also Figure 1 The functions of each node in the blockchain system shown include:

[0041] 1) Routing: a basic function of a node, used to support communication between nodes.

[0042] In addition to the routing function, the node can also have the following functions:

[0043] 2) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.

[0044] For example, the services implemented by the application include:

[0045] 2.1) Wallet, used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After the other nodes successfully verify the transaction, as a response to acknowledge the validity of the transaction, the transaction record data is stored in the temporary block of the blockchain; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;

[0046] 2.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data. The record data of the operation on the account data is sent to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.

[0047] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.

[0048] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.

[0049] See also Figure 2 , Figure 2This is an optional schematic diagram of the block structure provided by an embodiment of the present invention. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.

[0050] See also Figure 3 , Figure 3 Schematic diagram of a consensus algorithm testing system provided by an embodiment of the present invention. Figure 3 As shown, the consensus algorithm test system may include multiple test nodes and a node test system. Among them, the test node may refer to the node being tested. The node test system may include a control node and shadow nodes corresponding to each of the above multiple test nodes. Shadow nodes can be used to forward node messages. The control node can be used to process node messages. Each test node can establish a connection with other shadow nodes other than its own shadow node. Any test node can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The node test system may include at least one test server; specifically, each node in the node test system may be an independent server, and multiple nodes in the node test system may also correspond to one test server, or some nodes in the node test system may correspond to one test server, which is not limited by the present disclosure. The above-mentioned test server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.

[0051] Specifically, Figure 4 FIG. 1 is a flow chart of a message processing method according to an exemplary embodiment. Figure 4 As shown, the message processing method can be applied to electronic devices such as a node test system. The node test system may include a first shadow node corresponding to a first test node, a second shadow node corresponding to a second test node, and a control node. Specifically, the following steps may be included:

[0052] S401: Receive a first node message sent by a first test node based on a second shadow node.

[0053] In a specific embodiment, the node consensus address corresponding to the first shadow node is the same as the node consensus address of the first test node; the node consensus address corresponding to the second shadow node is the same as the node consensus address of the second test node.

[0054] In a specific embodiment, the first node message may refer to a network message sent by the first test node to the second test node. The first node message may include a first node network address, a second node network address, and a first consensus message. Among them, the first node network address may refer to the node network address corresponding to the first test node. The second node network address may refer to the node network address corresponding to the second shadow node. The first consensus message may include a first node consensus address, a second node consensus address, a first consensus description information, and a first message digital signature. The first node consensus address may refer to the node consensus address of the first test node or the first shadow node. The second node consensus address may refer to the node consensus address of the second test node or the second shadow node. The first consensus description information may characterize the message content in the first consensus message. The first message digital signature may be used to verify the node consensus address and consensus description information in the first consensus message to ensure the integrity of the message. Specifically, when the first test node belongs to the master node, the first consensus description information may include description information for the proposal; when the first test node belongs to the non-master node, the first consensus description information may include description information for voting.

[0055] In a specific embodiment, the node consensus address of any node can be used as the node unique identifier of any of the above nodes in the consensus algorithm implementation layer; the node network address of any node can be used as the node unique identifier of any of the above nodes in the network layer. It is understandable that in a node network, different nodes need to use different network addresses, but different nodes can use the same node consensus address. Exemplarily, in a blockchain system, the signature address used when the node generates a block is isolated from the network address of the node joining the network, so as to achieve hot replacement of the node block signature address.

[0056] In a specific embodiment, during the consensus algorithm testing process for a distributed system, the first test node can obtain the second node network address locally based on the second node consensus address; then, the first test node can encapsulate the first consensus message into a first node message; then, the first test node can send the first node message to the second shadow node based on the second node network address.

[0057] In a specific embodiment, the first test node can generate a first consensus message based on the first node consensus address, the second node consensus address, the first consensus description information and the first message digital signature; then, the first test node can use the first consensus message as the message payload of the first node message, combined with the first node network address and the second node network address, to generate the first node message. Specifically, in the process of the first test node generating the first consensus message, the first node consensus address can be used as the sending node consensus address in the first consensus message, and the second node consensus address can be used as the receiving node consensus address in the first consensus message. In the process of the first test node generating the first node message, the first node network address can be used as the sending node network address, and the second node network address can be used as the receiving node network address. Among them, the receiving node consensus address in any node message can refer to the consensus address of the node receiving any of the above node messages. The sending node consensus address in any node message can refer to the consensus address of the node sending any of the above node messages. The receiving node network address in any node message can refer to the network address of the node receiving any of the above node messages. The sending node network address in any node message can refer to the network address of the node sending any of the above node messages.

[0058] S403: Based on the second shadow node, send the first node message to the control node.

[0059] In a specific embodiment, when the second shadow node receives the first node message sent by the first test node, the second shadow node may forward the first node message to the control node.

[0060] S405: Based on the control node, perform message processing on the first node message to obtain a second node message.

[0061] In a specific embodiment, the second node message may refer to a network message that needs to be sent to the second test node after being processed by the control node.

[0062] In a specific embodiment, the above step S405 may include:

[0063] When the first node message meets the preset modification conditions, the consensus description information in the first node message is modified based on the control node to obtain the second node message.

[0064] In a specific embodiment, the preset modification condition may refer to a condition under which the node message needs to be modified. Specifically, the preset modification condition may be set according to actual application needs. Exemplarily, the preset modification condition may include that any parameter in the first node message matches the preset parameter.

[0065] In a specific embodiment, when the first node message satisfies the preset modification condition, based on the control node, the consensus description information in the first node message is modified to obtain the second node message, which may include:

[0066] Based on the control node, matching the target node consensus address in the first node message with at least one preset reference consensus address to obtain a first matching result;

[0067] Based on the control node, taking the preset reference consensus address corresponding to the first matching result in at least one preset reference consensus address as the target reference consensus address;

[0068] Based on the control node, the consensus description information in the first node message is modified to the preset reference description information corresponding to the target reference consensus address to obtain the second node message.

[0069] In a specific embodiment, the target node consensus address may include a first node consensus address and a second node consensus address.

[0070] In a specific embodiment, at least one preset reference consensus address may include one or more of at least one receiving reference consensus address and at least one sending reference consensus address. The receiving reference consensus address may refer to the receiving node consensus address corresponding to the node message that needs to be modified; the sending reference consensus address may refer to the sending node consensus address corresponding to the node message that needs to be modified. Specifically, the preset reference consensus address may be set according to actual application needs.

[0071] In a specific embodiment, the first matching result may be used to indicate a preset reference consensus address in at least one preset reference consensus address that matches the target node consensus address in the first node message.

[0072] In a specific embodiment, the control node may match the target node consensus address in the first node message with at least one preset reference consensus address to obtain a first matching result. Specifically, the control node may match each node consensus address in the target node consensus address with each preset reference consensus address to obtain the first matching result.

[0073] In a specific embodiment, the target reference consensus address may refer to a preset reference consensus address in at least one preset reference consensus address that matches the target node consensus address in the first node message. The target reference consensus address may include a receiving reference consensus address or a sending reference consensus address.

[0074] In a specific embodiment, the preset reference description information can be used as a reference for the control node to modify the consensus description information.

[0075] In a specific embodiment, the control node may select a preset reference consensus address corresponding to the first matching result from at least one preset reference consensus address as the target reference consensus address.

[0076] In a specific embodiment, the control node may select the preset reference description information corresponding to the target reference consensus address from a plurality of preset reference description information, and based on the preset reference description information corresponding to the target reference consensus address, modify the consensus description information in the first node message to obtain the second node message. Specifically, the control node may modify the consensus description information in the first node message to the preset reference description information corresponding to the above-mentioned target reference consensus address.

[0077] In the above embodiment, the consensus description information can be modified by the control node to simulate the abnormal operation of the abnormal node. For example, the node's proposal double signature operation or double proposal and other abnormal operations can be simulated.

[0078] In a specific embodiment, the above step S405 may further include:

[0079] In the case that the first node message does not meet the preset modification condition, the first node message is used as the second node message based on the control node.

[0080] In a specific embodiment, the control node may use the first node message as the second node message when the first node message does not meet the preset modification condition, and send the second node message to the first shadow node.

[0081] In the above embodiment, by using the first node message as the second node message based on the control node when the first node message does not meet the preset modification condition, the simulation of the message sending operation of the normal node can be achieved.

[0082] In a specific embodiment, before the above step S405, the above method may further include:

[0083] Based on the control node, matching the first node message with at least one preset filtering condition to obtain a second matching result;

[0084] When the second matching result indicates that the first node message satisfies any preset filtering condition, the first node message is filtered based on the control node.

[0085] In a specific embodiment, the preset filtering condition can be used as a reference for the node message to be filtered. Specifically, the preset filtering condition can be set according to the actual application needs. Exemplarily, the preset filtering condition can include any parameter in the first node message matching the preset parameter. The preset filtering condition can have different granularities.

[0086] In a specific embodiment, the second matching result may be used to indicate whether the first node message satisfies a preset filtering condition.

[0087] In a specific embodiment, the control node may perform matching processing on the first node message and each preset filtering condition to obtain a second matching result.

[0088] In a specific embodiment, the control node may filter the first node message if the second matching result indicates that a parameter in the first node message satisfies one or more of at least one preset filtering condition.

[0089] In a specific embodiment, the matching process of the first node message and at least one preset filtering condition based on the control node to obtain the second matching result may include:

[0090] Based on the control node, the target node consensus address in the first node message is matched with the preset blacklist address to obtain a third matching result;

[0091] Based on the control node, the consensus address of the target node is matched with the preset whitelist address to obtain a fourth matching result;

[0092] A second matching result is generated based on the control node, the third matching result, and the fourth matching result.

[0093] In a specific embodiment, the preset blacklist address may refer to the node consensus address corresponding to the node message that needs to be intercepted. The preset blacklist address may include at least one preset node consensus address. Specifically, the preset node consensus address can be set according to actual application needs, and the present disclosure does not limit it.

[0094] In a specific embodiment, the third matching result can be used to indicate whether any node consensus address in the target node consensus address belongs to a preset blacklist address.

[0095] In a specific embodiment, the control node may match any node consensus address in the target node consensus address with each preset node consensus address in the preset blacklist address to obtain a third matching result.

[0096] In a specific embodiment, the preset whitelist address may refer to a node consensus address of a node message that the control node can forward. The preset whitelist address may include at least one preset node consensus address. Specifically, the preset node consensus address may be set according to actual application needs, and the present disclosure does not limit it.

[0097] In a specific embodiment, the fourth matching result can be used to indicate whether there is a node consensus address in the target node consensus address that belongs to a preset whitelist address.

[0098] In a specific embodiment, the control node may match any node consensus address in the target consensus node address with each preset node consensus address in the preset whitelist address to obtain a fourth matching result.

[0099] In a specific embodiment, the control node may generate a second matching result based on the third matching result and the fourth matching result. The second matching result may include a fifth matching result and a sixth matching result. The fifth matching result may be used to indicate that the first node message does not meet the preset filtering condition; the sixth matching result may be used to indicate that the first node message meets the preset filtering condition. Specifically, the control node indicates that no node consensus address in the target node consensus address belongs to the preset blacklist address in the third matching result, and the fourth matching result indicates that there is a node consensus address in the target node consensus address that belongs to the preset whitelist address, and the second matching result may be determined to be the fifth matching result; correspondingly, the control node indicates that there is a node consensus address in the target node consensus address that belongs to the preset blacklist address in the third matching result, or the fourth matching result indicates that no node consensus address in the target node consensus address belongs to the preset whitelist address, and the second matching result may be determined to be the sixth matching result.

[0100] In a specific embodiment, the control node may forward the first node message to the first shadow node when the second matching result is the fifth matching result; the control node may filter the first node message when the second matching result is the sixth matching result.

[0101] In the above embodiment, based on the control node, the target node consensus address in the first node message is matched with the preset blacklist address to obtain a third matching result, based on the control node, the target node consensus address is matched with the preset whitelist address to obtain a fourth matching result, and based on the control node, the third matching result and the fourth matching result, a second matching result is generated, and the target node consensus address can be matched with the preset whitelist address and the preset blacklist address to achieve the simulation of the network partition situation in the multi-node system. Furthermore, more fine-grained partitioning can be achieved by specifying the preset filtering conditions to a certain round or the sequence number of a certain proposal.

[0102] In a specific embodiment, after the above step S405, the above method may further include:

[0103] When the second node message is empty, the second node message is filtered based on the control node.

[0104] In a specific embodiment, the control node may indicate that the first node message and the corresponding second node message need to be filtered out and not forwarded if the second node message is empty. Accordingly, the control node may filter the second node message if the second node message is empty.

[0105] In a specific embodiment, Figure 5 FIG. 1 is a schematic diagram showing the internal logic of a control node according to an exemplary embodiment. Figure 5 As shown, the control node may include a controller, a router, and a processor. The controller may be used to realize the network connection with the shadow node, integrate the internal logic implementation of the control node, and manage the entire life cycle of the control node. The router may be used to realize the routing processing of the node message. The processor may be used to realize the message processing of the node message. Specifically, the first node message sent by the second shadow node can be received by the controller in the control node; the controller can send the first node message to the router; after receiving the first node message, the router can match the first node message and at least one preset filtering condition to obtain a second matching result, and return the second matching result to the controller; after receiving the second matching result, the controller filters the first node message when the second matching result indicates that the first node message satisfies any preset filtering condition; when the controller receives the second matching result indicating that the first node message does not satisfy any preset filtering condition, the controller sends the first node message to the processor; when the processor receives the first node message, the processor processes the first node message to obtain a second node message, and returns the second node message to the controller; when the controller receives the second node message, the controller checks whether the second node message is empty; accordingly, when the controller is not empty, the second node message can be forwarded to the first shadow node.

[0106] In a specific embodiment, the processor in the controller can be an abstract processor interface of the controller. Specifically, all objects that implement the interface can be added to the processor chain of the controller, and the controller will call the processors in the order in which they are added. Furthermore, the processor can modify and intercept the transmitted messages at will.

[0107] In the above embodiment, based on the control node, the first node message is processed to obtain the second node message. The existence of the control node enables global control, including network routing, node message receiving order, coordination of faults between abnormal nodes, etc., so that more and finer-grained abnormal operations can be simulated more accurately.

[0108] S407: Receive a second node message sent by the control node based on the first shadow node.

[0109] In a specific embodiment, when the control node obtains the second node message through message processing, it can determine that the second node message needs to be sent to the first shadow node corresponding to the first test node based on the sending node consensus address in the second node message. Accordingly, the control node can send the second node message to the first shadow node. When the first shadow node and the control node are connected through a network, the first shadow node can receive the second node message sent by the control node.

[0110] S409: Based on the first shadow node, send the second node message to the second test node.

[0111] In a specific embodiment, when the first shadow node and the second test node are connected through a network, the first shadow node can send the second node message to the second test node based on the receiving node consensus address in the second node message. Specifically, the first shadow node can obtain the fourth node network address corresponding to the second test node locally, and send the second node message to the second test node based on the fourth node network address. The fourth node network address can refer to the node network address of the second test node.

[0112] In the above embodiment, based on the second shadow node, a first node message sent by the first test node is received; based on the second shadow node, the first node message is sent to the control node; based on the control node, the first node message is processed to obtain a second node message; based on the first shadow node, a second node message sent by the control node is received; based on the first shadow node, the second node message is sent to the second test node. There is no need to build a simulation node, that is, there is no need to change the algorithm of the test node to simulate the operation of the abnormal node. The impact of the test on the algorithm implementation itself can be greatly reduced, and the code workload of the test is also smaller. At the same time, the uncertainty of the occurrence of abnormal situations can be reduced, and the reproduction of the test scenario can be more easily controlled.

[0113] In a specific embodiment, before the above step S409, the above method may further include:

[0114] Receiving a first handshake connection instruction sent by the first test node based on the second shadow node;

[0115] Based on the second shadow node and the first node network address, return a first accept handshake instruction to the first test node;

[0116] When the first confirmation handshake instruction returned by the first test node is received, the first node network address is stored based on the second shadow node.

[0117] In a specific embodiment, the first handshake connection instruction may include a first node network address corresponding to the first test node. The first handshake connection instruction may be used to request a handshake connection at the network layer from the second shadow node.

[0118] In a specific embodiment, the first test node can obtain the second node network address of the second shadow node from a preset configuration file. The first test node can generate a first handshake connection instruction based on the second node network address and the first node network address, and send the first handshake connection instruction to the second shadow node. Among them, the second node network address may refer to the node network address of the second shadow node. Specifically, each test node corresponding configuration file can be pre-configured; the configuration file corresponding to each test node may include the node network address of each associated shadow node corresponding to each of the above test nodes. Among them, the associated shadow node corresponding to any test node may refer to a shadow node other than the shadow node corresponding to any of the above test nodes.

[0119] In a specific embodiment, upon receiving the first handshake connection instruction, the second shadow node may return a first accept handshake instruction carrying the second node network address to the first test node based on the first node network address.

[0120] In a specific embodiment, when the first test node receives the first acceptance handshake instruction, it checks and processes the second node network address in the first acceptance handshake instruction; after the check and confirmation are correct, the first test node can send a first confirmation handshake instruction to the second shadow node and store the second node network address locally.

[0121] In a specific embodiment, when the second shadow node receives the first confirmation handshake instruction returned by the first test node, it can store the first node network address locally.

[0122] In a specific embodiment, in a consensus algorithm testing system, the process of establishing a network connection between any test node and a shadow node other than the shadow node corresponding to any of the above-mentioned test nodes can refer to the process of establishing a network connection between the above-mentioned second shadow node and the first test node, and the present disclosure will not repeat it.

[0123] In the above embodiment, the first handshake connection instruction sent by the first test node is received by the second shadow node, and based on the second shadow node and the first node network address, the first acceptance handshake instruction is returned to the first test node. When the first confirmation handshake instruction returned by the first test node is received, the first node network address is stored based on the second shadow node, so that the network connection between the second shadow node and the first test node can be established.

[0124] In a specific embodiment, in the case of receiving the first confirmation handshake instruction returned by the first test node, after storing the first node network address based on the second shadow node, the method may further include:

[0125] Receiving a second handshake connection instruction sent by the first test node based on the second shadow node;

[0126] Based on the second shadow node and the first node network address, return a second accept handshake instruction to the first test node, so that the first test node checks the second node consensus address in the second accept handshake instruction;

[0127] When the second confirmation handshake instruction returned by the first test node is received, a mapping relationship between the first node consensus address and the first node network address is generated based on the second shadow node, and the mapping relationship is stored.

[0128] In a specific embodiment, the second handshake connection instruction may include the first node consensus address. The second handshake connection instruction may be used to request a handshake connection at the consensus layer from the second shadow node.

[0129] In a specific embodiment, when the first test node establishes a network connection with the second shadow node, the first test node may send a second handshake connection instruction carrying the consensus address of the first node to the second shadow node. Specifically, the first test node may obtain the second node network address locally, and based on the second node network address, send the second handshake connection instruction carrying the consensus address of the first node to the second shadow node.

[0130] In a specific embodiment, when the second shadow node receives the second handshake connection instruction sent by the first test node, it can return a second acceptance handshake instruction carrying the second node consensus address to the first test node based on the first node network address.

[0131] In a specific embodiment, when the first test node receives the second accept handshake instruction carrying the consensus address of the second node, it can check and process the consensus address of the second node; after checking and confirming that it is correct, the first test node can send a second confirmation handshake instruction to the second shadow node, and then, a mapping relationship between the second node consensus address and the second node network address can be established and stored locally at the node. Specifically, the first test node can analyze the consensus address of the second shadow node based on the digital signature of the second shadow node carried in the second accept handshake instruction, obtain the predicted consensus address corresponding to the second shadow node, and compare the above predicted consensus address with the second node consensus address carried in the second accept handshake instruction to obtain a comparison result; when the above comparison result indicates that the predicted consensus address is consistent with the second node consensus address, it can be determined that the inspection is correct, and the first test node can send a second confirmation handshake instruction to the second shadow node.

[0132] In a specific embodiment, upon receiving the second confirmation handshake instruction returned by the first test node, the second shadow node can generate and store a mapping relationship between the first node consensus address and the first node network address.

[0133] In a specific embodiment, Figure 6 FIG. 1 is a schematic diagram of a consensus layer handshake connection interaction process according to an exemplary embodiment. Specifically, Figure 6 As shown, the first test node can send a second handshake connection instruction carrying the consensus address of the first node to the second shadow node; when the second shadow node receives the second handshake connection instruction sent by the first test node, it can return a second acceptance handshake instruction carrying the consensus address of the second node to the first test node based on the first node network address; when the first test node receives the second acceptance handshake instruction carrying the consensus address of the second node, it can check and process the consensus address of the second node; after checking and confirming that it is correct, the first test node can send a second confirmation handshake instruction to the second shadow node.

[0134] In a specific embodiment, in a consensus algorithm testing system, the process of handshaking at the consensus layer between any test node and a shadow node other than the shadow node corresponding to any of the above test nodes can refer to the process of handshaking at the consensus layer between the above-mentioned second shadow node and the first test node, and will not be repeated in this disclosure.

[0135] In the above embodiment, based on the second shadow node receiving the second handshake connection instruction sent by the first test node, based on the second shadow node and the first node network address, a second acceptance handshake instruction is returned to the first test node, so that the first test node checks the second node consensus address in the second acceptance handshake instruction, and when the second confirmation handshake instruction returned by the first test node is received, based on the second shadow node, a mapping relationship between the first node consensus address and the first node network address is generated, and the mapping relationship is stored, which can facilitate the subsequent message interaction between the first test node and the second shadow node, and the node message can be forwarded directly based on the node consensus address, thereby improving the test efficiency.

[0136] In a specific embodiment, the above step S409 may include:

[0137] When a network connection is established between the first shadow node and the second test node, a second node message is sent to the second test node.

[0138] In a specific embodiment, when a network connection is established between the first shadow node and the second test node and a consensus layer handshake is completed, the first shadow node can determine the fourth node network address corresponding to the second node consensus address based on the mapping relationship in the node local; accordingly, the first shadow node can send the second node message to the second test node based on the fourth node network address.

[0139] In a specific embodiment, for the consensus algorithm test system, all the test nodes in the system can be started first, and the test nodes can actively try to connect to the test nodes specified in the preset configuration file at regular intervals. Since the node network address of the test node specified in the preset configuration file is the node network address of the corresponding shadow node, the test node can actually actively try to connect to the shadow node corresponding to the test node specified in the preset configuration file at regular intervals. Next, start the shadow node in the system and wait for the connection of the test node and the control node; then, start the control node and actively connect all the shadow nodes; after the nodes in the system complete the handshake connection of the network layer and the consensus layer, the test nodes in the consensus algorithm test system can communicate through the physical path of "shadow node-control node-shadow node". Further, the control node can process the node messages between the test nodes through the router and the processor. It can be understood that since the message protocol determines the sending node of the message by the signature of the message, and the test node and its corresponding shadow node share the same digital identity (such as a pair of public and private keys), from the perspective of the test node, it is impossible to distinguish between the shadow node and the corresponding test node at the level of the message protocol.

[0140] In the above embodiment, the first test node sends a consensus message to the second test node, which is actually a network message, passing through the shadow node, the control node, the shadow node, and then to the test node. The consensus layer uses the network layer to implement the sending of consensus messages. From the perspective of the network layer, the first test node establishes a physical connection with the second shadow node, and the second test node establishes a physical connection with the first shadow node. The shadow node is responsible for forwarding network messages. In this mode, the production environment is restored to the greatest extent. The first test node and the second test node usually need to be deployed on different physical servers and establish a real physical connection, and there is basically no intrusion on the code of the test node itself.

[0141] In a specific embodiment, during the consensus algorithm test process for the consensus algorithm test system, the operation simulation of the abnormal node can be performed through the control node. Specifically, the first node message or the second node message can be filtered through the control node to simulate the operation of the abnormal node deliberately not sending a message; the node message sent by the first test node to the second test node can also be modified through the control node, while the node message sent by the first test node to the third test node and the fourth test node is not modified, so as to simulate the double proposal operation of the abnormal node.

[0142] In a specific embodiment, during the consensus algorithm test process for the consensus algorithm test system, the state query API (Application Programming Interface) provided by the test node itself can be used to query whether the state of the test node meets the security and activity of the Byzantine fault-tolerant algorithm. Among them, the security of the Byzantine fault-tolerant algorithm can mean that the proposals finally submitted by all non-Byzantine nodes are consistent. The activity of the Byzantine fault-tolerant algorithm can mean that the proposal consensus between non-Byzantine nodes can continue.

[0143] In a specific embodiment, the above method may further include:

[0144] Receiving a third node message sent by the second test node based on the first shadow node;

[0145] Based on the first shadow node, sending the third node message to the control node;

[0146] Based on the control node, performing message processing on the third node message to obtain a fourth node message;

[0147] Based on the second shadow node, receiving a fourth node message sent by the control node;

[0148] Based on the second shadow node, a fourth node message is sent to the first test node.

[0149] In a specific embodiment, the third node message may refer to a network message sent by the second test node to the first test node.

[0150] In a specific embodiment, the second test node can process the consensus message in the second node message to obtain a third node message when receiving the second node message sent by the first shadow node. Exemplarily, when the first test node is the master node, the first test node can first generate a proposal and generate a first node message based on the proposal; the first test node can send the node message to the second test node through the second shadow node, the control node and the first shadow node in sequence; when the second test node receives the node message, it can perform voting based on the proposal corresponding to the consensus message in the above node message to obtain the voting result; accordingly, the second test node can generate a third node message based on the above voting result; the second test node can obtain the third node network address corresponding to the first node consensus address based on the mapping relationship; the second test node can send the third node message to the first shadow node based on the above third node network address.

[0151] In a specific embodiment, the control node can process the third node message through the controller, the router and the processor to obtain the fourth node message. Specifically, the process of the control node processing the third node message can refer to the specific process of the above step S405, which will not be repeated in this disclosure.

[0152] In a specific embodiment, the control node may send the fourth node message to the second shadow node; the second shadow node may forward the fourth node message to the first test node.

[0153] In a specific embodiment, when the consensus algorithm test system also includes a third test node, the node message between the first test node and the third test node can be transmitted through the first shadow node corresponding to the first test node, the control node, and the third shadow node corresponding to the third test node. Specifically, the first test node can generate a fifth node message and send the fifth node message to the third shadow node; the third shadow node can forward the fifth node message to the control node when receiving the fifth node message; the control node can obtain a sixth node message by processing the fifth node message, and send the sixth node message to the first shadow node; the first shadow node can forward the sixth node message to the third test node when receiving the sixth node message.

[0154] In the above embodiment, based on the second shadow node receiving the first node message sent by the first test node, the node consensus address corresponding to the second shadow node is the same as the node consensus address of the second test node, and the first test node cannot detect the existence of the second shadow node. Then, based on the second shadow node, the first node message is sent to the control node. Based on the control node, the first node message is processed to obtain the second node message. Through the message processing, the simulation of the abnormal operation of the abnormal node can be realized, and then the timing of the abnormal operation can be accurately controlled, the simulated abnormal operation can be globally controlled in fine granularity, and the abnormal operation code of the abnormal node can be reused to the greatest extent. Then, based on the first shadow node receiving the second node message sent by the control node, based on the first shadow node, the second node message is sent to the second test node. The node consensus address corresponding to the first shadow node is the same as the node consensus address of the first test node. For the second test node, the existence of the first shadow node is not detected, and for the test node, the existence of the control node cannot be detected, and the real production environment can be restored to the greatest extent. In addition, there is almost zero intrusion on the program code of the test node, especially the code of the consensus algorithm itself, which can reduce the workload and implementation difficulty and improve the test efficiency. It can be understood that, at the test node end, the network topology has not changed, and the message communication method has not changed, that is, the shadow nodes of other test nodes are no different from the test nodes corresponding to the shadow node in front of the test node; the simulation of abnormal operations does not need to be carried out by modifying the test node program code, and the impact on the code implementation of the algorithm is almost zero; the simulation of abnormal operations does not need to be simulated by writing separate code, but only needs to modify or filter the consensus message in the control node, and the implementation difficulty and workload are relatively lower.

[0155] Figure 7 is a schematic diagram of a message sending process in a message processing method according to an exemplary embodiment. Figure 8 FIG. 1 is an interactive schematic diagram of a message processing method according to an exemplary embodiment. Figure 7 As shown, the solid line represents the actual sending line, and the dotted line represents the logical sending line. Specifically, when the first test node sends a message to the second test node, it will send the message to the second shadow node. The second shadow node will forward the message directly to the control node. When the control node determines that the message is sent from the first test node to the second shadow node, it will forward the message to the first shadow node. Finally, the message is sent from the first shadow node to the second test node. The second shadow node is considered to be the second test node in the program memory of the first test node. Similarly, the first shadow node is considered to be the first test node in the program memory of the second test node. Therefore, from the final effect, both the first test node and the second test node will acknowledge the fact that "the first test node sent a message to the second test node".

[0156] Specifically, Figure 8 As shown, the first test node can obtain the node network address of the second test node according to the node consensus address of the second test node. Here, the node network address of the second shadow node is obtained (in the consensus layer implementation, the first test node cannot be aware of the existence of the second shadow node), and the consensus message is encapsulated into a network message and sent to the second shadow node; the second shadow node can directly forward the network message to the control node; the control node can read the consensus message from the network message, and after being processed by the controller, router and processor in the control node, the consensus message is re-encapsulated into a network message. Here, the control node obtains the node network address of the corresponding shadow node according to the consensus address of the sending node in the consensus message, and sends the network message to the first shadow node; when the first shadow node receives the network message of the control node, it can obtain the consensus address of the sending node and the consensus address of the receiving node of the consensus message from the network message. After confirming that the consensus address of the sending node is the local consensus address, the node address of the corresponding test node can be obtained through the consensus address of the receiving node, which is the second test node here, and then the network message can be forwarded to the second test node; the second test node reads the consensus message from the received network message, and can confirm that the consensus message is sent by the first test node through the consensus address of the sending node.

[0157] Fig. 9 is a structural block diagram of a message processing device according to an exemplary embodiment. Fig. 9 , the device can be arranged in the above-mentioned node test system, and specifically can include:

[0158] The first message receiving module 910 may be used to receive a first node message sent by the first test node based on the second shadow node; the first node message is a network message sent by the first test node to the second test node;

[0159] A first message sending module 920 may be configured to send a first node message to a control node based on a second shadow node;

[0160] The first message processing module 930 may be configured to process the first node message based on the control node to obtain a second node message;

[0161] The second message receiving module 940 may be configured to receive a second node message sent by the control node based on the first shadow node;

[0162] The second message sending module 950 may be configured to send a second node message to a second test node based on the first shadow node.

[0163] In a specific embodiment, the first message processing module 930 may include:

[0164] The modification processing module can be used to modify the consensus description information in the first node message based on the control node to obtain the second node message when the first node message meets the preset modification conditions.

[0165] In a specific embodiment, the modification processing module may include:

[0166] The first matching module can be used to match the target node consensus address in the first node message with at least one preset reference consensus address based on the control node to obtain a first matching result; the target node consensus address includes a first node consensus address and a second node consensus address, the first node consensus address is a node consensus address corresponding to the first test node, and the second node consensus address is a node consensus address corresponding to the second test node;

[0167] The reference address acquisition module may be used to use, based on the control node, a preset reference consensus address corresponding to a first matching result in at least one preset reference consensus address as a target reference consensus address;

[0168] The description modification module can be used to modify the consensus description information in the first node message to the preset reference description information corresponding to the target reference consensus address based on the control node to obtain the second node message.

[0169] In a specific embodiment, the first message processing module 930 may include:

[0170] The second message processing module may be configured to, when the first node message does not satisfy a preset modification condition, use the first node message as the second node message based on the control node.

[0171] In a specific embodiment, the above device may further include:

[0172] A second matching module may be used to match the first node message with at least one preset filtering condition based on the control node to obtain a second matching result;

[0173] The first filtering module may be configured to filter the first node message based on the control node when the second matching result indicates that the first node message satisfies any preset filtering condition.

[0174] In a specific embodiment, the second matching module may include:

[0175] The third matching module can be used to match the target node consensus address in the first node message with the preset blacklist address based on the control node to obtain a third matching result; the target node consensus address includes the first node consensus address and the second node consensus address;

[0176] The fourth matching module can be used to match the target node consensus address with the preset whitelist address based on the control node to obtain a fourth matching result;

[0177] The matching result generating module may be configured to generate a second matching result based on the control node, the third matching result and the fourth matching result.

[0178] In a specific embodiment, the above device may further include:

[0179] The second filtering module may be used to filter the second node message based on the control node when the second node message is empty.

[0180] In a specific embodiment, the second message sending module 950 may include:

[0181] The third message sending module can be used to send the second node message to the second test node when a network connection is established between the first shadow node and the second test node.

[0182] In a specific embodiment, the above device may further include:

[0183] The first instruction receiving module may be used to receive a first handshake connection instruction sent by the first test node based on the second shadow node; the first handshake connection instruction includes a first node network address corresponding to the first test node;

[0184] A first instruction return module may be used to return a first accept handshake instruction to the first test node based on the second shadow node and the first node network address;

[0185] The address storage module can be used to store the first node network address based on the second shadow node when receiving the first confirmation handshake instruction returned by the first test node.

[0186] In a specific embodiment, the above device may further include:

[0187] A second instruction receiving module may be used to receive a second handshake connection instruction sent by the first test node based on the second shadow node; the second handshake connection instruction includes a first node consensus address;

[0188] A second instruction return module may be used to return a second accept handshake instruction to the first test node based on the second shadow node and the first node network address, so that the first test node checks the second node consensus address in the second accept handshake instruction;

[0189] The mapping relationship generation module can be used to generate a mapping relationship between the first node consensus address and the first node network address based on the second shadow node when receiving the second confirmation handshake instruction returned by the first test node, and store the mapping relationship.

[0190] In a specific embodiment, the above device may further include:

[0191] A third message receiving module may be used to receive a third node message sent by the second test node based on the first shadow node; the third node message is a network message sent by the second test node to the first test node;

[0192] A third message sending module may be used to send a third node message to the control node based on the first shadow node;

[0193] A third message processing module may be used to process the third node message based on the control node to obtain a fourth node message;

[0194] A fourth message receiving module may be used to receive a fourth node message sent by the control node based on the second shadow node;

[0195] The fourth message sending module can be used to send a fourth node message to the first test node based on the second shadow node.

[0196] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0197] Fig.10 is a block diagram of an electronic device for processing node messages according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a message processing method is implemented.

[0198] Fig.11 is a block diagram of an electronic device for processing node messages according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.11As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a message processing method is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0199] Those skilled in the art will understand that Fig.10 or Fig.11 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0200] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the message processing method in the embodiment of the present disclosure.

[0201] In an exemplary embodiment, a computer-readable storage medium is also provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the message processing method in the embodiment of the present disclosure.

[0202] In an exemplary embodiment, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer is enabled to execute the message processing method in the embodiment of the present disclosure.

[0203] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0204] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0205] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0206] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A message processing method, characterized in that: Applied to a node test system, the node test system includes a first shadow node corresponding to a first test node, a second shadow node corresponding to a second test node, and a control node, the node consensus address corresponding to the first shadow node is the same as the node consensus address of the first test node, and the node consensus address corresponding to the second shadow node is the same as the node consensus address of the second test node; the method includes: receiving a first node message sent by the first test node based on the second shadow node; the first node message is a network message sent by the first test node to the second test node; Based on the second shadow node, sending the first node message to the control node; Based on the control node, performing message processing on the first node message to obtain a second node message; Receiving the second node message sent by the control node based on the first shadow node; Based on the first shadow node, the second node message is sent to the second test node.

2. The method according to claim 1, characterized in that The performing message processing on the first node message based on the control node to obtain a second node message includes: When the first node message meets the preset modification condition, the consensus description information in the first node message is modified based on the control node to obtain the second node message.

3. The method according to claim 2, characterized in that The step of modifying the consensus description information in the first node message based on the control node to obtain the second node message when the first node message meets the preset modification condition includes: Based on the control node, a target node consensus address in the first node message and at least one preset reference consensus address are matched to obtain a first matching result; the target node consensus address includes a first node consensus address and a second node consensus address, the first node consensus address is a node consensus address corresponding to the first test node, and the second node consensus address is a node consensus address corresponding to the second test node; Based on the control node, taking the preset reference consensus address corresponding to the first matching result in the at least one preset reference consensus address as the target reference consensus address; Based on the control node, the consensus description information in the first node message is modified to the preset reference description information corresponding to the target reference consensus address to obtain the second node message.

4. The method according to claim 1 or 2, characterized in that: The performing message processing on the first node message based on the control node to obtain a second node message includes: In the case that the first node message does not satisfy a preset modification condition, based on the control node, the first node message is used as the second node message.

5. The method according to claim 1, characterized in that Before performing message processing on the first node message based on the control node to obtain the second node message, the method further includes: Based on the control node, matching the first node message with at least one preset filtering condition to obtain a second matching result; When the second matching result indicates that the first node message satisfies any preset filtering condition, the first node message is filtered based on the control node.

6. The method according to claim 5, characterized in that: The matching process of the first node message and at least one preset filtering condition based on the control node to obtain a second matching result includes: Based on the control node, a target node consensus address in the first node message is matched with a preset blacklist address to obtain a third matching result; the target node consensus address includes a first node consensus address and a second node consensus address; Based on the control node, matching the target node consensus address with a preset whitelist address to obtain a fourth matching result; The second matching result is generated based on the control node, the third matching result and the fourth matching result.

7. The method according to claim 1, characterized in that After performing message processing on the first node message based on the control node to obtain the second node message, the method further includes: In the case that the second node message is empty, the second node message is filtered based on the control node.

8. The method according to claim 1, characterized in that The sending the second node message to the second test node based on the first shadow node includes: When a network connection is established between the first shadow node and the second test node, the second node message is sent to the second test node.

9. The method according to claim 8, characterized in that Before the receiving, based on the second shadow node, the first node message sent by the first test node, the method further includes: receiving a first handshake connection instruction sent by the first test node based on the second shadow node; the first handshake connection instruction includes a first node network address corresponding to the first test node; Based on the second shadow node and the first node network address, returning a first accept handshake instruction to the first test node; When the first confirmation handshake instruction returned by the first test node is received, the first node network address is stored based on the second shadow node.

10. The method according to claim 9, characterized in that In the case of receiving the first confirmation handshake instruction returned by the first test node, after storing the first node network address based on the second shadow node, the method further includes: Receiving a second handshake connection instruction sent by the first test node based on the second shadow node; the second handshake connection instruction includes the first node consensus address; Based on the second shadow node and the first node network address, returning a second accept handshake instruction to the first test node, so that the first test node checks the second node consensus address in the second accept handshake instruction; Upon receiving the second confirmation handshake instruction returned by the first test node, a mapping relationship between the first node consensus address and the first node network address is generated based on the second shadow node, and the mapping relationship is stored.

11. The method according to claim 1, characterized in that: The method further comprises: Receiving a third node message sent by the second test node based on the first shadow node; the third node message is a network message sent by the second test node to the first test node; Based on the first shadow node, sending the third node message to the control node; Based on the control node, performing message processing on the third node message to obtain a fourth node message; Based on the second shadow node, receiving the fourth node message sent by the control node; Based on the second shadow node, the fourth node message is sent to the first test node.

12. A message processing device, characterized in that: The node test system includes a first shadow node corresponding to a first test node, a second shadow node corresponding to a second test node, and a control node. The node consensus address corresponding to the first shadow node is the same as the node consensus address of the first test node. The node consensus address corresponding to the second shadow node is the same as the node consensus address of the second test node. The device includes: A first message receiving module, configured to receive a first node message sent by the first test node based on the second shadow node; the first node message is a network message sent by the first test node to the second test node; A first message sending module, configured to send the first node message to the control node based on the second shadow node; A first message processing module, configured to perform message processing on the first node message based on the control node to obtain a second node message; A second message receiving module, configured to receive the second node message sent by the control node based on the first shadow node; The second message sending module is used to send the second node message to the second test node based on the first shadow node.

13. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the executable instructions to implement the message processing method described in any one of claims 1 to 11.

14. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the message processing method according to any one of claims 1 to 11 is implemented.

15. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the message processing method described in any one of claims 1 to 11 is implemented.