WO2021175053A1 - 一种在虚拟机中执行功能模块的方法和装置 - Google Patents

一种在虚拟机中执行功能模块的方法和装置 Download PDF

Info

Publication number
WO2021175053A1
WO2021175053A1 PCT/CN2021/074399 CN2021074399W WO2021175053A1 WO 2021175053 A1 WO2021175053 A1 WO 2021175053A1 CN 2021074399 W CN2021074399 W CN 2021074399W WO 2021175053 A1 WO2021175053 A1 WO 2021175053A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
global variable
module
contract
wasm
Prior art date
Application number
PCT/CN2021/074399
Other languages
English (en)
French (fr)
Inventor
郭学鹏
林志平
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2021175053A1 publication Critical patent/WO2021175053A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Definitions

  • One or more embodiments of this specification relate to the field of blockchain technology, and more specifically, to a method and device for executing functional modules in a virtual machine
  • Virtual Machine is a complete computer system with complete hardware system functions that is simulated by software and runs in a completely isolated environment. Since the virtual machine can isolate the impact of the underlying hardware platform and operating system on the upper-layer applications, it is very beneficial to the development of the upper-layer applications. There is no need to pay attention to the details of the underlying platform in the upper-level application development process, only the specific business logic. After the development is completed, the virtual machine runs the upper-layer application and is responsible for converting the application code into code suitable for execution on the underlying platform. Specifically, in many scenarios, upper-level applications are written and developed by developers using high-level languages, and then compiled into bytecode by a compiler.
  • Bytecode is an execution program, a binary file composed of a sequence of operation code (op code)-data pairs, which is a kind of intermediate code. Then, the interpreter in the virtual machine interprets and executes the instruction stream represented by the bytecode.
  • a virtual machine can be deployed in each node of the blockchain network.
  • Users can write a smart contract in a high-level language, and then compile it into bytecode by a compiler, include the bytecode in the transaction that creates the smart contract, and publish it to the blockchain network, that is, deploy to the blockchain network Of each node.
  • the virtual machine in each node interprets and executes the bytecode.
  • WASM As the writing language for smart contracts.
  • WASM or WebAssembly
  • the virtual machine loading and executing the WASM smart contract can be divided into two steps: static loading for LEB128 decoding and instruction analysis, and dynamic execution of the resolved WASM instructions.
  • the first step is a low-frequency operation
  • the second step is a high-frequency and time-consuming operation. In the second step, every time a global access instruction is executed, an out-of-bounds check is performed.
  • the out-of-bounds check is used to determine whether the subscript of the global variable in the global access instruction exceeds the scope of the global variable subscript defined in the contract SCORE. To prevent security breaches and malicious attacks.
  • the cross-border check reduces the efficiency of smart contract execution.
  • the speed of WASM virtual machine interpreter's interpretation and execution of bytecode is critical to the performance of the entire system. Therefore, it is hoped that there will be an improved scheme to further improve the execution efficiency of the bytecode instruction stream in the WASM virtual machine.
  • One aspect of this specification provides a method for executing a function module in a virtual machine, the function module is defined in a first module, and the method includes: obtaining a WASM instruction sequence of the first module; based on the first module The WASM instruction sequence determines the global variable identification range; based on the global variable identification range, a global variable identification check is performed on each instruction in the WASM instruction sequence of the first module to determine whether to execute the functional module.
  • performing a global variable identification check on each instruction in the WASM instruction sequence of the first module includes: parsing whether the instruction is a global variable access instruction; after parsing that the instruction is a global variable access instruction In the case of determining whether the global variable identifier included in the instruction is within the scope of the global variable identifier to determine whether to execute the function module; determining whether the WASM instruction sequence of the first module does not include a global variable access instruction In this case, explain the WASM instruction sequence that executes the function module.
  • checking whether the global variable identifier included in the instruction is within the scope of the global variable identifier to determine whether to execute the function module includes: checking that the global variable identifier included in the instruction exceeds the global variable identifier. In the case of the identification range, the processing of the first module is ended; when it is checked that the global variable identifications included in each global variable access instruction of the first module are all within the scope of the global variable identification, the interpretation is executed The WASM instruction sequence of the functional module.
  • the virtual machine is a virtual machine in a blockchain node
  • the first module is a first contract
  • obtaining the WASM instruction sequence of the first module includes: During the first transaction of the function in the contract, the instruction sequence of the first contract is read from the local storage medium to obtain the WASM instruction sequence of the first contract.
  • reading the instruction sequence of the first contract from the local storage medium includes reading the variable-length-encoded instruction sequence of the first contract from the local storage medium, and performing the variable-length-encoding The instruction sequence of is decoded to obtain the WASM instruction sequence of the first contract.
  • the method further includes, in a case where it is checked that the global variable identifier included in the instruction is beyond the scope of the global variable identifier, performing error reporting processing relative to the first transaction.
  • Another aspect of this specification provides a device for executing a functional module in a virtual machine, the functional module is defined in a first module, and the device includes: an acquiring unit configured to acquire a WASM instruction sequence of the first module The determining unit is configured to determine the global variable identification range based on the WASM instruction sequence of the first module; the checking unit is configured to, based on the global variable identification range, for each of the WASM instruction sequence of the first module Each instruction performs a global variable identification check to determine whether to execute the function module.
  • the checking unit includes: a parsing subunit configured to analyze whether the instruction is a global variable access instruction; and the checking subunit is configured to resolve a case where the instruction is a global variable access instruction , Check whether the global variable identifier included in the instruction is within the scope of the global variable identifier to determine whether to execute the function module; the first execution subunit is configured to determine whether the first module is in the WASM instruction sequence In the case where the global variable access instruction is not included, the WASM instruction sequence of the function module is interpreted and executed.
  • the check subunit includes: an end subunit configured to end processing of the first module when it is checked that the global variable identifier included in the instruction exceeds the scope of the global variable identifier
  • the second execution subunit is configured to interpret and execute the WASM instruction of the functional module when checking that the global variable identifiers included in each global variable access instruction of the first module are all within the scope of the global variable identifier sequence.
  • the virtual machine is a virtual machine in a blockchain node
  • the first module is a first contract
  • the acquiring unit is further configured to call a function in the first contract during execution During the first transaction, read the instruction sequence of the first contract from the local storage medium to obtain the WASM instruction sequence of the first contract.
  • the acquiring unit includes a reading subunit configured to read the variable-length-encoded instruction sequence of the first contract from a local storage medium, and the decoding subunit is configured to The variable-length-encoded instruction sequence is decoded to obtain the WASM instruction sequence of the first contract.
  • the device further includes an error reporting unit configured to perform error reporting relative to the first transaction in the case where it is checked that the global variable identifier included in the instruction exceeds the scope of the global variable identifier .
  • Another aspect of this specification provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed in a computer, the computer is caused to execute any of the above-mentioned methods.
  • Another aspect of this specification provides a computing device, including a memory and a processor, the memory stores executable code, and when the processor executes the executable code, any one of the above methods is implemented.
  • Figure 1 schematically shows a schematic diagram of the process of invoking the contract SCORE in the blockchain network
  • Figure 2 shows a flow chart of a method for executing the function (func(;0;)) of the contract SCORE in a virtual machine according to an embodiment of the present specification
  • Fig. 3 shows an apparatus for executing function modules in a virtual machine according to an embodiment of the present specification.
  • the blockchain network includes several nodes, and each node can communicate with each other.
  • a user can send a transaction to any node in the blockchain through the client.
  • the transaction can be an ordinary transfer transaction, or it can be used to deploy a smart contract or call a smart contract.
  • Bob a user of the blockchain, wants to issue a smart contract Contract SCORE, which includes the following WASM text sequence:
  • the third line of the above code defines the interface function func(; 0;), which includes get_global 0, which is used to return the value of the 0th global variable to the caller.
  • the above contract code also defines the 0th to 7th global variables through the 5th to 12th lines. It can be understood that, for ease of reading, the above-mentioned WASM instruction sequence is displayed in the form of text, and in the virtual machine, the WASM instruction sequence is expressed in a binary format.
  • Bob can publish the transaction used to create the SCORE contract to any node in the blockchain through his client.
  • each node in the blockchain network can obtain and deploy the above-mentioned smart contract SCORE locally.
  • FIG. 1 schematically shows a schematic diagram of the process of invoking the contract SCORE in the blockchain network.
  • the blockchain network 100 includes nodes A to D, and the client of the user Alice can connect to any of the nodes A to D.
  • Alice can initiate, for example, transaction 1 (Tx 1) to node A, for example, to call the contract through her client.
  • Tx 1 transaction 1
  • the from field can be the address of the caller Alice, and the to field is the contract name and contract address of the aforementioned SCORE contract, indicating the smart contract called by the exchange.
  • the data field include the name of the method or function in the contract to be called (func(; 0;)).
  • each node can obtain and execute Transaction 1.
  • the function in the contract SCORE is executed through the WASM virtual machine, thereby returning the contract execution result.
  • the command sequence of the contract SCORE is obtained from the local block, and then each global access command in the command sequence is statically analyzed to perform cross-border check.
  • interpret and execute func(; 0;) specifically, obtain the corresponding machine code (machine code) based on the WASM sequence ) And execute the machine code.
  • FIG. 1 and the corresponding description are only schematic and not restrictive.
  • the blockchain network is not limited to a consortium chain network, but may also be a public chain network.
  • the WASM instruction sequence is not limited to the instruction sequence of the smart contract in the blockchain, but may also be the instruction sequence of the computing module in other application scenarios.
  • a smart contract in the blockchain will be taken as an example for an exemplary description.
  • Fig. 2 shows a flowchart of a method for executing a function (func(;0;)) of the contract SCORE in a virtual machine of a blockchain node according to an embodiment of the present specification, including steps S202 to S212.
  • Step S202 Obtain the WASM instruction sequence of the contract SCORE.
  • Step S204 Determine the global variable identification range based on the WASM instruction sequence of the contract SCORE.
  • Step S206 For each instruction in the WASM instruction sequence of the SCORE contract, analyze whether the instruction is a global variable access instruction.
  • Step S208 in the case where the instruction is resolved to be a global variable access instruction, check whether the global variable identifier included in the instruction is within the scope of the global variable identifier.
  • step S210 when it is checked that the global variable identifier included in the instruction exceeds the scope of the global variable identifier, the processing of the contract SCORE is ended.
  • Step S212 in the case that the global variable access instruction is not included in the instruction sequence, or the global variable access instruction in the instruction sequence does not cross the boundary, the function func(;0;) of the execution contract SCORE is interpreted.
  • step S202 the WASM instruction sequence of the contract SCORE is obtained.
  • the pre-deployed contract SCORE can be found from the local storage medium
  • the sequence of instructions Specifically, based on the name or contract account of the contract SCORE in transaction 1, the storage address of the contract SCORE in the local storage medium can be obtained, and the contract SCORE can be read through this address. For example, in a locally stored block database, the correspondence between the hash value of the contract's contract address and the contract storage address is recorded. Therefore, by retrieving the hash value of the contract SCORE contract address from the correspondence, the hash value of the contract address of the contract SCORE can be found The storage address of the contract SCORE in the storage medium.
  • the instruction sequence of the contract SCORE stored in the storage medium is a WASM instruction sequence, so that the WASM instruction sequence of the contract SCORE can be directly obtained from the storage medium.
  • the instruction sequence of the SCORE contract stored in the storage medium is an instruction sequence encoded by leb 128, so as to reduce the file size and make better use of storage space.
  • Leb 128, or "Little-Endian Base 128” is a variable-length encoding for any signed or unsigned integer. Therefore, an integer encoded with Leb128 will change the number of bytes according to the size of the number.
  • the encoding method of leb 128, of the 8 bits (8 bits) of each byte the lower 7 bits are the valid data part, and the highest bit is used to indicate whether the current byte is the last byte, and 1 means the last byte. Byte, 0 means it is not the last byte, that is, the subsequent bytes need to be continued. In this way, different numbers of bytes can be used to encode integers of different sizes.
  • each byte is first restored to 8 bits, and the highest bit is used to determine whether to follow the following bytes to jointly form the target data. Therefore, if the instruction sequence is decoded by leb 128, an instruction of variable length will be obtained. In order to store these instructions, variable-length instructions can be converted into memory-aligned fixed-length instructions. Therefore, after decoding the leb-encoded instruction sequence, the WASM instruction sequence of the contract SCORE can be obtained.
  • the pre-cached WASM instruction sequence of the SCORE contract can be read from the memory.
  • step S204 the global variable identification range is determined based on the WASM instruction sequence of the contract SCORE.
  • the virtual machine after the virtual machine obtains the WASM instruction sequence corresponding to the text sequence, by reading each instruction one by one, it can learn how many global variables are included in the instruction sequence. Specifically, after reading the WASM instructions corresponding to lines 5-12 in the above-mentioned WASM text sequence, it can be determined that the instruction sequence includes global variables 0-7, a total of 8 global variables, so as to assign variables to these global variables.
  • the labels are 0-7, that is, the global variable identification range is 0-7.
  • step S206 for each instruction in the WASM instruction sequence of the contract SCORE, whether the instruction is a global variable access instruction is analyzed one by one.
  • step S212 is entered, that is, the instruction sequence of the function func(;0;) is interpreted and executed.
  • step S208 in the case where it is parsed that the instruction is a global variable access instruction, it is checked whether the global variable identifier included in the instruction is within the scope of the global variable identifier.
  • step S212 is entered, that is, the instruction sequence of the function func(;0;) is interpreted and executed. If the instruction is not the last instruction of the contract SCORE, then return to step S206 for re-execution.
  • the SCORE contract also includes the global variable write instruction "set_global 10".
  • the variable subscript "10" in this instruction exceeds the global variable identification range 0-7 obtained by the virtual machine. Therefore, the variable subscript of the global variable write instruction is out of bounds, that is, the contract SCORE includes an incorrect instruction.
  • the wrong command "set_global 10" may be caused by a typing error, or a malicious command sequence sent by a malicious party deliberately. If the wrong command is executed in a virtual machine, it may cause system vulnerabilities and allow the malicious party to have a chance. take. In this case, step S210 is executed.
  • step S210 when it is checked that the global variable identifier included in the instruction exceeds the scope of the global variable identifier, the processing of the contract SCORE is ended.
  • an error reporting process is also performed before canceling the virtual machine.
  • the execution error of transaction 1 may be recorded in the state database, or the execution error of transaction 1 may be recorded in the operation log, where, for example, an error code may be recorded to indicate that the global variable subscript is out of range.
  • the node After finding an error for transaction 1, the node can send a transaction receipt to the client that sent transaction 1, including the error code in the receipt, so that user Alice can learn about the error in transaction 1.
  • WASM language can be used in a variety of scenarios, such as AutoCAD, GoogleEarth, Unity, WebPack, implement the corresponding functions by executing the WASM program in a virtual machine.
  • WASM calculation module is checked for out-of-bounds, so that when the function module (ie function) in the calculation module is interpreted and executed, the program execution time can be greatly reduced and the program execution speed can be accelerated.
  • Fig. 3 shows an apparatus 300 for executing a function module in a virtual machine according to an embodiment of the present specification.
  • the function module is defined in a first module.
  • the apparatus includes: an obtaining unit 31 configured to obtain the first module.
  • the determining unit 32 is configured to determine the global variable identification range based on the WASM instruction sequence of the first module;
  • the checking unit 33 is configured to, based on the global variable identification range, compare the first
  • Each instruction in the WASM instruction sequence of the module performs a global variable identification check to determine whether to execute the functional module.
  • the checking unit 33 includes: a parsing subunit 331 configured to analyze whether the instruction is a global variable access instruction; and the checking subunit 332 is configured to analyze that the instruction is a global variable access instruction. In the case of an instruction, check whether the global variable identifier included in the instruction is within the scope of the global variable identifier to determine whether to execute the function module; the first execution subunit 333 is configured to determine whether the first module In the case that the WASM instruction sequence does not include the global variable access instruction, the WASM instruction sequence of the functional module is interpreted and executed.
  • the checking subunit 332 includes an ending subunit 3321 configured to, in the case where it is checked that the global variable identifier included in the instruction exceeds the scope of the global variable identifier, end the first Module processing; the second execution sub-unit 3322 is configured to, in the case that the global variable identifiers included in each global variable access instruction of the first module are all within the scope of the global variable identifiers, interpret and execute the The WASM instruction sequence of the functional module.
  • the virtual machine is a virtual machine in a blockchain node
  • the first module is a first contract
  • the acquiring unit 31 is further configured to call the first contract in the execution During the first transaction of the function, the instruction sequence of the first contract is read from the local storage medium to obtain the WASM instruction sequence of the first contract.
  • the acquiring unit 31 includes a reading subunit 311 configured to read the variable-length-encoded instruction sequence of the first contract from a local storage medium, and the decoding subunit 312 is configured to , Decoding the variable-length-encoded instruction sequence to obtain the WASM instruction sequence of the first contract.
  • the device further includes an error reporting unit 34 configured to report an error with respect to the first transaction when it is checked that the global variable identifier included in the instruction exceeds the scope of the global variable identifier. deal with.
  • Another aspect of this specification provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed in a computer, the computer is caused to execute any of the above-mentioned methods.
  • Another aspect of this specification provides a computing device, including a memory and a processor, the memory stores executable code, and when the processor executes the executable code, any one of the above methods is implemented.
  • the software module can be placed in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or technical fields Any other form of storage medium known within.
  • RAM random access memory
  • ROM read-only memory
  • electrically programmable ROM electrically erasable programmable ROM
  • register hard disk, removable disk, CD-ROM, or technical fields Any other form of storage medium known within.

