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

SoliDiffy:面向Solidity智能合约的AST差异比对

SoliDiffy: AST Differencing for Solidity Smart Contracts

Mojtaba Eshghie, Viktor Åryd, Cyrille Artho, Martin Monperrus

AI总结:

本研究提出首款面向Solidity智能合约的AST差异比对工具SoliDiffy,可生成含四类操作的编辑脚本呈现结构差异,在大规模合约对和真实提交实验中均优于现有方法,已开源。

摘要:

结构化代码差异比对是通过代码的抽象语法树(AST)对比代码层级结构以捕捉修改的操作。基于AST的源代码差异比对可支撑漏洞检测、自动化修复等传统行级差异比对无法胜任的任务。我们提出SoliDiffy,这是首款面向Solidity智能合约的AST差异比对工具,能够生成编辑脚本,通过插入、删除、更新、移动操作可靠地呈现两份智能合约之间的结构差异。在包含353262个合约对的评估中,SoliDiffy的差异比对成功率达96.1%,超越现有最优水平,且生成的编辑脚本显著更短。针对925个真实世界提交的额外实验进一步证实,它优于Git的行级差异比对。即便源代码存在多处复杂修改,SoliDiffy也能准确呈现智能合约的演化过程。SoliDiffy已在https://github.com/mojtaba-eshghie/SoliDiffy 公开发布。

英文摘要:

Structured code differencing is the act of comparing the hierarchical structure of code via its abstract syntax tree (AST) to capture modifications. AST-based source code differencing enables tasks such as vulnerability detection and automated repair where traditional line-based differencing falls short. We introduce SoliDiffy, the first AST differencing tool for Solidity smart contracts with the ability to generate an edit script that soundly shows the structural differences between two smart-contracts using insert, delete, update, move operations. In our evaluation on 353,262 contract pairs, SoliDiffy achieved a 96.1% diffing success rate, surpassing the state-of-the-art, and produced significantly shorter edit scripts. Additional experiments on 925 real-world commits further confirmed its superiority compared to Git line-based differencing. SoliDiffy provides accurate representations of smart contract evolution even in the existence of multiple complex modifications to the source code. SoliDiffy is made publicly available at https://github.com/mojtaba-eshghie/SoliDiffy.

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

↑