MCPcopy Index your code
hub / github.com/asymptotic-code/sui-prover

github.com/asymptotic-code/sui-prover @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
2,416 symbols 8,960 edges 104 files 897 documented · 37%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Sui Prover

A tool for verifying the correctness of Move smart contracts on the Sui blockchain. Based on the Boogie verification engine and the Z3 SMT solver.

Go to Sui Prover Documentation for more information.

Quick Start

Install from brew

brew install asymptotic-code/sui-prover/sui-prover

Basic Usage

Write specifications for your smart contract that the Sui Prover will verify.

Specification Structure

#[spec(prove)]
fun function_spec<T>(args): ReturnType {
    // Preconditions on arguments

    let result = original_function(args);

    // Postconditions that must hold

    result
}

Example

Consider a simplified LP (Liquidity Pool) smart contract:

module amm::simple_lp;

use sui::balance::{Balance, Supply, zero};

public struct LP<phantom T> has drop {}

public struct Pool<phantom T> has store {
    balance: Balance<T>,
    shares: Supply<LP<T>>,
}

public fun withdraw<T>(pool: &mut Pool<T>, shares_in: Balance<LP<T>>): Balance<T> {
    if (shares_in.value() == 0) {
        shares_in.destroy_zero();
        return zero()
    };

    let balance = pool.balance.value();
    let shares = pool.shares.supply_value();

    let balance_to_withdraw = (((shares_in.value() as u128) * (balance as u128)) / (shares as u128)) as u64;

    pool.shares.decrease_supply(shares_in);
    pool.balance.split(balance_to_withdraw)
}

Example Specification

A specification to verify that the price of a share doesn't decrease when withdrawing funds:

#[spec(prove)]
fun withdraw_spec<T>(pool: &mut Pool<T>, shares_in: Balance<LP<T>>): Balance<T> {
    requires(shares_in.value() <= pool.shares.supply_value());

    let old_pool = clone!(pool);

    let result = withdraw(pool, shares_in);

    let old_balance = old_pool.balance.value().to_int();
    let new_balance = pool.balance.value().to_int();

    let old_shares = cloned_pool.shares.supply_value().to_int();
    let new_shares = pool.shares.supply_value().to_int();

    ensures(new_shares.mul(old_balance).lte(old_shares.mul(new_balance)));

    result
}

Running the Sui Prover

Run from the move.toml directory:

sui-prover

Claude Code Integration

Install the Sui Prover skill for Claude Code to get AI-assisted specification writing, verification debugging, and prover guidance.

Add the plugin source:

/plugin marketplace add asymptotic-code/sui-prover

Install the plugin:

/plugin install sui-prover@sui-prover

Once installed, Claude Code can help you write specifications, run the prover, and debug verification failures using the /sui-prover command.

See Also

Sui Prover Documentation

Extension points exported contracts — how you extend this code

TransferFunctions (Interface)
Take a pre-state + instruction and mutate it to produce a post-state。 [8 implementers]
crates/move-stackless-bytecode/src/dataflow_analysis.rs
GetNameString (Interface)
(no doc) [2 implementers]
crates/move-model/src/model.rs
AbstractDomain (Interface)
A trait to be implemented by domains which support a join. [13 implementers]
crates/move-stackless-bytecode/src/dataflow_domains.rs
FunctionTargetProcessor (Interface)
A trait describing a function target processor. [34 implementers]
crates/move-stackless-bytecode/src/function_target_pipeline.rs
DataflowAnalysis (Interface)
(no doc) [8 implementers]
crates/move-stackless-bytecode/src/dataflow_analysis.rs
ExpRewriterFunctions (Interface)
for trait default parameters [3 implementers]
crates/move-stackless-bytecode/src/exp_rewriter.rs

Core symbols most depended-on inside this repo

clone
called by 599
crates/move-stackless-bytecode/src/annotations.rs
to_string
called by 357
crates/move-prover-boogie-backend/src/boogie_backend/options.rs
insert
called by 353
crates/move-stackless-bytecode/src/livevar_analysis.rs
get
called by 295
crates/move-stackless-bytecode/src/annotations.rs
get_qualified_id
called by 255
crates/move-model/src/model.rs
contains
called by 200
crates/move-model/src/ty.rs
get_fun_qid_opt
called by 199
crates/move-model/src/model.rs
expect
called by 124
crates/move-prover-boogie-backend/src/boogie_backend/boogie_wrapper.rs

Shape

Method 1,879
Class 236
Function 230
Enum 61
Interface 10

Languages

Rust100%

Modules by API surface

crates/move-model/src/model.rs607 symbols
crates/move-prover-boogie-backend/src/boogie_backend/boogie_wrapper.rs97 symbols
crates/move-stackless-bytecode/src/function_target_pipeline.rs92 symbols
crates/move-prover-boogie-backend/src/boogie_backend/boogie_helpers.rs76 symbols
crates/move-prover-boogie-backend/src/boogie_backend/bytecode_translator.rs74 symbols
crates/move-stackless-bytecode/src/stackless_bytecode.rs64 symbols
crates/move-model/src/ty.rs62 symbols
crates/move-stackless-bytecode/src/package_targets.rs56 symbols
crates/move-stackless-bytecode/src/ast.rs54 symbols
crates/move-stackless-bytecode/src/access_path.rs54 symbols
crates/move-stackless-bytecode/src/function_target.rs53 symbols
crates/move-stackless-bytecode/src/access_path_trie.rs49 symbols

For agents

$ claude mcp add sui-prover \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact