Post
Share your knowledge.
+10
Multiple Source Verification Errors" in Sui Move Module Publications - Automated Error Resolution
Developers working with Sui Move frequently encounter issues related to "Multiple source verification errors found" when attempting to publish or upgrade modules. These errors occur due to mismatches between local dependencies and their on-chain counterparts, leading to failed publications and deployment challenges. Below is a consolidated example of the errors developers face:
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::vec_set
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::vec_map
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000001::MoveStdlib::bit_vector
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000001::MoveStdlib::ascii
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::hex
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::zklogin_verified_id
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::prover
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::coin
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::dynamic_field
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::transfer
- On-chain version of dependency Sui::zklogin_verified_id was not found.
- On-chain version of dependency Sui::zklogin_verified_issuer was not found.
- 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::transfer_policy
- Local dependency did not match its on-chain version at 0000000000000000000000000000000000000000000000000000000000000002::Sui::kiosk
This issue often arises due to:
- Mismatched versions between the local development environment (e.g., Sui CLI) and the on-chain state.
- Differences in package configurations across networks (e.g., Mainnet vs. Testnet).
- Missing or outdated dependencies in the on-chain environment.
Key Questions
- How can we automate the detection and resolution of these dependency mismatches during the publication process?
- What tools or scripts can be developed to ensure that local dependencies always align with their on-chain counterparts?
- Is there a way to streamline this process by integrating dependency checks into existing CI/CD pipelines or enhancing the Sui SDK?
Your task is to propose a solution that addresses these challenges, ensuring smoother and more reliable deployments for Sui Move developers. Make sure to post your solution below.
- Sui
- SDKs and Developer Tools
Answers
1Let me explain the solution and how to solve the "Multiple source verification errors" you're encountering in Sui Move when publishing or upgrading modules. When you develop Sui Move modules locally, you specify dependencies in your Move.toml file, like this:
[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui", subdir = "crates/sui-framework", rev = "some-revision" }
The rev field indicates the specific version (a branch, tag, or commit hash) of the Sui framework you’re using.
If this version doesn’t match what’s deployed on the blockchain for your target network, you’ll get verification errors during publication or upgrades. For example, the blockchain might be using an older version of Sui::vec_set
than your local code, or a module like Sui::zklogin_verified_id
might not be published on the network you’re targeting.
My solution is a Bash script that updates your Move.toml file with the correct revision of the Sui framework based on your target network and then verifies the setup by building your package. Save it as update-deps.sh
in your project directory (where Move.toml is located).
#!/bin/bash
# Function to get the latest commit hash for the network-specific branch
get_latest_rev() {
network=$1
case $network in
"testnet")
branch="framework/testnet"
;;
"devnet")
branch="framework/devnet"
;;
"mainnet")
branch="main"
;;
*)
echo "Invalid network specified. Use 'testnet', 'devnet', or 'mainnet'."
exit 1
;;
esac
# Fetch the latest commit hash from the specified branch
rev=$(git ls-remote https://github.com/MystenLabs/sui $branch | cut -f1)
if [ -z "$rev" ]; then
echo "Failed to fetch revision for branch $branch."
exit 1
fi
echo $rev
}
# Function to update Move.toml with the correct revision
update_move_toml() {
network=$1
rev=$(get_latest_rev $network)
# Update the rev field in Move.toml for the Sui dependency
sed -i "s/rev = .*/rev = \"$rev\"/" Move.toml
echo "Updated Move.toml with rev = $rev for $network"
}
# Main function
main() {
if [ $# -ne 1 ]; then
echo "Usage: $0 <network> (e.g., testnet, devnet, mainnet)"
exit 1
fi
network=$1
update_move_toml $network
# Attempt to build the package
if ! sui move build; then
echo "Build failed. Please check for missing dependencies or other issues."
else
echo "Build successful. You can now publish the package."
fi
}
# Run the main function with provided arguments
main "$@"
You can run Run chmod +x update-deps.sh
and execute it with your target network. like ./update-deps.sh testnet
So here is the out in your terminal:
harryphan@MacBook-Pro-2 hello % ./update-deps.sh testnet
Updated Move.toml with rev = 556b6e14896a09f95e7cf460bc8220a3bf997979 for testnet
UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git
INCLUDING DEPENDENCY Sui
INCLUDING DEPENDENCY MoveStdlib
BUILDING hello
Build successful. You can now publish the package.
Do you know the answer?
Please log in and share it.
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.