Graph-based Deep Learning for Detecting Gas Inefficiency in Ethereum Smart Contracts
Abstract
Gas Gas consumption is a critical factor influencing the efficiency, scalability, and operational cost of Ethereum smart contracts.As contract complexity grows, identifying structurally gas-inefficient patterns becomes essential for improving development workflows and preventing costly deployment decisions.This study presents a graph-based deep learning framework for detecting gas-inefficiency risk patterns at the function level, leveraging multi-relational Graph Attention Networks (GAT) applied to function-level contract graphs.By modeling call dependencies, control-flow interactions, and storage-based data dependencies, the model learns structural indicators associated with excessive gas consumption while explicitly excluding direct gas metrics from the feature space to prevent data leakage.Experimental results under a strict contract-level data split protocol demonstrate strong classification performance and stable generalization across held-out contracts under the main split protocol, and consistent behavior under an additional time-forward temporal robustness check.Ablation analysis confirms the contribution of dependency-aware edges and semantic features to predictive accuracy, highlighting the importance of modeling cross-function interactions rather than isolated code metrics.Beyond predictive performance, the proposed approach provides interpretable attention weights that identify structurally influential functions, supporting predeployment analysis and developer-guided manual refactoring decisions.By framing gas inefficiency as a global structural property emerging from function interactions, this work contributes aa scalable and explainable methodology for structural gas-inefficiency detection in smart contracts.The proposed model performs structural detection only and does not automatically modify or optimize smart contract code.
Community
0 commentsNo discussion yet
Be the first to share a question or observation.