Skip to main content
QUICK REVIEW

[论文解读] On-Chain Decentralized Learning and Cost-Effective Inference for DeFi Attack Mitigation

Alhaidari, Abdulrahman, Vinay J. Ribeiro|arXiv (Cornell University)|Jan 1, 2025
Blockchain Technology Applications and SecurityComputer Science被引用 2
一句话总结

YODA 通过使用基于 MIRACLE 算法的自适应多轮共识以及激励相容机制(如 RICE),在以太坊等无许可区块链上实现了计算密集型合约(CICs)的高效、安全的链下执行。其在拜占庭、利他主义、理性(BAR)威胁模型下具备强大的安全保证,且当拜占庭节点比例较低时效率接近最优。与以太坊的限制相比,单笔交易的气体使用量最高可提升 450 倍。

ABSTRACT

Billions of dollars are lost every year in DeFi platforms by transactions exploiting business logic or accounting vulnerabilities. Existing defenses focus on static code analysis, public mempool screening, attacker contract detection, or trusted off-chain monitors, none of which prevents exploits submitted through private relays or malicious contracts that execute within the same block. We present the first decentralized, fully on-chain learning framework that: (i) performs gas-prohibitive computation on Layer-2 to reduce cost, (ii) propagates verified model updates to Layer-1, and (iii) enables gas-bounded, low-latency inference inside smart contracts. A novel Proof-of-Improvement (PoIm) protocol governs the training process and verifies each decentralized micro update as a self-verifying training transaction. Updates are accepted by PoIm only if they demonstrably improve at least one core metric (e.g., accuracy, F1-score, precision, or recall) on a public benchmark without degrading any of the other core metrics, while adversarial proposals get financially penalized through an adaptable test set for evolving threats. We develop quantization and loop-unrolling techniques that enable inference for logistic regression, SVM, MLPs, CNNs, and gated RNNs (with support for formally verified decision tree inference) within the Ethereum block gas limit, while remaining bit-exact to their off-chain counterparts, formally proven in Z3. We curate 298 unique real-world exploits (2020 - 2025) with 402 exploit transactions across eight EVM chains, collectively responsible for $3.74 B in losses. We demonstrate that on-chain ML governed by PoIm detects previously unseen attacks with over 97% attack detection accuracy and 82.0% F1. A single inference, such as one made via an external call, typically incurs zero cost. Fully on-chain inference consumes 57,603 gas (≈ $0.18) for linear models, 143,647 gas (≈ $0.49) for CNN(F2, K1), and 506,397 gas (≈ $1.77) for CNN(F8, K4) on L1 (e.g., Ethereum). Our results show that practical and continually evolving DeFi defenses can be embedded directly in protocol logic without trusted guardians, and our solution achieves highly cost-effective protection while filling a critical gap between vulnerability scanners and real-time transaction screening.

研究动机与目标

  • 解决无许可区块链(如以太坊)在执行 CICs 时因高气体成本和验证者困境导致的局限性。
  • 设计一种系统,确保在包含拜占庭节点和理性(自私)节点的现实威胁模型下正确执行 CICs。
  • 实现在无需链上验证或部分执行的前提下,对 CICs 进行链下执行,确保可扩展性与公平性。
  • 提供经济与技术激励,使诚实行为对理性节点而言近似构成纳什均衡。
  • 在保持正确结果判定高概率的前提下,最小化计算与事务开销。

提出的方法

  • YODA 使用抽签机制从随机选择的小型执行集合(ES)进行链下 CIC 计算,从而降低链上负载。
  • 多轮自适应共识算法(MIRACLE)通过基于计数和拜占庭节点比例估计值 f 的方案摘要似然性,迭代评估以确定 CIC 的正确结果。
  • MIRACLE 根据实际拜占庭节点比例 f 自适应调整轮次数,当 f 较低时可最小化预期计算量。
  • 随机插入合约执行(RICE)协议通过引入随机性,防止搭便车行为,并确保正确 ES 参与者能及时、公平地获得奖励。
  • 通过经济激励与技术机制,确保理性节点的诚实行为近似构成纳什均衡。
  • 模块化架构支持独立替换组件(如 ES 选择、RICE 和 MIRACLE),以实现未来可扩展性。

实验结果

研究问题

  • RQ1在结合拜占庭与理性(自私)威胁模型下,能否实现在无许可区块链上安全高效地进行链下 CIC 执行?
  • RQ2当执行集合较小且可能已被攻破时,如何以极低的链上开销和高概率达成对单一正确 CIC 结果的一致共识?
  • RQ3何种机制可确保理性(自私)节点不会搭便车,而是提交正确结果?
  • RQ4当实际拜占庭节点比例低于最坏情况假设时,系统如何自适应地减少资源使用?
  • RQ5在拜占庭比例达到最大值且存在对抗性行为时,系统能否在预期执行轮次上实现近似最优?

主要发现

  • YODA 支持单个 CIC 的执行,其气体使用量最高可达以太坊当前 EVM 限制的 450 倍,显著提升了可扩展性。
  • MIRACLE 算法以至少 1−β 的概率保证 CIC 结果正确,并通过减少预期轮次数,自适应地适应较低的拜占庭比例。
  • 当实际拜占庭比例 f 低于假设的最坏情况 fmax 时,MIRACLE 实现了显著的效率提升,减少了所需执行轮次。
  • RICE 引入的开销极小:即使在 1 亿气体使用量下,绝对开销仍低于 0.2 秒,相对时间差可忽略不计。
  • 系统确保理性节点的诚实行为近似构成纳什均衡,通过经济与技术激励防止搭便车行为。
  • 在以太坊上的原型实现表明,YODA 可处理单位时间内和总气体需求量均比原生以太坊支持高出数个数量级的 CIC。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。