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

描述以太坊智能合约中的交易恢复语句

Characterizing Transaction-Reverting Statements in Ethereum Smart Contracts

Lu Liu, Lili Wei, Wuqi Zhang, Ming Wen, Yepang Liu, Shing-Chi Cheung

摘要:

智能合约是在区块链上运行以执行交易的程序。当输入约束或安全属性在运行时被违反时,智能合约执行的交易需要恢复,以避免不良后果。在支持智能合约的最受欢迎的区块链以太坊上,开发人员可以在三种交易恢复语句中进行选择(即,要求,如果...恢复原状如果处理异常交易。虽然这些交易恢复语句对于防止智能合约表现出异常行为或遭受恶意攻击至关重要,但人们对它们在实践中如何使用的理解有限。在这项工作中,我们进行了第一次实证研究,以描述以太坊智能合约中的交易恢复语句。我们测量了这些语句在流行的dapps中的3,866个已验证智能合约中的流行程度,并通过手动分析557个事务恢复语句建立了它们的目的分类。我们还比较了模板契约及其相应的自定义契约,以了解开发人员如何自定义事务恢复语句的使用。最后,我们分析了交易恢复语句的安全影响,将它们从智能合约中删除,并将突变合约与原始合约进行比较。我们的研究得出了重要的发现,这些发现可以为智能合约质量保证这一广泛领域的进一步研究提供指导,并为智能合约开发人员提供适当使用交易恢复语句的实用指导。

英文摘要:

Smart contracts are programs running on blockchain to execute transactions. When input constraints or security properties are violated at runtime, the transaction being executed by a smart contract needs to be reverted to avoid undesirable consequences. On Ethereum, the most popular blockchain that supports smart contracts, developers can choose among three transaction-reverting statements (i.e., require, if...revert, and if...throw) to handle anomalous transactions. While these transaction-reverting statements are vital for preventing smart contracts from exhibiting abnormal behaviors or suffering malicious attacks, there is limited understanding of how they are used in practice. In this work, we perform the first empirical study to characterize transaction-reverting statements in Ethereum smart contracts. We measured the prevalence of these statements in 3,866 verified smart contracts from popular dapps and built a taxonomy of their purposes via manually analyzing 557 transaction-reverting statements. We also compared template contracts and their corresponding custom contracts to understand how developers customize the use of transaction-reverting statements. Finally, we analyzed the security impact of transaction-reverting statements by removing them from smart contracts and comparing the mutated contracts against the original ones. Our study led to important findings, which can shed light on further research in the broad area of smart contract quality assurance and provide practical guidance to smart contract developers on the appropriate use of transaction-reverting statements.

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

↑