arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.02661cs.SE
收藏

如何节省我的 Gas 费用:理解并检测 Solidity 程序中的真实 Gas 问题

How to Save My Gas Fees: Understanding and Detecting Real-world Gas Issues in Solidity Programs

Mengting He, Shihao Xia, Boqin Qin, Nobuko Yoshida, Tingting Yu, Yiying Zhang, Linhai Song

AI总结:

本文实证研究 Solidity 智能合约中的 gas wastes,开发静态检测工具 PeCatch 并审查编译器实现,提出 11 项洞见和四条建议,修复缺陷每日可节省 76 万美元。

摘要:

在公共区块链系统 Ethereum 上执行智能合约时,其计算和数据存储会产生一种称为 gas fee 的费用。当程序员开发智能合约(例如使用 Solidity 编程语言)时,他们可能会在不知情的情况下编写不必要地导致更多 gas 费用的代码片段。这些问题,即我们所称的 gas wastes,会给用户造成重大金钱损失。本文率先通过两个关键步骤帮助 Ethereum 用户降低 gas 费用。首先,我们对开源 Solidity 程序和 Ethereum 交易轨迹中的 gas wastes 进行实证研究。其次,为验证研究发现,我们开发了一个名为 PeCatch 的静态工具,用于有效检测 Solidity 程序中的 gas wastes,并人工检查 Solidity 编译器代码,以准确定位导致 gas wastes 的实现错误。总体而言,我们提出了 11 项洞见和四条建议,可促进未来工具开发并提升程序员意识;修复我们检测到的缺陷每天可节省 76 万美元的 gas 费用。

英文摘要:

The execution of smart contracts on Ethereum, a public blockchain system, incurs a fee called gas fee for its computation and data storage. When programmers develop smart contracts (e.g., in the Solidity programming language), they could unknowingly write code snippets that unnecessarily cause more gas fees. These issues, or what we call gas wastes, can lead to significant monetary losses for users. This paper takes the initiative in helping Ethereum users reduce their gas fees in two key steps. First, we conduct an empirical study on gas wastes in open-source Solidity programs and Ethereum transaction traces. Second, to validate our study findings, we develop a static tool called PeCatch to effectively detect gas wastes in Solidity programs, and manually examine the Solidity compiler's code to pinpoint implementation errors causing gas wastes. Overall, we make 11 insights and four suggestions, which can foster future tool development and programmer awareness, and fixing our detected bugs can save $0.76 million in gas fees daily.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