Towards Detecting Comment-Code Inconsistency in Smart Contract via Pre-Training Techniques

Smart contracts are programs deployed on the blockchain. The security issues of smart contracts have become the focus in recent years. Comments have been widely used to improve the readability of programs. Nevertheless, comments and code are not always consistent in smart contracts because of the modification of developers based on token standards and code reuse. These inconsistencies can mislead developers and even pose security risks. We call comment-code inconsistencies as CCIs. In particular, permission-related CCIs can easily expose vulnerabilities in smart contracts, causing funds to be hacked. In this work, we employ pre-training techniques to detect CCIs on permission in smart contracts. Specifically, we collect 3511 comments from Ethereum and Defi projects. Firstly, we utilize BERT to classify permission comments. Then, we extract related function implementations of each permission comment using the compilation technique and adopt CodeT5 to embed comment-code pairs. Finally, we make use of BiLSTM to predict inconsistencies. The evaluation results show that our proposed approach performs better than the existing tools in both precision and recall. Moreover, considering the two stages, it achieves an accuracy of 95.2% and 91.5% in permission comment recognition and permission CCI detection, respectively.

Authors

Institutions

Publication Details

Published
2024-10-30
DOI
https://doi.org/10.1109/spaccs63173.2024.00013
Primary Topic
FinTech, Crowdfunding, Digital Finance
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Towards Detecting Comment-Code Inconsistency in Smart Contract via Pre-Training Techniques

Xiaohui Liu, Xiaohong Shi, Sicheng Hao, Lei Yang
FinTech, Crowdfunding, Digital Finance
article

Towards Detecting Comment-Code Inconsistency in Smart Contract via Pre-Training Techniques

Xiaohui Liu, Xiaohong Shi, Sicheng Hao, Lei Yang
article en

Abstract

Smart contracts are programs deployed on the blockchain. The security issues of smart contracts have become the focus in recent years. Comments have been widely used to improve the readability of programs. Nevertheless, comments and code are not always consistent in smart contracts because of the modification of developers based on token standards and code reuse. These inconsistencies can mislead developers and even pose security risks. We call comment-code inconsistencies as CCIs. In particular, permission-related CCIs can easily expose vulnerabilities in smart contracts, causing funds to be hacked. In this work, we employ pre-training techniques to detect CCIs on permission in smart contracts. Specifically, we collect 3511 comments from Ethereum and Defi projects. Firstly, we utilize BERT to classify permission comments. Then, we extract related function implementations of each permission comment using the compilation technique and adopt CodeT5 to embed comment-code pairs. Finally, we make use of BiLSTM to predict inconsistencies. The evaluation results show that our proposed approach performs better than the existing tools in both precision and recall. Moreover, considering the two stages, it achieves an accuracy of 95.2% and 91.5% in permission comment recognition and permission CCI detection, respectively.

Sun Yat-sen University (CN), Guangzhou Panyu Polytechnic (CN)
Openalex Percentile: Top 53%
FinTech, Crowdfunding, Digital Finance
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Towards Detecting Comment-Code Inconsistency in Smart Contract via Pre-Training Techniques — Xiaohui Liu, Xiaohong Shi, et al. · (2024) | TGRS Research Map | TGRS