Vulnerability detection method based on multi-modal feature fusion

By constructing a hybrid dataset and extracting multimodal features, the problem of insufficient model generalization ability in existing smart contract vulnerability detection methods is solved, enabling comprehensive detection of both manually and machine-generated contracts, and improving the accuracy and stability of vulnerability detection.

CN120910862APending Publication Date: 2025-11-07HANGZHOU DIANZI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511003600.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-21
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Existing smart contract vulnerability detection methods rely on only a single code feature, which cannot effectively capture the differences between human-written and machine-generated smart contracts. This results in insufficient model generalization ability and ignores the impact of large language models in smart contract writing.

Method used

We construct a hybrid dataset, inject vulnerabilities through a large language model, and combine static/dynamic analysis tools to extract multimodal features, including abstract syntax trees, function call graphs, and opcode features. We use a cross-modal attention mechanism for feature fusion and employ a focus loss function and resampling mechanism to optimize the model.

Benefits of technology

It improves the model's ability to generalize to machine-generated and manually written smart contracts, enhances the accuracy and stability of vulnerability detection, and can more comprehensively capture the relationships and behavioral characteristics inside and outside the contract.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120910862A_ABST
    Figure CN120910862A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-modal feature fusion-based vulnerability detection method, which comprises the following steps of: inserting a preset vulnerability into a real smart contract by using a large language model and an automatic vulnerability injection tool, and mixing with a smart contract public data set containing a real vulnerability; extracting a structural feature, a semantic feature and an operation code feature of the smart contract, performing unified representation on the structural feature, the semantic feature and the operation code feature, and performing multi-modal fusion by using a cross-modal attention mechanism; and inputting the features after multi-modal fusion into a classifier to output a vulnerability detection result, and dynamically adjusting a loss weight by using a focus loss function.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of smart contract vulnerability detection, and particularly relates to a vulnerability detection based on multi-modal feature fusion. BACKGROUND

[0002] Blockchain is a block chain storage, tamper-proof, secure and trusted decentralized distributed ledger, which combines distributed storage, peer-to-peer transmission, consensus mechanism, cryptography and other technologies, uses a growing chain of data blocks to record transactions and information, and ensures the security and transparency of data. The characteristics of blockchain include decentralization, tamper-proof, transparency, security and programmability. Each data block is linked to the previous block, forming a continuous chain, which guarantees the integrity of the transaction history. Smart contract technology makes blockchain programmable, supporting a wider range of applications.

[0003] A smart contract is a "computer transaction protocol that executes contract terms", which is a piece of code written on a blockchain. Once a certain event triggers the terms in the contract, the code will automatically execute. That is, it is executed when the conditions are met, without human intervention. All users on the blockchain can see the smart contract based on the blockchain, which will lead to all vulnerabilities including security vulnerabilities being visible and may not be quickly repaired. Therefore, smart contracts have become an extremely attractive target for attackers, and many malicious attackers try to exploit vulnerabilities in smart contracts using various means, thereby stealing a large amount of funds and disrupting the blockchain network. Therefore, it is particularly important to detect vulnerabilities in smart contracts.

[0004] Therefore, there are more and more researches on smart contract vulnerability detection. These methods propose new methods and architectures for automatically detecting vulnerabilities in smart contracts using machine learning and deep learning techniques. However, the existing smart contract vulnerability detection methods still have certain limitations. They only use source code, bytecode or operation code to extract single code features as input for model training, which may cause some information to be missed. At the same time, with the increasing sophistication of large language models, more and more people are using large language models to write code. The existing methods ignore this influence, and basically use real smart contract datasets, but there are some differences between human-written smart contracts and machine-generated smart contracts, which will limit the performance of the model trained. SUMMARY

[0005] The present application aims to overcome the shortcomings of the prior art and proposes a smart contract vulnerability detection method based on multi-modal feature fusion.

[0006] The purpose of the present application is achieved by the following technical solution: a smart contract vulnerability detection method based on multi-modal feature fusion, comprising:

[0007] S1, mixed dataset construction: using a large language model and an automated vulnerability injection tool, inserting preset vulnerabilities into real smart contracts, and mixing with a smart contract public dataset containing real vulnerabilities;

[0008] S2, multi-modal feature extraction: generating an abstract syntax tree of the smart contract, parsing the abstract syntax tree to extract function-level control flow graphs, intra-contract and cross-contract function call relationship graphs as structural features;

