Skip to content

mvr did not follow the external resolver protocol #241

@0xxlegolas

Description

@0xxlegolas

Summary

--resolve-deps fails for any package published under a non-canonical env (e.g. testnet_alpha, testnet_beta) instead of testnet

Details

mvr --resolve-deps (the resolver invoked by recent sui move build) fails with an "address missmatch" for any MVR name whose source repo publishes the package under an env name other than the canonical testnet / mainnet, even when the chain-id is 4c78adac

Reproduced against mvr 0.1.0-d85f8ad9 (suiup release) and mvr 0.1.0-1a463386 (main HEAD), with sui 1.69.1 and sui 1.70.2.

Image

Steps to reproduce

  1. Clone https://github.com/evefrontier/builder-scaffold/

  2. Replace the Move.toml local work dependancy with the mvr name @evefrontier/world-uat

Move.toml:

[package]
name = "smart_gate_extension"
edition = "2024"

[dependencies]
world = { r.mvr = "@evefrontier/world-uat" }

Run sui move build and it fails mvr did not follow the external resolver protocol.

Root cause

The MVR registry entry for @evefrontier/world-uat is correct: package_address = 0x07e6b810… matches [published.testnet_utopia].published-at in world-contracts/contracts/world/Published.toml.

The world-contracts repo publishes four packages, all on chain-id 4c78adac, under different env names mapping to different mvr names :

env name published-at original-id
testnet_internal 0xe148a214… 0x35398…
testnet_stillness 0xd2fd1224… 0x28b497…
testnet_utopia 0x07e6b810… 0xd12a70c7…

In crates/mvr-cli/src/utils/sui_binary.rs#L120-L143:

let network_name = network.to_string();          // always "testnet" or "mainnet"
let chain_id = get_chain_id(&network)?;          // "4c78adac" or "35834a8a"
let cli_output = sui_command([
    "move", "cache-package",
    &network_name,                               // <-- env name passed to sui
    chain_id.as_str(),
    dependency_str.as_str(),
])?;

Network is enum { Testnet, Mainnet }, so network.to_string() is always one of those two. Sui's move cache-package uses that as the env name to look up in Published.toml, so it always resolves against [published.testnet] / [published.mainnet].

For @evefrontier/world-uat the correct entry is [published.testnet_utopia]. I guess the tool returns the canonical-tier addresses (0x33226d2e… / 0x920e577e…), and the check at crates/mvr-cli/src/types/resolver_alt.rs#L89-L110 rejects it.

This makes MVR effectively unusable for any project that uses tiered environments sharing a chain-id (a common pattern: dev / staging / prod, plus this project's utopia / stillness / internal).

Suggested fix

Either (a) enumerate every [published.*] entry whose chain-id matches the requested env and accept any match, or (b) thread the registry-stored env name through PackageRequest and pass that to cache-package instead of the canonical testnet / mainnet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions