Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace collision between packages' dependencies #20112

Open
Oni-giri opened this issue Oct 31, 2024 · 3 comments
Open

Namespace collision between packages' dependencies #20112

Oni-giri opened this issue Oct 31, 2024 · 3 comments

Comments

@Oni-giri
Copy link

Steps to Reproduce Issue

Consider an empty project with the following Move.toml:

[package]
name = "test"
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move

[dependencies]
Sui = { override = true, git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" }
ScallopProtocol = { git = "https://github.com/scallop-io/sui-lending-protocol.git", subdir = "contracts/protocol", rev = "mainnet" }
lending_core = { git = "https://github.com/naviprotocol/protocol-interface.git", subdir = "lending_core", rev = "main" }

Expected Result

Everything compiles

Actual Result

Calling sui move build will return the following error:

Failed to build Move modules: Processing dependency 'lending_core' of 'test'

Caused by:
    Conflicting assignments for address 'math': '0x0' and '0x66aa3335901ce7e04b85ed6597ee42d4b479f7110bf98e8ebd474fa32a0027e1'..

Remarks

Note that removing ScallopProtocol or lending_core (Navi Finance) will compile fine.

The issue here is likely that both protocols use their own math dependency :

Given that both libraries are not overlapping, we can't try to override it.

System Information

  • OS: Ubuntu 20.04
  • Compiler: sui 1.36.1-homebrew
@tzakian
Copy link
Contributor

tzakian commented Oct 31, 2024

Hi there!

This is a problem due to Scallop and Navi exposing two different named addresses with the same name. This should be able to be resolved using the addr_subst form in the Move.toml which can be used to rename the math named address on either or both of the packages that bring the math address into scope. Give this a shot and it should work:

[package]
name = "test"
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move

[dependencies]
Sui = { override = true, git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" }
ScallopProtocol = { git = "https://github.com/scallop-io/sui-lending-protocol.git", subdir = "contracts/protocol", rev = "mainnet", addr_subst = {"scallop_math" = "math" } }
lending_core = { git = "https://github.com/naviprotocol/protocol-interface.git", subdir = "lending_core", rev = "main", addr_susbst = {"lending_math" = "math" } }

@Oni-giri
Copy link
Author

Oni-giri commented Nov 9, 2024

Thanks a lot ! It works!

@Oni-giri Oni-giri closed this as completed Nov 9, 2024
@Oni-giri Oni-giri reopened this Nov 21, 2024
@Oni-giri
Copy link
Author

Oni-giri commented Nov 21, 2024

Hi @tzakian thanks again for the fix ! I added Suilend to the mix, and now it's broken again. I have tried all combinations available, and I can't get it to compile, so I'm calling for your wisdom (again!).

Here is the TOML:

[package]
name = "my_project"
edition = "2024.beta" # edition = "legacy" to use legacy (pre-2024) Move
# license = ""           # e.g., "MIT", "GPL", "Apache 2.0"
# authors = ["..."]      # e.g., ["Joe Smith ([email protected])", "John Snow ([email protected])"]

[dependencies]
Sui = { override = true, git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" }
MoveStdlib = { override = true, git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "framework/mainnet" }
suilend = { git = "https://github.com/solendprotocol/suilend.git", subdir = "contracts/suilend/", rev = "mainnet"  }
ScallopProtocol = { git = "https://github.com/scallop-io/sui-lending-protocol.git", subdir = "contracts/protocol", rev = "mainnet", addr_subst = {"scallop_math" = "math" } }
lending_core = { git = "https://github.com/naviprotocol/protocol-interface.git", subdir = "lending_core", rev = "main", addr_susbst = {"lending_math" = "math"} }

Which leads to :

Failed to build Move modules: When resolving dependencies for package aftermath_grow, conflicting versions of package Pyth found:
At lending_core -> oracle -> Pyth
        Pyth = { git = "https://github.com/naviprotocol/pyth-crosschain.git", rev = "navi-forked", subdir = "target_chains/sui/contracts" }
At suilend -> Pyth
        Pyth = { git = "https://github.com/solendprotocol/pyth-crosschain.git", rev = "98e218c64bb75cf1350eb7b021e1ffcc3aedfd62", subdir = "target_chains/sui/contracts" }.

Trying to add addr_subst = {"suilend_pyth" = "pyth" } and addr_susbst = {"lending_math" = "math", "navi_pyth"= "pyth" } doesn't work either. As it appears, for navi, pyth is a subdependency of the oracle dep, maybe that's the cause?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants