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

在线检测有效的无回调对象并应用于智能合约

Online Detection of Effectively Callback Free Objects with Applications to Smart Contracts

Shelly Grossman, Ittai Abraham, Guy Golan-Gueta, Yan Michalevsky, Noam Rinetzky, Mooly Sagiv, Yoni Zohar

摘要:

回调在许多编程环境中是必不可少的,但会使程序理解和推理变得极其复杂,因为它们允许外部对象以意想不到的方式改变对象的本地状态,从而破坏模块化。加密货币框架Ethereum中著名的DAO漏洞,利用回调窃取了1.5亿美元。我们定义了有效回调自由(ECF)对象的概念,以便在不阻止模块化推理的情况下允许回调。在给定的执行跟踪中,如果存在一个没有回调到该对象的等效执行跟踪,则该对象是ECF。如果一个对象在所有可能的执行跟踪中都是ECF,那么它就是ECF。我们研究了动态检查ECF在一个给定的执行跟踪和静态检查,如果一个对象是ECF的可判定性。我们还证明了在以太坊中动态检查ECF是可行的,并且可以在线完成。通过运行以太坊中所有执行跟踪的历史记录,我们能够验证几乎所有现有的合约(不包括DAO或具有类似已知漏洞的合约)都是ECF。最后,我们表明,ECF,无论是动态或静态验证,使模块化推理封装状态的对象。

英文摘要:

Callbacks are essential in many programming environments, but drastically complicate program understanding and reasoning because they allow to mutate object's local states by external objects in unexpected fashions, thus breaking modularity. The famous DAO bug in the cryptocurrency framework Ethereum, employed callbacks to steal $150M. We define the notion of Effectively Callback Free (ECF) objects in order to allow callbacks without preventing modular reasoning. An object is ECF in a given execution trace if there exists an equivalent execution trace without callbacks to this object. An object is ECF if it is ECF in every possible execution trace. We study the decidability of dynamically checking ECF in a given execution trace and statically checking if an object is ECF. We also show that dynamically checking ECF in Ethereum is feasible and can be done online. By running the history of all execution traces in Ethereum, we were able to verify that virtually all existing contracts, excluding the DAO or contracts with similar known vulnerabilities, are ECF. Finally, we show that ECF, whether it is verified dynamically or statically, enables modular reasoning about objects with encapsulated state.

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

↑