[0009] Generate function source code context-aware semantic vectors, and fuse the semantic vectors with the control flow graph; embed the semantic fusion control flow graph subgraph into the corresponding function call relationship graph node to obtain a semantic enhanced call graph; use a relationship graph convolution network containing a hierarchical pooling layer to extract semantic features from the semantic enhanced call graph;

[0010] Compile the source code of the smart contract into bytecode, disassemble it to form operation codes and delete the operands in the instructions, classify the remaining operation codes and convert them into vector sequences, and extract operation code features through a transformer model;

[0011] S3, unified representation of structural features, semantic features and operation code features, multi-modal fusion using cross-modal attention mechanism;

[0012] S4, input the multi-modal fused features into the classifier to output the vulnerability detection results, and use the focal loss function to dynamically adjust the loss weight, and use the trained classifier to obtain the multi-class vulnerability detection results of the smart contract.

[0013] Further, the preset vulnerabilities are inserted into the real smart contract, the vulnerability samples generated by the large language model are optimized by reinforcement learning to make them more stealthy, and static / dynamic analysis tools are used to evaluate the vulnerability detectability, ensuring the high quality and high deception of the generated data.

[0014] Further, in the mixing process with the smart contract public dataset containing real vulnerabilities, an adversarial training strategy is used to optimize the distribution difference between the two types of data, enhance the model's generalization ability to machine-generated and human-written vulnerabilities; a domain adaptation method is used to reduce the distribution difference between real data and synthetic data, and a diffusion model is introduced to improve the quality of synthetic data.

[0015] Further, the extraction process of the structural features is as follows: use the solc compiler to generate the abstract syntax tree of the smart contract, extract the function-level control flow graph in combination with the Slither static analysis tool, and capture the logical structure; the extracted control flow graph needs to be post-processed, including deleting isolated nodes, merging redundant jump edges, and marking sensitive operations;

[0016] The surya tool is used to analyze an abstract syntax tree, extract a function call relationship graph in a contract and across contracts, and represent a global interaction path. Extracting the function call relationship graph requires supplementing cross-contract call path analysis. An import statement and inheritance relationship are used to build a complete call chain. In the extraction process, in addition to static structural information, dynamic analysis features are combined to enhance the behavioral understanding of smart contract vulnerabilities.

[0017] Further, the feature fusion of the function source code context-aware semantic vector and the semantic vector of the control flow graph specifically includes: taking each function source code block as input, converting it into a 768-dimensional embedding expression using a pre-trained model, taking each code block in the control flow graph as input, generating a context-aware semantic vector using a pre-trained code model CodeBERT, and then fusing the embedding expression of the source code and the semantic vector of the control flow graph.

[0018] Further, the embedding of the semantic-fused control flow graph subgraph into the corresponding function call relationship graph node specifically includes:

[0019] The function call relationship graph and the semantic-fused control flow graph are fused again into a semantic-enhanced call graph, wherein the function call relationship graph node represents a function, the edge represents a call relationship, and each function call relationship graph node is embedded with its corresponding control flow graph subgraph.

[0020] Further, the semantic feature extraction of the semantic-enhanced call graph using the relationship graph convolutional network containing a hierarchical pooling layer includes:

[0021] The semantic-enhanced call graph structure is standardized, including node alignment, edge type normalization, and position encoding to retain code order information. A relational graph convolutional network is used as the backbone model, and a hierarchical pooling layer is introduced after the backbone model to receive node embedding and graph structure output by the backbone model, generate super node representation, and aggregate graph structure.

[0022] Further, the classification of the retained operation codes includes: according to the Ethereum yellow book specification, arithmetic operation class, comparison class, and environment class are clustered respectively.

[0023] Further, the S3 specifically includes:

[0024] The feature table of the obtained structural features, semantic features and operation code features is input into a linear layer for flattening processing, so as to provide a unified representation for multi-modal fusion, key features are extracted by using an attention mechanism in each modality, redundant or irrelevant features are suppressed, each modality feature is compressed and reduced by using a trainable dimension reduction mapping layer, and then fusion is performed; a cross-modal attention mechanism is adopted to improve the information interaction ability between modes;

[0025] The cross-modal attention mechanism adopts a multi-head attention structure, and the semantic features and the operation code features are cross-fused after being weighted by attention, so as to improve the interactive expression ability between different modes.

