Skip to main content
QUICK REVIEW

[Paper Review] Formal Analysis of Composable DeFi Protocols

Palina Tolmach, Yi Li|arXiv (Cornell University)|Feb 28, 2021
Formal Methods in VerificationComputer Science27 references10 citations
TL;DR

This paper proposes a formal, process-algebraic modeling approach using Communicating Sequential Processes (CSP) to verify compositional security and financial properties of DeFi protocols. It models Curve Finance (DEX) and Compound (lending protocol) along with USDC stablecoin, using model checking to automatically detect vulnerabilities in their interactions, such as arbitrage-induced losses and profit manipulation, with verified violations confirmed on a local Ethereum network.

ABSTRACT

Decentralized finance (DeFi) has become one of the most successful applications of blockchain and smart contracts. The DeFi ecosystem enables a wide range of crypto-financial activities, while the underlying smart contracts often contain bugs, with many vulnerabilities arising from the unforeseen consequences of composing DeFi protocols together. In this paper, we propose a formal process-algebraic technique that models DeFi protocols in a compositional manner to allow for efficient property verification. We also conduct a case study to demonstrate the proposed approach in analyzing the composition of two interacting DeFi protocols, namely, Curve and Compound. Finally, we discuss how the proposed modeling and verification approach can be used to analyze financial and security properties of interest.

Motivation & Objective

  • To address the growing risk of security vulnerabilities in DeFi due to unintended interactions between composable protocols.
  • To develop a formal, compositional modeling technique that captures the behavior of DeFi components like tokens and pools.
  • To enable automated verification of financial and security properties across interacting DeFi protocols using model checking.
  • To demonstrate the approach on real-world protocols—Curve and Compound—by identifying and validating specific vulnerabilities in their composition.

Proposed method

  • Modeling DeFi components such as tokens, pools, and protocols using Communicating Sequential Processes (CSP) for precise behavioral specification.
  • Formalizing the behavior of Curve Finance (a DEX using constant-product invariant) and Compound (a lending protocol with interest rate models) in CSP.
  • Defining financial and security properties as temporal logic specifications to be verified via model checking.
  • Using the PAT model checker to perform reachability analysis and verify properties under various user interaction scenarios.
  • Simplifying smart contract behavior to enable formal verification while preserving key financial dynamics.
  • Validating detected violations on a locally deployed Ethereum network to confirm real-world relevance of model findings.

Experimental results

Research questions

  • RQ1Can formal process-algebraic modeling detect security and financial vulnerabilities arising from the composition of DeFi protocols like Curve and Compound?
  • RQ2What specific financial properties—such as profit and loss bounds—can be formally verified in interacting DeFi protocols?
  • RQ3How do market dynamics and arbitrage opportunities lead to unintended consequences in composable DeFi systems?
  • RQ4To what extent can model checking identify exploitable behaviors in protocol interactions without relying on runtime audits?
  • RQ5Can the proposed modeling approach be extended to capture broader DeFi mechanisms like governance and liquidity mining?

Key findings

  • The model checking process identified two violated financial properties: one related to maximum loss for Curve depositors and another to maximum profit for Compound depositors, both arising from arbitrage manipulation.
  • The reachability analysis in PAT revealed that an attacker could exploit price manipulation via Curve to extract $24M from Harvest, confirming the real-world relevance of the model.
  • The model detected that Compound depositors could suffer losses exceeding 10% under specific interaction patterns with Curve, due to price impact from arbitrage trades.
  • The violation of financial invariants was confirmed on a locally deployed Ethereum network, validating the model's accuracy in simulating real protocol behavior.
  • The study demonstrates that compositional formal verification can uncover vulnerabilities missed by traditional audits focused only on individual protocols.
  • The approach is scalable for initial verification but faces state explosion challenges with larger compositions, highlighting the need for compositional verification techniques like assume-guarantee reasoning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.