FMCF: A fusing multiple code features approach based on Transformer for Solidity smart contracts source code summarization

被引:0
|
作者
Lei, Gang [1 ]
Zhang, Donghua [2 ]
Xiao, Jianmao [1 ]
Fan, Guodong [3 ]
Cao, Yuanlong [1 ]
Feng, Zhiyong [3 ]
机构
[1] Jiangxi Normal Univ, Sch Software, Nanchang 330022, Peoples R China
[2] Jiangxi Normal Univ, Sch Digital Ind, Shangrao 334000, Peoples R China
[3] Tianjin Univ, Coll Intelligence & Comp, Tianjin 300350, Peoples R China
关键词
Solidity smart contracts; Source code summarization; Feature fusion; Transformer; Structure-based traversal; Manual evaluation; NATURAL-LANGUAGE SUMMARIES;
D O I
10.1016/j.asoc.2024.112238
中图分类号
TP18 [人工智能理论];
学科分类号
081104 ; 0812 ; 0835 ; 1405 ;
摘要
A smart contract is a software program executed on a blockchain, designed to facilitate functionalities such as contract execution, asset administration, and identity validation within a secure and decentralized ecosystem. Summarizing the code of Solidity smart contracts aids developers in promptly grasping essential functionalities, thereby enhancing the security posture of Ethereum-based projects. Existing smart contract code summarization works mainly use traditional information retrieval and single code features, resulting in suboptimal performance. In this study, we propose a fusing multiple code features (FMCF) approach based on Transformer for Solidity summarization. First, FMCF created contract integrity modeling and state immutability modeling in the data preprocessing stage to process and filter data that meets security conditions. At the same time, FMCF retains the self-attention mechanism to construct the Graph Attention Network (GAT) encoder and CodeBERT encoder, which respectively extract multiple feature vectors of the code to ensure the integrity of the source code information. Furthermore, the FMCF uses a weighted summation method to input these two types of feature vectors into the feature fusion module for fusion and inputs the fused feature vectors into the Transformer decoder to obtain the final smart contract code summarization. The experimental results show that FMCF outperforms the standard baseline methods by 12.45% in the BLEU score and maximally preserves the semantic information and syntax structures of the source code. The results demonstrate that the FMCF can provide a good direction for future research on smart contract code summarization, thereby helping developers enhance the security of development projects.
引用
收藏
页数:17
相关论文
共 50 条
  • [31] TBCUP: A Transformer-based Code Comments Updating Approach
    Liu, Shifan
    Cui, Zhanqi
    Chen, Xiang
    Yang, Jun
    Li, Li
    Zheng, Liwei
    2023 IEEE 47TH ANNUAL COMPUTERS, SOFTWARE, AND APPLICATIONS CONFERENCE, COMPSAC, 2023, : 892 - 897
  • [32] Research on smart contract vulnerability detection method based on domain features of solidity contracts and attention mechanism
    Wang, Changjing
    Jiang, Huiwen
    Wang, Yuxin
    Huang, Qing
    Zuo, Zhengkang
    JOURNAL OF INTELLIGENT & FUZZY SYSTEMS, 2023, 45 (01) : 1513 - 1525
  • [33] Integrating Non-Fourier and AST-Structural Relative Position Representations Into Transformer-Based Model for Source Code Summarization
    Liang, Hsiang-Mei
    Huang, Chin-Yu
    IEEE ACCESS, 2024, 12 : 9871 - 9889
  • [34] Integrating Non-Fourier and AST-Structural Relative Position Representations Into Transformer-Based Model for Source Code Summarization
    Liang, Hsiang-Mei
    Huang, Chin-Yu
    IEEE Access, 2024, 12 : 9871 - 9889
  • [35] EnCoSum: enhanced semantic features for multi-scale multi-modal source code summarization
    Yuexiu Gao
    Hongyu Zhang
    Chen Lyu
    Empirical Software Engineering, 2023, 28
  • [36] EnCoSum: enhanced semantic features for multi-scale multi-modal source code summarization
    Gao, Yuexiu
    Zhang, Hongyu
    Lyu, Chen
    EMPIRICAL SOFTWARE ENGINEERING, 2023, 28 (05)
  • [37] An Efficient Code-Embedding-Based Vulnerability Detection Model for Ethereum Smart Contracts
    Xu, Zhigang
    Chen, Xingxing
    Dong, Xinhua
    Han, Hongmu
    Yan, Zhongzhen
    Ye, Kangze
    Li, Chaojun
    Zheng, Zhiqiang
    Wang, Haitao
    Zhang, Jiaxi
    INTERNATIONAL JOURNAL OF DATA WAREHOUSING AND MINING, 2023, 19 (02)
  • [38] CCGIR: Information retrieval-based code comment generation method for smart contracts
    Yang, Guang
    Liu, Ke
    Chen, Xiang
    Zhou, Yanlin
    Yu, Chi
    Lin, Hao
    KNOWLEDGE-BASED SYSTEMS, 2022, 237
  • [39] Effective combining source code and opcode for accurate vulnerability detection of smart contracts in edge AI systems
    Huang, Huakun
    Guo, Longtao
    Zhao, Lingjun
    Wang, Haoda
    Xu, Chenkai
    Jiang, Shan
    APPLIED SOFT COMPUTING, 2024, 158
  • [40] VDHGT: A Source Code Vulnerability Detection Method Based on Heterogeneous Graph Transformer
    Yang, Hongyu
    Yang, Haiyun
    Zhang, Liang
    CYBERSPACE SAFETY AND SECURITY, CSS 2022, 2022, 13547 : 217 - 224