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

智能合约软件测试:第一项研究

Smart Contracts Software Metrics: a First Study

Roberto Tonelli, Giuseppe Destefanis, Michele Marchesi, Marco Ortu

摘要:

智能合约(SC)是驻留并运行在区块链上的软件代码。代码可以用不同的语言编写,其共同目的是在托管区块链上实现各种交易,它们由区块链基础设施管理,并工作以满足传统合同的典型条件。与传统的软件代码相比,软件代码必须满足强上下文相关的约束。特别是,由于字节码是在托管区块链中上传的,因此大小,计算资源,软件不同部分之间的交互都是有限的,即使特定的软件语言实现了或多或少与传统语言相同的结构,也没有正常软件开发中的自由。SC软件预计将反映这些约束SC软件度量,应该显示度量值的域的特性,并从更传统的软件度量不同。我们在超过12000个用Solidity编写并上传到以太坊区块链上的SC代码上测试了这个假设。我们从一个公共存储库中下载了SC,并计算了一组与SC相关的软件度量的统计数据,并将它们与从更传统的软件项目中提取的度量进行了比较。我们的研究结果表明,通常智能合约指标的范围比传统软件系统中的相应指标更受限制。一些程式化的事实,如一些指标分布尾部的幂律,只是近似的,但代码行遵循对数正态分布,这让人想起在传统软件系统中已经发现的相同行为。

英文摘要:

Smart contracts (SC) are software codes which reside and run over a blockchain. The code can be written in different languages with the common purpose of implementing various kinds of transactions onto the hosting blockchain, They are ruled by the blockchain infrastructure and work in order to satisfy conditions typical of traditional contracts. The software code must satisfy constrains strongly context dependent which are quite different from traditional software code. In particular, since the bytecode is uploaded in the hosting blockchain, size, computational resources, interaction between different parts of software are all limited and even if the specific software languages implement more or less the same constructs of traditional languages there is not the same freedom as in normal software development. SC software is expected to reflect these constrains on SC software metrics which should display metric values characteristic of the domain and different from more traditional software metrics. We tested this hypothesis on the code of more than twelve thousands SC written in Solidity and uploaded on the Ethereum blockchain. We downloaded the SC from a public repository and computed the statistics of a set of software metrics related to SC and compared them to the metrics extracted from more traditional software projects. Our results show that generally Smart Contracts metrics have ranges more restricted than the corresponding metrics in traditional software systems. Some of the stylized facts, like power law in the tail of the distribution of some metrics, are only approximate but the lines of code follow a log normal distribution which reminds of the same behavior already found in traditional software systems.

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

↑