Block chain system testing method and device, equipment and storage medium

By automatically injecting abnormal asset transfer logic and triggering relay devices for testing, the problem of complex and inefficient testing methods of existing blockchain system is solved, and comprehensive testing and improvement of the security and interception performance of cross-chain asset transfer in blockchain system is achieved.

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

Patent Information

Application Number
CN202311356297.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-18
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The existing blockchain system testing methods are complex in operation, resulting in low testing efficiency and ineffective evaluation of the interception performance of the blockchain system for abnormal asset transfers.

Method used

By automatically detecting the original asset transfer logic position points in the cross-chain bridge service source code, injecting abnormal asset transfer logic, generating test codes, triggering the relay device to transfer abnormal assets, and testing the interception performance of the blockchain system.

Benefits of technology

It improves the efficiency of blockchain system testing, reduces testing costs, and can comprehensively test the security of cross-chain asset transfers of blockchain systems, ensuring the precise interception of abnormal asset transfers by the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854169A_ABST
    Figure CN119854169A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a block chain system testing method and device, equipment and a storage medium, and is applied to the block chain technology, and the method comprises the steps: obtaining a test case used for carrying out an asset transfer test on a block chain system, and a cross-chain bridge service source code of a cross-chain bridge relay network; detecting a position point where an original asset transfer logic in the cross-chain-bridge service source code is located, and injecting an abnormal asset transfer logic at the position point to obtain a cross-chain-bridge service test code; triggering a relay device in the cross-chain bridge relay network, and performing abnormal asset transfer between the first block chain network and the second block chain network according to the cross-chain bridge service test code and the test case to obtain an asset transfer result; and according to the asset transfer result, testing the interception performance of the block chain system for abnormal asset transfer. The test efficiency of the block chain system can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to fields such as blockchain technology, and in particular to a blockchain system testing method, device, equipment and storage medium. Background Art

[0002] In order to realize the transfer of digital assets between different blockchain networks, cross-chain technology based on blockchain has emerged. Blockchain technology refers to the transfer of assets between different blockchain networks through a cross-chain bridge relay network to improve the interoperability between blockchain networks. In order to improve the security of asset transfer between different blockchain networks, it is necessary to test the blockchain system composed of the blockchain network and the cross-chain bridge relay network. At present, in the process of testing the blockchain system, the performance of the blockchain system can only be tested after the network protocol is mainly used to unpack, split, assemble, and decrypt the data packets related to asset transfer. It can be seen that this test method is complicated to operate, resulting in relatively low testing efficiency of the blockchain system. Summary of the invention

[0003] The embodiments of the present application provide a blockchain system testing method, apparatus, device and storage medium, which can improve the testing efficiency of the blockchain system.

[0004] On the one hand, an embodiment of the present application provides a blockchain system testing method, including:

[0005] Obtaining a test case for asset transfer testing of a blockchain system and a cross-chain bridge service source code of a cross-chain bridge relay network; the blockchain system includes a first blockchain network, a second blockchain network, and the cross-chain bridge relay network, and the cross-chain bridge relay network is used to transfer assets between the first blockchain network and the second blockchain network based on the cross-chain bridge service source code;

[0006] Detect the location of the original asset transfer logic in the above cross-chain bridge service source code, inject abnormal asset transfer logic at the above location, and obtain the cross-chain bridge service test code;

[0007] Trigger the relay device in the cross-chain bridge relay network, perform abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, and obtain the asset transfer result;

[0008] Based on the above asset transfer results, test the interception performance of the above blockchain system against abnormal asset transfers.

[0009] An embodiment of the present application provides a blockchain system testing device, including:

[0010] An acquisition module, used to acquire a test case for performing asset transfer testing on a blockchain system, and a cross-chain bridge service source code of a cross-chain bridge relay network; the blockchain system includes a first blockchain network, a second blockchain network, and the cross-chain bridge relay network, and the cross-chain bridge relay network is used to perform asset transfer between the first blockchain network and the second blockchain network based on the cross-chain bridge service source code;

[0011] An injection module is used to detect the location of the original asset transfer logic in the cross-chain bridge service source code, inject the abnormal asset transfer logic at the above location, and obtain the cross-chain bridge service test code;

[0012] A trigger module, used to trigger the relay device in the cross-chain bridge relay network, perform abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, and obtain an asset transfer result;

[0013] The test module is used to test the interception performance of the above-mentioned blockchain system against abnormal asset transfers based on the above-mentioned asset transfer results.

[0014] Optionally, the injection module includes a detection unit and an adding unit;

[0015] A detection unit, used to detect the location of the original asset transfer logic in the source code of the above cross-chain bridge service as an abnormal insertion point;

[0016] The adding unit is used to add the above-mentioned abnormal asset transfer logic at the abnormal insertion point in the above-mentioned cross-chain bridge service source code to obtain the cross-chain bridge service test code.

[0017] Optionally, the trigger module includes a calling unit, a compiling unit and a triggering unit;

[0018] A calling unit, used to call an activation instruction, activate the above cross-chain bridge service test code, and obtain a cross-chain bridge service intermediate file;

[0019] A compiling unit, used to compile the cross-chain bridge service test code according to the cross-chain bridge service intermediate file to obtain a cross-chain bridge service executable file;

[0020] A triggering unit is used to trigger the relay device in the above-mentioned cross-chain bridge relay network, and perform abnormal asset transfer between the above-mentioned first blockchain network and the above-mentioned second blockchain network according to the above-mentioned cross-chain bridge service executable file and the above-mentioned test case to obtain an asset transfer result.

[0021] Optionally, the triggering unit triggers the relay device in the cross-chain bridge relay network, performs abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service executable file and the test case, and obtains an asset transfer result, including:

[0022] Send the test case to the first node device in the first blockchain network, and the first node device in the first blockchain network is used to pledge the specified amount of digital assets in the test account address to the contract address of the asset smart contract according to the test case;

[0023] Send the above cross-chain bridge service executable file to the relay device in the above cross-chain bridge relay network;

[0024] The above-mentioned relay device is triggered to execute the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes a pledge event, and obtain an abnormal execution result; the second node device in the above-mentioned second blockchain network generates an asset transfer result based on the above-mentioned abnormal execution result, and the above-mentioned pledge event refers to that the above-mentioned specified number of digital assets of the above-mentioned test account address has been pledged to the contract address of the above-mentioned asset smart contract.

[0025] Optionally, the triggering unit triggers the above-mentioned relay device to execute the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes the mortgage event, and obtains an abnormal execution result, including:

[0026] Obtain the file package identifier of the file containing the abnormal asset transfer logic, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file;

[0027] Modify the environment variables according to the file package identifier, the file identifier and the abnormal logic identifier;

[0028] According to the modified environment variables, the relay device is triggered to execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtain an abnormal execution result.

[0029] Optionally, the triggering unit triggers the relay device to execute the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtains an abnormal execution result, including:

[0030] Obtain the file package identifier of the file containing the abnormal asset transfer logic, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file;

[0031] Generate an execution request for the abnormal asset transfer logic according to the file package identifier, the file identifier and the abnormal logic identifier;

[0032] The execution request is sent to the relay device. The execution request is used to instruct the relay device to execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtain an abnormal execution result.

[0033] Optionally, the execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes the mortgage event, so as to suspend consensus on the mortgage event and generate an abnormal execution result that the mortgage event has not been consensused; or,

[0034] The execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes a mortgage event, so as to generate an abnormal execution result indicating that the consensus of the mortgage event has not been passed.

[0035] Optionally, the device may further include a generating module and a sending module;

[0036] A generating module, configured to generate a request for suspending execution of the abnormal asset transfer logic according to the file package identifier, the file identifier and the abnormal logic identifier;

[0037] A sending module, used to send the above-mentioned suspension execution request to the above-mentioned relay device, wherein the above-mentioned suspension execution request is used to instruct the above-mentioned relay device to suspend the execution of the above-mentioned abnormal asset transfer logic in the above-mentioned cross-chain bridge service executable file when it detects that the above-mentioned first node device executes the mortgage event again, and execute the above-mentioned original asset transfer logic in the above-mentioned cross-chain bridge service executable file to obtain the original execution result; the second node device in the above-mentioned second blockchain network generates an updated asset transfer result based on the above-mentioned original execution result;

[0038] The testing module is also used to test the asset transfer performance of the above-mentioned blockchain system based on the above-mentioned updated asset transfer results.

[0039] Optionally, the test module tests the asset transfer performance of the above blockchain system according to the above updated asset transfer result, including:

[0040] According to the above updated asset transfer results, count the number of failures corresponding to the original asset transfer failures of the above blockchain system;

[0041] If the number of failures is greater than the first number threshold, it is determined that the asset transfer performance of the blockchain system is abnormal.

[0042] Optionally, the test module tests the interception performance of the above blockchain system against abnormal asset transfers based on the above asset transfer results, including:

[0043] According to the above asset transfer results, the number of successful abnormal asset transfers of the above blockchain system is counted;

[0044] If the above number of successes is greater than the second number threshold, it is determined that the interception performance of the above blockchain system for abnormal asset transfer is abnormal.

[0045] On one hand, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.

[0046] On the one hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.

[0047] In this application, by automatically detecting the location of the original asset transfer logic in the cross-chain bridge service source code corresponding to the cross-chain relay network, the abnormal asset transfer logic is automatically injected at the location, the cross-chain bridge service test code is obtained, the node device in the cross-chain bridge relay network is triggered, and the abnormal asset transfer is performed between different blockchain networks according to the cross-chain bridge service test code and the test case, and the asset transfer result is obtained. According to the asset transfer result, the interception performance of the blockchain system for abnormal asset transfer is automatically tested. In the process of testing the blockchain system, there is no need to perform complex operations such as unpacking, subpackaging, assembling, and decrypting data packets, thereby improving the testing efficiency of the blockchain system and reducing the testing cost. At the same time, the abnormal asset transfer logic can cover the abnormal scenarios in the cross-chain asset transfer event, which is conducive to the comprehensive testing of the blockchain system and the comprehensiveness of the cross-chain asset transfer test of the blockchain system. In turn, it is conducive to the optimization of the blockchain system by developers based on the test results of the blockchain system to improve the security of the cross-chain asset transfer of the blockchain system and enable the blockchain system to accurately intercept abnormal asset transfers. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0049] Figure 1 It is a schematic diagram of a blockchain system provided by this application;

[0050] Figure 2 This is a schematic diagram of an interaction scenario between various devices in a blockchain system provided by this application;

[0051] Figure 3 This is a schematic diagram of the process of cross-chain asset transfer provided by this application;

