Enhancing The Open Network: Definition and Automated Detection of Smart Contract Defects

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Song, Hao, Li, Teng, Chen, Jiachi, Chen, Ting, Li, Beibei, Lin, Zhangyan, Lu, Yi, Li, Pan, Zhou, Xihan
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866929671649624064
author Song, Hao
Li, Teng
Chen, Jiachi
Chen, Ting
Li, Beibei
Lin, Zhangyan
Lu, Yi
Li, Pan
Zhou, Xihan
author_facet Song, Hao
Li, Teng
Chen, Jiachi
Chen, Ting
Li, Beibei
Lin, Zhangyan
Lu, Yi
Li, Pan
Zhou, Xihan
contents The Open Network (TON), designed to support Telegram's extensive user base of hundreds of millions, has garnered considerable attention since its launch in 2022. FunC is the most popular programming language for writing smart contracts on TON. It is distinguished by a unique syntax compared to other smart contract languages. Despite growing interest, research on the practical defects of TON smart contracts is still in its early stages. In this paper, we summarize eight smart contract defects identified from TON's official blogs and audit reports, each with detailed definitions and code examples. Furthermore, we propose a static analysis framework called TONScanner to facilitate the detection of these defects. Specifically, TONScanner reuses FunC compiler's frontend code to transform the FunC source code into FunC intermediate representation (IR) in the form of a directed acyclic graph (DAG). Based on this IR, TONScanner constructs a control flow graph (CFG), then transforms it into a static single assignment (SSA) form to simplify further analysis. TONScanner also integrates Data Dependency, Call Graph, Taint Analysis, and Cell Construct, which are specifically tailored for TON blockchain's unique data structures. These components finally facilitate the identification of the eight defects. We evaluate the effectiveness of TONScanner by applying it to 1,640 smart contracts and find a total of 14,995 defects. Through random sampling and manual labeling, we find that TONScanner achieves an overall precision of 97.49%. The results reveal that current TON contracts contain numerous defects, indicating that developers are prone to making errors. TONScanner has proven its ability to accurately identify these defects, thereby aiding in their correction.
format Preprint
id arxiv_https___arxiv_org_abs_2501_06459
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Enhancing The Open Network: Definition and Automated Detection of Smart Contract Defects
Song, Hao
Li, Teng
Chen, Jiachi
Chen, Ting
Li, Beibei
Lin, Zhangyan
Lu, Yi
Li, Pan
Zhou, Xihan
Software Engineering
The Open Network (TON), designed to support Telegram's extensive user base of hundreds of millions, has garnered considerable attention since its launch in 2022. FunC is the most popular programming language for writing smart contracts on TON. It is distinguished by a unique syntax compared to other smart contract languages. Despite growing interest, research on the practical defects of TON smart contracts is still in its early stages. In this paper, we summarize eight smart contract defects identified from TON's official blogs and audit reports, each with detailed definitions and code examples. Furthermore, we propose a static analysis framework called TONScanner to facilitate the detection of these defects. Specifically, TONScanner reuses FunC compiler's frontend code to transform the FunC source code into FunC intermediate representation (IR) in the form of a directed acyclic graph (DAG). Based on this IR, TONScanner constructs a control flow graph (CFG), then transforms it into a static single assignment (SSA) form to simplify further analysis. TONScanner also integrates Data Dependency, Call Graph, Taint Analysis, and Cell Construct, which are specifically tailored for TON blockchain's unique data structures. These components finally facilitate the identification of the eight defects. We evaluate the effectiveness of TONScanner by applying it to 1,640 smart contracts and find a total of 14,995 defects. Through random sampling and manual labeling, we find that TONScanner achieves an overall precision of 97.49%. The results reveal that current TON contracts contain numerous defects, indicating that developers are prone to making errors. TONScanner has proven its ability to accurately identify these defects, thereby aiding in their correction.
title Enhancing The Open Network: Definition and Automated Detection of Smart Contract Defects
topic Software Engineering
url https://arxiv.org/abs/2501.06459