Nowadays, more and more applications are developed for running on a distributed ledger technology, namely dApps. The business logic of dApps is usually implemented within smart contracts developed through Solidity, a programming language for writing smart contracts on different blockchain platforms, including the popular Ethereum. In Ethereum, the smart contracts run on the machines of miners and the gas corresponds to the execution fee compensating such computing resources. However, the deployment and execution costs of a smart contract depend on the implementation choices done by developers. Unappropriated design choices could lead to higher gas consumption than necessary. In this paper, we (i) identify a set of 19 Solidity code smells affecting the deployment and transaction costs of a smart contract, and (ii) assess the relevance of such smells through a survey involving 34 participants. On top of these smells, we propose GasMet, a suite of metrics for statically evaluating the code quality of a smart contract from the gas consumption perspective. An experiment involving 2,186 smart contracts demonstrates that the proposed metrics have direct associations with deployment costs. The metrics in our suite can be used for more easily identifying source code segments that need optimizations.


翻译:目前,在分布式分类账技术(即dApps)上,开发了越来越多的应用软件,用于使用分布式分类账技术(即dApps)。dApps的商业逻辑通常是在通过Solidiity开发的智能合同中实施,Solidiity是一种用于在不同块链平台(包括受欢迎的Ethereum)上撰写智能合同的编程语言。在Etheum,在矿工机器和天然气上运行的智能合同与补偿这种计算资源的执行费相对应。然而,智能合同的部署和执行费用取决于开发商所作的实施选择。不适当的设计选择可能导致天然气消耗量超过必要。在本文中,我们(一)确定了一套19套Solidiity代码的气味影响智能合同的部署和交易成本,以及(二)通过涉及34名参与者的调查评估这种气味的相关性。除了这些气味外,我们提议从天然气消费角度对智能合同的代码质量进行静态评估的一套指标。涉及2,186个智能合同的实验表明拟议指标与部署成本有直接关联。我们套套装中的指标可用于更方便地确定需要优化的源代码部分。

0
下载
关闭预览

相关内容

【Google】平滑对抗训练,Smooth Adversarial Training
专知会员服务
49+阅读 · 2020年7月4日
【MIT】反偏差对比学习,Debiased Contrastive Learning
专知会员服务
91+阅读 · 2020年7月4日
已删除
将门创投
5+阅读 · 2019年4月4日
计算机 | ISMAR 2019等国际会议信息8条
Call4Papers
3+阅读 · 2019年3月5日
强化学习的Unsupervised Meta-Learning
CreateAMind
18+阅读 · 2019年1月7日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
【学习】Hierarchical Softmax
机器学习研究会
4+阅读 · 2017年8月6日
How Do Smart Contracts Benefit Security Protocols?
Arxiv
0+阅读 · 2022年2月17日
VIP会员
相关资讯
已删除
将门创投
5+阅读 · 2019年4月4日
计算机 | ISMAR 2019等国际会议信息8条
Call4Papers
3+阅读 · 2019年3月5日
强化学习的Unsupervised Meta-Learning
CreateAMind
18+阅读 · 2019年1月7日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
【学习】Hierarchical Softmax
机器学习研究会
4+阅读 · 2017年8月6日
Top
微信扫码咨询专知VIP会员