MystenLabs / sui

Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language
https://sui.io
Apache License 2.0
6.23k stars 11.2k forks source link

Sui Doc Bug regarding building MyFirstPackage #2621

Closed Bijan-Massoumi closed 2 years ago

Bijan-Massoumi commented 2 years ago

What are the existing URLs containing the issue, if any?

https://docs.sui.io/build/move

How would you describe the issue? (What needs changing?)

sui-move build doesn't build with the error:

Failed to build Move modules: "Unable to resolve packages for package 'MyFirstPackage'".

This is because the relative path is incorrect in the toml file in the guide. It should be Sui = { local = "../sui/crates/sui-framework" } and not Sui = { local = "../../crates/sui-framework" }.

However, when replacing this path, I get this error when running build:

error[E03001]: address with no value
  ┌─ ./sources/M1.move:3:9
  │
3 │     use sui::id::VersionedID;
  │         ^^^ address 'sui' is not assigned a value

error[E03002]: unbound module
  ┌─ ./sources/M1.move:3:9
  │
3 │     use sui::id::VersionedID;
  │         ^^^^^^^ Invalid 'use'. Unbound module: 'sui::id'

error[E03004]: unbound type
  ┌─ ./sources/M1.move:6:13
  │
6 │         id: VersionedID,
  │             ^^^^^^^^^^^ Unbound type 'VersionedID' in current scope

any help is much appreciated.

Clay-Mysten commented 2 years ago

Thank you so much for the report, Bijan! These details help tremendously.

I have confirmed the path is incorrect and started a fix in: https://github.com/MystenLabs/sui/pull/2637 As you will see, I'm also trying to be more explicit about the intended directory structure.

I also confirm the build errors you report and so have added a number of folks who can help.

Adam, I also suggest we follow this statement: "please make sure you add these functions, and all the following code in this tutorial, in the scope of our package - between curly braces starting and ending the package definition" With an example showing those functions in place in the m1.move file.

Finally, I see the initial example input for the m1.move file is corrupt, with the ::id:: being converted to what looks like emojicode. Godwin, I believe this is related to our new support of emojicode. Can we escape this syntax when in code blocks? Thanks, all.

Jibz1 commented 2 years ago

@Clay-Mysten will release a fix for the emoji on the code issue soon.

Jibz1 commented 2 years ago

code blocks no longer render emoji

Clay-Mysten commented 2 years ago

I have confirmed this is fixed in the main branch:

claymurphy@Clays-MacBook-Pro ~ % mkdir -p my_move_package/sources
touch my_move_package/sources/m1.move
touch my_move_package/Move.toml
claymurphy@Clays-MacBook-Pro ~ % cd my_move_package 
claymurphy@Clays-MacBook-Pro my_move_package % vi sources/m1.move 
claymurphy@Clays-MacBook-Pro my_move_package % vi Move.toml 
claymurphy@Clays-MacBook-Pro my_move_package % 
claymurphy@Clays-MacBook-Pro my_move_package % vi Move.toml
claymurphy@Clays-MacBook-Pro my_move_package % sui-move build
Artifacts path: "./build"
Build Successful
claymurphy@Clays-MacBook-Pro my_move_package % 

We should be releasing those changes to the devnet branch shortly. Thanks again for the report.

Clay-Mysten commented 2 years ago

We've fixed the path in the docs. Now closing this out since the fix is already in main. Please reopen if this persists. Thanks again for the report!

Clay-Mysten commented 2 years ago

Made one more fix: https://github.com/MystenLabs/sui/pull/2666

Bijan-Massoumi commented 2 years ago

Thanks! I'll let you guys know if I find any other issues

Clay-Mysten commented 2 years ago

Thanks! I'll let you guys know if I find any other issues

Please do! Thanks again. :-)