Abstract

本说明书实施例提供了一种在虚拟机中执行功能模块的方法和装置,所述功能模块在第一模块中定义,所述方法包括:获取所述第一模块的WASM指令序列;基于所述第一模块的WASM指令序列确定全局变量标识范围;基于所述全局变量标识范围,对所述第一模块的WASM指令序列中的每个指令进行全局变量标识检查,以确定是否执行所述功能模块。

Description

一种在虚拟机中执行功能模块的方法和装置 技术领域
本说明书一个或多个实施例涉及区块链技术领域,更具体地,涉及一种在虚拟机中执行功能模块的方法和装置
背景技术
虚拟机(Virtual Machine)是通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。由于虚拟机可以隔离底层硬件平台以及操作系统对上层应用的影响,因此非常有利于上层应用的开发。上层应用开发过程中无需关注底层平台的细节,只需要关注具体的业务逻辑。开发完成后,由虚拟机运行上层应用,负责将应用的代码转换为适于底层平台执行的代码。具体地,在许多场景中,上层应用由开发人员使用高级语言编写开发,之后通过编译器编译为字节码(bytecode)。字节码是一种执行程序,由一序列操作码(op码)-数据对组成的二进制文件,是一种中间码。然后,虚拟机中的解释器对字节码代表的指令流进行解释和执行。
例如,在支持智能合约的区块链应用场景中,可以在区块链网络的每个节点中部署虚拟机。用户可以用高级语言编写智能合约,然后经由编译器编译为字节码之后,将该字节码包含在创建智能合约的交易中,发布到区块链网络中,也就是部署到区块链网络的各个节点中。在需要执行智能合约时,由各个节点中的虚拟机对该字节码进行解释执行。
随着WASM语言的出现,越来越多的区块链中使用WASM作为智能合约的编写语言,相对应地,使用WASM虚拟机来执行智能合约。WASM即WebAssembly,是由W3C社区组织推出的一种为栈式虚拟机设计的二进制指令形式,是一种新的平台无关的中间字节码格式。虚拟机加载执行WASM智能合约可以分为两个步骤:静态加载做LEB128解码和指令解析,动态执行解析后的WASM指令。其中第一步属于低频操作,第二步属于高频耗时操作。在第二步中,每当执行一个全局访问指令,都要进行一次越界检查,所述越界检查用于确定全局访问指令中全局变量的下标是否超出合约SCORE中定义的全局变量下标范围,以防止出现安全漏洞和恶意攻击。所述越界检查使得智能合约执行效率降低。
在包括但不限于区块链的各种应用场景中,WASM虚拟机解释器对字节码的解释执 行速度对于整个系统的性能都至关重要。因此,希望能有改进的方案,进一步提高WASM虚拟机中字节码指令流的执行效率。
发明内容
本说明书一个方面提供一种在虚拟机中执行功能模块的方法,所述功能模块在第一模块中定义,所述方法包括:获取所述第一模块的WASM指令序列;基于所述第一模块的WASM指令序列确定全局变量标识范围;基于所述全局变量标识范围,对所述第一模块的WASM指令序列中的每个指令进行全局变量标识检查,以确定是否执行所述功能模块。
在一种实施方式中,对所述第一模块的WASM指令序列中的每个指令进行全局变量标识检查包括:解析该指令是否为全局变量访问指令;在解析出所述指令为全局变量访问指令的情况中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内,以确定是否执行所述功能模块;在确定所述第一模块的WASM指令序列中不包括全局变量访问指令的情况中,解释执行所述功能模块的WASM指令序列。
在一种实施方式中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内,以确定是否执行所述功能模块包括:在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,结束对所述第一模块的处理;在检查所述第一模块的各个全局变量访问指令中包括的全局变量标识都在所述全局变量标识范围内的情况中,解释执行所述功能模块的WASM指令序列。
在一种实施方式中,所述虚拟机为区块链节点中的虚拟机,所述第一模块为第一合约,其中,获取所述第一模块的WASM指令序列包括,在执行调用第一合约中的函数的第一交易时,从本地存储介质中读取第一合约的指令序列,以获取所述第一合约的WASM指令序列。
在一种实施方式中,从本地存储介质中读取第一合约的指令序列包括,从本地存储介质中读取第一合约的经可变长编码的指令序列,对所述经可变长编码的指令序列进行解码,以获取所述第一合约的WASM指令序列。
在一种实施方式中,所述方法还包括,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,相对于所述第一交易进行报错处理。
本说明书另一方面提供一种在虚拟机中执行功能模块的装置,所述功能模块在第一 模块中定义,所述装置包括:获取单元,配置为,获取所述第一模块的WASM指令序列;确定单元,配置为,基于所述第一模块的WASM指令序列确定全局变量标识范围;检查单元,配置为,基于所述全局变量标识范围,对所述第一模块的WASM指令序列中的每个指令进行全局变量标识检查,以确定是否执行所述功能模块。
在一种实施方式中,所述检查单元包括:解析子单元,配置为,解析该指令是否为全局变量访问指令;检查子单元,配置为,在解析出所述指令为全局变量访问指令的情况中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内,以确定是否执行所述功能模块;第一执行子单元,配置为,在确定所述第一模块的WASM指令序列中不包括全局变量访问指令的情况中,解释执行所述功能模块的WASM指令序列。
在一种实施方式中,所述检查子单元包括:结束子单元,配置为在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,结束对所述第一模块的处理;第二执行子单元,配置为在检查所述第一模块的各个全局变量访问指令中包括的全局变量标识都在所述全局变量标识范围内的情况中,解释执行所述功能模块的WASM指令序列。
在一种实施方式中,所述虚拟机为区块链节点中的虚拟机,所述第一模块为第一合约,其中,所述获取单元还配置为,在执行调用第一合约中的函数的第一交易时,从本地存储介质中读取第一合约的指令序列,以获取所述第一合约的WASM指令序列。
在一种实施方式中,所述获取单元包括,读取子单元,配置为,从本地存储介质中读取第一合约的经可变长编码的指令序列,解码子单元,配置为,对所述经可变长编码的指令序列进行解码,以获取所述第一合约的WASM指令序列。
在一种实施方式中,所述装置还包括,报错单元,配置为,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,相对于所述第一交易进行报错处理。
本说明书另一方面提供一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行上述任一项方法。
本说明书另一方面提供一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现上述任一项方法。
通过根据本说明书实施例的智能合约执行方案,在解释执行指令序列之前的静态解析过程中,对合约SCORE的指令序列进行一次全局变量下标越界的检查,而不需要每次执行全局变量访问指令时都进行一次下标越界检查,大大减少了在解释执行指令序列 时的时长,实现了更高的合约执行速度。
附图说明
通过结合附图描述本说明书实施例,可以使得本说明书实施例更加清楚:
图1示意示出在区块链网络中调用合约SCORE的过程示意图;
图2示出根据本说明书一个实施例的一种在虚拟机中执行合约SCORE的函数(func(;0;))的方法流程图;
图3示出根据本说明书实施例的一种在虚拟机中执行功能模块的装置。
具体实施方式
下面将结合附图描述本说明书实施例。
如本领域技术人员所知,区块链网络中包含若干节点,各个节点之间可以进行通信。在例如联盟链的区块链中,用户可以通过客户端向区块链中任一节点发送交易,交易既可以是普通的转账交易,也可以用于部署智能合约或调用智能合约。假设区块链的用户Bob想要发布智能合约Contract SCORE,该智能合约包括如下所示的WASM文本序列:
Figure PCTCN2021074399-appb-000001
其中,上述代码第3行定义了接口函数func(;0;),该函数中包括,get_global 0,用于把第0个全局变量值返回给调用者。上述合约代码中还通过第5~12行对第0~7个全局变量进行了定义。可以理解,为了便于阅读,上述WASM指令序列以文本的形式显 示,在虚拟机中,WASM指令序列以二进制的格式表示。
然后,Bob可通过其客户端向区块链中任一节点发布用于创建该合约SCORE的交易。从而,区块链网络中的各个节点均可以获取并在本地部署上述智能合约SCORE。
图1示意示出在区块链网络中调用合约SCORE的过程示意图。如图1中所示,区块链网络100中包括节点A~D,用户Alice的客户端可与节点A~D中任一节点连接。假定区块链网络的用户Alice想要调用以上智能合约SCORE,那么Alice通过其客户端可以向例如节点A发起例如交易1(Tx 1),进行合约调用。
具体而言,在交易1中,from字段可以是调用者Alice的地址,to字段即为上述SCORE合约的合约名称和合约地址,表示该交易所调用的智能合约。在数据字段,包含要调用的合约中的方法或函数名称(func(;0;))。
在Alice将交易1发布到区块链中去之后,各个节点都可以获取并执行交易1。在执行交易1时,通过WASM虚拟机执行合约SCORE中的函数,从而返回合约执行结果。其中,例如在节点D的虚拟机中执行交易1时,从本地区块中获取上述合约SCORE的指令序列,然后对该指令序列中的各个全局访问指令进行静态解析,以进行越界检查,在确定各个全局访问指令中的变量下标(即上述指令get_global 0中的“0”)都未越界之后,再解释执行func(;0;),具体是,基于WASM序列获取对应的机器码(machine code)并执行该机器码。从而不需要在解释执行func(;0;)的动态过程中进行下标越界的检查,尤其在func(;0;)为循环程序的情况下,可大大节省函数的解释执行时间。
可以理解,图1及相应的描述仅仅是示意性的,而不是限制性的,例如,所述区块链网络不限于为联盟链网络,而也可以为公链网络。另外,所述WASM指令序列不限于为区块链中智能合约的指令序列,而也可以为其它应用场景中的计算模块的指令序列。下文中将以区块链中的智能合约为例进行示例性描述。
下文将详细描述上述在解释执行WASM智能合约之前静态分析全局变量下标越界的方案。
图2示出根据本说明书一个实施例的一种在区块链节点的虚拟机中执行合约SCORE的函数(func(;0;))的方法流程图,包括步骤S202~步骤S212。
步骤S202,获取合约SCORE的WASM指令序列。
步骤S204,基于合约SCORE的WASM指令序列确定全局变量标识范围。
步骤S206,对于所述合约SCORE的WASM指令序列中的每个指令,解析该指令是否为全局变量访问指令。
步骤S208,在解析出所述指令为全局变量访问指令的情况中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内。
步骤S210,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,结束对所述合约SCORE的处理。
步骤S212,在所述指令序列中不包括全局变量访问指令、或者所述指令序列中的全局变量访问指令都未越界的情况中,解释执行合约SCORE的函数func(;0;)。
下面详细描述图2中各个步骤的执行过程。
首先,在步骤S202,获取合约SCORE的WASM指令序列。
如上文所述,当节点D中的虚拟机执行调用合约SCORE中某个函数(func(;0;))的交易(例如交易1)时,可从本地存储存储介质中找到预先部署的合约SCORE的指令序列。具体是,基于交易1中的合约SCORE的名称或合约账户,可获取合约SCORE在本地存储介质中的存储地址,并通过该地址读取合约SCORE。例如,在本地存储的区块数据库中,记录了合约的合约地址的哈希值与合约存储地址的对应关系,从而,通过从该对应关系检索合约SCORE的合约地址的哈希值,从而可找到合约SCORE在存储介质中的存储地址。
在一种实施方式中,所述存储介质中存储的合约SCORE的指令序列为WASM指令序列,从而可从存储介质中直接获取合约SCORE的WASM指令序列。
在一种实施方式中,所述存储介质中存储的合约SCORE的指令序列为经leb 128编码的指令序列,以减小文件体积,更好利用存储空间。Leb 128即"Little-Endian Base 128",是对任意有符号或者无符号整型数的可变长度的编码,因此,用Leb128编码的整数,会根据数字的大小改变所占字节数。根据leb 128的编码方式,每个字节的8位(8个bits)中,较低的7位为有效数据部分,最高位用于指示当前字节是否为最后一个字节,1表示最后一个字节,0表示不是最后一个字节,也就是需要接续后续字节。如此,可以采用不同字节数编码不同大小的整数。
相应地,对于leb编码的指令序列,在解码该指令序列时,先将各个字节还原为8位,通过最高位判断是否要接续后面的字节,共同形成目标数据。因此,对该指令序列进行leb 128解码,会得到不定长的指令。为了对这些指令进行存储,可以将可变长指 令转换为内存对齐的定长指令。从而,在对leb编码的指令序列进行解码之后,可获取合约SCORE的WASM指令序列。
可以理解,在该实施例中,不限于从节点本地存储介质中获取WASM指令序列,例如,在一种实施方式中,可从内存中读取预先缓存的合约SCORE的WASM指令序列。
在步骤S204,基于合约SCORE的WASM指令序列确定全局变量标识范围。
参考上述合约SCORE的WASM文本序列,虚拟机在获取与该文本序列相应的WASM指令序列之后,通过逐条读取每条指令,可获知该指令序列中共包括多少全局变量。具体是,通过读取上述WASM文本序列中第5-12行对应的WASM指令之后,可确定该指令序列中包括全局变量0~7,共8个全局变量,从而为这些全局变量分配的变量下标分别为0~7,即全局变量标识范围为0~7。
在步骤S206,对于所述合约SCORE的WASM指令序列中的每个指令,逐条解析该指令是否为全局变量访问指令。
例如,当解析到合约SCORE的第4行的“get_global 0”,可解析出该指令为全局变量读指令。全局变量访问指令不限于为全局变量读指令,还包括全局变量写指令,例如,“set_global1”。该步骤为相对于WASM指令序列中的各条指令的循环步骤。如图2中所示,对于WASM指令序列中的第i条指令,解析该执行是否为全局变量访问指令,如果是,则进入步骤S208,如果不是,如果还有下一条指令,则对第i+1条执行继续执行该步骤,如果没有下一条指令,即该条指令为最后一条指令,则进入步骤S212,即解释执行函数func(;0;)的指令序列。
在步骤S208,在解析出所述指令为全局变量访问指令的情况中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内。
例如,对于合约SCORE中的全局变量读指令get_global 0,即检查其中的变量下标“0”是否在上述全局变量标识范围0~7之内,显然,0在范围0~7之内。如图2中所示,该步骤为相对于指令序列中的每个全局变量访问指令的循环,当确定指令get_global 0中的变量下标0在范围0~7之内的情况中,如果该指令为合约SCORE的最后一条指令,则进入步骤S212,即,解释执行函数func(;0;)的指令序列,如果该指令不是合约SCORE的最后一条指令,则返回到步骤S206重新执行。
假设合约SCORE中除了上述全局变量读指令,还包括全局变量写指令“set_global  10”,很显然,该指令中的变量下标“10”超出了上述虚拟机获取的全局变量标识范围0~7,从而,该全局变量写指令的变量下标是越界的,即,合约SCORE中包括错误指令。所述错误指令“set_global 10”可能是由于打字错误造成,也有可能是恶意方故意发送的恶意指令序列,如果在虚拟机中执行该错误指令,有可能会造成系统漏洞,从而让恶意方有机可乘。在该情况中,执行步骤S210。
在步骤S210,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,结束对所述合约SCORE的处理。
所述结束对所述合约SCORE的处理,也即取消该虚拟机,从而停止对交易1的执行。
在一种实施方式中,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,在取消虚拟机之前,还进行报错处理。例如,可在状态数据库中记录交易1的执行出错,或者,可在运行日志中记录对交易1的执行出错,其中例如可记录错误码,以指示是全局变量下标越界的错误。节点在发现针对交易1的报错之后,可对发送交易1的客户端发送交易回执,在所述回执中包括所述错误码,以使得用户Alice可获知交易1中存在的错误。
在实际执行合约函数的过程中,有可能对该函数循环成百上千次,或者有可能在该函数中,对全局变量访问指令循环成百上千次,在该情况中,通过图2所示方法中,只需要在解释执行指令序列之前的静态解析过程中,对合约SCORE的指令序列进行一次全局变量下标越界的检查,而不需要每次执行全局变量访问指令时都进行一次下标越界检查,大大减少了在解释执行指令序列时的时长,实现了更高的合约执行速度。
可以理解,虽然上文以在WASM虚拟机中对智能合约的指令序列进行下标越界检查为例进行了描述,本说明书实施例不限于上述实施例。WASM语言可用于多种场景中,如在AutoCAD、GoogleEarth、Unity、WebPack中都通过在虚拟机中执行WASM程序而实施相应的功能,在这些场景中,类似地,通过在虚拟机中在静态解析阶段对WASM计算模块进行越界检查,从而在解释执行该计算模块中的功能模块(即函数)时,可大大减少程序执行时间,加快程序执行速度。
图3示出根据本说明书实施例的一种在虚拟机中执行功能模块的装置300,所述功能模块在第一模块中定义,所述装置包括:获取单元31,配置为,获取所述第一模块的WASM指令序列;确定单元32,配置为,基于所述第一模块的WASM指令序列确定全 局变量标识范围;检查单元33,配置为,基于所述全局变量标识范围,对所述第一模块的WASM指令序列中的每个指令进行全局变量标识检查,以确定是否执行所述功能模块。
在一种实施方式中,所述检查单元33包括:解析子单元331,配置为,解析该指令是否为全局变量访问指令;检查子单元332,配置为,在解析出所述指令为全局变量访问指令的情况中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内,以确定是否执行所述功能模块;第一执行子单元333,配置为,在确定所述第一模块的WASM指令序列中不包括全局变量访问指令的情况中,解释执行所述功能模块的WASM指令序列。
在一种实施方式中,所述检查子单元332包括,结束子单元3321,配置为,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,结束对所述第一模块的处理;第二执行子单元3322,配置为,在检查所述第一模块的各个全局变量访问指令中包括的全局变量标识都在所述全局变量标识范围内的情况中,解释执行所述功能模块的WASM指令序列。
在一种实施方式中,所述虚拟机为区块链节点中的虚拟机,所述第一模块为第一合约,其中,所述获取单元31还配置为,在执行调用第一合约中的函数的第一交易时,从本地存储介质中读取第一合约的指令序列,以获取所述第一合约的WASM指令序列。
在一种实施方式中,所述获取单元31包括,读取子单元311,配置为,从本地存储介质中读取第一合约的经可变长编码的指令序列,解码子单元312,配置为,对所述经可变长编码的指令序列进行解码,以获取所述第一合约的WASM指令序列。
在一种实施方式中,所述装置还包括,报错单元34,配置为,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,相对于所述第一交易进行报错处理。
本说明书另一方面提供一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行上述任一项方法。
本说明书另一方面提供一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现上述任一项方法。
需要理解,本文中的“第一”,“第二”等描述,仅仅为了描述的简单而对相似概念进行区分,并不具有其他限定作用。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
本领域普通技术人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。其中,软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (16)

  1. 一种在虚拟机中执行功能模块的方法,所述功能模块在第一模块中定义,所述方法包括:
    获取所述第一模块的WASM指令序列;
    基于所述第一模块的WASM指令序列确定全局变量标识范围;
    基于所述全局变量标识范围,对于所述第一模块的WASM指令序列中的每个指令,解析该指令是否为全局变量访问指令,在解析出所述指令为全局变量访问指令的情况中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内,以确定是否执行所述功能模块。
  2. 根据权利要求1所述的方法,还包括,在确定所述第一模块的WASM指令序列中不包括全局变量访问指令的情况中,解释执行所述功能模块的WASM指令序列。
  3. 根据权利要求1所述的方法,其中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内,以确定是否执行所述功能模块包括,
    在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,结束对所述第一模块的处理。
  4. 根据权利要求3所述的方法,其中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内,以确定是否执行所述功能模块还包括,在检查所述第一模块的各个全局变量访问指令中包括的全局变量标识都在所述全局变量标识范围内的情况中,解释执行所述功能模块的WASM指令序列。
  5. 根据权利要求1所述的方法,其中,所述虚拟机为区块链节点中的虚拟机,所述第一模块为第一合约,其中,获取所述第一模块的WASM指令序列包括,在执行调用第一合约中的函数的第一交易时,从本地存储介质中读取第一合约的指令序列,以获取所述第一合约的WASM指令序列。
  6. 根据权利要求5所述的方法,其中,从本地存储介质中读取第一合约的指令序列包括,从本地存储介质中读取第一合约的经可变长编码的指令序列,对所述经可变长编码的指令序列进行解码,以获取所述第一合约的WASM指令序列。
  7. 根据权利要求5所述的方法,还包括,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,相对于所述第一交易进行报错处理。
  8. 一种在虚拟机中执行功能模块的装置,所述功能模块在第一模块中定义,所述装置包括:
    获取单元,配置为,获取所述第一模块的WASM指令序列;
    确定单元,配置为,基于所述第一模块的WASM指令序列确定全局变量标识范围;
    检查单元,配置为,基于所述全局变量标识范围,对于所述第一模块的WASM指 令序列中的每个指令,解析该指令是否为全局变量访问指令,在解析出所述指令为全局变量访问指令的情况中,检查该指令包括的全局变量标识是否在所述全局变量标识范围内,以确定是否执行所述功能模块。
  9. 根据权利要求8所述的装置,所述检查单元还包括:
    第一执行子单元,配置为,在确定所述第一模块的WASM指令序列中不包括全局变量访问指令的情况中,解释执行所述功能模块的WASM指令序列。
  10. 根据权利要求8所述的装置,其中,所述检查单元包括检查子单元,所述检查子单元包括,
    结束子单元,配置为,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,结束对所述第一模块的处理。
  11. 根据权利要求10所述的装置,其中,所述检查子单元还包括,
    第二执行子单元,配置为,在检查所述第一模块的各个全局变量访问指令中包括的全局变量标识都在所述全局变量标识范围内的情况中,解释执行所述功能模块的WASM指令序列。
  12. 根据权利要求8所述的装置,其中,所述虚拟机为区块链节点中的虚拟机,所述第一模块为第一合约,其中,所述获取单元还配置为,在执行调用第一合约中的函数的第一交易时,从本地存储介质中读取第一合约的指令序列,以获取所述第一合约的WASM指令序列。
  13. 根据权利要求12所述的装置,其中,所述获取单元包括,读取子单元,配置为,从本地存储介质中读取第一合约的经可变长编码的指令序列,解码子单元,配置为,对所述经可变长编码的指令序列进行解码,以获取所述第一合约的WASM指令序列。
  14. 根据权利要求12所述的装置,还包括,报错单元,配置为,在检查出该指令包括的全局变量标识超出所述全局变量标识范围的情况中,相对于所述第一交易进行报错处理。
  15. 一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行权利要求1-7中任一项的所述的方法。
  16. 一种计算设备,包括存储器和处理器,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现权利要求1-7中任一项所述的方法。
