fuel
January 23, 2024, 5:36pm
1
Issue Building Example from sway-libs Repository
Hello Fuel community,
I recently updated my Fuel latest toolchain and fuelup, and encountered an issue while trying to build one of the examples from the sway-libs repository.
Here’s what I did:
Cloned the sway-libs repository:git clone git@github.com:FuelLabs/sway-standards.git
Navigated to the src3-mint-burn
example:cd ./sway-standards/
cd examples/src3-mint-burn/
Attempted to build the example:forc build
However, I encountered the following error during the build process:
Creating a new `Forc.lock` file. (Cause: lock file did not exist)
Adding core
Adding src20
Adding src3
Adding src5
Adding src7
Adding std git+https://github.com/fuellabs/sway?tag=v0.46.1#512a3386f8961185188302f391ccc96553d23a7a
Created new lock file at /Users/alexey/Desktop/sway-standards/examples/Forc.lock
Compiling library core (/Users/alexey/.forc/git/checkouts/std-9be0d6062747ea7/512a3386f8961185188302f391ccc96553d23a7a/sway-lib-core)
Compiling library std (git+https://github.com/fuellabs/sway?tag=v0.46.1#512a3386f8961185188302f391ccc96553d23a7a)
Compiling library src7 (/Users/alexey/Desktop/sway-standards/standards/src7-metadata)
Compiling library src3 (/Users/alexey/Desktop/sway-standards/standards/src3-mint-burn)
Compiling library src20 (/Users/alexey/Desktop/sway-standards/standards/src20-native-asset)
Compiling contract single_src7_asset (/Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset)
warning
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:55:17
|
53 |
54 | #[storage(read)]
55 | fn metadata(asset: AssetId, key: String) -> Option<Metadata> {
| ----- This declaration is never used.
56 | require(asset == AssetId::default(), "Invalid AssetId provided");
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:56:26
|
54 |
55 | fn metadata(asset: AssetId, key: String) -> Option<Metadata> {
56 | require(asset == AssetId::default(), "Invalid AssetId provided");
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
57 |
58 | if key == String::from_ascii_str("social:x") {
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:78:21
|
76 |
77 | fn total_supply(asset: AssetId) -> Option<u64> {
78 | if asset == AssetId::default() {
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
79 | Some(TOTAL_SUPPLY)
80 | } else {
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:87:21
|
85 |
86 | fn name(asset: AssetId) -> Option<String> {
87 | if asset == AssetId::default() {
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
88 | Some(String::from_ascii_str(from_str_array(NAME)))
89 | } else {
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:96:21
|
94 |
95 | fn symbol(asset: AssetId) -> Option<String> {
96 | if asset == AssetId::default() {
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
97 | Some(String::from_ascii_str(from_str_array(SYMBOL)))
98 | } else {
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:105:21
|
103 |
104 | fn decimals(asset: AssetId) -> Option<u8> {
105 | if asset == AssetId::default() {
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
106 | Some(DECIMALS)
107 | } else {
|
____
Aborting due to 5 errors.
Error: Failed to compile single_src7_asset
Here are the details of my toolchain setup:
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup
installed toolchains
--------------------
latest-aarch64-apple-darwin (default)
beta-4-aarch64-apple-darwin
latest-2023-11-15-aarch64-apple-darwin
my-custom-toolchain
active toolchain
-----------------
latest-aarch64-apple-darwin (default)
forc : 0.46.1
- forc-client
- forc-deploy : 0.46.1
- forc-run : 0.46.1
- forc-doc : 0.46.1
- forc-explore : 0.28.1
- forc-fmt : 0.46.1
- forc-index : 0.24.3
- forc-lsp : 0.46.1
- forc-tx : 0.46.1
- forc-wallet : 0.3.0
fuel-core : 0.20.5
fuel-core-keygen : Error getting version string
fuel-indexer : 0.24.3
fuels versions
---------------
forc : 0.45
forc-wallet : 0.45
Has anyone experienced a similar issue or can provide insights into what might be going wrong? Any help or suggestions would be greatly appreciated!
Thank you in advance!
opened 05:40PM - 23 Jan 24 UTC
### Describe the bug
# Issue Building Example from sway-libs Repository
… Hello Fuel community,
I recently updated my Fuel latest toolchain and fuelup, and encountered an issue while trying to build one of the examples from the sway-libs repository.
Here's what I did:
1. Cloned the sway-libs repository:
```
git clone git@github.com:FuelLabs/sway-standards.git
```
2. Navigated to the `src3-mint-burn` example:
```
cd ./sway-standards/
cd examples/src3-mint-burn/
```
3. Attempted to build the example:
```
forc build
```
However, I encountered the following error during the build process:
```
Creating a new `Forc.lock` file. (Cause: lock file did not exist)
Adding core
Adding src20
Adding src3
Adding src5
Adding src7
Adding std git+https://github.com/fuellabs/sway?tag=v0.46.1#512a3386f8961185188302f391ccc96553d23a7a
Created new lock file at /Users/alexey/Desktop/sway-standards/examples/Forc.lock
Compiling library core (/Users/alexey/.forc/git/checkouts/std-9be0d6062747ea7/512a3386f8961185188302f391ccc96553d23a7a/sway-lib-core)
Compiling library std (git+https://github.com/fuellabs/sway?tag=v0.46.1#512a3386f8961185188302f391ccc96553d23a7a)
Compiling library src7 (/Users/alexey/Desktop/sway-standards/standards/src7-metadata)
Compiling library src3 (/Users/alexey/Desktop/sway-standards/standards/src3-mint-burn)
Compiling library src20 (/Users/alexey/Desktop/sway-standards/standards/src20-native-asset)
Compiling contract single_src7_asset (/Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset)
warning
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:55:17
|
53 |
54 | #[storage(read)]
55 | fn metadata(asset: AssetId, key: String) -> Option<Metadata> {
| ----- This declaration is never used.
56 | require(asset == AssetId::default(), "Invalid AssetId provided");
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:56:26
|
54 |
55 | fn metadata(asset: AssetId, key: String) -> Option<Metadata> {
56 | require(asset == AssetId::default(), "Invalid AssetId provided");
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
57 |
58 | if key == String::from_ascii_str("social:x") {
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:78:21
|
76 |
77 | fn total_supply(asset: AssetId) -> Option<u64> {
78 | if asset == AssetId::default() {
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
79 | Some(TOTAL_SUPPLY)
80 | } else {
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:87:21
|
85 |
86 | fn name(asset: AssetId) -> Option<String> {
87 | if asset == AssetId::default() {
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
88 | Some(String::from_ascii_str(from_str_array(NAME)))
89 | } else {
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:96:21
|
94 |
95 | fn symbol(asset: AssetId) -> Option<String> {
96 | if asset == AssetId::default() {
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
97 | Some(String::from_ascii_str(from_str_array(SYMBOL)))
98 | } else {
|
____
error
--> /Users/alexey/Desktop/sway-standards/examples/src7-metadata/single_asset/src/single_asset.sw:105:21
|
103 |
104 | fn decimals(asset: AssetId) -> Option<u8> {
105 | if asset == AssetId::default() {
| ^^^^^^^^^^^^^^^^ Function "default" expects 1 argument but you provided 0.
106 | Some(DECIMALS)
107 | } else {
|
____
Aborting due to 5 errors.
Error: Failed to compile single_src7_asset
```
Here are the details of my toolchain setup:
```
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup
installed toolchains
--------------------
latest-aarch64-apple-darwin (default)
beta-4-aarch64-apple-darwin
latest-2023-11-15-aarch64-apple-darwin
my-custom-toolchain
active toolchain
-----------------
latest-aarch64-apple-darwin (default)
forc : 0.46.1
- forc-client
- forc-deploy : 0.46.1
- forc-run : 0.46.1
- forc-doc : 0.46.1
- forc-explore : 0.28.1
- forc-fmt : 0.46.1
- forc-index : 0.24.3
- forc-lsp : 0.46.1
- forc-tx : 0.46.1
- forc-wallet : 0.3.0
fuel-core : 0.20.5
fuel-core-keygen : Error getting version string
fuel-indexer : 0.24.3
fuels versions
---------------
forc : 0.45
forc-wallet : 0.45
```
Has anyone experienced a similar issue or can provide insights into what might be going wrong? Any help or suggestions would be greatly appreciated!
Thank you in advance!
### Steps to reproduce
1. Cloned the sway-libs repository:
```
git clone git@github.com:FuelLabs/sway-standards.git
```
2. Navigated to the `src3-mint-burn` example:
```
cd ./sway-standards/
cd examples/src3-mint-burn/
```
3. Attempted to build the example:
```
forc build
```
### Minimal reproducible code example
```Rust
-
```
### Rust Version
rustc 1.75.0 (82e1608df 2023-12-21)
### Forc Version
forc 0.46.1
### Expected behavior
successful build
### Additional context
_No response_
1 Like
bitzoic
January 24, 2024, 12:45am
2
It looks like you are trying to compile with forc v0.46.1. The sway-standards repository is currently up to date with forc v0.49.1.
If you’d still like to use forc v0.46.1, you can checkout the v0.2.0 release of sway-standards Release v0.2.0 · FuelLabs/sway-standards · GitHub
fuel
January 24, 2024, 11:25am
3
I got those versions after fuelup update, can you help me to update to forc v0.49.1?
^^/D/P/pyth-contract >>> fuelup show (fuels-rs-v0.54+165) 11:19:50
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup
installed toolchains
--------------------
latest-aarch64-apple-darwin (default)
beta-4-aarch64-apple-darwin
latest-2023-11-15-aarch64-apple-darwin (override)
my-custom-toolchain
active toolchain
-----------------
latest-2023-11-15-aarch64-apple-darwin (override), path: /Users/alexey/Desktop/Pyth-integration/fuel-toolchain.toml
forc : 0.47.0
- forc-client
- forc-deploy - not found
- forc-run - not found
- forc-doc - not found
- forc-explore : 0.28.1
- forc-fmt - not found
- forc-index : 0.23.0
- forc-lsp - not found
- forc-tx - not found
- forc-wallet : 0.3.0
fuel-core : 0.20.8
fuel-core-keygen : Error getting version string
fuel-indexer : 0.23.0
fuels versions
---------------
forc : 0.45
forc-wallet : 0.45
^^/D/P/pyth-contract >>> fuelup update (fuels-rs-v0.54+165) 11:19:56
updating the 'latest-aarch64-apple-darwin' toolchain
Downloading: forc forc-explore forc-index forc-wallet fuel-core fuel-core-keygen fuel-indexer
Adding component forc v0.46.1 to 'latest-aarch64-apple-darwin'
Installed forc v0.46.1 for toolchain 'latest-aarch64-apple-darwin'
Adding component forc-explore v0.28.1 to 'latest-aarch64-apple-darwin'
Installed forc-explore v0.28.1 for toolchain 'latest-aarch64-apple-darwin'
Adding component forc-index v0.24.3 to 'latest-aarch64-apple-darwin'
Installed forc-index v0.24.3 for toolchain 'latest-aarch64-apple-darwin'
Adding component forc-wallet v0.3.0 to 'latest-aarch64-apple-darwin'
Installed forc-wallet v0.3.0 for toolchain 'latest-aarch64-apple-darwin'
Adding component fuel-core v0.20.5 to 'latest-aarch64-apple-darwin'
Installed fuel-core v0.20.5 for toolchain 'latest-aarch64-apple-darwin'
Adding component fuel-core-keygen v0.20.5 to 'latest-aarch64-apple-darwin'
Installed fuel-core-keygen v0.20.5 for toolchain 'latest-aarch64-apple-darwin'
Adding component fuel-indexer v0.24.3 to 'latest-aarch64-apple-darwin'
Installed fuel-indexer v0.24.3 for toolchain 'latest-aarch64-apple-darwin'
latest updated
updated components:
- forc 0.46.1
- forc-explore 0.28.1
- forc-index 0.24.3
- forc-wallet 0.3.0
- fuel-core 0.20.5
- fuel-core-keygen 0.20.5
- fuel-indexer 0.24.3
^^/D/P/pyth-contract >>> fuelup show (fuels-rs-v0.54+165) 11:20:03
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup
installed toolchains
--------------------
latest-aarch64-apple-darwin (default)
beta-4-aarch64-apple-darwin
latest-2023-11-15-aarch64-apple-darwin (override)
my-custom-toolchain
active toolchain
-----------------
latest-2023-11-15-aarch64-apple-darwin (override), path: /Users/alexey/Desktop/Pyth-integration/fuel-toolchain.toml
forc : 0.47.0
- forc-client
- forc-deploy - not found
- forc-run - not found
- forc-doc - not found
- forc-explore : 0.28.1
- forc-fmt - not found
- forc-index : 0.23.0
- forc-lsp - not found
- forc-tx - not found
- forc-wallet : 0.3.0
fuel-core : 0.20.8
fuel-core-keygen : Error getting version string
fuel-indexer : 0.23.0
fuels versions
---------------
forc : 0.45
forc-wallet : 0.45
^^/D/P/pyth-contract >>> (fuels-rs-v0.54+165) 11:20:14
fuel
January 24, 2024, 2:00pm
4
worked with the nightly toolchain