[0026] Further, the classifier adopts a multi-layer perceptron structure with more than two layers, a GELU function is selected as an activation function to improve the nonlinear expression ability, a BatchNorm layer is used to accelerate training convergence, and a focal loss function automatically adjusts the loss value of each sample according to the prediction confidence of the model on the sample during the training process; and a resampling mechanism is introduced into the data set to further improve the detection stability and the discrimination ability of edge samples; the resampling mechanism balances the training data by combining oversampling and undersampling strategies, and an ensemble strategy is introduced to further improve the discrimination ability of complex samples, and finally outputs a multi-class vulnerability detection result or a binary classification label of the smart contract.

[0027] The present application has the following advantages:

[0028] The large model and other tools are used to inject vulnerabilities into the smart contract, a mixed data set containing synthetic data and real data is constructed, and the generalization ability of the model to machine-generated and manually written vulnerabilities is enhanced. In the feature extraction stage, the control flow graph of the method is taken as the method feature, and the method source code is fused to enhance the semantic feature, which is taken as the function feature of the function call graph, so as to more comprehensively extract the feature information of the function, and better capture the relationship between functions and contracts through the function call graph. BRIEF DESCRIPTION OF DRAWINGS

[0029] Figure 1 A vulnerability detection method framework based on multi-modal feature fusion is provided for the embodiment of the present application;

[0030] Figure 2 A vulnerability detection method implementation flowchart based on multi-modal feature fusion is provided for the embodiment of the present application;

[0031] Figure 3 A vulnerability detection device schematic diagram based on multi-modal feature fusion is provided for the embodiment of the present application. DETAILED DESCRIPTION

[0032] The specific embodiments of the present application are further described in detail below with reference to the accompanying drawings.

[0033] As shown in Figure 1 and Figure 2 The present application provides a vulnerability detection method based on multi-modal feature fusion, which comprises:

[0034] The present application is an effective intelligent contract vulnerability detection method, which aims to improve the generalization of the model vulnerability detection, so that the vulnerability detection model can have good adaptability to both artificially written intelligent contracts and large model generated intelligent contracts. The specific implementation process of the present application can be divided into the following stages: construction of mixed data set, extraction of multi-modal features, fusion of multi-modal features and intelligent contract vulnerability detection.

[0035] The first stage is the construction of the mixed data set.

[0036] The present application first collects real intelligent contracts with complete structure and clear function from a publicly trusted blockchain platform (Etherscan), and further selects verified non-vulnerability samples therefrom as basic data. Subsequently, using a large language model (LLM) and an automated vulnerability injection tool (HoneyBadger, ContractFuzzer), four known vulnerability types are injected into the basic contract, including re-entrant attack, integer overflow / underflow, unauthorized access and resource exhaustion, to construct synthetic labeled vulnerability samples.

[0037] The vulnerability injection process optimizes the vulnerability samples generated by the LLM in combination with reinforcement learning, so that they are more stealthy, and static / dynamic analysis tools (Mythril, Oyente) are used to evaluate the vulnerability detectability, to ensure the high quality and high deception of the generated data.

[0038] To ensure the diversity and representativeness of the data, the synthetic data set constructed and the public data set containing real vulnerabilities (SmartBugs) are fused in a ratio of 3:7 to form a mixed training data set with real and fake vulnerability samples. In view of the difference in distribution between real and synthetic data, the present application further introduces an adversarial training mechanism, constructs a domain discriminator as an auxiliary network module, and guides the main feature extractor to learn field-independent feature representation. By alternately optimizing the loss functions of the feature extractor and the discriminator, the source domain and the target domain are aligned in the feature space. At the same time, the field adaptation method (MMD, CORAL) is used to reduce the distribution difference between real data and synthetic data, and the diffusion model (Diffusion Model) is introduced to improve the quality of the synthetic data.

[0039] The second stage is the extraction of multi-modal features.

[0040] After obtaining the mixed dataset, multi-modal feature extraction is carried out for each smart contract sample, mainly including three dimensions of structural features, semantic features and operation code features.

[0041] First, according to the Solidity version of the smart contract, the solc compiler is used to generate its abstract syntax tree (AST), and the Slither tool is used to extract the function-level control flow graph (CFG) from the AST to capture control logic, jump structure and key security-sensitive nodes. The CFG extracted by the Slither tool needs to be post-processed, including deleting isolated nodes, merging redundant jump edges, and marking sensitive operations (such as external calls, state variable modifications);

[0042] Further, the Surya tool is used to extract the function call graph (CG) to supplement the function interaction paths within the contract and across contracts. The CG extracted by the surya tool needs to supplement the cross-contract call paths, and the complete call chain is constructed by analyzing the import statement and inheritance relationship. In the process of multi-modal feature extraction, in addition to static structural information, dynamic analysis features are also combined to enhance the behavioral understanding of smart contract vulnerabilities.

[0043] For each source code segment of a function, it is input into the pre-trained code language model (CodeBERT) to obtain its 768-dimensional embedding representation as the function-level semantic representation. In addition, each code block in the CFG is also semantically encoded using CodeBERT to obtain a context-aware code block-level representation. Finally, the function source code embedding and the CFG block embedding are semantically fused to capture the joint features between control semantics and context semantics.

[0044] In the graph structure modeling stage, the CFG and CG are combined to form a Semantically Enriched Call Graph (SECG) by using node normalization, edge type normalization, and graph embedding alignment strategies. The CG nodes represent functions, and the corresponding CFG subgraphs are embedded in them. The weights of the call edges are dynamically assigned based on the call frequency or static analysis results. To preserve the code order and context, a positional encoding mechanism is used to introduce sequential information. The resulting graph is used as the input data for the model, and a relational graph convolutional network (RGCN) is used as the backbone model. The message passing mechanism is used to aggregate the structural and semantic features of multiple-hop neighbors. To further achieve structural abstraction and multi-granularity representation, a hierarchical pooling module (DiffPool) is introduced after the RGCN to aggregate the node representations and achieve graph structure abstraction from the function level to the contract level. The DiffPool receives the node embeddings and graph structure output by the RGCN as input and generates higher-level "super-node" representations and aggregated graph structures to capture the hierarchical semantic relationships of the code. Finally, the output is input into a linear layer for flattening to provide a unified representation for multi-modal fusion.

[0045] When constructing the Semantically Enriched Call Graph (SECG), a dynamic weight mechanism is introduced in the setting of the call graph edge weight. The contribution of the edge is dynamically adjusted based on parameters such as function call frequency, call path length, self-call, and recursion depth.

[0046] The smart contract source code is compiled to bytecode, which is disassembled into an opcode sequence using the pyevmasm library. To unify the opcode structure, the operands are deleted, and only the opcode instructions are retained. Based on the Ethereum yellow paper, all opcodes are grouped and classified by function, and a low-complexity unified representation is constructed. Then, the opcode sequence is converted into a vector sequence and input into the Transformer model to capture the logical dependencies and semantic associations between opcodes, achieving behavior modeling based on the operation level.

[0047] In the opcode feature extraction process, the opcode classification strictly follows the Ethereum yellow paper specifications, with arithmetic operation classes (ADD / MOD), comparison classes (LT / GT), and environment classes (CALLER / GAS) being clustered separately.

[0048] In the third stage, the multi-modal features are fused.

[0049] To fully utilize the semantic and opcode modal information, the application designs a multi-modal fusion mechanism. First, the feature expressions of the obtained structural features, semantic features and opcode features are input into a linear layer for flattening processing to provide a unified representation for multi-modal fusion, and the key features are extracted by using an attention mechanism in each modality to strengthen the information representation capability; then, a cross-modal attention mechanism is used to enhance the interactive fusion between different modalities and capture the potential association between multi-source heterogeneous information. The cross-modal attention mechanism uses a multi-head attention structure to cross-fuse the semantic features and opcode features after attention weighting, thereby improving the interactive expression capability between different modalities. Before fusion, the key features are extracted by using the attention mechanism in each modality, and feature selection based on the attention weight distribution is performed to suppress redundant or irrelevant features, and then a trainable dimension reduction mapping layer is used to compress and reduce the features of each modality to reduce the influence of the dimension difference on the fusion effect.

[0050] In the fourth stage, the vulnerability detection model is trained.

[0051] The embedded vectors obtained after fusion are input into a multi-layer perceptron (MLP) classifier for training, and a prediction result of whether each smart contract has a vulnerability is output. In the training process, a focal loss function (Focal Loss) is used to cope with the imbalance problem of positive and negative samples, and the recognition ability of the model for edge samples (rare or difficult to detect vulnerabilities) is improved. At the same time, a resampling mechanism is used to dynamically adjust the distribution of training samples, thereby further enhancing the detection stability and generalization ability.

