一句话:提出首个检测 DApp 链上-链下同步缺陷的测试框架 ÐArcher,并在真实应用中验证其有效性。
基于以太坊的去中心化应用(DApp)通常分为链上层和链下层:链上执行交易并存储关键数据,链下与用户交互。链下层需主动与链上同步,否则不一致数据可能误导用户并造成交易费损失等后果。然而,发送到区块链的交易不保证执行,甚至可能因链重组在已执行后被回滚,这种交易执行的非确定性是区块链特有的,开发者常因不熟悉复杂交易生命周期而无法准确同步。本文研究以太坊 DApp 中链上-链下数据同步的挑战,归纳出两类可导致层间不一致的缺陷;提出状态转移模型来指导 DApp 测试,并设计两个有效 oracle 自动识别缺陷,构建了首个测试框架 ÐArcher。在 11 个流行真实 DApp 上评估,缺陷检测精确率 99.3%、召回率 87.6%、准确率 89.4%,显著优于基线,并发现 15 个真实缺陷,其中 6 个已被开发者确认,3 个已修复。
Since the emergence of Ethereum, blockchain-based decentralized applications (DApps) have become increasingly popular and important. To balance the security, performance, and costs, a DApp typically consists of two layers: an on-chain layer to execute transactions and store crucial data on the blockchain and an off-chain layer to interact with users. A DApp needs to synchronize its off-chain layer with the on-chain layer proactively. Otherwise, the inconsistent data in the off-chain layer could mislead users and cause undesirable consequences, e.g., loss of transaction fees. However, transactions sent to the blockchain are not guaranteed to be executed and could even be reversed after execution due to chain reorganization. Such non-determinism in the transaction execution is unique to blockchain. DApp developers may fail to perform the on-chain-off-chain synchronization accurately due to their lack of familiarity with the complex transaction lifecycle. In this work, we investigate the challenges of synchronizing on-chain and off-chain data in Ethereum-based DApps. We present two types of bugs that could result in inconsistencies between the on-chain and off-chain layers. To help detect such on-chain-off-chain synchronization bugs, we introduce a state transition model to guide the testing of DApps and propose two effective oracles to facilitate the automatic identification of bugs. We build the first testing framework, ÐArcher, to detect on-chain-off-chain synchronization bugs in DApps. We have evaluated ÐArcher on 11 popular real-world DApps. ÐArcher achieves high precision (99.3%), recall (87.6%), and accuracy (89.4%) in bug detection and significantly outperforms the baseline methods. It has found 15 real bugs in the 11 DApps. So far, six of the 15 bugs have been confirmed by the developers, and three have been fixed. These promising results demonstrate the usefulness of ÐArcher.
@inproceedings{paperbot6391,
title = {ÐArcher: detecting on-chain-off-chain synchronization bugs in decentralized applications},
author = {Wuqi Zhang and Lili Wei and Shuqing Li and Yepang Liu and Shing-Chi Cheung},
booktitle = {FSE},
year = {2021},
doi = {10.1145/3468264.3468546}
}