[0052] Figure 4 It is a flowchart of a blockchain system testing method provided by this application;

[0053] Figure 5 It is a flowchart of a blockchain system testing method provided by this application;

[0054] Figure 6 This is a flowchart of the cross-chain product testing, security testing, and release of a blockchain system provided by this application;

[0055] Figure 7 This is a scenario diagram of a blockchain system testing method provided by this application;

[0056] Figure 8 It is a structural schematic diagram of a blockchain system testing device provided in an embodiment of the present application;

[0057] Fig. 9 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0059] First, we introduce the blockchain system used in this solution. Figure 1 A schematic diagram of a blockchain system structure provided in an embodiment of the present application. The blockchain system may include a first blockchain network 10, a second blockchain network 11, and a cross-chain bridge relay network 12.

[0060] Among them, the first blockchain network 10 has multiple node devices, and the number of node devices in the first blockchain network 10 can be deployed according to demand. This application does not limit the node devices in the first blockchain network 10. Figure 1In the example, the first blockchain network includes four node devices, which are node device 101, node device 102, node device 103 and node device 104. Each node device in the first blockchain network 10 can receive input information during normal operation, and maintain the shared data in the first blockchain network 10 based on the received input information. In order to ensure the information intercommunication in the first blockchain network 10, there can be an information connection between each node device in the first blockchain network 10, and the node devices can transmit information through the above information connection. For example, when any node device in the first blockchain network 10 receives input information, the other node devices in the first blockchain network 10 obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all node devices in the first blockchain network 10 are consistent. The shared data between the node devices in the first blockchain network 10 can be stored in the form of a blockchain, that is, each node device in the first blockchain network 10 maintains the same blockchain. For the sake of distinction, the blockchain maintained by the node devices in the first blockchain network can be called blockchain A.

[0061] Similarly, the second blockchain network 11 has multiple node devices. The number of node devices in the second blockchain network 11 can be deployed according to demand. This application does not limit the node devices in the second blockchain network 11. Figure 1 In the example, the second blockchain network 11 includes four node devices, which are node device 101, node device 102, node device 103 and node device 104. Each node device in the second blockchain network 11 can receive input information during normal operation, and maintain the shared data in the second blockchain network 11 based on the received input information. In order to ensure the information intercommunication in the second blockchain network 11, there can be an information connection between each node device in the second blockchain network 11, and the node devices can transmit information through the above information connection. For example, when any node device in the second blockchain network 11 receives input information, the other node devices in the second blockchain network 11 obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all node devices in the second blockchain network 11 are consistent. The shared data between the node devices in the second blockchain network 11 can be stored in the form of a blockchain, that is, each node device in the second blockchain network 11 maintains the same blockchain. For the sake of distinction, the blockchain maintained by the node devices in the second blockchain network 11 can be called blockchain B.

[0062] It should be noted that the number of node devices in the first blockchain network 10 may be the same as or different from the number of node devices in the second blockchain network. The blockchain A maintained by the first blockchain network 10 and the blockchain B maintained by the second blockchain network may be generated based on the same blockchain protocol, that is, the blockchain A and the blockchain B have the same blockchain structure. In one embodiment, the blockchain A and the blockchain B may be generated based on different blockchain protocols, that is, the blockchain A and the blockchain B have different blockchain structures. For example, the blockchain A may be generated based on a public blockchain protocol, and the blockchain B may be generated based on a private blockchain protocol. The blockchain A may be called a public chain, and the blockchain B may be called a consortium chain or a private chain.

[0063] It should be noted that data or blocks can be transferred between node devices in the first blockchain network and between node devices in the second blockchain network through network connections. The network connection between the above-mentioned node devices can be based on node identification for data transmission. Each node device has a node identification corresponding to it, and each of the above-mentioned node devices can store the node identifications of other node devices connected to itself, so that the acquired data or generated blocks can be broadcast to other node devices according to the node identifications of other node devices. For example, node device 101 can maintain a node identification list, which stores the node names and node identifications of other node devices, as shown in Table 1:

[0064] Table 1

[0065] Node Name Node ID Node device 101 117.xxx.xxx.174 Node device 102 117.xxx.xxx.145 Node device 103 117.xxx.xxx.183 Node device 104 117.xxx.xxx.125 … …

[0066] Among them, the node identifier can be the Internet Protocol (IP) address for interconnecting networks or any other information that can be used to identify the node device in the blockchain network. Table 1 only uses the IP address as an example for explanation.

[0067] Assuming that the node identifier of node device 101 is 117.xxx.xxx.174, node device 101 can send a data synchronization request to node device 102 through 117.xxx.xxx.174, and node device 102 can know that the data synchronization request is sent by node device 101 through node identifier 117.xxx.xxx.174; similarly, node device 102 can send transaction data A to node device 101 through node identifier 117.xxx.xxx.145, and node device 101 can know that transaction data A is sent by node device 101 through node identifier 117.xxx.xxx.145, and the same is true for data transmission between other node devices, so they will not be elaborated one by one.

[0068] Among them, the cross-chain bridge relay network 12 refers to an intermediate network used to realize information interaction between the first blockchain network 10 and the second blockchain network 11. The cross-chain bridge relay network 12 has multiple relay devices. The number of relay devices in the cross-chain bridge relay network 12 can be deployed according to demand. This application does not limit the relay devices in the cross-chain bridge relay network 12. Figure 1 In the example, the cross-chain bridge relay network includes four relay devices, namely relay device 121, relay device 122, relay device 123 and relay device 124. Each relay device in the cross-chain bridge relay network 12 has a network connection with each node device in the first blockchain network 10 and each node device in the second blockchain network 11, so as to realize information interaction between the first blockchain network 10 and the second blockchain network 11 through the cross-chain bridge relay network 12.

[0069] It should be noted that the cross-chain bridge network 12 in the present application mainly realizes the asset transfer between the first blockchain network 10 and the second blockchain network 11, that is, the cross-chain bridge network 12 is used to transfer the digital assets of the first account address of the registered user in the first blockchain network 10 to the second account address of the registered user in the second blockchain network 11, wherein the first account address and the second account address may belong to the same user or to different users.

[0070] In one embodiment, the node devices in the first blockchain network 10 and the second blockchain network 12 may include: a. One or more asset smart contracts, one asset smart contract corresponds to one digital asset, and the asset smart contract includes transfer rules and casting rules for the corresponding digital asset. The transfer rule is used to indicate the maximum number of times a registered user can transfer the corresponding digital asset every day, the maximum number of digital assets transferred each time, etc., and the casting rule is used to indicate when or under what conditions a new digital asset can be generated. Digital assets may refer to assets in the form of electronic data, and digital assets may include digital collections, game themes, game equipment, game accounts, game coins, vouchers, etc. b. One or more contract executors, the contract executor corresponds to an asset smart contract, and the contract executor is used to execute the corresponding asset smart contract to transfer digital assets or generate new digital assets. c. Cross-chain bridge contract, the cross-chain bridge contract includes cross-chain transfer rules for transferring digital assets between different blockchain networks, such as the cross-chain transfer rules that define which blockchain networks meet the cross-chain asset transfer conditions and how to transfer cross-chain assets between different blockchain networks. For example, the cross-chain transfer rule stipulates that the network stability is greater than the stability threshold, and the blockchain network with a credit rating greater than the credit rating threshold meets the cross-chain transfer conditions. The cross-chain bridge contract can be jointly formulated by multiple blockchain networks for cross-chain asset transfers, and the cross-chain bridge contract can also be formulated by the cross-chain bridge relay network. The main logic of the cross-chain bridge contract is to verify that the signer has the authority, and then forward the message related to the digital asset transfer to the corresponding contract executor, and the contract executor calls the corresponding asset smart contract to transfer the asset.

[0071] It should be noted that the asset smart contract included in the node device in the first blockchain network 10 and the asset smart contract included in the node device in the second blockchain network 12 may be the same or different. Furthermore, the contract executor included in the node device in the first blockchain network 10 and the contract executor included in the node device in the second blockchain network 12 may be the same or different. Figure 2 As shown, the node device 101 in the first blockchain network 10 and the node device 111 in the second blockchain network 11 both include the first asset smart contract and the second asset smart contract as an example for explanation, that is, the node device 101 in the first blockchain network 10 and the node device 111 in the second blockchain network 11 both also include the contract executor 1 corresponding to the first asset smart contract and the contract executor 2 corresponding to the second asset smart contract. The first asset smart contract and the contract executor 1 correspond to the digital collection, that is, the contract executor 1 realizes the transfer (transaction) of the digital collection by calling the first asset smart contract; the second asset smart contract and the contract executor 2 correspond to the game theme, and the contract executor 2 realizes the transfer of the game theme by calling the second asset smart contract.

[0072] In one embodiment, Figure 2 As shown, the relay device in the cross-chain relay network 12 can be used for interface detection, cross-chain transaction sending, storage of cross-chain historical tasks and state management. Interface detection refers to detecting whether the first blockchain network 10 performs cross-chain asset transfer. Cross-chain transaction sending refers to sending the cross-chain transaction corresponding to the cross-chain asset transfer to the node device in the second blockchain network 11 when it is detected that the first blockchain network 10 performs cross-chain asset transfer. Cross-chain historical tasks refer to cross-chain asset transfers performed by relay devices in historical time periods. State management can refer to whether the cross-chain asset transfer has been completed and whether it has been successfully implemented.

[0073] In one embodiment, Figure 2 As shown, the first blockchain network 10 or the second blockchain network 11 can also be used to receive a cross-chain asset transfer request from a terminal 14, and the terminal 14 can refer to a device corresponding to a user registered in at least one of the first blockchain network 10 and the second blockchain network. The terminal 14 can include a cross-chain service front end, which can refer to an asset client. The asset client can be used to implement asset management business functions and realize communication connection with a decentralized application client based on the asset management business function. The asset client is a tool for managing and storing user digital assets, such as transferring digital assets to other accounts based on the asset client, and receiving digital assets transferred from other accounts based on the asset client. The asset client can be a hardware device or a software program.

[0074] It is understandable that with the widespread deployment of various decentralized applications on the blockchain and the increase in user activities on the blockchain, general users can use blockchain key management tools to log in when using decentralized applications. The address in the blockchain key management tool corresponds to a user on the blockchain. The decentralized application can trigger some interfaces to obtain the user address from the key management tool, in order to solve the problem that the Dapp background cannot trust the user address used when logging in to the decentralized application.

