The Move Prover

Jingyi Emma Zhong, Kevin Cheang, Shaz Qadeer, Wolfgang Grieskamp, Sam Blackshear, Junkil Park, Yoni Zohar, Clark W. Barrett, David L. Dill

Abstract

The Move Prover is an automated formal verification system specifically engineered for the Move language, the foundation of the Diem (formerly Libra) blockchain. By capitalizing on Move's "verification-friendly" architecture—characterized by linear types and the exclusion of dynamic dispatch—the Prover enables developers to automatically verify the functional correctness of critical smart contracts within seconds. This paper details the system's architecture, its integration with SMT solvers, and its successful application to the core modules of the Libra blockchain.

Introduction

Smart contracts represent a paradigm shift in financial technology, managing billions of dollars in digital assets. However, their automated and irreversible nature makes them prime targets for exploits; a single logic error can result in permanent financial loss. Traditional formal verification, while mathematically rigorous, has historically been too cumbersome for mainstream development due to complexities like pointer aliasing and re-entrancy inherent in most programming languages. The Move Prover addresses these challenges by providing a high-performance, user-friendly tool that ensures smart contracts adhere strictly to their specifications.

System Architecture and Methods

The Move Prover employs a sophisticated multi-stage pipeline to bridge the gap between high-level Move code and low-level mathematical proofs.

The Move Prover verification pipeline.

The process follows these key steps:

  1. Translation to Stackless IR: Move bytecode is first transformed into a "stackless" intermediate representation (IR), replacing stack-based operations with local variables to simplify analysis.
  2. Boogie Intermediate Language: The IR, along with user-defined specifications, is translated into Boogie, a generic verification language. A specialized Boogie model represents Move’s tree-shaped memory and linear resources as mathematical datatypes.
  3. SMT Solving: Boogie generates verification conditions—logical formulas—that are processed by high-performance Satisfiability Modulo Theories (SMT) solvers such as Z3 or CVC4. If the solver determines the formula is "UNSAT" (unsatisfiable), the code is mathematically proven to satisfy its specification.
  4. Diagnosis: In the event of a proof failure (a "SAT" result), the Prover translates the solver's counter-model back into a human-readable error message, pinpointing the issue at the source-code level.

Design for Verification

A core philosophy of the Move Prover is that the language itself should facilitate verification. Move omits features that traditionally complicate formal methods, such as concurrency, higher-order functions, and re-entrancy. Key features include:

  • Linearity: Move’s "resource" types have linear semantics, meaning they cannot be copied or dropped accidentally. The Prover relies on the Move bytecode verifier to guarantee these properties, allowing it to focus on higher-level functional logic.
  • The aborts_if Specification: The Prover introduces a first-class mechanism to specify conditions under which a function should abort, treating transaction reverts as expected, verifiable behavior rather than generic crashes.
  • Limited Aliasing: By enforcing strict rules on mutable references (exclusive access), Move eliminates the "aliasing problem" that often plagues verification in languages like C++ or Java, enabling more efficient reasoning by the SMT solver.

Evaluation and Results

The Move Prover was evaluated against the core modules of the Libra blockchain, specifically the Libra and LibraAccount modules, which handle critical asset management and account permissions.

The results demonstrated both speed and efficacy:

  • Comprehensive Coverage: The system successfully verified all 25 functions in the Libra module and 34 of 38 functions in the LibraAccount module. The remaining functions involved unsupported features like non-linear arithmetic.
  • High Performance: Verification was remarkably fast, with the Libra module completing in 2.99 seconds and the more complex LibraAccount module in 46.66 seconds.
  • Practical Impact: The tool identified subtle edge cases, such as a payment function vulnerability when the sender and payee were identical, which prompted developers to add specific checks for that case.

Limitations and Future Directions

While highly effective, the Move Prover has areas for growth. Current support for loops and recursion is limited, requiring manual "loop invariants" from developers. Future work aims to expand to "global" specifications—such as proving total currency supply remains constant across all transactions—and incorporating reasoning about "gas" consumption to prevent denial-of-service attacks. Additionally, optimizing SMT theories for vectors could further enhance performance.

Summary updated

BibTeX
@inproceedings{zhong2020move,
  author = {Jingyi Emma Zhong and Kevin Cheang and Shaz Qadeer and Wolfgang Grieskamp and Sam Blackshear and Junkil Park and Yoni Zohar and Clark W. Barrett and David L. Dill},
  title = {{The Move Prover}},
  booktitle = {CAV},
  year = {2020},
  doi = {10.1007/978-3-030-53288-8\_7},
}
Figure