PCT/CN2021/074399 2020-03-05 2021-01-29 一种在虚拟机中执行功能模块的方法和装置 WO2021175053A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010147875.X 2020-03-05
CN202010147875.XA CN111008067B (zh) 2020-03-05 2020-03-05 一种在虚拟机中执行功能模块的方法和装置

Publications (1)

Publication Number Publication Date
WO2021175053A1 true WO2021175053A1 (zh) 2021-09-10

Family

ID=70121002

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/074399 WO2021175053A1 (zh) 2020-03-05 2021-01-29 一种在虚拟机中执行功能模块的方法和装置

Country Status (2)

Country Link
CN (1) CN111008067B (zh)
WO (1) WO2021175053A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114661300A (zh) * 2022-04-11 2022-06-24 北京万昇智能科技有限公司 将PLC程序代码编译为WebAssembly代码的方法及装置

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111008067B (zh) * 2020-03-05 2020-06-09 支付宝(杭州)信息技术有限公司 一种在虚拟机中执行功能模块的方法和装置
CN116661910B (zh) * 2023-08-01 2023-09-22 北京中电华大电子设计有限责任公司 一种应用调用的方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170147299A1 (en) * 2015-11-24 2017-05-25 Nvidia Corporation System and method for optimizing multiple invocations of graphics processing unit programs in java
CN110096338A (zh) * 2019-05-10 2019-08-06 百度在线网络技术(北京)有限公司 智能合约执行方法、装置、设备及介质
CN110675256A (zh) * 2019-08-30 2020-01-10 阿里巴巴集团控股有限公司 部署和执行智能合约的方法及装置
CN110704063A (zh) * 2019-09-30 2020-01-17 支付宝(杭州)信息技术有限公司 编译和执行智能合约的方法及装置
CN111008067A (zh) * 2020-03-05 2020-04-14 支付宝(杭州)信息技术有限公司 一种在虚拟机中执行功能模块的方法和装置

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101211273B (zh) * 2006-12-25 2010-05-19 上海科泰世纪科技有限公司 在构件编程中自动生成Singleton模式的方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170147299A1 (en) * 2015-11-24 2017-05-25 Nvidia Corporation System and method for optimizing multiple invocations of graphics processing unit programs in java
CN110096338A (zh) * 2019-05-10 2019-08-06 百度在线网络技术(北京)有限公司 智能合约执行方法、装置、设备及介质
CN110675256A (zh) * 2019-08-30 2020-01-10 阿里巴巴集团控股有限公司 部署和执行智能合约的方法及装置
CN110704063A (zh) * 2019-09-30 2020-01-17 支付宝(杭州)信息技术有限公司 编译和执行智能合约的方法及装置
CN111008067A (zh) * 2020-03-05 2020-04-14 支付宝(杭州)信息技术有限公司 一种在虚拟机中执行功能模块的方法和装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114661300A (zh) * 2022-04-11 2022-06-24 北京万昇智能科技有限公司 将PLC程序代码编译为WebAssembly代码的方法及装置
CN114661300B (zh) * 2022-04-11 2022-10-18 北京万昇智能科技有限公司 将PLC程序代码编译为WebAssembly代码的方法及装置