[0052] The classifier uses a multi-layer perceptron structure (MLP) with more than two layers, the activation function uses GELU to improve the nonlinear expression capability, and the BatchNorm layer is used to accelerate the training convergence; in the training process, the focal loss function (Focal Loss) automatically adjusts the loss value of each sample according to the current prediction confidence of the model, thereby alleviating the performance degradation problem caused by class imbalance; the resampling mechanism combines oversampling and undersampling strategies to balance the training data, and an ensemble strategy is introduced to further improve the discrimination ability for complex samples, and finally the multi-class vulnerability detection result or binary classification label of the smart contract is output.

[0053] Corresponding to the foregoing embodiment of the smart contract vulnerability detection method based on multi-modal feature fusion, the application also provides an embodiment of a smart contract vulnerability detection device based on multi-modal feature fusion.

[0054] Referring to Figure 3The embodiment of the application provides a kind of smart contract vulnerability detection device based on multi-modal feature fusion, including memory and one or more processors, the memory has executable code stored therein, when the processor executes the executable code, for realizing the smart contract vulnerability detection method based on multi-modal feature fusion in one of the above embodiments.

[0055] The embodiment of the application provides a kind of smart contract vulnerability detection device based on multi-modal feature fusion can be applied to any data processing ability device, which can be such as computer and equipment or device.The device embodiment can be realized by software, also can be realized by hardware or software and hardware combination.For example, as a logical sense device, it is formed by the processor of the data processing ability device in which it is located to read the corresponding computer program instructions in non-volatile memory into memory and run.From the hardware level, as shown in Figure 3 As shown in the figure, a kind of hardware structure diagram of the data processing ability device in which the smart contract vulnerability detection device based on multi-modal feature fusion provided by the application is located, in addition to the processor, memory, network interface and non-volatile memory shown in the figure, the data processing ability device in which the device in the embodiment is usually according to the actual function of the data processing ability device, can also include other hardware, and this will not be repeated. Figure 3

[0056] The implementation process of the functions and roles of each unit in the above device is specifically described in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0057] For device embodiment, since it basically corresponds to method embodiment, relevant part is described in method embodiment part.The above described device embodiment is only illustrative, wherein the unit described as separate component can be or can not be physically separated, the component shown as unit can be or can not be physical unit, that is, it can be located in one place, or also can be distributed to multiple network units.Can select part or all modules to realize the purpose of the present application scheme according to actual needs.Ordinary skilled in the art can understand and implement without paying creative labor.

[0058] The embodiment of the application further provides a computer readable storage medium, which stores a program, and the program is executed by a processor to realize the smart contract vulnerability detection method based on multi-modal feature fusion in one of the above embodiments.

[0059] ​The computer readable storage medium can be an internal storage unit of any of the aforementioned data processing capable devices, such as a hard disk or a memory. The computer readable storage medium can also be an external storage device of any of the aforementioned data processing capable devices, such as a plug-in hard disk, a Smart Media Card (SMC), an SD card, a Flash Card, etc. Further, the computer readable storage medium can include both an internal storage unit and an external storage device of any of the aforementioned data processing capable devices. The computer readable storage medium is used to store the computer program and other programs and data required by the aforementioned data processing capable devices, and can also be used to temporarily store data that has been output or is about to be output.

[0060] The application further provides a computer program product comprising a computer program, which, when executed by a processor, implements the intelligent contract vulnerability detection method based on multi-modal feature fusion.

[0061] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.

[0062] It is to be understood that the above general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application. The application is not restricted to the precise construction and combinations of parts and steps described above and shown in the accompanying drawings, as such variations and modifications are intended to be included within the scope of the application. The scope of the application is limited only by the following claims.

Claims

1. A multi-modal feature fusion-based intelligent contract vulnerability detection method, characterized in that, The method comprises the following steps: S1, mixed dataset construction: using a large language model and an automatic vulnerability injection tool, inserting preset vulnerabilities into real smart contracts, and mixing with a smart contract public dataset containing real vulnerabilities; S2, multi-modal feature extraction: generating an abstract syntax tree of the smart contract, parsing the abstract syntax tree to extract function-level control flow graphs, intra-contract and cross-contract function call relationship graphs as structural features; Generating function source code context-aware semantic vectors, and performing feature fusion with the semantic vectors of the control flow graph; embedding the semantic fusion control flow graph subgraph into the corresponding function call relationship graph node to obtain a semantic enhanced call graph; using a relationship graph convolution network containing a hierarchical pooling layer to perform semantic feature extraction on the semantic enhanced call graph; S3, unified representation of structural features, semantic features and operation code features, and multi-modal fusion using a cross-modal attention mechanism; S4, inputting the multi-modal fused features into a classifier to output the vulnerability detection results, and using a focal loss function to dynamically adjust the loss weight, and using the trained classifier to obtain the multi-class vulnerability detection results of the smart contract. The preset vulnerabilities are inserted into the real smart contract, the vulnerability samples generated by the large language model are optimized by reinforcement learning, so that they are more concealed, and the static / dynamic analysis tool is used to evaluate the vulnerability detectability, so as to ensure the high quality and high deception of the generated data.

