-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Description
Steps to Reproduce Issue
The issue can be reproduced by attempting a standard build on a package where the [dev-dependencies]
section is populated.
The compiler fails to build the project, citing issues with named addresses and unbound modules, even though the configuration is valid for a standard build.
The provided repository is already configured in the failing state.
- Clone the reproduction repository:
git clone https://github.com/avernikoz/sui-dev-deps-override-repro.git
cd sui-dev-deps-override-repro
- Run the build command from within the main_package directory:
cd main_package
sui move build
To verify that the project is otherwise configured correctly, you can comment out the [dev-dependencies]
section in main_package/Move.toml
and run sui move build
again; the build will then succeed.
Expected Result
The build command should succeed.
According to the official documentation (The Move Book and the Sui Developer Guide), the [dev-dependencies]
and [dev-addresses]
sections should only be included in "dev" and "test" modes (i.e., when the --dev
or --test
flags are used).
For a standard sui move build
, the compiler should completely ignore these sections and resolve dependencies and named addresses using only the main [dependencies]
and [addresses]
sections.
This separation is critical for a secure and robust development lifecycle. The [dependencies]
section is intended to define the exact, stable, and often audited dependencies that will be included in the final on-chain package. The [dev-dependencies]
section, in contrast, is designed to allow developers to use local or remote forks for development and testing purposes.
The primary motivation for this is to facilitate comprehensive unit testing. For example, a developer might need to add #[test_only]
functions to a dependency to properly test their own package's interactions with it. This requires using a modified, local version of that dependency. The [dev-dependencies]
feature seems to be correct mechanism to enable this workflow, ensuring that the development-only forks and #[test_only]
additions are completely excluded from the final production build.
Without this feature working as documented, developers are forced into error-prone workarounds, hindering their ability to write thorough tests or compromising the integrity of the production package configuration.
Actual Result
The build fails with multiple compilation errors:
error[E03001]: address with no value
┌─ ./sources/main_package.move:6:5
│
6 │ use deepbook::pool::Pool;
│ ^^^^^^^^ address 'deepbook' is not assigned a value
error[E03002]: unbound module
┌─ ./sources/main_package.move:6:5
│
6 │ use deepbook::pool::Pool;
│ ^^^^^^^^^^^^^^ Invalid 'use'. Unbound module: 'deepbook::pool'
error[E03001]: address with no value
┌─ ./sources/main_package.move:7:5
│
7 │ use pyth::price_info::PriceInfoObject;
│ ^^^^ address 'pyth' is not assigned a value
error[E03002]: unbound module
┌─ ./sources/main_package.move:7:5
│
7 │ use pyth::price_info::PriceInfoObject;
│ ^^^^^^^^^^^^^^^^ Invalid 'use'. Unbound module: 'pyth::price_info'
Failed to build Move modules: Compilation error
System Information
- OS: macOS (Darwin 23.6.0)
- Compiler: sui 1.52.3-cd58464d654d