一句话:提出通过数据类型重构并用程序合成自动生成功能等价的合约,以降低 gas 消耗。
在以太坊上执行智能合约需要消耗以 gas 计量的费用,因此智能合约开发者投入大量精力降低 gas 使用。本文提出一种通过改变底层数据布局来降低智能合约 gas 消耗的新技术:给定智能合约 P 及一个类型级变换,方法能够自动合成与 P 功能等价的新合约 P'。作者提供了一种便捷的 DSL 来表达数据类型重构,并利用程序合成生成合约的新版本。该技术实现于工具 Solidare 中,并在来自 Etherscan 与 GasStation 的真实智能合约上进行了评估。实验表明,该方法能够有效自动化所期望的数据布局变换,并且对于使用丰富数据结构的智能合约,能有效降低其 gas 消耗。
Since executing a smart contract on the Ethereum blockchain costs money (measured in gas ), smart contract developers spend significant effort in reducing gas usage. In this paper, we propose a new technique for reducing the gas usage of smart contracts by changing the underlying data layout. Given a smart contract P and a type-level transformation, our method automatically synthesizes a new contract P ′ that is functionally equivalent to P . Our approach provides a convenient DSL for expressing data type refactorings and employs program synthesis to generate the new version of the contract. We have implemented our approach in a tool called Solidare and demonstrate its capabilities on real-world smart contracts from Etherscan and GasStation. In particular, we show that our approach is effective at automating the desired data layout transformation and that it is useful for reducing gas usage of smart contracts that use rich data structures.
@article{paperbot1425,
title = {Synthesis-powered optimization of smart contracts via data type refactoring},
author = {Yanju Chen and Yuepeng Wang and Maruth Goyal and James Dong and Yu Feng and Işil Dillig},
journal = {Proceedings of the ACM on Programming Languages},
volume = {6},
number = {OOPSLA2},
year = {2022},
doi = {10.1145/3563308}
}