Also Published As

Publication number Publication date
CN111008067B (zh) 2020-06-09
CN111008067A (zh) 2020-04-14

Similar Documents

Publication Publication Date Title
TWI730654B (zh) 部署和執行智能合約的方法及裝置
WO2021175053A1 (zh) 一种在虚拟机中执行功能模块的方法和装置
WO2021179809A1 (zh) 缓存和执行智能合约的方法和装置
US11237844B2 (en) Method and apparatus for loading kernel module
CN106970820B (zh) 代码存储方法及代码存储装置
CN110688122B (zh) 编译和执行智能合约的方法及装置
CN110704063B (zh) 编译和执行智能合约的方法及装置
CN110704064B (zh) 编译和执行智能合约的方法及装置
US9063760B2 (en) Employing native routines instead of emulated routines in an application being emulated
WO2020259417A1 (zh) 一种区块链的数据解析方法及装置
CN113961919B (zh) 恶意软件检测方法和装置
CN111179086A (zh) 一种基于WebAssembly的智能合约虚拟机
US9405652B2 (en) Regular expression support in instrumentation languages using kernel-mode executable code
CN114201756A (zh) 一种智能合约代码片段的漏洞检测方法和相关装置
CN111240772A (zh) 一种基于区块链的数据处理方法、装置及存储介质
KR102011725B1 (ko) 악성코드 검출을 위한 화이트리스트 구축 방법 및 이를 수행하기 위한 기록매체 및 장치
WO2021179697A1 (zh) 一种在虚拟机中执行功能模块的方法和装置
CN113849781B (zh) Go语言源代码混淆方法、系统、终端及存储介质
CN114706586A (zh) 代码编译、代码运行方法、装置、计算机设备及存储介质
CN113885876A (zh) 一种参数校验方法、装置、存储介质及计算机系统
CN113420569A (zh) 代码翻译方法、装置、设备及存储介质
Kim et al. Static dalvik bytecode optimization for Android applications
CN113778564B (zh) 一种高效执行evm智能合约的方法、设备及储存介质
CN111045657B (zh) 程序代码的运行方法和运行装置以及编译方法和编译装置
CN112905181A (zh) 一种模型编译、运行方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21763642

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21763642

Country of ref document: EP

Kind code of ref document: A1