sui icon indicating copy to clipboard operation
sui copied to clipboard

Unable to build project

Open inanisvitae opened this issue 1 year ago • 7 comments
trafficstars

Unable to build project

dep_package % sui move build --force UPDATING GIT DEPENDENCY https://github.com/MystenLabs/sui.git INCLUDING DEPENDENCY Sui INCLUDING DEPENDENCY MoveStdlib BUILDING dep_package error[Sui E01001]: invalid object construction ┌─ /Users/.move/https___github_com_MystenLabs_sui_git_framework__testnet/crates/sui-framework/packages/sui-framework/sources/random.move:53:20 │
53 │ let self = Random { │ ╭────────────────────^ 54 │ │ id: object::randomness_state(), │ │ -- -------------------------- Non fresh UID from this position │ │ │
│ │ The UID must come directly from sui::object::new. Or for tests, it can come from sui::test_scenario::new_object 55 │ │ inner: versioned::create(version, inner, ctx), 56 │ │ }; │ ╰─────────^ Invalid object creation without a newly created UID.

Failed to build Move modules: Compilation error.

Expected Result

When running sui move build --force can't compile

System Information

  • OS: MacOS
  • Compiler: SUI testnet

inanisvitae avatar Dec 07 '23 00:12 inanisvitae

This was fixed yesterday. Try to reinstall the sui cli either through

cargo install --locked --git https://github.com/MystenLabs/sui.git sui

or through homebrew

brew tap mystenlabs/tap
brew install mystenlabs/tap/sui

stefan-mysten avatar Dec 07 '23 02:12 stefan-mysten

I am not quite sure that fixes it as the approach above is for mainnet right? It seems to be fine for mainnet but for testnet we would need to use

cargo install --locked --git https://github.com/MystenLabs/sui.git sui --branch testnet

However building this here locally is broken with

error[E0599]: no function or associated item named `random_for_testing_only` found for struct `SuiAddress` in the current scope
   --> crates/sui-json-rpc-types/src/sui_event.rs:163:33
    |
163 |             sender: SuiAddress::random_for_testing_only(),
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `SuiAddress`

andyjsbell avatar Dec 07 '23 08:12 andyjsbell

@stefan-mysten Yes, still broken for both testnet and devnet.

inanisvitae avatar Dec 07 '23 09:12 inanisvitae

@inanisvitae @andyjsbell yes, this was merged on main and will probably be merged into testnet/devnet next week as per release schedule. I will see if I can cherry pick it into those branches. Thanks for the patience!

stefan-mysten avatar Dec 07 '23 16:12 stefan-mysten

@inanisvitae @andyjsbell - I cherry picked the fix into the release branch, which will be used for the release on Monday (devnet 1.16.0) / Tuesday (testnet 1.15.0). Thanks for your patience. If you cannot wait until then, either use main or releases/sui-v1.15.0-release branch, which will be the branch used for the Tuesday release (testnet).

stefan-mysten avatar Dec 07 '23 23:12 stefan-mysten

I have same problem, and fix it as follow:

  1. download the binary file: https://github.com/MystenLabs/sui/releases/tag/mainnet-v1.14.2
  2. rename the target/release/sui-macos-x86_64 to sui
  3. move the sui file to ~/.cargo/bin
  4. cd ~/.move/https___github_com_MystenLabs_sui_git_framework__testnet/
  5. change the branch to releases/sui-v1.14.0-release, and pull the remote code.

For reference, other OG have provided simpler solutions, but I have not tried:

  1. cargo install --locked --git https://github.com/MystenLabs/sui.git —tag mainnet-v1.14.2 sui
  2. change the move.toml, the git branch version.

ranmian avatar Dec 09 '23 07:12 ranmian

Just for the record, if you use Homebrew, you can install directly from our tap. https://docs.sui.io/guides/developer/getting-started/sui-install#install-homebrew

stefan-mysten avatar Dec 11 '23 23:12 stefan-mysten

This problem should have been fixed by now, so closing the issue. Please open a new issue if you encounter any problems.

stefan-mysten avatar Dec 29 '23 05:12 stefan-mysten