Guardians of the Ledger: Protecting Decentralized Exchanges From State Derailment Defects
The decentralized exchange (DEX) leverages smart contracts to trade digital assets for users on the blockchain. Developers usually develop several smart contracts into one project, implementing complex logic functions and multiple transaction operations. However, the interaction among these contracts poses challenges for developers analyzing the state logic. Due to the complex state logic in DEX projects, many critical state derailment defects have emerged in recent years. In this article, we conduct the first systematic study of state derailment defects in DEX. We define five categories of state derailment defects and provide detailed analyses of them. Furthermore, we propose a novel deep learning-based framework S<sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">tateGuard</small> for detecting state derailment defects in DEX smart contracts. It leverages a smart contract deconstructor to deconstruct the contract into an abstract syntax tree (AST), from which five categories of dependency features are extracted. Next, it implements a graph optimizer to process the structured data. At last, the optimized data is analyzed by graph convolutional networks to identify potential state derailment defects. We evaluated S<sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">tateGuard</small> through a dataset of 46 DEX projects containing 5671 smart contracts, and it achieved 94.25% F1-score. In addition, in a comparison experiment with state-of-the-art, S<sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">tateGuard</small> leads the F1-score by 6.29%. To further verify its practicality, we used S<sc xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">tateGuard</small> to audit real-world contracts and successfully authenticated multiple novel common vulnerabilities and exposures.
Authors
- Wenkai Li (ORCID: https://orcid.org/0000-0002-4238-8846)
- Yuqing Zhang (ORCID: https://orcid.org/0000-0001-8306-7195)
- Xiaoqi Li (ORCID: https://orcid.org/0000-0002-6012-9178)
- Zongwei Li (ORCID: https://orcid.org/0009-0008-7233-9464)
Institutions
- Hainan University (CN)
- Computer Network Information Center (CN)
- University of Chinese Academy of Sciences (CN)
Publication Details
- Journal
- IEEE Transactions on Reliability
- Published
- 2024-12-18
- DOI
- https://doi.org/10.1109/tr.2024.3509414
- Citations
- 18
- Primary Topic
- State Capitalism and Financial Governance
- Type
- article
- Field-Weighted Citation Impact
- 9.98
Funders
- National Natural Science Foundation of China