Malo in the Code Jungle: Explainable Fault Localization for Decentralized Applications
- 13 June 2025
- journal article
- Published by Institute of Electrical and Electronics Engineers (IEEE) in IEEE Transactions on Software Engineering
- Vol. 51 (7) , 2197-2210
Abstract
Decentralized applications (DApps) have long been sitting ducks for hackers due to their valuable cryptocurrency assets, exposing them to various security risks. When a DApp is attacked, promptly identifying faults is crucial to minimizing financial losses and ensuring effective fault repair. However, existing fault localization methods, which mostly rely on code coverage, often fall short for DApps, particularly when dealing with only one fault case. Furthermore, according to a prior survey, most developers expect fault localization tools to provide reasonable explanations. In this paper, we present Malo, a method for DApp-specific explainable fault localization. It identifies fault functions through suspicious token transfer-guided analysis, and then employs Large Language Models (LLMs) to generate explanations for these identified fault functions. Specifically, Malo examines function call traces and source codes of fault cases to acquire internal knowledge, and also retrieves relevant project documents from the Web to obtain external knowledge. By integrating internal and external knowledge, Malo generates reasonable explanations for faults in DApps. Our evaluation on a dataset of 68 real-world DApp faults demonstrates that Malo can locate 62% of faults within the Top-5, 9% higher than the state-of-the-art method. The experiment results also demonstrate a remarkable alignment accuracy of 71% between the explanations generated by Malo and the ground truth. In addition, we conduct a user study, which confirms that explanations generated by Malo can aid developers in comprehending the root cause of faults. Our code and dataset are available online: https://github.com/SodalimeZero/Malo_Code.git.Keywords
Funding Information
- National Natural Science Foundation of China (62372485, 623B2102, 62332004)
- Natural Science Foundation of Guangdong Province (2023A1515011314)
- Department of Education of Guangdong Province (2024ZDZX1001)
- Major Key Project of PCL (PCL2023A05)
- Fundamental Research Funds for the Central Universities, Sun Yat-sen University (24lgqb018)
This publication has 26 references indexed in Scilit:
- DeFiWarder: Protecting DeFi Apps from Token Leaking Vulnerabilities2023
- DeFiScanner: Spotting DeFi Attacks Exploiting Logic Vulnerabilities on BlockchainIEEE Transactions on Computational Social Systems, 2022
- Analysis of cryptocurrency transactions from a network perspective: An overviewJournal of Network and Computer Applications, 2021
- Fault Localization with Code Coverage Representation Learning2021
- MuSC: A Tool for Mutation Testing of Ethereum Smart Contract2019
- Practical Mutation Testing for Smart Contracts2019
- CNN-FL: An Effective Approach for Localizing Faults using Convolutional Neural Networks2019
- Ask the Mutants: Mutating Faulty Programs for Fault Localization2014
- Metallaxis‐FL: mutation‐based fault localizationSoftware Testing, Verification and Reliability, 2013
- An Evaluation of Similarity Coefficients for Software Fault Localization2006