2. The method of claim 1, wherein, In the mixing process with the smart contract public dataset containing real vulnerabilities, an adversarial training strategy is adopted to optimize the distribution difference between the two types of data, enhance the generalization ability of the model to machine-generated and manually-written vulnerabilities, and a domain adaptation method is adopted to reduce the distribution difference between real data and synthetic data, and a diffusion model is introduced to improve the quality of synthetic data. 3.The method of claim 1, wherein, The extraction process of the structural features is as follows: an abstract syntax tree of the smart contract is generated by using a solc compiler, a function-level control flow graph is extracted by using a Slither static analysis tool, and logical structures are captured; the extracted control flow graph needs to be post-processed, including deleting isolated nodes, merging redundant jump edges, and marking sensitive operations; 4. The method of claim 1, wherein, The abstract syntax tree is parsed by using a surya tool, and intra-contract and cross-contract function call relationship graphs are extracted to represent global interaction paths; In the extraction process of the function call relationship graph, in addition to static structural information, dynamic analysis features are also combined to enhance the behavior understanding of the smart contract vulnerabilities. ​ 5. The method of claim 1, wherein, The feature fusion of the generated function source code context-aware semantic vector and the semantic vector of the control flow graph specifically comprises: taking each function source code block as input, converting it into a 768-dimensional embedding expression by using a pre-trained model, taking each code block in the control flow graph as input, generating a context-aware semantic vector by using a pre-trained code model CodeBERT, and then performing feature fusion on the embedding expression of the source code and the semantic vector of the control flow graph.

6. The method of claim 1, wherein the method is based on multi-modal feature fusion. The embedding of the semantic-fused control flow graph subgraph into the corresponding function call relationship graph node specifically comprises: The function call relationship graph and the semantic-fused control flow graph are fused again into a semantic-enhanced call graph, wherein the function call relationship graph node represents a function, the edge represents a call relationship, and each function call relationship graph node is embedded with the corresponding control flow graph subgraph.

7. The method of claim 1, wherein the method is based on multi-modal feature fusion. The semantic feature extraction of the semantic-enhanced call graph by using the relation graph convolution network containing a hierarchical pooling layer comprises: The semantic-enhanced call graph structure is standardized, including node alignment, edge type normalization, and code order information is reserved by using position encoding; a relational graph convolution network is used as the backbone model, a hierarchical pooling layer is introduced after the backbone model to receive the node embedding and graph structure output by the backbone model, and a super node representation and aggregated graph structure are generated. 8.The method of claim 1, wherein, The classification of the reserved operation codes comprises: according to the Ethereum yellow book specification, arithmetic operation class, comparison class, and environment class are clustered respectively.

9. The method of claim 1, wherein, The S3 specifically comprises: The obtained structural features, semantic features, and operation code features are input into a linear layer for flattening processing to provide a unified representation for multi-modal fusion, the key features are extracted by using an attention mechanism inside each modality to suppress redundant or irrelevant features, and then the features of each modality are compressed and reduced by using a trainable dimension reduction mapping layer, and then fused; a cross-modal attention mechanism is used to improve the information interaction ability between modalities. The cross-modal attention mechanism uses a multi-head attention structure to perform attention weighting on the semantic features and operation code features and then cross-fuse them to improve the interactive expression ability between different modalities.

10. The method of claim 1, wherein, The classifier uses a multi-layer perceptron structure with more than two layers, the GELU function is selected as the activation function to improve the nonlinear expression ability, and the BatchNorm layer is used to accelerate training convergence; in the training process, the focal loss function automatically adjusts the loss value of each sample according to the current prediction confidence of the model; a resampling mechanism is introduced into the data set to further improve the detection stability and the discrimination ability of edge samples; the resampling mechanism balances the training data by combining oversampling and undersampling strategies, and an ensemble strategy is introduced to further improve the discrimination ability of complex samples, and finally outputs the multi-class vulnerability detection result or binary classification label of the smart contract.