paperbot · PL 论文追踪

全部论文 待读 收藏

P2 FunRedisp: Reordering Function Dispatch in Smart Contract to Reduce Invocation Gas Fees

FunRedisp:重排智能合约中的函数分派以降低调用 Gas 费用
ISSTA Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis2024匹配度 2/10 · 该论文属于智能合约字节码重构与 Gas 优化,虽涉及编译/程序变换,但用户画像聚焦于静态分析、LLM/Agent 与浮点/贝叶斯程序分析,二者几乎没有交集。引用 4 inbox
Yunqi Liu, Wei Song
crossref: 2026-09-12

AI 速览

一句话:提出字节码重构方法 FunRedisp,通过将热函数前移优化函数分派,降低智能合约调用 Gas 消耗。

智能合约多以 Solidity 编写并在以太坊等区块链上执行,部署或调用时需支付 Gas 费用以防止资源滥用。尽管节省 Gas 已有较多研究,但函数分派对调用 Gas 消耗的影响尚未被专门研究。本文首先揭示函数分派如何影响调用 Gas 消耗,然后提出 FunRedisp,一种字节码重构方法及开源工具:在源代码层识别智能合约中较可能被调用的热函数,再在字节码层将这些函数移动到函数分派的前端。作者在从以太坊随机选取的 50 个真实智能合约上评估 FunRedisp,实验表明其平均每笔交易可节省约 125.17 单位 Gas,而编译开销仅增加 0.37 秒。

问题
智能合约调用需要支付 Gas,但现有工作未研究函数分派顺序对调用 Gas 消耗的影响。
方法
FunRedisp 在源代码层识别热函数,并在字节码层将其移动到函数分派前端,以重构字节码降低调用开销。
评估
在从以太坊随机选取的 50 个真实智能合约上进行实验,平均每笔交易节省约 125.17 单位 Gas,编译开销仅增加 0.37 秒。
原文摘要(Abstract)

Smart contracts mostly written in Solidity are Turing-complete programs executed on the blockchain platforms such as Ethereum. To prevent resource abuse, a gas fee is required when users deploy or invoke smart contracts. Although saving gas consumption has received much attention, no work investigates the effect of function dispatch on the invocation gas consumption. In this paper, after demystifying how the function dispatch affects the invocation gas consumption, we present FunRedisp, a bytecode refactoring method and an open-source tool, to reduce the overall invocation gas consumption of smart contracts. At the source code level, FunRedisp initially identifies hot functions in a smart contract that have a big chance to be invoked, and then move them to the front of the function dispatch at the bytecode level. We implement FunRedisp and evaluate it on 50 real-world smart contracts randomly selected from Ethereum. The experimental results demonstrate that FunRedisp can save approximately 125.17 units of gas per transaction with the compilation overhead increased by only 0.37 seconds.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8509,
  title = {FunRedisp: Reordering Function Dispatch in Smart Contract to Reduce Invocation Gas Fees},
  author = {Yunqi Liu and Wei Song},
  booktitle = {ISSTA},
  year = {2024},
  doi = {10.1145/3650212.3652146}
}