As smart contracts gain adoption in financial transactions, it becomes increasingly important to ensure that they are free of bugs and security vulnerabilities. Of particular relevance in this context are arithmetic overflow bugs, as integers are often used to represent financial assets like account balances. Motivated by this observation, this paper presents SolType, a refinement type system for Solidity that can be used to prevent arithmetic over- and under-flows in smart contracts. SolType allows developers to add refinement type annotations and uses them to prove that arithmetic operations do not lead to over- and under-flows. SolType incorporates a rich vocabulary of refinement terms that allow expressing relationships between integer values and aggregate properties of complex data structures. Furthermore, our implementation, called Solid, incorporates a type inference engine and can automatically infer useful type annotations, including non-trivial contract invariants. To evaluate the usefulness of our type system, we use Solid to prove arithmetic safety of a total of 120 smart contracts. When used in its fully automated mode (i.e., using Solid's type inference capabilities), Solid is able to eliminate 86.3% of redundant runtime checks used to guard against overflows. We also compare Solid against a state-of-the-art arithmetic safety verifier called VeriSmart and show that Solid has a significantly lower false positive rate, while being significantly faster in terms of verification time.
翻译:随着智能合同在金融交易中被采纳,确保智能合同不受错误和安全弱点的影响变得日益重要。在这方面,特别相关的是算术溢出错误,因为整数常常用于代表金融资产,如账户余额。受此观察的驱动,本文件展示了SolType,这是一个完善的团结型系统,可以用来防止智能合同中计算过量和流量不足。SolType允许开发商添加精细型说明,并用来证明算术操作不会导致溢出和溢出。SolType含有丰富的精细化术语词汇,可以表达整数值和复杂数据结构的综合属性之间的关系。此外,我们的执行,称为Sustrial,包含一种类型的推算引擎,可以自动推断有用的类型说明,包括非边际合同。为了评估我们类型系统的有用性,我们使用固化软件来证明总共120个智能合同的算术安全性。当使用其完全自动化模式(即使用Sild'类推算能力)时,Slistable能够大量消除86.3%的超值检查,而我们用正值的准确性核查率要大大低于正值,我们用来对正值的保证。