paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Towards Finding Accounting Errors in Smart Contracts

面向智能合约中记账错误的发现
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 3/10 · 论文属于静态分析/类型系统与抽象解释方向,与用户的 PL 方法论兴趣有形式化的交集,但其应用域是智能合约的记账业务逻辑,既非 ML/Agentic 程序,也不涉及浮点分析、贝叶斯程序分析或 LLM 与静态分析的交叉,因此与画像核心方向只是方法论层面的弱相关。引用 8 inbox
Brian Zhang
crossref: 2026-09-12

AI 速览

一句话:提出抽象类型传播与检查系统,将智能合约业务逻辑建模为银行式原语,以自动发现记账错误。

智能合约中的记账错误常位于核心业务逻辑,具有合约特定性,现有自动化工具难以发现,人工审计也因需理解业务模型而困难。本文观察到大量业务逻辑可由存款、取款、贷款、还款等银行式原语或其组合建模,这些操作的性质可被抽象类型系统刻画。为此,作者提出一种新的类型传播与检查系统,用抽象类型建模代币单位、缩放因子和金融类型等高层信息,以识别记账错误。在29个真实项目的57个已知记账错误上评估,58%的错误是类型错误,系统捕获其中87.9%;在近期审计竞赛项目中还发现6个零日记账错误,其中4个导致直接资金损失。

问题
智能合约中的记账错误通常位于核心业务逻辑且合约特定,现有自动化工具难以发现,人工审计也因需要理解业务模型而十分困难。
方法
将常见业务逻辑抽象为银行式原语,设计抽象类型系统建模代币单位、缩放因子和金融类型等高阶信息,并通过类型传播与检查来捕获记账错误。
评估
在29个真实项目的57个已知记账错误上评估,发现58%为类型错误且系统捕获其中87.9%;在近期审计竞赛项目中检测出6个零日记账错误,其中4个导致直接资金损失。
原文摘要(Abstract)

Bugs in smart contracts may have devastating effects as they tend to cause financial loss. According to a recent study, accounting bugs are the most common kind of bugs in smart contracts that are beyond automated tools during pre-deployment auditing. The reason lies in that these bugs are usually in the core business logic and hence contract-specific. They are analogous to functional bugs in traditional software, which are largely beyond automated bug finding tools whose effectiveness hinges on uniform and machine checkable characteristics of bugs. It was also reported that accounting bugs are the second-most difficult to find through manual auditing, due to the need of understanding underlying business models. We observe that a large part of business logic in smart contracts can be modeled by a few primitive operations like those in a bank, such as deposit, withdraw, loan, and pay-off, or by their combinations. The properties of these operations can be clearly defined and checked by an abstract type system that models high-order information such as token units, scaling factors, and financial types. We hence develop a novel type propagation and checking system with the aim of identifying accounting bugs. Our evaluation on a large set of 57 existing accounting bugs in 29 real-world projects shows that 58% of the accounting bugs are type errors. Our system catches 87.9% of these type errors. In addition, applying our technique to auditing a large project in a very recent auditing contest has yielded the identification of 6 zero-day accounting bugs with 4 leading to direct fund loss.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11299,
  title = {Towards Finding Accounting Errors in Smart Contracts},
  author = {Brian Zhang},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639128}
}