sway
sway copied to clipboard
Lots of warnings on `forc init` -> `forc test`, considering cleanup
I'm getting a huge set of warnings when I run forc init, then forc test out of the box.
The default example and test should not have all these warnings and repeated warning statements. Default examples should be always up to date and not produce warnings.
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: constants
WARNING! unused manifest key: constants
Creating a new `Forc.lock` file. (Cause: lock file did not exist)
Adding core
Adding std git+https://github.com/fuellabs/sway?tag=v0.39.0#7a095280e7e1c0bfbbfc201867896e720aab7209
Created new lock file at /fuel-oracle/src/contracts/Forc.lock
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: project.target
WARNING! unused manifest key: constants
WARNING! unused manifest key: constants
Compiling library core (.forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core)
warning
--> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:485:21
|
483 |
484 | fn lsh(self, other: u64) -> Self {
485 | __lsh(self, other)
| ----- This cast, from integer type of width sixty four to integer type of width thirty two, will lose precision.
486 | }
487 | fn rsh(self, other: u64) -> Self {
|
____
warning
--> /.forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:488:21
|
486 |
487 | fn rsh(self, other: u64) -> Self {
488 | __rsh(self, other)
| ----- This cast, from integer type of width sixty four to integer type of width thirty two, will lose precision.
489 | }
490 | }
|
____
warning
--> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:494:21
|
492 |
493 | fn lsh(self, other: u64) -> Self {
494 | __lsh(self, other)
| ----- This cast, from integer type of width sixty four to integer type of width sixteen, will lose precision.
495 | }
496 | fn rsh(self, other: u64) -> Self {
|
____
warning
--> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:497:21
|
495 |
496 | fn rsh(self, other: u64) -> Self {
497 | __rsh(self, other)
| ----- This cast, from integer type of width sixty four to integer type of width sixteen, will lose precision.
498 | }
499 | }
|
____
warning
--> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:503:21
|
501 |
502 | fn lsh(self, other: u64) -> Self {
503 | __lsh(self, other)
| ----- This cast, from integer type of width sixty four to integer type of width eight, will lose precision.
504 | }
505 | fn rsh(self, other: u64) -> Self {
|
____
warning
--> .forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/ops.sw:506:21
|
504 |
505 | fn rsh(self, other: u64) -> Self {
506 | __rsh(self, other)
| ----- This cast, from integer type of width sixty four to integer type of width eight, will lose precision.
507 | }
508 | }
|
____
warning
--> forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-core/src/lib.sw:0:1
|
0 | library;
| - Module privacy rules will soon change to make modules private by default.
You can enable the new behavior with the --experimental-private-modules flag, which will become the default behavior in a later release.
More details are available in the related RFC: https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0008-private-modules.md
1 |
2 | pub mod primitives;
|
____
Compiled library "core" with 7 warnings.
Compiling library std (git+https://github.com/fuellabs/sway?tag=v0.39.0#7a095280e7e1c0bfbbfc201867896e720aab7209)
warning
--> forc/git/checkouts/std-9be0d6062747ea7/7a095280e7e1c0bfbbfc201867896e720aab7209/sway-lib-std/src/lib.sw:0:1
|
0 | library;
| - Module privacy rules will soon change to make modules private by default.
You can enable the new behavior with the --experimental-private-modules flag, which will become the default behavior in a later release.
More details are available in the related RFC: https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0008-private-modules.md
1 |
2 | pub mod error_signals;
|
____
Compiled library "std" with 1 warning.
Compiling contract contracts (/fuel-oracle/src/contracts)
warning
-->/fuel-oracle/src/contracts/src/main.sw:0:1
|
0 | contract;
| - Module privacy rules will soon change to make modules private by default.
You can enable the new behavior with the --experimental-private-modules flag, which will become the default behavior in a later release.
More details are available in the related RFC: https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0008-private-modules.md
1 |
2 | abi MyContract {
|
____
Compiled contract "contracts" with 1 warning.
warning
--> /fuel-oracle/src/contracts/src/main.sw:0:1
|
0 | contract;
| - Module privacy rules will soon change to make modules private by default.
You can enable the new behavior with the --experimental-private-modules flag, which will become the default behavior in a later release.
More details are available in the related RFC: https://github.com/FuelLabs/sway-rfcs/blob/master/rfcs/0008-private-modules.md
1 |
2 | abi MyContract {
|
____
Compiled contract "contracts" with 1 warning.
Finished debug in 948.981125ms
contract contracts
Bytecode size: 60 bytes
Running 0 tests
Result: OK. 0 passed. 0 failed. Finished in 0ns.
Manifest key warnings seems related to forc-pkg manifest parser. Other warnings are emitted from compiling the std lib, added appropriate tags for them. Also not sure if you are aware of it but, this output seems to be emitted from an outdated version of the forc and compiler private-modules feature is stabilized in the latest release (v0.40.1) (so there shouldn't be a warning for it)
Some of those have already been fixed in https://github.com/FuelLabs/sway/pull/4648.
@gr00vytvniks the warnings produced here are just duplicates of the same warning, you would just need to dedup them if you want to claim this issue
I think this issue is due to different warnings coming from different projects so I guess there is nothing to de-duplicate. Basically forc searches for std library after checking out sway repo. And there are couple of projects it checks before finding std library. So the warnings are actually coming from different places. For example simple_predicate which is living under docs folder here is using a deprecated feature . So they should be cleared in order to remove this warnings. This will also be solved once we mirror std and core to a different repo for faster checking as there won't be another projects to create warnings there.
Steps to close this issue:
- https://github.com/FuelLabs/sway/blob/9195d633f3626362f631f599a92c577977b93047/forc-pkg/src/manifest.rs#L501 add a prompt to print the
manifest_strso that you can see which manifests are creating this issue, One of them issimple_predicatethere are couple more of them. - You will have manifest files and warnings printed, the manifest file before the warning is the one creating that warning. So look at the name of the project
- Find that project in sway repo, and remove the unused key from its manifest file.
Basically [constants] table and target field should be removed from the manifest file.