aptos-labs / aptos-core

Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.
https://aptosfoundation.org
Other
6.18k stars 3.65k forks source link

[Bug][move-compiler] package namespace issue #11574

Open brmataptos opened 10 months ago

brmataptos commented 10 months ago

🐛 Bug

@lightmark passed on from an Aptos user:

i've encountered some problems when developing contracts for aggregated trading. I need to import two marketplaces with different addresses, but the package names of these two marketplaces are the same, so the compilation will fail. If I force the package name to be changed, it will lead to dependency exceptions at release time, is there a good solution for this situation?

... Note, they are mentioning the package name, not the module. I think there's an issue with that at least in the way we interpret the move.toml. ... well at least for move... packages must be deployed at a unique address... so maybe that's at least one method... giving additional qualifiers ...

brmataptos commented 10 months ago

@wrwg also had some opinions about this. Talk to him for ideas if you want to tackle this.

Kripth commented 8 months ago

Considering that it is possible to use multiple packages with the same name in the same package, for example by creating a manifest manually, it seems that this could be solved by converting dependencies from a table to an array on Move.toml, and internally, if not already an array.

[dependencies.Marketplace]
local = "../topaz"

[dependencies.Marketplace]
local = "../wapal"
[[dependencies]]
local = "../topaz"

[[dependencies]]
local = "../wapal"

The package's name could also be read from the dependency's Move.toml like the address is.

Is there a reason why conversion is not possible that I'm missing?