[0075] In one embodiment, Figure 2 As shown, the cross-chain bridge service backend is deployed in the cross-chain bridge server 13, and the cross-chain bridge server 13 can be used to provide back-end services for the asset client in the terminal 14. The back-end services include registration, login, upgrade and optimization of the asset client, etc.

[0076] It is understandable that the node devices in the first blockchain network, the node devices in the second blockchain network, the relay devices in the cross-chain bridge relay network, and the cross-chain bridge server 13 can all be independent physical servers, or they can be server clusters or distributed systems composed of at least two physical servers, or they can also be cloud servers that provide 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, Content Delivery Network (CDN), and big data and artificial intelligence platforms. Terminal 14 can specifically refer to a vehicle-mounted terminal, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a screen speaker, a smart watch, etc., but is not limited to this. Each terminal and server can trigger a wired or wireless communication method to connect directly or indirectly. At the same time, the number of terminals and servers can be one or at least two, and this application is not limited here. In particular, a relay device can also refer to a terminal.

[0077] In one embodiment, Figure 1 The blockchain system in can be used to realize cross-chain asset transfer, such as Figure 3 As shown, under normal circumstances, the cross-chain asset transfer process may include the following steps:

[0078] S11, the terminal 14 can send a request to any node device ( Figure 3 Taking node device 101 as an example), a cross-chain asset transfer request is sent, and the cross-chain asset transfer request is used to instruct the transfer of a specified number of digital assets from a first account address in the first blockchain network to a second account address in the second blockchain network. The cross-chain asset transfer request may include the first account address of the asset transferor, the second account address of the asset recipient, the network identifier of the first blockchain network, the network identifier of the second blockchain network, the specified number of digital assets to be transferred, the user information of the asset transferor, the type of digital assets, etc. The asset transferor may refer to a registered user in the first blockchain network, that is, a user who needs to transfer out digital assets, and the asset recipient may refer to a registered user in the second blockchain network, that is, a user who receives digital assets.

[0079] S12, the node device 101 can call the cross-chain bridge contract to reach a consensus on the cross-chain asset transfer request. Specifically, the node device 101 can verify whether the asset transferor meets the cross-chain asset transfer conditions according to the cross-chain asset transfer request and obtain a verification result. For example, the node device 101 can call the cross-chain bridge contract to verify whether the first blockchain network and the second blockchain network belong to blockchain networks that meet the cross-chain asset transfer conditions according to the network identifier of the first blockchain network and the network identifier of the second blockchain network. If so, it is determined that the asset transferor meets the cross-chain asset transfer conditions and generates a verification result indicating that the asset transferor meets the cross-chain asset transfer conditions. At the same time, the node device 101 will also send the cross-chain asset transfer request to other node devices in the first blockchain network, and other node devices will also call the cross-chain bridge contract to verify whether the asset transferor meets the cross-chain asset transfer conditions according to the cross-chain asset transfer request and obtain a verification result. Then, the node devices in the first blockchain network exchange their own verification results with each other. If the verification results obtained by the majority (such as 2 / 3) of the node devices in the first blockchain network indicate that the asset transferor meets the cross-chain asset transfer conditions, it is determined that the consensus of the cross-chain asset transfer request is passed.

[0080] S13, the node device 101 can call the contract executor to execute the corresponding asset smart contract, and pledge the specified number of digital assets in the first account address to the contract address of the asset smart contract. Specifically, when the node device 101 determines that the consensus of the asset transfer request is passed, it calls the contract executor to execute the corresponding asset smart contract, and pledges the specified number of digital assets in the first account address to the contract address of the asset smart contract. The contract executor and asset smart contract here correspond to the type of digital assets corresponding to the cross-chain asset transfer request. The type of digital assets is digital collections. The contract executor is the above-mentioned contract executor 1, and the asset smart contract is the first asset smart contract above.

[0081] S14. When any relay device in the cross-chain bridge relay network detects a mortgage event on a node device in the first blockchain network, it reaches a consensus on the mortgage event. Specifically, when any relay device in the cross-chain bridge relay network detects a mortgage event on a node device in the first blockchain network, it can generate event indication information about the mortgage event, sign the event indication information, obtain the event indication information with the signature, and send the event indication information with the signature to the node device in the second blockchain network. The event indication information is used to indicate that a specified number of digital assets have been mortgaged from the first account address to the contract address corresponding to the digital asset contract, and indicates the transfer of a specified number of digital assets from the contract address of the asset smart contract in the second blockchain network to the second account.

[0082] Optionally, when the relay device detects that the node device in the first blockchain network executes a mortgage event, it can verify whether the asset transferor meets the cross-chain asset transfer conditions according to the cross-chain asset transfer request. When it is verified that the asset transferor meets the cross-chain asset transfer conditions, it generates event indication information about the mortgage event, signs the event indication information, obtains the event indication information carrying the signature, and sends the event indication information carrying the signature to the node device in the second blockchain network. The relay device sends the event indication information carrying the signature to the node device in the second blockchain network, indicating that the relay device agrees to transfer the digital asset from the first account address in the first blockchain network to the second account address in the second blockchain network, which can also be called the consensus of the mortgage event, and can also be called the relay device voting for this cross-chain asset transfer. In particular, when it is verified that the asset transferor does not meet the cross-chain asset transfer conditions, the relay device can suspend the generation of event indication information about the mortgage event to intercept the cross-chain asset transfer, that is, the relay device can not vote for this cross-chain asset transfer. Alternatively, when it is verified that the asset transferor does not meet the cross-chain asset transfer conditions, the relay device can generate failure indication information about the mortgage event to intercept the cross-chain asset transfer, that is, the relay device can vote against this cross-chain asset transfer. The failure indication information is used to indicate that the asset transferor does not meet the cross-chain asset transfer conditions.

[0083] S15. The node device in the second blockchain network can call the cross-chain bridge contract to verify the signature of the received event indication information carrying the signature. If the signature verification passes, the contract executor can be called to execute the asset smart contract to transfer the specified number of digital assets in the contract address of the asset smart contract to the second account address to complete the cross-chain asset transfer.

[0084] Optionally, when the node device in the second blockchain network receives the event indication information with signatures sent by the majority of the relay devices, and more than a preset number of event indication information with signatures are all verified, it is determined that the cross-chain asset transfer has passed the verification, and the contract executor can be called to execute the asset smart contract, and the specified number of digital assets in the contract address of the asset smart contract is transferred to the second account address to complete the cross-chain asset transfer.

[0085] In summary, the signature voting process of the relay device is crucial. If the relay device detects a mortgage event, the signature voting process can refer to the consensus process of the above relay device on the mortgage event. However, if the relay device is attacked maliciously, it will cause the relay device to perform one or more of the following abnormal voting behaviors: 1. The relay device detects the mortgage event and does not vote (consensus) on this cross-chain asset transfer; 2. The relay device detects the mortgage event and votes against this cross-chain asset transfer. At this time, the digital asset transfer in the second blockchain network cannot be completed, the distributed consistency of the asset transfer cannot be achieved, and the cross-chain operation of the asset cannot be achieved. Therefore, in the actual testing process, it is necessary to perform an abnormal test on the interception event of the relay device to simulate the malicious attack method. The traditional abnormal test of the interception event of the relay device generally adopts the form of network packet capture, filters the protocol data, and performs packet loss processing on the detected transfer event to achieve the purpose of interception, or deploys another relay device, hard-codes the code logic of "not processing the transfer event" into the blockchain program, and realizes the abnormal processing of the interception event of the relay device. On the one hand, these methods require advance knowledge of the protocol data of the cross-chain bridge background, and there are technical risks of network unpacking, subpackaging, packaging and content encryption. On the other hand, hard coding has high implementation costs, low reuse rates, low automation, large workload, poor accuracy, and no clear logs to query.

[0086] Based on this, the present application proposes a blockchain system testing method, that is, in the testing phase, code insertion points that need to simulate abnormal asset transfer logic ("intercepting transfer events", "giving up voting") are defined, the code is automatically scanned, logic is dynamically inserted based on FailPoint, project engineering is automatically compiled, and the relay device can be triggered to execute abnormal asset transfer logic in the form of code drive or environment variable drive. Driven by the automated use cases of the blockchain network, the impact of abnormal asset transfer logic on the asset interoperability of cross-chain bridges is automatically detected. The FailPoint here is a Golang implementation of FreeBSD failpoints, which can inject errors or abnormal behaviors into the code, and is used to simulate error handling in various complex systems to improve the fault tolerance, correctness and stability of the blockchain system. Specifically, the present application makes the following improvements:

[0087] 1) Customize the abnormal insertion points in the source code of the cross-chain bridge service, and dynamically inject abnormal asset transfer logic at the abnormal insertion points. The abnormal asset transfer logic includes abnormal scenarios such as "giving up voting when a mortgage event is detected" and "voting against a mortgage event when a mortgage event is detected". After dynamic injection, the project file is automatically compiled;

[0088] 2) The cross-chain bridge service executable file injected with abnormal asset transfer logic can be customized and sent to the relay device in the cross-chain bridge relay network, covering a variety of abnormal asset transfer scenarios;

[0089] 3) Based on FailPoint, the startup and shutdown of abnormal asset transfer logic is dynamically triggered. Combined with automated test cases, the functionality and security of cross-chain asset transfer can be automatically detected and a test report can be generated.

[0090] Based on the high degree of automation and strong scalability of the blockchain system testing method in this application, various types of abnormal asset transfer behaviors of cross-chain bridges can be implemented, including "rejection of voting" and "voting against", etc., and "abnormal" behaviors can be dynamically turned on and off without the intervention of developers, thereby improving the efficiency of testing and reducing testing costs.

[0091] For further information, see Figure 4 Schematic diagram of a blockchain system testing method provided by an embodiment of the present application. Figure 4 As shown, the method can be performed by a test device, which can include at least one of a terminal and a server. The test device used to perform the blockchain system test method in this application can be collectively referred to as a computer device. The method can include the following steps:

[0092] S101. Obtain a test case for asset transfer testing of a blockchain system, and a cross-chain bridge service source code of a cross-chain bridge relay network; the blockchain system includes a first blockchain network, a second blockchain network, and the cross-chain bridge relay network, and the cross-chain bridge relay network is used to transfer assets between the first blockchain network and the second blockchain network based on the cross-chain bridge service source code.

[0093] It is understandable that the test case can be specifically used to perform a cross-chain asset transfer test on the blockchain system. The test case is used to indicate that a specified number of digital assets in the test account address in the first blockchain network is transferred to the test account address in the second blockchain network. The test case can also be used to indicate that a specified number of digital assets in the test account address in the second blockchain network is transferred to the test account address in the first blockchain network to improve the comprehensiveness of the test. In particular, this application is mainly explained by taking the test case as an example to indicate that a specified number of digital assets in the test account address in the first blockchain network is transferred to the test account address in the second blockchain network. The test account address in the first blockchain network can refer to the account address of any user registered in the first blockchain network, and the test account address in the second blockchain network can refer to the account address of any user registered in the second blockchain network. The cross-chain bridge service source code of the cross-chain bridge relay network can refer to the cross-chain bridge project engineering used by the relay device in the cross-chain relay network to provide a cross-chain relay service. The cross-chain relay service can include cross-chain messages, asset transfers, and various change setting functions in cross-chain contracts for detecting blockchain networks, such as changes in managers.

[0094] In the present application, the computer device can obtain test cases for asset transfer testing of the blockchain system and the cross-chain bridge service source code of the cross-chain bridge relay network from the test management platform. The test cases can be generated based on the number of blockchain networks in the blockchain system, the number of relay devices in the cross-chain bridge relay network, the number of node devices in the blockchain network, the function of the blockchain system, etc. The cross-chain bridge service source code can be generated according to the function of the relay device in the cross-chain bridge relay network.

[0095] S102. Detect the location of the original asset transfer logic in the cross-chain bridge service source code, inject abnormal asset transfer logic at the location, and obtain the cross-chain bridge service test code.

[0096] It can be understood that the source code used to implement asset transfer in the cross-chain bridge service source code can be called the original asset transfer logic, which can be used to instruct the relay device how to implement cross-chain asset transfer between different blockchain networks under normal circumstances. The original asset transfer logic includes the following contents: 1. When a mortgage event for digital assets is detected in the first blockchain network, a consensus is reached on the mortgage event; 2. When the consensus on the mortgage event is passed, event indication information about the mortgage event is generated, the event indication information is signed, and the event indication information carrying the signature is obtained, and the event indication information carrying the signature is sent to the node device in the second blockchain network; 3. When the consensus on the mortgage event is not passed, the cross-chain asset transfer is intercepted, and the connection of the cross-chain asset transfer includes one or more of the following: a. The event indication information carrying the signature is not sent to the node device in the second blockchain network; b. The failure indication information about the mortgage event is sent to the node device in the second blockchain network.

[0097] Similarly, the abnormal asset transfer logic can be used to instruct the relay device to perform abnormal asset transfer behavior. The abnormal asset transfer logic can cover abnormal asset transfer scenarios in real scenarios. Abnormal asset transfer scenarios can refer to asset transfer scenarios when the blockchain system is maliciously attacked. The abnormal asset transfer logic includes one or more of the following contents: 1. When a mortgage event for digital assets is detected in the first blockchain network, the consensus on the mortgage event is suspended, that is, no voting is performed on cross-chain asset transfers. 2. When a mortgage event for digital assets is detected in the first blockchain network, and the consensus on the mortgage event is passed, a failure indication information about the mortgage event is sent to the node device in the second blockchain network. In other words, when the consensus on the mortgage event is passed (that is, when the cross-chain asset transfer request is legal), a vote is cast against the cross-chain asset transfer. 3. When a mortgage event for digital assets is detected in the first blockchain network, and the consensus of the mortgage event is not passed, generate event indication information about the mortgage event, sign the event indication information, obtain event indication information with signature, and send the event indication information with signature to the node device in the second blockchain network; in other words, when the consensus of the mortgage event is not passed (that is, when the cross-chain asset transfer request is not legal), vote for the cross-chain asset transfer. 4. When a mortgage event for digital assets is not detected in the first blockchain network, generate event indication information about the mortgage event, sign the event indication information, obtain event indication information with signature, and send the event indication information with signature to the node device in the second blockchain network.

[0098] In this application, the computer device can scan the cross-chain bridge service source code to obtain the location point of the original asset transfer logic in the cross-chain bridge service source code, inject the abnormal asset transfer logic at this location point, and obtain the cross-chain bridge service test code. The cross-chain bridge service test code is used to test whether the blockchain system can successfully intercept abnormal asset transfers when there is a malicious attack. By automatically injecting abnormal asset transfer logic into the cross-chain bridge service source code, the automated testing of the blockchain system is realized. Since the abnormal asset transfer logic can cover the abnormal asset transfer scenarios in real scenarios, the comprehensiveness of the testing of the blockchain system can be improved.

[0099] In one embodiment, the above step S102 includes: the computer device can detect the location point where the original asset transfer logic is located in the above cross-chain bridge service source code as an abnormal insertion point; add the above abnormal asset transfer logic at the abnormal insertion point in the cross-chain bridge service source code to obtain the cross-chain bridge service test code.

[0100] Specifically, the computer device can detect the location of the original asset transfer logic in the cross-chain bridge service source code as the abnormal insertion point, add the abnormal asset transfer logic at the abnormal insertion point in the cross-chain bridge service source code, and move the original asset transfer logic in the cross-chain bridge service source code so that the execution order of the original asset transfer logic is after the execution order of the abnormal asset transfer logic, so that after the computer device executes the abnormal asset transfer logic, the original asset transfer logic is no longer executed.

[0101] S103. Trigger the relay device in the cross-chain bridge relay network, and perform abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case to obtain an asset transfer result.

[0102] In the present application, a computer device can trigger a relay device in the cross-chain bridge relay network, and perform an abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, and obtain an asset transfer result, which includes a successful asset transfer and a failed asset transfer. A successful asset transfer indicates that the blockchain system has failed to intercept the abnormal asset transfer, that is, in the case of a malicious attack (such as a malicious asset transfer) in the blockchain system, the asset transfer behavior corresponding to the malicious attack will be executed normally. A failed asset transfer indicates that the blockchain system has successfully intercepted the abnormal asset transfer, that is, in the case of a malicious attack in the blockchain system, the blockchain system can successfully intercept the malicious attack to ensure the security of digital assets.

[0103] S104. Based on the asset transfer result, test the interception performance of the blockchain system for abnormal asset transfer.

[0104] In this application, if the result of the asset transfer is that the asset transfer fails, it is determined that the blockchain system can successfully intercept the abnormal asset transfer, that is, the blockchain system has the ability to intercept abnormal asset transfers; if the result of the asset transfer is that the asset transfer is successful, it is determined that the blockchain system cannot successfully intercept the abnormal asset transfer, that is, the blockchain system does not have the ability to intercept abnormal asset transfers. By automatically testing the interception performance of the blockchain system for abnormal asset transfers based on the asset transfer results, the security, stability, fault tolerance, and correctness of the blockchain system can be ensured.

[0105] In this application, by automatically detecting the location of the original asset transfer logic in the cross-chain bridge service source code corresponding to the cross-chain relay network, the abnormal asset transfer logic is automatically injected at the location, the cross-chain bridge service test code is obtained, the node device in the cross-chain bridge relay network is triggered, and the abnormal asset transfer is performed between different blockchain networks according to the cross-chain bridge service test code and the test case, and the asset transfer result is obtained. According to the asset transfer result, the interception performance of the blockchain system for abnormal asset transfer is automatically tested. In the process of testing the blockchain system, there is no need to perform complex operations such as unpacking, subpackaging, assembling, and decrypting data packets, thereby improving the testing efficiency of the blockchain system and reducing the testing cost. At the same time, the abnormal asset transfer logic can cover the abnormal scenarios in the cross-chain asset transfer event, which is conducive to the comprehensive testing of the blockchain system and the comprehensiveness of the cross-chain asset transfer test of the blockchain system. In turn, it is conducive to the optimization of the blockchain system by developers based on the test results of the blockchain system to improve the security of the cross-chain asset transfer of the blockchain system and enable the blockchain system to accurately intercept abnormal asset transfers.

[0106] For further information, see Figure 5 Schematic diagram of a blockchain system testing method provided by an embodiment of the present application. Figure 5 As shown, the method can be performed by a test device, which can include at least one of a terminal and a server. The test device used to perform the blockchain system test method in this application can be collectively referred to as a computer device. The method can include the following steps:

[0107] S201. Obtain a test case for testing asset transfer on a blockchain system, and a cross-chain bridge service source code of a cross-chain bridge relay network; the blockchain system includes a first blockchain network, a second blockchain network, and the cross-chain bridge relay network, and the cross-chain bridge relay network is used to transfer assets between the first blockchain network and the second blockchain network based on the cross-chain bridge service source code.

[0108] S202. Detect the location of the original asset transfer logic in the cross-chain bridge service source code, inject abnormal asset transfer logic at the location, and obtain the cross-chain bridge service test code.

[0109] It should be noted that the specific implementation method of step S201 in this application can refer to the specific implementation method of step S101 in the previous text, and the specific implementation method of step S202 in this application can refer to the specific implementation method of step S102 in the previous text. The repeated parts will not be repeated.

[0110] S203. Call the activation instruction to activate the cross-chain bridge service test code to obtain the cross-chain bridge service intermediate file.

[0111] In this application, the activation instruction refers to an instruction for instructing the generation of a cross-chain bridge service intermediate file of a cross-chain bridge service test code, such as the activation instruction can be $GOPATH / src / github.com / pingcap / failpoint / bin / failpoint-ctl enable; the cross-chain bridge service intermediate file refers to a programming language applied to an abstract machine, which can be used to help analyze computer programs, and the cross-chain bridge service intermediate file is equivalent to the intermediate expression between the cross-chain bridge service test code and the cross-chain bridge service executable file. The computer device can call the activation instruction to activate the above cross-chain bridge service test code to obtain the cross-chain bridge service intermediate file, which can include the following intermediate files:

[0112] |--binding__failpoint_binding__.go

[0113] |--chain_voter.go

[0114] |--chain_router.go

[0115] |--chain_watcher.go

[0116] |--events.go

[0117] |--relayer.go

[0118] |--utils.go

[0119] `--utils.go__failpoint_stash__

[0120] Among them, chain_voter.go: chain voting service, mainly implements the voting logic of relay devices (i.e. consensus for mortgage events), chain_router.go: chain routing service, mainly implements the routing logic of different blockchain networks in cross-chain management, chain_watcher.go: chain detection service, mainly used to detect different contract events in cross-chain management, such as pledge, transfer, etc. events.go: event management, relayer.go: relay management, utils.go: tool management, utils.go__failpoint_stash__ and binding__failpoint_binding__.go: intermediate files, used to restore the original program. The intermediate files can be cleared by the clearing command: $GOPATH / src / github.com / pingcap / failpoint / bin / failpoint-ctl disable.

[0121] S204. Compile the cross-chain bridge service test code according to the cross-chain bridge service intermediate file to obtain a cross-chain bridge service executable file.

[0122] In the present application, the computer device can compile and process the cross-chain bridge service test code according to the cross-chain bridge service intermediate file to obtain a cross-chain bridge service executable file. The cross-chain bridge service executable file can be a binary file, and the cross-chain bridge service executable file can be executed by the relay device.

[0123] S205. Trigger the relay device in the cross-chain bridge relay network, and perform abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service executable file and the test case to obtain an asset transfer result.

[0124] In the present application, a computer device can trigger a relay device in the cross-chain bridge relay network, and perform abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service executable file and the test case, and obtain an asset transfer result, so as to realize automated testing of the blockchain system.

[0125] Optionally, the above-mentioned triggering of the relay device in the above-mentioned cross-chain bridge relay network, according to the above-mentioned cross-chain bridge service executable file and the above-mentioned test case, performs abnormal asset transfer between the above-mentioned first blockchain network and the above-mentioned second blockchain network, and obtains the asset transfer result, including: the computer device can send the above-mentioned test case to the first node device in the above-mentioned first blockchain network, and the first node device in the above-mentioned first blockchain network is used to pledge the specified number of digital assets in the test account address to the contract address of the asset smart contract according to the above-mentioned test case. Then, the above-mentioned cross-chain bridge service executable file is sent to the relay device in the above-mentioned cross-chain bridge relay network; the above-mentioned relay device is triggered to execute the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes the pledge event, and obtains the abnormal execution result; the second node device in the above-mentioned second blockchain network generates the asset transfer result based on the above-mentioned abnormal execution result, and the above-mentioned pledge event refers to that the above-mentioned specified number of digital assets in the above-mentioned test account address have been pledged to the contract address of the above-mentioned asset smart contract.

[0126] Specifically, the computer device may send the test case to the first node device in the first blockchain network. After receiving the test case, the first node device in the first blockchain network calls the cross-chain bridge contract to verify the legitimacy of the first blockchain network, the second blockchain network, the test account address in the first blockchain network, the test account address in the second blockchain network, etc. When it is verified that the first blockchain network, the second blockchain network, the test account address in the first blockchain network, the test account address in the second blockchain network, etc. are all legitimate, the first node device may call the contract executor corresponding to the type of digital asset and execute the asset smart contract corresponding to the contract executor to mortgage the specified number of digital assets in the test account address in the first blockchain network to the contract address of the asset smart contract according to the above test case. Then, the computer device may send the cross-chain bridge service executable file to the relay device in the above cross-chain bridge relay network; after the relay device receives the cross-chain bridge service executable file, it may execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes the mortgage event, and skip the original asset transfer logic to obtain an abnormal execution result. The abnormal execution result reflects that the relay device has executed the abnormal asset transfer logic. The second node device in the second blockchain network can generate an asset transfer result based on the abnormal execution result, that is, the second node device in the second blockchain network can transfer a specified amount of digital assets from the contract address of the asset smart contract to the test account address in the second blockchain network based on the abnormal execution result, and obtain an asset transfer result indicating that the asset transfer is successful, that is, the second node device did not intercept the abnormal asset transfer. In one embodiment, the second node device can suspend the transfer of a specified amount of digital assets from the contract address of the asset smart contract to the test account address in the second blockchain network based on the abnormal execution result, and obtain an asset transfer result indicating that the asset transfer failed, that is, the second node device intercepted the abnormal asset transfer.

[0127] In one embodiment, the above-mentioned triggering of the above-mentioned relay device executes the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes a mortgage event, and obtains an abnormal execution result, including: the computer device can obtain the file package identifier of the file where the above-mentioned abnormal asset transfer logic is located, the abnormal logic identifier of the above-mentioned abnormal asset transfer logic, and the text identifier of the above-mentioned cross-chain bridge service executable file; modify the environment variables according to the above-mentioned file package identifier, the above-mentioned file identifier and the above-mentioned abnormal logic identifier; according to the above-mentioned modified environment variables, trigger the above-mentioned relay device to execute the above-mentioned abnormal asset transfer logic in the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes a mortgage event, and obtain an abnormal execution result.

[0128] Specifically, the computer device can trigger the relay device to execute the abnormal asset transfer logic by modifying the environment variables. During the implementation process, the computer device can obtain the file package identifier of the file where the abnormal asset transfer logic is located, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file, and modify the environment variables according to the file package identifier, the file identifier, and the abnormal logic identifier; if the environment variable indicates that the original asset transfer logic is executed after the mortgage event of the first blockchain network is detected, the modified environment variable indicates that the abnormal resource transfer logic is executed after the mortgage event of the first blockchain network is detected, and the original asset transfer logic is skipped. Further, the computer device can trigger the above-mentioned relay device to execute the above-mentioned abnormal asset transfer logic in the above-mentioned cross-chain bridge service executable file when the above-mentioned first node device executes the mortgage event according to the above-mentioned modified environment variables, and obtain an abnormal execution result.

[0129] In one embodiment, the above-mentioned triggering of the above-mentioned relay device executes the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes a mortgage event, and obtains an abnormal execution result, including: the computer device can obtain the file package identifier of the file where the above-mentioned abnormal asset transfer logic is located, the abnormal logic identifier of the above-mentioned abnormal asset transfer logic, and the text identifier of the above-mentioned cross-chain bridge service executable file; according to the above-mentioned file package identifier, the above-mentioned file identifier and the above-mentioned abnormal logic identifier, generate an execution request for the above-mentioned abnormal asset transfer logic; send the above-mentioned execution request to the above-mentioned relay device, and the above-mentioned execution request is used to instruct the above-mentioned relay device to execute the above-mentioned abnormal asset transfer logic in the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes a mortgage event, and obtain an abnormal execution result.

[0130] Specifically, the computer device can trigger the relay device to execute the abnormal resource transfer logic by sending an http request. In the specific implementation process, the computer device can obtain the file package identifier of the file where the abnormal asset transfer logic is located, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the above-mentioned cross-chain bridge service executable file. Further, according to the above-mentioned file package identifier, the above-mentioned file identifier and the above-mentioned abnormal logic identifier, an execution activation instruction for the abnormal asset transfer logic is generated, and the execution activation instruction is used to instruct the relay device to execute the abnormal asset transfer logic. For example, the execution activation instruction is curl-XPUT-d'return(true)'{yourproject} / {package} / after_receive_event_reject_vote, where packag is the file package identifier of the file where your abnormal asset transfer logic is located, after_receive_event_reject_vote is the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the yourproject cross-chain bridge service executable file. Then, an execution request carrying the execution activation instruction is generated; and the above-mentioned execution request is sent to the above-mentioned relay device. The above-mentioned execution request is used to instruct the above-mentioned relay device to execute the above-mentioned abnormal asset transfer logic in the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes a mortgage event, and obtain an abnormal execution result.

[0131] In one embodiment, the execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes a mortgage event, so as to suspend consensus on the mortgage event and generate an abnormal execution result in which the mortgage event is not consensused, that is, not voting on the asset transfer.

[0132] In one embodiment, the execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes a mortgage event, so as to generate an abnormal execution result indicating that the consensus of the mortgage event has not been passed, that is, a negative vote on the asset transfer.

[0133] S206. Based on the asset transfer result, test the blockchain system's interception performance against abnormal asset transfers.

[0134] In one embodiment, the above-mentioned test of the interception performance of the above-mentioned blockchain system for abnormal asset transfers based on the above-mentioned asset transfer results includes: the computer device can count the number of successes corresponding to the successful abnormal asset transfers of the above-mentioned blockchain system based on the above-mentioned asset transfer results, and the number of successes can refer to the number of times the blockchain system did not intercept the abnormal asset transfers. If the above-mentioned number of successes is greater than the second number threshold, it is determined that the interception performance of the above-mentioned blockchain system for abnormal asset transfers is abnormal, that is, the interception performance of the blockchain system for abnormal asset transfers is relatively poor. If the number of successes is less than or equal to the second threshold number, it is determined that the interception performance of the blockchain system for abnormal asset transfers is normal, that is, the blockchain system can successfully intercept abnormal asset transfers, that is, the blockchain system has interception performance for abnormal asset transfers.

[0135] In one embodiment, the computer device can generate a suspension request for the abnormal asset transfer logic based on the file package identifier, the file identifier and the abnormal logic identifier; send the suspension request to the relay device, and the suspension request is used to instruct the relay device to suspend the execution of the abnormal asset transfer logic in the cross-chain bridge service executable file when it detects the first node device executing the mortgage event again, and execute the original asset transfer logic in the cross-chain bridge service executable file to obtain the original execution result. The second node device in the second blockchain network generates an updated asset transfer result based on the original execution result; and tests the asset transfer performance of the blockchain system based on the updated asset transfer result.

[0136] Specifically, the computer device can dynamically close the abnormal asset transfer logic. During the implementation process, the computer device can generate a closing instruction about the abnormal asset transfer logic according to the above-mentioned file package identifier, the above-mentioned file identifier and the above-mentioned abnormal logic identifier, and generate a suspension execution request carrying the closing instruction. If the closing instruction is used to suspend the execution of the abnormal asset transfer logic and execute the original asset transfer logic to dynamically close the abnormal asset transfer logic, the closing instruction can be curl-XDELETE-d{yourproject} / {package} / after_receive_event_reject_vote. Further, the suspension execution request is sent to the relay device. When the relay device detects that the first node device executes the mortgage event again, it can suspend the execution of the abnormal asset transfer logic in the cross-chain bridge service executable file, execute the original asset transfer logic in the cross-chain bridge service executable file, and obtain the original execution result. The original execution result is the consensus result of the relay device for the mortgage event. If the consensus result is that the mortgage event consensus is passed, and the updated asset transfer result indicates that the second node device has not transferred the specified number of digital assets in the contract address of the asset smart contract to the test account address in the second blockchain network, it is determined that the blockchain system does not have asset transfer performance. If the consensus result is that the mortgage event consensus is passed, and the updated asset transfer result indicates that the second node device has transferred the specified number of digital assets in the contract address of the asset smart contract to the test account address in the second blockchain network, it is determined that the blockchain system has asset transfer performance. If the consensus result is that the mortgage event consensus is not passed, and the updated asset transfer result indicates that the second node device has not transferred the specified number of digital assets in the contract address of the asset smart contract to the test account address in the second blockchain network, it is determined that the blockchain system has asset transfer performance. If the consensus result is that the mortgage event consensus is not passed, and the updated asset transfer result indicates that the second node device has transferred the specified number of digital assets in the contract address of the asset smart contract to the test account address in the second blockchain network, it is determined that the blockchain system has asset transfer performance abnormality.

[0137] In one embodiment, when the consensus result is that the consensus of the mortgage event is passed, the asset transfer performance of the above-mentioned blockchain system is tested according to the above-mentioned updated asset transfer result, including: the computer device can count the number of failures corresponding to the original asset transfer failures of the above-mentioned blockchain system according to the above-mentioned updated asset transfer result; if the above-mentioned number of failures is greater than the first number threshold, it is determined that the asset transfer performance of the above-mentioned blockchain system is abnormal; if the above-mentioned number of failures is less than or equal to the first number threshold, it is determined that the asset transfer performance of the above-mentioned blockchain system is normal.

[0138] In this application, by automatically detecting the location of the original asset transfer logic in the cross-chain bridge service source code corresponding to the cross-chain relay network, the abnormal asset transfer logic is automatically injected at the location, the cross-chain bridge service test code is obtained, the node device in the cross-chain bridge relay network is triggered, and the abnormal asset transfer is performed between different blockchain networks according to the cross-chain bridge service test code and the test case, and the asset transfer result is obtained. According to the asset transfer result, the interception performance of the blockchain system for abnormal asset transfer is automatically tested. In the process of testing the blockchain system, there is no need to perform complex operations such as unpacking, subpackaging, assembling, and decrypting data packets, thereby improving the testing efficiency of the blockchain system and reducing the testing cost. At the same time, the abnormal asset transfer logic can cover the abnormal scenarios in the cross-chain asset transfer event, which is conducive to the comprehensive testing of the blockchain system and the comprehensiveness of the cross-chain asset transfer test of the blockchain system. In turn, it is conducive to the optimization of the blockchain system by developers based on the test results of the blockchain system to improve the security of the cross-chain asset transfer of the blockchain system and enable the blockchain system to accurately intercept abnormal asset transfers.

[0139] In one embodiment, Figure 6 As shown in the figure, the blockchain system needs to go through the process of cross-chain product testing and security testing before it can be released and launched. The cross-chain product testing includes the following steps: 1. Develop the relay device of the cross-chain bridge, that is, generate the cross-chain bridge service source code corresponding to the relay device; 2. Develop and test each module to REQ, that is, submit the modules to be tested in the blockchain system to the test management platform. REQ refers to the software development and testing process management platform (referred to as the test management platform), which is used to manage the software version development, testing, defect submission, regression testing, and release of the blockchain system throughout the life cycle. 3. REQ platform distribution, that is, the test management platform distributes the test tasks to the computer equipment; 4. After the review is passed, enter the test process, that is, the test personnel corresponding to the computer equipment will review the test tasks. When the review is passed, the basic functions of the blockchain system will be tested. After the blockchain system completes the basic function test, it will enter the abnormal asset transfer scenario test (i.e., the security test process). The basic function test can refer to testing whether the blockchain system has the cross-chain asset transfer function.

[0140] Further, the security testing process includes the following steps: 1. Dynamically inject abnormal asset transfer logic, that is, the computer device can detect the location of the original asset transfer logic in the cross-chain bridge service source code, and dynamically inject the abnormal asset transfer logic at this location to obtain the cross-chain bridge service test code; 2. Automatic editing and distribution, the computer device can self-compile the cross-chain bridge service test code to obtain the cross-chain bridge service executable file, and send the cross-chain bridge service executable file to the relay device in the cross-chain bridge service network. 3. Trigger the start of the abnormal asset transfer logic. The computer device can trigger the relay device to execute the abnormal resource transfer logic when detecting the mortgage event of the digital asset by modifying the environment variable or sending an http request, and obtain the abnormal execution result. 4. Execute the test case of cross-chain asset transfer, that is, send the test case to the first node device in the first blockchain network, and the first node device can execute the test case of cross-chain asset transfer to mortgage the specified number of digital assets in the test account address to the contract address of the asset smart contract. The node device in the second blockchain network can generate an asset transfer result based on the abnormal execution result, and determine the impact of the abnormal asset transfer on the cross-chain asset transfer based on the asset transfer result. If the asset transfer result is an asset transfer failure, it indicates that the blockchain system will successfully intercept the abnormal asset transfer, that is, the abnormal asset transfer has no impact on the cross-chain asset transfer. If the asset transfer result is an asset transfer success, it indicates that the blockchain system cannot intercept the abnormal asset transfer, that is, the abnormal asset transfer has an impact on the cross-chain asset transfer, that is, the security of the blockchain system is relatively low. Therefore, the node device can analyze the impact of the abnormal asset transfer on the cross-chain asset transfer to generate a test report on the blockchain system. When the test report reflects that the blockchain system failed to successfully intercept the abnormal asset transfer, the blockchain system can be repaired based on the test report. When the test report reflects that the blockchain system can successfully intercept the abnormal asset transfer, the blockchain system can be released online to improve the security, stability, correctness and fault tolerance of the blockchain system.

[0141] In one embodiment, Figure 7 As shown, the first blockchain network includes node devices 70a, 71a, 72a and 73a, and the first blockchain network corresponds to blockchain A; the second blockchain network includes node devices 74a, 75a, 76a and 77a, and the second blockchain network corresponds to blockchain B. The blockchain system testing method in this application may include the following steps S71 to S75:

[0142] S71. Inject the abnormal asset transfer logic into the cross-chain bridge service source code to obtain the cross-chain bridge service test code; specifically, the computer device can detect the location point of the original asset transfer logic in the cross-chain bridge service source code as the abnormal insertion point, and inject the abnormal asset transfer logic into the abnormal insertion point to obtain the cross-chain bridge service test code.

[0143] S72. Self-compile the cross-chain bridge service test code; specifically, the computer device can self-compile the cross-chain bridge service test code to obtain the cross-chain bridge service executable file.

[0144] S73. Deploy a relay device with abnormal asset transfer logic; specifically, the computer device can send the cross-chain bridge service executable file to the relay device in the cross-chain bridge relay network.

[0145] S74. Triggering the shutdown or startup of the abnormal asset transfer logic. The computer device may trigger the relay device to shut down or start the abnormal asset transfer logic by modifying the environment variables or sending an http request.

[0146] S75. Generate a test report. The computer device can send the test case corresponding to the cross-chain asset transfer to any first node device in the first blockchain network, and the first node device can execute the test case to pledge the specified number of digital assets in the test account address to the contract address of the asset smart contract in the first blockchain network. When the cross-chain bridge relay network detects a pledge event, it can execute the abnormal transfer logic to obtain an abnormal execution result. The node device in the second blockchain network can obtain the asset transfer result based on the abnormal execution result, and the asset transfer result can be obtained from the abnormal operation log in the second blockchain network. Determine the interception performance of the blockchain system for abnormal asset transfer based on the asset transfer result, obtain the test result, and generate a test report based on the test result.

[0147] In summary, by automatically detecting the location of the original asset transfer logic in the cross-chain bridge service source code corresponding to the cross-chain relay network, the abnormal asset transfer logic is automatically injected at the location, the cross-chain bridge service test code is obtained, the node device in the cross-chain bridge relay network is triggered, and the abnormal asset transfer is performed between different blockchain networks according to the cross-chain bridge service test code and the test case to obtain the asset transfer result. According to the asset transfer result, the interception performance of the blockchain system for abnormal asset transfer is automatically tested. In the process of testing the blockchain system, there is no need to perform complex operations such as unpacking, subpackaging, assembling, and decrypting data packets, which improves the testing efficiency of the blockchain system and reduces the testing cost. At the same time, the abnormal asset transfer logic can cover the abnormal scenarios in the cross-chain asset transfer event, which is conducive to the comprehensive testing of the blockchain system and the comprehensiveness of the cross-chain asset transfer test of the blockchain system. In turn, it is conducive to the optimization of the blockchain system by developers based on the test results of the blockchain system to improve the security of the cross-chain asset transfer of the blockchain system and enable the blockchain system to accurately intercept abnormal asset transfers.

[0148] See also Figure 8 , is a schematic diagram of the structure of a blockchain system testing device provided in an embodiment of the present application. The above-mentioned blockchain-based blockchain system testing device can be a computer program (including program code) running in a network device. For example, the blockchain-based blockchain system testing device is an application software; the device can be used to execute the corresponding steps in the method provided in an embodiment of the present application. Figure 8 As shown, the blockchain system testing device may include:

[0149] An acquisition module 811 is used to acquire a test case for performing an asset transfer test on a blockchain system, and a cross-chain bridge service source code of a cross-chain bridge relay network; the blockchain system includes a first blockchain network, a second blockchain network, and the cross-chain bridge relay network, and the cross-chain bridge relay network is used to perform asset transfer between the first blockchain network and the second blockchain network based on the cross-chain bridge service source code;

[0150] The injection module 812 is used to detect the location of the original asset transfer logic in the cross-chain bridge service source code, inject the abnormal asset transfer logic at the location, and obtain the cross-chain bridge service test code;

[0151] The trigger module 813 is used to trigger the relay device in the cross-chain bridge relay network, and perform abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, to obtain the asset transfer result;

[0152] The testing module 814 is used to test the interception performance of the above-mentioned blockchain system against abnormal asset transfers based on the above-mentioned asset transfer results.

[0153] Optionally, the injection module 812 includes a detection unit 81a and an adding unit 82a;

[0154] Detection unit 81a, used to detect the location of the original asset transfer logic in the cross-chain bridge service source code as an abnormal insertion point;

[0155] The adding unit 82a is used to add the above-mentioned abnormal asset transfer logic at the abnormal insertion point in the above-mentioned cross-chain bridge service source code to obtain the cross-chain bridge service test code.

[0156] Optionally, the trigger module 813 includes a calling unit 83b, a compiling unit 84b and a triggering unit 85b;

[0157] The calling unit 83b is used to call the activation instruction, activate the cross-chain bridge service test code, and obtain the cross-chain bridge service intermediate file;

[0158] The compiling unit 84b is used to compile the cross-chain bridge service test code according to the cross-chain bridge service intermediate file to obtain a cross-chain bridge service executable file;

[0159] The trigger unit 85b is used to trigger the relay device in the above-mentioned cross-chain bridge relay network, and perform abnormal asset transfer between the above-mentioned first blockchain network and the above-mentioned second blockchain network according to the above-mentioned cross-chain bridge service executable file and the above-mentioned test case to obtain the asset transfer result.

[0160] Optionally, the trigger unit 85b triggers the relay device in the cross-chain bridge relay network, and performs abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service executable file and the test case, and obtains an asset transfer result, including:

[0161] Send the test case to the first node device in the first blockchain network, and the first node device in the first blockchain network is used to pledge the specified amount of digital assets in the test account address to the contract address of the asset smart contract according to the test case;

[0162] Send the above cross-chain bridge service executable file to the relay device in the above cross-chain bridge relay network;

[0163] The above-mentioned relay device is triggered to execute the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes a pledge event, and obtain an abnormal execution result; the second node device in the above-mentioned second blockchain network generates an asset transfer result based on the above-mentioned abnormal execution result, and the above-mentioned pledge event refers to that the above-mentioned specified number of digital assets of the above-mentioned test account address has been pledged to the contract address of the above-mentioned asset smart contract.

[0164] Optionally, the trigger unit 85b triggers the relay device to execute the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtains an abnormal execution result, including:

[0165] Obtain the file package identifier of the file containing the abnormal asset transfer logic, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file;

[0166] Modify the environment variables according to the file package identifier, the file identifier and the abnormal logic identifier;

[0167] According to the modified environment variables, the relay device is triggered to execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtain an abnormal execution result.

[0168] Optionally, the trigger unit 85b triggers the relay device to execute the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtains an abnormal execution result, including:

[0169] Obtain the file package identifier of the file containing the abnormal asset transfer logic, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file;

[0170] Generate an execution request for the abnormal asset transfer logic according to the file package identifier, the file identifier and the abnormal logic identifier;

[0171] The execution request is sent to the relay device. The execution request is used to instruct the relay device to execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtain an abnormal execution result.

[0172] Optionally, the execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes the mortgage event, so as to suspend consensus on the mortgage event and generate an abnormal execution result that the mortgage event has not been consensused; or,

[0173] The execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes a mortgage event, so as to generate an abnormal execution result indicating that the consensus of the mortgage event has not been passed.

[0174] Optionally, the device may further include a generating module 815 and a sending module 816;

[0175] A generating module 815, configured to generate a request for suspending execution of the abnormal asset transfer logic according to the file package identifier, the file identifier and the abnormal logic identifier;

[0176] The sending module 816 is used to send the above-mentioned suspension execution request to the above-mentioned relay device, and the above-mentioned suspension execution request is used to instruct the above-mentioned relay device to suspend the execution of the above-mentioned abnormal asset transfer logic in the above-mentioned cross-chain bridge service executable file when it detects that the above-mentioned first node device executes the mortgage event again, and execute the above-mentioned original asset transfer logic in the above-mentioned cross-chain bridge service executable file to obtain the original execution result; the second node device in the above-mentioned second blockchain network generates an updated asset transfer result based on the above-mentioned original execution result;

[0177] The testing module 814 is also used to test the asset transfer performance of the above-mentioned blockchain system according to the above-mentioned updated asset transfer result.

[0178] Optionally, the testing module 814 tests the asset transfer performance of the blockchain system according to the updated asset transfer result, including:

[0179] According to the above updated asset transfer results, count the number of failures corresponding to the original asset transfer failures of the above blockchain system;

[0180] If the number of failures is greater than the first number threshold, it is determined that the asset transfer performance of the blockchain system is abnormal.

[0181] Optionally, the testing module 814 tests the interception performance of the blockchain system for abnormal asset transfers according to the asset transfer results, including:

[0182] According to the above asset transfer results, the number of successful abnormal asset transfers of the above blockchain system is counted;

[0183] If the above number of successes is greater than the second number threshold, it is determined that the interception performance of the above blockchain system for abnormal asset transfer is abnormal.

[0184] According to one embodiment of the present application, the steps involved in the blockchain system testing method shown above can be Figure 8 The various modules in the blockchain system test device shown are executed. For example, Figure 4 The step S101 shown in FIG. 1 can be performed by Figure 8 The acquisition module 811 in is executed, Figure 4 The step S102 shown in FIG. 1 can be performed by Figure 8 The injection module 812 is executed; Figure 4 The step S103 shown in FIG. 1 can be performed by Figure 8 The trigger module 813 in is executed; Figure 4 The step S104 shown in FIG. 1 can be performed by Figure 8 The test module 814 in is executed.

[0185] According to one embodiment of the present application, Figure 8 The various modules in the blockchain system testing device shown can be separately or completely combined into one or several units to constitute, or one (some) of the units can be further divided into at least two functionally smaller sub-units, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In practical applications, the functions of one module can also be implemented by at least two units, or the functions of at least two modules can be implemented by one unit. In other embodiments of the present application, the blockchain system testing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units and can be implemented by the collaboration of at least two units.

[0186] According to one embodiment of the present application, a computer program (including program code) capable of executing each step involved in the corresponding method as shown above can be constructed by running a computer program (including program code) on a general-purpose computer device such as a computer including a central processing unit (CPU), a random access storage medium (RAM), a read-only storage medium (ROM) and other processing components and storage components. Figure 8 The blockchain system testing device shown in the embodiment of the present application is implemented by the blockchain system testing method. The above computer program can be recorded on, for example, a computer-readable recording medium, and loaded into the above computing device through the computer-readable recording medium, and run therein.

[0187] In this application, by automatically detecting the location of the original asset transfer logic in the cross-chain bridge service source code corresponding to the cross-chain relay network, the abnormal asset transfer logic is automatically injected at the location, the cross-chain bridge service test code is obtained, the node device in the cross-chain bridge relay network is triggered, and the abnormal asset transfer is performed between different blockchain networks according to the cross-chain bridge service test code and the test case, and the asset transfer result is obtained. According to the asset transfer result, the interception performance of the blockchain system for abnormal asset transfer is automatically tested. In the process of testing the blockchain system, there is no need to perform complex operations such as unpacking, subpackaging, assembling, and decrypting data packets, thereby improving the testing efficiency of the blockchain system and reducing the testing cost. At the same time, the abnormal asset transfer logic can cover the abnormal scenarios in the cross-chain asset transfer event, which is conducive to the comprehensive testing of the blockchain system and the comprehensiveness of the cross-chain asset transfer test of the blockchain system. In turn, it is conducive to the optimization of the blockchain system by developers based on the test results of the blockchain system to improve the security of the cross-chain asset transfer of the blockchain system and enable the blockchain system to accurately intercept abnormal asset transfers.

[0188] See also Fig. 9 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig. 9 As shown, the above-mentioned computer device 1000 may refer to a terminal or a server, including: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, in some embodiments, the user interface 1003 may include a display screen (DiSPlay), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatileMeMory), such as at least one disk storage. The memory 1005 may also be optionally at least one storage device away from the aforementioned processor 1001. As Fig. 9 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a computer program.

[0189] exist Fig. 9 In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call a computer program stored in the memory 1005 to execute:

[0190] Obtaining a test case for asset transfer testing of a blockchain system and a cross-chain bridge service source code of a cross-chain bridge relay network; the blockchain system includes a first blockchain network, a second blockchain network, and the cross-chain bridge relay network, and the cross-chain bridge relay network is used to transfer assets between the first blockchain network and the second blockchain network based on the cross-chain bridge service source code;

[0191] Detect the location of the original asset transfer logic in the above cross-chain bridge service source code, inject abnormal asset transfer logic at the above location, and obtain the cross-chain bridge service test code;

[0192] Trigger the relay device in the cross-chain bridge relay network, perform abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, and obtain the asset transfer result;

[0193] Based on the above asset transfer results, test the interception performance of the above blockchain system against abnormal asset transfers.

[0194] Optionally, the processor 1001 calls the computer program stored in the memory 1005 to execute the detection of the location point where the original asset transfer logic in the cross-chain bridge service source code is located, and injects the abnormal asset transfer logic at the above location point to obtain the cross-chain bridge service test code, including:

[0195] Detect the location of the original asset transfer logic in the source code of the above cross-chain bridge service as the abnormal insertion point;

[0196] Add the above abnormal asset transfer logic at the abnormal insertion point in the above cross-chain bridge service source code to obtain the cross-chain bridge service test code.

[0197] Optionally, the processor 1001 calls the computer program stored in the memory 1005 to execute and trigger the relay device in the cross-chain bridge relay network, and performs abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, and obtains the asset transfer result, including:

[0198] Call the activation instruction to activate the above cross-chain bridge service test code and obtain the cross-chain bridge service intermediate file;

[0199] According to the above cross-chain bridge service intermediate file, compile the above cross-chain bridge service test code to obtain a cross-chain bridge service executable file;

[0200] The relay device in the cross-chain bridge relay network is triggered, and according to the cross-chain bridge service executable file and the test case, an abnormal asset transfer is performed between the first blockchain network and the second blockchain network to obtain an asset transfer result.

[0201] Optionally, the processor 1001 calls the computer program stored in the memory 1005 to execute and trigger the relay device in the cross-chain bridge relay network, and performs abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service executable file and the test case, and obtains an asset transfer result, including:

[0202] Send the test case to the first node device in the first blockchain network, and the first node device in the first blockchain network is used to pledge the specified amount of digital assets in the test account address to the contract address of the asset smart contract according to the test case;

[0203] Send the above cross-chain bridge service executable file to the relay device in the above cross-chain bridge relay network;

[0204] The above-mentioned relay device is triggered to execute the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes a pledge event, and obtain an abnormal execution result; the second node device in the above-mentioned second blockchain network generates an asset transfer result based on the above-mentioned abnormal execution result, and the above-mentioned pledge event refers to that the above-mentioned specified number of digital assets of the above-mentioned test account address has been pledged to the contract address of the above-mentioned asset smart contract.

[0205] Optionally, the processor 1001 calls the computer program stored in the memory 1005 to trigger the above-mentioned relay device to execute the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes the mortgage event, and obtains an abnormal execution result, including:

[0206] Obtain the file package identifier of the file containing the abnormal asset transfer logic, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file;

[0207] Modify the environment variables according to the file package identifier, the file identifier and the abnormal logic identifier;

[0208] According to the modified environment variables, the relay device is triggered to execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtain an abnormal execution result.

[0209] Optionally, the processor 1001 calls the computer program stored in the memory 1005 to trigger the above-mentioned relay device to execute the above-mentioned cross-chain bridge service executable file when detecting that the above-mentioned first node device executes the mortgage event, and obtains an abnormal execution result, including:

[0210] Obtain the file package identifier of the file containing the abnormal asset transfer logic, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file;

[0211] Generate an execution request for the abnormal asset transfer logic according to the file package identifier, the file identifier and the abnormal logic identifier;

[0212] The execution request is sent to the relay device. The execution request is used to instruct the relay device to execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtain an abnormal execution result.

[0213] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute an execution request to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes a mortgage event, so as to suspend consensus on the mortgage event and generate an abnormal execution result that the mortgage event is not consensused; or,

[0214] The execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes a mortgage event, so as to generate an abnormal execution result indicating that the consensus of the mortgage event has not been passed.

[0215] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute:

[0216] Generate a request for suspending execution of the abnormal asset transfer logic according to the file package identifier, the file identifier and the abnormal logic identifier;

[0217] The suspension execution request is sent to the relay device, and the suspension execution request is used to instruct the relay device to suspend the execution of the abnormal asset transfer logic in the cross-chain bridge service executable file when the first node device executes the mortgage event again, and execute the original asset transfer logic in the cross-chain bridge service executable file to obtain the original execution result; the second node device in the second blockchain network generates an updated asset transfer result based on the original execution result;

[0218] Based on the above updated asset transfer results, test the asset transfer performance of the above blockchain system.

[0219] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute, according to the updated asset transfer result, testing the asset transfer performance of the blockchain system, including:

[0220] According to the above updated asset transfer results, count the number of failures corresponding to the original asset transfer failures of the above blockchain system;

[0221] If the number of failures is greater than the first number threshold, it is determined that the asset transfer performance of the blockchain system is abnormal.

[0222] Optionally, the processor 1001 calls a computer program stored in the memory 1005 to execute, based on the asset transfer result, testing the interception performance of the blockchain system for abnormal asset transfer, including:

[0223] According to the above asset transfer results, the number of successful abnormal asset transfers of the above blockchain system is counted;

[0224] If the above number of successes is greater than the second number threshold, it is determined that the interception performance of the above blockchain system for abnormal asset transfer is abnormal.

[0225] In this application, by automatically detecting the location of the original asset transfer logic in the cross-chain bridge service source code corresponding to the cross-chain relay network, the abnormal asset transfer logic is automatically injected at the location, the cross-chain bridge service test code is obtained, the node device in the cross-chain bridge relay network is triggered, and the abnormal asset transfer is performed between different blockchain networks according to the cross-chain bridge service test code and the test case, and the asset transfer result is obtained. According to the asset transfer result, the interception performance of the blockchain system for abnormal asset transfer is automatically tested. In the process of testing the blockchain system, there is no need to perform complex operations such as unpacking, subpackaging, assembling, and decrypting data packets, thereby improving the testing efficiency of the blockchain system and reducing the testing cost. At the same time, the abnormal asset transfer logic can cover the abnormal scenarios in the cross-chain asset transfer event, which is conducive to the comprehensive testing of the blockchain system and the comprehensiveness of the cross-chain asset transfer test of the blockchain system. In turn, it is conducive to the optimization of the blockchain system by developers based on the test results of the blockchain system to improve the security of the cross-chain asset transfer of the blockchain system and enable the blockchain system to accurately intercept abnormal asset transfers.

[0226] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the blockchain system testing device mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the blockchain system testing method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0227] As an example, the above program instructions may be deployed on a computer device for execution, or deployed on at least two computer devices at one location for execution, or, executed on at least two computer devices distributed at at least two locations and triggering the interconnection of a communication network. At least two computer devices distributed at at least two locations and triggering the interconnection of a communication network may constitute a blockchain network.

[0228] The computer-readable storage medium may be the blockchain system testing device provided in any of the aforementioned embodiments or the central storage unit of the computer device, such as a hard disk or a central storage of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SMART Media card, SMC), a secure digital (Secure digital, SD) card, a flash memory card (flaSh card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the central storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0229] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish between contents in different media, rather than to describe a specific order. In addition, the terms "including" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other step units inherent to these processes, methods, devices, products, or equipment.

[0230] The collection and processing of relevant data in this application (such as the initial behavioral characteristics corresponding to the user's interaction behavior, and the user's object characteristics, etc.) should be strictly in accordance with the requirements of relevant national laws and regulations when applied in instances, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.

[0231] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the description of the above-mentioned blockchain system testing method and decoding method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the embodiment of the computer program product involved in this application, please refer to the description of the method embodiment of this application.

[0232] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0233] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided by the embodiment of the present application. Specifically, each process and / or box in the method flow chart and / or structural diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network connection device to generate a machine, so that the instructions executed by the processor of the computer or other programmable network connection device are triggered to generate instructions for implementing the process in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable network-connected device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1These computer program instructions can also be loaded onto a computer or other programmable network connected device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A flow or multiple flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.

[0234] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A blockchain system testing method, characterized in that: include: Obtain test cases for asset transfer testing of blockchain systems and the cross-chain bridge service source code of the cross-chain bridge relay network; The blockchain system includes a first blockchain network, a second blockchain network, and the cross-chain bridge relay network, wherein the cross-chain bridge relay network is used to transfer assets between the first blockchain network and the second blockchain network based on the cross-chain bridge service source code; Detect the location of the original asset transfer logic in the cross-chain bridge service source code, inject the abnormal asset transfer logic at the location, and obtain the cross-chain bridge service test code; Triggering a relay device in the cross-chain bridge relay network, performing abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, and obtaining an asset transfer result; Based on the asset transfer results, the interception performance of the blockchain system for abnormal asset transfers is tested.

2. The method according to claim 1, characterized in that The detecting the location point where the original asset transfer logic is located in the cross-chain bridge service source code, injecting the abnormal asset transfer logic at the location point, and obtaining the cross-chain bridge service test code includes: Detect the location of the original asset transfer logic in the cross-chain bridge service source code as an abnormal insertion point; The abnormal asset transfer logic is added at the abnormal insertion point in the cross-chain bridge service source code to obtain the cross-chain bridge service test code.

3. The method according to claim 1, characterized in that: The triggering of the relay device in the cross-chain bridge relay network, performing abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, and obtaining an asset transfer result includes: Calling the activation instruction to activate the cross-chain bridge service test code and obtain the cross-chain bridge service intermediate file; Compile the cross-chain bridge service test code according to the cross-chain bridge service intermediate file to obtain a cross-chain bridge service executable file; The relay device in the cross-chain bridge relay network is triggered, and according to the cross-chain bridge service executable file and the test case, an abnormal asset transfer is performed between the first blockchain network and the second blockchain network to obtain an asset transfer result.

4. The method according to claim 3, characterized in that: The triggering of the relay device in the cross-chain bridge relay network, performing abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service executable file and the test case, and obtaining an asset transfer result includes: Sending the test case to a first node device in the first blockchain network, where the first node device in the first blockchain network is used to pledge a specified amount of digital assets in the test account address to the contract address of the asset smart contract according to the test case; Sending the cross-chain bridge service executable file to a relay device in the cross-chain bridge relay network; The relay device is triggered to execute the cross-chain bridge service executable file when detecting that the first node device executes a pledge event, and obtain an abnormal execution result; the second node device in the second blockchain network generates an asset transfer result based on the abnormal execution result, and the pledge event refers to that the specified number of digital assets of the test account address has been pledged to the contract address of the asset smart contract.

5. The method according to claim 4, characterized in that The triggering of the relay device, when detecting that the first node device executes a mortgage event, executes the cross-chain bridge service executable file and obtains an abnormal execution result, including: Obtain the file package identifier of the file where the abnormal asset transfer logic is located, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file; Modify the environment variable according to the file package identifier, the file identifier and the abnormal logic identifier; According to the modified environment variables, the relay device is triggered to execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtain an abnormal execution result.

6. The method according to claim 4, characterized in that The triggering of the relay device, when detecting that the first node device executes a mortgage event, executes the cross-chain bridge service executable file and obtains an abnormal execution result, including: Obtain the file package identifier of the file where the abnormal asset transfer logic is located, the abnormal logic identifier of the abnormal asset transfer logic, and the text identifier of the cross-chain bridge service executable file; Generate an execution request for the abnormal asset transfer logic according to the file package identifier, the file identifier and the abnormal logic identifier; The execution request is sent to the relay device, and the execution request is used to instruct the relay device to execute the abnormal asset transfer logic in the cross-chain bridge service executable file when detecting that the first node device executes a mortgage event, and obtain an abnormal execution result.

7. The method according to claim 5, characterized in that The execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes a mortgage event, so as to suspend consensus on the mortgage event and generate an abnormal execution result that the mortgage event has not been consensused; or, The execution request is used to instruct the relay device to execute the abnormal asset transfer logic when detecting that the first device executes a mortgage event, so as to generate an abnormal execution result indicating that the mortgage event consensus has not passed.

8. The method according to claim 5, characterized in that The method further comprises: Generate a request for suspending execution of the abnormal asset transfer logic according to the file package identifier, the file identifier and the abnormal logic identifier; The execution suspension request is sent to the relay device, and the execution suspension request is used to instruct the relay device to suspend the execution of the abnormal asset transfer logic in the cross-chain bridge service executable file when it detects that the first node device executes the mortgage event again, and execute the original asset transfer logic in the cross-chain bridge service executable file to obtain the original execution result; the second node device in the second blockchain network generates an updated asset transfer result based on the original execution result; According to the updated asset transfer result, the asset transfer performance of the blockchain system is tested.

9. The method according to claim 8, characterized in that The step of testing the asset transfer performance of the blockchain system according to the updated asset transfer result includes: According to the updated asset transfer result, counting the number of failures corresponding to the original asset transfer failures of the blockchain system; If the number of failures is greater than the first number threshold, it is determined that the asset transfer performance of the blockchain system is abnormal.

10. The method according to claim 1, characterized in that The step of testing the interception performance of the blockchain system for abnormal asset transfer according to the asset transfer result includes: According to the asset transfer result, the number of successful abnormal asset transfers of the blockchain system is counted; If the number of successes is greater than the second number threshold, it is determined that the interception performance of the blockchain system for abnormal asset transfers is abnormal.

11. A blockchain system testing device, characterized in that: include: An acquisition module for acquiring test cases for asset transfer testing of blockchain systems and the cross-chain bridge service source code of the cross-chain bridge relay network; The blockchain system includes a first blockchain network, a second blockchain network, and the cross-chain bridge relay network, wherein the cross-chain bridge relay network is used to transfer assets between the first blockchain network and the second blockchain network based on the cross-chain bridge service source code; An injection module is used to detect the location of the original asset transfer logic in the cross-chain bridge service source code, and inject the abnormal asset transfer logic at the location to obtain the cross-chain bridge service test code; A trigger module, used to trigger the relay device in the cross-chain bridge relay network, perform abnormal asset transfer between the first blockchain network and the second blockchain network according to the cross-chain bridge service test code and the test case, and obtain an asset transfer result; The testing module is used to test the interception performance of the blockchain system for abnormal asset transfer according to the asset transfer result.

12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 10 are implemented.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.