You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

构建成功后发布Sui Move模块失败,遇依赖验证错误

Sui Move模块发布失败:依赖版本不匹配问题解决

执行的发布命令

sui client publish --gas-budget 3000000000

终端返回信息

[warn] Client/Server api version mismatch, client api version : 1.10.1, server api version : 1.11.0
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING basic

发布失败错误详情

Failed to publish the Move module(s), reason: [warning] Multiple source verification errors found:

  • Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::table_vec
  • Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::tx_context
  • Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::ecdsa_k1
  • Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::kiosk_extension
  • Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::transfer

This may indicate that the on-chain version(s) of your package's dependencies may behave differently than the source version(s) your package was built against.

Fix this by rebuilding your packages with source versions matching on-chain versions of dependencies, or ignore this warning by re-running with the --skip-dependency-verification flag.

Move模块代码

module basic::DEMO {
    use sui::object::{Self, UID};
    use sui::tx_context::{Self, TxContext};
    use sui::transfer;

    struct Wallet has key {
        id: UID,
        balance: u128,
        name: vector<u8>
    }
    fun init(ctx: &mut TxContext) {
        let wallet = Wallet {
            id: object::new(ctx),
            balance: 1_000_000_000_000_000,
            name: b"Maythunguyen",
        };

        transfer::transfer(wallet, tx_context::sender(ctx));

    }
}

Move.toml配置

[package]
name = "basic"
version = "0.0.1"

[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" }

[addresses]
basic = "0x0"

构建成功日志

UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING basic

解决方案

方案1:快速临时解决(跳过依赖验证)

直接在发布命令后添加参数强制跳过版本检查:

sui client publish --gas-budget 3000000000 --skip-dependency-verification

方案2:规范解决(匹配链上依赖版本)

  1. 升级Sui客户端版本:将客户端升级至与服务器一致的1.11.0版本:
    cargo install --locked --git https://github.com/MystenLabs/sui.git --tag sui-v1.11.0 sui
    
  2. 更新Move.toml依赖版本:将Sui依赖的rev值替换为对应版本标签:
    [dependencies]
    Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "sui-v1.11.0" }
    
  3. 重新构建并发布:
    sui move build
    sui client publish --gas-budget 3000000000
    

方案3:适配测试网官方框架版本

若部署到测试网,可查看Sui官方测试网公告获取最新框架rev值,替换到Move.toml后重新构建发布,确保依赖版本与链上完全一致。

内容的提问来源于stack exchange,提问作者Thư Nguyễn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 18:15:00