Back to Search Start Over

Application programming interface recommendation for smart contract using deep learning from augmented code representation.

Authors :
Cai, Jie
Cai, Qian
Li, Bin
Zhang, Jiale
Sun, Xiaobing
Source :
Journal of Software: Evolution & Process. Mar2024, p1. 19p. 12 Illustrations, 5 Charts.
Publication Year :
2024

Abstract

Application programming interface (API) recommendation plays a crucial role in facilitating smart contract development by providing developers with a ranked list of candidate APIs for specific recommendation points. Deep learning‐based approaches have shown promising results in this field. However, existing approaches mainly rely on token sequences or abstract syntax trees (ASTs) for learning recommendation point‐related features, which may overlook the essential knowledge implied in the relations between or within statements and may include task‐irrelevant components during feature learning. To address these limitations, we propose a novel code graph called pruned and augmented AST (pa‐AST). Our approach enhances the AST by incorporating additional knowledge derived from the control and data flow relations between and within statements in the smart contract code. Through this augmentation, the pa‐AST can better represent the semantic features of the code. Furthermore, we conduct AST pruning to eliminate task‐irrelevant components based on the identified flow relations. This step helps mitigate the interference caused by these irrelevant parts during the model feature learning process. Additionally, we extract the API sequence surrounding the recommendation point to provide supplementary knowledge for the model learning. The experimental results demonstrate our proposed approach achieving an average mean reciprocal rank (MRR) of 68.02%, outperforming the baselines' performance. Furthermore, through ablation experiments, we explore the effectiveness of our proposed code representation approach. The results indicate that combining pa‐AST with the API sequence yields improved performance compared with using them individually. Moreover, our AST augmentation and pruning techniques significantly contribute to the overall results. [ABSTRACT FROM AUTHOR]

Details

Language :
English
ISSN :
20477473
Database :
Academic Search Index
Journal :
Journal of Software: Evolution & Process
Publication Type :
Academic Journal
Accession number :
175749682
Full Text :
https://doi.org/10.1002/smr.2658